Function at 0x401660
Capabilities:
Check if file exists
Get file attributes
Query environment variable

Disassembly:
push ebp
mov ebp, esp
push edi
push esi
push ebx
push eax
mov eax, 0x8898
call fcn.00403a48
sub esp, eax
mov eax, dword [esp + eax]
mov dword [ebp - 0x8890], edx
mov dword [ebp - 0x888c], eax
mov dword [esp + 4], 0x406056
mov dword [esp], eax
call dword [sym.imp.ucrtbase.dll_wcspbrk]
test eax, eax
je 0x401bc2
mov eax, dword [ebp - 0x888c]
lea ebx, [ebp - 0x800c]
mov dword [esp + 0xc], 0
mov dword [esp + 8], ebx
mov dword [esp], eax
mov eax, dword [sym.imp.kernel32.dll_GetFullPathNameW]
mov dword [esp + 4], 0x2000
mov dword [ebp - 0x8888], 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 - 0x8884], 0
mov esi, eax
test eax, eax
je 0x40170e
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 - 0x8884], eax
lea ecx, reloc.ucrtbase.dll_strchr
xor eax, eax
mov dword [ebp - 0x8880], ecx
lea esi, [esi]
movzx edx, word [esi + eax + 2]
mov word [ecx + eax], dx
add eax, 2
test dx, dx
jne 0x401720
mov word [esi + 2], 0
mov esi, dword [sym.imp.kernel32.dll_GetEnvironmentVariableW]
lea eax, [ebp - 0x400c]
mov dword [esp + 8], 0x2000
mov dword [esp + 4], eax
mov dword [esp], str.PATHEXT
call esi
sub eax, 1
sub esp, 0xc
cmp eax, 0x1ffe
jbe 0x401787
xor eax, eax
lea esi, [esi]
nop
movzx edx, word [eax + str..bat_.com_.cmd_.exe]
mov word [ebp + eax - 0x400c], dx
add eax, 2
test dx, dx
jne 0x401770
test byte [0x404000], 8
jne 0x401cb9
mov dword [ebp - 0x887c], ebx
lea esi, [esi]
mov ecx, 0x82
lea edi, [ebp - 0x8464]
xor eax, eax
mov ebx, dword [ebp - 0x887c]
rep stosd dword es:[edi], eax
jmp 0x4017cf
mov ecx, eax
xor ecx, 1
cmp dx, 0x22
cmove eax, ecx
add ebx, 2
movzx edx, word [ebx]
test eax, eax
jne 0x4017e0
cmp dx, 0x3b
je 0x401a00
test dx, dx
jne 0x4017c0
mov ecx, dword [ebp - 0x887c]
xor eax, eax
lea esi, [esi]
movzx edx, word [ecx + eax]
mov word [ebp + eax - 0x8464], dx
add eax, 2
test dx, dx
jne 0x4017f0
movzx edx, word [ebp - 0x8464]
mov dword [ebp - 0x887c], 0
test dx, dx
je 0x401a45
lea eax, [ebp - 0x8464]
add eax, 2
cmp word [eax], 0
jne 0x401824
lea edi, [ebp - 0x8464]
sub eax, edi
sar eax, 1
sub eax, 1
cmp word [ebp + eax*2 - 0x8464], 0x22
je 0x401b81
xor eax, eax
cmp dx, 0x22
jne 0x401868
jmp 0x4019e0
movzx edx, word [ebp + eax - 0x8464]
mov word [ebp + eax - 0x8874], dx
add eax, 2
test dx, dx
jne 0x401860
lea eax, [ebp - 0x8464]
mov dword [esp + 0xc], 0
mov dword [esp + 8], eax
lea eax, [ebp - 0x8874]
mov dword [esp], eax
mov eax, dword [ebp - 0x8888]
mov dword [esp + 4], 0x104
call eax
lea eax, [ebp - 0x8464]
sub esp, 0x10
cmp word [ebp - 0x8464], 0
je 0x401b97
lea esi, [esi]
add eax, 2
cmp word [eax], 0
jne 0x4018c0
lea edi, [ebp - 0x8464]
sub eax, edi
sar eax, 1
cmp word [ebp + eax*2 - 0x8466], 0x5c
jne 0x401b32
lea edx, [ebp - 0x8464]
lea esi, [esi]
nop
add edx, 2
cmp word [edx], 0
jne 0x4018f0
mov ebx, dword [ebp - 0x8880]
xor eax, eax
movzx ecx, word [ebx + eax]
mov word [edx + eax], cx
add eax, 2
test cx, cx
jne 0x401901
cmp word [ebp - 0x8464], 0
lea ebx, [ebp - 0x8464]
je 0x401bad
add ebx, 2
cmp word [ebx], 0
jne 0x401925
mov edx, dword [ebp - 0x8884]
test edx, edx
je 0x401963
lea eax, [ebp - 0x8464]
mov dword [esp], eax
call dword [sym.imp.kernel32.dll_GetFileAttributesW]
sub esp, 4
cmp eax, 0xffffffff
jne 0x401afc
cmp word [ebp - 0x8464], 0
lea edx, [ebp - 0x8464]
je 0x401979
lea edx, [ebp - 0x8464]
lea esi, [esi]
add edx, 2
cmp word [edx], 0
jne 0x401970
xor eax, eax
mov ecx, 0x2e
jmp 0x401989
movzx ecx, word [eax + 0x4060cc]
mov word [edx + eax], cx
add eax, 2
test cx, cx
jne 0x401982
lea eax, [ebp - 0x825c]
mov dword [esp + 4], eax
lea eax, [ebp - 0x8464]
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 0x401a61
mov ebx, dword [ebp - 0x887c]
test ebx, ebx
jne 0x4017a0
xor eax, eax
lea esp, [ebp - 0xc]
pop ebx
pop esi
pop edi
pop ebp
ret
movzx edx, word [ebp + eax - 0x8462]
mov word [ebp + eax - 0x8874], dx
add eax, 2
test dx, dx
jne 0x4019e0
jmp 0x401878
mov eax, dword [ebp - 0x887c]
mov esi, ebx
sub esi, eax
mov dword [esp + 4], eax
lea eax, [ebp - 0x8464]
mov dword [esp + 8], esi
sar esi, 1
mov dword [esp], eax
call sym._memcpy
xor eax, eax
mov word [ebp + esi*2 - 0x8464], ax
movzx edx, word [ebp - 0x8464]
lea eax, [ebx + 2]
mov dword [ebp - 0x887c], eax
test dx, dx
jne 0x40181e
cmp word [ebp - 0x8466], 0x22
je 0x401b7e
mov word [ebp - 0x8874], 0
jmp 0x401878
lea esi, [ebp - 0x400c]
jmp 0x401ab8
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 - 0x8878], edx
call sym._memcpy
mov edx, dword [ebp - 0x8878]
xor ecx, ecx
lea eax, [ebp - 0x8464]
mov word [ebx + edx], cx
mov dword [esp], eax
call dword [sym.imp.kernel32.dll_GetFileAttributesW]
sub esp, 4
cmp eax, 0xffffffff
jne 0x401afc
test esi, esi
je 0x4019c8
mov dword [esp + 4], 0x3b
mov dword [esp], esi
call dword [sym.imp.ucrtbase.dll_wcschr]
mov edi, eax
test eax, eax
jne 0x401a70
xor eax, eax
movzx edx, word [esi + eax]
mov word [ebx + eax], dx
add eax, 2
test dx, dx
jne 0x401ad1
lea eax, [ebp - 0x8464]
mov dword [esp], eax
call dword [sym.imp.kernel32.dll_GetFileAttributesW]
sub esp, 4
cmp eax, 0xffffffff
je 0x4019c8
lea eax, [ebp - 0x8464]
mov dword [esp], eax
call dword [sym.imp.ucrtbase.dll__wcsdup]
mov edx, eax
mov eax, dword [ebp - 0x8890]
mov dword [eax], edx
mov eax, 1
test edx, edx
jne 0x4019d8
mov edx, dword [ebp - 0x888c]
mov eax, 0xe
call sym._fatal_string_error.constprop.2
lea edx, [ebp - 0x8464]
lea esi, [esi]
nop
add edx, 2
cmp word [edx], 0
jne 0x401b40
xor eax, eax
mov ecx, 0x5c
jmp 0x401b59
movzx ecx, word [eax + 0x4060c8]
mov word [edx + eax], cx
add eax, 2
test cx, cx
jne 0x401b52
cmp word [ebp - 0x8464], 0
lea edx, [ebp - 0x8464]
jne 0x4018e2
jmp 0x4018f9
or eax, 0xffffffff
xor edi, edi
mov word [ebp + eax*2 - 0x8464], di
movzx edx, word [ebp - 0x8464]
jmp 0x401849
cmp word [ebp - 0x8466], 0x5c
lea edx, [ebp - 0x8464]
je 0x4018f9
jmp 0x401b49
mov esi, dword [ebp - 0x8884]
test esi, esi
jne 0x401938
mov edx, ebx
jmp 0x401979
lea ebx, [ebp - 0x800c]
lea esi, [esi]
nop
movzx edx, word [eax + 0x40605e]
mov word [ebx + eax], dx
add eax, 2
test dx, dx
jne 0x401bd0
lea eax, [ebp - 0x8008]
mov dword [esp + 8], 0x1ffe
mov esi, dword [sym.imp.kernel32.dll_GetEnvironmentVariableW]
mov dword [esp + 4], eax
mov dword [esp], 0x406064
call esi
sub eax, 1
sub esp, 0xc
cmp eax, 0x1ffc
jbe 0x401c26
xor eax, eax
movzx edx, word [eax + 0x40606e]
mov word [ebx + eax], dx
add eax, 2
test dx, dx
jne 0x401c13
mov edi, dword [ebp - 0x888c]
mov dword [esp + 4], 0x2e
mov dword [esp], edi
call dword [sym.imp.ucrtbase.dll_wcschr]
xor edx, edx
cmp word [edi], 0
mov ecx, edi
je 0x401c6d
lea esi, [esi]
nop
add ecx, 2
cmp word [ecx], 0
jne 0x401c50
sub ecx, dword [ebp - 0x888c]
xor edx, edx
cmp ecx, 0x206
jg 0x4019d6
lea edi, reloc.ucrtbase.dll_strchr
mov dword [ebp - 0x8878], eax
mov ecx, dword [ebp - 0x888c]
mov dword [ebp - 0x8880], edi
movzx eax, word [ecx + edx]
mov word [edi + edx], ax
add edx, 2
test ax, ax
jne 0x401c85
mov eax, dword [ebp - 0x8878]
test eax, eax
setne al
movzx eax, al
mov dword [ebp - 0x8884], eax
mov eax, dword [sym.imp.kernel32.dll_GetFullPathNameW]
mov dword [ebp - 0x8888], eax
jmp 0x40173d
mov eax, dword [ebp - 0x8880]
call sym._wine_dbgstr_wn.constprop.3
mov esi, eax
mov eax, ebx
call sym._wine_dbgstr_wn.constprop.3
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], global___dbch
mov dword [esp], 3
call sym._wine_dbg_log.constprop.4
jmp 0x401794