Function at 0x401570
Capabilities:
Query environment variable

Disassembly:
push ebp
mov ebp, esp
push edi
push esi
push ebx
sub esp, 0x38
mov edx, dword [0x402010]
cmp edx, 0xffffffff
je 0x401620
sub edx, 1
js 0x4015e9
mov eax, dword [0x405088]
xor edi, edi
mov ecx, edi
mov edi, edx
mov dword [ebp - 0x14], eax
mov eax, dword [ebp + 8]
add eax, 1
mov dword [ebp - 0x18], eax
mov eax, dword [sym.imp.ucrtbase.dll_strcmp]
mov dword [ebp - 0x1c], eax
jmp 0x4015b7
lea ecx, [ebx + 1]
cmp ecx, edi
jg 0x4015e9
lea ebx, [edi + ecx]
mov dword [ebp - 0x10], ecx
sar ebx, 1
mov esi, ebx
shl esi, 4
add esi, dword [ebp - 0x14]
lea eax, [esi + 1]
mov dword [esp + 4], eax
mov eax, dword [ebp - 0x18]
mov dword [esp], eax
mov eax, dword [ebp - 0x1c]
call eax
mov ecx, dword [ebp - 0x10]
test eax, eax
je 0x401610
jns 0x4015b0
lea edi, [ebx - 1]
cmp ecx, edi
jle 0x4015b7
mov edx, dword [ebp + 8]
movzx eax, byte [0x402014]
cmp byte [edx], 0
js 0x401600
lea esp, [ebp - 0xc]
pop ebx
pop esi
pop edi
pop ebp
ret
mov edx, dword [ebp + 8]
mov byte [edx], al
lea esp, [ebp - 0xc]
pop ebx
pop esi
pop edi
pop ebp
ret
movzx eax, byte [esi]
lea esp, [ebp - 0xc]
pop ebx
pop esi
pop edi
pop ebp
ret
mov dword [esp], str.WINEDEBUG
call dword [sym.imp.ucrtbase.dll_getenv]
mov dword [0x402010], 0
test eax, eax
je 0x4015e9
mov dword [esp], eax
call dword [sym.imp.ucrtbase.dll__strdup]
mov dword [ebp - 0x2c], eax
test eax, eax
je 0x401776
mov ebx, dword [ebp - 0x2c]
lea esi, [esi]
mov dword [esp + 4], 0x2c
mov dword [esp], ebx
call dword [sym.imp.ucrtbase.dll_strchr]
mov dword [ebp - 0x10], 0
test eax, eax
je 0x40167d
lea edx, [eax + 1]
mov byte [eax], 0
mov dword [ebp - 0x10], edx
mov dword [esp + 4], 0x40305a
mov dword [esp], ebx
call dword [sym.imp.ucrtbase.dll_strcspn]
lea edx, [ebx + eax]
mov esi, eax
movzx edi, byte [edx]
mov eax, edi
test al, al
je 0x401710
cmp edx, ebx
jbe 0x4017a0
mov dword [ebp - 0x14], edx
xor ecx, ecx
mov edx, edi
mov eax, 5
mov byte [ebp - 0x18], dl
mov edi, ecx
cmp esi, eax
jne 0x4016d8
mov eax, dword [edi*4 + 0x4030e4]
mov dword [esp + 8], esi
mov dword [esp], ebx
mov dword [esp + 4], eax
call sym._memcmp
test eax, eax
je 0x4018b4
add edi, 1
cmp edi, 4
je 0x401700
mov eax, dword [edi*4 + 0x4030e4]
mov dword [esp], eax
call dword [sym.imp.ucrtbase.dll_strlen]
cmp esi, eax
je 0x4016b9
add edi, 1
cmp edi, 4
jne 0x4016e0
lea esi, [esi]
mov eax, dword [ebp - 0x10]
test eax, eax
je 0x40176a
mov ebx, dword [ebp - 0x10]
jmp 0x401658
movzx edi, byte [ebx]
mov eax, edi
cmp al, 0x2d
je 0x401788
lea eax, [edi - 0x2b]
and eax, 0xfd
mov byte [ebp - 0x14], al
je 0x401830
mov byte [ebp - 0x1c], 0xff
mov byte [ebp - 0x14], 0
mov eax, edi
test al, al
je 0x401700
mov edi, 0x40305d
mov ecx, 4
mov esi, ebx
repe cmpsb byte [esi], byte es:[edi]
seta al
sbb al, 0
test al, al
jne 0x4017b0
movzx eax, byte [ebp - 0x14]
not eax
and al, byte [0x402014]
or al, byte [ebp - 0x1c]
mov byte [0x402014], al
mov eax, dword [ebp - 0x10]
test eax, eax
jne 0x401707
mov eax, dword [ebp - 0x2c]
mov dword [esp], eax
call dword [sym.imp.ucrtbase.dll_free]
mov edx, dword [0x402010]
jmp 0x401588
mov byte [ebp - 0x14], 0xff
mov byte [ebp - 0x1c], 0
mov edx, ebx
movzx edi, byte [edx + 1]
lea ebx, [edx + 1]
jmp 0x401732
mov ebx, edx
jmp 0x401713
mov dword [esp], ebx
call dword [sym.imp.ucrtbase.dll_strlen]
mov dword [ebp - 0x34], eax
cmp eax, 0xe
ja 0x401700
mov eax, dword [0x402010]
mov edx, dword [0x405088]
mov dword [ebp - 0x30], eax
sub eax, 1
mov dword [ebp - 0x20], edx
mov ecx, eax
js 0x4019c4
mov eax, dword [sym.imp.ucrtbase.dll_strcmp]
xor edi, edi
mov dword [ebp - 0x24], ebx
mov edx, edi
mov edi, ecx
mov dword [ebp - 0x28], eax
jmp 0x4017ff
lea edx, [esi + 1]
cmp edx, edi
jg 0x40184d
lea esi, [edi + edx]
mov dword [ebp - 0x18], edx
sar esi, 1
mov ebx, esi
shl ebx, 4
add ebx, dword [ebp - 0x20]
lea eax, [ebx + 1]
mov dword [esp + 4], eax
mov eax, dword [ebp - 0x24]
mov dword [esp], eax
mov eax, dword [ebp - 0x28]
call eax
mov edx, dword [ebp - 0x18]
test eax, eax
je 0x40183b
jns 0x4017f8
lea edi, [esi - 1]
jmp 0x4017fb
mov byte [ebp - 0x1c], 0xff
mov edx, ebx
jmp 0x401792
movzx eax, byte [ebp - 0x14]
not eax
and al, byte [ebx]
or al, byte [ebp - 0x1c]
mov byte [ebx], al
jmp 0x401700
mov esi, edx
mov ebx, dword [ebp - 0x24]
mov edi, edx
mov ecx, edx
shl esi, 4
mov eax, dword [0x40508c]
cmp dword [ebp - 0x30], eax
jge 0x401926
add esi, dword [ebp - 0x20]
cmp edi, dword [ebp - 0x30]
jl 0x40198f
mov eax, dword [ebp - 0x34]
lea ecx, [esi + 1]
add eax, 1
cmp eax, 4
jae 0x4018ee
test eax, eax
je 0x401893
movzx edx, byte [ebx]
mov byte [esi + 1], dl
test al, 2
jne 0x4019f5
movzx eax, byte [ebp - 0x14]
not eax
and al, byte [0x402014]
or al, byte [ebp - 0x1c]
mov byte [esi], al
mov eax, dword [ebp - 0x30]
add eax, 1
mov dword [0x402010], eax
jmp 0x401700
mov ecx, edi
movzx edi, byte [ebp - 0x18]
mov eax, 1
mov edx, dword [ebp - 0x14]
shl eax, cl
mov ecx, edi
mov byte [ebp - 0x14], al
cmp cl, 0x2b
je 0x4019b6
lea eax, [edi - 0x2b]
and eax, 0xfd
mov byte [ebp - 0x1c], al
je 0x401792
mov byte [ebp - 0x1c], 0
mov ebx, edx
jmp 0x401738
mov edx, dword [ebx]
mov dword [esi + 1], edx
mov edx, dword [ebx + eax - 4]
mov dword [ecx + eax - 4], edx
lea edx, [esi + 5]
and edx, 0xfffffffc
sub ecx, edx
add eax, ecx
sub ebx, ecx
and eax, 0xfffffffc
cmp eax, 4
jb 0x401893
and eax, 0xfffffffc
xor ecx, ecx
mov edi, dword [ebx + ecx]
mov dword [edx + ecx], edi
add ecx, 4
cmp ecx, eax
jb 0x401914
jmp 0x401893
add eax, eax
mov edx, 0x10
mov dword [ebp - 0x18], ecx
cmp eax, 0x10
cmovl eax, edx
mov edx, dword fs:[0x18]
mov dword [0x40508c], eax
shl eax, 4
cmp dword [ebp - 0x20], 0
je 0x4019cf
mov dword [esp + 0xc], eax
mov eax, dword [ebp - 0x20]
mov dword [esp + 4], 0
mov dword [esp + 8], eax
mov eax, dword [edx + 0x30]
mov eax, dword [eax + 0x18]
mov dword [esp], eax
call dword [sym.imp.kernel32.dll_HeapReAlloc]
mov ecx, dword [ebp - 0x18]
mov dword [ebp - 0x20], eax
sub esp, 0x10
mov eax, dword [ebp - 0x20]
mov dword [0x405088], eax
mov eax, dword [0x402010]
mov dword [ebp - 0x30], eax
jmp 0x401867
mov eax, dword [ebp - 0x30]
mov dword [esp + 4], esi
sub eax, edi
shl eax, 4
mov dword [esp + 8], eax
lea eax, [ecx + 1]
shl eax, 4
add eax, dword [ebp - 0x20]
mov dword [esp], eax
call dword [sym.imp.ucrtbase.dll_memmove]
jmp 0x401873
mov byte [ebp - 0x1c], al
mov ebx, edx
mov byte [ebp - 0x14], 0
jmp 0x401790
xor esi, esi
xor ecx, ecx
xor edi, edi
jmp 0x401859
mov dword [esp + 8], eax
mov dword [esp + 4], 0
mov eax, dword [edx + 0x30]
mov eax, dword [eax + 0x18]
mov dword [esp], eax
call dword [sym.imp.kernel32.dll_HeapAlloc]
mov ecx, dword [ebp - 0x18]
mov dword [ebp - 0x20], eax
sub esp, 0xc
jmp 0x40197a
movzx edx, word [ebx + eax - 2]
mov word [ecx + eax - 2], dx
jmp 0x401893