mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 21:53:06 +00:00
[Win32SS] Implement EngCreate/DeletePalette.
Safe to be called from user side without UMPD support.
This commit is contained in:
parent
dcd463ba98
commit
c698eff041
2 changed files with 56 additions and 25 deletions
|
@ -211,21 +211,6 @@ NtGdiEngCreateDeviceSurface(
|
||||||
return NULL;
|
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
|
__kernel_entry
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
APIENTRY
|
APIENTRY
|
||||||
|
@ -236,16 +221,6 @@ NtGdiEngDeleteClip(
|
||||||
return STATUS_NOT_IMPLEMENTED;
|
return STATUS_NOT_IMPLEMENTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
__kernel_entry
|
|
||||||
BOOL
|
|
||||||
APIENTRY
|
|
||||||
NtGdiEngDeletePalette(
|
|
||||||
_In_ HPALETTE hPal)
|
|
||||||
{
|
|
||||||
UNIMPLEMENTED;
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
__kernel_entry
|
__kernel_entry
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
APIENTRY
|
APIENTRY
|
||||||
|
|
|
@ -12,6 +12,9 @@
|
||||||
#define NDEBUG
|
#define NDEBUG
|
||||||
#include <debug.h>
|
#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 */
|
static UINT SystemPaletteUse = SYSPAL_NOSTATIC; /* The program need save the pallete and restore it */
|
||||||
|
|
||||||
PALETTE gpalRGB, gpalBGR, gpalRGB555, gpalRGB565, *gppalMono, *gppalDefault;
|
PALETTE gpalRGB, gpalBGR, gpalRGB555, gpalRGB565, *gppalMono, *gppalDefault;
|
||||||
|
@ -1263,5 +1266,58 @@ NtGdiUnrealizeObject(HGDIOBJ hgdiobj)
|
||||||
return Ret;
|
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 */
|
/* EOF */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue