Function at 0x140022770
Capabilities:
Check if file exists
Enumerate pe sections
Get file size
Parse pe header
Read file via mapping

Disassembly:
mov qword [rsp + 0x10], rdx
mov qword [rsp + 8], rcx
push rdi
sub rsp, 0x460
mov rax, qword [0x140065840]
xor rax, rsp
mov qword [rsp + 0x458], rax
mov dword [rsp + 0x278], 0
lea rdi, [rsp + 0x60]
xor eax, eax
mov ecx, 0x208
rep stosb byte [rdi], al
mov r8d, 0x104
lea rdx, [rsp + 0x60]
mov rcx, qword [rsp + 0x478]
call qword [sym.imp.KERNEL32.dll_GetModuleFileNameW]
lea rcx, [rsp + 0x60]
call qword [sym.imp.SHLWAPI.dll_PathFileExistsW]
test eax, eax
jne 0x1400227dc
xor eax, eax
jmp 0x140023060
mov qword [rsp + 0x270], 0
mov qword [rsp + 0x48], 0
mov qword [rsp + 0x40], 0
mov rax, qword [rsp + 0x470]
mov dword [rax + 0x40], 0
mov rcx, qword [rsp + 0x470]
add rcx, 0xe0
call fcn.140028440
mov qword [rsp + 0x30], 0
mov dword [rsp + 0x28], 0x80
mov dword [rsp + 0x20], 3
xor r9d, r9d
mov r8d, 1
mov edx, 0x80000000
lea rcx, [rsp + 0x60]
call qword [sym.imp.KERNEL32.dll_CreateFileW]
mov qword [rsp + 0x270], rax
cmp qword [rsp + 0x270], 0xffffffffffffffff
jne 0x140022867
jmp 0x140022fe1
xor edx, edx
mov rcx, qword [rsp + 0x270]
call qword [sym.imp.KERNEL32.dll_GetFileSize]
mov edx, eax
mov rax, qword [rsp + 0x470]
mov dword [rax + 0x44], edx
mov qword [rsp + 0x28], 0
mov dword [rsp + 0x20], 0
xor r9d, r9d
mov r8d, 2
xor edx, edx
mov rcx, qword [rsp + 0x270]
call qword [sym.imp.KERNEL32.dll_CreateFileMappingW]
mov qword [rsp + 0x48], rax
cmp qword [rsp + 0x48], 0
jne 0x1400228c0
jmp 0x140022fe1
mov qword [rsp + 0x20], 0
xor r9d, r9d
xor r8d, r8d
mov edx, 4
mov rcx, qword [rsp + 0x48]
call qword [sym.imp.KERNEL32.dll_MapViewOfFile]
mov qword [rsp + 0x40], rax
cmp qword [rsp + 0x40], 0
jne 0x1400228f1
jmp 0x140022fe1
mov qword [rsp + 0x2c8], 0
mov qword [rsp + 0x280], 0
mov qword [rsp + 0x2d8], 0
mov dword [rsp + 0x28c], 0
mov qword [rsp + 0x2f0], 0
mov dword [rsp + 0x2c0], 0
mov dword [rsp + 0x2e8], 0
mov rax, qword [rsp + 0x40]
mov qword [rsp + 0x2c8], rax
mov rax, qword [rsp + 0x2c8]
movsxd rcx, dword [rax + 0x3c]
mov rax, qword [rsp + 0x40]
add rax, rcx
mov qword [rsp + 0x280], rax
mov rax, qword [rsp + 0x2c8]
movzx eax, word [rax]
cmp eax, 0x5a4d
jne 0x14002298d
mov rax, qword [rsp + 0x280]
cmp dword [rax], 0x4550
je 0x140022992
jmp 0x140022fe1
mov rax, qword [rsp + 0x280]
movzx eax, word [rax + 0x16]
and eax, 0x2000
test eax, eax
je 0x1400229b4
mov dword [rsp + 0x450], 1
jmp 0x1400229bf
mov dword [rsp + 0x450], 0
mov rcx, qword [rsp + 0x470]
mov eax, dword [rsp + 0x450]
mov dword [rcx + 0x10], eax
mov rax, qword [rsp + 0x280]
movzx eax, word [rax + 0x18]
cmp eax, 0x10b
jne 0x1400229f5
mov rax, qword [rsp + 0x470]
mov dword [rax + 0xc], 0
jmp 0x140022a27
mov rax, qword [rsp + 0x280]
movzx eax, word [rax + 0x18]
cmp eax, 0x20b
jne 0x140022a27
mov rax, qword [rsp + 0x470]
mov dword [rax + 0xc], 1
mov rax, qword [rsp + 0x280]
mov qword [rsp + 0x2d8], rax
mov rax, qword [rsp + 0x280]
movzx eax, word [rax + 6]
mov dword [rsp + 0x2d0], eax
mov rax, qword [rsp + 0x280]
movzx eax, word [rax + 0x14]
mov dword [rsp + 0x288], eax
mov rax, qword [rsp + 0x280]
movzx eax, word [rax + 0x18]
cmp eax, 0x20b
jne 0x140022ae7
mov rax, qword [rsp + 0x470]
mov dword [rax + 0xc], 1
mov rax, qword [rsp + 0x280]
mov qword [rsp + 0x2d8], rax
mov rax, qword [rsp + 0x478]
mov qword [rsp + 0x2f0], rax
mov rax, qword [rsp + 0x2d8]
mov eax, dword [rax + 0x38]
mov dword [rsp + 0x2c0], eax
mov rax, qword [rsp + 0x2d8]
mov eax, dword [rax + 0x54]
mov dword [rsp + 0x2e8], eax
mov rcx, qword [rsp + 0x470]
mov rax, qword [rsp + 0x2d8]
mov rax, qword [rax + 0x30]
mov qword [rcx + 0x58], rax
mov rcx, qword [rsp + 0x470]
mov rax, qword [rsp + 0x2d8]
mov eax, dword [rax + 0x50]
mov dword [rcx + 0x48], eax
jmp 0x140022b41
mov eax, dword [rsp + 0x478]
mov dword [rsp + 0x28c], eax
mov rax, qword [rsp + 0x280]
mov eax, dword [rax + 0x38]
mov dword [rsp + 0x2c0], eax
mov rax, qword [rsp + 0x280]
mov eax, dword [rax + 0x54]
mov dword [rsp + 0x2e8], eax
mov rax, qword [rsp + 0x280]
mov eax, dword [rax + 0x34]
mov dword [rsp + 0x28c], eax
mov rcx, qword [rsp + 0x470]
mov rax, qword [rsp + 0x280]
mov eax, dword [rax + 0x50]
mov dword [rcx + 0x48], eax
mov rcx, qword [rsp + 0x470]
mov rax, qword [rsp + 0x470]
mov eax, dword [rax + 0x48]
mov dword [rcx + 0x40], eax
mov ecx, dword [rsp + 0x2e8]
lea rdx, [0x1400680a0]
call fcn.140043ab4
mov qword [rsp + 0x340], rax
mov rcx, qword [rsp + 0x470]
mov rax, qword [rsp + 0x340]
mov qword [rcx + 0x68], rax
mov rax, qword [rsp + 0x470]
cmp qword [rax + 0x68], 0
jne 0x140022b9a
jmp 0x140022fe1
mov r8d, dword [rsp + 0x2e8]
mov rdx, qword [rsp + 0x40]
mov rcx, qword [rsp + 0x470]
mov rcx, qword [rcx + 0x68]
call fcn.140043430
mov rax, qword [rsp + 0x470]
mov rax, qword [rax + 0x68]
mov qword [rsp + 0x2e0], rax
mov rax, qword [rsp + 0x470]
cmp dword [rax + 0xc], 0
jne 0x140022c03
mov rax, qword [rsp + 0x2e0]
movsxd rcx, dword [rax + 0x3c]
mov rax, qword [rsp + 0x470]
add rcx, qword [rax + 0x68]
mov rax, qword [rsp + 0x470]
mov qword [rax + 0xd0], rcx
jmp 0x140022c2a
mov rax, qword [rsp + 0x2e0]
movsxd rcx, dword [rax + 0x3c]
mov rax, qword [rsp + 0x470]
add rcx, qword [rax + 0x68]
mov rax, qword [rsp + 0x470]
mov qword [rax + 0xd8], rcx
lea rcx, [rsp + 0x298]
call fcn.140003220
lea rdi, [rsp + 0x2a0]
xor eax, eax
mov ecx, 0x20
rep stosb byte [rdi], al
mov eax, dword [rsp + 0x2e8]
mov dword [rsp + 0x2a8], eax
mov eax, dword [rsp + 0x2e8]
mov dword [rsp + 0x2ac], eax
cmp dword [rsp + 0x2c0], 0
je 0x140022ca6
mov ecx, dword [rsp + 0x2e8]
mov eax, dword [rsp + 0x2c0]
lea eax, [rcx + rax - 1]
xor edx, edx
div dword [rsp + 0x2c0]
mov dword [rsp + 0x2f8], eax
mov eax, dword [rsp + 0x2f8]
imul eax, dword [rsp + 0x2c0]
mov dword [rsp + 0x2a8], eax
mov rax, qword [rsp + 0x470]
cmp dword [rax + 0xc], 0
je 0x140022cc6
mov rax, qword [rsp + 0x2f0]
mov qword [rsp + 0x2a0], rax
jmp 0x140022cd4
mov eax, dword [rsp + 0x28c]
mov dword [rsp + 0x2a0], eax
mov dword [rsp + 0x2b0], 0
mov eax, dword [rsp + 0x2e8]
mov dword [rsp + 0x2b4], eax
lea rdx, str.PE_Header
lea rcx, [rsp + 0x298]
call fcn.140003460
mov dword [rsp + 0x2bc], 0x40000000
mov rcx, qword [rsp + 0x470]
add rcx, 0xe0
lea rdx, [rsp + 0x298]
call fcn.1400283c0
mov qword [rsp + 0x290], 0
mov rax, qword [rsp + 0x470]
cmp dword [rax + 0xc], 0
je 0x140022d65
mov rax, qword [rsp + 0x2d8]
movzx ecx, word [rax + 0x14]
mov rax, qword [rsp + 0x2d8]
lea rax, [rax + rcx + 0x18]
mov qword [rsp + 0x290], rax
jmp 0x140022d86
mov rax, qword [rsp + 0x280]
movzx ecx, word [rax + 0x14]
mov rax, qword [rsp + 0x280]
lea rax, [rax + rcx + 0x18]
mov qword [rsp + 0x290], rax
mov dword [rsp + 0x2fc], 0
jmp 0x140022da4
mov eax, dword [rsp + 0x2fc]
add eax, 1
mov dword [rsp + 0x2fc], eax
mov eax, dword [rsp + 0x2d0]
cmp dword [rsp + 0x2fc], eax
jge 0x140022fca
lea rcx, [rsp + 0x300]
call fcn.140003220
lea rdi, [rsp + 0x308]
xor eax, eax
mov ecx, 0x20
rep stosb byte [rdi], al
lea rdi, [rsp + 0x328]
xor eax, eax
mov ecx, 9
rep stosb byte [rdi], al
mov r8d, 9
xor edx, edx
lea rcx, [rsp + 0x328]
call fcn.140044a50
movsxd rax, dword [rsp + 0x2fc]
imul rax, rax, 0x28
mov rdx, qword [rsp + 0x290]
add rdx, rax
mov r8d, 8
lea rcx, [rsp + 0x328]
call fcn.140043430
lea rcx, [rsp + 0x328]
call fcn.140044890
test rax, rax
jbe 0x140022e72
lea rdx, [rsp + 0x328]
lea rcx, [rsp + 0x348]
call fcn.140010c20
mov rcx, rax
call fcn.1400329e0
mov rdx, rax
lea rcx, [rsp + 0x300]
call fcn.140003460
lea rcx, [rsp + 0x348]
call fcn.140010bf0
movsxd rcx, dword [rsp + 0x2fc]
imul rcx, rcx, 0x28
mov rax, qword [rsp + 0x290]
mov eax, dword [rax + rcx + 8]
mov dword [rsp + 0x314], eax
mov eax, dword [rsp + 0x314]
mov dword [rsp + 0x310], eax
cmp dword [rsp + 0x2c0], 0
je 0x140022ef2
movsxd rcx, dword [rsp + 0x2fc]
imul rcx, rcx, 0x28
mov rax, qword [rsp + 0x290]
mov ecx, dword [rax + rcx + 8]
mov eax, dword [rsp + 0x2c0]
lea eax, [rcx + rax - 1]
xor edx, edx
div dword [rsp + 0x2c0]
mov dword [rsp + 0x338], eax
mov eax, dword [rsp + 0x338]
imul eax, dword [rsp + 0x2c0]
mov dword [rsp + 0x310], eax
mov rax, qword [rsp + 0x470]
cmp dword [rax + 0xc], 0
je 0x140022f12
mov rax, qword [rsp + 0x2f0]
mov qword [rsp + 0x308], rax
jmp 0x140022f20
mov eax, dword [rsp + 0x28c]
mov dword [rsp + 0x308], eax
movsxd rcx, dword [rsp + 0x2fc]
imul rcx, rcx, 0x28
mov rax, qword [rsp + 0x290]
mov eax, dword [rax + rcx + 0xc]
mov dword [rsp + 0x318], eax
movsxd rcx, dword [rsp + 0x2fc]
imul rcx, rcx, 0x28
mov rax, qword [rsp + 0x290]
mov eax, dword [rax + rcx + 0x10]
mov dword [rsp + 0x31c], eax
movsxd rcx, dword [rsp + 0x2fc]
imul rcx, rcx, 0x28
mov rax, qword [rsp + 0x290]
mov eax, dword [rax + rcx + 0x14]
mov dword [rsp + 0x320], eax
movsxd rcx, dword [rsp + 0x2fc]
imul rcx, rcx, 0x28
mov rax, qword [rsp + 0x290]
mov eax, dword [rax + rcx + 0x24]
mov dword [rsp + 0x324], eax
mov rcx, qword [rsp + 0x470]
add rcx, 0xe0
lea rdx, [rsp + 0x300]
call fcn.1400283c0
lea rcx, [rsp + 0x300]
call fcn.1400067b0
jmp 0x140022d93
lea rcx, [rsp + 0x298]
call fcn.1400067b0
xor eax, eax
test eax, eax
jne 0x14002281d
cmp qword [rsp + 0x270], 0
je 0x140022ffa
mov rcx, qword [rsp + 0x270]
call qword [sym.imp.KERNEL32.dll_CloseHandle]
cmp qword [rsp + 0x48], 0
je 0x14002300d
mov rcx, qword [rsp + 0x48]
call qword [sym.imp.KERNEL32.dll_CloseHandle]
cmp qword [rsp + 0x40], 0
je 0x140023020
mov rcx, qword [rsp + 0x40]
call qword [sym.imp.KERNEL32.dll_UnmapViewOfFile]
mov rcx, qword [rsp + 0x470]
add rcx, 0xe0
call fcn.1400283b0
cmp rax, 2
jb 0x140023045
mov dword [rsp + 0x278], 1
mov rcx, qword [rsp + 0x470]
add rcx, 0xe0
call fcn.1400283b0
mov eax, dword [rsp + 0x278]
mov rcx, qword [rsp + 0x458]
xor rcx, rsp
call fcn.140043800
add rsp, 0x460
pop rdi
ret