Function at 0x10040d170
Capabilities:
Get file size
Read file on windows
Write file on windows

Disassembly:
sub rsp, 0x28
cmp dword [0x1004276d0], 3
jb 0x100407c90
mov qword [rsp + 0x30], rbx
xor ebx, ebx
cmp word [0x100430d10], bx
mov qword [rsp + 0x20], rdi
lea rdi, [0x100430d10]
jne 0x100407b7b
mov rcx, qword [0x100427d90]
test rcx, rcx
je 0x100407aff
call fcn.1004070f0
cmp word [0x100430d10], bx
jne 0x100407b7b
lea rcx, [0x1004308d8]
call fcn.1004070f0
cmp word [0x100430d10], bx
jne 0x100407b7b
cmp word [str.SQLDUMPER_UNKNOWN_APP.EXE], bx
je 0x100407b7b
lea rcx, str.SQLDUMPER_UNKNOWN_APP.EXE
call qword [sym.imp.SHLWAPI.dll_PathFindFileNameW]
mov rdx, rax
test rax, rax
je 0x100407b7b
mov r9d, 0x104
mov r8, rdi
sub rdx, rdi
nop
lea rcx, [r9 + 0x7ffffefa]
test rcx, rcx
je 0x100407b64
movzx eax, word [rdx + r8]
test ax, ax
je 0x100407b64
mov word [r8], ax
add r8, 2
sub r9, 1
jne 0x100407b40
test r9, r9
lea rax, [r8 - 2]
cmovne rax, r8
mov word [rax], bx
jne 0x100407b7b
mov word [0x100430d10], bx
mov rdx, rdi
call fcn.100401ab0
mov edx, dword [0x100430f18]
mov rdi, qword [rsp + 0x20]
mov ecx, dword [0x100430f1c]
test edx, edx
jne 0x100407c0c
mov edx, ebx
test ecx, ecx
jne 0x100407bdd
cmp dword [0x100427d50], ebx
jne 0x100407bc5
movzx ecx, word [0x100427d54]
movzx edx, byte [0x100427d57]
movzx eax, byte [0x100427d56]
shl ecx, 0x10
shl edx, 0x10
or edx, eax
jmp 0x100407bd1
mov ecx, dword [0x100427dc4]
mov edx, dword [0x100427dc0]
mov dword [0x100430f18], edx
mov dword [0x100430f1c], ecx
test edx, edx
jne 0x100407c0c
test ecx, ecx
jne 0x100407c0c
mov eax, dword [0x100430ae0]
mov ecx, dword [0x100430ae4]
mov dword [0x100430f18], eax
mov dword [0x100430f1c], ecx
test eax, eax
jne 0x100407c0c
test ecx, ecx
jne 0x100407c0c
mov qword [0x100430f18], rbx
cmp word [0x100430f20], bx
jne 0x100407c36
lea rcx, [0x100430af0]
call fcn.100407170
cmp word [0x100430f20], bx
jne 0x100407c36
lea rcx, str.SQLDUMPER_UNKNOWN_MODULE.DLL
call fcn.100407170
cmp dword [0x100431128], ebx
jne 0x100407c6f
mov ecx, dword [0x10043112c]
test ecx, ecx
jne 0x100407c6f
mov eax, dword [0x100430cf8]
mov ecx, dword [0x100430cfc]
mov dword [0x100431128], eax
mov dword [0x10043112c], ecx
test eax, eax
jne 0x100407c6f
test ecx, ecx
jne 0x100407c6f
mov qword [0x100431128], rbx
mov r8d, dword [0x100427dd8]
mov rdx, qword [0x100427dd0]
mov rbx, qword [rsp + 0x30]
add rsp, 0x28
jmp 0x10040d170
add rsp, 0x28
ret
push rbp
push rdi
mov eax, 0x1078
call fcn.100412d40
sub rsp, rax
mov rax, qword [0x100422010]
xor rax, rsp
mov qword [rsp + 0x1050], rax
mov rdi, rdx
lea rcx, [0x100422050]
test rdx, rdx
mov ebp, r8d
mov edx, 3
jne 0x10040d1bf
lea r8, str.Log_file_name_is_not_specified.
call fcn.100401b20
mov eax, 1
jmp 0x10040d457
mov qword [rsp + 0x1090], rbx
lea r8, str.Start_generating_log_file_tail.
mov qword [rsp + 0x10a8], rsi
mov qword [rsp + 0x1060], r15
call fcn.100401b20
xor r15d, r15d
lea r8, [0x100443b84]
mov esi, 0x100000
lea rdx, str..log
cmp ebp, esi
lea rcx, [0x100427924]
mov ebx, r15d
cmovbe esi, ebp
call fcn.10040ce90
test eax, eax
je 0x10040d405
mov qword [rsp + 0x30], r15
lea r8d, [r15 + 3]
mov dword [rsp + 0x28], 0x80
xor r9d, r9d
mov edx, 0x80000000
mov dword [rsp + 0x20], 3
mov rcx, rdi
call qword [sym.imp.KERNEL32.dll_CreateFileW]
mov rbp, rax
cmp rax, 0xffffffffffffffff
je 0x10040d3de
xor edx, edx
mov qword [rsp + 0x1068], r14
mov rcx, rax
call qword [sym.imp.KERNEL32.dll_GetFileSize]
cmp eax, 0xffffffff
je 0x10040d3a2
cmp eax, esi
jbe 0x10040d289
mov edx, esi
lea r9d, [r15 + 2]
neg edx
xor r8d, r8d
mov rcx, rbp
call qword [sym.imp.KERNEL32.dll_SetFilePointer]
cmp eax, 0xffffffff
je 0x10040d3a2
mov qword [rsp + 0x30], r15
lea rcx, [0x100443b84]
mov dword [rsp + 0x28], 0x80
xor r9d, r9d
xor r8d, r8d
mov dword [rsp + 0x20], 2
mov edx, 0x40000000
call qword [sym.imp.KERNEL32.dll_CreateFileW]
mov r14, rax
cmp rax, 0xffffffffffffffff
je 0x10040d38c
mov ebx, 1
mov edi, r15d
test esi, esi
je 0x10040d37c
mov qword [rsp + 0x1070], r12
mov r12d, 0x1000
cmp ebx, 1
jne 0x10040d34f
mov r8d, esi
mov dword [rsp + 0x40], r15d
sub r8d, edi
mov qword [rsp + 0x20], r15
cmp r8d, r12d
lea r9, [rsp + 0x40]
lea rdx, [rsp + 0x50]
mov rcx, rbp
cmova r8d, r12d
call qword [sym.imp.KERNEL32.dll_ReadFile]
mov ebx, eax
test eax, eax
je 0x10040d353
mov r8d, dword [rsp + 0x40]
test r8d, r8d
je 0x10040d34f
lea r9, [rsp + 0x44]
mov dword [rsp + 0x44], r15d
lea rdx, [rsp + 0x50]
mov qword [rsp + 0x20], r15
mov rcx, r14
call qword [sym.imp.KERNEL32.dll_WriteFile]
mov ebx, eax
mov eax, dword [rsp + 0x40]
cmp dword [rsp + 0x44], eax
jne 0x10040d387
add edi, eax
cmp esi, edi
ja 0x10040d2e1
test ebx, ebx
jne 0x10040d374
call qword [sym.imp.KERNEL32.dll_GetLastError]
lea r8, str.FileCopy:_Unable_to_read_write_file__error__d
mov edx, 1
mov r9d, eax
lea rcx, [0x100422050]
call fcn.100401b20
mov r12, qword [rsp + 0x1070]
mov rcx, r14
call qword [sym.imp.KERNEL32.dll_CloseHandle]
jmp 0x10040d3c7
mov ebx, r15d
jmp 0x10040d353
call qword [sym.imp.KERNEL32.dll_GetLastError]
lea r9, [0x100443b84]
lea r8, str.Unable_to_open_file__s_for_write__error__d
jmp 0x10040d3b2
call qword [sym.imp.KERNEL32.dll_GetLastError]
mov r9, rdi
lea r8, str.Unable_to_set_position_in_file__s__error__d
mov edx, 1
mov dword [rsp + 0x20], eax
lea rcx, [0x100422050]
call fcn.100401b20
mov rcx, rbp
call qword [sym.imp.KERNEL32.dll_CloseHandle]
mov r14, qword [rsp + 0x1068]
test ebx, ebx
jne 0x10040d425
jmp 0x10040d41d
call qword [sym.imp.KERNEL32.dll_GetLastError]
mov r9, rdi
lea r8, str.Unable_to_open_file__s__error__d
lea rcx, [0x100422050]
mov dword [rsp + 0x20], eax
mov edx, 1
call fcn.100401b20
jmp 0x10040d41d
lea r8, str.Unable_to_construct_name_for_temporary_log_file
mov edx, 1
lea rcx, [0x100422050]
call fcn.100401b20
mov word [0x100443b84], r15w
lea r8, str.Finished_generating_log_file_tail.
mov edx, 3
lea rcx, [0x100422050]
call fcn.100401b20
mov r15, qword [rsp + 0x1060]
mov eax, ebx
mov rbx, qword [rsp + 0x1090]
mov rsi, qword [rsp + 0x10a8]
mov rcx, qword [rsp + 0x1050]
xor rcx, rsp
call fcn.1004119e0
add rsp, 0x1078
pop rdi
pop rbp
ret