Function at 0x102228c0
Capabilities:
Set environment variable

Disassembly:
sub esp, 4
cmp dword [esp + 8], 0
push ebx
push esi
push edi
push ebp
je 0x10222afe
mov edx, dword [esp + 0x18]
push 0x3d
push edx
call sym.MSVCRT40.dll__mbschr
add esp, 8
mov ebp, eax
test ebp, ebp
je 0x10222afe
cmp ebp, dword [esp + 0x18]
je 0x10222afe
cmp byte [ebp + 1], 1
sbb eax, eax
mov ecx, dword [sym.MSVCRT40.dll__environ]
neg eax
mov dword [esp + 0x10], eax
cmp dword [sym.MSVCRT40.dll___initenv], ecx
jne 0x1022291d
push ecx
call fcn.10222b70
add esp, 4
mov dword [sym.MSVCRT40.dll__environ], eax
cmp dword [sym.MSVCRT40.dll__environ], 0
jne 0x102229cd
cmp dword [esp + 0x1c], 0
je 0x10222954
cmp dword [sym.MSVCRT40.dll__wenviron], 0
je 0x10222954
call fcn.10222830
test eax, eax
je 0x102229cd
mov eax, 0xffffffff
pop ebp
pop edi
pop esi
pop ebx
add esp, 4
ret
cmp dword [esp + 0x10], 0
je 0x10222965
xor eax, eax
pop ebp
pop edi
pop esi
pop ebx
add esp, 4
ret
cmp dword [sym.MSVCRT40.dll__environ], 0
jne 0x10222999
push 4
call sym.MSVCRT40.dll_malloc
add esp, 4
mov dword [sym.MSVCRT40.dll__environ], eax
test eax, eax
jne 0x1022298e
mov eax, 0xffffffff
pop ebp
pop edi
pop esi
pop ebx
add esp, 4
ret
mov eax, dword [sym.MSVCRT40.dll__environ]
mov dword [eax], 0
cmp dword [sym.MSVCRT40.dll__wenviron], 0
jne 0x102229cd
push 4
call sym.MSVCRT40.dll_malloc
add esp, 4
mov dword [sym.MSVCRT40.dll__wenviron], eax
test eax, eax
jne 0x102229c2
mov eax, 0xffffffff
pop ebp
pop edi
pop esi
pop ebx
add esp, 4
ret
mov eax, dword [sym.MSVCRT40.dll__wenviron]
mov dword [eax], 0
mov esi, dword [sym.MSVCRT40.dll__environ]
sub ebp, dword [esp + 0x18]
mov edx, dword [esp + 0x18]
push ebp
push edx
call fcn.10222b10
add esp, 8
mov edi, eax
test edi, edi
jl 0x10222a35
cmp dword [esi], 0
je 0x10222a35
cmp dword [esp + 0x10], 0
je 0x10222a2c
lea ebx, [esi + edi*4]
mov eax, dword [ebx]
push eax
call sym.MSVCRT40.dll_free
add esp, 4
cmp dword [ebx], 0
je 0x10222a19
mov eax, dword [ebx + 4]
add ebx, 4
inc edi
mov dword [ebx - 4], eax
cmp dword [ebx], 0
jne 0x10222a0a
shl edi, 2
push edi
push esi
call sym.MSVCRT40.dll_realloc
add esp, 8
test eax, eax
je 0x10222a7d
jmp 0x10222a78
mov edx, dword [esp + 0x18]
mov dword [esi + edi*4], edx
jmp 0x10222a7d
cmp dword [esp + 0x10], 0
jne 0x10222af4
test edi, edi
jge 0x10222a46
neg edi
lea eax, [edi*4 + 8]
push eax
push esi
call sym.MSVCRT40.dll_realloc
add esp, 8
test eax, eax
jne 0x10222a68
mov eax, 0xffffffff
pop ebp
pop edi
pop esi
pop ebx
add esp, 4
ret
lea ecx, [eax + edi*4]
mov edx, dword [esp + 0x18]
mov dword [ecx], edx
mov dword [ecx + 4], 0
mov dword [sym.MSVCRT40.dll__environ], eax
cmp dword [esp + 0x1c], 0
je 0x10222aea
mov edi, dword [esp + 0x18]
mov ecx, 0xffffffff
sub eax, eax
repne scasb al, byte es:[edi]
not ecx
inc ecx
push ecx
call sym.MSVCRT40.dll_malloc
add esp, 4
mov ebx, eax
test ebx, ebx
je 0x10222aea
mov edi, dword [esp + 0x18]
mov ecx, 0xffffffff
sub eax, eax
repne scasb al, byte es:[edi]
not ecx
sub edi, ecx
mov eax, ecx
shr ecx, 2
mov esi, edi
mov edi, ebx
rep movsd dword es:[edi], dword [esi]
mov ecx, eax
and ecx, 3
rep movsb byte es:[edi], byte [esi]
cmp dword [esp + 0x10], 1
sbb eax, eax
lea ecx, [ebp + ebx]
mov byte [ecx], 0
lea ecx, [ecx + 1]
and eax, ecx
push eax
push ebx
call dword [sym.imp.KERNEL32.dll_SetEnvironmentVariableA]
push ebx
call sym.MSVCRT40.dll_free
add esp, 4
xor eax, eax
pop ebp
pop edi
pop esi
pop ebx
add esp, 4
ret
xor eax, eax
pop ebp
pop edi
pop esi
pop ebx
add esp, 4
ret
mov eax, 0xffffffff
pop ebp
pop edi
pop esi
pop ebx
add esp, 4
ret