mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-08-26 19:33:31 +00:00
[Win32SS] Implement EngCreate/DeletePalette.
Safe to be called from user side without UMPD support.
This commit is contained in:
@@ -211,21 +211,6 @@ NtGdiEngCreateDeviceSurface(
|
||||
return NULL;
|
||||
}
|
||||
|
||||
__kernel_entry
|
||||
HPALETTE
|
||||
APIENTRY
|
||||
NtGdiEngCreatePalette(
|
||||
_In_ ULONG iMode,
|
||||
_In_ ULONG cColors,
|
||||
_In_ ULONG *pulColors,
|
||||
_In_ FLONG flRed,
|
||||
_In_ FLONG flGreen,
|
||||
_In_ FLONG flBlue)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
__kernel_entry
|
||||
NTSTATUS
|
||||
APIENTRY
|
||||
@@ -236,16 +221,6 @@ NtGdiEngDeleteClip(
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
__kernel_entry
|
||||
BOOL
|
||||
APIENTRY
|
||||
NtGdiEngDeletePalette(
|
||||
_In_ HPALETTE hPal)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
__kernel_entry
|
||||
NTSTATUS
|
||||
APIENTRY
|
||||
|
||||
@@ -12,6 +12,9 @@
|
||||
#define NDEBUG
|
||||
#include <debug.h>
|
||||
|
||||
#define PAL_SETOWNER 0x8000
|
||||
#define MAX_PALCOLORS 65536
|
||||
|
||||
static UINT SystemPaletteUse = SYSPAL_NOSTATIC; /* The program need save the pallete and restore it */
|
||||
|
||||
PALETTE gpalRGB, gpalBGR, gpalRGB555, gpalRGB565, *gppalMono, *gppalDefault;
|
||||
@@ -1263,5 +1266,58 @@ NtGdiUnrealizeObject(HGDIOBJ hgdiobj)
|
||||
return Ret;
|
||||
}
|
||||
|
||||
__kernel_entry
|
||||
HPALETTE
|
||||
APIENTRY
|
||||
NtGdiEngCreatePalette(
|
||||
_In_ ULONG iMode,
|
||||
_In_ ULONG cColors,
|
||||
_In_ ULONG *pulColors,
|
||||
_In_ FLONG flRed,
|
||||
_In_ FLONG flGreen,
|
||||
_In_ FLONG flBlue)
|
||||
{
|
||||
HPALETTE hPal = NULL;
|
||||
ULONG *pulcSafe, ulColors[WINDDI_MAXSETPALETTECOLORS];
|
||||
|
||||
if ( cColors > MAX_PALCOLORS ) return NULL;
|
||||
|
||||
if ( cColors <= WINDDI_MAXSETPALETTECOLORS )
|
||||
{
|
||||
pulcSafe = ulColors;
|
||||
}
|
||||
else
|
||||
{
|
||||
pulcSafe = ExAllocatePoolWithTag(PagedPool, cColors * sizeof(ULONG), GDITAG_UMPD );
|
||||
}
|
||||
|
||||
_SEH2_TRY
|
||||
{
|
||||
ProbeForRead( pulColors, cColors * sizeof(ULONG), 1);
|
||||
RtlCopyMemory( pulcSafe, pulColors, cColors * sizeof(ULONG) );
|
||||
}
|
||||
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||
{
|
||||
SetLastNtError(_SEH2_GetExceptionCode());
|
||||
if ( cColors > WINDDI_MAXSETPALETTECOLORS ) ExFreePoolWithTag( pulcSafe, GDITAG_UMPD );
|
||||
_SEH2_YIELD(return hPal);
|
||||
}
|
||||
_SEH2_END;
|
||||
|
||||
hPal = EngCreatePalette( iMode/*|PAL_SETOWNER*/, cColors, pulColors, flRed, flGreen, flBlue );
|
||||
|
||||
if ( cColors > WINDDI_MAXSETPALETTECOLORS ) ExFreePoolWithTag( pulcSafe, GDITAG_UMPD );
|
||||
|
||||
return hPal;
|
||||
}
|
||||
|
||||
__kernel_entry
|
||||
BOOL
|
||||
APIENTRY
|
||||
NtGdiEngDeletePalette(
|
||||
_In_ HPALETTE hPal)
|
||||
{
|
||||
return EngDeletePalette(hPal);
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
||||
Reference in New Issue
Block a user