Function at 0x140012340
Capabilities:
Get common file path
Query environment variable
Write file on windows

Disassembly:
push rbp
push rbx
push rsi
push r12
push r13
lea rbp, [rsp - 0xb70]
sub rsp, 0xc70
mov rax, qword [0x1401fa010]
xor rax, rsp
mov qword [rbp + 0xb50], rax
movzx r13d, dl
mov r12, rcx
call fcn.14000fbc0
xor bl, bl
call qword [sym.imp.KERNEL32.dll_GetCurrentProcess]
lea r8, [rsp + 0x38]
mov edx, 8
mov rcx, rax
call qword [sym.imp.ADVAPI32.dll_OpenProcessToken]
xor esi, esi
test eax, eax
je 0x1400123e0
mov rcx, qword [rsp + 0x38]
lea rax, [rsp + 0x30]
lea r9d, [rsi + 4]
mov qword [rsp + 0x20], rax
lea r8, [rsp + 0x40]
mov dword [rsp + 0x30], esi
lea edx, [rsi + 0x12]
call qword [sym.imp.ADVAPI32.dll_GetTokenInformation]
test eax, eax
je 0x1400123cd
cmp dword [rsp + 0x30], 4
jne 0x1400123cd
cmp dword [rsp + 0x40], 2
sete bl
mov rcx, qword [rsp + 0x38]
call qword [sym.imp.KERNEL32.dll_CloseHandle]
test bl, bl
jne 0x1400129b9
mov qword [rsp + 0xcb0], rdi
lea r9, [rsp + 0x30]
mov ebx, 0x400
mov qword [rsp + 0xc68], r14
mov edx, ebx
mov qword [rsp + 0xc60], r15
xor r8d, r8d
mov qword [rsp + 0x30], rsi
lea rcx, [0x14018a030]
call qword [sym.imp.SHELL32.dll_SHGetKnownFolderPath]
mov word [rsp + 0x50], si
mov rdi, 0xffffffffffffffff
mov r15d, 0x80070057
mov r14d, 0x7ffffffe
test eax, eax
jns 0x140012518
mov r8d, ebx
lea rdx, [rsp + 0x50]
lea rcx, str.ProgramW6432
call qword [sym.imp.KERNEL32.dll_GetEnvironmentVariableW]
lea r8, str.GetEnvironmentVariable_num_characters___d_n_n
mov edx, ebx
mov r9d, eax
lea rcx, [rbp + 0x750]
mov esi, eax
call fcn.140008bb0
xor ecx, ecx
call qword [sym.imp.KERNEL32.dll_SetConsoleOutputCP]
mov ecx, 0xfffffff5
call qword [sym.imp.KERNEL32.dll_GetStdHandle]
xor ecx, ecx
mov dword [rsp + 0x40], ecx
cmp rax, rdi
je 0x1400124bd
lea rdx, [rbp + 0x750]
mov r8, rdi
inc r8
cmp byte [rdx + r8], cl
jne 0x140012490
mov qword [rsp + 0x20], rcx
lea r9, [rsp + 0x40]
mov rcx, rax
lea rdx, [rbp + 0x750]
call qword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
jne 0x1400124bd
call qword [sym.imp.KERNEL32.dll_GetLastError]
test esi, esi
jne 0x140012516
xor ecx, ecx
call qword [sym.imp.KERNEL32.dll_SetConsoleOutputCP]
mov ecx, 0xfffffff5
call qword [sym.imp.KERNEL32.dll_GetStdHandle]
xor esi, esi
mov dword [rsp + 0x40], esi
cmp rax, rdi
je 0x1400126bd
lea r9, [rsp + 0x40]
mov qword [rsp + 0x20], rsi
mov r8d, 0xbf
lea rdx, str.Looks_like_this_machine_is_running_a_32_bit_OS._Nevertheless_GetEnvironmentVariable__ProgramW6432__returned_zero_characters_so_we_cant_find_3rd_party_plugins_from_the_iTunes_plug_ins_folder.
mov rcx, rax
call qword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
jne 0x1400126bd
call qword [sym.imp.KERNEL32.dll_GetLastError]
jmp 0x1400126bd
xor esi, esi
mov r9, qword [rsp + 0x30]
test r9, r9
je 0x1400125dd
mov rcx, rbx
lea rax, [rsp + 0x50]
nop
cmp word [rax], 0
je 0x140012540
add rax, 2
sub rcx, 1
jne 0x140012530
mov r8, rbx
mov eax, r15d
sub r8, rcx
test rcx, rcx
cmove r8, rsi
cmovne eax, esi
je 0x1400125a7
mov rdx, rbx
lea rcx, [rsp + 0x50]
lea rcx, [rcx + r8*2]
sub rdx, r8
je 0x140012591
mov rax, r14
sub r9, rcx
nop dword [rax]
test rax, rax
je 0x140012591
movzx r8d, word [r9 + rcx]
test r8w, r8w
je 0x140012591
mov word [rcx], r8w
dec rax
add rcx, 2
sub rdx, 1
jne 0x140012570
test rdx, rdx
lea rax, [rcx - 2]
cmovne rax, rcx
mov word [rax], si
mov eax, 0x8007007a
cmovne eax, esi
test eax, eax
jns 0x1400125dd
xor ecx, ecx
call qword [sym.imp.KERNEL32.dll_SetConsoleOutputCP]
mov ecx, 0xfffffff5
call qword [sym.imp.KERNEL32.dll_GetStdHandle]
mov dword [rsp + 0x40], esi
cmp rax, rdi
je 0x1400126a8
mov r8d, 0x32
lea rdx, str.StringCchCat_pathString__1024__folderPath__failed_n
jmp 0x14001268b
mov rcx, rbx
lea rax, [rsp + 0x50]
cmp word [rax], 0
je 0x1400125f5
add rax, 2
sub rcx, 1
jne 0x1400125e5
mov rax, rbx
sub rax, rcx
test rcx, rcx
cmove rax, rsi
je 0x140012662
mov rdx, rbx
lea rcx, [rsp + 0x50]
lea rcx, [rcx + rax*2]
sub rdx, rax
je 0x140012643
lea r9, str.iTunesPlug_ins_
mov rax, r14
sub r9, rcx
test rax, rax
je 0x140012643
movzx r8d, word [r9 + rcx]
test r8w, r8w
je 0x140012643
mov word [rcx], r8w
dec rax
add rcx, 2
sub rdx, 1
jne 0x140012622
test rdx, rdx
lea rax, [rcx - 2]
cmovne rax, rcx
mov word [rax], si
je 0x140012662
lea rdx, [rsp + 0x50]
mov rcx, r12
call fcn.140011f20
jmp 0x1400126a8
xor ecx, ecx
call qword [sym.imp.KERNEL32.dll_SetConsoleOutputCP]
mov ecx, 0xfffffff5
call qword [sym.imp.KERNEL32.dll_GetStdHandle]
mov dword [rsp + 0x40], esi
cmp rax, rdi
je 0x1400126a8
mov r8d, 0x14
lea rdx, str.StringCchCat_failed_n
lea r9, [rsp + 0x40]
mov qword [rsp + 0x20], rsi
mov rcx, rax
call qword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
jne 0x1400126a8
call qword [sym.imp.KERNEL32.dll_GetLastError]
mov rcx, qword [rsp + 0x30]
test rcx, rcx
je 0x1400126bd
call qword [sym.imp.ole32.dll_CoTaskMemFree]
mov qword [rsp + 0x30], rsi
mov r8d, ebx
mov word [rsp + 0x50], si
lea rdx, [rsp + 0x50]
xor ecx, ecx
call qword [sym.imp.KERNEL32.dll_GetModuleFileNameW]
test eax, eax
je 0x140012770
lea rcx, [rsp + 0x50]
call qword [sym.imp.SHLWAPI.dll_PathRemoveFileSpecW]
test eax, eax
je 0x140012770
mov rcx, rbx
lea rax, [rsp + 0x50]
cmp word [rax], 0
je 0x140012705
add rax, 2
sub rcx, 1
jne 0x1400126f5
mov rax, rbx
sub rax, rcx
test rcx, rcx
cmove rax, rsi
je 0x140012770
mov rdx, rbx
lea rcx, [rsp + 0x50]
lea rcx, [rcx + rax*2]
sub rdx, rax
je 0x140012753
lea r9, str.Plug_ins_
mov rax, r14
sub r9, rcx
test rax, rax
je 0x140012753
movzx r8d, word [r9 + rcx]
test r8w, r8w
je 0x140012753
mov word [rcx], r8w
dec rax
add rcx, 2
sub rdx, 1
jne 0x140012732
test rdx, rdx
lea rax, [rcx - 2]
cmovne rax, rcx
mov word [rax], si
je 0x140012770
lea rdx, [rsp + 0x50]
mov rcx, r12
call fcn.140011f20
lea r9, [rsp + 0x30]
xor r8d, r8d
mov edx, ebx
lea rcx, [0x14018a020]
call qword [sym.imp.SHELL32.dll_SHGetKnownFolderPath]
test eax, eax
js 0x140012935
mov r9, qword [rsp + 0x30]
mov word [rsp + 0x50], si
test r9, r9
je 0x140012860
mov rcx, rbx
lea rax, [rsp + 0x50]
nop word [rax + rax]
cmp word [rax], 0
je 0x1400127c0
add rax, 2
sub rcx, 1
jne 0x1400127b0
mov rax, rbx
sub rax, rcx
test rcx, rcx
cmove rax, rsi
cmovne r15d, esi
je 0x140012829
mov rdx, rbx
lea rcx, [rsp + 0x50]
lea rcx, [rcx + rax*2]
sub rdx, rax
je 0x140012811
mov rax, r14
sub r9, rcx
nop word [rax + rax]
test rax, rax
je 0x140012811
movzx r8d, word [r9 + rcx]
test r8w, r8w
je 0x140012811
mov word [rcx], r8w
dec rax
add rcx, 2
sub rdx, 1
jne 0x1400127f0
test rdx, rdx
lea rax, [rcx - 2]
mov r15d, 0x8007007a
cmovne rax, rcx
cmovne r15d, esi
mov word [rax], si
test r15d, r15d
jns 0x140012860
xor ecx, ecx
call qword [sym.imp.KERNEL32.dll_SetConsoleOutputCP]
mov ecx, 0xfffffff5
call qword [sym.imp.KERNEL32.dll_GetStdHandle]
mov dword [rsp + 0x40], esi
cmp rax, rdi
je 0x140012923
mov r8d, 0x32
lea rdx, str.StringCchCat_pathString__1024__folderPath__failed_n
jmp 0x140012906
mov rcx, rbx
lea rax, [rsp + 0x50]
cmp word [rax], 0
je 0x140012878
add rax, 2
sub rcx, 1
jne 0x140012868
mov rax, rbx
sub rax, rcx
test rcx, rcx
cmove rax, rsi
je 0x1400128dd
lea rcx, [rsp + 0x50]
lea rcx, [rcx + rax*2]
sub rbx, rax
je 0x1400128be
lea rdx, str.Apple_ComputeriTunesiTunes_Plug_ins_
sub rdx, rcx
nop
test r14, r14
je 0x1400128be
movzx eax, word [rdx + rcx]
test ax, ax
je 0x1400128be
mov word [rcx], ax
dec r14
add rcx, 2
sub rbx, 1
jne 0x1400128a0
test rbx, rbx
lea rax, [rcx - 2]
cmovne rax, rcx
mov word [rax], si
je 0x1400128dd
lea rdx, [rsp + 0x50]
mov rcx, r12
call fcn.140011f20
jmp 0x140012923
xor ecx, ecx
call qword [sym.imp.KERNEL32.dll_SetConsoleOutputCP]
mov ecx, 0xfffffff5
call qword [sym.imp.KERNEL32.dll_GetStdHandle]
mov dword [rsp + 0x40], esi
cmp rax, rdi
je 0x140012923
mov r8d, 0x14
lea rdx, str.StringCchCat_failed_n
lea r9, [rsp + 0x40]
mov qword [rsp + 0x20], rsi
mov rcx, rax
call qword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
jne 0x140012923
call qword [sym.imp.KERNEL32.dll_GetLastError]
mov rcx, qword [rsp + 0x30]
test rcx, rcx
je 0x1400129a1
call qword [sym.imp.ole32.dll_CoTaskMemFree]
jmp 0x1400129a1
mov r9d, eax
lea r8, str.SHGetKnownFolderPath_FOLDERID_RoamingAppData_failed._HRESULT__0x_X_n_n
mov rdx, rbx
lea rcx, [rbp + 0x750]
call fcn.140008bb0
xor ecx, ecx
call qword [sym.imp.KERNEL32.dll_SetConsoleOutputCP]
mov ecx, 0xfffffff5
call qword [sym.imp.KERNEL32.dll_GetStdHandle]
mov dword [rsp + 0x40], esi
cmp rax, rdi
je 0x1400129a1
lea rcx, [rbp + 0x750]
inc rdi
cmp byte [rcx + rdi], 0
jne 0x140012971
mov r8, rdi
mov qword [rsp + 0x20], rsi
lea r9, [rsp + 0x40]
mov rcx, rax
lea rdx, [rbp + 0x750]
call qword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
jne 0x1400129a1
call qword [sym.imp.KERNEL32.dll_GetLastError]
mov r14, qword [rsp + 0xc68]
mov rdi, qword [rsp + 0xcb0]
mov r15, qword [rsp + 0xc60]
movzx edx, r13b
mov rcx, r12
call fcn.14000cd90
mov rcx, qword [rbp + 0xb50]
xor rcx, rsp
call fcn.140183d70
add rsp, 0xc70
pop r13
pop r12
pop rsi
pop rbx
pop rbp
ret