Author: jimtabor Date: Sat Apr 21 01:21:15 2007 New Revision: 26439
URL: http://svn.reactos.org/svn/reactos?rev=26439&view=rev Log: Implement GdiFixUpHandle, fix handle masking and entry indexing.
Modified: trunk/reactos/dll/win32/gdi32/include/gdi32p.h trunk/reactos/dll/win32/gdi32/misc/misc.c trunk/reactos/include/reactos/win32k/ntgdihdl.h
Modified: trunk/reactos/dll/win32/gdi32/include/gdi32p.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdi32/include/gdi... ============================================================================== --- trunk/reactos/dll/win32/gdi32/include/gdi32p.h (original) +++ trunk/reactos/dll/win32/gdi32/include/gdi32p.h Sat Apr 21 01:21:15 2007 @@ -114,6 +114,10 @@ PLDC GdiGetLDC(HDC hDC);
+HGDIOBJ +STDCALL +GdiFixUpHandle(HGDIOBJ hGO); + BOOL WINAPI CalculateColorTableSize(
Modified: trunk/reactos/dll/win32/gdi32/misc/misc.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdi32/misc/misc.c... ============================================================================== --- trunk/reactos/dll/win32/gdi32/misc/misc.c (original) +++ trunk/reactos/dll/win32/gdi32/misc/misc.c Sat Apr 21 01:21:15 2007 @@ -32,6 +32,20 @@ HANDLE CurrentProcessId = NULL; DWORD GDI_BatchLimit = 1;
+ +/* + * @implemented + */ +HGDIOBJ +STDCALL +GdiFixUpHandle(HGDIOBJ hGdiObj) +{ + if (((ULONG_PTR)(hGdiObj)) & GDI_HANDLE_UPPER_MASK ) return hGdiObj; + PGDI_TABLE_ENTRY Entry = GdiHandleTable + GDI_HANDLE_TO_ENTRY(hGdiObj); + return hGdiObj = (HGDIOBJ)(((LONG_PTR)(hGdiObj)) | + (Entry->Type << 16)); // Rebuild handle for Object +} + /* * @implemented */ @@ -44,7 +58,7 @@
BOOL GdiIsHandleValid(HGDIOBJ hGdiObj) { - PGDI_TABLE_ENTRY Entry = GdiHandleTable + GDI_HANDLE_GET_INDEX(hGdiObj); + PGDI_TABLE_ENTRY Entry = GdiHandleTable + GDI_HANDLE_TO_ENTRY(hGdiObj); if(Entry->KernelData != NULL && (Entry->Type & GDI_HANDLE_TYPE_MASK) == (LONG)GDI_HANDLE_GET_TYPE(hGdiObj)) { HANDLE pid = (HANDLE)((ULONG_PTR)Entry->ProcessId & ~0x1); @@ -58,7 +72,7 @@
BOOL GdiGetHandleUserData(HGDIOBJ hGdiObj, PVOID *UserData) { - PGDI_TABLE_ENTRY Entry = GdiHandleTable + GDI_HANDLE_GET_INDEX(hGdiObj); + PGDI_TABLE_ENTRY Entry = GdiHandleTable + GDI_HANDLE_TO_ENTRY(hGdiObj); if(Entry->KernelData != NULL && (Entry->Type & GDI_HANDLE_TYPE_MASK) == (LONG)GDI_HANDLE_GET_TYPE(hGdiObj)) { HANDLE pid = (HANDLE)((ULONG_PTR)Entry->ProcessId & ~0x1); @@ -103,3 +117,5 @@ { return GDI_BatchLimit; } + +
Modified: trunk/reactos/include/reactos/win32k/ntgdihdl.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/win32k/ntgd... ============================================================================== --- trunk/reactos/include/reactos/win32k/ntgdihdl.h (original) +++ trunk/reactos/include/reactos/win32k/ntgdihdl.h Sat Apr 21 01:21:15 2007 @@ -25,6 +25,7 @@ #define GDI_HANDLE_TYPE_MASK 0x007f0000 #define GDI_HANDLE_STOCK_MASK 0x00800000 #define GDI_HANDLE_REUSE_MASK 0xff000000 +#define GDI_HANDLE_UPPER_MASK (GDI_HANDLE_TYPE_MASK|GDI_HANDLE_STOCK_MASK|GDI_HANDLE_REUSE_MASK) #define GDI_HANDLE_REUSECNT_SHIFT 24
/*! \defgroup GDI object types @@ -106,6 +107,11 @@ PVOID UserData; /* Points to the user mode structure, usually NULL though */ } GDI_TABLE_ENTRY, *PGDI_TABLE_ENTRY;
+ +#define GDI_HANDLE_TO_ENTRY(h) \ + ((((ULONG_PTR)(h)) & GDI_HANDLE_INDEX_MASK) * sizeof(GDI_TABLE_ENTRY)) + + typedef struct _RGNATTR { ULONG AttrFlags;