Function at 0x405805
Capabilities:
Accept command line arguments
Check if file exists
Copy file
Create process on windows
Get common file path
Get file attributes
Terminate process

Disassembly:
sub esp, 0x3b0
mov eax, dword [0x4241a4]
xor eax, esp
mov dword [esp + 0x3ac], eax
push ebx
push ebp
mov ebp, 0x104
lea eax, [esp + 0xa0]
push ebp
push eax
call dword [sym.imp.KERNEL32.dll_GetSystemDirectoryA]
push str.lpk.dll
lea eax, [esp + 0xa4]
push ebp
push eax
call fcn.0040c238
add esp, 0xc
lea eax, [esp + 0xa0]
xor ebx, ebx
push 8
push ebx
push eax
call dword [sym.imp.KERNEL32.dll_LoadLibraryExA]
push ebp
lea eax, [esp + 0xa4]
push eax
push ebx
call dword [sym.imp.KERNEL32.dll_GetModuleFileNameA]
push str..local
lea eax, [esp + 0xa4]
push 0x10a
push eax
call fcn.0040c238
add esp, 0xc
lea eax, [esp + 0xa0]
push eax
call dword [sym.imp.KERNEL32.dll_GetFileAttributesA]
cmp eax, 0xffffffff
je 0x40589d
push 1
call dword [sym.imp.KERNEL32.dll_ExitProcess]
push esi
lea eax, [esp + 0x14]
mov dword [esp + 0x14], ebx
push edi
push eax
mov dword [esp + 0x20], ebx
mov dword [esp + 0x24], ebx
call fcn.004051d3
mov edi, dword [esp + 0x1c]
mov ebp, ebx
mov ebx, dword [esp + 0x20]
mov eax, ebx
pop ecx
sub eax, edi
push 0x18
cdq
pop ecx
idiv ecx
mov dword [esp + 0x10], eax
test eax, eax
je 0x4058ff
mov esi, edi
cmp dword [esi + 0x14], 0x10
mov ecx, esi
jb 0x4058de
mov ecx, dword [esi]
push ecx
push str._run1
call fcn.0040f745
pop ecx
pop ecx
test eax, eax
je 0x405bbf
push 0x18
pop eax
inc ebp
add esi, eax
cmp ebp, dword [esp + 0x10]
jb 0x4058d4
push 0x104
lea eax, [esp + 0x1b8]
push eax
push 0
call dword [sym.imp.KERNEL32.dll_GetModuleFileNameA]
and dword [esp + 0x88], 0
lea eax, [esp + 0x78]
push eax
mov dword [esp + 0x90], 0xf
mov byte [esp + 0x7c], 0
call fcn.00405398
pop ecx
test eax, eax
je 0x405946
lea eax, [esp + 0x78]
push eax
call fcn.0040510f
pop ecx
cmp dword [esp + 0x8c], 0x10
lea eax, [esp + 0x1b4]
lea esi, [esp + 0x78]
cmovae esi, dword [esp + 0x78]
push eax
call dword [sym.imp.SHLWAPI.dll_PathFindFileNameA]
push eax
push esi
lea eax, [esp + 0x2c0]
push eax
call dword [sym.imp.SHLWAPI.dll_PathCombineA]
push 1
lea eax, [esp + 0x2bc]
push eax
lea eax, [esp + 0x1bc]
push eax
call dword [sym.imp.KERNEL32.dll_CopyFileA]
test eax, eax
je 0x405ae2
call dword [sym.imp.KERNEL32.dll_GetCommandLineA]
cmp dword [edi + 0x14], 0x10
mov esi, eax
mov ecx, edi
jb 0x4059a7
mov ecx, dword [edi]
push dword [edi + 0x10]
push ecx
push esi
call fcn.0040f820
xor ecx, ecx
add esp, 0xc
test eax, eax
setne cl
inc ecx
add ecx, dword [edi + 0x10]
add ecx, esi
push ecx
lea ecx, [esp + 0x94]
call fcn.00404de6
mov esi, str.__run1__shortcut_
push esi
call fcn.0040c2b0
pop ecx
push eax
push esi
lea ecx, [esp + 0x98]
call fcn.0040569d
mov esi, eax
lea eax, [esp + 0x1b4]
push eax
call fcn.0040c2b0
pop ecx
push eax
lea eax, [esp + 0x1b8]
mov ecx, esi
push eax
call fcn.0040569d
mov ebp, 0x41c680
mov esi, eax
push ebp
call fcn.0040c2b0
pop ecx
push eax
push ebp
mov ecx, esi
call fcn.0040569d
mov eax, dword [esp + 0xa0]
inc eax
push eax
call fcn.004088eb
cmp dword [esp + 0xa8], 0x10
lea ecx, [esp + 0x94]
mov ebp, eax
cmovae ecx, dword [esp + 0x94]
push ecx
mov ecx, dword [esp + 0xa8]
inc ecx
push ecx
push ebp
call fcn.0040c1de
push 0x44
pop esi
push esi
lea eax, [esp + 0x48]
push 0
push eax
call fcn.00403817
push 0x10
lea eax, [esp + 0x44]
mov dword [esp + 0x54], esi
push 0
push eax
call fcn.00403817
add esp, 0x28
lea ecx, [esp + 0x24]
cmp dword [esp + 0x8c], 0x10
lea eax, [esp + 0x78]
cmovae eax, dword [esp + 0x78]
push ecx
lea ecx, [esp + 0x38]
push ecx
push eax
xor eax, eax
push eax
push eax
push eax
push eax
push eax
push ebp
lea eax, [esp + 0x2dc]
push eax
call dword [sym.imp.KERNEL32.dll_CreateProcessA]
test eax, eax
je 0x405acf
push 0xffffffffffffffff
push dword [esp + 0x28]
call dword [sym.imp.KERNEL32.dll_WaitForSingleObject]
push dword [esp + 0x28]
mov esi, dword [sym.imp.KERNEL32.dll_CloseHandle]
call esi
push dword [esp + 0x24]
call esi
push ebp
call fcn.004088f4
pop ecx
lea ecx, [esp + 0x90]
call fcn.004055ed
lea eax, [esp + 0x78]
push eax
call fcn.00404f6f
mov eax, dword [esp + 0x90]
mov ebp, 0x1000
pop ecx
cmp eax, 0x10
jb 0x405b31
mov ecx, dword [esp + 0x78]
inc eax
mov dword [esp + 0x10], eax
mov dword [esp + 0x14], ecx
cmp eax, ebp
jb 0x405b28
lea eax, [esp + 0x10]
push eax
lea eax, [esp + 0x18]
push eax
call fcn.00405425
mov eax, dword [esp + 0x18]
pop ecx
pop ecx
mov ecx, dword [esp + 0x14]
push eax
push ecx
call fcn.004088dd
pop ecx
pop ecx
and dword [esp + 0x88], 0
mov dword [esp + 0x8c], 0xf
mov byte [esp + 0x78], 0
test edi, edi
je 0x405ba4
mov esi, edi
cmp esi, ebx
je 0x405b67
push 0x18
pop edi
mov ecx, esi
call fcn.004055ed
add esi, edi
cmp esi, ebx
jne 0x405b56
mov edi, dword [esp + 0x18]
mov eax, dword [esp + 0x20]
sub eax, edi
mov dword [esp + 0x14], edi
push 0x18
cdq
pop ecx
idiv ecx
imul eax, eax, 0x18
mov dword [esp + 0x10], eax
cmp eax, ebp
jb 0x405b9b
lea eax, [esp + 0x10]
push eax
lea eax, [esp + 0x18]
push eax
call fcn.00405425
mov eax, dword [esp + 0x18]
mov edi, dword [esp + 0x1c]
pop ecx
pop ecx
push eax
push edi
call fcn.004088dd
pop ecx
pop ecx
xor eax, eax
mov ecx, dword [esp + 0x3bc]
pop edi
pop esi
pop ebp
pop ebx
xor ecx, esp
call fcn.0040886e
add esp, 0x3b0
ret
test edi, edi
je 0x405c1d
mov esi, edi
cmp esi, ebx
je 0x405bdd
push 0x18
pop edi
mov ecx, esi
call fcn.004055ed
add esi, edi
cmp esi, ebx
jne 0x405bcc
mov edi, dword [esp + 0x18]
mov eax, dword [esp + 0x20]
sub eax, edi
mov dword [esp + 0x10], edi
push 0x18
cdq
pop ecx
idiv ecx
imul eax, eax, 0x18
mov dword [esp + 0x14], eax
cmp eax, 0x1000
jb 0x405c14
lea eax, [esp + 0x14]
push eax
lea eax, [esp + 0x14]
push eax
call fcn.00405425
mov eax, dword [esp + 0x1c]
mov edi, dword [esp + 0x18]
pop ecx
pop ecx
push eax
push edi
call fcn.004088dd
pop ecx
pop ecx
xor eax, eax
inc eax
jmp 0x405ba6