Function at 0x140022620
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 0x14002268c
xor eax, eax
jmp 0x140022f10
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.140028130
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 0x140022717
jmp 0x140022e91
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 0x140022770
jmp 0x140022e91
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 0x1400227a1
jmp 0x140022e91
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 0x14002283d
mov rax, qword [rsp + 0x280]
cmp dword [rax], 0x4550
je 0x140022842
jmp 0x140022e91
mov rax, qword [rsp + 0x280]
movzx eax, word [rax + 0x16]
and eax, 0x2000
test eax, eax
je 0x140022864
mov dword [rsp + 0x450], 1
jmp 0x14002286f
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 0x1400228a5
mov rax, qword [rsp + 0x470]
mov dword [rax + 0xc], 0
jmp 0x1400228d7
mov rax, qword [rsp + 0x280]
movzx eax, word [rax + 0x18]
cmp eax, 0x20b
jne 0x1400228d7
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 0x140022997
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 0x1400229f1
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.1400437a4
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 0x140022a4a
jmp 0x140022e91
mov r8d, dword [rsp + 0x2e8]
mov rdx, qword [rsp + 0x40]
mov rcx, qword [rsp + 0x470]
mov rcx, qword [rcx + 0x68]
call fcn.140043120
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 0x140022ab3
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 0x140022ada
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 0x140022b56
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 0x140022b76
mov rax, qword [rsp + 0x2f0]
mov qword [rsp + 0x2a0], rax
jmp 0x140022b84
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.1400280b0
mov qword [rsp + 0x290], 0
mov rax, qword [rsp + 0x470]
cmp dword [rax + 0xc], 0
je 0x140022c15
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 0x140022c36
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 0x140022c54
mov eax, dword [rsp + 0x2fc]
add eax, 1
mov dword [rsp + 0x2fc], eax
mov eax, dword [rsp + 0x2d0]
cmp dword [rsp + 0x2fc], eax
jge 0x140022e7a
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.140044740
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.140043120
lea rcx, [rsp + 0x328]
call fcn.140044580
test rax, rax
jbe 0x140022d22
lea rdx, [rsp + 0x328]
lea rcx, [rsp + 0x348]
call fcn.140010c00
mov rcx, rax
call fcn.1400326d0
mov rdx, rax
lea rcx, [rsp + 0x300]
call fcn.140003460
lea rcx, [rsp + 0x348]
call fcn.140010bd0
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 0x140022da2
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 0x140022dc2
mov rax, qword [rsp + 0x2f0]
mov qword [rsp + 0x308], rax
jmp 0x140022dd0
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.1400280b0
lea rcx, [rsp + 0x300]
call fcn.1400067b0
jmp 0x140022c43
lea rcx, [rsp + 0x298]
call fcn.1400067b0
xor eax, eax
test eax, eax
jne 0x1400226cd
cmp qword [rsp + 0x270], 0
je 0x140022eaa
mov rcx, qword [rsp + 0x270]
call qword [sym.imp.KERNEL32.dll_CloseHandle]
cmp qword [rsp + 0x48], 0
je 0x140022ebd
mov rcx, qword [rsp + 0x48]
call qword [sym.imp.KERNEL32.dll_CloseHandle]
cmp qword [rsp + 0x40], 0
je 0x140022ed0
mov rcx, qword [rsp + 0x40]
call qword [sym.imp.KERNEL32.dll_UnmapViewOfFile]
mov rcx, qword [rsp + 0x470]
add rcx, 0xe0
call fcn.1400280a0
cmp rax, 2
jb 0x140022ef5
mov dword [rsp + 0x278], 1
mov rcx, qword [rsp + 0x470]
add rcx, 0xe0
call fcn.1400280a0
mov eax, dword [rsp + 0x278]
mov rcx, qword [rsp + 0x458]
xor rcx, rsp
call fcn.1400434f0
add rsp, 0x460
pop rdi
ret