Function at 0x140001280
Capabilities:
Check if file exists
Create directory
Get common file path

Disassembly:
push rbp
push rbx
push rsi
push rdi
push r13
lea rbp, [rsp - 0x1d0]
sub rsp, 0x2d0
mov rax, qword [section..data]
xor rax, rsp
mov qword [rbp + 0x1c0], rax
mov rbx, r8
lea rax, [rbp - 0x50]
xor r8d, r8d
mov qword [rsp + 0x20], rax
xor r9d, r9d
mov edx, 0x1c
xor ecx, ecx
call qword [sym.imp.SHELL32.dll_SHGetFolderPathW]
test eax, eax
js 0x140001338
mov r9d, 0x104
lea r8, str.Pimax
mov edx, r9d
lea rcx, [rbp - 0x50]
call qword [sym.imp.api_ms_win_crt_string_l1_1_0.dll_wcsncat_s]
lea rcx, [rbp - 0x50]
call qword [sym.imp.SHLWAPI.dll_PathFileExistsW]
mov edi, eax
test eax, eax
jne 0x140001302
xor edx, edx
lea rcx, [rbp - 0x50]
call qword [sym.imp.KERNEL32.dll_CreateDirectoryW]
mov edi, eax
mov r9d, 0x104
lea r8, str.MagicAttach.log
mov edx, r9d
lea rcx, [rbp - 0x50]
call qword [sym.imp.api_ms_win_crt_string_l1_1_0.dll_wcsncat_s]
test edi, edi
je 0x140001338
lea rdx, [0x140004434]
lea rcx, [rbp - 0x50]
call qword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll__wfopen]
mov qword [0x140006710], rax
xor edi, edi
xorps xmm0, xmm0
mov r13, 0xffffffffffffffff
mov qword [rsp + 0x60], rdi
movups xmmword [rsp + 0x50], xmm0
mov qword [rsp + 0x68], rdi
mov r8, r13
inc r8
cmp word [rbx + r8*2], di
jne 0x140001356
mov qword [rsp + 0x300], r12
lea rcx, [rsp + 0x50]
mov qword [rsp + 0x308], r14
mov rdx, rbx
mov qword [rsp + 0x318], r15
call fcn.140001db0
mov rsi, qword [rsp + 0x60]
test rsi, rsi
jne 0x1400013c5
mov rcx, qword [0x140006710]
test rcx, rcx
je 0x1400013a7
lea rdx, str.usage:_MagicAttach_x64.exe___pid___process_id__n
call fcn.140001010
lea rcx, str.usage:_MagicAttach_x64.exe___pid___process_id__n
call fcn.140001060
mov rcx, qword [0x140006710]
call qword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_fflush]
jmp 0x140001a2e
xorps xmm0, xmm0
mov qword [rbp - 0x80], rdi
movdqu xmmword [rsp + 0x70], xmm0
lea r14, [0x140004468]
lea r12, [0x14000446c]
mov r15, qword [rsp + 0x68]
lea r9, [rsp + 0x50]
mov r11, qword [rsp + 0x50]
cmp r15, 7
cmova r9, r11
cmp rsi, 1
jb 0x140001424
lea r10, [r9 + rsi*2]
mov rdi, r9
mov rax, r10
sub rax, rdi
sar rax, 1
je 0x140001424
nop
cmp word [rdi], 0x2f
je 0x140001640
add rdi, 2
sub rax, 1
jne 0x140001410
test rsi, rsi
je 0x1400014b0
nop dword [rax]
cmp r15, 7
lea rax, [rsp + 0x50]
cmova rax, r11
cmp word [rax], 0x20
jne 0x1400014b0
cmp r15, 7
lea r9, [rsp + 0x50]
mov edx, 1
lea rax, [rsp + 0x50]
cmova rax, r11
cmova r9, r11
sub r9, rax
mov rax, rsi
sar r9, 1
sub rax, r9
cmp rax, rdx
cmovb rdx, rax
cmp r15, 7
lea rax, [rsp + 0x50]
cmova rax, r11
sub rsi, rdx
mov r8, rsi
sub r8, r9
lea rcx, [rax + r9*2]
lea rdx, [rcx + rdx*2]
lea r8, [r8*2 + 2]
call sub.VCRUNTIME140.dll_memmove
mov r15, qword [rsp + 0x68]
mov r11, qword [rsp + 0x50]
mov qword [rsp + 0x60], rsi
test rsi, rsi
jne 0x140001430
xor edi, edi
mov ebx, edi
nop dword [rax]
nop dword [rax + rax]
cmp r15, 7
lea rax, [rsp + 0x50]
cmova rax, r11
cmp rbx, rsi
jae 0x1400014f4
sub rsi, rbx
lea rbx, [rax + rbx*2]
je 0x1400014f4
nop dword [rax + rax]
cmp word [rbx], 0x22
je 0x1400017fc
add rbx, 2
sub rsi, 1
jne 0x1400014e0
mov r14, qword [rsp + 0x70]
mov r12, qword [rsp + 0x78]
cmp r14, r12
je 0x1400019d6
cmp qword [r14 + 0x18], 7
lea r10, [0x140004488]
xorps xmm0, xmm0
mov qword [rbp - 0x60], rdi
movups xmmword [rbp - 0x78], xmm0
mov ecx, 0xa
lea r9, str.handle
movabs rdx, 0x7fffffffffffffff
movabs rax, 0x7ffffffffffffffe
mov r15, r14
jbe 0x140001546
mov r15, qword [r14]
mov rsi, qword [r14 + 0x10]
cmp rsi, rax
ja 0x140001b9e
cmp rsi, 7
ja 0x140001849
mov qword [rbp - 0x68], rsi
mov edi, 7
mov qword [rbp - 0x60], rdi
lea r8, [rbp - 0x78]
movups xmm0, xmmword [r15]
movups xmmword [rbp - 0x78], xmm0
cmp rsi, 6
jne 0x140001840
mov rdx, rsi
mov rcx, r9
sub r8, r9
nop dword [rax]
movzx eax, word [rcx]
cmp word [rcx + r8], ax
jne 0x140001840
add rcx, 2
sub rdx, 1
jne 0x140001590
cmp qword [rsp + 0x68], rdi
lea rbx, [rsp + 0x50]
mov rcx, qword [0x140006710]
cmova rbx, qword [rsp + 0x50]
test rcx, rcx
je 0x1400015d3
mov r8, rbx
lea rdx, str.Injecting_process_handle:__ls_n
call fcn.140001010
mov rdx, rbx
lea rcx, str.Injecting_process_handle:__ls_n
call fcn.140001060
mov rcx, qword [0x140006710]
call qword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_fflush]
xor r8d, r8d
xor edx, edx
mov rcx, rbx
call qword [sym.imp.api_ms_win_crt_convert_l1_1_0.dll_wcstol]
movsxd rbx, eax
test eax, eax
jne 0x140001a7a
mov rcx, qword [0x140006710]
test rcx, rcx
je 0x140001620
lea rdx, str.Failed_to_get_process_handle_n
call fcn.140001010
lea rcx, str.Failed_to_get_process_handle_n
call fcn.140001060
mov rcx, qword [0x140006710]
call qword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_fflush]
xor ebx, ebx
jmp 0x140001abb
test rdi, rdi
je 0x140001424
mov r8, rdi
mov edx, 1
sub r8, r14
mov rcx, r14
nop word [rax + rax]
movzx eax, word [rcx]
cmp word [rcx + r8], ax
jne 0x14000173b
add rcx, 2
sub rdx, 1
jne 0x140001660
sub rdi, r9
sar rdi, 1
cmp rdi, r13
je 0x140001424
cmp r15, 7
lea r9, [rsp + 0x50]
cmova r9, r11
cmp rsi, 1
jb 0x1400016c4
lea r10, [r9 + rsi*2]
mov rbx, r9
mov rax, r10
sub rax, rbx
sar rax, 1
je 0x1400016c4
nop dword [rax]
cmp word [rbx], 0x20
je 0x140001744
add rbx, 2
sub rax, 1
jne 0x1400016b0
mov rbx, r13
xor eax, eax
lea rcx, [rdi + 1]
sub rbx, rdi
mov qword [rsp + 0x40], rax
mov qword [rsp + 0x48], rax
xorps xmm0, xmm0
movups xmmword [rsp + 0x30], xmm0
cmp rsi, rcx
jb 0x140001ba4
sub rsi, rcx
lea r8, [rbx - 1]
cmp rsi, r8
lea rax, [rsp + 0x50]
cmovb r8, rsi
cmp r15, 7
cmova rax, r11
lea rdx, [rax + rcx*2]
lea rcx, [rsp + 0x30]
call fcn.140001db0
mov rdx, qword [rsp + 0x78]
cmp rdx, qword [rbp - 0x80]
je 0x140001788
movups xmm0, xmmword [rsp + 0x30]
movups xmm1, xmmword [rsp + 0x40]
movups xmmword [rdx], xmm0
movups xmmword [rdx + 0x10], xmm1
add qword [rsp + 0x78], 0x20
jmp 0x1400017d9
add rdi, 2
jmp 0x140001404
test rbx, rbx
je 0x1400016c4
mov r8, rbx
mov edx, 1
sub r8, r12
mov rcx, r12
nop dword [rax + rax]
movzx eax, word [rcx]
cmp word [rcx + r8], ax
jne 0x14000177f
add rcx, 2
sub rdx, 1
jne 0x140001760
sub rbx, r9
sar rbx, 1
jmp 0x1400016c7
add rbx, 2
jmp 0x1400016a1
lea r8, [rsp + 0x30]
lea rcx, [rsp + 0x70]
call fcn.140002170
mov rdx, qword [rsp + 0x48]
cmp rdx, 7
jbe 0x1400017d9
mov rcx, qword [rsp + 0x30]
lea rdx, [rdx*2 + 2]
mov rax, rcx
cmp rdx, 0x1000
jb 0x1400017d4
mov rcx, qword [rcx - 8]
add rdx, 0x27
sub rax, rcx
add rax, 0xfffffffffffffff8
cmp rax, 0x1f
ja 0x140001a73
call fcn.14000289c
mov r8, rbx
mov qword [rsp + 0x20], 0
mov rdx, rdi
lea rcx, [rsp + 0x50]
call fcn.140001bb0
mov rsi, qword [rsp + 0x60]
jmp 0x1400013e0
test rbx, rbx
je 0x1400014f4
sub rbx, rax
sar rbx, 1
cmp rbx, r13
je 0x1400014f4
mov r8d, 1
mov qword [rsp + 0x20], rdi
mov rdx, rbx
lea rcx, [rsp + 0x50]
call fcn.140001bb0
mov r11, qword [rsp + 0x50]
mov r15, qword [rsp + 0x68]
mov rsi, qword [rsp + 0x60]
jmp 0x1400014c0
mov rbx, qword [rbp - 0x78]
jmp 0x1400018dd
mov rdi, rsi
or rdi, 7
cmp rdi, rax
jbe 0x140001891
mov rdi, rax
lea rcx, [rdx + rdx]
cmp rcx, 0x1000
jb 0x1400018af
lea rax, [rcx + 0x27]
cmp rax, rcx
jbe 0x140001baa
mov rcx, rax
call fcn.140002860
test rax, rax
je 0x140001a73
lea rbx, [rax + 0x27]
and rbx, 0xffffffffffffffe0
mov qword [rbx - 8], rax
jmp 0x1400018b7
cmp rdi, 0xa
cmovb rdi, rcx
lea rcx, [rdi + 1]
cmp rcx, rdx
ja 0x140001baa
add rcx, rcx
jne 0x14000185c
xor ebx, ebx
jmp 0x1400018b7
call fcn.140002860
mov rbx, rax
lea r8, [rsi*2 + 2]
mov qword [rbp - 0x78], rbx
mov rdx, r15
mov qword [rbp - 0x68], rsi
mov rcx, rbx
mov qword [rbp - 0x60], rdi
call sub.VCRUNTIME140.dll_memcpy
lea r10, [0x140004488]
cmp rdi, 7
lea r8, [rbp - 0x78]
cmova r8, rbx
cmp rsi, 3
jne 0x14000197d
mov rdx, rsi
mov rcx, r10
sub r8, r10
nop dword [rax]
movzx eax, word [rcx]
cmp word [rcx + r8], ax
jne 0x14000197d
add rcx, 2
sub rdx, 1
jne 0x140001900
cmp qword [rsp + 0x68], 7
lea rcx, [rsp + 0x50]
cmova rcx, qword [rsp + 0x50]
xor r8d, r8d
call qword [sym.imp.api_ms_win_crt_convert_l1_1_0.dll_wcstol]
xor edx, edx
mov ecx, 0x1fffff
mov r8d, eax
call qword [sym.imp.KERNEL32.dll_OpenProcess]
test rax, rax
jne 0x140001acd
mov rcx, qword [0x140006710]
test rcx, rcx
je 0x14000195f
lea rdx, str.Failed_to_get_process_handle_n
call fcn.140001010
lea rcx, str.Failed_to_get_process_handle_n
call fcn.140001060
mov rcx, qword [0x140006710]
call qword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_fflush]
jmp 0x140001b0d
cmp rdi, 7
jbe 0x1400019b8
lea rdx, [rdi*2 + 2]
mov rax, rbx
cmp rdx, 0x1000
jb 0x1400019b0
mov rbx, qword [rbx - 8]
add rdx, 0x27
sub rax, rbx
add rax, 0xfffffffffffffff8
cmp rax, 0x1f
ja 0x140001a73
mov rcx, rbx
call fcn.14000289c
add r14, 0x20
xor edi, edi
cmp r14, r12
jne 0x140001507
mov r15, qword [rsp + 0x68]
mov r11, qword [rsp + 0x50]
mov r14, qword [rsp + 0x70]
mov r13d, edi
test r14, r14
je 0x140001a38
mov rdx, qword [rsp + 0x78]
mov rcx, r14
call fcn.140001ee0
mov rcx, qword [rsp + 0x70]
mov rdx, qword [rbp - 0x80]
mov rax, rcx
sub rdx, rcx
and rdx, 0xffffffffffffffe0
cmp rdx, 0x1000
jb 0x140001a1c
mov rcx, qword [rcx - 8]
add rdx, 0x27
sub rax, rcx
add rax, 0xfffffffffffffff8
cmp rax, 0x1f
ja 0x140001a73
call fcn.14000289c
xorps xmm0, xmm0
mov qword [rbp - 0x80], rdi
movdqu xmmword [rsp + 0x70], xmm0
mov r11, qword [rsp + 0x50]
mov r15, qword [rsp + 0x68]
cmp r15, 7
jbe 0x140001b66
lea rdx, [r15*2 + 2]
mov rax, r11
cmp rdx, 0x1000
jb 0x140001b5e
mov r11, qword [r11 - 8]
add rdx, 0x27
sub rax, r11
add rax, 0xfffffffffffffff8
cmp rax, 0x1f
jbe 0x140001b5e
call qword [sym.imp.api_ms_win_crt_runtime_l1_1_0.dll__invalid_parameter_noinfo_noreturn]
int3
mov rcx, rbx
call fcn.1400024a0
test al, al
jne 0x140001a8a
xor ebx, ebx
jmp 0x140001abb
mov rcx, qword [0x140006710]
test rcx, rcx
je 0x140001aa2
lea rdx, str.Injected_dlls_succesfully_n
call fcn.140001010
lea rcx, str.Injected_dlls_succesfully_n
call fcn.140001060
mov rcx, qword [0x140006710]
call qword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_fflush]
neg rbx
mov rbx, qword [rbp - 0x78]
sbb r13d, r13d
neg r13d
dec r13d
jmp 0x140001b0d
mov rcx, rax
call fcn.1400024a0
test al, al
je 0x140001b0d
mov rcx, qword [0x140006710]
test rcx, rcx
je 0x140001af1
lea rdx, str.Injected_dlls_succesfully_n
call fcn.140001010
lea rcx, str.Injected_dlls_succesfully_n
call fcn.140001060
mov rcx, qword [0x140006710]
call qword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_fflush]
xor r13d, r13d
cmp rdi, 7
jbe 0x140001b48
lea rdx, [rdi*2 + 2]
mov rax, rbx
cmp rdx, 0x1000
jb 0x140001b40
mov rbx, qword [rbx - 8]
add rdx, 0x27
sub rax, rbx
add rax, 0xfffffffffffffff8
cmp rax, 0x1f
ja 0x140001a73
mov rcx, rbx
call fcn.14000289c
mov r15, qword [rsp + 0x68]
xor edi, edi
mov r11, qword [rsp + 0x50]
mov r14, qword [rsp + 0x70]
jmp 0x1400019d9
mov rcx, r11
call fcn.14000289c
mov r15, qword [rsp + 0x318]
mov eax, r13d
mov r14, qword [rsp + 0x308]
mov r12, qword [rsp + 0x300]
mov rcx, qword [rbp + 0x1c0]
xor rcx, rsp
call fcn.140002840
add rsp, 0x2d0
pop r13
pop rdi
pop rsi
pop rbx
pop rbp
ret
call fcn.140001260
int3
call fcn.140001d90
int3
call fcn.1400011c0
int3