Fix GDI_PAL_COLORS crash.

Dmitry Timoshkov dmitry at baikal.ru
Mon Apr 4 18:36:27 CDT 2005


"Glenn Wurster" <gwurster at scs.carleton.ca> wrote:

> GDI_PAL_COLORS is composed of 16 bit indexes, we only got the first
> 256 colours.  Instead of making a copy of possibly 65535 different
> palette entries in the logical palette, get a pointer and build up the
> dib colours as needed.  Yes, the % is how windows works.  Yes,
> conformance tests are in the queue of patches to be submitted.

GDI_GetObjPtr/GDI_ReleaseObj are the DLL separation hacks and will be
removed eventually from GDI32 exports. You need to make a copy of all
palette entries anyway. Perhaps the following code is a better solution:

colors = GetPaletteEntries(hpal, 0, 0, NULL);
pal_ents = HeapAlloc(GetProcessHeap(), 0, colors * sizeof(*pal_ents));
colors = GetPaletteEntries(hpal, 0, colors, pal_ents);

for(i = 0; i < colors; i++, index++)
{
...
}

HeapFree(GetProcessHeap(), 0, pal_ents);

-- 
Dmitry.




More information about the wine-devel mailing list