Function at 0x401710
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.00403ad8
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 0x401cbc
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 0x4017b4
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, reloc.ucrtbase.dll_strcmp
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 0x4017c8
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
sub eax, 1
sub esp, 0xc
cmp eax, 0x1ffe
jbe 0x401827
xor eax, eax
nop
movzx edx, word [eax + str..bat_.com_.cmd_.exe]
mov word [ebp + eax - 0x4018], dx
add eax, 2
test dx, dx
jne 0x401810
test byte [0x404000], 8
jne 0x401da3
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 0x40186f
mov ecx, eax
xor ecx, 1
cmp dx, 0x22
cmove eax, ecx
add ebx, 2
movzx edx, word [ebx]
test eax, eax
jne 0x401880
cmp dx, 0x3b
je 0x401af0
test dx, dx
jne 0x401860
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 0x401890
movzx edx, word [ebp - 0x8470]
mov dword [ebp - 0x8890], 0
test dx, dx
je 0x401b35
lea eax, [ebp - 0x8470]
lea esi, [esi]
add eax, 2
cmp word [eax], 0
jne 0x4018c8
lea edi, [ebp - 0x8470]
sub eax, edi
sar eax, 1
cmp word [ebp + eax*2 - 0x8472], 0x22
lea ecx, [eax - 1]
je 0x401c78
xor eax, eax
cmp dx, 0x22
jne 0x401908
jmp 0x401ad0
movzx edx, word [ebp + eax - 0x8470]
mov word [ebp + eax - 0x8880], dx
add eax, 2
test dx, dx
jne 0x401900
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 0x401ca3
lea esi, [esi]
add eax, 2
cmp word [eax], 0
jne 0x401960
lea edi, [ebp - 0x8470]
sub eax, edi
sar eax, 1
cmp word [ebp + eax*2 - 0x8472], 0x5c
je 0x4019c3
lea edx, [ebp - 0x8470]
lea esi, [esi]
add edx, 2
cmp word [edx], 0
jne 0x401988
xor eax, eax
mov ecx, 0x5c
jmp 0x4019a7
movzx ecx, word [eax + 0x4050d8]
mov word [edx + eax], cx
add eax, 2
test cx, cx
jne 0x4019a0
cmp word [ebp - 0x8470], 0
lea edx, [ebp - 0x8470]
je 0x4019d9
lea edx, [ebp - 0x8470]
lea esi, [esi]
add edx, 2
cmp word [edx], 0
jne 0x4019d0
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 0x4019e8
cmp word [ebp - 0x8470], 0
lea ebx, [ebp - 0x8470]
je 0x401c8e
lea esi, [esi]
add ebx, 2
cmp word [ebx], 0
jne 0x401a10
mov edx, dword [ebp - 0x8898]
test edx, edx
je 0x401a4c
lea eax, [ebp - 0x8470]
mov dword [esp], eax
call dword [sym.imp.kernel32.dll_GetFileAttributesW]
sub esp, 4
cmp eax, 0xffffffff
jne 0x401bf3
cmp word [ebp - 0x8470], 0
je 0x401de8
lea edx, [ebp - 0x8470]
lea esi, [esi]
add edx, 2
cmp word [edx], 0
jne 0x401a58
xor eax, eax
mov ecx, 0x2e
jmp 0x401a77
movzx ecx, word [eax + 0x4050dc]
mov word [edx + eax], cx
add eax, 2
test cx, cx
jne 0x401a70
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 0x401b58
mov ebx, dword [ebp - 0x8890]
test ebx, ebx
jne 0x401840
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 0x401ad0
jmp 0x401918
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 0x4018be
cmp word [ebp - 0x8472], 0x22
je 0x401c6e
mov word [ebp - 0x8880], 0
jmp 0x401918
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 0x401bc0
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 0x401b60
jmp 0x401bf3
xor eax, eax
lea esi, [esi]
movzx edx, word [esi + eax]
mov word [ebx + eax], dx
add eax, 2
test dx, dx
jne 0x401bc8
lea eax, [ebp - 0x8470]
mov dword [esp], eax
call dword [sym.imp.kernel32.dll_GetFileAttributesW]
sub esp, 4
cmp eax, 0xffffffff
je 0x401ab6
cmp word [ebp - 0x8470], 0
lea eax, [ebp - 0x8470]
je 0x401c11
lea esi, [esi]
nop
add eax, 2
cmp word [eax], 0
jne 0x401c08
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 edi, dword [ebp - 0x88a0]
xor edx, edx
sub esp, 0xc
mov dword [edi], eax
test eax, eax
je 0x401c64
nop
movzx ecx, word [ebp + edx - 0x8470]
mov word [eax + edx], cx
add edx, 2
test cx, cx
jne 0x401c50
mov eax, 1
jmp 0x401ac6
or ecx, 0xffffffff
lea esi, [esi]
xor edi, edi
mov word [ebp + ecx*2 - 0x8470], di
movzx edx, word [ebp - 0x8470]
jmp 0x4018ed
mov esi, dword [ebp - 0x8898]
test esi, esi
jne 0x401a23
mov edx, ebx
jmp 0x401a61
cmp word [ebp - 0x8472], 0x5c
lea edx, [ebp - 0x8470]
je 0x4019d9
jmp 0x401991
lea ebx, [ebp - 0x8018]
lea esi, [esi]
movzx edx, word [eax + 0x40506e]
mov word [ebx + eax], dx
add eax, 2
test dx, dx
jne 0x401cc8
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
sub eax, 1
sub esp, 0xc
cmp eax, 0x1ffc
jbe 0x401d23
xor eax, eax
lea esi, [esi]
nop
movzx edx, word [eax + 0x40507e]
mov word [ebx + eax], dx
add eax, 2
test dx, dx
jne 0x401d10
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 0x401d59
add edx, 2
cmp word [edx], 0
jne 0x401d40
sub edx, esi
xor eax, eax
cmp edx, 0x206
jg 0x401ac4
lea edx, reloc.ucrtbase.dll_strcmp
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 0x401d70
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 0x4017e5
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], global___dbch
mov dword [esp], 3
call sym._wine_dbg_log.constprop.0
jmp 0x401834
lea edx, [ebp - 0x8470]
jmp 0x401a61