Function at 0x470820
Capabilities:
Resolve function by parsing pe exports
Write file on windows

Disassembly:
sub esp, 0x5c
push ebx
push ebp
push esi
push edi
mov ebx, dword [esp + 0x7c]
cmp dword [esp + 0x74], 0
je 0x470906
lea eax, [esp + 0x10]
push eax
push 0x18
push dword [esp + 0x7c]
call dword [sym.imp.GDI32.DLL_GetObjectA]
test eax, eax
je 0x470906
test ebx, ebx
jne 0x470861
movzx eax, word [esp + 0x20]
movzx ecx, word [esp + 0x22]
imul ecx
mov ebx, eax
mov eax, 1
cmp ebx, eax
ja 0x47086e
mov ebx, eax
jmp 0x470887
mov al, 4
cmp ebx, eax
ja 0x470878
mov ebx, eax
jmp 0x470887
mov al, 8
cmp ebx, eax
ja 0x470882
mov ebx, eax
jmp 0x470887
mov ebx, 0x18
mov eax, 0x28
mov dword [esp + 0x28], eax
mov ecx, dword [esp + 0x14]
mov dword [esp + 0x2c], ecx
mov ecx, dword [esp + 0x18]
mov dword [esp + 0x30], ecx
mov word [esp + 0x34], 1
mov word [esp + 0x36], bx
xor ecx, ecx
mov dword [esp + 0x38], ecx
mov edx, dword [esp + 0x14]
imul edx, ebx
add edx, 0x1f
shr edx, 5
shl edx, 2
imul edx, dword [esp + 0x18]
mov dword [esp + 0x3c], edx
mov dword [esp + 0x40], ecx
mov dword [esp + 0x44], ecx
mov dword [esp + 0x48], ecx
mov dword [esp + 0x4c], ecx
lea edx, [esp + 0x28]
push edx
call fcn.004707fa
add esp, 4
and eax, 0xffff
mov ecx, dword [esp + 0x3c]
lea eax, [ecx + eax + 0x28]
push eax
push 0x42
call dword [sym.imp.KERNEL32.DLL_GlobalAlloc]
test eax, eax
mov dword [esp + 0x50], eax
jne 0x470910
xor eax, eax
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x5c
ret
push eax
call dword [sym.imp.KERNEL32.DLL_GlobalLock]
mov ebp, eax
mov eax, eax
add eax, dword [esp + 0x28]
push eax
lea ecx, [esp + 0x2c]
push ecx
call fcn.004707fa
mov ecx, eax
and ecx, 0xffff
add esp, 4
pop eax
add eax, ecx
mov dword [esp + 0x54], eax
lea esi, [esp + 0x28]
mov edi, ebp
mov ecx, 0xa
rep movsd dword es:[edi], dword [esi]
push ecx
call dword [sym.imp.USER32.DLL_GetDC]
mov ebx, eax
cmp dword [esp + 0x78], 0
je 0x470971
push 0
push dword [esp + 0x7c]
push ebx
call dword [sym.imp.GDI32.DLL_SelectPalette]
mov dword [esp + 0x78], eax
push ebx
call dword [sym.imp.GDI32.DLL_RealizePalette]
push 0
push ebp
push dword [esp + 0x5c]
push dword [esp + 0x24]
push 0
push dword [esp + 0x88]
push ebx
call dword [sym.imp.GDI32.DLL_GetDIBits]
test eax, eax
jne 0x4709ae
push dword [esp + 0x50]
call dword [sym.imp.KERNEL32.DLL_GlobalUnlock]
push dword [esp + 0x50]
call dword [sym.imp.KERNEL32.DLL_GlobalFree]
mov dword [esp + 0x50], 0
jmp 0x4709b8
push dword [esp + 0x50]
call dword [sym.imp.KERNEL32.DLL_GlobalUnlock]
cmp dword [esp + 0x78], 0
je 0x4709cc
push 0
push dword [esp + 0x7c]
push ebx
call dword [sym.imp.GDI32.DLL_SelectPalette]
push ebx
push 0
call dword [sym.imp.USER32.DLL_ReleaseDC]
cmp dword [esp + 0x70], 0
je 0x470b02
push 0
push 0x80
push 2
push 0
push 0
push 0xc0000000
push dword [esp + 0x88]
call dword [sym.imp.KERNEL32.DLL_CreateFileA]
mov edi, eax
cmp eax, 0xffffffff
mov ecx, 1
jne 0x470a0d
xor ecx, ecx
mov esi, ecx
cmp cx, 1
jne 0x470aed
mov word [esp + 0x58], 0x4d42
mov ecx, dword [ebp]
push ecx
push ebp
call fcn.004707fa
and eax, 0xffff
add esp, 4
pop ecx
lea ecx, [eax + ecx + 0xe]
mov dword [esp + 0x62], ecx
mov edx, dword [ebp + 0x14]
add edx, ecx
mov dword [esp + 0x5a], edx
xor ecx, ecx
mov word [esp + 0x5e], cx
mov word [esp + 0x60], cx
test si, si
je 0x470a6d
push ecx
lea ecx, [esp + 0x6c]
push ecx
push 0xe
lea ecx, [esp + 0x64]
push ecx
push edi
call dword [sym.imp.KERNEL32.DLL_WriteFile]
test eax, eax
jne 0x470a71
xor ecx, ecx
jmp 0x470a76
mov ecx, 1
test cx, cx
je 0x470aa0
push 0
lea ecx, [esp + 0x6c]
push ecx
push ebp
call fcn.004707fa
add esp, 4
and eax, 0xffff
add eax, 0x28
push eax
push ebp
push edi
call dword [sym.imp.KERNEL32.DLL_WriteFile]
test eax, eax
jne 0x470aa4
xor ecx, ecx
jmp 0x470aa9
mov ecx, 1
test cx, cx
je 0x470ac7
push 0
lea ecx, [esp + 0x6c]
push ecx
push dword [ebp + 0x14]
push dword [esp + 0x60]
push edi
call dword [sym.imp.KERNEL32.DLL_WriteFile]
test eax, eax
jne 0x470acb
xor ecx, ecx
jmp 0x470ad0
mov ecx, 1
mov esi, ecx
push edi
call dword [sym.imp.KERNEL32.DLL_CloseHandle]
test eax, eax
je 0x470ae2
test si, si
jne 0x470ae6
xor ecx, ecx
jmp 0x470aeb
mov ecx, 1
mov esi, ecx
push dword [esp + 0x50]
call dword [sym.imp.KERNEL32.DLL_GlobalFree]
movsx eax, si
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x5c
ret
mov eax, dword [esp + 0x50]
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x5c
ret