[ros-diffs] [tkreuzer] 28459: - 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

tkreuzer at svn.reactos.org tkreuzer at svn.reactos.org
Thu Aug 23 02:31:27 CEST 2007


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?rev=28459&r1=28458&r2=28459&view=diff
==============================================================================
--- 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 at 4
 AddFontResourceTracking at 8
 AngleArc at 24
-AnimatePalette at 16=NtGdiAnimatePalette at 16
+AnimatePalette at 16
 AnyLinkedFonts at 0
 Arc at 36
 ArcTo at 36
@@ -368,7 +368,7 @@
 GetDCBrushColor at 4
 GetDCOrgEx at 8
 GetDCPenColor at 4
-GetDIBColorTable at 16=NtGdiGetDIBColorTable at 16
+GetDIBColorTable at 16
 GetDIBits at 28
 GetDeviceCaps at 8=NtGdiGetDeviceCaps at 8
 GetDeviceGammaRamp at 8
@@ -417,7 +417,7 @@
 GetObjectW at 12
 GetOutlineTextMetricsA at 12
 GetOutlineTextMetricsW at 12
-GetPaletteEntries at 16=NtGdiGetPaletteEntries at 16
+GetPaletteEntries at 16
 GetPath at 16
 GetPixel at 12=NtGdiGetPixel at 12
 GetPixelFormat at 4
@@ -432,7 +432,7 @@
 GetStretchBltMode at 4=NtGdiGetStretchBltMode at 4
 GetStringBitmapA at 20
 GetStringBitmapW at 20
-GetSystemPaletteEntries at 16=NtGdiGetSystemPaletteEntries at 16
+GetSystemPaletteEntries at 16
 GetSystemPaletteUse at 4
 GetTextAlign at 4=NtGdiGetTextAlign at 4
 GetTextCharacterExtra at 4
@@ -542,7 +542,7 @@
 SetColorSpace at 8
 SetDCBrushColor at 8
 SetDCPenColor at 8
-SetDIBColorTable at 16=NtGdiSetDIBColorTable at 16
+SetDIBColorTable at 16
 SetDIBits at 28=NtGdiSetDIBits at 28
 SetDIBitsToDevice at 48
 SetDeviceGammaRamp at 8
@@ -560,7 +560,7 @@
 SetMetaFileBitsEx at 8
 SetMetaRgn at 4
 SetMiterLimit at 12
-SetPaletteEntries at 16=NtGdiSetPaletteEntries at 16
+SetPaletteEntries at 16
 SetPixel at 16=NtGdiSetPixel at 16
 SetPixelFormat at 12
 SetPixelV at 16=NtGdiSetPixelV at 16

Modified: trunk/reactos/dll/win32/gdi32/gdi32.rbuild
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdi32/gdi32.rbuild?rev=28459&r1=28458&r2=28459&view=diff
==============================================================================
--- 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/palette.c?rev=28459&view=auto
==============================================================================
--- 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=28459&r1=28458&r2=28459&view=diff
==============================================================================
--- 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/ntgdibad.h?rev=28459&r1=28458&r2=28459&view=diff
==============================================================================
--- 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/include/intgdi.h?rev=28459&r1=28458&r2=28459&view=diff
==============================================================================
--- 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/objects/color.c?rev=28459&r1=28458&r2=28459&view=diff
==============================================================================
--- 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/objects/dibobj.c?rev=28459&r1=28458&r2=28459&view=diff
==============================================================================
--- 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/w32ksvc.db?rev=28459&r1=28458&r2=28459&view=diff
==============================================================================
--- 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




More information about the Ros-diffs mailing list