Function at 0x100161c90
Capabilities:
Check if file exists
Write file on windows

Disassembly:
push r14
mov eax, 0x15e0
call fcn.10005f3c0
sub rsp, rax
mov qword [rsp + 0x70], 0xfffffffffffffffe
mov qword [rsp + 0x15f8], rbx
mov qword [rsp + 0x1600], rsi
mov qword [rsp + 0x1608], rdi
mov rax, qword [0x10022f440]
xor rax, rsp
mov qword [rsp + 0x15d0], rax
mov rsi, rcx
lea rcx, [rsp + 0x78]
call qword [sym.imp.KERNEL32.dll_GetLocalTime]
mov qword [rsp + 0x60], 0xffffffffffffffff
call qword [sym.imp.KERNEL32.dll_GetCurrentThread]
mov rcx, rax
lea r9, [rsp + 0x60]
mov edx, 4
lea r8d, [rdx - 3]
call qword [sym.imp.ADVAPI32.dll_OpenThreadToken]
test eax, eax
jne 0x100161d23
call qword [sym.imp.KERNEL32.dll_GetLastError]
mov edi, eax
cmp eax, 0x3f0
je 0x100161d53
or edi, 0x80130000
xor ebx, ebx
jmp 0x100161d57
call qword [sym.imp.ADVAPI32.dll_RevertToSelf]
test eax, eax
jne 0x100161d53
call qword [sym.imp.KERNEL32.dll_GetLastError]
mov edi, eax
mov rcx, qword [rsp + 0x60]
call qword [sym.imp.KERNEL32.dll_CloseHandle]
mov qword [rsp + 0x60], 0xffffffffffffffff
or edi, 0x80130000
xor ebx, ebx
jmp 0x100161d57
xor ebx, ebx
mov edi, ebx
mov ecx, edi
call fcn.10015ed00
nop
mov rcx, qword [rsi + 0x2b0]
mov rax, qword [rcx]
lea rdx, [rsp + 0x90]
call qword [rax + reloc.WS2_32.dll_htonl]
nop
cmp dword [rsi + 0x180], 0
jne 0x100161e13
mov edx, dword [rsi + 0x17c]
mov rcx, rsi
call fcn.100162080
movzx eax, word [rsp + 0x84]
movzx ecx, word [rsp + 0x82]
movzx edx, word [rsp + 0x80]
movzx r8d, word [rsp + 0x78]
movzx r10d, word [rsp + 0x7e]
movzx r11d, word [rsp + 0x7a]
mov dword [rsp + 0x50], eax
mov dword [rsp + 0x48], ecx
mov dword [rsp + 0x40], edx
mov dword [rsp + 0x38], r8d
mov dword [rsp + 0x30], r10d
mov dword [rsp + 0x28], r11d
mov rax, qword [rsp + 0x190]
mov qword [rsp + 0x20], rax
mov r9, qword [rsi + 0x288]
lea r8, [0x100045330]
mov edx, 0x104
lea rcx, [rsp + 0x1b0]
call fcn.10006c5f0
mov ecx, eax
call fcn.10015ec90
lea rdx, [rsp + 0x1b0]
jmp 0x100161e6a
lea rcx, [rsp + 0x1b0]
lea rdx, [rsi + 0x188]
mov r8d, 0x118
call sub.MSVCR100.dll_memcpy
mov r11, qword [rsp + 0x190]
mov qword [rsp + 0x20], r11
lea r9, [rsp + 0x1b0]
lea r8, [0x100045380]
mov edx, 0x104
lea rcx, [rsp + 0x3c0]
call fcn.10006c5f0
mov ecx, eax
call fcn.10015ec90
lea rdx, [rsp + 0x3c0]
mov rcx, rsi
call fcn.100057700
mov r14d, 2
mov edi, r14d
cmp dword [rsi + 0x180], r14d
jne 0x100161e9b
lea edi, [r14 + 1]
mov rcx, qword [rsi + 0x100]
call qword [sym.imp.SHLWAPI.dll_PathFileExistsW]
test eax, eax
cmove edi, r14d
mov rcx, qword [rsi + 0x2a8]
cmp rcx, 0xffffffffffffffff
je 0x100161eae
call qword [sym.imp.KERNEL32.dll_CloseHandle]
mov qword [rsp + 0x30], rbx
mov dword [rsp + 0x28], 0x80
mov dword [rsp + 0x20], edi
xor r9d, r9d
mov edx, 0x40000000
lea r8d, [r9 + 1]
mov rcx, qword [rsi + 0x100]
call qword [sym.imp.KERNEL32.dll_CreateFileW]
mov qword [rsi + 0x2a8], rax
mov dword [rsp + 0x6c], 0xfeff
mov qword [rsp + 0x20], rbx
lea r9, [rsp + 0x68]
mov r8d, r14d
lea rdx, [rsp + 0x6c]
mov rcx, rax
call qword [sym.imp.KERNEL32.dll_WriteFile]
mov rcx, qword [rsi + 0x2b0]
mov rax, qword [rcx]
mov r9d, 0x7ff
lea r8, [rsp + 0x5d0]
mov rdx, rsi
call qword [rax]
lea r11, [rsp + 0x5d0]
or rax, 0xffffffffffffffff
nop dword [rax + rax]
inc rax
cmp word [r11 + rax*2], 0
jne 0x100161f30
lea r8d, [rax + rax]
mov qword [rsp + 0x20], rbx
lea r9, [rsp + 0x68]
lea rdx, [rsp + 0x5d0]
mov rcx, qword [rsi + 0x2a8]
call qword [sym.imp.KERNEL32.dll_WriteFile]
mov rcx, qword [rsi + 0x2b0]
mov rax, qword [rcx]
call qword [rax + 0x10]
test eax, eax
je 0x100161f7c
mov rcx, qword [rsi + 0x100]
call sym.ReportingServicesService.exe_RsDumpSetLogFile
nop
jmp 0x100161f80
mov rdx, qword [rsp + 0x190]
test rdx, rdx
je 0x100161fec
lea rax, [rsp + 0x90]
cmp rdx, rax
je 0x100161fec
mov rax, rdx
mov r8d, 0x200
and rax, 0xffffffffffffe000
je 0x100161fb6
cmp word [rax + 4], r8w
jne 0x100161fb6
mov rax, qword [rax + 0x28]
mov rax, qword [rax + 8]
mov rcx, qword [rax + 0x10]
dec rcx
not rcx
and rcx, rdx
je 0x100161fd4
cmp word [rcx + 4], r8w
jne 0x100161fd4
mov rcx, qword [rcx + 0x28]
mov rcx, qword [rcx + 8]
test byte [rcx + 0x28], 8
jne 0x100161fe4
mov rax, qword [rcx]
call qword [rax + 0x28]
mov qword [rsp + 0x190], rbx
mov rdx, qword [rsp + 0x60]
cmp rdx, 0xffffffffffffffff
je 0x100162038
xor ecx, ecx
call qword [sym.imp.ADVAPI32.dll_SetThreadToken]
test eax, eax
jne 0x10016202d
call qword [sym.imp.KERNEL32.dll_GetLastError]
mov ebx, eax
mov rcx, qword [rsp + 0x60]
cmp rcx, 0xffffffffffffffff
je 0x100162025
call qword [sym.imp.KERNEL32.dll_CloseHandle]
mov qword [rsp + 0x60], 0xffffffffffffffff
or ebx, 0x80130000
jmp 0x100162041
mov rcx, qword [rsp + 0x60]
call qword [sym.imp.KERNEL32.dll_CloseHandle]
mov qword [rsp + 0x60], 0xffffffffffffffff
mov ecx, ebx
call fcn.10015ed00
mov rcx, qword [rsp + 0x15d0]
xor rcx, rsp
call fcn.10005f420
lea r11, [rsp + 0x15e0]
mov rbx, qword [r11 + 0x18]
mov rsi, qword [r11 + 0x20]
mov rdi, qword [r11 + 0x28]
mov rsp, r11
pop r14
ret