Function at 0x40c884
Capabilities:
Set environment variable

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x18
mov eax, dword [ebp + 8]
push esi
xor esi, esi
cmp eax, esi
mov dword [ebp - 4], esi
jne 0x40c89c
or eax, 0xffffffff
jmp 0x40c903
push ebx
push edi
mov edi, dword [eax]
cmp edi, esi
mov dword [ebp - 0xc], edi
je 0x40c8fe
push 0x3d
push edi
call fcn.00410183
mov ebx, eax
cmp ebx, esi
pop ecx
pop ecx
je 0x40c8fe
cmp edi, ebx
je 0x40c8fe
xor eax, eax
cmp word [ebx + 2], si
sete al
mov dword [ebp - 8], eax
mov eax, dword [0x41d104]
cmp eax, dword [0x41d108]
jne 0x40c8e3
mov edi, eax
call fcn.0040c823
mov edi, dword [ebp - 0xc]
mov dword [0x41d104], eax
cmp eax, esi
jne 0x40c941
cmp dword [ebp + 0xc], esi
mov eax, dword [0x41d0fc]
je 0x40c906
cmp eax, esi
je 0x40c906
call fcn.00410101
test eax, eax
je 0x40c941
or eax, 0xffffffff
pop edi
pop ebx
pop esi
leave
ret
cmp dword [ebp - 8], esi
jne 0x40cb49
cmp eax, esi
jne 0x40c92e
push 4
call fcn.00407d2b
cmp eax, esi
pop ecx
mov dword [0x41d0fc], eax
je 0x40c8fe
mov dword [eax], esi
cmp dword [0x41d104], esi
jne 0x40c941
push 4
call fcn.00407d2b
cmp eax, esi
pop ecx
mov dword [0x41d104], eax
je 0x40c8fe
mov dword [eax], esi
mov eax, dword [0x41d104]
sub ebx, edi
sar ebx, 1
push edi
mov edi, ebx
mov dword [ebp - 0x18], eax
mov dword [ebp - 0x14], ebx
call fcn.0040c7d2
mov ebx, eax
cmp ebx, esi
pop ecx
jl 0x40c9a8
mov edi, dword [ebp - 0x18]
cmp dword [edi], esi
je 0x40c9a8
lea edi, [edi + ebx*4]
push dword [edi]
call fcn.00407eae
cmp dword [ebp - 8], esi
pop ecx
jne 0x40c98b
mov eax, dword [ebp - 0xc]
mov dword [edi], eax
mov eax, dword [ebp + 8]
mov dword [eax], esi
jmp 0x40c9e9
mov eax, dword [edi + 4]
mov dword [edi], eax
inc ebx
add edi, 4
cmp dword [edi], esi
jne 0x40c982
mov eax, ebx
shl eax, 2
push eax
push dword [0x41d104]
call fcn.0040ba4c
cmp eax, esi
pop ecx
pop ecx
je 0x40c9e9
jmp 0x40c9e4
cmp dword [ebp - 8], esi
jne 0x40cb3b
cmp ebx, esi
jge 0x40c9b7
neg ebx
lea eax, [ebx*4 + 8]
push eax
push dword [0x41d104]
call fcn.0040ba4c
cmp eax, esi
pop ecx
pop ecx
je 0x40c8fe
mov ecx, dword [ebp - 0xc]
lea ebx, [eax + ebx*4]
mov dword [ebx], ecx
mov ecx, dword [ebp + 8]
mov dword [ebx + 4], esi
mov dword [ecx], esi
mov dword [0x41d104], eax
cmp dword [ebp + 0xc], esi
je 0x40cb25
push dword [ebp - 0xc]
call fcn.00408fe9
lea eax, [eax + eax + 4]
push eax
call fcn.00407d2b
mov edi, eax
cmp edi, esi
pop ecx
pop ecx
mov dword [ebp - 0x18], edi
je 0x40cb25
push dword [ebp - 0xc]
push edi
call fcn.004100e5
mov eax, dword [ebp - 0x14]
lea ebx, [edi + eax*2]
mov word [ebx], si
inc ebx
pop ecx
inc ebx
cmp dword [0x417b40], 1
pop ecx
jne 0x40ca60
mov eax, dword [ebp - 8]
neg eax
sbb eax, eax
not eax
and eax, ebx
push eax
push edi
call dword [sym.imp.KERNEL32.dll_SetEnvironmentVariableW]
test eax, eax
jne 0x40ca60
call dword [sym.imp.KERNEL32.dll_GetLastError]
cmp eax, 0x78
jne 0x40ca5c
mov dword [0x417b40], esi
jmp 0x40ca6c
or dword [ebp - 4], 0xffffffff
cmp dword [0x417b40], esi
jne 0x40cb1e
push esi
push esi
push esi
push esi
push 0xffffffffffffffff
push edi
mov edi, dword [sym.imp.KERNEL32.dll_WideCharToMultiByte]
push esi
push esi
mov dword [ebp - 0x14], esi
mov dword [ebp - 0x10], esi
call edi
cmp eax, esi
mov dword [ebp + 8], eax
je 0x40cb05
push eax
call fcn.00407d2b
cmp eax, esi
pop ecx
mov dword [ebp - 0x14], eax
je 0x40cb05
push esi
push esi
push dword [ebp + 8]
push eax
push 0xffffffffffffffff
push dword [ebp - 0x18]
push esi
push esi
call edi
test eax, eax
je 0x40cb05
cmp dword [ebp - 8], esi
jne 0x40cae5
push esi
push esi
push esi
push esi
push 0xffffffffffffffff
push ebx
push esi
push esi
call edi
cmp eax, esi
mov dword [ebp + 8], eax
je 0x40cb05
push eax
call fcn.00407d2b
cmp eax, esi
pop ecx
mov dword [ebp - 0x10], eax
je 0x40cb05
push esi
push esi
push dword [ebp + 8]
push eax
push 0xffffffffffffffff
push ebx
push esi
push esi
call edi
test eax, eax
jne 0x40cae5
or dword [ebp - 4], 0xffffffff
cmp dword [ebp - 4], 0xffffffff
je 0x40cb09
mov eax, dword [ebp - 8]
neg eax
sbb eax, eax
not eax
and eax, dword [ebp - 0x10]
push eax
push dword [ebp - 0x14]
call dword [sym.imp.KERNEL32.dll_SetEnvironmentVariableA]
test eax, eax
jne 0x40cb09
or dword [ebp - 4], 0xffffffff
push dword [ebp - 0x10]
call fcn.00407eae
push dword [ebp - 0x14]
call fcn.00407eae
mov edi, dword [ebp - 0x18]
pop ecx
pop ecx
push edi
call fcn.00407eae
pop ecx
cmp dword [ebp - 8], esi
je 0x40cb33
push dword [ebp - 0xc]
call fcn.00407eae
pop ecx
mov eax, dword [ebp - 4]
jmp 0x40c901
push dword [ebp - 0xc]
call fcn.00407eae
mov eax, dword [ebp + 8]
pop ecx
mov dword [eax], esi
xor eax, eax
jmp 0x40c901