Author: gadamopoulos Date: Sat Jan 8 08:57:15 2011 New Revision: 50317
URL: http://svn.reactos.org/svn/reactos?rev=50317&view=rev Log: [winent] - Move implementation of handle mapping to user mode.
[win32k] - Remove handle mappings from win32k. Now win32k manages only its own handles
Modified: branches/arwinss/reactos/dll/win32/winent.drv/dib.c branches/arwinss/reactos/dll/win32/winent.drv/gdidrv.c branches/arwinss/reactos/dll/win32/winent.drv/main.c branches/arwinss/reactos/dll/win32/winent.drv/mouse.c branches/arwinss/reactos/dll/win32/winent.drv/winent.h branches/arwinss/reactos/include/reactos/wine/ntrosgdi.h branches/arwinss/reactos/subsystems/win32/win32k/gdi/bitmap.c branches/arwinss/reactos/subsystems/win32/win32k/gdi/dc.c branches/arwinss/reactos/subsystems/win32/win32k/gre/gdiobj.c branches/arwinss/reactos/subsystems/win32/win32k/main/cursor.c branches/arwinss/reactos/subsystems/win32/win32k/main/init.c branches/arwinss/reactos/subsystems/win32/win32k/w32ksvc.db
Modified: branches/arwinss/reactos/dll/win32/winent.drv/dib.c URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/winent... ============================================================================== --- branches/arwinss/reactos/dll/win32/winent.drv/dib.c [iso-8859-1] (original) +++ branches/arwinss/reactos/dll/win32/winent.drv/dib.c [iso-8859-1] Sat Jan 8 08:57:15 2011 @@ -173,6 +173,8 @@ } }
+ hbitmap = (HBITMAP)MapUserHandle(hbitmap); + result = RosGdiSetDIBits(physDev->hKernelDC, hbitmap, startscan, lines, safeBits, info, coloruse);
@@ -192,6 +194,8 @@ /* Check if this bitmap has a DIB section */ if (!(obj_size = GetObjectW( hbitmap, sizeof(dib), &dib ))) return 0;
+ hbitmap = (HBITMAP)MapUserHandle(hbitmap); + /* Perform GetDIBits */ return RosGdiGetDIBits(physDev->hKernelDC, hbitmap, startscan, lines, bits, info, coloruse, &dib); } @@ -202,6 +206,7 @@ DIBSECTION dib; LONG height, width; WORD infoBpp, compression; + HBITMAP hKbitmap;
GetObjectW( hbitmap, sizeof(dib), &dib );
@@ -212,7 +217,11 @@ // TODO: Should pass as a flag instead if (height < 0) dib.dsBmih.biHeight *= -1;
- return RosGdiCreateDIBSection(physDev->hKernelDC, hbitmap, bmi, usage, &dib); + hKbitmap = RosGdiCreateDIBSection(physDev->hKernelDC, bmi, usage, &dib); + + AddHandleMapping(hKbitmap, hbitmap); + + return hbitmap; }
UINT CDECL RosDrv_SetDIBColorTable( NTDRV_PDEVICE *physDev, UINT start, UINT count, const RGBQUAD *colors )
Modified: branches/arwinss/reactos/dll/win32/winent.drv/gdidrv.c URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/winent... ============================================================================== --- branches/arwinss/reactos/dll/win32/winent.drv/gdidrv.c [iso-8859-1] (original) +++ branches/arwinss/reactos/dll/win32/winent.drv/gdidrv.c [iso-8859-1] Sat Jan 8 08:57:15 2011 @@ -15,12 +15,89 @@
/* GLOBALS ****************************************************************/ HANDLE hStockBitmap; +static struct list handle_mapping_list = LIST_INIT( handle_mapping_list ); +static CRITICAL_SECTION handle_mapping_cs; + +typedef struct _HMAPPING +{ + HGDIOBJ hUser; + HGDIOBJ hKernel; + struct list entry; +} HMAPPING, *PHMAPPING;
/* FUNCTIONS **************************************************************/
+VOID InitHandleMapping() +{ + InitializeCriticalSection(&handle_mapping_cs); +} + +VOID AddHandleMapping(HGDIOBJ hKernel, HGDIOBJ hUser) +{ + PHMAPPING mapping = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(HMAPPING)); + if(!mapping) + return; + + mapping->hKernel = hKernel; + mapping->hUser = hUser; + + EnterCriticalSection(&handle_mapping_cs); + list_add_tail(&handle_mapping_list, &mapping->entry); + LeaveCriticalSection(&handle_mapping_cs); +} + +static PHMAPPING FindHandleMapping(HGDIOBJ hUser) +{ + PHMAPPING item; + + LIST_FOR_EACH_ENTRY( item, &handle_mapping_list, HMAPPING, entry ) + { + if (item->hUser == hUser) + { + return item; + } + } + + return NULL; +} + +HGDIOBJ MapUserHandle(HGDIOBJ hUser) +{ + PHMAPPING mapping; + + mapping = FindHandleMapping(hUser); + + return mapping ? mapping->hKernel : NULL; +} + +VOID RemoveHandleMapping(HGDIOBJ hUser) +{ + PHMAPPING mapping; + + mapping = FindHandleMapping(hUser); + if(mapping == NULL) + return; + + EnterCriticalSection(&handle_mapping_cs); + list_remove(&mapping->entry); + LeaveCriticalSection(&handle_mapping_cs); +} + +VOID CleanupHandleMapping() +{ + PHMAPPING mapping; + + while(!list_empty(&handle_mapping_list)) + { + mapping = LIST_ENTRY(list_head(&handle_mapping_list), HMAPPING, entry); + RemoveHandleMapping(mapping->hUser); + } +} + BOOL CDECL RosDrv_CreateBitmap( NTDRV_PDEVICE *physDev, HBITMAP hbitmap, LPVOID bmBits ) { BITMAP bitmap; + HBITMAP hKbitmap;
/* Get the usermode object */ if (!GetObjectW(hbitmap, sizeof(bitmap), &bitmap)) return FALSE; @@ -29,7 +106,13 @@ if (bitmap.bmPlanes != 1) return FALSE;
/* Create the kernelmode bitmap object */ - return RosGdiCreateBitmap(physDev->hKernelDC, hbitmap, &bitmap, bmBits); + hKbitmap = RosGdiCreateBitmap(physDev->hKernelDC, &bitmap, bmBits); + + if(!hKbitmap) + return FALSE; + + AddHandleMapping(hKbitmap, hbitmap); + return TRUE; }
BOOL CDECL RosDrv_CreateDC( HDC hdc, NTDRV_PDEVICE **pdev, LPCWSTR driver, LPCWSTR device, @@ -73,7 +156,14 @@
BOOL CDECL RosDrv_DeleteBitmap( HBITMAP hbitmap ) { - return RosGdiDeleteBitmap(hbitmap); + HBITMAP hKbitmap = (HBITMAP)MapUserHandle(hbitmap); + + if(hKbitmap == NULL) + return FALSE; + + RemoveHandleMapping(hbitmap); + + return RosGdiDeleteBitmap(hKbitmap); }
BOOL CDECL RosDrv_DeleteDC( NTDRV_PDEVICE *physDev ) @@ -134,6 +224,8 @@
LONG CDECL RosDrv_GetBitmapBits( HBITMAP hbitmap, void *buffer, LONG count ) { + hbitmap = (HBITMAP)MapUserHandle(hbitmap); + return RosGdiGetBitmapBits(hbitmap, buffer, count); }
@@ -184,7 +276,10 @@ BOOL bRes, bStock = FALSE;
/* Check if it's a stock bitmap */ - if (hbitmap == hStockBitmap) bStock = TRUE; + if (hbitmap == hStockBitmap) + bStock = TRUE; + else + hbitmap = (HBITMAP)MapUserHandle(hbitmap);
/* Select the bitmap into the DC */ bRes = RosGdiSelectBitmap(physDev->hKernelDC, hbitmap, bStock); @@ -201,6 +296,9 @@ LOGBRUSH logbrush;
if (!GetObjectA( hbrush, sizeof(logbrush), &logbrush )) return 0; + + if(logbrush.lbStyle == BS_PATTERN) + logbrush.lbHatch = (ULONG_PTR)MapUserHandle((HBITMAP)logbrush.lbHatch);
RosGdiSelectBrush(physDev->hKernelDC, &logbrush);
Modified: branches/arwinss/reactos/dll/win32/winent.drv/main.c URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/winent... ============================================================================== --- branches/arwinss/reactos/dll/win32/winent.drv/main.c [iso-8859-1] (original) +++ branches/arwinss/reactos/dll/win32/winent.drv/main.c [iso-8859-1] Sat Jan 8 08:57:15 2011 @@ -69,12 +69,14 @@ case DLL_PROCESS_ATTACH: InitializeCriticalSection(&NTDRV_CritSection); NTDRV_InitClipboard(); + InitHandleMapping(); //ret = process_attach(); break; case DLL_THREAD_DETACH: //thread_detach(); break; case DLL_PROCESS_DETACH: + CleanupHandleMapping(); //process_detach(); break; }
Modified: branches/arwinss/reactos/dll/win32/winent.drv/mouse.c URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/winent... ============================================================================== --- branches/arwinss/reactos/dll/win32/winent.drv/mouse.c [iso-8859-1] (original) +++ branches/arwinss/reactos/dll/win32/winent.drv/mouse.c [iso-8859-1] Sat Jan 8 08:57:15 2011 @@ -382,12 +382,12 @@ if(handle == NULL) { RosUserSetCursor(NULL); - - // FIXME: Delete previously created (by GetIconInfo) bitmaps! } else { GetIconInfo(handle, &iconinfo); + iconinfo.hbmColor = (HBITMAP)MapUserHandle(iconinfo.hbmColor); + iconinfo.hbmMask = (HBITMAP)MapUserHandle(iconinfo.hbmMask); RosUserSetCursor(&iconinfo); } }
Modified: branches/arwinss/reactos/dll/win32/winent.drv/winent.h URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/winent... ============================================================================== --- branches/arwinss/reactos/dll/win32/winent.drv/winent.h [iso-8859-1] (original) +++ branches/arwinss/reactos/dll/win32/winent.drv/winent.h [iso-8859-1] Sat Jan 8 08:57:15 2011 @@ -98,6 +98,11 @@
/* clipboard.c */ void NTDRV_InitClipboard(void); +VOID InitHandleMapping(); +VOID AddHandleMapping(HGDIOBJ hKernel, HGDIOBJ hUser); +HGDIOBJ MapUserHandle(HGDIOBJ hUser); +VOID RemoveHandleMapping(HGDIOBJ hUser); +VOID CleanupHandleMapping();
/* gdidrv.c */ void CDECL RosDrv_SetDeviceClipping( NTDRV_PDEVICE *physDev, HRGN vis_rgn, HRGN clip_rgn ); @@ -105,6 +110,8 @@ /* graphics.c */ INT RosDrv_XWStoDS( NTDRV_PDEVICE *physDev, INT width ); INT RosDrv_YWStoDS( NTDRV_PDEVICE *physDev, INT height ); + +HGDIOBJ MapHandle(HGDIOBJ hUser);
/* font.c */ VOID
Modified: branches/arwinss/reactos/include/reactos/wine/ntrosgdi.h URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/include/reactos/... ============================================================================== --- branches/arwinss/reactos/include/reactos/wine/ntrosgdi.h [iso-8859-1] (original) +++ branches/arwinss/reactos/include/reactos/wine/ntrosgdi.h [iso-8859-1] Sat Jan 8 08:57:15 2011 @@ -64,8 +64,8 @@ BOOL APIENTRY RosGdiBitBlt( HDC physDevDst, INT xDst, INT yDst, INT width, INT height, HDC physDevSrc, INT xSrc, INT ySrc, DWORD rop ); -BOOL APIENTRY RosGdiCreateBitmap( HDC physDev, HBITMAP hBitmap, BITMAP *pBitmap, LPVOID bmBits ); -HBITMAP APIENTRY RosGdiCreateDIBSection( HDC physDev, HBITMAP hbitmap, +HBITMAP APIENTRY RosGdiCreateBitmap( HDC physDev, BITMAP *pBitmap, LPVOID bmBits ); +HBITMAP APIENTRY RosGdiCreateDIBSection( HDC physDev, const BITMAPINFO *bmi, UINT usage, DIBSECTION *dib ); BOOL APIENTRY RosGdiDeleteBitmap( HBITMAP hbitmap ); LONG APIENTRY RosGdiGetBitmapBits( HBITMAP hbitmap, void *buffer, LONG count );
Modified: branches/arwinss/reactos/subsystems/win32/win32k/gdi/bitmap.c URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win32... ============================================================================== --- branches/arwinss/reactos/subsystems/win32/win32k/gdi/bitmap.c [iso-8859-1] (original) +++ branches/arwinss/reactos/subsystems/win32/win32k/gdi/bitmap.c [iso-8859-1] Sat Jan 8 08:57:15 2011 @@ -68,7 +68,7 @@ return bRes; }
-BOOL APIENTRY RosGdiCreateBitmap( HDC physDev, HBITMAP hUserBitmap, BITMAP *pBitmap, LPVOID bmBits ) +HBITMAP APIENTRY RosGdiCreateBitmap( HDC physDev, BITMAP *pBitmap, LPVOID bmBits ) { HBITMAP hBitmap; SIZEL slSize; @@ -97,7 +97,7 @@ NULL);
/* Return failure if no bitmap was created */ - if (!hBitmap) return FALSE; + if (!hBitmap) return 0;
/* Set its bits if any */ if (bmBits) @@ -112,16 +112,13 @@ SURFACE_UnlockSurface(pSurface); }
- /* Map handles */ - GDI_AddHandleMapping(hBitmap, hUserBitmap); - - DPRINT("Created bitmap %x (user handle %x)\n", hBitmap, hUserBitmap); + DPRINT("Created bitmap %x \n", hBitmap);
/* Indicate success */ - return TRUE; -} - -HBITMAP APIENTRY RosGdiCreateDIBSection( HDC physDev, HBITMAP hbitmap, + return hBitmap; +} + +HBITMAP APIENTRY RosGdiCreateDIBSection( HDC physDev, const BITMAPINFO *bmi, UINT usage, DIBSECTION *dib ) { SIZEL szSize; @@ -192,27 +189,16 @@ ExFreePoolWithTag(lpRGB, TAG_COLORMAP); }
- /* Map handles */ - GDI_AddHandleMapping(hbmDIB, hbitmap); - - DPRINT("Created bitmap %x (user handle %x) for DIB section\n", hbmDIB, hbitmap); + DPRINT("Created bitmap %x for DIB section\n", hbmDIB);
/* Return success */ - return hbitmap; + return hbmDIB; }
BOOL APIENTRY RosGdiDeleteBitmap( HBITMAP hbitmap ) { - HGDIOBJ hKernel = GDI_MapUserHandle(hbitmap); - - /* Fail if this object doesn't exist */ - if (!hKernel) return FALSE; - - /* Delete U->K mapping */ - GDI_RemoveHandleMapping(hbitmap); - /* Delete the bitmap */ - GreDeleteObject(hKernel); + GreDeleteObject(hbitmap);
/* Indicate success */ return TRUE; @@ -222,23 +208,13 @@ { PSURFACE psurf; LONG bmSize, ret; - HGDIOBJ hKernel;
if (buffer != NULL && Bytes == 0) { return 0; }
- /* Get kernelmode bitmap handle */ - hKernel = GDI_MapUserHandle(hbitmap); - - if (!hKernel) - { - DPRINT1("Trying to GetBitmapBits of an unkown bitmap (uhandle %x)\n", hbitmap); - return 0; - } - - psurf = SURFACE_LockSurface(hKernel); + psurf = SURFACE_LockSurface(hbitmap); if (!psurf) return 0;
bmSize = BITMAP_GetWidthBytes(psurf->SurfObj.sizlBitmap.cx, @@ -264,18 +240,16 @@ return ret; }
-INT APIENTRY RosGdiGetDIBits( HDC physDev, HBITMAP hUserBitmap, UINT StartScan, UINT ScanLines, +INT APIENTRY RosGdiGetDIBits( HDC physDev, HBITMAP hBitmap, UINT StartScan, UINT ScanLines, LPVOID Bits, BITMAPINFO *bmi, UINT ColorUse, DIBSECTION *dib ) { PDC pDC;
- HGDIOBJ hBitmap = GDI_MapUserHandle(hUserBitmap); - /* Get a pointer to the DCs */ pDC = DC_LockDc(physDev);
- DPRINT("RosGdiGetDIBits for bitmap %x (user handle %x), StartScan %d, ScanLines %d, height %d\n", - hBitmap, hUserBitmap, StartScan, ScanLines, dib->dsBm.bmHeight); + DPRINT("RosGdiGetDIBits for bitmap %x , StartScan %d, ScanLines %d, height %d\n", + hBitmap, StartScan, ScanLines, dib->dsBm.bmHeight);
/* Set the bits */ GreGetDIBits(pDC, @@ -365,18 +339,16 @@ return Entries; }
-INT APIENTRY RosGdiSetDIBits(HDC physDev, HBITMAP hUserBitmap, UINT StartScan, +INT APIENTRY RosGdiSetDIBits(HDC physDev, HBITMAP hBitmap, UINT StartScan, UINT ScanLines, LPCVOID Bits, const BITMAPINFO *bmi, UINT ColorUse) { PDC pDC;
- HGDIOBJ hBitmap = GDI_MapUserHandle(hUserBitmap); - /* Get a pointer to the DCs */ pDC = DC_LockDc(physDev);
- DPRINT("RosGdiSetDIBits for bitmap %x (user handle %x), StartScan %d, ScanLines %d\n", - hBitmap, hUserBitmap, StartScan, ScanLines); + DPRINT("RosGdiSetDIBits for bitmap %x, StartScan %d, ScanLines %d\n", + hBitmap, StartScan, ScanLines);
/* Set the bits */ ScanLines = GreSetDIBits(pDC,
Modified: branches/arwinss/reactos/subsystems/win32/win32k/gdi/dc.c URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win32... ============================================================================== --- branches/arwinss/reactos/subsystems/win32/win32k/gdi/dc.c [iso-8859-1] (original) +++ branches/arwinss/reactos/subsystems/win32/win32k/gdi/dc.c [iso-8859-1] Sat Jan 8 08:57:15 2011 @@ -156,29 +156,24 @@ { PDC pDC; PSURFACE pSurface; - HGDIOBJ hBmpKern; + + DPRINT("Selecting %x bitmap to hdc %x\n", hbitmap, physDev);
if (bStock) { /* Selecting stock bitmap */ - hBmpKern = hStockBmp; - } - else - { - /* Selecting usual bitmap */ - hBmpKern = GDI_MapUserHandle(hbitmap); - if (!hBmpKern) - { - DPRINT1("Trying to select an unknown bitmap %x to the DC %x!\n", hbitmap, physDev); - return FALSE; - } - } - - DPRINT("Selecting %x bitmap to hdc %x\n", hBmpKern, physDev); + hbitmap = hStockBmp; + } + + pSurface = SURFACE_ShareLockSurface(hbitmap); + if(pSurface== NULL) + { + DPRINT1("SURFACE_ShareLockSurface failed\n"); + return FALSE; + }
/* Get a pointer to the DC and the bitmap*/ pDC = DC_LockDc(physDev); - pSurface = SURFACE_ShareLockSurface(hBmpKern);
/* Release the old bitmap */ SURFACE_ShareUnlockSurface(pDC->dclevel.pSurface); @@ -200,8 +195,6 @@
HBRUSH APIENTRY GreCreateBrush(LOGBRUSH *pLogBrush) { - HGDIOBJ hBmpKern; - /* Create the brush */ switch(pLogBrush->lbStyle) { @@ -212,14 +205,8 @@ case BS_HATCHED: return GreCreateHatchBrush(pLogBrush->lbHatch, pLogBrush->lbColor); case BS_PATTERN: - hBmpKern = GDI_MapUserHandle((HBITMAP)pLogBrush->lbHatch); - if (!hBmpKern) - { - DPRINT1("Trying to create a pattern brush with an unknown bitmap %x !\n", pLogBrush->lbHatch); - return NULL; - } - GDIOBJ_SetOwnership(hBmpKern, NULL); - return GreCreatePatternBrush(hBmpKern); + GDIOBJ_SetOwnership((HBITMAP)pLogBrush->lbHatch, NULL); + return GreCreatePatternBrush((HBITMAP)pLogBrush->lbHatch); case BS_DIBPATTERN: default: UNIMPLEMENTED;
Modified: branches/arwinss/reactos/subsystems/win32/win32k/gre/gdiobj.c URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win32... ============================================================================== --- branches/arwinss/reactos/subsystems/win32/win32k/gre/gdiobj.c [iso-8859-1] (original) +++ branches/arwinss/reactos/subsystems/win32/win32k/gre/gdiobj.c [iso-8859-1] Sat Jan 8 08:57:15 2011 @@ -984,6 +984,8 @@ HandleType = GDI_HANDLE_GET_TYPE(hObj); HandleUpper = GDI_HANDLE_GET_UPPER(hObj);
+ //ASSERT(hObj); + /* Check that the handle index is valid. */ if (HandleIndex >= GDI_HANDLE_COUNT) return NULL; @@ -993,6 +995,7 @@ HandleType != ExpectedType) || HandleType == 0 ) { + //ASSERT(FALSE); DPRINT1("Attempted to lock object 0x%x of wrong type (Handle: 0x%x, requested: 0x%x)\n", hObj, HandleType, ExpectedType); return NULL; @@ -1520,147 +1523,4 @@
}
-/* Usermode -> kernelmode handle mapping */ -LIST_ENTRY HandleMapping; -KSPIN_LOCK HandleMappingLock; - -typedef struct _HMAPPING -{ - HGDIOBJ hUser; - HGDIOBJ hKernel; - HANDLE hProcessId; - LIST_ENTRY Entry; -} HMAPPING, *PHMAPPING; - -VOID NTAPI -GDI_InitHandleMapping() -{ - /* Initialize handles list and a spinlock */ - InitializeListHead(&HandleMapping); - KeInitializeSpinLock(&HandleMappingLock); -} - -VOID NTAPI -GDI_AddHandleMapping(HGDIOBJ hKernel, HGDIOBJ hUser) -{ - HGDIOBJ hExisting; - PHMAPPING pMapping = ExAllocatePool(NonPagedPool, sizeof(HMAPPING)); - if (!pMapping) return; - - /* Set mapping */ - pMapping->hUser = hUser; - pMapping->hKernel = hKernel; - pMapping->hProcessId = PsGetCurrentProcessId(); - - /* Debug check: see if we already have this mapping */ - hExisting = GDI_MapUserHandle(hUser); - if (hExisting) - DPRINT1("Trying to map already existing mapping %x -> %x to %x!\n", hUser, hExisting, hKernel); - - /* Add it to the list */ - ExInterlockedInsertHeadList(&HandleMapping, &pMapping->Entry, &HandleMappingLock); -} - -HGDIOBJ NTAPI -GDI_MapUserHandle(HGDIOBJ hUser) -{ - KIRQL OldIrql; - PLIST_ENTRY Current; - PHMAPPING Mapping; - HGDIOBJ Found = 0; - HANDLE hProcessId = PsGetCurrentProcessId(); - - /* Acquire the lock and check if the list is empty */ - KeAcquireSpinLock(&HandleMappingLock, &OldIrql); - - /* Traverse the list to find our mapping */ - Current = HandleMapping.Flink; - while(Current != &HandleMapping) - { - Mapping = CONTAINING_RECORD(Current, HMAPPING, Entry); - - /* Check if it's our entry */ - if (Mapping->hUser == hUser && Mapping->hProcessId == hProcessId) - { - /* Found it, save it and break out of the loop */ - Found = Mapping->hKernel; - break; - } - - /* Advance to the next pair */ - Current = Current->Flink; - } - - /* Release the lock and return the entry */ - KeReleaseSpinLock(&HandleMappingLock, OldIrql); - return Found; -} - -VOID NTAPI -GDI_RemoveHandleMapping(HGDIOBJ hUser) -{ - KIRQL OldIrql; - PLIST_ENTRY Current; - PHMAPPING Mapping; - HANDLE hProcessId = PsGetCurrentProcessId(); - - /* Acquire the lock and check if the list is empty */ - KeAcquireSpinLock(&HandleMappingLock, &OldIrql); - - /* Traverse the list to find our mapping */ - Current = HandleMapping.Flink; - while(Current != &HandleMapping) - { - Mapping = CONTAINING_RECORD(Current, HMAPPING, Entry); - - /* Check if it's our entry */ - if (Mapping->hUser == hUser && Mapping->hProcessId == hProcessId) - { - /* Remove and free it */ - RemoveEntryList(Current); - ExFreePool(Mapping); - break; - } - - /* Advance to the next pair */ - Current = Current->Flink; - } - - /* Release the lock and return the entry */ - KeReleaseSpinLock(&HandleMappingLock, OldIrql); -} - -VOID NTAPI -GDI_CleanupHandleMapping() -{ - KIRQL OldIrql; - PLIST_ENTRY Current; - PHMAPPING Mapping; - HANDLE hProcessId = PsGetCurrentProcessId(); - - /* Acquire the lock and check if the list is empty */ - KeAcquireSpinLock(&HandleMappingLock, &OldIrql); - - /* Traverse the list to find all handles of a current process */ - Current = HandleMapping.Flink; - while(Current != &HandleMapping) - { - Mapping = CONTAINING_RECORD(Current, HMAPPING, Entry); - - /* Check if it's our entry */ - if (Mapping->hProcessId == hProcessId) - { - /* Remove and free it */ - RemoveEntryList(Current); - ExFreePool(Mapping); - } - - /* Advance to the next pair */ - Current = Current->Flink; - } - - /* Release the lock and return the entry */ - KeReleaseSpinLock(&HandleMappingLock, OldIrql); -} - /* EOF */
Modified: branches/arwinss/reactos/subsystems/win32/win32k/main/cursor.c URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win32... ============================================================================== --- branches/arwinss/reactos/subsystems/win32/win32k/main/cursor.c [iso-8859-1] (original) +++ branches/arwinss/reactos/subsystems/win32/win32k/main/cursor.c [iso-8859-1] Sat Jan 8 08:57:15 2011 @@ -123,11 +123,6 @@ return; }
- IconInfo->hbmMask = GDI_MapUserHandle(IconInfo->hbmMask); - IconInfo->hbmColor = GDI_MapUserHandle(IconInfo->hbmColor); - - DPRINT("hbmMask = 0x%x, hbmColor = 0x%x\n", IconInfo->hbmMask, IconInfo->hbmColor); - GreSetPointerShape( hDCscreen, IconInfo->hbmMask, IconInfo->hbmColor,
Modified: branches/arwinss/reactos/subsystems/win32/win32k/main/init.c URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win32... ============================================================================== --- branches/arwinss/reactos/subsystems/win32/win32k/main/init.c [iso-8859-1] (original) +++ branches/arwinss/reactos/subsystems/win32/win32k/main/init.c [iso-8859-1] Sat Jan 8 08:57:15 2011 @@ -101,9 +101,6 @@ }
UserLeave(); - - /* Destroy all user->kernel handle mapping */ - GDI_CleanupHandleMapping(); }
DPRINT("Leave Win32kProcessCallback\n"); @@ -368,9 +365,6 @@ return STATUS_UNSUCCESSFUL; }
- /* Initialize handle-mapping */ - GDI_InitHandleMapping(); - /* Create stock objects */ CreateStockObjects();
Modified: branches/arwinss/reactos/subsystems/win32/win32k/w32ksvc.db URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win32... ============================================================================== --- branches/arwinss/reactos/subsystems/win32/win32k/w32ksvc.db [iso-8859-1] (original) +++ branches/arwinss/reactos/subsystems/win32/win32k/w32ksvc.db [iso-8859-1] Sat Jan 8 08:57:15 2011 @@ -1,8 +1,8 @@ wine_server_call 1 RosGdiAlphaBlend 11 RosGdiBitBlt 9 -RosGdiCreateBitmap 4 -RosGdiCreateDIBSection 5 +RosGdiCreateBitmap 3 +RosGdiCreateDIBSection 4 RosGdiDeleteBitmap 1 RosGdiGetBitmapBits 3 RosGdiGetDIBits 8