Function at 0x401b70
Capabilities:
Reference sql statements
Write file on windows

Disassembly:
push ebp
mov ebp, esp
push edi
push esi
mov esi, eax
push ebx
mov ebx, edx
sub esp, 0x44c
mov dword [ebp - 0x428], 0
mov dword [esp + 0x18], 0
mov dword [esp + 0x14], pe_nt_image_headers32
mov dword [esp + 0x10], 1
mov dword [esp + 0xc], 0
mov dword [esp + 8], 3
mov dword [esp + 4], 0x40000000
mov dword [esp], edx
mov dword [ebp - 0x424], 0
call sub.kernel32.dll_CreateFileW
sub esp, 0x1c
mov edi, eax
cmp eax, 0xffffffff
je 0x401c90
lea eax, [ebp - 0x428]
mov dword [esp + 4], str.SELECT_Data_FROM__Streams_WHERE_Name___
mov dword [esp + 8], eax
mov eax, dword [esi]
mov dword [esp], eax
call sub.msi.dll_MsiDatabaseOpenViewW
sub esp, 0xc
test eax, eax
je 0x401c48
xor esi, esi
test byte [section..data], 2
jne 0x401e50
mov eax, dword [ebp - 0x424]
test eax, eax
je 0x401c21
mov dword [esp], eax
call sub.msi.dll_MsiCloseHandle
sub esp, 4
mov eax, dword [ebp - 0x428]
test eax, eax
jne 0x401c80
cmp edi, 0xffffffff
je 0x401c3b
mov dword [esp], edi
call sub.kernel32.dll_CloseHandle
sub esp, 4
lea esp, [ebp - 0xc]
mov eax, esi
pop ebx
pop esi
pop edi
pop ebp
ret
mov dword [esp], 1
call sub.msi.dll_MsiCreateRecord
mov dword [ebp - 0x424], eax
sub esp, 4
test eax, eax
jne 0x401d90
test byte [section..data], 2
jne 0x401ee0
mov eax, dword [ebp - 0x428]
xor esi, esi
test eax, eax
je 0x401c30
nop
mov dword [esp], eax
call sub.msi.dll_MsiViewClose
sub esp, 4
jmp 0x401c2b
xor esi, esi
test byte [section..data], 2
je 0x401c0c
test ebx, ebx
je 0x4020c8
mov eax, ebx
shr eax, 0x10
je 0x402098
mov dword [esp + 4], 0xffffffff
mov dword [esp], ebx
call sub.kernel32.dll_IsBadStringPtrW
mov edx, str._invalid_
sub esp, 8
test eax, eax
jne 0x401e1e
movzx edx, word [ebx]
test dx, dx
je 0x4020d2
nop
mov ecx, eax
lea eax, [eax + 1]
cmp word [ebx + ecx*2 + 2], 0
jne 0x401ce0
mov eax, 0x224c
mov dword [ebp - 0x42c], ebx
mov word [ebp - 0x418], ax
lea eax, [ebp - 0x416]
jmp 0x401d54
cmp dx, 9
je 0x402008
cmp dx, 0xa
jne 0x402026
mov esi, 0x6e5c
add eax, 2
mov word [eax - 2], si
lea ebx, [ebp - 0x2f6]
lea esi, [ecx - 1]
cmp eax, ebx
ja 0x401df0
test ecx, ecx
jle 0x401df0
mov ecx, dword [ebp - 0x42c]
movzx edx, word [ecx]
mov ecx, esi
add dword [ebp - 0x42c], 2
cmp dx, 0xd
je 0x401ff0
jbe 0x401d10
cmp dx, 0x22
je 0x402080
cmp dx, 0x5c
jne 0x402019
mov ebx, 0x5c5c
add eax, 2
mov word [eax - 2], bx
jmp 0x401d30
mov dword [esp + 8], ebx
mov dword [esp + 4], 1
mov dword [esp], eax
call sub.msi.dll_MsiRecordSetStringW
sub esp, 0xc
test eax, eax
je 0x401e80
xor esi, esi
test byte [section..data], 2
je 0x401c0c
mov dword [esp + 0xc], str.Failed_to_add_stream_filename_to_MSI_record._n
mov dword [esp + 8], str.extract_stream
mov dword [esp + 4], 0x404000
mov dword [esp], 1
call fcn.00401060
jmp 0x401c0c
mov byte [eax], 0x22
test esi, esi
jle 0x4020eb
mov ecx, 0x2e2e
mov byte [eax + 3], 0x2e
lea edx, [eax + 4]
mov word [eax + 1], cx
lea eax, [ebp - 0x418]
mov byte [edx], 0
mov dword [esp], eax
call fcn.00403a60
mov edx, eax
mov dword [esp + 0x10], edx
xor esi, esi
mov dword [esp + 0xc], str.Failed_to_open_destination_file__s._n
mov dword [esp + 8], str.extract_stream
mov dword [esp + 4], 0x404000
mov dword [esp], 1
call fcn.00401060
jmp 0x401c0c
mov dword [esp + 0xc], str.Failed_to_open__Streams_table._n
mov dword [esp + 8], str.extract_stream
mov dword [esp + 4], 0x404000
mov dword [esp], 1
call fcn.00401060
jmp 0x401c0c
mov eax, dword [ebp - 0x424]
mov dword [esp + 4], eax
mov eax, dword [ebp - 0x428]
mov dword [esp], eax
call sub.msi.dll_MsiViewExecute
sub esp, 8
test eax, eax
je 0x401f10
xor esi, esi
test byte [section..data], 2
je 0x401c0c
mov dword [esp + 0xc], str.Failed_to_query_stream_from__Streams_table._n
mov dword [esp + 8], str.extract_stream
mov dword [esp + 4], 0x404000
mov dword [esp], 1
call fcn.00401060
jmp 0x401c0c
mov dword [esp + 0xc], str.Failed_to_create_MSI_record._n
xor esi, esi
mov dword [esp + 8], str.extract_stream
mov dword [esp + 4], 0x404000
mov dword [esp], 1
call fcn.00401060
jmp 0x401c0c
mov eax, dword [ebp - 0x424]
mov dword [esp], eax
call sub.msi.dll_MsiCloseHandle
lea eax, [ebp - 0x424]
mov dword [ebp - 0x424], 0
sub esp, 4
mov dword [esp + 4], eax
mov eax, dword [ebp - 0x428]
mov dword [esp], eax
call sub.msi.dll_MsiViewFetch
sub esp, 8
test eax, eax
jne 0x4020f8
mov dword [ebp - 0x420], 0x400
lea ebx, [ebp - 0x418]
lea esi, [ebp - 0x420]
lea esi, [esi]
mov eax, dword [ebp - 0x424]
mov dword [esp + 0xc], esi
mov dword [esp + 8], ebx
mov dword [esp + 4], 1
mov dword [esp], eax
call sub.msi.dll_MsiRecordReadStream
sub esp, 0x10
test eax, eax
jne 0x402168
lea eax, [ebp - 0x41c]
mov dword [esp + 0x10], 0
mov dword [esp + 0xc], eax
mov eax, dword [ebp - 0x420]
mov dword [esp + 4], ebx
mov dword [esp + 8], eax
mov dword [esp], edi
call sub.kernel32.dll_WriteFile
sub esp, 0x14
test eax, eax
je 0x402130
mov eax, dword [ebp - 0x420]
cmp eax, dword [ebp - 0x41c]
jne 0x402130
cmp eax, 0x400
je 0x401f68
mov esi, 1
jmp 0x401c0c
mov ebx, 0x725c
add eax, 2
mov word [eax - 2], bx
jmp 0x401d30
mov edx, 0x745c
add eax, 2
mov word [eax - 2], dx
jmp 0x401d30
lea esi, [edx - 0x20]
cmp si, 0x5e
jbe 0x4020b8
mov esi, edx
mov byte [eax], 0x5c
add eax, 5
shr si, 0xc
movzx esi, si
movzx ebx, byte [esi + str.0123456789abcdefopen_database]
mov esi, edx
shr si, 8
and esi, 0xf
mov byte [eax - 4], bl
movzx ebx, byte [esi + str.0123456789abcdefopen_database]
mov esi, edx
and edx, 0xf
shr si, 4
movzx edx, byte [edx + str.0123456789abcdefopen_database]
and esi, 0xf
mov byte [eax - 3], bl
movzx ebx, byte [esi + str.0123456789abcdefopen_database]
mov byte [eax - 1], dl
mov byte [eax - 2], bl
jmp 0x401d30
mov esi, 0x225c
add eax, 2
mov word [eax - 2], si
jmp 0x401d30
movzx ebx, bx
mov dword [esp], str._04x
mov dword [esp + 4], ebx
call fcn.004011e0
mov edx, eax
jmp 0x401e1e
mov byte [eax], dl
add eax, 1
jmp 0x401d30
mov edx, str._null_
jmp 0x401e1e
mov edx, 0x224c
mov byte [ebp - 0x416], 0x22
lea eax, [ebp - 0x416]
mov word [ebp - 0x418], dx
lea edx, [eax + 1]
jmp 0x401e0b
xor esi, esi
test byte [section..data], 2
je 0x401c0c
mov dword [esp + 0xc], str.Failed_to_query_row_from__Streams_table._n
mov dword [esp + 8], str.extract_stream
mov dword [esp + 4], 0x404000
mov dword [esp], 1
call fcn.00401060
jmp 0x401c0c
xor esi, esi
test byte [section..data], 2
je 0x401c0c
mov dword [esp + 0xc], str.Failed_to_write_stream_to_destination_file._n
mov dword [esp + 8], str.extract_stream
mov dword [esp + 4], 0x404000
mov dword [esp], 1
call fcn.00401060
jmp 0x401c0c
xor esi, esi
test byte [section..data], 2
je 0x401c0c
mov dword [esp + 0xc], str.Failed_to_read_stream_from__Streams_table._n
mov dword [esp + 8], str.extract_stream
mov dword [esp + 4], 0x404000
mov dword [esp], 1
call fcn.00401060
jmp 0x401c0c