Function at 0x40da40
Capabilities:
Query environment variable
Set environment variable

Disassembly:
push ebp
mov ebp, esp
sub esp, 0xec
push edi
push esi
push ebx
mov ebx, dword [ebp + 8]
add esp, 0xfffffff4
push 0x7d0
call fcn.00417610
mov dword [ebp - 0xd4], eax
mov edi, ebx
mov al, 0
cld
mov ecx, 0xffffffff
repne scasb al, byte es:[edi]
not ecx
lea esi, [ebx + ecx - 0xa]
mov edi, 0x40d9e7
mov ecx, 0xa
cld
xor eax, eax
repe cmpsb byte [esi], byte es:[edi]
je 0x40da89
sbb eax, eax
or al, 1
add esp, 0x10
test eax, eax
jne 0x40daa4
mov edi, ebx
mov al, 0
cld
mov ecx, 0xffffffff
repne scasb al, byte es:[edi]
not ecx
lea edi, [ecx - 0xb]
jmp 0x40dab5
mov edi, ebx
mov al, 0
cld
mov ecx, 0xffffffff
repne scasb al, byte es:[edi]
not ecx
lea edi, [ecx - 0xa]
add esp, 0xfffffffc
push edi
push ebx
mov eax, dword [ebp - 0xd4]
push eax
call sub.msvcrt.dll_strncpy
mov eax, dword [ebp - 0xd4]
mov byte [edi + eax], 0
add esp, 0xfffffff4
push 0x4000
call fcn.00417610
mov esi, eax
add esp, 0x20
add esp, 0xfffffff4
push 0x4000
call fcn.00417610
mov dword [ebp - 0xd8], eax
add esp, 0xfffffffc
push 0x4000
push eax
push 0x40d9f1
call sub.KERNEL32.dll_GetEnvironmentVariableA
add esp, 0xfffffffc
mov eax, dword [ebp - 0xd8]
push eax
push esi
call sub.msvcrt.dll_strcpy
add esp, 0x20
add esp, 0xfffffff8
push 0x40cc59
push esi
call sub.msvcrt.dll_strcat
add esp, 0xfffffff8
mov eax, dword [ebp - 0xd4]
push eax
push esi
call sub.msvcrt.dll_strcat
add esp, 0x20
add esp, 0xfffffff8
push esi
push 0x40d9f1
call sub.KERNEL32.dll_SetEnvironmentVariableA
add esp, 8
test eax, eax
je 0x40db5c
add esp, 0xfffffff8
push esi
push 0x40d9f6
jmp 0x40db6b
add esp, 0xfffffffc
call sub.KERNEL32.dll_GetLastError
push eax
push esi
push 0x40da10
call fcn.0040874c
add esp, 0x10
add esp, 0xfffffff4
push 0x4000
call fcn.00417610
mov dword [ebp - 0xdc], eax
add esp, 0xfffffffc
push esi
push 0x40da35
push eax
call sub.msvcrt.dll_sprintf
add esp, 0x20
add esp, 0xfffffff4
mov eax, dword [ebp - 0xdc]
push eax
call sub.msvcrt.dll__putenv
mov dword [ebp - 0xe0], 0
add esp, 0xfffffffc
push 0xc8
lea ebx, [ebp - 0xd0]
push ebx
push 0x98
call fcn.00401aa8
mov edi, ebx
mov al, 0
cld
mov ecx, 0xffffffff
repne scasb al, byte es:[edi]
add esp, 0x20
cmp ecx, 0xfffffffe
je 0x40dbf7
add esp, 0xfffffff8
push ebx
mov eax, dword [ebp - 0xd4]
push eax
call fcn.0040d934
mov dword [ebp - 0xe0], eax
add esp, 0x10
xor ebx, ebx
cmp dword [ebp - 0xe0], 0
jne 0x40dcb2
mov esi, esi
add esp, 0xfffffff8
push dword [ebx*4 + 0x40dee0]
mov eax, dword [ebp - 0xd4]
push eax
call fcn.0040d934
mov dword [ebp - 0xe0], eax
add esp, 0x10
inc ebx
cmp ebx, 4
jg 0x40dc31
test eax, eax
je 0x40dc08
cmp dword [ebp - 0xe0], 0
jne 0x40dcb2
add esp, 0xfffffff8
mov eax, dword [ebp - 0xd8]
push eax
push 0x40d9f1
call sub.KERNEL32.dll_SetEnvironmentVariableA
add esp, 8
test eax, eax
je 0x40dc68
add esp, 0xfffffff8
mov eax, dword [ebp - 0xd8]
push eax
push 0x40d9f6
jmp 0x40dc7d
add esp, 0xfffffffc
call sub.KERNEL32.dll_GetLastError
push eax
mov eax, dword [ebp - 0xd8]
push eax
push 0x40da10
call fcn.0040874c
add esp, 0x10
add esp, 0xfffffffc
mov eax, dword [ebp - 0xd8]
push eax
push 0x40da35
mov eax, dword [ebp - 0xdc]
push eax
call sub.msvcrt.dll_sprintf
add esp, 0xfffffff4
mov eax, dword [ebp - 0xdc]
push eax
call sub.msvcrt.dll__putenv
add esp, 0x20
add esp, 0xfffffff4
push esi
call fcn.0041772c
add esp, 0xfffffff4
mov eax, dword [ebp - 0xd8]
push eax
call fcn.0041772c
add esp, 0x20
add esp, 0xfffffff4
mov eax, dword [ebp - 0xdc]
push eax
call fcn.0041772c
add esp, 0xfffffff4
mov eax, dword [ebp - 0xd4]
push eax
call fcn.0041772c
mov eax, dword [ebp - 0xe0]
lea esp, [ebp - 0xf8]
pop ebx
pop esi
pop edi
leave
ret