Function at 0x40b460
Capabilities:
Query environment variable
Resolve function by parsing pe exports

Disassembly:
push ebp
mov ebp, esp
push ebx
push edi
push esi
and esp, 0xfffffff8
sub esp, 0xd8
mov esi, ecx
test edx, edx
je 0x40b49d
setns al
js 0x40bc1e
movzx edi, al
push edi
mov ebx, edx
push edx
call fcn.0040dc80
add esp, 8
test eax, eax
jne 0x40b4a4
push edi
push ebx
call fcn.005062c0
add esp, 8
ud2
mov eax, 1
mov ebx, edx
push ebx
push esi
mov esi, eax
push eax
call fcn.004f5b80
add esp, 0xc
call fcn.004c0910
lea ecx, [esp + 0x78]
push edx
push eax
push ecx
call fcn.0040d840
add esp, 0xc
mov eax, dword [esp + 0x78]
mov edx, dword [esp + 0x7c]
mov edi, ebx
mov dword [esp + 0x5c], eax
mov eax, dword [esp + 0x80]
mov dword [esp + 0x58], edx
lea ecx, [eax + eax*2]
test eax, eax
lea ecx, [edx + ecx*8]
mov dword [esp + 0x48], ecx
mov ecx, edx
je 0x40b8ce
mov eax, ecx
mov ebx, esi
mov dword [esp + 0x14], edi
jmp 0x40b50e
mov eax, dword [esp + 0x4c]
cmp eax, dword [esp + 0x48]
je 0x40b953
lea ecx, [eax + 0x18]
mov dword [esp + 0x10], edi
mov dword [esp + 0x4c], ecx
mov ecx, dword [eax + 4]
test ecx, ecx
je 0x40b8da
mov edx, dword [eax]
mov esi, dword [eax + 8]
mov edi, ebx
lea ebx, [esp + 0x3c]
mov dword [esp + 0x6c], edx
mov dword [esp + 0x70], ecx
mov dword [esp + 0x74], esi
mov ecx, dword [eax + 0xc]
mov edx, dword [eax + 0x10]
mov eax, dword [eax + 0x14]
mov dword [esp + 0x80], 0x507db8
mov dword [esp + 0x84], 2
mov dword [esp + 0x78], 0
mov dword [esp + 0x88], ebx
mov dword [esp + 0x8c], 1
mov dword [esp + 0x68], eax
lea eax, [esp + 0x6c]
mov dword [esp + 0x64], ecx
mov dword [esp + 0x54], edx
mov dword [esp + 0x3c], eax
lea eax, [esp + 0x78]
mov dword [esp + 0x40], 0x4079c0
push eax
lea eax, [esp + 0x20]
push eax
call fcn.004d1060
add esp, 8
mov eax, dword [esp + 0x1c]
mov esi, dword [esp + 0x24]
mov dword [esp + 0x60], eax
mov eax, dword [esp + 0x20]
push esi
mov dword [esp + 0x54], eax
push eax
push ebx
mov ebx, edi
call fcn.004d1a40
add esp, 0xc
mov eax, dword [esp + 0x44]
mov dword [esp + 0x18], edi
mov edx, dword [esp + 0x40]
mov edi, dword [esp + 0x10]
test eax, eax
je 0x40b620
cmp eax, edi
jae 0x40b640
cmp eax, 1
jne 0x40b654
movzx eax, byte [edx]
cmp edi, 7
ja 0x40b695
xor ecx, ecx
nop
cmp byte [ebx + ecx], al
je 0x40b620
inc ecx
cmp edi, ecx
jne 0x40b5f0
mov eax, dword [esp + 0x3c]
test eax, eax
je 0x40b864
push 1
push eax
push edx
call fcn.0040dc90
add esp, 0xc
jmp 0x40b864
mov eax, dword [esp + 0x3c]
test eax, eax
je 0x40b6cf
push 1
push eax
push edx
call fcn.0040dc90
add esp, 0xc
jmp 0x40b6cf
mov dword [esp], edx
jne 0x40b689
push edi
push ebx
push edx
call fcn.004f60f4
add esp, 0xc
test eax, eax
jmp 0x40b6a9
push eax
mov dword [esp + 4], edx
push edx
push edi
push ebx
lea ebx, [esp + 0x88]
push ebx
call fcn.004d8100
add esp, 0x14
lea ecx, [esp + 0x1c]
mov edx, ebx
call fcn.0040a2b0
cmp dword [esp + 0x1c], 0
setne bl
mov eax, dword [esp + 0x3c]
test eax, eax
jne 0x40b6b4
jmp 0x40b6c3
xor ebx, ebx
mov eax, dword [esp + 0x3c]
test eax, eax
jne 0x40b6b4
jmp 0x40b6c3
mov dword [esp], edx
movzx eax, al
push edi
push ebx
push eax
call fcn.004dbbe0
add esp, 0xc
cmp eax, 1
sete bl
mov eax, dword [esp + 0x3c]
test eax, eax
je 0x40b6c3
push 1
push eax
push dword [esp + 8]
call fcn.0040dc90
add esp, 0xc
test bl, bl
mov ebx, dword [esp + 0x18]
je 0x40b864
push esi
push dword [esp + 0x54]
lea esi, [esp + 0x44]
push esi
call fcn.004d1a40
add esp, 0xc
mov dword [esp + 4], 0
mov dword [esp + 8], 1
mov dword [esp + 0xc], 0
push edi
push ebx
push esi
lea esi, [esp + 0x84]
push esi
call fcn.004d19c0
add esp, 0x10
lea ecx, [esp + 0x1c]
mov edx, esi
call fcn.0040a2b0
cmp dword [esp + 0x1c], 0
je 0x40b7f0
xor ebx, ebx
mov esi, 1
xor edx, edx
jmp 0x40b762
mov esi, dword [esp + 8]
lea eax, [esi + ebx]
push edi
push dword [esp + 0x58]
push eax
call fcn.004f5b80
add esp, 0xc
add ebx, edi
lea ecx, [esp + 0x1c]
lea edx, [esp + 0x78]
mov dword [esp + 0xc], ebx
call fcn.0040a2b0
cmp dword [esp + 0x1c], 0
mov edx, dword [esp]
je 0x40b7e0
mov edi, dword [esp + 0x20]
mov ecx, dword [esp + 0x18]
mov eax, edx
mov eax, dword [esp + 4]
add ecx, edx
sub edi, edx
mov edx, dword [esp + 0x24]
sub eax, ebx
cmp eax, edi
mov dword [esp], edx
jb 0x40b7ba
add esi, ebx
push edi
push ecx
push esi
call fcn.004f5b80
add esp, 0xc
add ebx, edi
mov edi, dword [esp + 0x68]
mov dword [esp + 0xc], ebx
mov eax, dword [esp + 4]
sub eax, ebx
cmp eax, edi
jae 0x40b730
push edi
push ebx
lea eax, [esp + 0xc]
push eax
call fcn.00503700
add esp, 0xc
mov ebx, dword [esp + 0xc]
jmp 0x40b730
push edi
push ebx
lea eax, [esp + 0xc]
push eax
mov esi, ecx
call fcn.00503700
mov ecx, esi
add esp, 0xc
mov esi, dword [esp + 8]
mov ebx, dword [esp + 0xc]
jmp 0x40b781
mov eax, dword [esp + 4]
jmp 0x40b7fb
xor eax, eax
mov esi, 1
xor ebx, ebx
xor edx, edx
mov ecx, dword [esp + 0x18]
sub eax, ebx
add ecx, edx
mov dword [esp], ecx
mov ecx, dword [esp + 0x10]
sub ecx, edx
mov edi, ecx
cmp eax, ecx
jb 0x40b8b2
add esi, ebx
push edi
push dword [esp + 4]
push esi
call fcn.004f5b80
add esp, 0xc
mov eax, dword [esp + 0x14]
test eax, eax
je 0x40b83d
push 1
push eax
push dword [esp + 0x20]
call fcn.0040dc90
add esp, 0xc
mov eax, dword [esp + 4]
mov esi, dword [esp + 8]
mov dword [esp + 0x14], eax
mov eax, dword [esp + 0x3c]
test eax, eax
je 0x40b860
push 1
push eax
push dword [esp + 0x48]
call fcn.0040dc90
add esp, 0xc
add edi, ebx
mov ebx, esi
mov eax, dword [esp + 0x60]
test eax, eax
je 0x40b87b
push 1
push eax
push dword [esp + 0x58]
call fcn.0040dc90
add esp, 0xc
mov eax, dword [esp + 0x64]
test eax, eax
je 0x40b892
push 1
push eax
push dword [esp + 0x5c]
call fcn.0040dc90
add esp, 0xc
mov eax, dword [esp + 0x6c]
test eax, eax
je 0x40b500
push 1
push eax
push dword [esp + 0x78]
call fcn.0040dc90
add esp, 0xc
jmp 0x40b500
push edi
push ebx
lea eax, [esp + 0xc]
push eax
call fcn.00503700
add esp, 0xc
mov esi, dword [esp + 8]
mov ebx, dword [esp + 0xc]
jmp 0x40b816
mov dword [esp + 0x10], edi
mov dword [esp + 0x14], edi
mov edi, esi
jmp 0x40b8e0
mov ecx, dword [esp + 0x4c]
mov edi, ebx
mov ebx, dword [esp + 0x48]
mov esi, ecx
mov eax, ebx
sub eax, ecx
mov ecx, 0xaaaaaaab
mul ecx
mov ecx, esi
cmp ebx, esi
je 0x40b94d
mov esi, edx
add ecx, 0x10
mov ebx, edi
shr esi, 4
jmp 0x40b916
add ecx, 0x18
dec esi
je 0x40b94f
mov eax, dword [ecx - 0x10]
test eax, eax
je 0x40b931
push 1
push eax
push dword [ecx - 0xc]
mov ebx, ecx
call fcn.0040dc90
mov ecx, ebx
mov ebx, edi
add esp, 0xc
mov eax, dword [ecx - 4]
test eax, eax
je 0x40b910
push 1
push eax
push dword [ecx]
mov ebx, ecx
call fcn.0040dc90
mov ecx, ebx
mov ebx, edi
add esp, 0xc
jmp 0x40b910
mov ebx, edi
mov edi, dword [esp + 0x10]
mov eax, dword [esp + 0x5c]
test eax, eax
je 0x40b970
shl eax, 3
lea eax, [eax + eax*2]
push 4
push eax
push dword [esp + 0x60]
call fcn.0040dc90
add esp, 0xc
lea eax, [0x4fd2dc]
lea ecx, [esp + 0x78]
mov dword [esp + 0x78], eax
mov eax, dword [esp + 0x78]
mov dword [esp + 0x78], 0xa200176f
push dword [esp + 0x78]
push eax
call fcn.00401300
add esp, 8
mov ecx, 0x33578a04
lea esi, [esp + 0x1c]
xor ecx, dword [eax]
mov dword [esp + 0x1c], ecx
movzx ecx, word [eax + 4]
movzx eax, byte [eax + 6]
xor cl, 0xef
xor ch, 0xa
xor al, 0xfa
mov byte [esp + 0x20], cl
mov byte [esp + 0x21], ch
mov byte [esp + 0x22], al
push 7
push esi
lea eax, [esp + 0x80]
push eax
call fcn.004c74c0
add esp, 0xc
push 0x8000000
lea eax, [esp + 0x7c]
push eax
call fcn.004c4670
add esp, 8
lea eax, [0x4ff28d]
mov dword [esp + 0x1c], eax
mov eax, dword [esp + 0x1c]
mov dword [esp + 0x1c], 0x33374672
push dword [esp + 0x1c]
push eax
call fcn.004019a0
add esp, 8
movzx eax, word [eax]
xor al, 0xf5
xor ah, 0xc9
mov byte [esp + 0x1c], al
mov byte [esp + 0x1d], ah
push 2
push esi
lea eax, [esp + 0x80]
push eax
call fcn.004c7580
add esp, 0xc
push edi
push ebx
lea eax, [esp + 0x80]
push eax
call fcn.004c7580
add esp, 0xc
mov eax, dword [esp + 0x14]
test eax, eax
je 0x40ba53
push 1
push eax
push ebx
call fcn.0040dc90
add esp, 0xc
lea eax, [esp + 0x78]
push eax
push esi
call fcn.004c4680
add esp, 8
mov esi, dword [esp + 0x24]
cmp esi, 2
jne 0x40baa6
cmp byte [esp + 0x1c], 3
jne 0x40bae8
mov esi, dword [esp + 0x20]
mov eax, dword [esi + 4]
push dword [esi]
call dword [eax]
add esp, 4
mov eax, dword [esi + 4]
mov ecx, dword [eax + 4]
test ecx, ecx
je 0x40ba97
push dword [eax + 8]
push ecx
push dword [esi]
call fcn.0040dc90
add esp, 0xc
push 4
push 0xc
push esi
call fcn.0040dc90
add esp, 0xc
jmp 0x40bae8
mov edi, dword [sym.imp.KERNEL32.dll_CloseHandle]
push dword [esp + 0x1c]
call edi
push dword [esp + 0x20]
call edi
test esi, esi
je 0x40bac6
push dword [esp + 0x28]
call dword [sym.imp.KERNEL32.dll_CloseHandle]
cmp dword [esp + 0x2c], 0
je 0x40bad7
push dword [esp + 0x30]
call dword [sym.imp.KERNEL32.dll_CloseHandle]
cmp dword [esp + 0x34], 0
je 0x40bae8
push dword [esp + 0x38]
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov eax, dword [esp + 0x88]
test eax, eax
je 0x40bb05
push 1
push eax
push dword [esp + 0x94]
call fcn.0040dc90
add esp, 0xc
mov esi, dword [esp + 0xcc]
test esi, esi
je 0x40bb3c
mov edi, dword [esp + 0xc8]
add edi, 8
jmp 0x40bb26
add edi, 0x14
dec esi
je 0x40bb3c
mov eax, dword [edi - 4]
test eax, eax
je 0x40bb20
push 1
push eax
push dword [edi]
call fcn.0040dc90
add esp, 0xc
jmp 0x40bb20
mov eax, dword [esp + 0xc4]
test eax, eax
je 0x40bb5f
shl eax, 2
lea eax, [eax + eax*4]
push 4
push eax
push dword [esp + 0xd0]
call fcn.0040dc90
add esp, 0xc
lea eax, [esp + 0x98]
push eax
call fcn.00405280
add esp, 4
cmp byte [esp + 0x84], 2
je 0x40bb93
mov eax, dword [esp + 0x78]
test eax, eax
je 0x40bb93
push 1
push eax
push dword [esp + 0x84]
call fcn.0040dc90
add esp, 0xc
mov eax, dword [esp + 0xa8]
cmp eax, 5
ja 0x40bbdd
mov ecx, 0x27
bt ecx, eax
jae 0x40bbdd
mov eax, dword [esp + 0xb0]
cmp eax, 5
ja 0x40bbf6
mov ecx, 0x27
bt ecx, eax
jae 0x40bbf6
mov eax, dword [esp + 0xb8]
cmp eax, 5
ja 0x40bc0f
mov ecx, 0x27
bt ecx, eax
jae 0x40bc0f
lea esp, [ebp - 0xc]
pop esi
pop edi
pop ebx
pop ebp
ret
push dword [esp + 0xac]
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov eax, dword [esp + 0xb0]
cmp eax, 5
jbe 0x40bbb5
push dword [esp + 0xb4]
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov eax, dword [esp + 0xb8]
cmp eax, 5
jbe 0x40bbcb
push dword [esp + 0xbc]
call dword [sym.imp.KERNEL32.dll_CloseHandle]
jmp 0x40bbd5
call fcn.004ccfb0
ud2