Function at 0x401660
Capabilities:
Check if file exists
Create directory
Create process on windows
Delete file
Get common file path
Get file attributes

Disassembly:
push ebp
mov ebp, esp
and esp, 0xfffffff8
sub esp, 0x4fc
mov eax, dword [0x40e054]
xor eax, esp
mov dword [esp + 0x4f8], eax
push ebx
push esi
push edi
mov edi, dword [ebp + 8]
lea eax, [esp + 0x2f8]
push eax
push 0x104
call dword [sym.imp.KERNEL32.dll_GetTempPathW]
lea ecx, [esp + 0xf0]
push ecx
xor esi, esi
push esi
push esi
lea edx, [esp + 0x304]
push edx
call dword [sym.imp.KERNEL32.dll_GetTempFileNameW]
test eax, eax
jne 0x4016ce
call dword [sym.imp.KERNEL32.dll_GetLastError]
pop edi
pop esi
pop ebx
mov ecx, dword [esp + 0x4f8]
xor ecx, esp
call fcn.00403102
mov esp, ebp
pop ebp
ret 0x10
lea eax, [esp + 0xf0]
push eax
call dword [sym.imp.KERNEL32.dll_GetFileAttributesW]
cmp eax, 0xffffffff
je 0x4016f8
cmp eax, 0x10
je 0x4016f8
lea ecx, [esp + 0xf0]
push ecx
call dword [sym.imp.KERNEL32.dll_DeleteFileW]
test eax, eax
je 0x4016b1
push esi
lea edx, [esp + 0xf4]
push edx
call dword [sym.imp.KERNEL32.dll_CreateDirectoryW]
test eax, eax
je 0x4016b1
lea eax, [esp + 0x10]
mov ebx, str.stub.exe
lea edx, [esp + 0xf0]
mov dword [esp + 0x28], 7
mov dword [esp + 0x24], esi
mov word [esp + 0x14], si
call fcn.004011d0
mov eax, dword [esp + 0x14]
mov ebx, 8
cmp dword [esp + 0x28], ebx
jae 0x401744
lea eax, [esp + 0x14]
push eax
push str.STUBEXE
mov ecx, edi
call fcn.00402a70
add esp, 8
test al, al
jne 0x40178c
call dword [sym.imp.KERNEL32.dll_GetLastError]
cmp dword [esp + 0x28], ebx
mov esi, eax
jb 0x401773
mov eax, dword [esp + 0x14]
push eax
call fcn.004038ea
add esp, 4
mov eax, esi
pop edi
pop esi
pop ebx
mov ecx, dword [esp + 0x4f8]
xor ecx, esp
call fcn.00403102
mov esp, ebp
pop ebp
ret 0x10
lea eax, [esp + 0x2c]
mov ebx, 0x40ca7c
lea edx, [esp + 0xf0]
mov dword [esp + 0x44], 7
mov dword [esp + 0x40], esi
mov word [esp + 0x30], si
call fcn.004011d0
cmp dword [esp + 0x44], 8
mov eax, dword [esp + 0x30]
jae 0x4017c1
lea eax, [esp + 0x30]
push eax
push str.BOOTSTRAPPER
mov ecx, edi
call fcn.00402a70
add esp, 8
test al, al
jne 0x401808
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov edi, eax
lea esi, [esp + 0x2c]
call fcn.00401c70
lea esi, [esp + 0x10]
call fcn.00401c70
mov eax, edi
pop edi
pop esi
pop ebx
mov ecx, dword [esp + 0x4f8]
xor ecx, esp
call fcn.00403102
mov esp, ebp
pop ebp
ret 0x10
lea ecx, [esp + 0x9c]
push ecx
mov ebx, 7
push 0x40cac4
mov ecx, edi
mov dword [esp + 0xbc], ebx
mov dword [esp + 0xb8], esi
mov word [esp + 0xa8], si
call fcn.004028c0
add esp, 8
test al, al
jne 0x401854
call dword [sym.imp.KERNEL32.dll_GetLastError]
lea esi, [esp + 0x9c]
mov edi, eax
call fcn.00401c70
jmp 0x4017dd
lea edx, [esp + 0x64]
push edx
push 0x40cae4
mov ecx, edi
mov dword [esp + 0x84], ebx
mov dword [esp + 0x80], esi
mov word [esp + 0x70], si
mov dword [esp + 0xa0], ebx
mov dword [esp + 0x9c], esi
mov word [esp + 0x8c], si
mov dword [esp + 0xf4], ebx
mov dword [esp + 0xf0], esi
mov word [esp + 0xe0], si
call fcn.004028c0
lea eax, [esp + 0x88]
push eax
push 0x40cb00
mov ecx, edi
call fcn.004028c0
add esp, 0x10
test al, al
je 0x40191a
mov edi, dword [esp + 0x84]
mov eax, 8
cmp dword [esp + 0x98], eax
jae 0x4018db
lea edi, [esp + 0x84]
cmp dword [esp + 0x28], eax
mov eax, dword [esp + 0x14]
jae 0x4018e9
lea eax, [esp + 0x14]
push 0x40cb00
push 0x40caac
call fcn.00401450
add esp, 8
cmp dword [esp + 0x78], esi
jne 0x401988
push 0xffffffffffffffff
push esi
lea eax, [esp + 0x88]
lea ecx, [esp + 0x6c]
call fcn.004021a0
jmp 0x401988
lea ecx, [esp + 0x48]
push ecx
mov dword [esp + 0x64], ebx
mov dword [esp + 0x60], esi
mov word [esp + 0x50], si
call fcn.004014a0
mov edi, dword [esp + 0x50]
mov eax, 8
add esp, 4
cmp dword [esp + 0x60], eax
jae 0x401947
lea edi, [esp + 0x4c]
cmp dword [esp + 0x28], eax
mov eax, dword [esp + 0x14]
jae 0x401955
lea eax, [esp + 0x14]
push str.SOURCEDIRECTORY
push 0x40caac
call fcn.00401450
add esp, 8
cmp dword [esp + 0x78], esi
jne 0x40197d
push 0xffffffffffffffff
push esi
lea eax, [esp + 0x50]
lea ecx, [esp + 0x6c]
call fcn.004021a0
lea esi, [esp + 0x48]
call fcn.00401c70
xor esi, esi
mov edi, dword [esp + 0xa0]
mov ebx, 8
cmp dword [esp + 0xb4], ebx
jae 0x4019a4
lea edi, [esp + 0xa0]
cmp dword [esp + 0x28], ebx
mov eax, dword [esp + 0x14]
jae 0x4019b2
lea eax, [esp + 0x14]
push 0x40cac4
push 0x40caac
call fcn.00401450
mov edi, dword [esp + 0x70]
add esp, 8
cmp dword [esp + 0x7c], ebx
jae 0x4019d2
lea edi, [esp + 0x68]
cmp dword [esp + 0x44], ebx
mov eax, dword [esp + 0x30]
jae 0x4019e0
lea eax, [esp + 0x30]
push 0x40cae4
push 0x28
call fcn.00401450
mov edi, 1
add esp, 8
cmp dword [0x40edd8], edi
mov ebx, 7
mov dword [esp + 0xd0], ebx
mov dword [esp + 0xcc], esi
mov word [esp + 0xbc], si
jle 0x401aa4
jmp 0x401a20
push 0x20
lea esi, [esp + 0xbc]
call fcn.00401ca0
mov eax, dword [0x40eddc]
xor esi, esi
lea edx, [esp + 0x48]
mov dword [esp + 0x60], ebx
mov dword [esp + 0x5c], esi
mov word [esp + 0x4c], si
mov ecx, dword [eax + edi*4]
push edx
push ecx
call fcn.00402bd0
lea edx, [esp + 0x50]
push edx
call fcn.004012e0
add esp, 0xc
push esi
lea eax, [esp + 0x4c]
push eax
or eax, 0xffffffff
lea esi, [esp + 0xc0]
call fcn.00401de0
cmp dword [esp + 0x60], 8
jb 0x401a86
mov ecx, dword [esp + 0x4c]
push ecx
call fcn.004038ea
add esp, 4
add edi, 1
cmp edi, dword [0x40edd8]
jl 0x401a20
mov ecx, dword [esp + 0xbc]
xor esi, esi
cmp dword [esp + 0xd0], 8
jae 0x401aab
lea ecx, [esp + 0xbc]
mov eax, dword [esp + 0x30]
mov edi, 8
cmp dword [esp + 0x44], edi
jae 0x401abe
lea eax, [esp + 0x30]
push 1
push esi
push ecx
push eax
push 0x40cb40
push esi
call dword [sym.imp.SHELL32.dll_ShellExecuteW]
cmp dword [esp + 0xd0], edi
jb 0x401ae8
mov edx, dword [esp + 0xbc]
push edx
call fcn.004038ea
add esp, 4
cmp dword [esp + 0xec], edi
mov dword [esp + 0xd0], ebx
mov dword [esp + 0xcc], esi
mov word [esp + 0xbc], si
jb 0x401b17
mov eax, dword [esp + 0xd8]
push eax
call fcn.004038ea
add esp, 4
cmp dword [esp + 0x98], edi
mov dword [esp + 0xec], ebx
mov dword [esp + 0xe8], esi
mov word [esp + 0xd8], si
jb 0x401b46
mov ecx, dword [esp + 0x84]
push ecx
call fcn.004038ea
add esp, 4
cmp dword [esp + 0x7c], edi
mov dword [esp + 0x98], ebx
mov dword [esp + 0x94], esi
mov word [esp + 0x84], si
jb 0x401b6f
mov edx, dword [esp + 0x68]
push edx
call fcn.004038ea
add esp, 4
cmp dword [esp + 0xb4], edi
mov dword [esp + 0x7c], ebx
mov dword [esp + 0x78], esi
mov word [esp + 0x68], si
jb 0x401b95
mov eax, dword [esp + 0xa0]
push eax
call fcn.004038ea
add esp, 4
cmp dword [esp + 0x44], edi
mov dword [esp + 0xb4], ebx
mov dword [esp + 0xb0], esi
mov word [esp + 0xa0], si
jb 0x401bbe
mov ecx, dword [esp + 0x30]
push ecx
call fcn.004038ea
add esp, 4
cmp dword [esp + 0x28], edi
mov dword [esp + 0x44], ebx
mov dword [esp + 0x40], esi
mov word [esp + 0x30], si
jb 0x401bde
mov edx, dword [esp + 0x14]
push edx
call fcn.004038ea
add esp, 4
mov ecx, dword [esp + 0x504]
pop edi
pop esi
pop ebx
xor ecx, esp
xor eax, eax
call fcn.00403102
mov esp, ebp
pop ebp
ret 0x10