diff --git a/reactos/dll/win32/gdi32/gdi32.def b/reactos/dll/win32/gdi32/gdi32.def index bb189e2def7..9dc667a093c 100644 --- a/reactos/dll/win32/gdi32/gdi32.def +++ b/reactos/dll/win32/gdi32/gdi32.def @@ -17,7 +17,7 @@ AddFontResourceExW@12 AddFontResourceW@4 AddFontResourceTracking@8 AngleArc@24 -AnimatePalette@16=NtGdiAnimatePalette@16 +AnimatePalette@16 AnyLinkedFonts@0 Arc@36 ArcTo@36 @@ -368,7 +368,7 @@ GetCurrentPositionEx@8=NtGdiGetCurrentPositionEx@8 GetDCBrushColor@4 GetDCOrgEx@8 GetDCPenColor@4 -GetDIBColorTable@16=NtGdiGetDIBColorTable@16 +GetDIBColorTable@16 GetDIBits@28 GetDeviceCaps@8=NtGdiGetDeviceCaps@8 GetDeviceGammaRamp@8 @@ -417,7 +417,7 @@ GetObjectType@4 GetObjectW@12 GetOutlineTextMetricsA@12 GetOutlineTextMetricsW@12 -GetPaletteEntries@16=NtGdiGetPaletteEntries@16 +GetPaletteEntries@16 GetPath@16 GetPixel@12=NtGdiGetPixel@12 GetPixelFormat@4 @@ -432,7 +432,7 @@ GetStockObject@4 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 @@ SetColorAdjustment@8 SetColorSpace@8 SetDCBrushColor@8 SetDCPenColor@8 -SetDIBColorTable@16=NtGdiSetDIBColorTable@16 +SetDIBColorTable@16 SetDIBits@28=NtGdiSetDIBits@28 SetDIBitsToDevice@48 SetDeviceGammaRamp@8 @@ -560,7 +560,7 @@ SetMapperFlags@8 SetMetaFileBitsEx@8 SetMetaRgn@4 SetMiterLimit@12 -SetPaletteEntries@16=NtGdiSetPaletteEntries@16 +SetPaletteEntries@16 SetPixel@16=NtGdiSetPixel@16 SetPixelFormat@12 SetPixelV@16=NtGdiSetPixelV@16 diff --git a/reactos/dll/win32/gdi32/gdi32.rbuild b/reactos/dll/win32/gdi32/gdi32.rbuild index 442e808868f..1f660b7000a 100644 --- a/reactos/dll/win32/gdi32/gdi32.rbuild +++ b/reactos/dll/win32/gdi32/gdi32.rbuild @@ -37,6 +37,7 @@ linedda.c metafile.c painting.c + palette.c pen.c region.c text.c diff --git a/reactos/dll/win32/gdi32/objects/palette.c b/reactos/dll/win32/gdi32/objects/palette.c new file mode 100644 index 00000000000..7bdfd74dac6 --- /dev/null +++ b/reactos/dll/win32/gdi32/objects/palette.c @@ -0,0 +1,66 @@ +#include "precomp.h" + +#define NDEBUG +#include + +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 */ diff --git a/reactos/include/psdk/ntgdi.h b/reactos/include/psdk/ntgdi.h index bd90fe814a9..1afc9671e6a 100644 --- a/reactos/include/psdk/ntgdi.h +++ b/reactos/include/psdk/ntgdi.h @@ -385,10 +385,10 @@ W32KAPI 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 ); diff --git a/reactos/include/reactos/win32k/ntgdibad.h b/reactos/include/reactos/win32k/ntgdibad.h index b28090c6d9e..4828bab8fea 100644 --- a/reactos/include/reactos/win32k/ntgdibad.h +++ b/reactos/include/reactos/win32k/ntgdibad.h @@ -103,16 +103,6 @@ STDCALL 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 @@ BOOL STDCALL NtGdiGetCurrentPositionEx(HDC hDC, LPPOINT currentPosition); /* 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 @@ NtGdiGetLogColorSpace(HCOLORSPACE hColorSpace, /* 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 @@ -418,16 +388,6 @@ INT STDCALL NtGdiGetROP2(HDC hDC); /* 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); @@ -583,16 +543,6 @@ COLORREF STDCALL NtGdiSetBkColor (HDC hDC, COLORREF Color); /* 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 STDCALL @@ -634,17 +584,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 STDCALL diff --git a/reactos/subsystems/win32/win32k/include/intgdi.h b/reactos/subsystems/win32/win32k/include/intgdi.h index e93f9ccb699..0e493eaf443 100644 --- a/reactos/subsystems/win32/win32k/include/intgdi.h +++ b/reactos/subsystems/win32/win32k/include/intgdi.h @@ -271,5 +271,36 @@ LONG STDCALL IntSetBitmapBits(PBITMAPOBJ bmp, DWORD Bytes, IN PBYTE Bits); 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 */ diff --git a/reactos/subsystems/win32/win32k/objects/color.c b/reactos/subsystems/win32/win32k/objects/color.c index 7ad236bcdbc..431b3f1d8bf 100644 --- a/reactos/subsystems/win32/win32k/objects/color.c +++ b/reactos/subsystems/win32/win32k/objects/color.c @@ -74,16 +74,21 @@ const PALETTEENTRY* FASTCALL COLOR_GetSystemPaletteTemplate(void) 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 @@ BOOL STDCALL NtGdiAnimatePalette(HPALETTE hPal, UINT StartIndex, 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); + UserReleaseDC(Wnd,hDC, FALSE); } - return TRUE; + return ret; } HPALETTE STDCALL NtGdiCreateHalftonePalette(HDC hDC) @@ -138,7 +146,7 @@ HPALETTE STDCALL NtGdiCreateHalftonePalette(HDC hDC) 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 @@ UINT STDCALL NtGdiGetNearestPaletteIndex(HPALETTE hpal, return index; } -UINT STDCALL NtGdiGetPaletteEntries(HPALETTE hpal, - UINT StartIndex, - UINT Entries, - LPPALETTEENTRY pe) +UINT STDCALL +IntGetPaletteEntries(HPALETTE hpal, + UINT StartIndex, + UINT Entries, + LPPALETTEENTRY pe) { - PPALGDI palGDI; - UINT numEntries; + PPALGDI palGDI; + UINT numEntries; - palGDI = (PPALGDI) PALETTE_LockPalette(hpal); - if (NULL == palGDI) + palGDI = (PPALGDI) PALETTE_LockPalette(hpal); + if (NULL == palGDI) { - return 0; + return 0; } - numEntries = palGDI->NumColors; - if (numEntries < StartIndex + Entries) + numEntries = palGDI->NumColors; + if (NULL != pe) { - Entries = numEntries - StartIndex; + 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; + } + } } - if (NULL != pe) + else { - 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; - } - } + Entries = numEntries; } - PALETTE_UnlockPalette(palGDI); - return Entries; + PALETTE_UnlockPalette(palGDI); + return Entries; } -UINT STDCALL NtGdiGetSystemPaletteEntries(HDC hDC, - UINT StartIndex, - UINT Entries, - LPPALETTEENTRY pe) +UINT STDCALL +IntGetSystemPaletteEntries(HDC hDC, + UINT StartIndex, + UINT Entries, + LPPALETTEENTRY pe) { PPALGDI palGDI = NULL; PDC dc = NULL; @@ -393,58 +407,46 @@ UINT STDCALL NtGdiGetSystemPaletteEntries(HDC hDC, 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; - } + UINT CopyEntries; - 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; - } + if (StartIndex + Entries < palGDI->NumColors) + CopyEntries = StartIndex + Entries; else - { - Ret = dc->GDIInfo->ulNumPalReg; - } + CopyEntries = palGDI->NumColors - StartIndex; + + memcpy(pe, + palGDI->IndexedColors + StartIndex, + CopyEntries * sizeof(pe[0])); + + Ret = CopyEntries; + } + else + { + Ret = dc->GDIInfo->ulNumPalReg; } } - _SEH_HANDLE - { - SetLastNtError(_SEH_GetExceptionCode()); - } - _SEH_END; if (palGDI != NULL) PALETTE_UnlockPalette(palGDI); @@ -624,34 +626,40 @@ BOOL STDCALL NtGdiSetColorAdjustment(HDC hDC, return FALSE; } -UINT STDCALL NtGdiSetPaletteEntries(HPALETTE hpal, - UINT Start, - UINT Entries, - CONST LPPALETTEENTRY pe) +UINT STDCALL +IntSetPaletteEntries(HPALETTE hpal, + UINT Start, + UINT Entries, + CONST LPPALETTEENTRY pe) { - PPALGDI palGDI; - WORD numEntries; + PPALGDI palGDI; + WORD numEntries; - palGDI = PALETTE_LockPalette(hpal); - if (!palGDI) return 0; - - numEntries = palGDI->NumColors; - if (Start >= numEntries) + if ((UINT)hpal & GDI_HANDLE_STOCK_MASK) { - PALETTE_UnlockPalette(palGDI); - return 0; + 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; + 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 @@ int STDCALL COLOR_PaletteLookupExactIndex( PALETTEENTRY* palPalEntry, int size, } 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 */ diff --git a/reactos/subsystems/win32/win32k/objects/dibobj.c b/reactos/subsystems/win32/win32k/objects/dibobj.c index 9a7d8cfa6e9..1a319595116 100644 --- a/reactos/subsystems/win32/win32k/objects/dibobj.c +++ b/reactos/subsystems/win32/win32k/objects/dibobj.c @@ -25,7 +25,7 @@ #include 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 @@ NtGdiSetDIBColorTable(HDC hDC, UINT StartIndex, UINT Entries, CONST RGBQUAD *Col 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 @@ NtGdiSetDIBColorTable(HDC hDC, UINT StartIndex, UINT Entries, CONST RGBQUAD *Col } 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 @@ NtGdiGetDIBColorTable(HDC hDC, UINT StartIndex, UINT Entries, RGBQUAD *Colors) 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 diff --git a/reactos/subsystems/win32/win32k/w32ksvc.db b/reactos/subsystems/win32/win32k/w32ksvc.db index 1bf0cfb97f5..2a1e35df880 100644 --- a/reactos/subsystems/win32/win32k/w32ksvc.db +++ b/reactos/subsystems/win32/win32k/w32ksvc.db @@ -132,7 +132,7 @@ NtGdiDeleteObjectApp 1 NtGdiDescribePixelFormat 4 # NtGdiGetPerBandInfo 2 # NtGdiDoBanding 4 -# NtGdiDoPalette 6 +NtGdiDoPalette 6 NtGdiDrawEscape 4 NtGdiEllipse 5 # NtGdiEnableEudc 1 @@ -513,7 +513,7 @@ NtUserSetActiveWindow 1 # NtUserSetAppImeLevel 2 NtUserSetCapture 1 NtUserSetClassLong 4 -# NtUserSetClassWord 1 Wrong number of param ? +NtUserSetClassWord 3 NtUserSetClipboardData 3 NtUserSetClipboardViewer 1 NtUserSetConsoleReserveKeys 2 @@ -558,7 +558,7 @@ NtUserSetWindowsHookAW 3 NtUserSetWindowsHookEx 6 NtUserSetWindowStationUser 4 NtUserSetWindowWord 3 -# NtUserSetWinEventHook 4 Wrong number of param ? +NtUserSetWinEventHook 8 NtUserShowCaret 1 NtUserShowScrollBar 3 NtUserShowWindow 2 @@ -683,9 +683,7 @@ NtUserFindExistingCursorIcon 4 NtUserFindWindowEx 4 NtUserGetClassInfo 4 NtUserInitTask 11 -NtUserSetClassWord 3 NtUserSetCursorIconData 6 -NtUserSetWinEventHook 8 NtUserUnregisterClass 2 NtUserValidateHandleSecure 1 # @@ -693,13 +691,11 @@ NtUserValidateHandleSecure 1 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 @@ NtUserSetCursorIconContents 2 NtUserSetScrollBarInfo 3 NtUserGetDesktopWindow 0 NtGdiAddFontResource 2 -NtGdiAnimatePalette 4 NtGdiCloseEnhMetaFile 1 NtGdiColorMatchToTarget 3 NtGdiCopyEnhMetaFile 2 @@ -781,7 +776,6 @@ NtGdiGetClipBox 2 NtGdiGetColorSpace 1 NtGdiGetCurrentObject 2 NtGdiGetCurrentPositionEx 2 -NtGdiGetDIBColorTable 4 NtGdiGetEnhMetaFile 1 NtGdiGetEnhMetaFileBits 3 NtGdiGetEnhMetaFileDescription 3 @@ -794,12 +788,10 @@ NtGdiGetGraphicsMode 1 NtGdiGetICMProfile 3 NtGdiGetLogColorSpace 3 NtGdiGetMapMode 1 -NtGdiGetPaletteEntries 4 NtGdiGetPixelFormat 1 NtGdiGetPolyFillMode 1 NtGdiGetROP2 1 NtGdiGetStretchBltMode 1 -NtGdiGetSystemPaletteEntries 4 NtGdiGetTextAlign 1 NtGdiGetTextColor 1 NtGdiGetTextExtentPoint32 4