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

Disassembly:
sub esp, 0x1c
push ebx
push ebp
push esi
mov ebx, ecx
push edi
mov edi, dword [esp + 0x30]
lea eax, [ebx + 0x420]
xor esi, esi
push edi
push eax
mov dword [esp + 0x24], esi
call dword [sym.imp.KERNEL32.dll_lstrcpyW]
push esi
push 0x80
push 3
push esi
push 1
push 0xc0000000
push edi
call dword [sym.imp.KERNEL32.dll_CreateFileW]
mov ebp, eax
cmp ebp, 0xffffffff
mov dword [esp + 0x10], ebp
jne 0x4015ef
mov eax, dword [0x413560]
mov ebx, dword [sym.imp.KERNEL32.dll_GetProcessHeap]
test eax, eax
je 0x4015a0
push edi
push 0x400
push 0x83a
push 0x413560
call fcn.00401b70
mov esi, eax
add esp, 0x10
test esi, esi
jne 0x4015c6
push 0x800
push 8
call ebx
push eax
call dword [sym.imp.KERNEL32.dll_HeapAlloc]
mov esi, eax
test esi, esi
je 0x4015e0
push edi
push str.File_Not_Found____s_r_n
push esi
call dword [sym.imp.USER32.dll_wsprintfW]
add esp, 0xc
push esi
push 0x410cb0
call fcn.004031d6
add esp, 8
push esi
push 0
call ebx
push eax
call dword [sym.imp.KERNEL32.dll_HeapFree]
pop edi
pop esi
pop ebp
mov eax, 1
pop ebx
add esp, 0x1c
ret 8
lea ecx, [esp + 0x18]
push ecx
push ebp
call dword [sym.imp.KERNEL32.dll_GetFileSize]
cmp eax, 1
mov dword [esp + 0x18], eax
jae 0x401621
push ebp
call dword [sym.imp.KERNEL32.dll_CloseHandle]
push edi
call dword [sym.imp.KERNEL32.dll_DeleteFileW]
pop edi
pop esi
pop ebp
mov eax, 1
pop ebx
add esp, 0x1c
ret 8
lea ebp, [ebx + 0x10]
push edi
push ebp
call dword [sym.imp.KERNEL32.dll_lstrcpyW]
push str..out
push ebp
call dword [sym.imp.KERNEL32.dll_lstrcatW]
lea ebp, [ebx + 0x218]
push edi
push ebp
call dword [sym.imp.KERNEL32.dll_lstrcpyW]
push str..err
push ebp
call dword [sym.imp.KERNEL32.dll_lstrcatW]
mov ecx, dword [esp + 0x10]
lea edx, [esp + 0x14]
push 0
mov edi, 2
push edx
lea eax, [esp + 0x28]
push edi
push eax
push ecx
mov dword [esp + 0x34], 0
call dword [sym.imp.KERNEL32.dll_ReadFile]
cmp dword [esp + 0x20], 0xfeff
jne 0x4017a2
mov dword [ebx + 0x638], edi
mov eax, dword [0x413560]
mov edi, dword [sym.imp.KERNEL32.dll_HeapAlloc]
test eax, eax
je 0x4016cc
mov ebp, dword [sym.imp.KERNEL32.dll_GetProcessHeap]
push 0x800
push 0
call ebp
push eax
call edi
mov esi, eax
test esi, esi
je 0x4016d2
mov edx, dword [0x413560]
push 0x400
push esi
push 0x83b
push edx
call dword [sym.imp.USER32.dll_LoadStringW]
jmp 0x4016f0
mov ebp, dword [sym.imp.KERNEL32.dll_GetProcessHeap]
push 0x200
push 8
call ebp
push eax
call edi
mov esi, eax
test esi, esi
je 0x40170c
push str.UNICODE_byte_order_mark_detected._All_i_o_will_be_UNICODE._r_n
push esi
call dword [sym.imp.KERNEL32.dll_lstrcpyW]
push esi
push 0x410cb0
call fcn.004031d6
add esp, 8
push esi
push 0
call ebp
push eax
call dword [sym.imp.KERNEL32.dll_HeapFree]
xor esi, esi
mov ecx, dword [esp + 0x10]
mov ebp, dword [sym.imp.KERNEL32.dll_SetFilePointer]
xor eax, eax
push 2
mov dword [esp + 0x28], eax
push eax
push 0xfffffffffffffffc
push ecx
mov word [esp + 0x38], ax
call ebp
mov ecx, dword [esp + 0x10]
lea edx, [esp + 0x14]
push 0
push edx
lea eax, [esp + 0x2c]
push 4
push eax
push ecx
call dword [sym.imp.KERNEL32.dll_ReadFile]
mov eax, dword [esp + 0x14]
test eax, eax
je 0x4018c8
mov ecx, 0xd
mov eax, 0xa
cmp word [esp + 0x24], cx
jne 0x40176a
cmp word [esp + 0x26], ax
je 0x4018c8
lea edx, [esp + 0x14]
mov word [esp + 0x26], ax
push 0
mov word [esp + 0x28], cx
mov ecx, dword [esp + 0x14]
push edx
lea eax, [esp + 0x2c]
push 4
push eax
push ecx
call dword [sym.imp.KERNEL32.dll_WriteFile]
mov edx, dword [esp + 0x10]
push edx
call dword [sym.imp.KERNEL32.dll_FlushFileBuffers]
mov eax, dword [esp + 0x10]
push eax
jmp 0x4018c2
mov eax, dword [ebx + 0x638]
cmp eax, edi
mov edi, dword [sym.imp.KERNEL32.dll_HeapAlloc]
jne 0x40183b
mov eax, dword [0x413560]
test eax, eax
je 0x4017f1
mov ebp, dword [sym.imp.KERNEL32.dll_GetProcessHeap]
push 0x800
push 0
call ebp
push eax
call edi
mov esi, eax
test esi, esi
je 0x4017f7
mov ecx, dword [0x413560]
push 0x400
push esi
push 0x83c
push ecx
call dword [sym.imp.USER32.dll_LoadStringW]
jmp 0x401815
mov ebp, dword [sym.imp.KERNEL32.dll_GetProcessHeap]
push 0x200
push 8
call ebp
push eax
call edi
mov esi, eax
test esi, esi
je 0x401831
push str.UNICODE_byte_order_mark_was_NOT_detected._All_i_o_will_use_the_OEM_code_page._r_n
push esi
call dword [sym.imp.KERNEL32.dll_lstrcpyW]
push esi
push 0x410cb0
call fcn.004031d6
add esp, 8
push esi
push 0
call ebp
push eax
call dword [sym.imp.KERNEL32.dll_HeapFree]
xor esi, esi
mov dword [ebx + 0x638], 1
mov eax, dword [esp + 0x10]
mov ebp, dword [sym.imp.KERNEL32.dll_SetFilePointer]
xor edx, edx
push 2
mov word [esp + 0x34], dx
push edx
push 0xfffffffffffffffe
push eax
mov byte [esp + 0x42], dl
call ebp
mov eax, dword [esp + 0x10]
lea ecx, [esp + 0x14]
push 0
push ecx
lea edx, [esp + 0x38]
push 2
push edx
push eax
call dword [sym.imp.KERNEL32.dll_ReadFile]
mov eax, dword [esp + 0x14]
test eax, eax
je 0x4018c8
mov dl, byte [esp + 0x30]
mov ecx, 0xd
cmp dl, cl
mov eax, 0xa
jne 0x401891
cmp byte [esp + 0x31], al
je 0x4018c8
mov byte [esp + 0x30], cl
lea ecx, [esp + 0x14]
push 0
mov byte [esp + 0x35], al
mov eax, dword [esp + 0x14]
push ecx
lea edx, [esp + 0x38]
push 2
push edx
push eax
call dword [sym.imp.KERNEL32.dll_WriteFile]
mov ecx, dword [esp + 0x10]
push ecx
call dword [sym.imp.KERNEL32.dll_FlushFileBuffers]
mov edx, dword [esp + 0x10]
push edx
call dword [sym.imp.KERNEL32.dll_SetEndOfFile]
mov eax, dword [esp + 0x10]
push 0
push 0
push 0
push eax
mov dword [esp + 0x24], 0
call ebp
mov eax, dword [esp + 0x18]
push 0
lea ecx, [eax + eax*2 + 0x20000]
push ecx
push 0
call dword [sym.imp.KERNEL32.dll_HeapCreate]
mov ecx, dword [ebx + 0x638]
mov dword [ebx + 0x644], eax
cmp ecx, 2
jne 0x40194a
test eax, eax
jne 0x40190e
call dword [sym.imp.KERNEL32.dll_GetProcessHeap]
mov edx, dword [esp + 0x18]
add edx, 2
push edx
push 8
push eax
call edi
mov ebp, eax
test ebp, ebp
jne 0x40198f
push str.HeapAlloc_in_ReadSQLFile_failed__r_n
push 0x410cd0
call fcn.004031d6
mov eax, dword [esp + 0x18]
add esp, 8
push eax
call dword [sym.imp.KERNEL32.dll_CloseHandle]
pop edi
pop esi
pop ebp
xor eax, eax
pop ebx
add esp, 0x1c
ret 8
test eax, eax
jne 0x401954
call dword [sym.imp.KERNEL32.dll_GetProcessHeap]
mov ecx, dword [esp + 0x18]
inc ecx
push ecx
push 8
push eax
call edi
mov dword [esp + 0x1c], eax
mov eax, dword [ebx + 0x644]
test eax, eax
jne 0x401973
call dword [sym.imp.KERNEL32.dll_GetProcessHeap]
mov edx, dword [esp + 0x18]
lea ecx, [edx + edx + 2]
push ecx
push 8
push eax
call edi
mov ebp, eax
mov eax, dword [esp + 0x1c]
test eax, eax
je 0x401921
test ebp, ebp
je 0x401921
mov eax, dword [ebx + 0x638]
push 0
cmp eax, 2
jne 0x4019d4
mov eax, dword [esp + 0x1c]
mov ecx, dword [esp + 0x14]
lea edx, [esp + 0x18]
push edx
push eax
push ebp
push ecx
call dword [sym.imp.KERNEL32.dll_ReadFile]
mov eax, dword [esp + 0x14]
lea edx, [esp + 0x30]
push edx
push eax
push ebp
mov dword [esp + 0x3c], 8
call dword [sym.imp.ADVAPI32.dll_IsTextUnicode]
test eax, eax
je 0x4019ee
add ebp, 2
jmp 0x4019ee
mov edx, dword [esp + 0x1c]
mov eax, dword [esp + 0x20]
lea ecx, [esp + 0x18]
push ecx
mov ecx, dword [esp + 0x18]
push edx
push eax
push ecx
call dword [sym.imp.KERNEL32.dll_ReadFile]
mov eax, dword [0x413560]
test eax, eax
je 0x401a25
push 0x800
push 0
call dword [sym.imp.KERNEL32.dll_GetProcessHeap]
push eax
call edi
mov esi, eax
test esi, esi
je 0x401a29
mov edx, dword [0x413560]
push 0x400
push esi
push 0x83d
push edx
call dword [sym.imp.USER32.dll_LoadStringW]
test esi, esi
jne 0x401a4b
push 0x200
push 8
call dword [sym.imp.KERNEL32.dll_GetProcessHeap]
push eax
call edi
mov esi, eax
test esi, esi
je 0x401a4b
push str.MultiByteToWideChar_failed_to_convert_the_input_file_to_UNICODE._r_n
push esi
call dword [sym.imp.KERNEL32.dll_lstrcpyW]
mov eax, dword [ebx + 0x638]
sub eax, 0
je 0x401aa9
dec eax
jne 0x401abf
mov eax, dword [esp + 0x14]
mov edx, dword [esp + 0x1c]
lea ecx, [eax + eax]
push ecx
push ebp
push 0xffffffffffffffff
push edx
push 1
push 1
call dword [sym.imp.KERNEL32.dll_MultiByteToWideChar]
test eax, eax
jne 0x401abf
test esi, esi
je 0x40193e
push esi
push 0x410cd0
call fcn.004031d6
add esp, 8
push esi
push 0
call dword [sym.imp.KERNEL32.dll_GetProcessHeap]
push eax
call dword [sym.imp.KERNEL32.dll_HeapFree]
pop edi
pop esi
pop ebp
xor eax, eax
pop ebx
add esp, 0x1c
ret 8
mov eax, dword [esp + 0x14]
mov edx, dword [esp + 0x1c]
lea ecx, [eax + eax]
push ecx
push ebp
push 0xffffffffffffffff
push edx
push 1
push 0
jmp 0x401a6d
test esi, esi
je 0x401ad7
push esi
push 0
call dword [sym.imp.KERNEL32.dll_GetProcessHeap]
mov esi, dword [sym.imp.KERNEL32.dll_HeapFree]
push eax
call esi
jmp 0x401add
mov esi, dword [sym.imp.KERNEL32.dll_HeapFree]
mov edi, dword [esp + 0x1c]
test edi, edi
je 0x401afb
mov eax, dword [ebx + 0x644]
test eax, eax
jne 0x401af5
call dword [sym.imp.KERNEL32.dll_GetProcessHeap]
push edi
push 0
push eax
call esi
mov eax, dword [esp + 0x10]
push eax
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov ecx, dword [esp + 0x34]
test ecx, ecx
je 0x401b51
mov eax, dword [ebx + 8]
lea edi, [ebx + 0xc]
push 0
push edi
mov edx, dword [eax]
push ecx
push eax
call dword [edx + 0xdc]
test eax, eax
mov dword [ebx + 4], eax
jge 0x401b51
mov eax, dword [ebx + 0x644]
test eax, eax
jne 0x401b38
call dword [sym.imp.KERNEL32.dll_GetProcessHeap]
push ebp
push 0
push eax
call esi
mov ecx, ebx
call fcn.00402240
pop edi
pop esi
pop ebp
xor eax, eax
pop ebx
add esp, 0x1c
ret 8
push ebp
mov ecx, ebx
call fcn.00401cc0
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x1c
ret 8