Function at 0x5146a0
Capabilities:
Access pe header
Copy file
Read file via mapping

Disassembly:
push ebp
mov ebp, esp
push edi
push esi
mov esi, eax
push ebx
mov ebx, edx
mov edi, dword fs:[0x18]
sub esp, 0x28
mov dword [ebp - 0x18], ecx
mov dword [esp + 4], edx
mov dword [esp + 8], 0
mov dword [esp], eax
call dword [sym.imp.kernel32.dll_CopyFileA]
sub esp, 0xc
mov dword [ebp - 0x10], eax
call fcn.0057d110
mov dword [eax], 0x5eee7f
mov dword [eax + 4], 0xcb8
mov eax, dword [edi + 0x34]
mov dword [esp + 8], esi
mov dword [esp + 0x10], eax
mov dword [esp + 0xc], ebx
mov dword [esp + 4], str.Failed_to_copy_executable__s_in__s___lu__n
mov edx, dword [ebp - 0x10]
mov dword [esp], edx
call fcn.0050e8b0
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], 3
mov dword [esp + 4], 0xc0000000
mov dword [esp], ebx
call dword [sym.imp.kernel32.dll_CreateFileA]
sub esp, 0x1c
mov esi, eax
mov dword [ebp - 0x10], eax
call fcn.0057d110
mov dword [eax], 0x5eee7f
mov dword [eax + 4], 0xcbc
mov eax, dword [edi + 0x34]
mov dword [esp + 8], ebx
mov dword [esp + 0xc], eax
xor eax, eax
cmp esi, 0xffffffff
setne al
mov dword [esp + 4], str.Couldnt_open_file__s___lu__n
mov dword [esp], eax
call fcn.0050e8b0
mov dword [esp], esi
mov dword [esp + 0x14], 0
mov dword [esp + 0x10], 0
mov dword [esp + 0xc], 0
mov dword [esp + 8], 4
mov dword [esp + 4], 0
call dword [sym.imp.kernel32.dll_CreateFileMappingW]
sub esp, 0x18
mov esi, eax
mov dword [ebp - 0x14], eax
call fcn.0057d110
mov dword [eax], 0x5eee7f
mov dword [eax + 4], 0xcbe
mov eax, dword [edi + 0x34]
mov dword [esp + 4], str.Couldnt_create_map___lu__n
mov dword [esp + 8], eax
xor eax, eax
test esi, esi
setne al
mov dword [esp], eax
call fcn.0050e8b0
mov dword [esp], esi
mov dword [esp + 0x10], 0
mov dword [esp + 0xc], 0
mov dword [esp + 8], 0
mov dword [esp + 4], 0xf001f
call dword [sym.imp.kernel32.dll_MapViewOfFile]
sub esp, 0x14
mov esi, eax
call fcn.0057d110
mov dword [eax], 0x5eee7f
mov dword [eax + 4], 0xcc0
mov eax, dword [edi + 0x34]
mov dword [esp + 4], str.Couldnt_map___lu__n
mov dword [esp + 8], eax
xor eax, eax
test esi, esi
setne al
mov dword [esp], eax
call fcn.0050e8b0
mov dword [esp], esi
call dword [sym.imp.ntdll.dll_RtlImageNtHeader]
sub esp, 4
mov edi, eax
call fcn.0057d110
mov dword [eax], 0x5eee7f
mov dword [eax + 4], 0xcc2
xor eax, eax
test edi, edi
setne al
mov dword [esp + 8], ebx
mov dword [esp + 4], str.Cannot_get_NT_headers_out_of__s_n
mov dword [esp], eax
call fcn.0050e8b0
test edi, edi
je 0x51488a
movzx eax, word [ebp - 0x18]
mov word [edi + 0x5c], ax
mov dword [esp], esi
call dword [sym.imp.kernel32.dll_UnmapViewOfFile]
sub esp, 4
mov ebx, eax
call fcn.0057d110
mov dword [eax], 0x5eee7f
mov dword [eax + 4], 0xcc5
mov eax, dword fs:[0x18]
mov eax, dword [eax + 0x34]
mov dword [esp], ebx
mov dword [esp + 4], str.Couldnt_unmap___lu__n
mov dword [esp + 8], eax
call fcn.0050e8b0
mov eax, dword [ebp - 0x14]
mov ebx, dword [sym.imp.kernel32.dll_CloseHandle]
mov dword [esp], eax
call ebx
mov eax, dword [ebp - 0x10]
sub esp, 4
mov dword [esp], eax
call ebx
sub esp, 4
lea esp, [ebp - 0xc]
pop ebx
pop esi
pop edi
pop ebp
ret