diff --git a/win32ss/gdi/ntgdi/palette.c b/win32ss/gdi/ntgdi/palette.c index 265b691164..54c12f7b69 100644 --- a/win32ss/gdi/ntgdi/palette.c +++ b/win32ss/gdi/ntgdi/palette.c @@ -965,6 +965,9 @@ IntSetPaletteEntries( { PPALETTE palGDI; ULONG numEntries; + INT i; + BYTE tmp; + PALETTEENTRY palnew[256]; if ((UINT_PTR)hpal & GDI_HANDLE_STOCK_MASK) { @@ -974,6 +977,21 @@ IntSetPaletteEntries( palGDI = PALETTE_ShareLockPalette(hpal); if (!palGDI) return 0; + if ((Entries < 256) && (pe)) + { + memcpy(palnew, pe, Entries * sizeof(PALETTEENTRY)); + i = 0; + do + { + tmp = palnew[i].peBlue; + palnew[i].peBlue = palnew[i].peRed; + palnew[i].peRed = tmp; + DPRINT("Color Entry '%d' is '%06x' and red/blue is '%d/%d.\n", i, pe[i], pe[i].peRed, pe[i].peBlue); + ++i; + } + while (i < Entries); + } + numEntries = palGDI->NumColors; if (Start >= numEntries) { @@ -984,7 +1002,7 @@ IntSetPaletteEntries( { Entries = numEntries - Start; } - memcpy(palGDI->IndexedColors + Start, pe, Entries * sizeof(PALETTEENTRY)); + memcpy(palGDI->IndexedColors + Start, palnew, Entries * sizeof(PALETTEENTRY)); PALETTE_ShareUnlockPalette(palGDI); return Entries;