Function at 0x10309000
Capabilities:
Print debug messages

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x2c
mov eax, dword [ebp + 0xc]
mov dword [ebp - 8], eax
push 0
call dword [sym.imp.USER32.dll_GetDC]
mov dword [ebp - 4], eax
mov ecx, dword [ebp + 0x10]
movzx edx, word [ecx + 4]
sar edx, 8
mov byte [ebp - 0x10], dl
mov eax, dword [ebp + 0x10]
movzx ecx, word [eax + 6]
sar ecx, 8
mov byte [ebp - 0xf], cl
mov edx, dword [ebp + 0x10]
movzx eax, word [edx + 8]
sar eax, 8
mov byte [ebp - 0xe], al
mov byte [ebp - 0xd], 0
push 0x26
mov ecx, dword [ebp - 4]
push ecx
call dword [sym.imp.GDI32.dll_GetDeviceCaps]
and eax, 0x100
je 0x103091d9
push 0x68
mov edx, dword [ebp - 4]
push edx
call dword [sym.imp.GDI32.dll_GetDeviceCaps]
mov dword [ebp - 0x14], eax
movzx eax, byte [ebp - 0x10]
movzx ecx, byte [ebp - 0xf]
shl ecx, 8
or eax, ecx
movzx edx, byte [ebp - 0xe]
shl edx, 0x10
or eax, edx
mov dword [ebp - 0x1c], eax
mov eax, dword [ebp - 0x1c]
push eax
mov ecx, dword [ebp - 8]
mov edx, dword [ecx]
push edx
call dword [sym.imp.GDI32.dll_GetNearestPaletteIndex]
mov dword [ebp - 0x18], eax
lea eax, [ebp - 0xc]
push eax
push 1
mov ecx, dword [ebp - 0x18]
push ecx
mov edx, dword [ebp - 8]
mov eax, dword [edx]
push eax
call dword [sym.imp.GDI32.dll_GetPaletteEntries]
movzx ecx, byte [ebp - 0xc]
movzx edx, byte [ebp - 0xb]
shl edx, 8
or ecx, edx
movzx eax, byte [ebp - 0xa]
shl eax, 0x10
or ecx, eax
mov dword [ebp - 0x20], ecx
mov ecx, dword [ebp - 8]
mov edx, dword [ebp - 0x18]
cmp edx, dword [ecx + 4]
jae 0x103090da
mov eax, dword [ebp - 0x1c]
cmp eax, dword [ebp - 0x20]
je 0x10309174
mov ecx, dword [ebp - 8]
mov edx, dword [ecx + 4]
cmp edx, dword [ebp - 0x14]
jne 0x10309136
movzx eax, byte [ebp - 0xc]
imul eax, eax, 0x101
mov ecx, dword [ebp + 0x10]
mov word [ecx + 4], ax
movzx edx, byte [ebp - 0xb]
imul edx, edx, 0x101
mov eax, dword [ebp + 0x10]
mov word [eax + 6], dx
movzx ecx, byte [ebp - 0xa]
imul ecx, ecx, 0x101
mov edx, dword [ebp + 0x10]
mov word [edx + 8], cx
mov eax, dword [ebp - 0xc]
mov dword [ebp - 0x10], eax
mov ecx, dword [ebp - 8]
mov edx, dword [ebp - 0x18]
cmp edx, dword [ecx + 4]
jb 0x10309134
push str.XAllocColor:_Colormap_is_bigger_than_we_thought
call dword [sym.imp.KERNEL32.dll_OutputDebugStringA]
jmp 0x10309174
mov eax, dword [ebp - 8]
mov ecx, dword [eax + 4]
add ecx, 1
mov edx, dword [ebp - 8]
mov dword [edx + 4], ecx
mov eax, dword [ebp - 8]
mov ecx, dword [eax + 4]
push ecx
mov edx, dword [ebp - 8]
mov eax, dword [edx]
push eax
call dword [sym.imp.GDI32.dll_ResizePalette]
lea ecx, [ebp - 0x10]
push ecx
push 1
mov edx, dword [ebp - 8]
mov eax, dword [edx + 4]
sub eax, 1
push eax
mov ecx, dword [ebp - 8]
mov edx, dword [ecx]
push edx
call dword [sym.imp.GDI32.dll_SetPaletteEntries]
movzx eax, byte [ebp - 0x10]
movzx ecx, byte [ebp - 0xf]
shl ecx, 8
or eax, ecx
movzx edx, byte [ebp - 0xe]
shl edx, 0x10
or eax, edx
or eax, 0x2000000
mov ecx, dword [ebp + 0x10]
mov dword [ecx], eax
lea edx, [ebp - 0x2c]
push edx
mov eax, dword [ebp + 0x10]
mov ecx, dword [eax]
push ecx
mov edx, dword [ebp - 8]
add edx, 0xc
push edx
mov eax, dword [ebp - 8]
mov ecx, dword [eax + 0x3c]
call ecx
add esp, 0xc
mov dword [ebp - 0x28], eax
cmp dword [ebp - 0x2c], 0
je 0x103091c2
mov dword [ebp - 0x24], 1
jmp 0x103091ce
mov edx, dword [ebp - 0x28]
mov eax, dword [edx + 0xc]
add eax, 1
mov dword [ebp - 0x24], eax
mov ecx, dword [ebp - 0x28]
mov edx, dword [ebp - 0x24]
mov dword [ecx + 0xc], edx
jmp 0x10309256
movzx eax, byte [ebp - 0x10]
movzx ecx, byte [ebp - 0xf]
shl ecx, 8
or eax, ecx
movzx edx, byte [ebp - 0xe]
shl edx, 0x10
or eax, edx
push eax
mov eax, dword [ebp - 4]
push eax
call dword [sym.imp.GDI32.dll_GetNearestColor]
mov ecx, dword [ebp + 0x10]
mov dword [ecx], eax
mov edx, dword [ebp + 0x10]
mov eax, dword [edx]
and eax, 0xff
movzx ecx, al
imul ecx, ecx, 0x101
mov edx, dword [ebp + 0x10]
mov word [edx + 4], cx
mov eax, dword [ebp + 0x10]
movzx ecx, word [eax]
sar ecx, 8
and ecx, 0xff
movzx edx, cl
imul edx, edx, 0x101
mov eax, dword [ebp + 0x10]
mov word [eax + 6], dx
mov ecx, dword [ebp + 0x10]
mov edx, dword [ecx]
shr edx, 0x10
and edx, 0xff
movzx eax, dl
imul eax, eax, 0x101
mov ecx, dword [ebp + 0x10]
mov word [ecx + 8], ax
mov edx, dword [ebp - 4]
push edx
push 0
call dword [sym.imp.USER32.dll_ReleaseDC]
mov eax, 1
mov esp, ebp
pop ebp
ret