Function at 0x10165040
Capabilities:
Query environment variable

Disassembly:
push ebp
mov ebp, esp
push ebx
push edi
push esi
sub esp, 0x438
mov ebx, dword [ebp + 8]
mov edx, dword [ebp + 0xc]
lea ecx, [ebp - 0x444]
push dword [ebp + 0x10]
call fcn.1017e3a0
add esp, 4
mov eax, dword [ebp - 0x444]
test eax, eax
mov dword [ebp - 0x20], eax
je 0x10165168
mov eax, dword [ebp - 0x440]
mov esi, 0x200
mov dword [ebp - 0x34], 2
mov dword [ebp - 0x30], 0
mov dword [ebp - 0x2c], 0
mov dword [ebp - 0x14], 0
mov dword [ebp - 0x18], 2
mov dword [ebp - 0x10], 0
mov dword [ebp - 0x24], eax
cmp esi, 0x201
jae 0x101650e0
jmp 0x101650ce
jbe 0x101651bb
cmp esi, 0x201
jae 0x101650e0
mov dword [ebp - 0x28], 0x200
lea ebx, [ebp - 0x444]
mov edi, esi
jmp 0x10165114
mov edi, dword [ebp - 0x14]
mov eax, dword [ebp - 0x10]
sub esi, edi
sub eax, edi
cmp eax, esi
jae 0x10165105
mov edx, edi
lea ecx, [ebp - 0x34]
push esi
call fcn.10150480
add esp, 4
mov eax, dword [ebp - 0x34]
mov edi, dword [ebp - 0x30]
mov dword [ebp - 0x18], eax
mov ebx, dword [ebp - 0x18]
mov dword [ebp - 0x2c], edi
mov dword [ebp - 0x10], edi
mov dword [ebp - 0x28], edi
mov dword [ebp - 0x14], edi
push 0
call sub.KERNEL32.dll_SetLastError
push edi
push ebx
push dword [ebp - 0x20]
call sub.KERNEL32.dll_GetEnvironmentVariableW
mov esi, eax
test eax, eax
jne 0x10165138
call sub.KERNEL32.dll_GetLastError
test eax, eax
jne 0x101652a0
cmp esi, edi
jne 0x101650c0
call sub.KERNEL32.dll_GetLastError
cmp eax, 0x7a
jne 0x101652ba
lea esi, [edi + edi]
test edi, edi
mov eax, 0xffffffff
cmovs esi, eax
cmp esi, 0x201
jb 0x101650ce
jmp 0x101650e0
cmp byte [ebp - 0x440], 3
jne 0x101651b2
mov edi, dword [ebp - 0x43c]
mov esi, dword [edi + 4]
mov ebx, dword [edi]
mov eax, dword [esi]
push ebx
call eax
add esp, 4
cmp dword [esi + 4], 0
je 0x101651a1
cmp dword [esi + 8], 9
jb 0x10165193
mov ebx, dword [ebx - 4]
push ebx
push 0
push dword [0x1048f0f8]
call sub.KERNEL32.dll_HeapFree
push edi
push 0
push dword [0x1048f0f8]
call sub.KERNEL32.dll_HeapFree
mov ebx, dword [ebp + 8]
mov byte [ebx + 0xc], 2
jmp 0x10165293
mov eax, dword [ebp - 0x28]
cmp esi, eax
ja 0x101652d0
lea eax, [ebp - 0x44]
push esi
push ebx
push eax
call fcn.10169f90
add esp, 0xc
mov eax, dword [ebp - 0x3c]
movzx edx, word [ebp - 0x37]
movzx ecx, byte [ebp - 0x35]
mov esi, dword [ebp - 0x44]
mov edi, dword [ebp - 0x40]
movzx ebx, byte [ebp - 0x38]
mov dword [ebp - 0x10], eax
mov word [ebp - 0x1c], dx
mov byte [ebp - 0x1a], cl
cmp dword [ebp - 0x14], 0
je 0x10165209
push dword [ebp - 0x18]
push 0
push dword [0x1048f0f8]
call sub.KERNEL32.dll_HeapFree
cmp bl, 2
jne 0x1016525c
mov ebx, dword [ebp + 8]
mov eax, esi
cmp al, 3
mov byte [ebx + 0xc], 2
jne 0x1016527d
mov eax, edi
mov edi, dword [edi]
mov esi, dword [eax + 4]
mov dword [ebp - 0x14], eax
mov eax, dword [esi]
push edi
call eax
add esp, 4
cmp dword [esi + 4], 0
je 0x1016524a
cmp dword [esi + 8], 9
jb 0x1016523c
mov edi, dword [edi - 4]
push edi
push 0
push dword [0x1048f0f8]
call sub.KERNEL32.dll_HeapFree
push dword [ebp - 0x14]
push 0
push dword [0x1048f0f8]
call sub.KERNEL32.dll_HeapFree
jmp 0x1016527d
movzx eax, word [ebp - 0x1c]
mov ecx, dword [ebp + 8]
mov bh, byte [ebp - 0x1a]
mov edx, dword [ebp - 0x10]
mov word [ecx + 0xd], ax
mov byte [ecx + 0xf], bh
mov dword [ecx], esi
mov dword [ecx + 4], edi
mov dword [ecx + 8], edx
mov byte [ecx + 0xc], bl
mov ebx, ecx
cmp dword [ebp - 0x24], 0
je 0x10165293
push dword [ebp - 0x20]
push 0
push dword [0x1048f0f8]
call sub.KERNEL32.dll_HeapFree
mov eax, ebx
add esp, 0x438
pop esi
pop edi
pop ebx
pop ebp
ret
xor esi, esi
mov bl, 2
call sub.KERNEL32.dll_GetLastError
mov edi, eax
cmp dword [ebp - 0x14], 0
jne 0x101651f9
jmp 0x10165209
push 0x1043b1dc
push 0x28
push str.internal_error:_entered_unreachable_codel
call fcn.10027330
add esp, 0xc
jmp 0x101652df
push 0x1043b1cc
push eax
push esi
call fcn.1002ac30
add esp, 0xc
ud2