Function at 0x140003540
Capabilities:
Get common file path
Read file on windows
Write file on windows

Disassembly:
mov rax, rsp
push rbx
push r14
sub rsp, 0x668
mov ebx, edx
xor r14d, r14d
lea rdx, [rsp + 0x40]
mov dword [rax + 0x18], r14d
mov ecx, 0x104
mov dword [rax + 0x20], r14d
call qword [sym.imp.KERNEL32.dll_GetTempPathW]
test eax, eax
jne 0x1400035a8
call qword [sym.imp.KERNEL32.dll_GetLastError]
lea rdx, str.____GetTempPathW_Failed_With_Error_:
mov ebx, eax
lea rcx, [0x140048660]
call fcn.1400012f0
mov rcx, rax
mov edx, ebx
call fcn.140002eb0
mov rcx, rax
call fcn.140001f10
xor eax, eax
add rsp, 0x668
pop r14
pop rbx
ret
mov qword [rsp + 0x680], rbp
lea r9, str.tempfile.txt
mov qword [rsp + 0x688], rsi
lea r8, [rsp + 0x40]
lea rdx, str._s_s
mov qword [rsp + 0x660], rdi
lea rcx, [rsp + 0x250]
call qword [sym.imp.USER32.dll_wsprintfW]
mov rsi, r14
mov rbp, rbx
test ebx, ebx
je 0x140003774
nop
mov qword [rsp + 0x30], r14
lea rcx, [rsp + 0x250]
mov dword [rsp + 0x28], pe_nt_image_headers64
xor r9d, r9d
xor r8d, r8d
mov dword [rsp + 0x20], 2
mov edx, 0x40000000
call qword [sym.imp.KERNEL32.dll_CreateFileW]
mov rdi, rax
cmp rax, 0xffffffffffffffff
je 0x140003890
call qword [sym.imp.KERNEL32.dll_GetProcessHeap]
mov edx, 8
mov r8d, 0xfffff
mov rcx, rax
call qword [sym.imp.KERNEL32.dll_HeapAlloc]
mov rbx, rax
call fcn.1400176c0
mov r9d, eax
mov r8d, 0xfffff
mov eax, 0x80808081
imul r9d
add edx, r9d
sar edx, 7
mov ecx, edx
shr ecx, 0x1f
add edx, ecx
imul ecx, edx, 0xff
sub r9d, ecx
mov rcx, rbx
mov edx, r9d
call fcn.140012a30
lea r9, [rsp + 0x698]
mov qword [rsp + 0x20], r14
mov r8d, 0xfffff
mov rdx, rbx
mov rcx, rdi
call qword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
je 0x140003816
cmp dword [rsp + 0x698], 0xfffff
jne 0x140003816
xor edx, edx
mov r8d, 0xfffff
mov rcx, rbx
call fcn.140012a30
mov rcx, rdi
call qword [sym.imp.KERNEL32.dll_CloseHandle]
mov qword [rsp + 0x30], r14
lea rcx, [rsp + 0x250]
mov dword [rsp + 0x28], 0x4000100
xor r9d, r9d
xor r8d, r8d
mov dword [rsp + 0x20], 3
mov edx, 0x80000000
call qword [sym.imp.KERNEL32.dll_CreateFileW]
mov rdi, rax
cmp rax, 0xffffffffffffffff
je 0x140003890
lea r9, [rsp + 0x690]
mov qword [rsp + 0x20], r14
mov r8d, 0xfffff
mov rdx, rbx
mov rcx, rax
call qword [sym.imp.KERNEL32.dll_ReadFile]
test eax, eax
je 0x14000379c
cmp dword [rsp + 0x690], 0xfffff
jne 0x14000379c
xor edx, edx
mov r8d, 0xfffff
mov rcx, rbx
call fcn.140012a30
call qword [sym.imp.KERNEL32.dll_GetProcessHeap]
mov r8, rbx
xor edx, edx
mov rcx, rax
call qword [sym.imp.KERNEL32.dll_HeapFree]
mov rcx, rdi
call qword [sym.imp.KERNEL32.dll_CloseHandle]
inc rsi
cmp rsi, rbp
jb 0x1400035f0
mov eax, 1
mov rsi, qword [rsp + 0x688]
mov rbp, qword [rsp + 0x680]
mov rdi, qword [rsp + 0x660]
add rsp, 0x668
pop r14
pop rbx
ret
call qword [sym.imp.KERNEL32.dll_GetLastError]
lea rdx, str.____ReadFile_Failed_With_Error_:
mov ebx, eax
lea rcx, [0x140048660]
call fcn.1400012f0
mov rcx, rax
mov edx, ebx
call fcn.140002eb0
mov rcx, rax
call fcn.140001f10
lea rdx, str._i__Read
lea rcx, [0x140048660]
call fcn.1400012f0
mov edx, dword [rsp + 0x690]
mov rcx, rax
call fcn.140002eb0
mov rcx, rax
lea rdx, str._Bytes_of
call fcn.1400012f0
mov rcx, rax
mov edx, 0xfffff
call fcn.1400030d0
mov rcx, rax
call fcn.140001f10
xor eax, eax
jmp 0x140003779
call qword [sym.imp.KERNEL32.dll_GetLastError]
lea rdx, str.____WriteFile_Failed_With_Error_:
mov ebx, eax
lea rcx, [0x140048660]
call fcn.1400012f0
mov rcx, rax
mov edx, ebx
call fcn.140002eb0
mov rcx, rax
call fcn.140001f10
lea rdx, str._i__Written
lea rcx, [0x140048660]
call fcn.1400012f0
mov edx, dword [rsp + 0x698]
mov rcx, rax
call fcn.140002eb0
mov rcx, rax
lea rdx, str._Bytes_of
call fcn.1400012f0
mov rcx, rax
mov edx, 0xfffff
call fcn.1400030d0
mov rcx, rax
call fcn.140001f10
xor eax, eax
jmp 0x140003779
call qword [sym.imp.KERNEL32.dll_GetLastError]
lea rdx, str.____CreateFileW_Failed_With_Error_:
mov ebx, eax
lea rcx, [0x140048660]
call fcn.1400012f0
mov rcx, rax
mov edx, ebx
call fcn.140002eb0
mov rcx, rax
call fcn.140001f10
xor eax, eax
jmp 0x140003779