Function at 0x406a70
Capabilities:
Delete file
Get common file path
Write file on windows

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x860
mov eax, dword [0x455c20]
xor eax, ebp
mov dword [ebp - 4], eax
mov eax, dword [ebp + 8]
mov ecx, dword [ebp + 0x14]
mov dword [ebp - 0x85c], eax
mov dword [ebp - 0x860], ecx
push ebx
push esi
push edi
mov edi, dword [ebp + 0xc]
mov dword [ebp - 0x858], edi
test eax, eax
je 0x406aed
mov ebx, eax
mov dword [ebp - 0x850], ebx
lea eax, [ebp - 0x828]
push eax
push ebx
call fcn.00428fc0
mov edi, dword [sym.imp.MSVCR120.dll_strerror]
add esp, 8
mov esi, dword [sym.imp.MSVCR120.dll__errno]
test eax, eax
je 0x406c8d
call esi
push dword [eax]
call edi
push eax
push ebx
push str._s:__s_n
call fcn.00408fb0
add esp, 0x10
mov bl, 1
jmp 0x406de7
lea eax, [ebp - 0x804]
push eax
push 0x400
call dword [sym.imp.KERNEL32.dll_GetTempPathA]
test eax, eax
je 0x406e6a
cmp eax, 0x400
jg 0x406e63
call dword [sym.imp.MSVCR120.dll__getpid]
push eax
push 0x42b69a
lea eax, [ebp - 0x804]
push eax
push str._s_spsql.edit._d.sql
lea eax, [ebp - 0x404]
push 0x400
push eax
call fcn.004262e0
lea ebx, [ebp - 0x404]
push 0x180
mov eax, ebx
mov dword [ebp - 0x850], ebx
push 0x501
push eax
call dword [sym.imp.MSVCR120.dll__open]
add esp, 0x24
cmp eax, 0xffffffff
je 0x406df2
push 0x42dc78
push eax
call dword [sym.imp.MSVCR120.dll__fdopen]
add esp, 8
mov dword [ebp - 0x854], eax
test eax, eax
je 0x406df2
mov esi, dword [edi + 4]
test esi, esi
je 0x406b93
mov ecx, dword [edi]
cmp byte [ecx + esi - 1], 0xa
je 0x406ba5
push 0xa
push edi
call sub.LIBPQ.dll_Ordinal_68
mov eax, dword [ebp - 0x854]
add esp, 8
inc esi
push eax
push esi
push 1
push dword [edi]
call dword [sym.imp.MSVCR120.dll_fwrite]
add esp, 0x10
cmp eax, esi
je 0x406c3f
mov esi, dword [sym.imp.MSVCR120.dll__errno]
call esi
mov edi, dword [sym.imp.MSVCR120.dll_strerror]
push dword [eax]
call edi
push eax
lea eax, [ebp - 0x404]
push eax
push str._s:__s_n
call fcn.00408fb0
push dword [ebp - 0x854]
call dword [sym.imp.MSVCR120.dll_fclose]
add esp, 0x14
test eax, eax
je 0x406c0e
call esi
push dword [eax]
call edi
push eax
lea eax, [ebp - 0x404]
push eax
push str._s:__s_n
call fcn.00408fb0
add esp, 0x10
lea eax, [ebp - 0x404]
push eax
mov eax, dword [sym.imp.MSVCR120.dll_remove]
call eax
add esp, 4
test eax, eax
je 0x406e19
call esi
push dword [eax]
call edi
push eax
lea eax, [ebp - 0x404]
push eax
push str._s:__s_n
jmp 0x406e11
push dword [ebp - 0x854]
call dword [sym.imp.MSVCR120.dll_fclose]
add esp, 4
test eax, eax
je 0x406aad
mov esi, dword [sym.imp.MSVCR120.dll__errno]
call esi
mov edi, dword [sym.imp.MSVCR120.dll_strerror]
push dword [eax]
call edi
push eax
lea eax, [ebp - 0x404]
push eax
push str._s:__s_n
call fcn.00408fb0
lea eax, [ebp - 0x404]
push eax
mov eax, dword [sym.imp.MSVCR120.dll_remove]
call eax
add esp, 0x14
jmp 0x406c1f
push dword [ebp + 0x10]
push ebx
call fcn.00408bb0
add esp, 8
test al, al
sete bl
test bl, bl
jne 0x406de7
lea eax, [ebp - 0x84c]
push eax
push dword [ebp - 0x850]
call fcn.00428fc0
add esp, 8
test eax, eax
je 0x406ce0
call esi
push dword [eax]
call edi
push eax
push dword [ebp - 0x850]
push str._s:__s_n
call fcn.00408fb0
add esp, 0x10
mov bl, 1
jmp 0x406de7
mov eax, dword [ebp - 0x80c]
cmp eax, dword [ebp - 0x830]
je 0x406de7
push 0x42e1ec
push dword [ebp - 0x850]
call dword [sym.imp.MSVCR120.dll_fopen]
add esp, 8
mov dword [ebp - 0x854], eax
test eax, eax
jne 0x406d31
call esi
push dword [eax]
call edi
push eax
push dword [ebp - 0x850]
push str._s:__s_n
call fcn.00408fb0
add esp, 0x10
mov bl, 1
jmp 0x406de7
push dword [ebp - 0x858]
call sub.LIBPQ.dll_Ordinal_70
push dword [ebp - 0x854]
lea eax, [ebp - 0x804]
push 0x400
push eax
call dword [sym.imp.MSVCR120.dll_fgets]
add esp, 0x10
test eax, eax
je 0x406d9a
mov esi, dword [ebp - 0x858]
mov edi, dword [ebp - 0x854]
lea eax, [ebp - 0x804]
push eax
push esi
call sub.LIBPQ.dll_Ordinal_75
push edi
lea eax, [ebp - 0x804]
push 0x400
push eax
call dword [sym.imp.MSVCR120.dll_fgets]
add esp, 0x14
test eax, eax
jne 0x406d67
mov esi, dword [sym.imp.MSVCR120.dll__errno]
mov edi, dword [sym.imp.MSVCR120.dll_strerror]
push dword [ebp - 0x854]
call dword [sym.imp.MSVCR120.dll_ferror]
add esp, 4
test eax, eax
je 0x406dcb
call esi
push dword [eax]
call edi
push eax
push dword [ebp - 0x850]
push str._s:__s_n
call fcn.00408fb0
add esp, 0x10
mov bl, 1
jmp 0x406dd8
mov eax, dword [ebp - 0x860]
test eax, eax
je 0x406dd8
mov byte [eax], 1
push dword [ebp - 0x854]
call dword [sym.imp.MSVCR120.dll_fclose]
add esp, 4
cmp dword [ebp - 0x85c], 0
jne 0x406e4b
jmp 0x406e1b
mov esi, dword [sym.imp.MSVCR120.dll__errno]
call esi
mov edi, dword [sym.imp.MSVCR120.dll_strerror]
push dword [eax]
call edi
push eax
lea eax, [ebp - 0x404]
push eax
push str.could_not_open_temporary_file___s_:__s_n
call fcn.00408fb0
add esp, 0x10
mov bl, 1
push dword [ebp - 0x850]
call dword [sym.imp.MSVCR120.dll_remove]
add esp, 4
cmp eax, 0xffffffff
jne 0x406e4b
call esi
push dword [eax]
call edi
push eax
push dword [ebp - 0x850]
push str._s:__s_n
call fcn.00408fb0
add esp, 0x10
mov bl, 1
xor eax, eax
test bl, bl
pop edi
pop esi
sete al
pop ebx
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.00429e54
mov esp, ebp
pop ebp
ret
mov eax, 0x42b69a
jmp 0x406e7b
call dword [sym.imp.MSVCR120.dll__errno]
push dword [eax]
call dword [sym.imp.MSVCR120.dll_strerror]
add esp, 4
push eax
push str.could_not_locate_temporary_directory:__s_n
call fcn.00408fb0
mov ecx, dword [ebp - 4]
add esp, 8
xor ecx, ebp
xor al, al
pop edi
pop esi
pop ebx
call fcn.00429e54
mov esp, ebp
pop ebp
ret