2 * ReactOS W32 Subsystem
3 * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 ReactOS Team
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26 // FIXME: Use PXLATEOBJ logicalToSystem instead of int *mapping
28 int COLOR_gapStart
= 256;
29 int COLOR_gapEnd
= -1;
30 int COLOR_gapFilled
= 0;
34 static HPALETTE hPrimaryPalette
= 0; // used for WM_PALETTECHANGED
36 //static HPALETTE hLastRealizedPalette = 0; // UnrealizeObject() needs it
39 static UINT SystemPaletteUse
= SYSPAL_NOSTATIC
; /* the program need save the pallete and restore it */
41 const PALETTEENTRY COLOR_sysPalTemplate
[NB_RESERVED_COLORS
] =
43 // first 10 entries in the system palette
44 // red green blue flags
45 { 0x00, 0x00, 0x00, PC_SYS_USED
},
46 { 0x80, 0x00, 0x00, PC_SYS_USED
},
47 { 0x00, 0x80, 0x00, PC_SYS_USED
},
48 { 0x80, 0x80, 0x00, PC_SYS_USED
},
49 { 0x00, 0x00, 0x80, PC_SYS_USED
},
50 { 0x80, 0x00, 0x80, PC_SYS_USED
},
51 { 0x00, 0x80, 0x80, PC_SYS_USED
},
52 { 0xc0, 0xc0, 0xc0, PC_SYS_USED
},
53 { 0xc0, 0xdc, 0xc0, PC_SYS_USED
},
54 { 0xa6, 0xca, 0xf0, PC_SYS_USED
},
56 // ... c_min/2 dynamic colorcells
57 // ... gap (for sparse palettes)
58 // ... c_min/2 dynamic colorcells
60 { 0xff, 0xfb, 0xf0, PC_SYS_USED
},
61 { 0xa0, 0xa0, 0xa4, PC_SYS_USED
},
62 { 0x80, 0x80, 0x80, PC_SYS_USED
},
63 { 0xff, 0x00, 0x00, PC_SYS_USED
},
64 { 0x00, 0xff, 0x00, PC_SYS_USED
},
65 { 0xff, 0xff, 0x00, PC_SYS_USED
},
66 { 0x00, 0x00, 0xff, PC_SYS_USED
},
67 { 0xff, 0x00, 0xff, PC_SYS_USED
},
68 { 0x00, 0xff, 0xff, PC_SYS_USED
},
69 { 0xff, 0xff, 0xff, PC_SYS_USED
} // last 10
72 const PALETTEENTRY
* FASTCALL
COLOR_GetSystemPaletteTemplate(void)
74 return (const PALETTEENTRY
*)&COLOR_sysPalTemplate
;
78 IntAnimatePalette(HPALETTE hPal
,
81 CONST PPALETTEENTRY PaletteColors
)
85 if( hPal
!= NtGdiGetStockObject(DEFAULT_PALETTE
) )
92 const PALETTEENTRY
*pptr
= PaletteColors
;
94 palPtr
= (PPALGDI
)PALETTE_LockPalette(hPal
);
95 if (!palPtr
) return FALSE
;
97 pal_entries
= palPtr
->NumColors
;
98 if (StartIndex
>= pal_entries
)
100 PALETTE_UnlockPalette(palPtr
);
103 if (StartIndex
+NumEntries
> pal_entries
) NumEntries
= pal_entries
- StartIndex
;
105 for (NumEntries
+= StartIndex
; StartIndex
< NumEntries
; StartIndex
++, pptr
++)
107 /* According to MSDN, only animate PC_RESERVED colours */
108 if (palPtr
->IndexedColors
[StartIndex
].peFlags
& PC_RESERVED
)
110 memcpy( &palPtr
->IndexedColors
[StartIndex
], pptr
,
111 sizeof(PALETTEENTRY
) );
113 PALETTE_ValidateFlags(&palPtr
->IndexedColors
[StartIndex
], 1);
117 PALETTE_UnlockPalette(palPtr
);
119 /* Immediately apply the new palette if current window uses it */
120 Wnd
= UserGetDesktopWindow();
121 hDC
= UserGetWindowDC(Wnd
);
125 if (dc
->dclevel
.hpal
== hPal
)
128 IntGdiRealizePalette(hDC
);
133 UserReleaseDC(Wnd
,hDC
, FALSE
);
138 HPALETTE APIENTRY
NtGdiCreateHalftonePalette(HDC hDC
)
143 WORD NumberOfEntries
;
144 PALETTEENTRY aEntries
[256];
147 Palette
.Version
= 0x300;
148 Palette
.NumberOfEntries
= 256;
149 if (IntGetSystemPaletteEntries(hDC
, 0, 256, Palette
.aEntries
) == 0)
151 /* from wine, more that 256 color math */
152 Palette
.NumberOfEntries
= 20;
153 for (i
= 0; i
< Palette
.NumberOfEntries
; i
++)
155 Palette
.aEntries
[i
].peRed
=0xff;
156 Palette
.aEntries
[i
].peGreen
=0xff;
157 Palette
.aEntries
[i
].peBlue
=0xff;
158 Palette
.aEntries
[i
].peFlags
=0x00;
161 Palette
.aEntries
[0].peRed
=0x00;
162 Palette
.aEntries
[0].peBlue
=0x00;
163 Palette
.aEntries
[0].peGreen
=0x00;
166 for (i
=1; i
<= 6; i
++)
168 Palette
.aEntries
[i
].peRed
=(i
%2)?0x80:0;
169 Palette
.aEntries
[i
].peGreen
=(i
==2)?0x80:(i
==3)?0x80:(i
==6)?0x80:0;
170 Palette
.aEntries
[i
].peBlue
=(i
>3)?0x80:0;
173 for (i
=7; i
<= 12; i
++)
178 Palette
.aEntries
[i
].peRed
=0xc0;
179 Palette
.aEntries
[i
].peBlue
=0xc0;
180 Palette
.aEntries
[i
].peGreen
=0xc0;
183 Palette
.aEntries
[i
].peRed
=0xc0;
184 Palette
.aEntries
[i
].peGreen
=0xdc;
185 Palette
.aEntries
[i
].peBlue
=0xc0;
188 Palette
.aEntries
[i
].peRed
=0xa6;
189 Palette
.aEntries
[i
].peGreen
=0xca;
190 Palette
.aEntries
[i
].peBlue
=0xf0;
193 Palette
.aEntries
[i
].peRed
=0xff;
194 Palette
.aEntries
[i
].peGreen
=0xfb;
195 Palette
.aEntries
[i
].peBlue
=0xf0;
198 Palette
.aEntries
[i
].peRed
=0xa0;
199 Palette
.aEntries
[i
].peGreen
=0xa0;
200 Palette
.aEntries
[i
].peBlue
=0xa4;
203 Palette
.aEntries
[i
].peRed
=0x80;
204 Palette
.aEntries
[i
].peGreen
=0x80;
205 Palette
.aEntries
[i
].peBlue
=0x80;
209 for (i
=13; i
<= 18; i
++)
211 Palette
.aEntries
[i
].peRed
=(i
%2)?0xff:0;
212 Palette
.aEntries
[i
].peGreen
=(i
==14)?0xff:(i
==15)?0xff:(i
==18)?0xff:0;
213 Palette
.aEntries
[i
].peBlue
=(i
>15)?0xff:0x00;
218 /* 256 color table */
219 for (r
= 0; r
< 6; r
++)
220 for (g
= 0; g
< 6; g
++)
221 for (b
= 0; b
< 6; b
++)
223 i
= r
+ g
*6 + b
*36 + 10;
224 Palette
.aEntries
[i
].peRed
= r
* 51;
225 Palette
.aEntries
[i
].peGreen
= g
* 51;
226 Palette
.aEntries
[i
].peBlue
= b
* 51;
229 for (i
= 216; i
< 246; i
++)
231 int v
= (i
- 216) << 3;
232 Palette
.aEntries
[i
].peRed
= v
;
233 Palette
.aEntries
[i
].peGreen
= v
;
234 Palette
.aEntries
[i
].peBlue
= v
;
238 return NtGdiCreatePaletteInternal((LOGPALETTE
*)&Palette
, Palette
.NumberOfEntries
);
247 NtGdiCreatePaletteInternal ( IN LPLOGPALETTE pLogPal
, IN UINT cEntries
)
252 pLogPal
->palNumEntries
= cEntries
;
253 NewPalette
= PALETTE_AllocPalette( PAL_INDEXED
,
255 (PULONG
)pLogPal
->palPalEntry
,
258 if (NewPalette
== NULL
)
263 PalGDI
= (PPALGDI
) PALETTE_LockPalette(NewPalette
);
266 PALETTE_ValidateFlags(PalGDI
->IndexedColors
, PalGDI
->NumColors
);
267 PalGDI
->logicalToSystem
= NULL
;
268 PALETTE_UnlockPalette(PalGDI
);
272 /* FIXME - Handle PalGDI == NULL!!!! */
273 DPRINT1("waring PalGDI is NULL \n");
279 BOOL APIENTRY
NtGdiGetColorAdjustment(HDC hDC
,
280 LPCOLORADJUSTMENT ca
)
286 unsigned short GetNumberOfBits(unsigned int dwMask
)
288 unsigned short wBits
;
289 for (wBits
= 0; dwMask
; dwMask
= dwMask
& (dwMask
- 1))
294 COLORREF APIENTRY
NtGdiGetNearestColor(HDC hDC
, COLORREF Color
)
296 COLORREF nearest
= CLR_INVALID
;
299 LONG RBits
, GBits
, BBits
;
304 HPALETTE hpal
= dc
->dclevel
.hpal
;
305 palGDI
= (PPALGDI
) PALETTE_LockPalette(hpal
);
312 switch (palGDI
->Mode
)
315 nearest
= COLOR_LookupNearestColor(palGDI
->IndexedColors
,
316 palGDI
->NumColors
, Color
);
323 RBits
= 8 - GetNumberOfBits(palGDI
->RedMask
);
324 GBits
= 8 - GetNumberOfBits(palGDI
->GreenMask
);
325 BBits
= 8 - GetNumberOfBits(palGDI
->BlueMask
);
327 (GetRValue(Color
) >> RBits
) << RBits
,
328 (GetGValue(Color
) >> GBits
) << GBits
,
329 (GetBValue(Color
) >> BBits
) << BBits
);
332 PALETTE_UnlockPalette(palGDI
);
339 UINT APIENTRY
NtGdiGetNearestPaletteIndex(HPALETTE hpal
,
342 PPALGDI palGDI
= (PPALGDI
) PALETTE_LockPalette(hpal
);
347 /* Return closest match for the given RGB color */
348 index
= COLOR_PaletteLookupPixel(palGDI
->IndexedColors
, palGDI
->NumColors
, NULL
, Color
, FALSE
);
349 PALETTE_UnlockPalette(palGDI
);
356 IntGetPaletteEntries(HPALETTE hpal
,
364 palGDI
= (PPALGDI
) PALETTE_LockPalette(hpal
);
370 numEntries
= palGDI
->NumColors
;
373 if (numEntries
< StartIndex
+ Entries
)
375 Entries
= numEntries
- StartIndex
;
377 if (numEntries
<= StartIndex
)
379 PALETTE_UnlockPalette(palGDI
);
382 memcpy(pe
, palGDI
->IndexedColors
+ StartIndex
, Entries
* sizeof(PALETTEENTRY
));
383 for (numEntries
= 0; numEntries
< Entries
; numEntries
++)
385 if (pe
[numEntries
].peFlags
& 0xF0)
387 pe
[numEntries
].peFlags
= 0;
393 Entries
= numEntries
;
396 PALETTE_UnlockPalette(palGDI
);
401 IntGetSystemPaletteEntries(HDC hDC
,
406 PPALGDI palGDI
= NULL
;
408 UINT EntriesSize
= 0;
413 SetLastWin32Error(ERROR_INVALID_PARAMETER
);
419 EntriesSize
= Entries
* sizeof(pe
[0]);
420 if (Entries
!= EntriesSize
/ sizeof(pe
[0]))
422 /* Integer overflow! */
423 SetLastWin32Error(ERROR_INVALID_PARAMETER
);
428 if (!(dc
= DC_LockDc(hDC
)))
430 SetLastWin32Error(ERROR_INVALID_HANDLE
);
434 palGDI
= PALETTE_LockPalette(dc
->dclevel
.hpal
);
439 if (StartIndex
>= palGDI
->NumColors
)
441 else if (Entries
> palGDI
->NumColors
- StartIndex
)
442 Entries
= palGDI
->NumColors
- StartIndex
;
445 palGDI
->IndexedColors
+ StartIndex
,
446 Entries
* sizeof(pe
[0]));
452 Ret
= dc
->ppdev
->GDIInfo
.ulNumPalReg
;
457 PALETTE_UnlockPalette(palGDI
);
465 UINT APIENTRY
NtGdiGetSystemPaletteUse(HDC hDC
)
467 return SystemPaletteUse
;
471 The RealizePalette function modifies the palette for the device associated with the specified device context. If the device context is a memory DC, the color table for the bitmap selected into the DC is modified. If the device context is a display DC, the physical palette for that device is modified.
473 A logical palette is a buffer between color-intensive applications and the system, allowing these applications to use as many colors as needed without interfering with colors displayed by other windows.
475 1= IF DRAWING TO A DEVICE
476 -- If it is a paletted bitmap, and is not an identity palette, then an XLATEOBJ is created between the logical palette and
478 -- If it is an RGB palette, then an XLATEOBJ is created between the RGB values and the system palette.
480 2= IF DRAWING TO A MEMORY DC\BITMAP
481 -- If it is a paletted bitmap, and is not an identity palette, then an XLATEOBJ is created between the logical palette and
483 -- If it is an RGB palette, then an XLATEOBJ is created between the RGB values and the dc palette.
485 UINT FASTCALL
IntGdiRealizePalette(HDC hDC
)
488 * This function doesn't do any real work now and there's plenty
492 PPALGDI palGDI
, sysGDI
;
495 HPALETTE systemPalette
;
496 USHORT sysMode
, palMode
;
501 systemPalette
= NtGdiGetStockObject(DEFAULT_PALETTE
);
502 palGDI
= PALETTE_LockPalette(dc
->dclevel
.hpal
);
506 DPRINT1("IntGdiRealizePalette(): palGDI is NULL, exiting\n");
511 sysGDI
= PALETTE_LockPalette(systemPalette
);
515 DPRINT1("IntGdiRealizePalette(): sysGDI is NULL, exiting\n");
516 PALETTE_UnlockPalette(palGDI
);
521 // The RealizePalette function modifies the palette for the device associated with the specified device context. If the
522 // device context is a memory DC, the color table for the bitmap selected into the DC is modified. If the device
523 // context is a display DC, the physical palette for that device is modified.
524 if(dc
->dctype
== DC_TYPE_MEMORY
)
527 DPRINT1("RealizePalette unimplemented for memory managed DCs\n");
530 DPRINT1("RealizePalette unimplemented for device DCs\n");
533 // need to pass this to IntEngCreateXlate with palettes unlocked
534 sysMode
= sysGDI
->Mode
;
535 palMode
= palGDI
->Mode
;
536 PALETTE_UnlockPalette(sysGDI
);
537 PALETTE_UnlockPalette(palGDI
);
539 // Create the XLATEOBJ for device managed DCs
540 if(dc
->dctype
!= DC_TYPE_MEMORY
)
542 if (palGDI
->logicalToSystem
!= NULL
)
544 EngDeleteXlate(palGDI
->logicalToSystem
);
546 palGDI
->logicalToSystem
= IntEngCreateXlate(sysMode
, palMode
, systemPalette
, dc
->dclevel
.hpal
);
554 BOOL APIENTRY
NtGdiResizePalette(HPALETTE hpal
,
557 /* PALOBJ *palPtr = (PALOBJ*)AccessUserObject(hPal);
558 UINT cPrevEnt, prevVer;
559 INT prevsize, size = sizeof(LOGPALETTE) + (cEntries - 1) * sizeof(PALETTEENTRY);
560 XLATEOBJ *XlateObj = NULL;
562 if(!palPtr) return FALSE;
563 cPrevEnt = palPtr->logpalette->palNumEntries;
564 prevVer = palPtr->logpalette->palVersion;
565 prevsize = sizeof(LOGPALETTE) + (cPrevEnt - 1) * sizeof(PALETTEENTRY) + sizeof(int*) + sizeof(GDIOBJHDR);
566 size += sizeof(int*) + sizeof(GDIOBJHDR);
567 XlateObj = palPtr->logicalToSystem;
569 if (!(palPtr = GDI_ReallocObject(size, hPal, palPtr))) return FALSE;
573 XLATEOBJ *NewXlateObj = (int*) HeapReAlloc(GetProcessHeap(), 0, XlateObj, cEntries * sizeof(int));
574 if(NewXlateObj == NULL)
576 ERR("Can not resize logicalToSystem -- out of memory!");
577 GDI_ReleaseObj( hPal );
580 palPtr->logicalToSystem = NewXlateObj;
583 if(cEntries > cPrevEnt)
585 if(XlateObj) memset(palPtr->logicalToSystem + cPrevEnt, 0, (cEntries - cPrevEnt)*sizeof(int));
586 memset( (BYTE*)palPtr + prevsize, 0, size - prevsize );
587 PALETTE_ValidateFlags((PALETTEENTRY*)((BYTE*)palPtr + prevsize), cEntries - cPrevEnt );
589 palPtr->logpalette->palNumEntries = cEntries;
590 palPtr->logpalette->palVersion = prevVer;
591 // GDI_ReleaseObj( hPal );
598 BOOL APIENTRY
NtGdiSetColorAdjustment(HDC hDC
,
599 LPCOLORADJUSTMENT ca
)
606 IntSetPaletteEntries(HPALETTE hpal
,
609 CONST LPPALETTEENTRY pe
)
614 if ((UINT
)hpal
& GDI_HANDLE_STOCK_MASK
)
619 palGDI
= PALETTE_LockPalette(hpal
);
620 if (!palGDI
) return 0;
622 numEntries
= palGDI
->NumColors
;
623 if (Start
>= numEntries
)
625 PALETTE_UnlockPalette(palGDI
);
628 if (numEntries
< Start
+ Entries
)
630 Entries
= numEntries
- Start
;
632 memcpy(palGDI
->IndexedColors
+ Start
, pe
, Entries
* sizeof(PALETTEENTRY
));
633 PALETTE_ValidateFlags(palGDI
->IndexedColors
, palGDI
->NumColors
);
634 if (palGDI
->logicalToSystem
)
635 ExFreePool(palGDI
->logicalToSystem
);
636 palGDI
->logicalToSystem
= NULL
;
637 PALETTE_UnlockPalette(palGDI
);
643 NtGdiSetSystemPaletteUse(HDC hDC
, UINT Usage
)
645 UINT old
= SystemPaletteUse
;
647 /* Device doesn't support colour palettes */
648 if (!(NtGdiGetDeviceCaps(hDC
, RASTERCAPS
) & RC_PALETTE
)) {
654 case SYSPAL_NOSTATIC
:
655 case SYSPAL_NOSTATIC256
:
657 SystemPaletteUse
= Usage
;
670 NtGdiUnrealizeObject(HGDIOBJ hgdiobj
)
676 ((UINT
)hgdiobj
& GDI_HANDLE_STOCK_MASK
) ||
677 !GDI_HANDLE_IS_TYPE(hgdiobj
, GDI_OBJECT_TYPE_PALETTE
) )
680 palGDI
= PALETTE_LockPalette(hgdiobj
);
681 if (!palGDI
) return FALSE
;
684 // Need to do something!!!
685 // Zero out Current and Old Translated pointers?
688 PALETTE_UnlockPalette(palGDI
);
693 NtGdiUpdateColors(HDC hDC
)
696 BOOL calledFromUser
, ret
;
697 USER_REFERENCE_ENTRY Ref
;
699 calledFromUser
= UserIsEntered();
701 if (!calledFromUser
){
702 UserEnterExclusive();
705 Wnd
= UserGetWindowObject(IntWindowFromDC(hDC
));
708 SetLastWin32Error(ERROR_INVALID_WINDOW_HANDLE
);
710 if (!calledFromUser
){
717 UserRefObjectCo(Wnd
, &Ref
);
718 ret
= co_UserRedrawWindow(Wnd
, NULL
, 0, RDW_INVALIDATE
);
719 UserDerefObjectCo(Wnd
);
721 if (!calledFromUser
){
728 INT APIENTRY
COLOR_PaletteLookupPixel(PALETTEENTRY
*palPalEntry
, INT size
,
729 XLATEOBJ
*XlateObj
, COLORREF col
, BOOL skipReserved
)
731 int i
, best
= 0, diff
= 0x7fffffff;
734 for( i
= 0; i
< size
&& diff
; i
++ )
737 if(!(palPalEntry
[i
].peFlags
& PC_SYS_USED
) || (skipReserved
&& palPalEntry
[i
].peFlags
& PC_SYS_RESERVED
))
741 r
= abs((SHORT
)palPalEntry
[i
].peRed
- GetRValue(col
));
742 g
= abs((SHORT
)palPalEntry
[i
].peGreen
- GetGValue(col
));
743 b
= abs((SHORT
)palPalEntry
[i
].peBlue
- GetBValue(col
));
747 if( r
< diff
) { best
= i
; diff
= r
; }
750 if (XlateObj
== NULL
)
753 return (XlateObj
->pulXlate
) ? (INT
)XlateObj
->pulXlate
[best
] : best
;
756 COLORREF APIENTRY
COLOR_LookupNearestColor( PALETTEENTRY
* palPalEntry
, int size
, COLORREF color
)
760 index
= COLOR_PaletteLookupPixel(palPalEntry
, size
, NULL
, color
, FALSE
);
762 palPalEntry
[index
].peRed
,
763 palPalEntry
[index
].peGreen
,
764 palPalEntry
[index
].peBlue
);
767 int APIENTRY
COLOR_PaletteLookupExactIndex( PALETTEENTRY
* palPalEntry
, int size
,
771 BYTE r
= GetRValue(col
), g
= GetGValue(col
), b
= GetBValue(col
);
772 for( i
= 0; i
< size
; i
++ )
774 if( palPalEntry
[i
].peFlags
& PC_SYS_USED
) /* skips gap */
775 if(palPalEntry
[i
].peRed
== r
&& palPalEntry
[i
].peGreen
== g
&& palPalEntry
[i
].peBlue
== b
) return i
;
788 IN LPVOID pUnsafeEntries
,
793 LPVOID pEntries
= NULL
;
795 /* FIXME: Handle bInbound correctly */
798 (pUnsafeEntries
== NULL
|| cEntries
== 0))
805 pEntries
= ExAllocatePool(PagedPool
, cEntries
* sizeof(PALETTEENTRY
));
812 ProbeForRead(pUnsafeEntries
, cEntries
* sizeof(PALETTEENTRY
), 1);
813 memcpy(pEntries
, pUnsafeEntries
, cEntries
* sizeof(PALETTEENTRY
));
815 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER
)
817 ExFreePool(pEntries
);
818 _SEH2_YIELD(return 0);
829 ret
= IntAnimatePalette((HPALETTE
)hObj
, iStart
, cEntries
, (CONST PPALETTEENTRY
)pEntries
);
832 case GdiPalSetEntries
:
834 ret
= IntSetPaletteEntries((HPALETTE
)hObj
, iStart
, cEntries
, (CONST LPPALETTEENTRY
)pEntries
);
837 case GdiPalGetEntries
:
838 ret
= IntGetPaletteEntries((HPALETTE
)hObj
, iStart
, cEntries
, (LPPALETTEENTRY
)pEntries
);
841 case GdiPalGetSystemEntries
:
842 ret
= IntGetSystemPaletteEntries((HDC
)hObj
, iStart
, cEntries
, (LPPALETTEENTRY
)pEntries
);
845 case GdiPalSetColorTable
:
847 ret
= IntSetDIBColorTable((HDC
)hObj
, iStart
, cEntries
, (RGBQUAD
*)pEntries
);
850 case GdiPalGetColorTable
:
852 ret
= IntGetDIBColorTable((HDC
)hObj
, iStart
, cEntries
, (RGBQUAD
*)pEntries
);
862 ProbeForWrite(pUnsafeEntries
, cEntries
* sizeof(PALETTEENTRY
), 1);
863 memcpy(pUnsafeEntries
, pEntries
, cEntries
* sizeof(PALETTEENTRY
));
865 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER
)
871 ExFreePool(pEntries
);