Function at 0x4021f0
Capabilities:
Check for peb beingdebugged flag
Check if file exists
Get file attributes
Get process heap flags
Query environment variable

Disassembly:
push ebp
mov ebp, esp
push edi
push esi
push ebx
push eax
mov eax, 0x88b8
call fcn.00401048
sub esp, eax
mov eax, dword [esp + eax]
mov dword [ebp - 0x88a0], edx
mov dword [esp + 4], 0x405066
mov esi, eax
mov dword [esp], eax
call dword [sym.imp.ucrtbase.dll_wcspbrk]
test eax, eax
je 0x4027a4
mov eax, dword [sym.imp.kernel32.dll_GetFullPathNameW]
lea ebx, [ebp - 0x8018]
mov dword [esp], esi
mov dword [esp + 0xc], 0
mov dword [esp + 8], ebx
mov dword [esp + 4], 0x2000
mov dword [ebp - 0x889c], eax
call eax
sub esp, 0x10
mov dword [esp + 4], 0x5c
mov dword [esp], ebx
call dword [sym.imp.ucrtbase.dll_wcsrchr]
mov dword [ebp - 0x8898], 0
mov esi, eax
test eax, eax
je 0x402294
mov dword [esp + 4], 0x2e
mov dword [esp], eax
call dword [sym.imp.ucrtbase.dll_wcschr]
test eax, eax
setne al
movzx eax, al
mov dword [ebp - 0x8898], eax
lea ecx, [ebp - 0x8678]
xor eax, eax
mov dword [ebp - 0x8894], ecx
lea esi, [esi]
movzx edx, word [esi + eax + 2]
mov word [ecx + eax], dx
add eax, 2
test dx, dx
jne 0x4022a8
mov word [esi + 2], 0
mov edi, dword [sym.imp.kernel32.dll_GetEnvironmentVariableW]
lea eax, [ebp - 0x4018]
mov dword [esp + 8], 0x2000
mov dword [esp + 4], eax
mov dword [esp], str.PATHEXT
call edi
dec eax
sub esp, 0xc
cmp eax, 0x1ffe
jbe 0x402307
xor eax, eax
lea esi, [esi]
movzx edx, word [eax + str..bat_.com_.cmd_.exe]
mov word [ebp + eax - 0x4018], dx
add eax, 2
test dx, dx
jne 0x4022f0
test byte [0x404020], 8
jne 0x402893
mov dword [ebp - 0x8890], ebx
lea esi, [esi]
mov ecx, 0x82
lea edi, [ebp - 0x8470]
xor eax, eax
mov ebx, dword [ebp - 0x8890]
rep stosd dword es:[edi], eax
jmp 0x40234f
mov ecx, eax
xor ecx, 1
cmp dx, 0x22
cmove eax, ecx
add ebx, 2
movzx edx, word [ebx]
test eax, eax
jne 0x402360
cmp dx, 0x3b
je 0x4025d0
test dx, dx
jne 0x402340
mov ecx, dword [ebp - 0x8890]
xor eax, eax
lea esi, [esi]
movzx edx, word [ecx + eax]
mov word [ebp + eax - 0x8470], dx
add eax, 2
test dx, dx
jne 0x402370
movzx edx, word [ebp - 0x8470]
mov dword [ebp - 0x8890], 0
test dx, dx
je 0x402615
lea eax, [ebp - 0x8470]
lea esi, [esi]
add eax, 2
cmp word [eax], 0
jne 0x4023a8
lea edi, [ebp - 0x8470]
sub eax, edi
sar eax, 1
cmp word [ebp + eax*2 - 0x8472], 0x22
lea ecx, [eax - 1]
je 0x402760
xor eax, eax
cmp dx, 0x22
jne 0x4023e8
jmp 0x4025b0
movzx edx, word [ebp + eax - 0x8470]
mov word [ebp + eax - 0x8880], dx
add eax, 2
test dx, dx
jne 0x4023e0
lea eax, [ebp - 0x8470]
mov dword [esp + 0xc], 0
mov dword [esp + 8], eax
lea eax, [ebp - 0x8880]
mov dword [esp], eax
mov eax, dword [ebp - 0x889c]
mov dword [esp + 4], 0x104
call eax
lea eax, [ebp - 0x8470]
sub esp, 0x10
cmp word [ebp - 0x8470], 0
je 0x40278b
lea esi, [esi]
add eax, 2
cmp word [eax], 0
jne 0x402440
lea edi, [ebp - 0x8470]
sub eax, edi
sar eax, 1
cmp word [ebp + eax*2 - 0x8472], 0x5c
je 0x4024a3
lea edx, [ebp - 0x8470]
lea esi, [esi]
add edx, 2
cmp word [edx], 0
jne 0x402468
xor eax, eax
mov ecx, 0x5c
jmp 0x402487
movzx ecx, word [eax + 0x4050d8]
mov word [edx + eax], cx
add eax, 2
test cx, cx
jne 0x402480
cmp word [ebp - 0x8470], 0
lea edx, [ebp - 0x8470]
je 0x4024b9
lea edx, [ebp - 0x8470]
lea esi, [esi]
add edx, 2
cmp word [edx], 0
jne 0x4024b0
mov ebx, dword [ebp - 0x8894]
xor eax, eax
lea esi, [esi]
movzx ecx, word [ebx + eax]
mov word [edx + eax], cx
add eax, 2
test cx, cx
jne 0x4024c8
cmp word [ebp - 0x8470], 0
lea ebx, [ebp - 0x8470]
je 0x402776
lea esi, [esi]
add ebx, 2
cmp word [ebx], 0
jne 0x4024f0
mov edx, dword [ebp - 0x8898]
test edx, edx
je 0x40252c
lea eax, [ebp - 0x8470]
mov dword [esp], eax
call dword [sym.imp.kernel32.dll_GetFileAttributesW]
sub esp, 4
cmp eax, 0xffffffff
jne 0x4026d3
cmp word [ebp - 0x8470], 0
je 0x4028d8
lea edx, [ebp - 0x8470]
lea esi, [esi]
add edx, 2
cmp word [edx], 0
jne 0x402538
xor eax, eax
mov ecx, 0x2e
jmp 0x402557
movzx ecx, word [eax + 0x4050dc]
mov word [edx + eax], cx
add eax, 2
test cx, cx
jne 0x402550
lea eax, [ebp - 0x8268]
mov dword [esp + 4], eax
lea eax, [ebp - 0x8470]
mov dword [esp], eax
call dword [sym.imp.kernel32.dll_FindFirstFileW]
sub esp, 8
mov esi, eax
mov dword [esp], eax
call dword [sym.imp.kernel32.dll_FindClose]
sub esp, 4
cmp esi, 0xffffffff
jne 0x402638
mov ebx, dword [ebp - 0x8890]
test ebx, ebx
jne 0x402320
xor eax, eax
lea esp, [ebp - 0xc]
pop ebx
pop esi
pop edi
pop ebp
ret
movzx edx, word [ebp + eax - 0x846e]
mov word [ebp + eax - 0x8880], dx
add eax, 2
test dx, dx
jne 0x4025b0
jmp 0x4023f8
mov eax, dword [ebp - 0x8890]
mov esi, ebx
sub esi, eax
mov dword [esp + 4], eax
lea eax, [ebp - 0x8470]
mov dword [esp + 8], esi
sar esi, 1
mov dword [esp], eax
call sym._memcpy
xor eax, eax
mov word [ebp + esi*2 - 0x8470], ax
movzx edx, word [ebp - 0x8470]
lea eax, [ebx + 2]
mov dword [ebp - 0x8890], eax
test dx, dx
jne 0x40239e
cmp word [ebp - 0x8472], 0x22
je 0x402756
mov word [ebp - 0x8880], 0
jmp 0x4023f8
lea esi, [ebp - 0x4018]
nop
mov dword [esp + 4], 0x3b
mov dword [esp], esi
call dword [sym.imp.ucrtbase.dll_wcschr]
mov edi, eax
test eax, eax
je 0x4026a0
mov edx, eax
mov dword [esp + 4], esi
sub edx, esi
mov dword [esp], ebx
lea esi, [edi + 2]
mov dword [esp + 8], edx
mov dword [ebp - 0x888c], edx
call sym._memcpy
mov edx, dword [ebp - 0x888c]
xor ecx, ecx
lea eax, [ebp - 0x8470]
mov word [ebx + edx], cx
mov dword [esp], eax
call dword [sym.imp.kernel32.dll_GetFileAttributesW]
sub esp, 4
cmp eax, 0xffffffff
je 0x402640
jmp 0x4026d3
xor eax, eax
lea esi, [esi]
movzx edx, word [esi + eax]
mov word [ebx + eax], dx
add eax, 2
test dx, dx
jne 0x4026a8
lea eax, [ebp - 0x8470]
mov dword [esp], eax
call dword [sym.imp.kernel32.dll_GetFileAttributesW]
sub esp, 4
cmp eax, 0xffffffff
je 0x402596
cmp word [ebp - 0x8470], 0
lea eax, [ebp - 0x8470]
je 0x4026f1
lea esi, [esi]
nop
add eax, 2
cmp word [eax], 0
jne 0x4026e8
lea edi, [ebp - 0x8470]
mov dword [esp + 4], 0
sub eax, edi
add eax, 2
mov dword [esp + 8], eax
mov edx, dword fs:[0x18]
mov eax, dword [edx + 0x30]
mov eax, dword [eax + 0x18]
mov dword [esp], eax
call dword [sym.imp.kernel32.dll_HeapAlloc]
mov ecx, eax
mov eax, dword [ebp - 0x88a0]
sub esp, 0xc
mov dword [eax], ecx
xor eax, eax
test ecx, ecx
je 0x40274c
lea esi, [esi]
movzx edx, word [ebp + eax - 0x8470]
mov word [ecx + eax], dx
add eax, 2
test dx, dx
jne 0x402738
mov eax, 1
jmp 0x4025a6
or ecx, 0xffffffff
lea esi, [esi]
xor edi, edi
mov word [ebp + ecx*2 - 0x8470], di
movzx edx, word [ebp - 0x8470]
jmp 0x4023cd
mov esi, dword [ebp - 0x8898]
test esi, esi
jne 0x402503
mov edx, ebx
jmp 0x402541
cmp word [ebp - 0x8472], 0x5c
lea edx, [ebp - 0x8470]
je 0x4024b9
jmp 0x402471
lea ebx, [ebp - 0x8018]
lea esi, [esi]
movzx edx, word [eax + 0x40506e]
mov word [ebx + eax], dx
add eax, 2
test dx, dx
jne 0x4027b0
lea eax, [ebp - 0x8014]
mov dword [esp + 8], 0x1ffe
mov edi, dword [sym.imp.kernel32.dll_GetEnvironmentVariableW]
mov dword [esp + 4], eax
mov dword [esp], 0x405074
call edi
dec eax
sub esp, 0xc
cmp eax, 0x1ffc
jbe 0x40280b
xor eax, eax
lea esi, [esi]
movzx edx, word [eax + 0x40507e]
mov word [ebx + eax], dx
add eax, 2
test dx, dx
jne 0x4027f8
mov dword [esp + 4], 0x2e
mov dword [esp], esi
call dword [sym.imp.ucrtbase.dll_wcschr]
mov edx, esi
mov ecx, eax
xor eax, eax
cmp word [esi], 0
je 0x402849
lea esi, [esi]
nop
add edx, 2
cmp word [edx], 0
jne 0x402830
sub edx, esi
xor eax, eax
cmp edx, 0x206
jg 0x4025a4
lea edx, [ebp - 0x8678]
mov dword [ebp - 0x888c], ecx
mov dword [ebp - 0x8894], edx
mov ecx, edx
lea esi, [esi]
movzx edx, word [esi + eax]
mov word [ecx + eax], dx
add eax, 2
test dx, dx
jne 0x402860
mov ecx, dword [ebp - 0x888c]
xor eax, eax
test ecx, ecx
setne al
mov dword [ebp - 0x8898], eax
mov eax, dword [sym.imp.kernel32.dll_GetFullPathNameW]
mov dword [ebp - 0x889c], eax
jmp 0x4022c5
mov eax, dword [ebp - 0x8894]
call sym._wine_dbgstr_wn.constprop.0
mov esi, eax
mov eax, ebx
call sym._wine_dbgstr_wn.constprop.0
mov dword [esp + 0x14], esi
mov dword [esp + 0x10], eax
mov dword [esp + 0xc], str.Searching_in__s_for__s_n
mov dword [esp + 8], str.search_path
mov dword [esp + 4], 0x404020
mov dword [esp], 3
call sym._wine_dbg_log.constprop.0
jmp 0x402314
lea edx, [ebp - 0x8470]
jmp 0x402541