Function at 0x1021d100
Capabilities:
Set environment variable

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x20
push esi
mov dword [ebp - 0x10], 0
mov dword [ebp - 0x14], 0
cmp dword [ebp + 8], 0
jne 0x1021d145
xor eax, eax
jne 0x1021d13d
push str.FALSE
push 0
push 0x5a
push str.setenv.c
push 2
call sym.MSVCR71D.dll__CrtDbgReport
add esp, 0x14
cmp eax, 1
jne 0x1021d13d
int3
or eax, 0xffffffff
jmp 0x1021d474
mov edx, dword [ebp + 8]
mov eax, dword [edx]
mov dword [ebp - 0x14], eax
cmp dword [ebp - 0x14], 0
je 0x1021d172
push 0x3d
mov ecx, dword [ebp - 0x14]
push ecx
call sym.MSVCR71D.dll__mbschr
add esp, 8
mov dword [ebp - 0x20], eax
cmp dword [ebp - 0x20], 0
je 0x1021d172
mov edx, dword [ebp - 0x14]
cmp edx, dword [ebp - 0x20]
jne 0x1021d17a
or eax, 0xffffffff
jmp 0x1021d474
mov eax, dword [ebp - 0x20]
movsx ecx, byte [eax + 1]
neg ecx
sbb ecx, ecx
inc ecx
mov dword [ebp - 0x1c], ecx
mov edx, dword [sym.MSVCR71D.dll__environ]
cmp edx, dword [sym.MSVCR71D.dll___initenv]
jne 0x1021d1aa
mov eax, dword [sym.MSVCR71D.dll__environ]
push eax
call fcn.1021d500
add esp, 4
mov dword [sym.MSVCR71D.dll__environ], eax
cmp dword [sym.MSVCR71D.dll__environ], 0
jne 0x1021d26b
cmp dword [ebp + 0xc], 0
je 0x1021d1dc
cmp dword [sym.MSVCR71D.dll__wenviron], 0
je 0x1021d1dc
call fcn.1021d010
test eax, eax
je 0x1021d1d7
or eax, 0xffffffff
jmp 0x1021d474
jmp 0x1021d26b
cmp dword [ebp - 0x1c], 0
je 0x1021d1e9
xor eax, eax
jmp 0x1021d474
cmp dword [sym.MSVCR71D.dll__environ], 0
jne 0x1021d22a
push 0x9c
push str.setenv.c
push 2
push 4
call sym.MSVCR71D.dll__malloc_dbg
add esp, 0x10
mov dword [sym.MSVCR71D.dll__environ], eax
cmp dword [sym.MSVCR71D.dll__environ], 0
jne 0x1021d21e
or eax, 0xffffffff
jmp 0x1021d474
mov ecx, dword [sym.MSVCR71D.dll__environ]
mov dword [ecx], 0
cmp dword [sym.MSVCR71D.dll__wenviron], 0
jne 0x1021d26b
push 0xa3
push str.setenv.c
push 2
push 4
call sym.MSVCR71D.dll__malloc_dbg
add esp, 0x10
mov dword [sym.MSVCR71D.dll__wenviron], eax
cmp dword [sym.MSVCR71D.dll__wenviron], 0
jne 0x1021d25f
or eax, 0xffffffff
jmp 0x1021d474
mov edx, dword [sym.MSVCR71D.dll__wenviron]
mov dword [edx], 0
mov eax, dword [sym.MSVCR71D.dll__environ]
mov dword [ebp - 8], eax
mov ecx, dword [ebp - 0x20]
sub ecx, dword [ebp - 0x14]
push ecx
mov edx, dword [ebp - 0x14]
push edx
call fcn.1021d480
add esp, 8
mov dword [ebp - 0xc], eax
cmp dword [ebp - 0xc], 0
jl 0x1021d334
mov eax, dword [ebp - 8]
cmp dword [eax], 0
je 0x1021d334
push 2
mov ecx, dword [ebp - 0xc]
mov edx, dword [ebp - 8]
mov eax, dword [edx + ecx*4]
push eax
call sym.MSVCR71D.dll__free_dbg
add esp, 8
cmp dword [ebp - 0x1c], 0
je 0x1021d31a
jmp 0x1021d2c4
mov ecx, dword [ebp - 0xc]
add ecx, 1
mov dword [ebp - 0xc], ecx
mov edx, dword [ebp - 0xc]
mov eax, dword [ebp - 8]
cmp dword [eax + edx*4], 0
je 0x1021d2e5
mov ecx, dword [ebp - 0xc]
mov edx, dword [ebp - 8]
mov eax, dword [ebp - 0xc]
mov esi, dword [ebp - 8]
mov eax, dword [esi + eax*4 + 4]
mov dword [edx + ecx*4], eax
jmp 0x1021d2bb
push 0xd1
push str.setenv.c
push 2
mov ecx, dword [ebp - 0xc]
shl ecx, 2
push ecx
mov edx, dword [sym.MSVCR71D.dll__environ]
push edx
call sym.MSVCR71D.dll__realloc_dbg
add esp, 0x14
mov dword [ebp - 8], eax
cmp dword [ebp - 8], 0
je 0x1021d318
mov eax, dword [ebp - 8]
mov dword [sym.MSVCR71D.dll__environ], eax
jmp 0x1021d32f
mov ecx, dword [ebp - 0xc]
mov edx, dword [ebp - 8]
mov eax, dword [ebp - 0x14]
mov dword [edx + ecx*4], eax
mov ecx, dword [ebp + 8]
mov dword [ecx], 0
jmp 0x1021d3ca
cmp dword [ebp - 0x1c], 0
jne 0x1021d3ac
cmp dword [ebp - 0xc], 0
jge 0x1021d348
mov edx, dword [ebp - 0xc]
neg edx
mov dword [ebp - 0xc], edx
push 0xe9
push str.setenv.c
push 2
mov eax, dword [ebp - 0xc]
lea ecx, [eax*4 + 8]
push ecx
mov edx, dword [sym.MSVCR71D.dll__environ]
push edx
call sym.MSVCR71D.dll__realloc_dbg
add esp, 0x14
mov dword [ebp - 8], eax
cmp dword [ebp - 8], 0
jne 0x1021d37f
or eax, 0xffffffff
jmp 0x1021d474
mov eax, dword [ebp - 0xc]
mov ecx, dword [ebp - 8]
mov edx, dword [ebp - 0x14]
mov dword [ecx + eax*4], edx
mov eax, dword [ebp - 0xc]
mov ecx, dword [ebp - 8]
mov dword [ecx + eax*4 + 4], 0
mov edx, dword [ebp + 8]
mov dword [edx], 0
mov eax, dword [ebp - 8]
mov dword [sym.MSVCR71D.dll__environ], eax
jmp 0x1021d3ca
push 2
mov ecx, dword [ebp - 0x14]
push ecx
call sym.MSVCR71D.dll__free_dbg
add esp, 8
mov edx, dword [ebp + 8]
mov dword [edx], 0
xor eax, eax
jmp 0x1021d474
cmp dword [ebp + 0xc], 0
je 0x1021d45d
push 0x109
push str.setenv.c
push 2
mov eax, dword [ebp - 0x14]
push eax
call sym.MSVCR71D.dll_strlen
add esp, 4
add eax, 2
push eax
call sym.MSVCR71D.dll__malloc_dbg
add esp, 0x10
mov dword [ebp - 0x18], eax
cmp dword [ebp - 0x18], 0
je 0x1021d45d
mov ecx, dword [ebp - 0x14]
push ecx
mov edx, dword [ebp - 0x18]
push edx
call sym.MSVCR71D.dll__mbscpy
add esp, 8
mov eax, dword [ebp - 0x20]
sub eax, dword [ebp - 0x14]
add eax, dword [ebp - 0x18]
mov dword [ebp - 4], eax
mov ecx, dword [ebp - 4]
mov byte [ecx], 0
mov edx, dword [ebp - 4]
add edx, 1
mov dword [ebp - 4], edx
xor eax, eax
cmp dword [ebp - 0x1c], 0
setne al
dec eax
and eax, dword [ebp - 4]
push eax
mov ecx, dword [ebp - 0x18]
push ecx
call dword [sym.imp.KERNEL32.dll_SetEnvironmentVariableA]
test eax, eax
jne 0x1021d44f
mov dword [ebp - 0x10], 0xffffffff
push 2
mov edx, dword [ebp - 0x18]
push edx
call sym.MSVCR71D.dll__free_dbg
add esp, 8
cmp dword [ebp - 0x1c], 0
je 0x1021d471
push 2
mov eax, dword [ebp - 0x14]
push eax
call sym.MSVCR71D.dll__free_dbg
add esp, 8
mov eax, dword [ebp - 0x10]
pop esi
mov esp, ebp
pop ebp
ret