Function at 0x10002020
Capabilities:
Allocate or change rwx memory
Execute shellcode via indirect call
Get file size
Parse pe header
Read file via mapping

Disassembly:
push ebp
mov ebp, esp
sub esp, 0xc
push ebx
push esi
push edi
mov edi, ecx
mov dword [ebp - 0xc], edi
test edi, edi
jne 0x10002039
xor eax, eax
jmp 0x10002127
cmp byte [edi + 0xc], 0
je 0x10002089
mov ecx, dword [edi + 0x10]
mov eax, 0x5a4d
mov dword [edi + 4], ecx
cmp word [ecx], ax
je 0x1000206e
push str.___DOS_Signature_invalid_n
push 2
call fcn.10005915
add esp, 4
push eax
call fcn.10001930
add esp, 8
xor eax, eax
jmp 0x10002127
mov eax, dword [ecx + 0x3c]
add eax, ecx
mov dword [edi + 8], eax
cmp dword [eax], 0x4550
je 0x10002122
push str.___NT_Signature_mismatch_n
jmp 0x10002054
push 0
push 0
push 3
push 0
push 1
push 0x80000000
push dword [edi]
call dword [sym.imp.KERNEL32.dll_CreateFileW]
mov ebx, eax
cmp ebx, 0xffffffff
jne 0x100020ae
push str.___Failed_to_open_PE_File_n
jmp 0x10002054
push 0
push ebx
call dword [sym.imp.KERNEL32.dll_GetFileSize]
push 0
push 0
push 0
push 2
push 0
push ebx
mov dword [edi + 0x14], eax
call dword [sym.imp.KERNEL32.dll_CreateFileMappingW]
mov esi, eax
test esi, esi
jne 0x100020f4
push str.___Failed_to_create_file_mapping_for_PE_File_n
push 2
call fcn.10005915
add esp, 4
push eax
call fcn.10001930
add esp, 8
push ebx
call dword [sym.imp.KERNEL32.dll_CloseHandle]
xor eax, eax
jmp 0x10002127
push 0
push 0
push 0
push 4
push esi
call dword [sym.imp.KERNEL32.dll_MapViewOfFile]
push esi
mov esi, dword [sym.imp.KERNEL32.dll_CloseHandle]
mov dword [edi + 0x10], eax
call esi
push ebx
call esi
cmp dword [edi + 0x10], 0
jne 0x10002122
push str.___Failed_to_obtain_a_map_view_of_PE_File_n
jmp 0x10002054
mov eax, 1
test eax, eax
je 0x100021eb
push str.___Checking_for_self_relocation_n
push 2
call fcn.10005915
add esp, 4
push eax
call fcn.10001930
mov ebx, dword [sym.imp.KERNEL32.dll_GetModuleHandleW]
add esp, 8
push 0
call ebx
mov esi, eax
test esi, esi
jne 0x10002171
push str.____Failed_to_get_our_loaded_address_n
push 2
call fcn.10005915
add esp, 4
push eax
call fcn.10001930
add esp, 8
jmp 0x1000219b
mov ebx, dword [esi + 0x3c]
cmp dword [ebx + esi], 0x4550
je 0x100021f4
push str.____Failed_to_find_our_own_headers_n
push 2
call fcn.10005915
add esp, 4
push eax
call fcn.10001930
add esp, 8
mov ebx, dword [sym.imp.KERNEL32.dll_GetModuleHandleW]
xor eax, eax
test eax, eax
je 0x10002318
push fcn.10001ef0
push str.___Relocating_loader_image__Continue_Function:_0x_08x__n
push 2
call fcn.10005915
add esp, 4
push eax
call fcn.10001930
add esp, 0xc
push 0
call ebx
mov esi, eax
mov dword [ebp - 8], esi
test esi, esi
jne 0x10002255
push str.____Failed_to_get_our_loaded_address_n
push 2
call fcn.10005915
add esp, 4
push eax
call fcn.10001930
add esp, 8
xor eax, eax
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
push dword [ebx + esi + 0x50]
push esi
push str.___MyBase:_0x_08x_MySize:__d_n
push 2
call fcn.10005915
add esp, 4
push eax
call fcn.10001930
mov eax, dword [edi + 8]
add esp, 0x10
mov ecx, dword [eax + 0x34]
cmp ecx, esi
jb 0x10002195
mov eax, dword [ebx + esi + 0x50]
add eax, esi
cmp ecx, eax
jae 0x10002195
push str.___Self_relocation_required_n
push 2
call fcn.10005915
add esp, 4
push eax
call fcn.10001930
mov ebx, dword [sym.imp.KERNEL32.dll_GetModuleHandleW]
add esp, 8
mov eax, 1
jmp 0x1000219d
mov eax, dword [esi + 0x3c]
add eax, esi
mov dword [ebp - 4], eax
push 0x40
push 0x3000
mov eax, dword [eax + 0x50]
inc eax
push eax
push 0
call dword [sym.imp.KERNEL32.dll_VirtualAlloc]
mov ebx, eax
test ebx, ebx
jne 0x10002281
push str.____Failed_to_allocate_memory_for_self_relocation_n
jmp 0x100021d8
push ebx
push str.___New_Loader_Base:_0x_08x_n
push 2
call fcn.10005915
add esp, 4
push eax
call fcn.10001930
mov eax, dword [ebp - 4]
add esp, 0xc
mov dword [edi + 0x1c], ebx
push dword [eax + 0x50]
push esi
push ebx
call fcn.10004f20
add esp, 0xc
mov ecx, ebx
call fcn.10001a70
test eax, eax
jne 0x100022c2
push str.____Failed_to_process_IAT_for_relocated_image_n
jmp 0x100021d8
mov esi, ebx
mov ecx, ebx
sub esi, dword [ebp - 8]
mov edx, esi
call fcn.10001950
test eax, eax
jne 0x100022de
push str.____Failed_to_apply_relocations_on_relocated_image_n
jmp 0x100021d8
add esi, fcn.10001ef0
mov dword [edi + 0x18], ebx
push esi
push str.___Jumping_to_relocated_image__Relocated_Continue_Function:_0x_08x__n
push 2
mov dword [ebp - 8], esi
call fcn.10005915
add esp, 4
push eax
call fcn.10001930
add esp, 0xc
mov eax, dword [ebp - 0xc]
push eax
mov eax, dword [ebp - 8]
call eax
mov eax, 1
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
push edi
call fcn.10001ef0
add esp, 4
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret