Function at 0x4013ee
Capabilities:
Write file on windows

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x98
lea eax, [ebp - 0x28]
mov dword [esp + 8], eax
mov dword [esp + 4], 0x18
mov eax, dword [ebp + 8]
mov dword [esp], eax
call sym._GetObjectA_12
sub esp, 0xc
test eax, eax
jne 0x401424
mov dword [ebp - 0x64], 0
jmp 0x4017ea
mov eax, dword [ebp - 0x18]
movzx edx, word [ebp - 0x16]
imul eax, edx
mov word [ebp - 0x2e], ax
cmp word [ebp - 0x2e], 1
jne 0x401441
mov word [ebp - 0x2e], 1
jmp 0x401483
cmp word [ebp - 0x2e], 4
ja 0x401450
mov word [ebp - 0x2e], 4
jmp 0x401483
cmp word [ebp - 0x2e], 8
ja 0x40145f
mov word [ebp - 0x2e], 8
jmp 0x401483
cmp word [ebp - 0x2e], 0x10
ja 0x40146e
mov word [ebp - 0x2e], 0x10
jmp 0x401483
cmp word [ebp - 0x2e], 0x18
ja 0x40147d
mov word [ebp - 0x2e], 0x18
jmp 0x401483
mov word [ebp - 0x2e], 0x20
cmp word [ebp - 0x2e], 0x18
je 0x4014b0
movzx ecx, word [ebp - 0x2e]
mov eax, 4
shl eax, cl
add eax, 0x28
mov dword [esp + 4], eax
mov dword [esp], 0x40
call sym._LocalAlloc_8
sub esp, 8
mov dword [ebp - 0x2c], eax
jmp 0x4014ca
mov dword [esp + 4], 0x28
mov dword [esp], 0x40
call sym._LocalAlloc_8
sub esp, 8
mov dword [ebp - 0x2c], eax
mov eax, dword [ebp - 0x2c]
mov dword [eax], 0x28
mov edx, dword [ebp - 0x2c]
mov eax, dword [ebp - 0x24]
mov dword [edx + 4], eax
mov edx, dword [ebp - 0x2c]
mov eax, dword [ebp - 0x20]
mov dword [edx + 8], eax
mov edx, dword [ebp - 0x2c]
mov eax, dword [ebp - 0x18]
mov word [edx + 0xc], ax
mov edx, dword [ebp - 0x2c]
movzx eax, word [ebp - 0x16]
mov word [edx + 0xe], ax
cmp word [ebp - 0x2e], 0x17
ja 0x401512
mov edx, dword [ebp - 0x2c]
movzx ecx, word [ebp - 0x2e]
mov eax, 1
shl eax, cl
mov dword [edx + 0x20], eax
mov eax, dword [ebp - 0x2c]
mov dword [eax + 0x10], 0
mov eax, dword [ebp - 0x2c]
mov dword [ebp - 0x68], eax
mov eax, dword [ebp - 0x2c]
mov eax, dword [eax + 4]
add eax, 7
mov dword [ebp - 0x6c], eax
cmp dword [ebp - 0x6c], 0
jns 0x401538
add dword [ebp - 0x6c], 7
mov edx, dword [ebp - 0x6c]
sar edx, 3
mov eax, dword [ebp - 0x2c]
imul edx, dword [eax + 8]
movzx eax, word [ebp - 0x2e]
imul eax, edx
mov edx, dword [ebp - 0x68]
mov dword [edx + 0x14], eax
mov eax, dword [ebp - 0x2c]
mov dword [eax + 0x24], 0
mov eax, dword [ebp - 0x2c]
mov dword [ebp - 0x4c], eax
mov eax, dword [ebp - 0x4c]
mov eax, dword [eax + 0x14]
mov dword [esp + 4], eax
mov dword [esp], 0
call sym._GlobalAlloc_8
sub esp, 8
mov dword [ebp - 0x50], eax
cmp dword [ebp - 0x50], 0
jne 0x40159c
mov dword [esp], str.error:_out_of_memory_n
call sym._printf
mov dword [ebp - 0x64], 0
jmp 0x4017ea
mov dword [esp + 0x18], 0
mov eax, dword [ebp - 0x2c]
mov dword [esp + 0x14], eax
mov eax, dword [ebp - 0x50]
mov dword [esp + 0x10], eax
mov eax, dword [ebp - 0x4c]
mov eax, dword [eax + 8]
movzx eax, ax
mov dword [esp + 0xc], eax
mov dword [esp + 8], 0
mov eax, dword [ebp + 8]
mov dword [esp + 4], eax
mov eax, dword [ebp + 0xc]
mov dword [esp], eax
call sym._GetDIBits_28
sub esp, 0x1c
test eax, eax
jne 0x4015f8
mov dword [esp], str.error:_GetDiBits_failed_n
call sym._printf
mov dword [ebp - 0x64], 0
jmp 0x4017ea
mov dword [esp + 0x18], 0
mov dword [esp + 0x14], pe_nt_image_headers32
mov dword [esp + 0x10], 2
mov dword [esp + 0xc], 0
mov dword [esp + 8], 0
mov dword [esp + 4], 0xc0000000
mov eax, dword [ebp + 0x10]
mov dword [esp], eax
call sym._CreateFileA_28
sub esp, 0x1c
mov dword [ebp - 0x34], eax
cmp dword [ebp - 0x34], 0xffffffff
jne 0x40165e
mov eax, dword [ebp + 0x10]
mov dword [esp + 4], eax
mov dword [esp], str.error:_cannot_create_file__s_n
call sym._printf
mov dword [ebp - 0x64], 0
jmp 0x4017ea
mov word [ebp - 0x48], 0x4d42
mov edx, dword [ebp - 0x4c]
mov eax, dword [ebp - 0x4c]
mov eax, dword [eax + 0x20]
shl eax, 2
mov ecx, dword [edx]
lea edx, [eax + ecx]
mov eax, dword [ebp - 0x4c]
mov ecx, dword [eax + 0x14]
lea eax, [edx + ecx]
add eax, 0xe
mov dword [ebp - 0x46], eax
mov word [ebp - 0x42], 0
mov word [ebp - 0x40], 0
mov edx, dword [ebp - 0x4c]
mov eax, dword [ebp - 0x4c]
mov eax, dword [eax + 0x20]
shl eax, 2
add eax, dword [edx]
add eax, 0xe
mov dword [ebp - 0x3e], eax
mov dword [esp + 0x10], 0
lea eax, [ebp - 0x60]
mov dword [esp + 0xc], eax
mov dword [esp + 8], 0xe
lea eax, [ebp - 0x48]
mov dword [esp + 4], eax
mov eax, dword [ebp - 0x34]
mov dword [esp], eax
call sym._WriteFile_20
sub esp, 0x14
test eax, eax
jne 0x4016f3
mov eax, dword [ebp + 0x10]
mov dword [esp + 4], eax
mov dword [esp], str.error:_cannot_write_file__s_n
call sym._printf
mov dword [ebp - 0x64], 0
jmp 0x4017ea
mov dword [esp + 0x10], 0
lea eax, [ebp - 0x60]
mov dword [esp + 0xc], eax
mov eax, dword [ebp - 0x4c]
mov eax, dword [eax + 0x20]
shl eax, 2
add eax, 0x28
mov dword [esp + 8], eax
mov eax, dword [ebp - 0x4c]
mov dword [esp + 4], eax
mov eax, dword [ebp - 0x34]
mov dword [esp], eax
call sym._WriteFile_20
sub esp, 0x14
test eax, eax
jne 0x40174a
mov eax, dword [ebp + 0x10]
mov dword [esp + 4], eax
mov dword [esp], str.error:_cannot_write_file__s_n
call sym._printf
mov dword [ebp - 0x64], 0
jmp 0x4017ea
mov eax, dword [ebp - 0x4c]
mov eax, dword [eax + 0x14]
mov dword [ebp - 0x58], eax
mov dword [ebp - 0x54], eax
mov eax, dword [ebp - 0x50]
mov dword [ebp - 0x5c], eax
mov dword [esp + 0x10], 0
lea eax, [ebp - 0x60]
mov dword [esp + 0xc], eax
mov eax, dword [ebp - 0x58]
mov dword [esp + 8], eax
mov eax, dword [ebp - 0x5c]
mov dword [esp + 4], eax
mov eax, dword [ebp - 0x34]
mov dword [esp], eax
call sym._WriteFile_20
sub esp, 0x14
test eax, eax
jne 0x4017a7
mov eax, dword [ebp + 0x10]
mov dword [esp + 4], eax
mov dword [esp], str.error:_cannot_write_file__s_n
call sym._printf
mov dword [ebp - 0x64], 0
jmp 0x4017ea
mov eax, dword [ebp - 0x34]
mov dword [esp], eax
call sym._CloseHandle_4
sub esp, 4
test eax, eax
jne 0x4017d5
mov eax, dword [ebp + 0x10]
mov dword [esp + 4], eax
mov dword [esp], str.error:_cannot_close_file__s_n
call sym._printf
mov dword [ebp - 0x64], 0
jmp 0x4017ea
mov eax, dword [ebp - 0x50]
mov dword [esp], eax
call sym._GlobalFree_4
sub esp, 4
mov dword [ebp - 0x64], 1
mov eax, dword [ebp - 0x64]
leave
ret