Function at 0x402e70
Capabilities:
Write file on windows

Disassembly:
mov edi, edi
push ebp
mov ebp, esp
sub esp, 0xe4
mov eax, dword [0x41b2c0]
mov dword [ebp - 0x14], eax
mov dword [ebp - 0xa8], 0
mov word [ebp - 0xc4], 0x40
mov dword [ebp - 0xb8], 0
lea eax, [ebp - 0xc]
push eax
mov ecx, dword [ebp + 0xc]
push ecx
call sub.ODBC32.dll_SQLNumResultCols
mov word [ebp - 0x10], 0
jmp 0x402ec1
mov dx, word [ebp - 0x10]
add dx, 1
mov word [ebp - 0x10], dx
movsx eax, word [ebp - 0x10]
cmp eax, 0x400
jge 0x402ed9
movsx ecx, word [ebp - 0x10]
mov byte [ecx + 0x41bc40], 0x20
jmp 0x402eb5
mov word [ebp - 0x10], 1
jmp 0x402eed
mov dx, word [ebp - 0x10]
add dx, 1
mov word [ebp - 0x10], dx
movsx eax, word [ebp - 0x10]
movsx ecx, word [ebp - 0xc]
cmp eax, ecx
jg 0x402fe6
lea edx, [ebp - 0xb0]
push edx
lea eax, [ebp - 8]
push eax
lea ecx, [ebp - 4]
push ecx
lea edx, [ebp - 0xc0]
push edx
lea eax, [ebp - 0xc8]
push eax
mov cx, word [ebp - 0xc4]
push ecx
lea edx, [ebp - 0xa0]
push edx
mov ax, word [ebp - 0x10]
push eax
mov ecx, dword [ebp + 0xc]
push ecx
call sub.ODBC32.dll_SQLDescribeCol
push 0
lea edx, [ebp - 0xbc]
push edx
movsx eax, word [ebp - 0xc8]
push eax
lea ecx, [ebp - 0xa0]
push ecx
mov edx, dword [ebp + 8]
push edx
call dword [sym.imp.KERNEL32.dll_WriteFile]
movsx eax, word [ebp - 0xc8]
mov ecx, dword [ebp - 4]
sub ecx, eax
jns 0x402f73
mov dword [ebp - 0xd4], 0
jmp 0x402f85
movsx edx, word [ebp - 0xc8]
mov eax, dword [ebp - 4]
sub eax, edx
mov dword [ebp - 0xd4], eax
push 0
lea ecx, [ebp - 0xbc]
push ecx
mov edx, dword [ebp - 0xd4]
add edx, 4
push edx
push 0x41bc40
mov eax, dword [ebp + 8]
push eax
call dword [sym.imp.KERNEL32.dll_WriteFile]
movsx ecx, word [ebp - 0xc8]
cmp ecx, dword [ebp - 4]
jle 0x402fc2
movsx edx, word [ebp - 0xc8]
mov dword [ebp - 0xd8], edx
jmp 0x402fcb
mov eax, dword [ebp - 4]
mov dword [ebp - 0xd8], eax
mov ecx, dword [ebp - 0xd8]
mov edx, dword [ebp - 0xb8]
lea eax, [edx + ecx + 4]
mov dword [ebp - 0xb8], eax
jmp 0x402ee1
push 0
lea ecx, [ebp - 0xbc]
push ecx
push 2
push 0x4160a8
mov edx, dword [ebp + 8]
push edx
call dword [sym.imp.KERNEL32.dll_WriteFile]
push 1
push 0x2d
push 0x41bc40
call fcn.00407900
add esp, 0xc
mov word [ebp - 0x10], 0
jmp 0x403025
mov ax, word [ebp - 0x10]
add ax, 1
mov word [ebp - 0x10], ax
movsx ecx, word [ebp - 0x10]
cmp ecx, dword [ebp - 0xb8]
jge 0x40304d
push 0
lea edx, [ebp - 0xbc]
push edx
push 1
push 0x41bc40
mov eax, dword [ebp + 8]
push eax
call dword [sym.imp.KERNEL32.dll_WriteFile]
jmp 0x403019
push 1
push 0x20
push 0x41bc40
call fcn.00407900
add esp, 0xc
mov dword [ebp - 0xb4], 0x400
mov ecx, dword [ebp - 0xb4]
push ecx
push 0x40
call dword [sym.imp.KERNEL32.dll_GlobalAlloc]
mov dword [ebp - 0xac], eax
cmp dword [ebp - 0xac], 0
jne 0x4030b1
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov dword [ebp - 0xcc], eax
cmp dword [ebp - 0xcc], 0
je 0x4030aa
mov edx, dword [ebp - 0xcc]
push edx
call fcn.00405c70
add esp, 4
xor eax, eax
jmp 0x403347
mov word [ebp - 0x10], 1
jmp 0x4030c5
mov ax, word [ebp - 0x10]
add ax, 1
mov word [ebp - 0x10], ax
movsx ecx, word [ebp - 0x10]
movsx edx, word [ebp - 0xc]
cmp ecx, edx
jg 0x4032b3
mov eax, dword [ebp - 0xb4]
push eax
push 0
mov ecx, dword [ebp - 0xac]
push ecx
call fcn.00407c90
add esp, 0xc
lea edx, [ebp - 0xa8]
push edx
mov eax, dword [ebp - 0xb4]
push eax
mov ecx, dword [ebp - 0xac]
push ecx
push 1
mov dx, word [ebp - 0x10]
push edx
mov eax, dword [ebp + 0xc]
push eax
call sub.ODBC32.dll_SQLGetData
mov ecx, dword [ebp - 0xa8]
cmp ecx, dword [ebp - 0xb4]
jl 0x4031bd
mov edx, dword [ebp - 0xa8]
cmp edx, dword [ebp - 0xb4]
jl 0x403142
mov eax, dword [ebp - 0xb4]
shl eax, 1
mov dword [ebp - 0xb4], eax
jmp 0x403124
mov ecx, dword [ebp - 0xac]
push ecx
call dword [sym.imp.KERNEL32.dll_GlobalFree]
mov edx, dword [ebp - 0xb4]
push edx
push 0x40
call dword [sym.imp.KERNEL32.dll_GlobalAlloc]
mov dword [ebp - 0xac], eax
cmp dword [ebp - 0xac], 0
jne 0x403198
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov dword [ebp - 0xd0], eax
cmp dword [ebp - 0xd0], 0
je 0x403191
mov eax, dword [ebp - 0xd0]
push eax
call fcn.00405c70
add esp, 4
xor eax, eax
jmp 0x403347
lea ecx, [ebp - 0xa8]
push ecx
mov edx, dword [ebp - 0xb4]
push edx
mov eax, dword [ebp - 0xac]
push eax
push 1
mov cx, word [ebp - 0x10]
push ecx
mov edx, dword [ebp + 0xc]
push edx
call sub.ODBC32.dll_SQLGetData
lea eax, [ebp - 0xb0]
push eax
lea ecx, [ebp - 8]
push ecx
lea edx, [ebp - 4]
push edx
lea eax, [ebp - 0xc0]
push eax
lea ecx, [ebp - 0xc8]
push ecx
mov dx, word [ebp - 0xc4]
push edx
lea eax, [ebp - 0xa0]
push eax
mov cx, word [ebp - 0x10]
push ecx
mov edx, dword [ebp + 0xc]
push edx
call sub.ODBC32.dll_SQLDescribeCol
push 0
lea eax, [ebp - 0xbc]
push eax
mov ecx, dword [ebp - 0xa8]
push ecx
mov edx, dword [ebp - 0xac]
push edx
mov eax, dword [ebp + 8]
push eax
call dword [sym.imp.KERNEL32.dll_WriteFile]
movsx ecx, word [ebp - 0xc8]
cmp ecx, dword [ebp - 4]
jle 0x403233
movsx edx, word [ebp - 0xc8]
mov dword [ebp - 0xdc], edx
jmp 0x40323c
mov eax, dword [ebp - 4]
mov dword [ebp - 0xdc], eax
mov ecx, dword [ebp - 0xdc]
sub ecx, dword [ebp - 0xbc]
jmp 0x403256
movsx edx, word [ebp - 0xc8]
cmp edx, dword [ebp - 4]
jle 0x403271
movsx eax, word [ebp - 0xc8]
mov dword [ebp - 0xe4], eax
jmp 0x40327a
mov ecx, dword [ebp - 4]
mov dword [ebp - 0xe4], ecx
mov edx, dword [ebp - 0xe4]
sub edx, dword [ebp - 0xbc]
mov dword [ebp - 0xe0], edx
push 0
lea eax, [ebp - 0xbc]
push eax
mov ecx, dword [ebp - 0xe0]
add ecx, 4
push ecx
push 0x41bc40
mov edx, dword [ebp + 8]
push edx
call dword [sym.imp.KERNEL32.dll_WriteFile]
jmp 0x4030b9
push 0
lea eax, [ebp - 0xbc]
push eax
push 2
push 0x4160ac
mov ecx, dword [ebp + 8]
push ecx
call dword [sym.imp.KERNEL32.dll_WriteFile]
mov edx, dword [ebp + 0xc]
push edx
call sub.ODBC32.dll_SQLFetch
mov word [ebp - 0xa4], ax
movsx eax, word [ebp - 0xa4]
test eax, eax
je 0x4030b1
movsx ecx, word [ebp - 0xa4]
cmp ecx, 1
je 0x4030b1
mov edx, dword [ebp - 0xac]
push edx
call dword [sym.imp.KERNEL32.dll_GlobalFree]
mov dword [ebp - 0xac], 0
push 0
lea eax, [ebp - 0xbc]
push eax
push 2
push 0x4160b0
mov ecx, dword [ebp + 8]
push ecx
call dword [sym.imp.KERNEL32.dll_WriteFile]
mov edx, dword [ebp + 0xc]
push edx
call sub.ODBC32.dll_SQLMoreResults
movsx eax, ax
cmp eax, 0x64
jne 0x402ea0
mov eax, 1
mov ecx, dword [ebp - 0x14]
call fcn.00407d96
mov esp, ebp
pop ebp
ret