Function at 0x406840
Capabilities:
Query environment variable

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x28
push esi
mov esi, dword [ebp + 8]
xorps xmm0, xmm0
movlpd qword [ebp - 0x10], xmm0
test esi, esi
je 0x406adc
cmp dword [ebp + 0xc], 0
je 0x406adc
cmp word [esi], 0x25
je 0x406871
xor eax, eax
pop esi
mov esp, ebp
pop ebp
ret
mov ecx, esi
lea edx, [ecx + 2]
mov ax, word [ecx]
add ecx, 2
test ax, ax
jne 0x406876
sub ecx, edx
sar ecx, 1
lea ecx, [ecx*2 + 2]
test ecx, ecx
je 0x406ad2
push ecx
call fcn.005369fe
mov edx, eax
add esp, 4
mov dword [ebp - 4], edx
test edx, edx
je 0x406ad2
mov ecx, esi
push edi
lea edi, [ecx + 2]
mov ax, word [ecx]
add ecx, 2
test ax, ax
jne 0x4068b0
sub ecx, edi
sar ecx, 1
push ebx
lea eax, [ecx*2 + 2]
push eax
push 0
push edx
call fcn.00537300
xorps xmm0, xmm0
mov edi, esi
push 0x25
push esi
movlpd qword [ebp - 0x24], xmm0
call fcn.00536376
add esp, 0x14
test eax, eax
je 0x406abd
mov esi, dword [ebp - 0x20]
mov ebx, dword [ebp - 0x24]
push 0x25
push edi
call fcn.00536376
add ebx, 1
push 0x25
adc esi, 0
lea edi, [eax + 2]
push edi
call fcn.00536376
add esp, 0x10
test eax, eax
jne 0x4068f3
mov dword [ebp - 0x28], edi
cmp ebx, 2
jne 0x406abd
test esi, esi
jne 0x406abd
mov edx, dword [ebp + 8]
xorps xmm0, xmm0
mov ecx, edx
movlpd qword [ebp - 0x24], xmm0
movlpd qword [ebp - 0x18], xmm0
lea esi, [ecx + 2]
lea esp, [esp]
mov ax, word [ecx]
add ecx, 2
test ax, ax
jne 0x406940
mov ebx, dword [ebp - 4]
sub ecx, esi
sar ecx, 1
je 0x4069e4
mov eax, dword [ebp - 0x14]
mov ecx, dword [ebp - 0x24]
mov esi, dword [ebp - 0x18]
mov edi, dword [ebp - 0x20]
mov dword [ebp + 8], eax
mov eax, dword [ebp - 0xc]
mov dword [ebp - 0x14], eax
mov eax, dword [ebp - 0x10]
mov dword [ebp - 0x1c], 0x25
mov dword [ebp - 0xc], eax
mov dword [ebp - 8], ecx
jmp 0x406983
mov ecx, dword [ebp - 8]
cmp ecx, 2
jne 0x40698c
test edi, edi
je 0x4069e1
movzx eax, word [edx + esi*2]
cmp word [ebp - 0x1c], ax
je 0x4069a9
mov ecx, dword [ebp - 0xc]
mov word [ebx + ecx*2], ax
add ecx, 1
mov dword [ebp - 0xc], ecx
adc dword [ebp - 0x14], 0
jmp 0x4069b2
add ecx, 1
mov dword [ebp - 8], ecx
adc edi, 0
mov ecx, edx
add esi, 1
adc dword [ebp + 8], 0
lea eax, [ecx + 2]
mov dword [ebp - 0x20], eax
mov ax, word [ecx]
add ecx, 2
test ax, ax
jne 0x4069c1
sub ecx, dword [ebp - 0x20]
mov eax, dword [ebp + 8]
sar ecx, 1
test eax, eax
jb 0x406980
ja 0x4069e1
cmp esi, ecx
mov ecx, dword [ebp - 8]
jb 0x406983
mov edi, dword [ebp - 0x28]
push 0x800
call fcn.005369fe
mov esi, eax
add esp, 4
test esi, esi
je 0x406a6f
mov ebx, dword [ebp - 4]
push 0x400
push esi
push ebx
call dword [sym.imp.KERNEL32.dll_GetEnvironmentVariableW]
mov dword [ebp + 8], eax
test eax, eax
je 0x406a4a
cmp eax, 0x400
jbe 0x406a84
push esi
call fcn.005369c6
mov eax, dword [ebp + 8]
add esp, 4
lea eax, [eax*2 + 2]
test eax, eax
je 0x406a6f
push eax
call fcn.005369fe
mov esi, eax
add esp, 4
test esi, esi
je 0x406a6f
push dword [ebp + 8]
push esi
push ebx
call dword [sym.imp.KERNEL32.dll_GetEnvironmentVariableW]
test eax, eax
jne 0x406a84
push ebx
call fcn.005369c6
push esi
call fcn.005369c6
add esp, 8
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
call fcn.00406590
add esp, 4
pop ebx
pop edi
pop esi
mov esp, ebp
pop ebp
ret
push ebx
call fcn.005369c6
add esp, 4
pop ebx
pop edi
mov eax, 3
pop esi
mov esp, ebp
pop ebp
ret
push ebx
call fcn.005369c6
push esi
call fcn.00408e70
mov ebx, dword [ebp + 0xc]
push esi
mov dword [ebx], eax
call fcn.005369c6
add esp, 0xc
cmp dword [ebx], 0
je 0x406a78
xor eax, eax
cmp ax, word [edi]
je 0x406ab4
push edi
push ebx
call fcn.00408ba0
add esp, 8
pop ebx
pop edi
xor eax, eax
pop esi
mov esp, ebp
pop ebp
ret
mov ebx, dword [ebp - 4]
push ebx
call fcn.005369c6
add esp, 4
xor eax, eax
pop ebx
pop edi
pop esi
mov esp, ebp
pop ebp
ret
mov eax, 3
pop esi
mov esp, ebp
pop ebp
ret
mov eax, 1
pop esi
mov esp, ebp
pop ebp
ret