Author: tkreuzer Date: Thu Aug 23 04:31:26 2007 New Revision: 28459
URL: http://svn.reactos.org/svn/reactos?rev=28459&view=rev Log: - NtGdiAnimatePalette, NtGdiGe/SetPaletteEntries, NtGdiGetSystemPaletteEntries, NtGdiGet/SetDIBColorTable: rename into IntXxx, remove SEH and remove functions from w32ksvc.db - implement NtGdiDoPalette calling the Int functions using SEH & ProbeForXxx and add it to w32ksvc.db - change parameters of NtGdiDoPalette: HPALETTE -> HGDIOBJ, as it also accepts HDC, LPPALETTENTRY -> LPVOID as it also accepts RGBQUAD* - implement stub functions in gdi32.dll calling NtGdiDoPalette instead of redirecting to the old NtGdixxx functions - update ntgdibad.h
Added: trunk/reactos/dll/win32/gdi32/objects/palette.c Modified: trunk/reactos/dll/win32/gdi32/gdi32.def trunk/reactos/dll/win32/gdi32/gdi32.rbuild trunk/reactos/include/psdk/ntgdi.h trunk/reactos/include/reactos/win32k/ntgdibad.h trunk/reactos/subsystems/win32/win32k/include/intgdi.h trunk/reactos/subsystems/win32/win32k/objects/color.c trunk/reactos/subsystems/win32/win32k/objects/dibobj.c trunk/reactos/subsystems/win32/win32k/w32ksvc.db
Modified: trunk/reactos/dll/win32/gdi32/gdi32.def URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdi32/gdi32.def?r... ============================================================================== --- trunk/reactos/dll/win32/gdi32/gdi32.def (original) +++ trunk/reactos/dll/win32/gdi32/gdi32.def Thu Aug 23 04:31:26 2007 @@ -17,7 +17,7 @@ AddFontResourceW@4 AddFontResourceTracking@8 AngleArc@24 -AnimatePalette@16=NtGdiAnimatePalette@16 +AnimatePalette@16 AnyLinkedFonts@0 Arc@36 ArcTo@36 @@ -368,7 +368,7 @@ GetDCBrushColor@4 GetDCOrgEx@8 GetDCPenColor@4 -GetDIBColorTable@16=NtGdiGetDIBColorTable@16 +GetDIBColorTable@16 GetDIBits@28 GetDeviceCaps@8=NtGdiGetDeviceCaps@8 GetDeviceGammaRamp@8 @@ -417,7 +417,7 @@ GetObjectW@12 GetOutlineTextMetricsA@12 GetOutlineTextMetricsW@12 -GetPaletteEntries@16=NtGdiGetPaletteEntries@16 +GetPaletteEntries@16 GetPath@16 GetPixel@12=NtGdiGetPixel@12 GetPixelFormat@4 @@ -432,7 +432,7 @@ GetStretchBltMode@4=NtGdiGetStretchBltMode@4 GetStringBitmapA@20 GetStringBitmapW@20 -GetSystemPaletteEntries@16=NtGdiGetSystemPaletteEntries@16 +GetSystemPaletteEntries@16 GetSystemPaletteUse@4 GetTextAlign@4=NtGdiGetTextAlign@4 GetTextCharacterExtra@4 @@ -542,7 +542,7 @@ SetColorSpace@8 SetDCBrushColor@8 SetDCPenColor@8 -SetDIBColorTable@16=NtGdiSetDIBColorTable@16 +SetDIBColorTable@16 SetDIBits@28=NtGdiSetDIBits@28 SetDIBitsToDevice@48 SetDeviceGammaRamp@8 @@ -560,7 +560,7 @@ SetMetaFileBitsEx@8 SetMetaRgn@4 SetMiterLimit@12 -SetPaletteEntries@16=NtGdiSetPaletteEntries@16 +SetPaletteEntries@16 SetPixel@16=NtGdiSetPixel@16 SetPixelFormat@12 SetPixelV@16=NtGdiSetPixelV@16
Modified: trunk/reactos/dll/win32/gdi32/gdi32.rbuild URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdi32/gdi32.rbuil... ============================================================================== --- trunk/reactos/dll/win32/gdi32/gdi32.rbuild (original) +++ trunk/reactos/dll/win32/gdi32/gdi32.rbuild Thu Aug 23 04:31:26 2007 @@ -37,6 +37,7 @@ <file>linedda.c</file> <file>metafile.c</file> <file>painting.c</file> + <file>palette.c</file> <file>pen.c</file> <file>region.c</file> <file>text.c</file>
Added: trunk/reactos/dll/win32/gdi32/objects/palette.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdi32/objects/pal... ============================================================================== --- trunk/reactos/dll/win32/gdi32/objects/palette.c (added) +++ trunk/reactos/dll/win32/gdi32/objects/palette.c Thu Aug 23 04:31:26 2007 @@ -1,0 +1,66 @@ +#include "precomp.h" + +#define NDEBUG +#include <debug.h> + +BOOL +WINAPI +AnimatePalette(HPALETTE hpal, + UINT iStartIndex, + UINT cEntries, + const PALETTEENTRY *ppe) +{ + return NtGdiDoPalette(hpal, iStartIndex, cEntries, (PALETTEENTRY*)ppe, GdiPalAnimate, TRUE); +} + +UINT +WINAPI +GetPaletteEntries(HPALETTE hpal, + UINT iStartIndex, + UINT cEntries, + LPPALETTEENTRY ppe) +{ + return NtGdiDoPalette(hpal, iStartIndex, cEntries, ppe, GdiPalGetEntries, FALSE); +} + +UINT +WINAPI +SetPaletteEntries(HPALETTE hpal, + UINT iStartIndex, + UINT cEntries, + const PALETTEENTRY *ppe) +{ + return NtGdiDoPalette(hpal, iStartIndex, cEntries, (PALETTEENTRY*)ppe, GdiPalSetEntries, TRUE); +} + +UINT +WINAPI +GetSystemPaletteEntries(HDC hDC, + UINT iStartIndex, + UINT cEntries, + LPPALETTEENTRY ppe) +{ + return NtGdiDoPalette(hDC, iStartIndex, cEntries, ppe, GdiPalGetSystemEntries, FALSE); +} + +UINT +WINAPI +GetDIBColorTable(HDC hDC, + UINT iStartIndex, + UINT cEntries, + RGBQUAD *pColors) +{ + return NtGdiDoPalette(hDC, iStartIndex, cEntries, pColors, GdiPalGetColorTable, FALSE); +} + +UINT +WINAPI +SetDIBColorTable(HDC hDC, + UINT iStartIndex, + UINT cEntries, + const RGBQUAD *pColors) +{ + return NtGdiDoPalette(hDC, iStartIndex, cEntries, (RGBQUAD*)pColors, GdiPalSetColorTable, TRUE); +} + +/* EOF */
Modified: trunk/reactos/include/psdk/ntgdi.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/ntgdi.h?rev=28... ============================================================================== --- trunk/reactos/include/psdk/ntgdi.h (original) +++ trunk/reactos/include/psdk/ntgdi.h Thu Aug 23 04:31:26 2007 @@ -385,10 +385,10 @@ LONG APIENTRY NtGdiDoPalette( - IN HPALETTE hpal, + IN HGDIOBJ hObj, IN WORD iStart, IN WORD cEntries, - IN PALETTEENTRY *pPalEntries, + IN LPVOID pEntries, IN DWORD iFunc, IN BOOL bInbound );
Modified: trunk/reactos/include/reactos/win32k/ntgdibad.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/win32k/ntgd... ============================================================================== --- trunk/reactos/include/reactos/win32k/ntgdibad.h (original) +++ trunk/reactos/include/reactos/win32k/ntgdibad.h Thu Aug 23 04:31:26 2007 @@ -103,16 +103,6 @@ NtGdiAddFontResource(PUNICODE_STRING Filename, DWORD fl);
-/* Use NtGdiDoPalette with GdiPalAnimate */ -BOOL -STDCALL -NtGdiAnimatePalette ( - HPALETTE hpal, - UINT StartIndex, - UINT Entries, - CONST PPALETTEENTRY ppe - ); - /* Metafiles are user mode */ HENHMETAFILE STDCALL @@ -307,16 +297,6 @@ /* Use NtGdiGetDCPoint with GdiGetDCOrg. */ BOOL STDCALL NtGdiGetDCOrgEx(HDC hDC, LPPOINT Point);
-/* Use NtGdiDoPalette with GdiPalGetColorTable. */ -UINT -STDCALL -NtGdiGetDIBColorTable ( - HDC hDC, - UINT StartIndex, - UINT Entries, - RGBQUAD * Colors - ); - /* Meta are user-mode. */ HENHMETAFILE STDCALL @@ -394,16 +374,6 @@ /* Should be done in user-mode using shared GDI Objects. */ INT STDCALL NtGdiGetMapMode(HDC hDC);
-/* Use NtGdiDoPalette with GdiPalGetEntries. */ -UINT -STDCALL -NtGdiGetPaletteEntries ( - HPALETTE hpal, - UINT StartIndex, - UINT Entries, - LPPALETTEENTRY pe - ); - /* Should be done in user-mode using shared GDI Objects. */ INT STDCALL @@ -417,16 +387,6 @@
/* Should be done in user-mode using shared GDI Objects. */ INT STDCALL NtGdiGetStretchBltMode(HDC hDC); - -/* Use NtGdiDoPalette with GdiPalSetSystemEntries. */ -UINT -STDCALL -NtGdiGetSystemPaletteEntries ( - HDC hDC, - UINT StartIndex, - UINT Entries, - LPPALETTEENTRY pe - );
/* Should be done in user-mode using shared GDI Objects. */ UINT STDCALL NtGdiGetTextAlign(HDC hDC); @@ -582,16 +542,6 @@
/* Needs to be done in user-mode, using shared GDI Object Attributes. */ INT STDCALL NtGdiSetBkMode(HDC hDC, INT backgroundMode); - -/* Use NtGdiDoPalette with GdiPalSetColorTable, TRUE. */ -UINT -STDCALL -NtGdiSetDIBColorTable ( - HDC hDC, - UINT StartIndex, - UINT Entries, - CONST RGBQUAD * Colors - );
/* Use SetDIBitsToDevice in gdi32. */ INT @@ -633,17 +583,6 @@ STDCALL NtGdiSetMapperFlags(HDC hDC, DWORD Flag); - - -/* Use NtGdiDoPalette with GdiPalSetEntries, TRUE. */ -UINT -STDCALL -NtGdiSetPaletteEntries ( - HPALETTE hpal, - UINT Start, - UINT Entries, - CONST LPPALETTEENTRY pe - );
/* Use NtGdiSetPixel(hdc, x, y, color) != CLR_INVALID; */ BOOL
Modified: trunk/reactos/subsystems/win32/win32k/include/intgdi.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/inc... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/include/intgdi.h (original) +++ trunk/reactos/subsystems/win32/win32k/include/intgdi.h Thu Aug 23 04:31:26 2007 @@ -271,5 +271,36 @@
LONG STDCALL IntGetBitmapBits(PBITMAPOBJ bmp, DWORD Bytes, OUT PBYTE Bits);
+UINT STDCALL IntSetDIBColorTable(HDC hDC, UINT StartIndex, UINT Entries, CONST RGBQUAD *Colors); + +UINT STDCALL IntGetDIBColorTable(HDC hDC, UINT StartIndex, UINT Entries, RGBQUAD *Colors); + +UINT STDCALL +IntAnimatePalette(HPALETTE hPal, UINT StartIndex, + UINT NumEntries, CONST PPALETTEENTRY PaletteColors); + +UINT STDCALL +IntGetPaletteEntries(HPALETTE hpal, + UINT StartIndex, + UINT Entries, + LPPALETTEENTRY pe); + +UINT STDCALL +IntSetPaletteEntries(HPALETTE hpal, + UINT Start, + UINT Entries, + CONST LPPALETTEENTRY pe); + +UINT STDCALL +IntGetSystemPaletteEntries(HDC hDC, + UINT StartIndex, + UINT Entries, + LPPALETTEENTRY pe); +UINT STDCALL +IntGetDIBColorTable(HDC hDC, UINT StartIndex, UINT Entries, RGBQUAD *Colors); + +UINT STDCALL +IntSetDIBColorTable(HDC hDC, UINT StartIndex, UINT Entries, CONST RGBQUAD *Colors); + #endif /* _WIN32K_INTGDI_H */
Modified: trunk/reactos/subsystems/win32/win32k/objects/color.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/obj... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/objects/color.c (original) +++ trunk/reactos/subsystems/win32/win32k/objects/color.c Thu Aug 23 04:31:26 2007 @@ -74,16 +74,21 @@ return (const PALETTEENTRY*)&COLOR_sysPalTemplate; }
-BOOL STDCALL NtGdiAnimatePalette(HPALETTE hPal, UINT StartIndex, - UINT NumEntries, CONST PPALETTEENTRY PaletteColors) -{ +UINT STDCALL +IntAnimatePalette(HPALETTE hPal, + UINT StartIndex, + UINT NumEntries, + CONST PPALETTEENTRY PaletteColors) +{ + UINT ret = 0; + if( hPal != NtGdiGetStockObject(DEFAULT_PALETTE) ) { PPALGDI palPtr; UINT pal_entries; HDC hDC; PDC dc; - PWINDOW_OBJECT Wnd; + PWINDOW_OBJECT Wnd; const PALETTEENTRY *pptr = PaletteColors;
palPtr = (PPALGDI)PALETTE_LockPalette(hPal); @@ -92,39 +97,42 @@ pal_entries = palPtr->NumColors; if (StartIndex >= pal_entries) { - PALETTE_UnlockPalette(palPtr); - return FALSE; + PALETTE_UnlockPalette(palPtr); + return FALSE; } if (StartIndex+NumEntries > pal_entries) NumEntries = pal_entries - StartIndex;
- for (NumEntries += StartIndex; StartIndex < NumEntries; StartIndex++, pptr++) { - /* According to MSDN, only animate PC_RESERVED colours */ - if (palPtr->IndexedColors[StartIndex].peFlags & PC_RESERVED) { - memcpy( &palPtr->IndexedColors[StartIndex], pptr, - sizeof(PALETTEENTRY) ); - PALETTE_ValidateFlags(&palPtr->IndexedColors[StartIndex], 1); - } + for (NumEntries += StartIndex; StartIndex < NumEntries; StartIndex++, pptr++) + { + /* According to MSDN, only animate PC_RESERVED colours */ + if (palPtr->IndexedColors[StartIndex].peFlags & PC_RESERVED) + { + memcpy( &palPtr->IndexedColors[StartIndex], pptr, + sizeof(PALETTEENTRY) ); + ret++; + PALETTE_ValidateFlags(&palPtr->IndexedColors[StartIndex], 1); + } }
PALETTE_UnlockPalette(palPtr);
/* Immediately apply the new palette if current window uses it */ - Wnd = UserGetDesktopWindow(); + Wnd = UserGetDesktopWindow(); hDC = (HDC)UserGetWindowDC(Wnd); dc = DC_LockDc(hDC); if (NULL != dc) { - if (dc->w.hPalette == hPal) - { - DC_UnlockDc(dc); - NtGdiRealizePalette(hDC); - } - else - DC_UnlockDc(dc); + if (dc->w.hPalette == hPal) + { + DC_UnlockDc(dc); + NtGdiRealizePalette(hDC); + } + else + DC_UnlockDc(dc); } - UserReleaseDC(Wnd,hDC, FALSE); - } - return TRUE; + UserReleaseDC(Wnd,hDC, FALSE); + } + return ret; }
HPALETTE STDCALL NtGdiCreateHalftonePalette(HDC hDC) @@ -138,7 +146,7 @@
Palette.Version = 0x300; Palette.NumberOfEntries = 256; - if (NtGdiGetSystemPaletteEntries(hDC, 0, 256, Palette.aEntries) == 0) + if (IntGetSystemPaletteEntries(hDC, 0, 256, Palette.aEntries) == 0) { /* from wine, more that 256 color math */ Palette.NumberOfEntries = 20; @@ -337,50 +345,56 @@ return index; }
-UINT STDCALL NtGdiGetPaletteEntries(HPALETTE hpal, - UINT StartIndex, - UINT Entries, - LPPALETTEENTRY pe) -{ - PPALGDI palGDI; - UINT numEntries; - - palGDI = (PPALGDI) PALETTE_LockPalette(hpal); - if (NULL == palGDI) - { - return 0; - } - - numEntries = palGDI->NumColors; - if (numEntries < StartIndex + Entries) - { - Entries = numEntries - StartIndex; - } - if (NULL != pe) - { - if (numEntries <= StartIndex) - { - PALETTE_UnlockPalette(palGDI); - return 0; - } - memcpy(pe, palGDI->IndexedColors + StartIndex, Entries * sizeof(PALETTEENTRY)); - for (numEntries = 0; numEntries < Entries; numEntries++) - { - if (pe[numEntries].peFlags & 0xF0) - { - pe[numEntries].peFlags = 0; - } - } - } - - PALETTE_UnlockPalette(palGDI); - return Entries; -} - -UINT STDCALL NtGdiGetSystemPaletteEntries(HDC hDC, - UINT StartIndex, - UINT Entries, - LPPALETTEENTRY pe) +UINT STDCALL +IntGetPaletteEntries(HPALETTE hpal, + UINT StartIndex, + UINT Entries, + LPPALETTEENTRY pe) +{ + PPALGDI palGDI; + UINT numEntries; + + palGDI = (PPALGDI) PALETTE_LockPalette(hpal); + if (NULL == palGDI) + { + return 0; + } + + numEntries = palGDI->NumColors; + if (NULL != pe) + { + if (numEntries < StartIndex + Entries) + { + Entries = numEntries - StartIndex; + } + if (numEntries <= StartIndex) + { + PALETTE_UnlockPalette(palGDI); + return 0; + } + memcpy(pe, palGDI->IndexedColors + StartIndex, Entries * sizeof(PALETTEENTRY)); + for (numEntries = 0; numEntries < Entries; numEntries++) + { + if (pe[numEntries].peFlags & 0xF0) + { + pe[numEntries].peFlags = 0; + } + } + } + else + { + Entries = numEntries; + } + + PALETTE_UnlockPalette(palGDI); + return Entries; +} + +UINT STDCALL +IntGetSystemPaletteEntries(HDC hDC, + UINT StartIndex, + UINT Entries, + LPPALETTEENTRY pe) { PPALGDI palGDI = NULL; PDC dc = NULL; @@ -393,58 +407,46 @@ return 0; }
- _SEH_TRY + if (pe != NULL) + { + EntriesSize = Entries * sizeof(pe[0]); + if (Entries != EntriesSize / sizeof(pe[0])) + { + /* Integer overflow! */ + SetLastWin32Error(ERROR_INVALID_PARAMETER); + return 0; + } + } + + if (!(dc = DC_LockDc(hDC))) + { + SetLastWin32Error(ERROR_INVALID_HANDLE); + return 0; + } + + palGDI = PALETTE_LockPalette(dc->w.hPalette); + if (palGDI != NULL) { if (pe != NULL) { - EntriesSize = Entries * sizeof(pe[0]); - if (Entries != EntriesSize / sizeof(pe[0])) - { - /* Integer overflow! */ - SetLastWin32Error(ERROR_INVALID_PARAMETER); - _SEH_LEAVE; - } - - ProbeForWrite(pe, - EntriesSize, - sizeof(UINT)); - } - - if (!(dc = DC_LockDc(hDC))) - { - SetLastWin32Error(ERROR_INVALID_HANDLE); - _SEH_LEAVE; - } - - palGDI = PALETTE_LockPalette(dc->w.hPalette); - if (palGDI != NULL) - { - if (pe != NULL) - { - UINT CopyEntries; - - if (StartIndex + Entries < palGDI->NumColors) - CopyEntries = StartIndex + Entries; - else - CopyEntries = palGDI->NumColors - StartIndex; - - memcpy(pe, - palGDI->IndexedColors + StartIndex, - CopyEntries * sizeof(pe[0])); - - Ret = CopyEntries; - } + UINT CopyEntries; + + if (StartIndex + Entries < palGDI->NumColors) + CopyEntries = StartIndex + Entries; else - { - Ret = dc->GDIInfo->ulNumPalReg; - } - } - } - _SEH_HANDLE - { - SetLastNtError(_SEH_GetExceptionCode()); - } - _SEH_END; + CopyEntries = palGDI->NumColors - StartIndex; + + memcpy(pe, + palGDI->IndexedColors + StartIndex, + CopyEntries * sizeof(pe[0])); + + Ret = CopyEntries; + } + else + { + Ret = dc->GDIInfo->ulNumPalReg; + } + }
if (palGDI != NULL) PALETTE_UnlockPalette(palGDI); @@ -624,34 +626,40 @@ return FALSE; }
-UINT STDCALL NtGdiSetPaletteEntries(HPALETTE hpal, - UINT Start, - UINT Entries, - CONST LPPALETTEENTRY pe) -{ - PPALGDI palGDI; - WORD numEntries; - - palGDI = PALETTE_LockPalette(hpal); - if (!palGDI) return 0; - - numEntries = palGDI->NumColors; - if (Start >= numEntries) - { - PALETTE_UnlockPalette(palGDI); - return 0; - } - if (numEntries < Start + Entries) - { - Entries = numEntries - Start; - } - memcpy(palGDI->IndexedColors + Start, pe, Entries * sizeof(PALETTEENTRY)); - PALETTE_ValidateFlags(palGDI->IndexedColors, palGDI->NumColors); - ExFreePool(palGDI->logicalToSystem); - palGDI->logicalToSystem = NULL; - PALETTE_UnlockPalette(palGDI); - - return Entries; +UINT STDCALL +IntSetPaletteEntries(HPALETTE hpal, + UINT Start, + UINT Entries, + CONST LPPALETTEENTRY pe) +{ + PPALGDI palGDI; + WORD numEntries; + + if ((UINT)hpal & GDI_HANDLE_STOCK_MASK) + { + return 0; + } + + palGDI = PALETTE_LockPalette(hpal); + if (!palGDI) return 0; + + numEntries = palGDI->NumColors; + if (Start >= numEntries) + { + PALETTE_UnlockPalette(palGDI); + return 0; + } + if (numEntries < Start + Entries) + { + Entries = numEntries - Start; + } + memcpy(palGDI->IndexedColors + Start, pe, Entries * sizeof(PALETTEENTRY)); + PALETTE_ValidateFlags(palGDI->IndexedColors, palGDI->NumColors); + ExFreePool(palGDI->logicalToSystem); + palGDI->logicalToSystem = NULL; + PALETTE_UnlockPalette(palGDI); + + return Entries; }
UINT STDCALL @@ -816,4 +824,83 @@ } return -1; } + + +W32KAPI +LONG +APIENTRY +NtGdiDoPalette( + IN HGDIOBJ hObj, + IN WORD iStart, + IN WORD cEntries, + IN LPVOID pUnsafeEntries, + IN DWORD iFunc, + IN BOOL bInbound) +{ + LONG ret; + + /* FIXME: Handle bInbound correctly */ + + if (bInbound && + (pUnsafeEntries == NULL || cEntries == 0)) + { + return 0; + } + + _SEH_TRY + { + switch(iFunc) + { + case GdiPalAnimate: + ProbeForRead(pUnsafeEntries, cEntries * sizeof(PALETTEENTRY), 1); + ret = IntAnimatePalette((HPALETTE)hObj, iStart, cEntries, pUnsafeEntries); + break; + + case GdiPalSetEntries: + ProbeForRead(pUnsafeEntries, cEntries * sizeof(PALETTEENTRY), 1); + ret = IntSetPaletteEntries((HPALETTE)hObj, iStart, cEntries, pUnsafeEntries); + break; + + case GdiPalGetEntries: + if (pUnsafeEntries) + { + ProbeForWrite(pUnsafeEntries, cEntries * sizeof(PALETTEENTRY), 1); + } + ret = IntGetPaletteEntries((HPALETTE)hObj, iStart, cEntries, pUnsafeEntries); + break; + + case GdiPalGetSystemEntries: + if (pUnsafeEntries) + { + ProbeForWrite(pUnsafeEntries, cEntries * sizeof(PALETTEENTRY), 1); + } + ret = IntGetSystemPaletteEntries((HDC)hObj, iStart, cEntries, pUnsafeEntries); + break; + + case GdiPalSetColorTable: + ProbeForRead(pUnsafeEntries, cEntries * sizeof(PALETTEENTRY), 1); + ret = IntSetDIBColorTable((HDC)hObj, iStart, cEntries, (RGBQUAD*)pUnsafeEntries); + break; + + case GdiPalGetColorTable: + if (pUnsafeEntries) + { + ProbeForWrite(pUnsafeEntries, cEntries * sizeof(PALETTEENTRY), 1); + } + ret = IntGetDIBColorTable((HDC)hObj, iStart, cEntries, (RGBQUAD*)pUnsafeEntries); + break; + + default: + ret = 0; + } + } + _SEH_HANDLE + { + ret = 0; + } + _SEH_END + + return ret; +} + /* EOF */
Modified: trunk/reactos/subsystems/win32/win32k/objects/dibobj.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/obj... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/objects/dibobj.c (original) +++ trunk/reactos/subsystems/win32/win32k/objects/dibobj.c Thu Aug 23 04:31:26 2007 @@ -25,7 +25,7 @@ #include <debug.h>
UINT STDCALL -NtGdiSetDIBColorTable(HDC hDC, UINT StartIndex, UINT Entries, CONST RGBQUAD *Colors) +IntSetDIBColorTable(HDC hDC, UINT StartIndex, UINT Entries, CONST RGBQUAD *Colors) { PDC dc; PBITMAPOBJ BitmapObj; @@ -62,22 +62,15 @@ Entries = (1 << BitmapObj->dib->dsBmih.biBitCount) - StartIndex;
PalGDI = PALETTE_LockPalette(BitmapObj->hDIBPalette); - _SEH_TRY + + for (Index = StartIndex; + Index < StartIndex + Entries && Index < PalGDI->NumColors; + Index++) { - for (Index = StartIndex; - Index < StartIndex + Entries && Index < PalGDI->NumColors; - Index++) - { - PalGDI->IndexedColors[Index].peRed = Colors[Index - StartIndex].rgbRed; - PalGDI->IndexedColors[Index].peGreen = Colors[Index - StartIndex].rgbGreen; - PalGDI->IndexedColors[Index].peBlue = Colors[Index - StartIndex].rgbBlue; - } + PalGDI->IndexedColors[Index].peRed = Colors[Index - StartIndex].rgbRed; + PalGDI->IndexedColors[Index].peGreen = Colors[Index - StartIndex].rgbGreen; + PalGDI->IndexedColors[Index].peBlue = Colors[Index - StartIndex].rgbBlue; } - _SEH_HANDLE - { - Entries = 0; - } - _SEH_END PALETTE_UnlockPalette(PalGDI); } else @@ -90,7 +83,7 @@ }
UINT STDCALL -NtGdiGetDIBColorTable(HDC hDC, UINT StartIndex, UINT Entries, RGBQUAD *Colors) +IntGetDIBColorTable(HDC hDC, UINT StartIndex, UINT Entries, RGBQUAD *Colors) { PDC dc; PBITMAPOBJ BitmapObj; @@ -127,22 +120,15 @@ Entries = (1 << BitmapObj->dib->dsBmih.biBitCount) - StartIndex;
PalGDI = PALETTE_LockPalette(BitmapObj->hDIBPalette); - _SEH_TRY + + for (Index = StartIndex; + Index < StartIndex + Entries && Index < PalGDI->NumColors; + Index++) { - for (Index = StartIndex; - Index < StartIndex + Entries && Index < PalGDI->NumColors; - Index++) - { - Colors[Index - StartIndex].rgbRed = PalGDI->IndexedColors[Index].peRed; - Colors[Index - StartIndex].rgbGreen = PalGDI->IndexedColors[Index].peGreen; - Colors[Index - StartIndex].rgbBlue = PalGDI->IndexedColors[Index].peBlue; - } + Colors[Index - StartIndex].rgbRed = PalGDI->IndexedColors[Index].peRed; + Colors[Index - StartIndex].rgbGreen = PalGDI->IndexedColors[Index].peGreen; + Colors[Index - StartIndex].rgbBlue = PalGDI->IndexedColors[Index].peBlue; } - _SEH_HANDLE - { - Entries = 0; - } - _SEH_END PALETTE_UnlockPalette(PalGDI); } else
Modified: trunk/reactos/subsystems/win32/win32k/w32ksvc.db URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/w32... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/w32ksvc.db (original) +++ trunk/reactos/subsystems/win32/win32k/w32ksvc.db Thu Aug 23 04:31:26 2007 @@ -132,7 +132,7 @@ NtGdiDescribePixelFormat 4 # NtGdiGetPerBandInfo 2 # NtGdiDoBanding 4 -# NtGdiDoPalette 6 +NtGdiDoPalette 6 NtGdiDrawEscape 4 NtGdiEllipse 5 # NtGdiEnableEudc 1 @@ -513,7 +513,7 @@ # NtUserSetAppImeLevel 2 NtUserSetCapture 1 NtUserSetClassLong 4 -# NtUserSetClassWord 1 Wrong number of param ? +NtUserSetClassWord 3 NtUserSetClipboardData 3 NtUserSetClipboardViewer 1 NtUserSetConsoleReserveKeys 2 @@ -558,7 +558,7 @@ NtUserSetWindowsHookEx 6 NtUserSetWindowStationUser 4 NtUserSetWindowWord 3 -# NtUserSetWinEventHook 4 Wrong number of param ? +NtUserSetWinEventHook 8 NtUserShowCaret 1 NtUserShowScrollBar 3 NtUserShowWindow 2 @@ -683,9 +683,7 @@ NtUserFindWindowEx 4 NtUserGetClassInfo 4 NtUserInitTask 11 -NtUserSetClassWord 3 NtUserSetCursorIconData 6 -NtUserSetWinEventHook 8 NtUserUnregisterClass 2 NtUserValidateHandleSecure 1 # @@ -693,13 +691,11 @@ NtGdiSelectObject 2 NtGdiSetBkColor 2 NtGdiSetBkMode 2 -NtGdiSetDIBColorTable 4 NtGdiSetDIBits 7 NtGdiSetEnhMetaFileBits 2 NtGdiSetGraphicsMode 2 NtGdiSetICMProfile 2 NtGdiSetMapperFlags 2 -NtGdiSetPaletteEntries 4 NtGdiSetPixelV 4 NtGdiSetPolyFillMode 2 NtGdiSetROP2 2 @@ -751,7 +747,6 @@ NtUserSetScrollBarInfo 3 NtUserGetDesktopWindow 0 NtGdiAddFontResource 2 -NtGdiAnimatePalette 4 NtGdiCloseEnhMetaFile 1 NtGdiColorMatchToTarget 3 NtGdiCopyEnhMetaFile 2 @@ -781,7 +776,6 @@ NtGdiGetColorSpace 1 NtGdiGetCurrentObject 2 NtGdiGetCurrentPositionEx 2 -NtGdiGetDIBColorTable 4 NtGdiGetEnhMetaFile 1 NtGdiGetEnhMetaFileBits 3 NtGdiGetEnhMetaFileDescription 3 @@ -794,12 +788,10 @@ NtGdiGetICMProfile 3 NtGdiGetLogColorSpace 3 NtGdiGetMapMode 1 -NtGdiGetPaletteEntries 4 NtGdiGetPixelFormat 1 NtGdiGetPolyFillMode 1 NtGdiGetROP2 1 NtGdiGetStretchBltMode 1 -NtGdiGetSystemPaletteEntries 4 NtGdiGetTextAlign 1 NtGdiGetTextColor 1 NtGdiGetTextExtentPoint32 4