Author: gedmurphy Date: Sat Apr 1 19:25:40 2006 New Revision: 21433
URL: http://svn.reactos.ru/svn/reactos?rev=21433&view=rev Log: - change the GDI code a bit so it's able to handle multiple tables (e.g. separate Dd table) - patch by Thomas Weidenmueller
Removed: trunk/reactos/subsystems/win32/win32k/ntuser/ssec.c Modified: trunk/reactos/subsystems/win32/win32k/eng/palette.c trunk/reactos/subsystems/win32/win32k/eng/surface.c trunk/reactos/subsystems/win32/win32k/include/bitmaps.h trunk/reactos/subsystems/win32/win32k/include/brush.h trunk/reactos/subsystems/win32/win32k/include/dc.h trunk/reactos/subsystems/win32/win32k/include/dce.h trunk/reactos/subsystems/win32/win32k/include/gdiobj.h trunk/reactos/subsystems/win32/win32k/include/object.h trunk/reactos/subsystems/win32/win32k/include/palette.h trunk/reactos/subsystems/win32/win32k/include/pen.h trunk/reactos/subsystems/win32/win32k/include/region.h trunk/reactos/subsystems/win32/win32k/include/ssec.h trunk/reactos/subsystems/win32/win32k/include/text.h trunk/reactos/subsystems/win32/win32k/include/win32k.h trunk/reactos/subsystems/win32/win32k/main/dllmain.c trunk/reactos/subsystems/win32/win32k/ntddraw/ddraw.c trunk/reactos/subsystems/win32/win32k/ntuser/cursoricon.c trunk/reactos/subsystems/win32/win32k/ntuser/misc.c trunk/reactos/subsystems/win32/win32k/ntuser/painting.c trunk/reactos/subsystems/win32/win32k/ntuser/windc.c trunk/reactos/subsystems/win32/win32k/objects/bitmaps.c trunk/reactos/subsystems/win32/win32k/objects/brush.c trunk/reactos/subsystems/win32/win32k/objects/cliprgn.c trunk/reactos/subsystems/win32/win32k/objects/color.c trunk/reactos/subsystems/win32/win32k/objects/dc.c trunk/reactos/subsystems/win32/win32k/objects/gdiobj.c trunk/reactos/subsystems/win32/win32k/objects/palobj.c trunk/reactos/subsystems/win32/win32k/objects/region.c trunk/reactos/subsystems/win32/win32k/objects/stockobj.c trunk/reactos/subsystems/win32/win32k/win32k.rbuild
Modified: trunk/reactos/subsystems/win32/win32k/eng/palette.c URL: http://svn.reactos.ru/svn/reactos/trunk/reactos/subsystems/win32/win32k/eng/... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/eng/palette.c (original) +++ trunk/reactos/subsystems/win32/win32k/eng/palette.c Sat Apr 1 19:25:40 2006 @@ -44,7 +44,7 @@ Palette = PALETTE_AllocPalette(Mode, NumColors, Colors, Red, Green, Blue); if (Palette != NULL) { - GDIOBJ_SetOwnership(Palette, NULL); + GDIOBJ_SetOwnership(GdiHandleTable, Palette, NULL); }
return Palette; @@ -56,7 +56,7 @@ BOOL STDCALL EngDeletePalette(IN HPALETTE Palette) { - GDIOBJ_SetOwnership(Palette, PsGetCurrentProcess()); + GDIOBJ_SetOwnership(GdiHandleTable, Palette, PsGetCurrentProcess());
return PALETTE_FreePalette(Palette); }
Modified: trunk/reactos/subsystems/win32/win32k/eng/surface.c URL: http://svn.reactos.ru/svn/reactos/trunk/reactos/subsystems/win32/win32k/eng/... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/eng/surface.c (original) +++ trunk/reactos/subsystems/win32/win32k/eng/surface.c Sat Apr 1 19:25:40 2006 @@ -373,7 +373,7 @@ if ( !NewBitmap ) return 0;
- GDIOBJ_SetOwnership(NewBitmap, NULL); + GDIOBJ_SetOwnership(GdiHandleTable, NewBitmap, NULL);
return NewBitmap; } @@ -394,7 +394,7 @@ if (NewSurface == NULL) return 0;
- GDIOBJ_SetOwnership(NewSurface, NULL); + GDIOBJ_SetOwnership(GdiHandleTable, NewSurface, NULL);
BitmapObj = BITMAPOBJ_LockBitmap(NewSurface); if (! BITMAPOBJ_InitBitsLock(BitmapObj)) @@ -506,7 +506,7 @@ BOOL STDCALL EngDeleteSurface(IN HSURF Surface) { - GDIOBJ_SetOwnership(Surface, PsGetCurrentProcess()); + GDIOBJ_SetOwnership(GdiHandleTable, Surface, PsGetCurrentProcess()); BITMAPOBJ_FreeBitmap(Surface); return TRUE; } @@ -533,7 +533,7 @@ SURFOBJ * STDCALL EngLockSurface(IN HSURF Surface) { - BITMAPOBJ *bmp = GDIOBJ_ShareLockObj(Surface, GDI_OBJECT_TYPE_BITMAP); + BITMAPOBJ *bmp = GDIOBJ_ShareLockObj(GdiHandleTable, Surface, GDI_OBJECT_TYPE_BITMAP);
if (bmp != NULL) return &bmp->SurfObj; @@ -548,6 +548,6 @@ EngUnlockSurface(IN SURFOBJ *Surface) { if (Surface != NULL) - GDIOBJ_UnlockObjByPtr(Surface); + GDIOBJ_UnlockObjByPtr(GdiHandleTable, Surface); } /* EOF */
Modified: trunk/reactos/subsystems/win32/win32k/include/bitmaps.h URL: http://svn.reactos.ru/svn/reactos/trunk/reactos/subsystems/win32/win32k/incl... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/include/bitmaps.h (original) +++ trunk/reactos/subsystems/win32/win32k/include/bitmaps.h Sat Apr 1 19:25:40 2006 @@ -25,9 +25,9 @@ /* Internal interface */
#define BITMAPOBJ_AllocBitmap() \ - ((HBITMAP) GDIOBJ_AllocObj (GDI_OBJECT_TYPE_BITMAP)) + ((HBITMAP) GDIOBJ_AllocObj (GdiHandleTable, GDI_OBJECT_TYPE_BITMAP)) #define BITMAPOBJ_FreeBitmap(hBMObj) \ - GDIOBJ_FreeObj((HGDIOBJ) hBMObj, GDI_OBJECT_TYPE_BITMAP) + GDIOBJ_FreeObj(GdiHandleTable, (HGDIOBJ) hBMObj, GDI_OBJECT_TYPE_BITMAP) /* NOTE: Use shared locks! */ #define BITMAPOBJ_LockBitmap(hBMObj) (PBITMAPOBJ)EngLockSurface((HSURF)hBMObj) #define BITMAPOBJ_UnlockBitmap(pBMObj) EngUnlockSurface(&pBMObj->SurfObj)
Modified: trunk/reactos/subsystems/win32/win32k/include/brush.h URL: http://svn.reactos.ru/svn/reactos/trunk/reactos/subsystems/win32/win32k/incl... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/include/brush.h (original) +++ trunk/reactos/subsystems/win32/win32k/include/brush.h Sat Apr 1 19:25:40 2006 @@ -68,10 +68,10 @@ #define GDIBRUSH_IS_MASKING 0x8000 /* Pattern bitmap is used as transparent mask (?) */ #define GDIBRUSH_CACHED_IS_SOLID 0x80000000
-#define BRUSHOBJ_AllocBrush() ((HBRUSH) GDIOBJ_AllocObj (GDI_OBJECT_TYPE_BRUSH)) -#define BRUSHOBJ_FreeBrush(hBrush) GDIOBJ_FreeObj((HGDIOBJ)hBrush, GDI_OBJECT_TYPE_BRUSH) -#define BRUSHOBJ_LockBrush(hBrush) ((PGDIBRUSHOBJ)GDIOBJ_LockObj((HGDIOBJ)hBrush, GDI_OBJECT_TYPE_BRUSH)) -#define BRUSHOBJ_UnlockBrush(pBrush) GDIOBJ_UnlockObjByPtr(pBrush) +#define BRUSHOBJ_AllocBrush() ((HBRUSH) GDIOBJ_AllocObj (GdiHandleTable, GDI_OBJECT_TYPE_BRUSH)) +#define BRUSHOBJ_FreeBrush(hBrush) GDIOBJ_FreeObj(GdiHandleTable, (HGDIOBJ)hBrush, GDI_OBJECT_TYPE_BRUSH) +#define BRUSHOBJ_LockBrush(hBrush) ((PGDIBRUSHOBJ)GDIOBJ_LockObj(GdiHandleTable, (HGDIOBJ)hBrush, GDI_OBJECT_TYPE_BRUSH)) +#define BRUSHOBJ_UnlockBrush(pBrush) GDIOBJ_UnlockObjByPtr(GdiHandleTable, pBrush) BOOL INTERNAL_CALL BRUSH_Cleanup(PVOID ObjectBody);
#endif
Modified: trunk/reactos/subsystems/win32/win32k/include/dc.h URL: http://svn.reactos.ru/svn/reactos/trunk/reactos/subsystems/win32/win32k/incl... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/include/dc.h (original) +++ trunk/reactos/subsystems/win32/win32k/include/dc.h Sat Apr 1 19:25:40 2006 @@ -166,9 +166,9 @@ /* Internal functions */
#define DC_LockDc(hDC) \ - ((PDC) GDIOBJ_LockObj ((HGDIOBJ) hDC, GDI_OBJECT_TYPE_DC)) + ((PDC) GDIOBJ_LockObj (GdiHandleTable, (HGDIOBJ) hDC, GDI_OBJECT_TYPE_DC)) #define DC_UnlockDc(pDC) \ - GDIOBJ_UnlockObjByPtr (pDC) + GDIOBJ_UnlockObjByPtr (GdiHandleTable, pDC)
HDC FASTCALL RetrieveDisplayHDC(VOID); HDC FASTCALL DC_AllocDC(PUNICODE_STRING Driver);
Modified: trunk/reactos/subsystems/win32/win32k/include/dce.h URL: http://svn.reactos.ru/svn/reactos/trunk/reactos/subsystems/win32/win32k/incl... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/include/dce.h (original) +++ trunk/reactos/subsystems/win32/win32k/include/dce.h Sat Apr 1 19:25:40 2006 @@ -44,10 +44,10 @@ #define DCX_NOCLIPCHILDREN 0x00080000
#define DCEOBJ_AllocDCE() \ - ((HDCE) GDIOBJ_AllocObj (GDI_OBJECT_TYPE_DCE)) -#define DCEOBJ_FreeDCE(hDCE) GDIOBJ_FreeObj((HGDIOBJ)hDCE, GDI_OBJECT_TYPE_DCE) -#define DCEOBJ_LockDCE(hDCE) ((PDCE)GDIOBJ_LockObj((HGDIOBJ)hDCE, GDI_OBJECT_TYPE_DCE)) -#define DCEOBJ_UnlockDCE(pDCE) GDIOBJ_UnlockObjByPtr(pDCE) + ((HDCE) GDIOBJ_AllocObj (GdiHandleTable, GDI_OBJECT_TYPE_DCE)) +#define DCEOBJ_FreeDCE(hDCE) GDIOBJ_FreeObj(GdiHandleTable, (HGDIOBJ)hDCE, GDI_OBJECT_TYPE_DCE) +#define DCEOBJ_LockDCE(hDCE) ((PDCE)GDIOBJ_LockObj(GdiHandleTable, (HGDIOBJ)hDCE, GDI_OBJECT_TYPE_DCE)) +#define DCEOBJ_UnlockDCE(pDCE) GDIOBJ_UnlockObjByPtr(GdiHandleTable, pDCE) BOOL INTERNAL_CALL DCE_Cleanup(PVOID ObjectBody);
PDCE FASTCALL DceAllocDCE(PWINDOW_OBJECT Window, DCE_TYPE Type);
Modified: trunk/reactos/subsystems/win32/win32k/include/gdiobj.h URL: http://svn.reactos.ru/svn/reactos/trunk/reactos/subsystems/win32/win32k/incl... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/include/gdiobj.h (original) +++ trunk/reactos/subsystems/win32/win32k/include/gdiobj.h Sat Apr 1 19:25:40 2006 @@ -8,6 +8,21 @@
/* Public GDI Object/Handle definitions */ #include <win32k/ntgdihdl.h> + +typedef struct _GDI_HANDLE_TABLE +{ + /* the table must be located at the beginning of this structure so it can be + properly mapped! */ + GDI_TABLE_ENTRY Entries[GDI_HANDLE_COUNT]; + + PPAGED_LOOKASIDE_LIST LookasideLists; + + SLIST_HEADER FreeEntriesHead; + SLIST_ENTRY FreeEntries[((GDI_HANDLE_COUNT * sizeof(GDI_TABLE_ENTRY)) << 3) / + (sizeof(SLIST_ENTRY) << 3)]; +} GDI_HANDLE_TABLE, *PGDI_HANDLE_TABLE; + +extern PGDI_HANDLE_TABLE GdiHandleTable;
typedef PVOID PGDIOBJ;
@@ -28,11 +43,11 @@ #endif } GDIOBJHDR, *PGDIOBJHDR;
-BOOL INTERNAL_CALL GDIOBJ_OwnedByCurrentProcess(HGDIOBJ ObjectHandle); -void INTERNAL_CALL GDIOBJ_SetOwnership(HGDIOBJ ObjectHandle, PEPROCESS Owner); -void INTERNAL_CALL GDIOBJ_CopyOwnership(HGDIOBJ CopyFrom, HGDIOBJ CopyTo); -BOOL INTERNAL_CALL GDIOBJ_ConvertToStockObj(HGDIOBJ *hObj); -VOID INTERNAL_CALL GDIOBJ_UnlockObjByPtr(PGDIOBJ Object); +BOOL INTERNAL_CALL GDIOBJ_OwnedByCurrentProcess(PGDI_HANDLE_TABLE HandleTable, HGDIOBJ ObjectHandle); +void INTERNAL_CALL GDIOBJ_SetOwnership(PGDI_HANDLE_TABLE HandleTable, HGDIOBJ ObjectHandle, PEPROCESS Owner); +void INTERNAL_CALL GDIOBJ_CopyOwnership(PGDI_HANDLE_TABLE HandleTable, HGDIOBJ CopyFrom, HGDIOBJ CopyTo); +BOOL INTERNAL_CALL GDIOBJ_ConvertToStockObj(PGDI_HANDLE_TABLE HandleTable, HGDIOBJ *hObj); +VOID INTERNAL_CALL GDIOBJ_UnlockObjByPtr(PGDI_HANDLE_TABLE HandleTable, PGDIOBJ Object);
#define GDIOBJ_GetObjectType(Handle) \ GDI_HANDLE_GET_TYPE(Handle) @@ -40,26 +55,26 @@ #ifdef GDI_DEBUG
/* a couple macros for debugging GDIOBJ locking */ -#define GDIOBJ_AllocObj(ty) GDIOBJ_AllocObjDbg(__FILE__,__LINE__,ty) -#define GDIOBJ_FreeObj(obj,ty) GDIOBJ_FreeObjDbg(__FILE__,__LINE__,obj,ty) -#define GDIOBJ_LockObj(obj,ty) GDIOBJ_LockObjDbg(__FILE__,__LINE__,obj,ty) -#define GDIOBJ_ShareLockObj(obj,ty) GDIOBJ_ShareLockObjDbg(__FILE__,__LINE__,obj,ty) +#define GDIOBJ_AllocObj(ty) GDIOBJ_AllocObjDbg(GdiHandleTable,__FILE__,__LINE__,ty) +#define GDIOBJ_FreeObj(obj,ty) GDIOBJ_FreeObjDbg(GdiHandleTable,__FILE__,__LINE__,obj,ty) +#define GDIOBJ_LockObj(obj,ty) GDIOBJ_LockObjDbg(GdiHandleTable,__FILE__,__LINE__,obj,ty) +#define GDIOBJ_ShareLockObj(obj,ty) GDIOBJ_ShareLockObjDbg(GdiHandleTable,__FILE__,__LINE__,obj,ty)
-HGDIOBJ INTERNAL_CALL GDIOBJ_AllocObjDbg(const char* file, int line, ULONG ObjectType); -BOOL INTERNAL_CALL GDIOBJ_FreeObjDbg (const char* file, int line, HGDIOBJ hObj, DWORD ObjectType); -PGDIOBJ INTERNAL_CALL GDIOBJ_LockObjDbg (const char* file, int line, HGDIOBJ hObj, DWORD ObjectType); -PGDIOBJ INTERNAL_CALL GDIOBJ_ShareLockObjDbg (const char* file, int line, HGDIOBJ hObj, DWORD ObjectType); +HGDIOBJ INTERNAL_CALL GDIOBJ_AllocObjDbg(PGDI_HANDLE_TABLE HandleTable, const char* file, int line, ULONG ObjectType); +BOOL INTERNAL_CALL GDIOBJ_FreeObjDbg (PGDI_HANDLE_TABLE HandleTable, const char* file, int line, HGDIOBJ hObj, DWORD ObjectType); +PGDIOBJ INTERNAL_CALL GDIOBJ_LockObjDbg (PGDI_HANDLE_TABLE HandleTable, const char* file, int line, HGDIOBJ hObj, DWORD ObjectType); +PGDIOBJ INTERNAL_CALL GDIOBJ_ShareLockObjDbg (PGDI_HANDLE_TABLE HandleTable, const char* file, int line, HGDIOBJ hObj, DWORD ObjectType);
#else /* !GDI_DEBUG */
-HGDIOBJ INTERNAL_CALL GDIOBJ_AllocObj(ULONG ObjectType); -BOOL INTERNAL_CALL GDIOBJ_FreeObj (HGDIOBJ hObj, DWORD ObjectType); -PGDIOBJ INTERNAL_CALL GDIOBJ_LockObj (HGDIOBJ hObj, DWORD ObjectType); -PGDIOBJ INTERNAL_CALL GDIOBJ_ShareLockObj (HGDIOBJ hObj, DWORD ObjectType); +HGDIOBJ INTERNAL_CALL GDIOBJ_AllocObj(PGDI_HANDLE_TABLE HandleTable, ULONG ObjectType); +BOOL INTERNAL_CALL GDIOBJ_FreeObj (PGDI_HANDLE_TABLE HandleTable, HGDIOBJ hObj, DWORD ObjectType); +PGDIOBJ INTERNAL_CALL GDIOBJ_LockObj (PGDI_HANDLE_TABLE HandleTable, HGDIOBJ hObj, DWORD ObjectType); +PGDIOBJ INTERNAL_CALL GDIOBJ_ShareLockObj (PGDI_HANDLE_TABLE HandleTable, HGDIOBJ hObj, DWORD ObjectType);
#endif /* GDI_DEBUG */
-PVOID INTERNAL_CALL GDI_MapHandleTable(PEPROCESS Process); +PVOID INTERNAL_CALL GDI_MapHandleTable(PSECTION_OBJECT SectionObject, PEPROCESS Process);
#define GDIOBJFLAG_DEFAULT (0x0) #define GDIOBJFLAG_IGNOREPID (0x1)
Modified: trunk/reactos/subsystems/win32/win32k/include/object.h URL: http://svn.reactos.ru/svn/reactos/trunk/reactos/subsystems/win32/win32k/incl... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/include/object.h (original) +++ trunk/reactos/subsystems/win32/win32k/include/object.h Sat Apr 1 19:25:40 2006 @@ -125,8 +125,6 @@ \ }
-VOID INTERNAL_CALL InitGdiObjectHandleTable (VOID); - VOID FASTCALL CreateStockObjects (VOID); VOID FASTCALL CreateSysColorObjects (VOID);
Modified: trunk/reactos/subsystems/win32/win32k/include/palette.h URL: http://svn.reactos.ru/svn/reactos/trunk/reactos/subsystems/win32/win32k/incl... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/include/palette.h (original) +++ trunk/reactos/subsystems/win32/win32k/include/palette.h Sat Apr 1 19:25:40 2006 @@ -35,9 +35,9 @@ ULONG Blue); HPALETTE FASTCALL PALETTE_AllocPaletteIndexedRGB(ULONG NumColors, CONST RGBQUAD *Colors); -#define PALETTE_FreePalette(hPalette) GDIOBJ_FreeObj((HGDIOBJ)hPalette, GDI_OBJECT_TYPE_PALETTE) -#define PALETTE_LockPalette(hPalette) ((PPALGDI)GDIOBJ_LockObj((HGDIOBJ)hPalette, GDI_OBJECT_TYPE_PALETTE)) -#define PALETTE_UnlockPalette(pPalette) GDIOBJ_UnlockObjByPtr(pPalette) +#define PALETTE_FreePalette(hPalette) GDIOBJ_FreeObj(GdiHandleTable, (HGDIOBJ)hPalette, GDI_OBJECT_TYPE_PALETTE) +#define PALETTE_LockPalette(hPalette) ((PPALGDI)GDIOBJ_LockObj(GdiHandleTable, (HGDIOBJ)hPalette, GDI_OBJECT_TYPE_PALETTE)) +#define PALETTE_UnlockPalette(pPalette) GDIOBJ_UnlockObjByPtr(GdiHandleTable, pPalette) BOOL INTERNAL_CALL PALETTE_Cleanup(PVOID ObjectBody);
HPALETTE FASTCALL PALETTE_Init (VOID);
Modified: trunk/reactos/subsystems/win32/win32k/include/pen.h URL: http://svn.reactos.ru/svn/reactos/trunk/reactos/subsystems/win32/win32k/incl... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/include/pen.h (original) +++ trunk/reactos/subsystems/win32/win32k/include/pen.h Sat Apr 1 19:25:40 2006 @@ -6,9 +6,9 @@
/* Internal interface */
-#define PENOBJ_AllocPen() ((HPEN)GDIOBJ_AllocObj(GDI_OBJECT_TYPE_PEN)) -#define PENOBJ_FreePen(hBMObj) GDIOBJ_FreeObj((HGDIOBJ) hBMObj, GDI_OBJECT_TYPE_PEN) -#define PENOBJ_LockPen(hBMObj) ((PGDIBRUSHOBJ)GDIOBJ_LockObj((HGDIOBJ) hBMObj, GDI_OBJECT_TYPE_PEN)) -#define PENOBJ_UnlockPen(pPenObj) GDIOBJ_UnlockObjByPtr(pPenObj) +#define PENOBJ_AllocPen() ((HPEN)GDIOBJ_AllocObj(GdiHandleTable, GDI_OBJECT_TYPE_PEN)) +#define PENOBJ_FreePen(hBMObj) GDIOBJ_FreeObj(GdiHandleTable, (HGDIOBJ) hBMObj, GDI_OBJECT_TYPE_PEN) +#define PENOBJ_LockPen(hBMObj) ((PGDIBRUSHOBJ)GDIOBJ_LockObj(GdiHandleTable, (HGDIOBJ) hBMObj, GDI_OBJECT_TYPE_PEN)) +#define PENOBJ_UnlockPen(pPenObj) GDIOBJ_UnlockObjByPtr(GdiHandleTable, pPenObj)
#endif
Modified: trunk/reactos/subsystems/win32/win32k/include/region.h URL: http://svn.reactos.ru/svn/reactos/trunk/reactos/subsystems/win32/win32k/incl... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/include/region.h (original) +++ trunk/reactos/subsystems/win32/win32k/include/region.h Sat Apr 1 19:25:40 2006 @@ -11,9 +11,9 @@ } ROSRGNDATA, *PROSRGNDATA, *LPROSRGNDATA;
-#define RGNDATA_FreeRgn(hRgn) GDIOBJ_FreeObj((HGDIOBJ)hRgn, GDI_OBJECT_TYPE_REGION) -#define RGNDATA_LockRgn(hRgn) ((PROSRGNDATA)GDIOBJ_LockObj((HGDIOBJ)hRgn, GDI_OBJECT_TYPE_REGION)) -#define RGNDATA_UnlockRgn(pRgn) GDIOBJ_UnlockObjByPtr(pRgn) +#define RGNDATA_FreeRgn(hRgn) GDIOBJ_FreeObj(GdiHandleTable, (HGDIOBJ)hRgn, GDI_OBJECT_TYPE_REGION) +#define RGNDATA_LockRgn(hRgn) ((PROSRGNDATA)GDIOBJ_LockObj(GdiHandleTable, (HGDIOBJ)hRgn, GDI_OBJECT_TYPE_REGION)) +#define RGNDATA_UnlockRgn(pRgn) GDIOBJ_UnlockObjByPtr(GdiHandleTable, pRgn) HRGN FASTCALL RGNDATA_AllocRgn(INT n); BOOL INTERNAL_CALL RGNDATA_Cleanup(PVOID ObjectBody);
Modified: trunk/reactos/subsystems/win32/win32k/include/ssec.h URL: http://svn.reactos.ru/svn/reactos/trunk/reactos/subsystems/win32/win32k/incl... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/include/ssec.h (original) +++ trunk/reactos/subsystems/win32/win32k/include/ssec.h Sat Apr 1 19:25:40 2006 @@ -1,73 +1,0 @@ -/* $Id$ - * - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS Win32k subsystem - * PURPOSE: shared sections - * FILE: include/ssec.h - * PROGRAMMER: Thomas Weidenmueller w3seek@reactos.com - * - */ - -#ifndef _WIN32K_SSEC_H -#define _WIN32K_SSEC_H - -typedef struct _SHARED_SECTION -{ - PSECTION_OBJECT SectionObject; - PVOID SystemMappedBase; - ULONG ViewSize; -} SHARED_SECTION, *PSHARED_SECTION; - -typedef struct _SHARED_SECTIONS_ARRAY -{ - struct _SHARED_SECTIONS_ARRAY *Next; - ULONG nEntries; - SHARED_SECTION SharedSection[0]; -} SHARED_SECTIONS_ARRAY, *PSHARED_SECTIONS_ARRAY; - -typedef struct _SHARED_SECTION_POOL -{ - FAST_MUTEX Lock; - ULONG PoolSize; - ULONG PoolFree; - ULONG SharedSectionCount; - SHARED_SECTIONS_ARRAY SectionsArray; -} SHARED_SECTION_POOL, *PSHARED_SECTION_POOL; - -NTSTATUS INTERNAL_CALL -IntUserCreateSharedSectionPool(IN ULONG MaximumPoolSize, - IN PSHARED_SECTION_POOL *SharedSectionPool); - -VOID INTERNAL_CALL -IntUserFreeSharedSectionPool(IN PSHARED_SECTION_POOL SharedSectionPool); - -NTSTATUS INTERNAL_CALL -InUserDeleteSharedSection(IN PSHARED_SECTION_POOL SharedSectionPool, - IN PVOID SystemMappedBase); - -NTSTATUS INTERNAL_CALL -IntUserCreateSharedSection(IN PSHARED_SECTION_POOL SharedSectionPool, - IN OUT PVOID *SystemMappedBase, - IN OUT ULONG *SharedSectionSize); - -NTSTATUS INTERNAL_CALL -IntUserMapSharedSection(IN PSHARED_SECTION_POOL SharedSectionPool, - IN PEPROCESS Process, - IN PVOID SystemMappedBase, - IN PLARGE_INTEGER SectionOffset OPTIONAL, - IN OUT PVOID *UserMappedBase, - IN PULONG ViewSize OPTIONAL, - IN BOOLEAN ReadOnly); - -NTSTATUS INTERNAL_CALL -IntUserUnMapSharedSection(IN PSHARED_SECTION_POOL SharedSectionPool, - IN PEPROCESS Process, - IN PVOID SystemMappedBase, - IN PVOID UserMappedBase); - -extern PSHARED_SECTION_POOL SessionSharedSectionPool; - -#endif /* ! defined(_WIN32K_SSEC_H) */ - -/* EOF */ -
Modified: trunk/reactos/subsystems/win32/win32k/include/text.h URL: http://svn.reactos.ru/svn/reactos/trunk/reactos/subsystems/win32/win32k/incl... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/include/text.h (original) +++ trunk/reactos/subsystems/win32/win32k/include/text.h Sat Apr 1 19:25:40 2006 @@ -12,10 +12,10 @@ /* Internal interface */
#define TEXTOBJ_AllocText() \ - ((HFONT) GDIOBJ_AllocObj (GDI_OBJECT_TYPE_FONT)) -#define TEXTOBJ_FreeText(hBMObj) GDIOBJ_FreeObj((HGDIOBJ) hBMObj, GDI_OBJECT_TYPE_FONT) -#define TEXTOBJ_LockText(hBMObj) ((PTEXTOBJ) GDIOBJ_LockObj ((HGDIOBJ) hBMObj, GDI_OBJECT_TYPE_FONT)) -#define TEXTOBJ_UnlockText(pBMObj) GDIOBJ_UnlockObjByPtr (pBMObj) + ((HFONT) GDIOBJ_AllocObj (GdiHandleTable, GDI_OBJECT_TYPE_FONT)) +#define TEXTOBJ_FreeText(hBMObj) GDIOBJ_FreeObj(GdiHandleTable, (HGDIOBJ) hBMObj, GDI_OBJECT_TYPE_FONT) +#define TEXTOBJ_LockText(hBMObj) ((PTEXTOBJ) GDIOBJ_LockObj (GdiHandleTable, (HGDIOBJ) hBMObj, GDI_OBJECT_TYPE_FONT)) +#define TEXTOBJ_UnlockText(pBMObj) GDIOBJ_UnlockObjByPtr (GdiHandleTable, pBMObj)
NTSTATUS FASTCALL TextIntRealizeFont(HFONT FontHandle); NTSTATUS FASTCALL TextIntCreateFontIndirect(CONST LPLOGFONTW lf, HFONT *NewFont);
Modified: trunk/reactos/subsystems/win32/win32k/include/win32k.h URL: http://svn.reactos.ru/svn/reactos/trunk/reactos/subsystems/win32/win32k/incl... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/include/win32k.h (original) +++ trunk/reactos/subsystems/win32/win32k/include/win32k.h Sat Apr 1 19:25:40 2006 @@ -14,7 +14,6 @@ /* Internal Win32k Headers */ #include <include/ntuser.h> #include <include/win32.h> -#include <include/ssec.h> #include <include/accelerator.h> #include <include/callback.h> #include <include/class.h>
Modified: trunk/reactos/subsystems/win32/win32k/main/dllmain.c URL: http://svn.reactos.ru/svn/reactos/trunk/reactos/subsystems/win32/win32k/main... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/main/dllmain.c (original) +++ trunk/reactos/subsystems/win32/win32k/main/dllmain.c Sat Apr 1 19:25:40 2006 @@ -27,13 +27,15 @@ #define NDEBUG #include <debug.h>
-BOOL INTERNAL_CALL GDI_CleanupForProcess (struct _EPROCESS *Process); +PGDI_HANDLE_TABLE INTERNAL_CALL GDIOBJ_iAllocHandleTable(OUT PSECTION_OBJECT *SectionObject); +BOOL INTERNAL_CALL GDI_CleanupForProcess (PGDI_HANDLE_TABLE HandleTable, struct _EPROCESS *Process); +/* FIXME */ +PGDI_HANDLE_TABLE GdiHandleTable = NULL; +PSECTION_OBJECT GdiTableSection = NULL;
extern ULONG_PTR Win32kSSDT[]; extern UCHAR Win32kSSPT[]; extern ULONG Win32kNumberOfSysCalls; - -PSHARED_SECTION_POOL SessionSharedSectionPool = NULL;
NTSTATUS STDCALL @@ -84,7 +86,7 @@ if(Process->Peb != NULL) { /* map the gdi handle table to user land */ - Process->Peb->GdiSharedHandleTable = GDI_MapHandleTable(Process); + Process->Peb->GdiSharedHandleTable = GDI_MapHandleTable(GdiTableSection, Process); }
/* setup process flags */ @@ -102,7 +104,7 @@ /* no process windows should exist at this point, or the function will assert! */ DestroyProcessClasses(Win32Process);
- GDI_CleanupForProcess(Process); + GDI_CleanupForProcess(GdiHandleTable, Process);
co_IntGraphicsCheck(FALSE);
@@ -340,13 +342,6 @@ */ PsEstablishWin32Callouts(&CalloutData);
- Status = IntUserCreateSharedSectionPool(48 * 1024 * 1024, /* 48 MB by default */ - &SessionSharedSectionPool); - if (!NT_SUCCESS(Status)) - { - DPRINT1("Failed to initialize the shared section pool: Status 0x%x\n", Status); - } - Status = InitUserImpl(); if (!NT_SUCCESS(Status)) { @@ -445,7 +440,12 @@ return(Status); }
- InitGdiObjectHandleTable (); + GdiHandleTable = GDIOBJ_iAllocHandleTable(&GdiTableSection); + if (GdiHandleTable == NULL) + { + DPRINT1("Failed to initialize the GDI handle table.\n"); + return STATUS_UNSUCCESSFUL; + }
/* Initialize FreeType library */ if (! InitFontSupport())
Modified: trunk/reactos/subsystems/win32/win32k/ntddraw/ddraw.c URL: http://svn.reactos.ru/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntdd... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntddraw/ddraw.c (original) +++ trunk/reactos/subsystems/win32/win32k/ntddraw/ddraw.c Sat Apr 1 19:25:40 2006 @@ -15,6 +15,8 @@
/* swtich this off to get rid of all dx debug msg */ #define DX_DEBUG + +#define DdHandleTable GdiHandleTable
/************************************************************************/ @@ -95,7 +97,7 @@ return NULL; }
- hDirectDraw = GDIOBJ_AllocObj(GDI_OBJECT_TYPE_DIRECTDRAW); + hDirectDraw = GDIOBJ_AllocObj(DdHandleTable, GDI_OBJECT_TYPE_DIRECTDRAW); if (!hDirectDraw) { /* No more memmory */ @@ -106,7 +108,7 @@ return NULL; }
- pDirectDraw = GDIOBJ_LockObj(hDirectDraw, GDI_OBJECT_TYPE_DIRECTDRAW); + pDirectDraw = GDIOBJ_LockObj(DdHandleTable, hDirectDraw, GDI_OBJECT_TYPE_DIRECTDRAW); if (!pDirectDraw) { /* invalid handle */ @@ -133,7 +135,7 @@ /* DD_PALETTECALLBACKS setup*/ RtlMoveMemory(&pDirectDraw->Pal, &surface_callbacks, sizeof(DD_PALETTECALLBACKS)); - GDIOBJ_UnlockObjByPtr(pDirectDraw); + GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw); DC_UnlockDc(pDC);
return hDirectDraw; @@ -146,7 +148,7 @@ #ifdef DX_DEBUG DPRINT1("NtGdiDdDeleteDirectDrawObject\n"); #endif - return GDIOBJ_FreeObj(hDirectDrawLocal, GDI_OBJECT_TYPE_DIRECTDRAW); + return GDIOBJ_FreeObj(DdHandleTable, hDirectDrawLocal, GDI_OBJECT_TYPE_DIRECTDRAW); }
BOOL STDCALL NtGdiDdQueryDirectDrawObject( @@ -201,7 +203,7 @@ }
- pDirectDraw = GDIOBJ_LockObj(hDirectDrawLocal, GDI_OBJECT_TYPE_DIRECTDRAW); + pDirectDraw = GDIOBJ_LockObj(DdHandleTable, hDirectDrawLocal, GDI_OBJECT_TYPE_DIRECTDRAW); if (!pDirectDraw) @@ -226,7 +228,7 @@ #ifdef DX_DEBUG DPRINT1(" Fail to get DirectDraw driver info \n"); #endif - GDIOBJ_UnlockObjByPtr(pDirectDraw); + GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw); return FALSE; }
@@ -351,7 +353,7 @@ } #endif
- GDIOBJ_UnlockObjByPtr(pDirectDraw); + GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw);
return TRUE; } @@ -364,7 +366,7 @@ { DWORD ddRVal = 0;
- PDD_DIRECTDRAW pDirectDraw = GDIOBJ_LockObj(hDirectDrawLocal, GDI_OBJECT_TYPE_DIRECTDRAW); + PDD_DIRECTDRAW pDirectDraw = GDIOBJ_LockObj(DdHandleTable, hDirectDrawLocal, GDI_OBJECT_TYPE_DIRECTDRAW); #ifdef DX_DEBUG DPRINT1("NtGdiDdGetDriverInfo\n"); #endif @@ -397,7 +399,7 @@ else ddRVal = pDirectDraw->Hal.GetDriverInfo(puGetDriverInfoData);
- GDIOBJ_UnlockObjByPtr(pDirectDraw); + GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw);
return ddRVal; } @@ -425,7 +427,7 @@ DPRINT1("NtGdiDdCreateSurface\n"); #endif
- pDirectDraw = GDIOBJ_LockObj(hDirectDrawLocal, GDI_OBJECT_TYPE_DIRECTDRAW); + pDirectDraw = GDIOBJ_LockObj(DdHandleTable, hDirectDrawLocal, GDI_OBJECT_TYPE_DIRECTDRAW); if (pDirectDraw == NULL) { #ifdef DX_DEBUG @@ -456,7 +458,7 @@ /* But back the orignal PDev */ puCreateSurfaceData->lpDD = lgpl;
- GDIOBJ_UnlockObjByPtr(pDirectDraw); + GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw); return ddRVal; }
@@ -473,7 +475,7 @@ #endif
- pDirectDraw = GDIOBJ_LockObj(hDirectDrawLocal, GDI_OBJECT_TYPE_DIRECTDRAW); + pDirectDraw = GDIOBJ_LockObj(DdHandleTable, hDirectDrawLocal, GDI_OBJECT_TYPE_DIRECTDRAW); if (pDirectDraw == NULL) return DDHAL_DRIVER_NOTHANDLED;
@@ -492,7 +494,7 @@ /* But back the orignal PDev */ puWaitForVerticalBlankData->lpDD = lgpl;
- GDIOBJ_UnlockObjByPtr(pDirectDraw); + GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw); return ddRVal; }
@@ -504,7 +506,7 @@ DWORD ddRVal; PDD_DIRECTDRAW_GLOBAL lgpl;
- PDD_DIRECTDRAW pDirectDraw = GDIOBJ_LockObj(hDirectDrawLocal, GDI_OBJECT_TYPE_DIRECTDRAW); + PDD_DIRECTDRAW pDirectDraw = GDIOBJ_LockObj(DdHandleTable, hDirectDrawLocal, GDI_OBJECT_TYPE_DIRECTDRAW); #ifdef DX_DEBUG DPRINT1("NtGdiDdCanCreateSurface\n"); #endif @@ -526,7 +528,7 @@ /* But back the orignal PDev */ puCanCreateSurfaceData->lpDD = lgpl;
- GDIOBJ_UnlockObjByPtr(pDirectDraw); + GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw); return ddRVal; }
@@ -538,7 +540,7 @@ DWORD ddRVal; PDD_DIRECTDRAW_GLOBAL lgpl;
- PDD_DIRECTDRAW pDirectDraw = GDIOBJ_LockObj(hDirectDrawLocal, GDI_OBJECT_TYPE_DIRECTDRAW); + PDD_DIRECTDRAW pDirectDraw = GDIOBJ_LockObj(DdHandleTable, hDirectDrawLocal, GDI_OBJECT_TYPE_DIRECTDRAW); #ifdef DX_DEBUG DPRINT1("NtGdiDdGetScanLine\n"); #endif @@ -560,7 +562,7 @@ /* But back the orignal PDev */ puGetScanLineData->lpDD = lgpl;
- GDIOBJ_UnlockObjByPtr(pDirectDraw); + GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw); return ddRVal; }
@@ -579,7 +581,7 @@ { DWORD ddRVal = DDHAL_DRIVER_NOTHANDLED;
- PDD_DIRECTDRAW pDirectDraw = GDIOBJ_LockObj(hSurface, GDI_OBJECT_TYPE_DIRECTDRAW); + PDD_DIRECTDRAW pDirectDraw = GDIOBJ_LockObj(DdHandleTable, hSurface, GDI_OBJECT_TYPE_DIRECTDRAW); #ifdef DX_DEBUG DPRINT1("NtGdiDdDestroySurface\n"); #endif @@ -605,7 +607,7 @@ }
- GDIOBJ_UnlockObjByPtr(pDirectDraw); + GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw); return ddRVal; }
@@ -620,7 +622,7 @@ DWORD ddRVal; PDD_DIRECTDRAW_GLOBAL lgpl;
- PDD_DIRECTDRAW pDirectDraw = GDIOBJ_LockObj(hSurfaceTarget, GDI_OBJECT_TYPE_DIRECTDRAW); + PDD_DIRECTDRAW pDirectDraw = GDIOBJ_LockObj(DdHandleTable, hSurfaceTarget, GDI_OBJECT_TYPE_DIRECTDRAW); #ifdef DX_DEBUG DPRINT1("NtGdiDdFlip\n"); #endif @@ -643,7 +645,7 @@ /* But back the orignal PDev */ puFlipData->lpDD = lgpl;
- GDIOBJ_UnlockObjByPtr(pDirectDraw); + GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw); return ddRVal; }
@@ -656,7 +658,7 @@ DWORD ddRVal; PDD_DIRECTDRAW_GLOBAL lgpl;
- PDD_DIRECTDRAW pDirectDraw = GDIOBJ_LockObj(hSurface, GDI_OBJECT_TYPE_DIRECTDRAW); + PDD_DIRECTDRAW pDirectDraw = GDIOBJ_LockObj(DdHandleTable, hSurface, GDI_OBJECT_TYPE_DIRECTDRAW); #ifdef DX_DEBUG DPRINT1("NtGdiDdLock\n"); #endif @@ -678,7 +680,7 @@ /* But back the orignal PDev */ puLockData->lpDD = lgpl;
- GDIOBJ_UnlockObjByPtr(pDirectDraw); + GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw); return ddRVal; }
@@ -690,7 +692,7 @@ DWORD ddRVal; PDD_DIRECTDRAW_GLOBAL lgpl;
- PDD_DIRECTDRAW pDirectDraw = GDIOBJ_LockObj(hSurface, GDI_OBJECT_TYPE_DIRECTDRAW); + PDD_DIRECTDRAW pDirectDraw = GDIOBJ_LockObj(DdHandleTable, hSurface, GDI_OBJECT_TYPE_DIRECTDRAW); #ifdef DX_DEBUG DPRINT1("NtGdiDdUnlock\n"); #endif @@ -712,7 +714,7 @@ /* But back the orignal PDev */ puUnlockData->lpDD = lgpl;
- GDIOBJ_UnlockObjByPtr(pDirectDraw); + GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw); return ddRVal; }
@@ -725,7 +727,7 @@ DWORD ddRVal; PDD_DIRECTDRAW_GLOBAL lgpl;
- PDD_DIRECTDRAW pDirectDraw = GDIOBJ_LockObj(hSurfaceDest, GDI_OBJECT_TYPE_DIRECTDRAW); + PDD_DIRECTDRAW pDirectDraw = GDIOBJ_LockObj(DdHandleTable, hSurfaceDest, GDI_OBJECT_TYPE_DIRECTDRAW); #ifdef DX_DEBUG DPRINT1("NtGdiDdBlt\n"); #endif @@ -747,7 +749,7 @@ /* But back the orignal PDev */ puBltData->lpDD = lgpl;
- GDIOBJ_UnlockObjByPtr(pDirectDraw); + GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw); return ddRVal; }
@@ -759,7 +761,7 @@ DWORD ddRVal; PDD_DIRECTDRAW_GLOBAL lgpl;
- PDD_DIRECTDRAW pDirectDraw = GDIOBJ_LockObj(hSurface, GDI_OBJECT_TYPE_DIRECTDRAW); + PDD_DIRECTDRAW pDirectDraw = GDIOBJ_LockObj(DdHandleTable, hSurface, GDI_OBJECT_TYPE_DIRECTDRAW); #ifdef DX_DEBUG DPRINT1("NtGdiDdSetColorKey\n"); #endif @@ -781,7 +783,7 @@ /* But back the orignal PDev */ puSetColorKeyData->lpDD = lgpl;
- GDIOBJ_UnlockObjByPtr(pDirectDraw); + GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw); return ddRVal; }
@@ -795,7 +797,7 @@ DWORD ddRVal; PDD_DIRECTDRAW_GLOBAL lgpl;
- PDD_DIRECTDRAW pDirectDraw = GDIOBJ_LockObj(hSurfaceAttached, GDI_OBJECT_TYPE_DIRECTDRAW); + PDD_DIRECTDRAW pDirectDraw = GDIOBJ_LockObj(DdHandleTable, hSurfaceAttached, GDI_OBJECT_TYPE_DIRECTDRAW); #ifdef DX_DEBUG DPRINT1("NtGdiDdAddAttachedSurface\n"); #endif @@ -817,7 +819,7 @@ /* But back the orignal PDev */ puAddAttachedSurfaceData->lpDD = lgpl;
- GDIOBJ_UnlockObjByPtr(pDirectDraw); + GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw); return ddRVal; }
@@ -829,7 +831,7 @@ DWORD ddRVal; PDD_DIRECTDRAW_GLOBAL lgpl;
- PDD_DIRECTDRAW pDirectDraw = GDIOBJ_LockObj(hSurface, GDI_OBJECT_TYPE_DIRECTDRAW); + PDD_DIRECTDRAW pDirectDraw = GDIOBJ_LockObj(DdHandleTable, hSurface, GDI_OBJECT_TYPE_DIRECTDRAW); #ifdef DX_DEBUG DPRINT1("NtGdiDdGetBltStatus\n"); #endif @@ -851,7 +853,7 @@ /* But back the orignal PDev */ puGetBltStatusData->lpDD = lgpl;
- GDIOBJ_UnlockObjByPtr(pDirectDraw); + GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw); return ddRVal; }
@@ -863,7 +865,7 @@ DWORD ddRVal; PDD_DIRECTDRAW_GLOBAL lgpl;
- PDD_DIRECTDRAW pDirectDraw = GDIOBJ_LockObj(hSurface, GDI_OBJECT_TYPE_DIRECTDRAW); + PDD_DIRECTDRAW pDirectDraw = GDIOBJ_LockObj(DdHandleTable, hSurface, GDI_OBJECT_TYPE_DIRECTDRAW); #ifdef DX_DEBUG DPRINT1("NtGdiDdGetFlipStatus\n"); #endif @@ -885,7 +887,7 @@ /* But back the orignal PDev */ puGetFlipStatusData->lpDD = lgpl;
- GDIOBJ_UnlockObjByPtr(pDirectDraw); + GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw); return ddRVal; }
@@ -898,7 +900,7 @@ DWORD ddRVal; PDD_DIRECTDRAW_GLOBAL lgpl;
- PDD_DIRECTDRAW pDirectDraw = GDIOBJ_LockObj(hSurfaceDestination, GDI_OBJECT_TYPE_DIRECTDRAW); + PDD_DIRECTDRAW pDirectDraw = GDIOBJ_LockObj(DdHandleTable, hSurfaceDestination, GDI_OBJECT_TYPE_DIRECTDRAW); #ifdef DX_DEBUG DPRINT1("NtGdiDdUpdateOverlay\n"); #endif @@ -920,7 +922,7 @@ /* But back the orignal PDev */ puUpdateOverlayData->lpDD = lgpl;
- GDIOBJ_UnlockObjByPtr(pDirectDraw); + GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw); return ddRVal; }
@@ -933,7 +935,7 @@ DWORD ddRVal; PDD_DIRECTDRAW_GLOBAL lgpl;
- PDD_DIRECTDRAW pDirectDraw = GDIOBJ_LockObj(hSurfaceDestination, GDI_OBJECT_TYPE_DIRECTDRAW); + PDD_DIRECTDRAW pDirectDraw = GDIOBJ_LockObj(DdHandleTable, hSurfaceDestination, GDI_OBJECT_TYPE_DIRECTDRAW); #ifdef DX_DEBUG DPRINT1("NtGdiDdSetOverlayPosition\n"); #endif @@ -955,7 +957,7 @@ /* But back the orignal PDev */ puSetOverlayPositionData->lpDD = lgpl;
- GDIOBJ_UnlockObjByPtr(pDirectDraw); + GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw); return ddRVal; }
@@ -985,7 +987,7 @@ BOOL bComplete ) { - PDD_DIRECTDRAW pDirectDraw = GDIOBJ_LockObj(hDirectDrawLocal, GDI_OBJECT_TYPE_DIRECTDRAW); + PDD_DIRECTDRAW pDirectDraw = GDIOBJ_LockObj(DdHandleTable, hDirectDrawLocal, GDI_OBJECT_TYPE_DIRECTDRAW); PDD_SURFACE pSurface; #ifdef DX_DEBUG DPRINT1("NtGdiDdCreateSurfaceObject\n"); @@ -994,9 +996,9 @@ return NULL;
if (!hSurface) - hSurface = GDIOBJ_AllocObj(GDI_OBJECT_TYPE_DD_SURFACE); - - pSurface = GDIOBJ_LockObj(hSurface, GDI_OBJECT_TYPE_DD_SURFACE); + hSurface = GDIOBJ_AllocObj(DdHandleTable, GDI_OBJECT_TYPE_DD_SURFACE); + + pSurface = GDIOBJ_LockObj(DdHandleTable, hSurface, GDI_OBJECT_TYPE_DD_SURFACE); /* FIXME - Handle pSurface == NULL!!!! */
RtlMoveMemory(&pSurface->Local, puSurfaceLocal, sizeof(DD_SURFACE_LOCAL)); @@ -1010,8 +1012,8 @@ // FIXME: figure out how to use this pSurface->bComplete = bComplete;
- GDIOBJ_UnlockObjByPtr(pSurface); - GDIOBJ_UnlockObjByPtr(pDirectDraw); + GDIOBJ_UnlockObjByPtr(DdHandleTable, pSurface); + GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw);
return hSurface; } @@ -1026,7 +1028,7 @@ /* FIXME add right GDI_OBJECT_TYPE_ for everthing for now we are using same type */ /* return GDIOBJ_FreeObj(hSurface, GDI_OBJECT_TYPE_DD_SURFACE); */ - return GDIOBJ_FreeObj(hSurface, GDI_OBJECT_TYPE_DD_SURFACE); + return GDIOBJ_FreeObj(DdHandleTable, hSurface, GDI_OBJECT_TYPE_DD_SURFACE); }
@@ -1072,7 +1074,7 @@ DWORD ddRVal = DDHAL_DRIVER_NOTHANDLED; PDD_DIRECTDRAW_GLOBAL lgpl;
- PDD_DIRECTDRAW pDirectDraw = GDIOBJ_LockObj(hDirectDrawLocal, GDI_OBJECT_TYPE_DIRECTDRAW); + PDD_DIRECTDRAW pDirectDraw = GDIOBJ_LockObj(DdHandleTable, hDirectDrawLocal, GDI_OBJECT_TYPE_DIRECTDRAW); #ifdef DX_DEBUG DPRINT1("NtGdiDdGetAvailDriverMemory\n"); #endif @@ -1086,7 +1088,7 @@ /* make the call */ // ddRVal = pDirectDraw->DdGetAvailDriverMemory(puGetAvailDriverMemoryData);
- GDIOBJ_UnlockObjByPtr(pDirectDraw); + GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw);
/* But back the orignal PDev */ @@ -1106,7 +1108,7 @@ DWORD ddRVal; PDD_DIRECTDRAW_GLOBAL lgpl;
- PDD_DIRECTDRAW pDirectDraw = GDIOBJ_LockObj(hDirectDraw, GDI_OBJECT_TYPE_DIRECTDRAW); + PDD_DIRECTDRAW pDirectDraw = GDIOBJ_LockObj(DdHandleTable, hDirectDraw, GDI_OBJECT_TYPE_DIRECTDRAW);
#ifdef DX_DEBUG DPRINT1("NtGdiDdSetExclusiveMode\n"); @@ -1121,7 +1123,7 @@ /* make the call */ ddRVal = pDirectDraw->DdSetExclusiveMode(puSetExclusiveModeData);
- GDIOBJ_UnlockObjByPtr(pDirectDraw); + GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw);
/* But back the orignal PDev */ puSetExclusiveModeData->lpDD = lgpl;
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/cursoricon.c URL: http://svn.reactos.ru/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntus... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/cursoricon.c (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/cursoricon.c Sat Apr 1 19:25:40 2006 @@ -490,12 +490,12 @@ /* delete bitmaps */ if(bmpMask) { - GDIOBJ_SetOwnership(bmpMask, PsGetCurrentProcess()); + GDIOBJ_SetOwnership(GdiHandleTable, bmpMask, PsGetCurrentProcess()); NtGdiDeleteObject(bmpMask); } if(bmpColor) { - GDIOBJ_SetOwnership(bmpColor, PsGetCurrentProcess()); + GDIOBJ_SetOwnership(GdiHandleTable, bmpColor, PsGetCurrentProcess()); NtGdiDeleteObject(bmpColor); }
@@ -587,7 +587,7 @@ CurIcon->Size.cx = bmp->SurfObj.sizlBitmap.cx; CurIcon->Size.cy = bmp->SurfObj.sizlBitmap.cy; BITMAPOBJ_UnlockBitmap(bmp); - GDIOBJ_SetOwnership(CurIcon->IconInfo.hbmColor, NULL); + GDIOBJ_SetOwnership(GdiHandleTable, CurIcon->IconInfo.hbmColor, NULL); } if(CurIcon->IconInfo.hbmMask && (bmp = BITMAPOBJ_LockBitmap(CurIcon->IconInfo.hbmMask))) @@ -598,7 +598,7 @@ CurIcon->Size.cy = bmp->SurfObj.sizlBitmap.cy / 2; } BITMAPOBJ_UnlockBitmap(bmp); - GDIOBJ_SetOwnership(CurIcon->IconInfo.hbmMask, NULL); + GDIOBJ_SetOwnership(GdiHandleTable, CurIcon->IconInfo.hbmMask, NULL); } } else @@ -1142,7 +1142,7 @@ CurIcon->Size.cx = bmp->SurfObj.sizlBitmap.cx; CurIcon->Size.cy = bmp->SurfObj.sizlBitmap.cy; BITMAPOBJ_UnlockBitmap(bmp); - GDIOBJ_SetOwnership(CurIcon->IconInfo.hbmColor, NULL); + GDIOBJ_SetOwnership(GdiHandleTable, CurIcon->IconInfo.hbmColor, NULL); } else { @@ -1154,7 +1154,7 @@ CurIcon->Size.cy = bmp->SurfObj.sizlBitmap.cy / 2;
BITMAPOBJ_UnlockBitmap(bmp); - GDIOBJ_SetOwnership(CurIcon->IconInfo.hbmMask, NULL); + GDIOBJ_SetOwnership(GdiHandleTable, CurIcon->IconInfo.hbmMask, NULL); }
Ret = TRUE;
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/misc.c URL: http://svn.reactos.ru/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntus... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/misc.c (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/misc.c Sat Apr 1 19:25:40 2006 @@ -1052,7 +1052,7 @@ BITMAPOBJ_UnlockBitmap(bmp);
/* change the bitmap's ownership */ - GDIOBJ_SetOwnership(hNewBitmap, NULL); + GDIOBJ_SetOwnership(GdiHandleTable, hNewBitmap, NULL); } hOldBitmap = (HBITMAP)InterlockedExchange((LONG*)&WinStaObject->hbmWallpaper, (LONG)hNewBitmap); if(hOldBitmap != NULL)
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/painting.c URL: http://svn.reactos.ru/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntus... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/painting.c (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/painting.c Sat Apr 1 19:25:40 2006 @@ -194,7 +194,7 @@ if (NtGdiCombineRgn(Window->UpdateRegion, Window->UpdateRegion, hRgnWindow, RGN_AND) == NULLREGION) { - GDIOBJ_SetOwnership(Window->UpdateRegion, PsGetCurrentProcess()); + GDIOBJ_SetOwnership(GdiHandleTable, Window->UpdateRegion, PsGetCurrentProcess()); NtGdiDeleteObject(Window->UpdateRegion); Window->UpdateRegion = NULL; if (!(Window->Flags & WINDOWOBJECT_NEED_INTERNALPAINT)) @@ -251,7 +251,7 @@ if ((HANDLE) 1 != TempRegion && NULL != TempRegion) { /* NOTE: The region can already be deleted! */ - GDIOBJ_FreeObj(TempRegion, GDI_OBJECT_TYPE_REGION | GDI_OBJECT_TYPE_SILENT); + GDIOBJ_FreeObj(GdiHandleTable, TempRegion, GDI_OBJECT_TYPE_REGION | GDI_OBJECT_TYPE_SILENT); } }
@@ -372,13 +372,13 @@ if (Window->UpdateRegion == NULL) { Window->UpdateRegion = NtGdiCreateRectRgn(0, 0, 0, 0); - GDIOBJ_SetOwnership(Window->UpdateRegion, NULL); + GDIOBJ_SetOwnership(GdiHandleTable, Window->UpdateRegion, NULL); }
if (NtGdiCombineRgn(Window->UpdateRegion, Window->UpdateRegion, hRgn, RGN_OR) == NULLREGION) { - GDIOBJ_SetOwnership(Window->UpdateRegion, PsGetCurrentProcess()); + GDIOBJ_SetOwnership(GdiHandleTable, Window->UpdateRegion, PsGetCurrentProcess()); NtGdiDeleteObject(Window->UpdateRegion); Window->UpdateRegion = NULL; } @@ -398,7 +398,7 @@ if (NtGdiCombineRgn(Window->UpdateRegion, Window->UpdateRegion, hRgn, RGN_DIFF) == NULLREGION) { - GDIOBJ_SetOwnership(Window->UpdateRegion, PsGetCurrentProcess()); + GDIOBJ_SetOwnership(GdiHandleTable, Window->UpdateRegion, PsGetCurrentProcess()); NtGdiDeleteObject(Window->UpdateRegion); Window->UpdateRegion = NULL; } @@ -761,7 +761,7 @@ if (hRgn != (HANDLE)1 && hRgn != NULL) { /* NOTE: The region can already by deleted! */ - GDIOBJ_FreeObj(hRgn, GDI_OBJECT_TYPE_REGION | GDI_OBJECT_TYPE_SILENT); + GDIOBJ_FreeObj(GdiHandleTable, hRgn, GDI_OBJECT_TYPE_REGION | GDI_OBJECT_TYPE_SILENT); } }
@@ -793,7 +793,7 @@ { IntGetClientRect(Window, &Ps.rcPaint); } - GDIOBJ_SetOwnership(Window->UpdateRegion, PsGetCurrentProcess()); + GDIOBJ_SetOwnership(GdiHandleTable, Window->UpdateRegion, PsGetCurrentProcess()); Window->UpdateRegion = NULL; } else
Removed: trunk/reactos/subsystems/win32/win32k/ntuser/ssec.c URL: http://svn.reactos.ru/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntus... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/ssec.c (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/ssec.c (removed) @@ -1,421 +1,0 @@ -/* - * ReactOS W32 Subsystem - * Copyright (C) 1998 - 2005 ReactOS Team - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ -/* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * PURPOSE: shared sections support - * FILE: subsys/win32k/misc/ssec.c - * PROGRAMER: Thomas Weidenmueller w3seek@reactos.com - */ - -#include <w32k.h> - -#define NDEBUG -#include <debug.h> - -/* - * FIXME - instead of mapping the memory into system space using - * MmMapViewInSystemSpace() we should rather use - * MmMapViewInSessionSpace() to map it into session space! - */ - -NTSTATUS INTERNAL_CALL -IntUserCreateSharedSectionPool(IN ULONG MaximumPoolSize, - IN PSHARED_SECTION_POOL *SharedSectionPool) -{ - PSHARED_SECTION_POOL Pool; - ULONG PoolStructSize; - - ASSERT(SharedSectionPool); - - PoolStructSize = ROUND_UP(sizeof(SHARED_SECTION_POOL), PAGE_SIZE); - Pool = ExAllocatePoolWithTag(NonPagedPool, - PoolStructSize, - TAG_SSECTPOOL); - if(Pool != NULL) - { - RtlZeroMemory(Pool, PoolStructSize); - - /* initialize the session heap */ - ExInitializeFastMutex(&Pool->Lock); - Pool->PoolSize = ROUND_UP(MaximumPoolSize, PAGE_SIZE); - Pool->PoolFree = Pool->PoolSize; - Pool->SharedSectionCount = 0; - Pool->SectionsArray.Next = NULL; - Pool->SectionsArray.nEntries = ((PoolStructSize - sizeof(SHARED_SECTION_POOL)) / - sizeof(SHARED_SECTION)) - 1; - - ASSERT(Pool->SectionsArray.nEntries > 0); - - *SharedSectionPool = Pool; - - return STATUS_SUCCESS; - } - - return STATUS_INSUFFICIENT_RESOURCES; -} - - -VOID INTERNAL_CALL -IntUserFreeSharedSectionPool(IN PSHARED_SECTION_POOL SharedSectionPool) -{ - PSHARED_SECTIONS_ARRAY Array, OldArray; - PSHARED_SECTION SharedSection, LastSharedSection; - - ASSERT(SharedSectionPool); - - Array = &SharedSectionPool->SectionsArray; - - ExEnterCriticalRegionAndAcquireFastMutexUnsafe(&SharedSectionPool->Lock); - while(SharedSectionPool->SharedSectionCount > 0 && Array != NULL) - { - for(SharedSection = Array->SharedSection, LastSharedSection = SharedSection + Array->nEntries; - SharedSection != LastSharedSection && SharedSectionPool->SharedSectionCount > 0; - SharedSection++) - { - if(SharedSection->SectionObject != NULL) - { - ASSERT(SharedSection->SystemMappedBase); - - /* FIXME - use MmUnmapViewInSessionSpace() once implemented! */ - MmUnmapViewInSystemSpace(SharedSection->SystemMappedBase); - /* dereference the keep-alive reference so the section get's deleted */ - ObDereferenceObject(SharedSection->SectionObject); - - SharedSectionPool->SharedSectionCount--; - } - } - - OldArray = Array; - Array = Array->Next; - - /* all shared sections in this array were freed, link the following array to - the main session heap and free this array */ - SharedSectionPool->SectionsArray.Next = Array; - ExFreePool(OldArray); - } - - ASSERT(SharedSectionPool->SectionsArray.Next == NULL); - ASSERT(SharedSectionPool->SharedSectionCount == 0); - - ExReleaseFastMutexUnsafeAndLeaveCriticalRegion(&SharedSectionPool->Lock); -} - - -NTSTATUS INTERNAL_CALL -IntUserCreateSharedSection(IN PSHARED_SECTION_POOL SharedSectionPool, - IN OUT PVOID *SystemMappedBase, - IN OUT ULONG *SharedSectionSize) -{ - PSHARED_SECTIONS_ARRAY Array, LastArray; - PSHARED_SECTION FreeSharedSection, SharedSection, LastSharedSection; - LARGE_INTEGER SectionSize; - ULONG Size; - NTSTATUS Status; - - ASSERT(SharedSectionPool && SharedSectionSize && (*SharedSectionSize) > 0 && SystemMappedBase); - - FreeSharedSection = NULL; - - Size = ROUND_UP(*SharedSectionSize, PAGE_SIZE); - - ExEnterCriticalRegionAndAcquireFastMutexUnsafe(&SharedSectionPool->Lock); - - if(Size > SharedSectionPool->PoolFree) - { - ExReleaseFastMutexUnsafeAndLeaveCriticalRegion(&SharedSectionPool->Lock); - DPRINT1("Shared Section Pool limit (0x%x KB) reached, attempted to allocate a 0x%x KB shared section!\n", - SharedSectionPool->PoolSize / 1024, (*SharedSectionSize) / 1024); - return STATUS_INSUFFICIENT_RESOURCES; - } - - /* walk the array to find a free entry */ - for(Array = &SharedSectionPool->SectionsArray, LastArray = Array; - Array != NULL && FreeSharedSection == NULL; - Array = Array->Next) - { - LastArray = Array; - - for(SharedSection = Array->SharedSection, LastSharedSection = SharedSection + Array->nEntries; - SharedSection != LastSharedSection; - SharedSection++) - { - if(SharedSection->SectionObject == NULL) - { - FreeSharedSection = SharedSection; - break; - } - } - - if(Array->Next != NULL) - { - LastArray = Array; - } - } - - ASSERT(LastArray); - - if(FreeSharedSection == NULL) - { - ULONG nNewEntries; - PSHARED_SECTIONS_ARRAY NewArray; - - ASSERT(LastArray->Next == NULL); - - /* couldn't find a free entry in the array, extend the array */ - - nNewEntries = ((PAGE_SIZE - sizeof(SHARED_SECTIONS_ARRAY)) / sizeof(SHARED_SECTION)) + 1; - NewArray = ExAllocatePoolWithTag(NonPagedPool, - sizeof(SHARED_SECTIONS_ARRAY) + ((nNewEntries - 1) * - sizeof(SHARED_SECTION)), - TAG_SSECTPOOL); - if(NewArray == NULL) - { - ExReleaseFastMutexUnsafeAndLeaveCriticalRegion(&SharedSectionPool->Lock); - DPRINT1("Failed to allocate new array for shared sections!\n"); - return STATUS_INSUFFICIENT_RESOURCES; - } - - NewArray->nEntries = nNewEntries; - NewArray->Next = NULL; - LastArray->Next = NewArray; - - Array = NewArray; - FreeSharedSection = &Array->SharedSection[0]; - } - - ASSERT(FreeSharedSection); - - /* now allocate a real section */ - - SectionSize.QuadPart = Size; - Status = MmCreateSection((PVOID)&FreeSharedSection->SectionObject, - SECTION_ALL_ACCESS, - NULL, - &SectionSize, - PAGE_EXECUTE_READWRITE, - SEC_COMMIT, - NULL, - NULL); - if(NT_SUCCESS(Status)) - { - Status = MmMapViewInSystemSpace(FreeSharedSection->SectionObject, - &FreeSharedSection->SystemMappedBase, - &FreeSharedSection->ViewSize); - if(NT_SUCCESS(Status)) - { - (*SharedSectionSize) -= Size; - SharedSectionPool->SharedSectionCount++; - - *SystemMappedBase = FreeSharedSection->SystemMappedBase; - *SharedSectionSize = FreeSharedSection->ViewSize; - } - else - { - ObDereferenceObject(FreeSharedSection->SectionObject); - FreeSharedSection->SectionObject = NULL; - DPRINT1("Failed to map the shared section into system space! Status 0x%x\n", Status); - } - } - - ExReleaseFastMutexUnsafeAndLeaveCriticalRegion(&SharedSectionPool->Lock); - - return Status; -} - - -NTSTATUS INTERNAL_CALL -InUserDeleteSharedSection(PSHARED_SECTION_POOL SharedSectionPool, - PVOID SystemMappedBase) -{ - PSHARED_SECTIONS_ARRAY Array; - PSECTION_OBJECT SectionObject; - PSHARED_SECTION SharedSection, LastSharedSection; - NTSTATUS Status; - - ASSERT(SharedSectionPool && SystemMappedBase); - - SectionObject = NULL; - - ExEnterCriticalRegionAndAcquireFastMutexUnsafe(&SharedSectionPool->Lock); - - for(Array = &SharedSectionPool->SectionsArray; - Array != NULL && SectionObject == NULL; - Array = Array->Next) - { - for(SharedSection = Array->SharedSection, LastSharedSection = SharedSection + Array->nEntries; - SharedSection != LastSharedSection; - SharedSection++) - { - if(SharedSection->SystemMappedBase == SystemMappedBase) - { - SectionObject = SharedSection->SectionObject; - SharedSection->SectionObject = NULL; - SharedSection->SystemMappedBase = NULL; - - ASSERT(SharedSectionPool->SharedSectionCount > 0); - SharedSectionPool->SharedSectionCount--; - break; - } - } - } - - ExReleaseFastMutexUnsafeAndLeaveCriticalRegion(&SharedSectionPool->Lock); - - if(SectionObject != NULL) - { - Status = MmUnmapViewInSystemSpace(SystemMappedBase); - ObDereferenceObject(SectionObject); - } - else - { - DPRINT1("Couldn't find and delete a shared section with SystemMappedBase=0x%x!\n", SystemMappedBase); - Status = STATUS_UNSUCCESSFUL; - } - - return Status; -} - - -NTSTATUS INTERNAL_CALL -IntUserMapSharedSection(IN PSHARED_SECTION_POOL SharedSectionPool, - IN PEPROCESS Process, - IN PVOID SystemMappedBase, - IN PLARGE_INTEGER SectionOffset OPTIONAL, - IN OUT PVOID *UserMappedBase, - IN PULONG ViewSize OPTIONAL, - IN BOOLEAN ReadOnly) -{ - PSHARED_SECTIONS_ARRAY Array; - PSECTION_OBJECT SectionObject; - PSHARED_SECTION SharedSection, LastSharedSection; - NTSTATUS Status; - - ASSERT(SharedSectionPool && Process && SystemMappedBase && UserMappedBase); - - SectionObject = NULL; - SharedSection = NULL; - - ExEnterCriticalRegionAndAcquireFastMutexUnsafe(&SharedSectionPool->Lock); - - for(Array = &SharedSectionPool->SectionsArray; - Array != NULL && SectionObject == NULL; - Array = Array->Next) - { - for(SharedSection = Array->SharedSection, LastSharedSection = SharedSection + Array->nEntries; - SharedSection != LastSharedSection; - SharedSection++) - { - if(SharedSection->SystemMappedBase == SystemMappedBase) - { - SectionObject = SharedSection->SectionObject; - break; - } - } - } - - if(SectionObject != NULL) - { - ULONG RealViewSize = (ViewSize ? min(*ViewSize, SharedSection->ViewSize) : SharedSection->ViewSize); - - ObReferenceObjectByPointer(SectionObject, - (ReadOnly ? SECTION_MAP_READ : SECTION_MAP_READ | SECTION_MAP_WRITE), - NULL, - KernelMode); - - Status = MmMapViewOfSection(SectionObject, - Process, - UserMappedBase, - 0, - 0, - SectionOffset, - &RealViewSize, - ViewUnmap, /* not sure if we should inherit it... */ - MEM_COMMIT, - (ReadOnly ? PAGE_READONLY : PAGE_READWRITE)); - if(!NT_SUCCESS(Status)) - { - DPRINT1("Failed to map shared section (readonly=%d) into user memory! Status: 0x%x\n", ReadOnly, Status); - } - } - else - { - DPRINT1("Couldn't find and map a shared section with SystemMappedBase=0x%x!\n", SystemMappedBase); - Status = STATUS_UNSUCCESSFUL; - } - - ExReleaseFastMutexUnsafeAndLeaveCriticalRegion(&SharedSectionPool->Lock); - - return Status; -} - - -NTSTATUS INTERNAL_CALL -IntUserUnMapSharedSection(IN PSHARED_SECTION_POOL SharedSectionPool, - IN PEPROCESS Process, - IN PVOID SystemMappedBase, - IN PVOID UserMappedBase) -{ - PSHARED_SECTIONS_ARRAY Array; - PSECTION_OBJECT SectionObject; - PSHARED_SECTION SharedSection, LastSharedSection; - NTSTATUS Status; - - ASSERT(SharedSectionPool && Process && SystemMappedBase && UserMappedBase); - - SectionObject = NULL; - - ExEnterCriticalRegionAndAcquireFastMutexUnsafe(&SharedSectionPool->Lock); - - for(Array = &SharedSectionPool->SectionsArray; - Array != NULL && SectionObject == NULL; - Array = Array->Next) - { - for(SharedSection = Array->SharedSection, LastSharedSection = SharedSection + Array->nEntries; - SharedSection != LastSharedSection; - SharedSection++) - { - if(SharedSection->SystemMappedBase == SystemMappedBase) - { - SectionObject = SharedSection->SectionObject; - break; - } - } - } - - ExReleaseFastMutexUnsafeAndLeaveCriticalRegion(&SharedSectionPool->Lock); - - if(SectionObject != NULL) - { - Status = MmUnmapViewOfSection(Process, - UserMappedBase); - ObDereferenceObject(SectionObject); - if(!NT_SUCCESS(Status)) - { - DPRINT1("Failed to unmap shared section UserMappedBase=0x%x! Status: 0x%x\n", UserMappedBase, Status); - } - } - else - { - DPRINT1("Couldn't find and unmap a shared section with SystemMappedBase=0x%x!\n", SystemMappedBase); - Status = STATUS_UNSUCCESSFUL; - } - - return Status; -}
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/windc.c URL: http://svn.reactos.ru/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntus... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/windc.c (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/windc.c Sat Apr 1 19:25:40 2006 @@ -123,7 +123,7 @@ defaultDCstate = NtGdiGetDCState(Dce->hDC); DC_SetOwnership(defaultDCstate, NULL); } - GDIOBJ_SetOwnership(Dce->Self, NULL); + GDIOBJ_SetOwnership(GdiHandleTable, Dce->Self, NULL); DC_SetOwnership(Dce->hDC, NULL); Dce->hwndCurrent = (Window ? Window->hSelf : NULL); Dce->hClipRgn = NULL; @@ -641,9 +641,9 @@ SetDCHook(dce->hDC, NULL, 0L); #endif
- if(Force && !GDIOBJ_OwnedByCurrentProcess(dce->hDC)) - { - GDIOBJ_SetOwnership(dce->Self, PsGetCurrentProcess()); + if(Force && !GDIOBJ_OwnedByCurrentProcess(GdiHandleTable, dce->hDC)) + { + GDIOBJ_SetOwnership(GdiHandleTable, dce->Self, PsGetCurrentProcess()); DC_SetOwnership(dce->hDC, PsGetCurrentProcess()); }
Modified: trunk/reactos/subsystems/win32/win32k/objects/bitmaps.c URL: http://svn.reactos.ru/svn/reactos/trunk/reactos/subsystems/win32/win32k/obje... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/objects/bitmaps.c (original) +++ trunk/reactos/subsystems/win32/win32k/objects/bitmaps.c Sat Apr 1 19:25:40 2006 @@ -1516,7 +1516,7 @@ if (hBitmap == NULL) return 0;
- Bitmap = GDIOBJ_LockObj(hBitmap, GDI_OBJECT_TYPE_BITMAP); + Bitmap = GDIOBJ_LockObj(GdiHandleTable, hBitmap, GDI_OBJECT_TYPE_BITMAP); if (Bitmap == NULL) return 0;
@@ -1536,7 +1536,7 @@ ExFreePool (buf); }
- GDIOBJ_UnlockObjByPtr(Bitmap); + GDIOBJ_UnlockObjByPtr(GdiHandleTable, Bitmap);
return res; }
Modified: trunk/reactos/subsystems/win32/win32k/objects/brush.c URL: http://svn.reactos.ru/svn/reactos/trunk/reactos/subsystems/win32/win32k/obje... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/objects/brush.c (original) +++ trunk/reactos/subsystems/win32/win32k/objects/brush.c Sat Apr 1 19:25:40 2006 @@ -42,7 +42,7 @@ if(pBrush->flAttrs & (GDIBRUSH_IS_HATCH | GDIBRUSH_IS_BITMAP)) { ASSERT(pBrush->hbmPattern); - GDIOBJ_SetOwnership(pBrush->hbmPattern, PsGetCurrentProcess()); + GDIOBJ_SetOwnership(GdiHandleTable, pBrush->hbmPattern, PsGetCurrentProcess()); NtGdiDeleteObject(pBrush->hbmPattern); }
@@ -297,7 +297,7 @@ BrushObject->hbmPattern = hPattern; /* FIXME: Fill in the rest of fields!!! */
- GDIOBJ_SetOwnership(hPattern, NULL); + GDIOBJ_SetOwnership(GdiHandleTable, hPattern, NULL);
BRUSHOBJ_UnlockBrush(BrushObject);
@@ -340,7 +340,7 @@ BrushObject->hbmPattern = hPattern; BrushObject->BrushAttr.lbColor = Color & 0xFFFFFF;
- GDIOBJ_SetOwnership(hPattern, NULL); + GDIOBJ_SetOwnership(GdiHandleTable, hPattern, NULL);
BRUSHOBJ_UnlockBrush(BrushObject);
@@ -377,7 +377,7 @@ BrushObject->hbmPattern = hPattern; /* FIXME: Fill in the rest of fields!!! */
- GDIOBJ_SetOwnership(hPattern, NULL); + GDIOBJ_SetOwnership(GdiHandleTable, hPattern, NULL);
BRUSHOBJ_UnlockBrush(BrushObject);
Modified: trunk/reactos/subsystems/win32/win32k/objects/cliprgn.c URL: http://svn.reactos.ru/svn/reactos/trunk/reactos/subsystems/win32/win32k/obje... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/objects/cliprgn.c (original) +++ trunk/reactos/subsystems/win32/win32k/objects/cliprgn.c Sat Apr 1 19:25:40 2006 @@ -81,7 +81,7 @@ if (dc->w.hVisRgn == NULL) { dc->w.hVisRgn = NtGdiCreateRectRgn(0, 0, 0, 0); - GDIOBJ_CopyOwnership(hdc, dc->w.hVisRgn); + GDIOBJ_CopyOwnership(GdiHandleTable, hdc, dc->w.hVisRgn); } else {
Modified: trunk/reactos/subsystems/win32/win32k/objects/color.c URL: http://svn.reactos.ru/svn/reactos/trunk/reactos/subsystems/win32/win32k/obje... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/objects/color.c (original) +++ trunk/reactos/subsystems/win32/win32k/objects/color.c Sat Apr 1 19:25:40 2006 @@ -616,7 +616,7 @@ if(!hgdiobj) return Ret;
- ptr = GDIOBJ_LockObj(hgdiobj, GDI_OBJECT_TYPE_DONTCARE); + ptr = GDIOBJ_LockObj(GdiHandleTable, hgdiobj, GDI_OBJECT_TYPE_DONTCARE); if (ptr == 0) { SetLastWin32Error(ERROR_INVALID_HANDLE); @@ -642,7 +642,7 @@ break; }
- GDIOBJ_UnlockObjByPtr(ptr); + GDIOBJ_UnlockObjByPtr(GdiHandleTable, ptr); return Ret; }
Modified: trunk/reactos/subsystems/win32/win32k/objects/dc.c URL: http://svn.reactos.ru/svn/reactos/trunk/reactos/subsystems/win32/win32k/obje... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/objects/dc.c (original) +++ trunk/reactos/subsystems/win32/win32k/objects/dc.c Sat Apr 1 19:25:40 2006 @@ -1065,7 +1065,7 @@ { PDC DCToDelete;
- if (!GDIOBJ_OwnedByCurrentProcess(DCHandle)) + if (!GDIOBJ_OwnedByCurrentProcess(GdiHandleTable, DCHandle)) { SetLastWin32Error(ERROR_INVALID_HANDLE); return FALSE; @@ -1739,7 +1739,7 @@ INT Result = 0; DWORD ObjectType;
- GdiObject = GDIOBJ_LockObj(Handle, GDI_OBJECT_TYPE_DONTCARE); + GdiObject = GDIOBJ_LockObj(GdiHandleTable, Handle, GDI_OBJECT_TYPE_DONTCARE); if (NULL == GdiObject) { SetLastWin32Error(ERROR_INVALID_HANDLE); @@ -1780,7 +1780,7 @@ break; }
- GDIOBJ_UnlockObjByPtr(GdiObject); + GDIOBJ_UnlockObjByPtr(GdiHandleTable, GdiObject);
return Result; } @@ -1857,7 +1857,7 @@ INT result; DWORD objectType;
- ptr = GDIOBJ_LockObj(handle, GDI_OBJECT_TYPE_DONTCARE); + ptr = GDIOBJ_LockObj(GdiHandleTable, handle, GDI_OBJECT_TYPE_DONTCARE); if (ptr == 0) { SetLastWin32Error(ERROR_INVALID_HANDLE); @@ -1912,7 +1912,7 @@ result = 0; break; } - GDIOBJ_UnlockObjByPtr(ptr); + GDIOBJ_UnlockObjByPtr(GdiHandleTable, ptr); return result; }
@@ -2263,7 +2263,7 @@ RtlCopyMemory(Buf, Driver->Buffer, Driver->MaximumLength); }
- hDC = (HDC) GDIOBJ_AllocObj(GDI_OBJECT_TYPE_DC); + hDC = (HDC) GDIOBJ_AllocObj(GdiHandleTable, GDI_OBJECT_TYPE_DC); if (hDC == NULL) { if(Buf) @@ -2339,7 +2339,7 @@ VOID FASTCALL DC_FreeDC(HDC DCToFree) { - if (!GDIOBJ_FreeObj(DCToFree, GDI_OBJECT_TYPE_DC)) + if (!GDIOBJ_FreeObj(GdiHandleTable, DCToFree, GDI_OBJECT_TYPE_DC)) { DPRINT("DC_FreeDC failed\n"); } @@ -2415,21 +2415,21 @@ { PDC DC;
- GDIOBJ_SetOwnership(hDC, Owner); + GDIOBJ_SetOwnership(GdiHandleTable, hDC, Owner); DC = DC_LockDc(hDC); if (NULL != DC) { if (NULL != DC->w.hClipRgn) { - GDIOBJ_CopyOwnership(hDC, DC->w.hClipRgn); + GDIOBJ_CopyOwnership(GdiHandleTable, hDC, DC->w.hClipRgn); } if (NULL != DC->w.hVisRgn) { - GDIOBJ_CopyOwnership(hDC, DC->w.hVisRgn); + GDIOBJ_CopyOwnership(GdiHandleTable, hDC, DC->w.hVisRgn); } if (NULL != DC->w.hGCClipRgn) { - GDIOBJ_CopyOwnership(hDC, DC->w.hGCClipRgn); + GDIOBJ_CopyOwnership(GdiHandleTable, hDC, DC->w.hGCClipRgn); } DC_UnlockDc(DC); }
Modified: trunk/reactos/subsystems/win32/win32k/objects/gdiobj.c URL: http://svn.reactos.ru/svn/reactos/trunk/reactos/subsystems/win32/win32k/obje... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/objects/gdiobj.c (original) +++ trunk/reactos/subsystems/win32/win32k/objects/gdiobj.c Sat Apr 1 19:25:40 2006 @@ -40,19 +40,6 @@ /* apparently the first 10 entries are never used in windows as they are empty */ #define RESERVE_ENTRIES_COUNT 10
-typedef struct _GDI_HANDLE_TABLE -{ - /* the table must be located at the beginning of this structure so it can be - properly mapped! */ - GDI_TABLE_ENTRY Entries[GDI_HANDLE_COUNT]; - - PPAGED_LOOKASIDE_LIST LookasideLists; - - SLIST_HEADER FreeEntriesHead; - SLIST_ENTRY FreeEntries[((GDI_HANDLE_COUNT * sizeof(GDI_TABLE_ENTRY)) << 3) / - (sizeof(SLIST_ENTRY) << 3)]; -} GDI_HANDLE_TABLE, *PGDI_HANDLE_TABLE; - typedef struct { ULONG Type; @@ -63,7 +50,7 @@ /* * Dummy GDI Cleanup Callback */ -BOOL INTERNAL_CALL +static BOOL INTERNAL_CALL GDI_CleanupDummy(PVOID ObjectBody) { return TRUE; @@ -71,7 +58,7 @@
/* Testing shows that regions are the most used GDIObj type, so put that one first for performance */ -const +static const GDI_OBJ_INFO ObjInfo[] = { /* Type */ /* Size */ /* CleanupProc */ @@ -96,7 +83,6 @@
#define OBJTYPE_COUNT (sizeof(ObjInfo) / sizeof(ObjInfo[0]))
-static PGDI_HANDLE_TABLE HandleTable = NULL; static LARGE_INTEGER ShortDelay;
#define DelayExecution() \ @@ -113,57 +99,80 @@ * Allocate GDI object table. * \param Size - number of entries in the object table. */ -static PGDI_HANDLE_TABLE INTERNAL_CALL -GDIOBJ_iAllocHandleTable(VOID) -{ - PGDI_HANDLE_TABLE handleTable; - ULONG htSize; +PGDI_HANDLE_TABLE INTERNAL_CALL +GDIOBJ_iAllocHandleTable(OUT PSECTION_OBJECT *SectionObject) +{ + PGDI_HANDLE_TABLE HandleTable = NULL; + LARGE_INTEGER htSize; UINT ObjType; UINT i; + ULONG ViewSize = 0; PGDI_TABLE_ENTRY Entry; - - handleTable = NULL; - htSize = sizeof(GDI_HANDLE_TABLE); - - IntUserCreateSharedSection(SessionSharedSectionPool, - (PVOID*)&handleTable, - &htSize); - ASSERT( handleTable ); - RtlZeroMemory(handleTable, sizeof(GDI_HANDLE_TABLE)); + NTSTATUS Status; + + ASSERT(SectionObject != NULL); + + htSize.QuadPart = sizeof(GDI_HANDLE_TABLE); + + Status = MmCreateSection((PVOID*)SectionObject, + SECTION_ALL_ACCESS, + NULL, + &htSize, + PAGE_READWRITE, + SEC_COMMIT, + NULL, + NULL); + if (!NT_SUCCESS(Status)) + return NULL; + + /* FIXME - use MmMapViewInSessionSpace once available! */ + Status = MmMapViewInSystemSpace(*SectionObject, + (PVOID*)&HandleTable, + &ViewSize); + if (!NT_SUCCESS(Status)) + { + ObDereferenceObject(*SectionObject); + *SectionObject = NULL; + return NULL; + } + + RtlZeroMemory(HandleTable, sizeof(GDI_HANDLE_TABLE));
/* * initialize the free entry cache */ - InitializeSListHead(&handleTable->FreeEntriesHead); + InitializeSListHead(&HandleTable->FreeEntriesHead); Entry = &HandleTable->Entries[RESERVE_ENTRIES_COUNT]; for(i = GDI_HANDLE_COUNT - 1; i >= RESERVE_ENTRIES_COUNT; i--) { - InterlockedPushEntrySList(&handleTable->FreeEntriesHead, &handleTable->FreeEntries[i]); - } - - handleTable->LookasideLists = ExAllocatePoolWithTag(NonPagedPool, + InterlockedPushEntrySList(&HandleTable->FreeEntriesHead, &HandleTable->FreeEntries[i]); + } + + HandleTable->LookasideLists = ExAllocatePoolWithTag(NonPagedPool, OBJTYPE_COUNT * sizeof(PAGED_LOOKASIDE_LIST), TAG_GDIHNDTBLE); - if(handleTable->LookasideLists == NULL) - { - InUserDeleteSharedSection(SessionSharedSectionPool, - handleTable); + if(HandleTable->LookasideLists == NULL) + { + MmUnmapViewInSystemSpace(HandleTable); + ObDereferenceObject(*SectionObject); + *SectionObject = NULL; return NULL; }
for(ObjType = 0; ObjType < OBJTYPE_COUNT; ObjType++) { - ExInitializePagedLookasideList(handleTable->LookasideLists + ObjType, NULL, NULL, 0, + ExInitializePagedLookasideList(HandleTable->LookasideLists + ObjType, NULL, NULL, 0, ObjInfo[ObjType].Size + sizeof(GDIOBJHDR), TAG_GDIOBJ, 0); }
ShortDelay.QuadPart = -5000LL; /* FIXME - 0.5 ms? */
- return handleTable; + return HandleTable; }
static __inline PPAGED_LOOKASIDE_LIST -FindLookasideList(DWORD ObjectType) +FindLookasideList(PGDI_HANDLE_TABLE HandleTable, + DWORD ObjectType) { int Index;
@@ -227,7 +236,7 @@ #define H 1024 static struct DbgOpenGDIHandle h[H];
-void IntDumpHandleTable() +void IntDumpHandleTable(PGDI_HANDLE_TABLE HandleTable) { int i, n = 0, j, k, J;
@@ -318,9 +327,9 @@ */ HGDIOBJ INTERNAL_CALL #ifdef GDI_DEBUG -GDIOBJ_AllocObjDbg(const char* file, int line, ULONG ObjectType) +GDIOBJ_AllocObjDbg(PGDI_HANDLE_TABLE HandleTable, const char* file, int line, ULONG ObjectType) #else /* !GDI_DEBUG */ -GDIOBJ_AllocObj(ULONG ObjectType) +GDIOBJ_AllocObj(PGDI_HANDLE_TABLE HandleTable, ULONG ObjectType) #endif /* GDI_DEBUG */ { PW32PROCESS W32Process; @@ -339,7 +348,7 @@
ASSERT(ObjectType != GDI_OBJECT_TYPE_DONTCARE);
- LookasideList = FindLookasideList(ObjectType); + LookasideList = FindLookasideList(HandleTable, ObjectType); if(LookasideList != NULL) { newObject = ExAllocateFromPagedLookasideList(LookasideList); @@ -434,7 +443,7 @@ ExFreeToPagedLookasideList(LookasideList, newObject); DPRINT1("Failed to insert gdi object into the handle table, no handles left!\n"); #ifdef GDI_DEBUG - IntDumpHandleTable(); + IntDumpHandleTable(HandleTable); #endif /* GDI_DEBUG */ } else @@ -461,9 +470,9 @@ */ BOOL INTERNAL_CALL #ifdef GDI_DEBUG -GDIOBJ_FreeObjDbg(const char* file, int line, HGDIOBJ hObj, DWORD ObjectType) +GDIOBJ_FreeObjDbg(PGDI_HANDLE_TABLE HandleTable, const char* file, int line, HGDIOBJ hObj, DWORD ObjectType) #else /* !GDI_DEBUG */ -GDIOBJ_FreeObj(HGDIOBJ hObj, DWORD ObjectType) +GDIOBJ_FreeObj(PGDI_HANDLE_TABLE HandleTable, HGDIOBJ hObj, DWORD ObjectType) #endif /* GDI_DEBUG */ { PGDI_TABLE_ENTRY Entry; @@ -535,7 +544,7 @@ Ret = RunCleanupCallback(GDIHdrToBdy(GdiHdr), Type);
/* Now it's time to free the memory */ - LookasideList = FindLookasideList(Type); + LookasideList = FindLookasideList(HandleTable, Type); if(LookasideList != NULL) { ExFreeToPagedLookasideList(LookasideList, GdiHdr); @@ -601,18 +610,6 @@ }
return FALSE; -} - -/*! - * Initialization of the GDI object engine. -*/ -VOID INTERNAL_CALL -InitGdiObjectHandleTable (VOID) -{ - DPRINT("InitGdiObjectHandleTable\n"); - - HandleTable = GDIOBJ_iAllocHandleTable(); - DPRINT("HandleTable: %x\n", HandleTable); }
/*! @@ -626,7 +623,7 @@ DPRINT("NtGdiDeleteObject handle 0x%08x\n", hObject);
return NULL != hObject - ? GDIOBJ_FreeObj(hObject, GDI_OBJECT_TYPE_DONTCARE) : FALSE; + ? GDIOBJ_FreeObj(GdiHandleTable, hObject, GDI_OBJECT_TYPE_DONTCARE) : FALSE; }
/*! @@ -634,7 +631,7 @@ * \param Process - PID of the process that will be destroyed. */ BOOL INTERNAL_CALL -GDI_CleanupForProcess (struct _EPROCESS *Process) +GDI_CleanupForProcess (PGDI_HANDLE_TABLE HandleTable, struct _EPROCESS *Process) { PGDI_TABLE_ENTRY Entry, End; PEPROCESS CurrentProcess; @@ -673,7 +670,7 @@ simply ignore this fact here. */ ObjectHandle = (HGDIOBJ)(Index | (Entry->Type & 0xFFFF0000));
- if(GDIOBJ_FreeObj(ObjectHandle, GDI_OBJECT_TYPE_DONTCARE) && + if(GDIOBJ_FreeObj(HandleTable, ObjectHandle, GDI_OBJECT_TYPE_DONTCARE) && W32Process->GDIObjects == 0) { /* there are no more gdi handles for this process, bail */ @@ -705,9 +702,9 @@ */ PGDIOBJ INTERNAL_CALL #ifdef GDI_DEBUG -GDIOBJ_LockObjDbg (const char* file, int line, HGDIOBJ hObj, DWORD ObjectType) +GDIOBJ_LockObjDbg (PGDI_HANDLE_TABLE HandleTable, const char* file, int line, HGDIOBJ hObj, DWORD ObjectType) #else /* !GDI_DEBUG */ -GDIOBJ_LockObj (HGDIOBJ hObj, DWORD ObjectType) +GDIOBJ_LockObj (PGDI_HANDLE_TABLE HandleTable, HGDIOBJ hObj, DWORD ObjectType) #endif /* GDI_DEBUG */ { USHORT HandleIndex; @@ -858,9 +855,9 @@ */ PGDIOBJ INTERNAL_CALL #ifdef GDI_DEBUG -GDIOBJ_ShareLockObjDbg (const char* file, int line, HGDIOBJ hObj, DWORD ObjectType) +GDIOBJ_ShareLockObjDbg (PGDI_HANDLE_TABLE HandleTable, const char* file, int line, HGDIOBJ hObj, DWORD ObjectType) #else /* !GDI_DEBUG */ -GDIOBJ_ShareLockObj (HGDIOBJ hObj, DWORD ObjectType) +GDIOBJ_ShareLockObj (PGDI_HANDLE_TABLE HandleTable, HGDIOBJ hObj, DWORD ObjectType) #endif /* GDI_DEBUG */ { USHORT HandleIndex; @@ -989,7 +986,7 @@ * \param Object Object pointer (as returned by GDIOBJ_LockObj). */ VOID INTERNAL_CALL -GDIOBJ_UnlockObjByPtr(PGDIOBJ Object) +GDIOBJ_UnlockObjByPtr(PGDI_HANDLE_TABLE HandleTable, PGDIOBJ Object) { PGDIOBJHDR GdiHdr = GDIBdyToHdr(Object); #ifdef GDI_DEBUG @@ -1005,7 +1002,7 @@
BOOL INTERNAL_CALL -GDIOBJ_OwnedByCurrentProcess(HGDIOBJ ObjectHandle) +GDIOBJ_OwnedByCurrentProcess(PGDI_HANDLE_TABLE HandleTable, HGDIOBJ ObjectHandle) { PGDI_TABLE_ENTRY Entry; HANDLE ProcessId; @@ -1029,7 +1026,7 @@ }
BOOL INTERNAL_CALL -GDIOBJ_ConvertToStockObj(HGDIOBJ *hObj) +GDIOBJ_ConvertToStockObj(PGDI_HANDLE_TABLE HandleTable, HGDIOBJ *hObj) { /* * FIXME !!!!! THIS FUNCTION NEEDS TO BE FIXED - IT IS NOT SAFE WHEN OTHER THREADS @@ -1167,7 +1164,7 @@ }
void INTERNAL_CALL -GDIOBJ_SetOwnership(HGDIOBJ ObjectHandle, PEPROCESS NewOwner) +GDIOBJ_SetOwnership(PGDI_HANDLE_TABLE HandleTable, HGDIOBJ ObjectHandle, PEPROCESS NewOwner) { PGDI_TABLE_ENTRY Entry; HANDLE ProcessId, LockedProcessId, PrevProcId; @@ -1302,7 +1299,7 @@ }
void INTERNAL_CALL -GDIOBJ_CopyOwnership(HGDIOBJ CopyFrom, HGDIOBJ CopyTo) +GDIOBJ_CopyOwnership(PGDI_HANDLE_TABLE HandleTable, HGDIOBJ CopyFrom, HGDIOBJ CopyTo) { PGDI_TABLE_ENTRY FromEntry; PETHREAD Thread; @@ -1347,14 +1344,14 @@ /* FIXME */ if(NT_SUCCESS(PsLookupProcessByProcessId((HANDLE)((ULONG_PTR)FromPrevProcId & ~0x1), &ProcessTo))) { - GDIOBJ_SetOwnership(CopyTo, ProcessTo); + GDIOBJ_SetOwnership(HandleTable, CopyTo, ProcessTo); ObDereferenceObject(ProcessTo); } } else { /* mark the object as global */ - GDIOBJ_SetOwnership(CopyTo, NULL); + GDIOBJ_SetOwnership(HandleTable, CopyTo, NULL); }
(void)InterlockedExchangePointer(&FromEntry->ProcessId, FromPrevProcId); @@ -1417,23 +1414,33 @@ }
PVOID INTERNAL_CALL -GDI_MapHandleTable(PEPROCESS Process) -{ - ULONG TableSize = sizeof(HandleTable->Entries); - PVOID MappedGdiTable = NULL; /* FIXME - try preferred GDI_HANDLE_TABLE_BASE_ADDRESS? */ - NTSTATUS Status = IntUserMapSharedSection(SessionSharedSectionPool, - Process, - HandleTable, - NULL, - &MappedGdiTable, - &TableSize, - TRUE); - if(NT_SUCCESS(Status)) - { - return MappedGdiTable; - } - - return NULL; +GDI_MapHandleTable(PSECTION_OBJECT SectionObject, PEPROCESS Process) +{ + PVOID MappedView = NULL; + NTSTATUS Status; + LARGE_INTEGER Offset; + ULONG ViewSize = sizeof(GDI_HANDLE_TABLE); + + Offset.QuadPart = 0; + + ASSERT(SectionObject != NULL); + ASSERT(Process != NULL); + + Status = MmMapViewOfSection(SectionObject, + Process, + &MappedView, + 0, + 0, + &Offset, + &ViewSize, + ViewUnmap, + SEC_NO_CHANGE, + PAGE_READONLY); + + if (!NT_SUCCESS(Status)) + return NULL; + + return MappedView; }
/* EOF */
Modified: trunk/reactos/subsystems/win32/win32k/objects/palobj.c URL: http://svn.reactos.ru/svn/reactos/trunk/reactos/subsystems/win32/win32k/obje... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/objects/palobj.c (original) +++ trunk/reactos/subsystems/win32/win32k/objects/palobj.c Sat Apr 1 19:25:40 2006 @@ -63,7 +63,7 @@ HPALETTE NewPalette; PPALGDI PalGDI;
- NewPalette = (HPALETTE) GDIOBJ_AllocObj(GDI_OBJECT_TYPE_PALETTE); + NewPalette = (HPALETTE) GDIOBJ_AllocObj(GdiHandleTable, GDI_OBJECT_TYPE_PALETTE); if (NULL == NewPalette) { return NULL; @@ -112,7 +112,7 @@ PPALGDI PalGDI; unsigned i;
- NewPalette = (HPALETTE) GDIOBJ_AllocObj(GDI_OBJECT_TYPE_PALETTE); + NewPalette = (HPALETTE) GDIOBJ_AllocObj(GdiHandleTable, GDI_OBJECT_TYPE_PALETTE); if (NULL == NewPalette) { return NULL;
Modified: trunk/reactos/subsystems/win32/win32k/objects/region.c URL: http://svn.reactos.ru/svn/reactos/trunk/reactos/subsystems/win32/win32k/obje... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/objects/region.c (original) +++ trunk/reactos/subsystems/win32/win32k/objects/region.c Sat Apr 1 19:25:40 2006 @@ -1905,7 +1905,7 @@ HRGN hReg; PROSRGNDATA pReg;
- if ((hReg = (HRGN) GDIOBJ_AllocObj(GDI_OBJECT_TYPE_REGION))) + if ((hReg = (HRGN) GDIOBJ_AllocObj(GdiHandleTable, GDI_OBJECT_TYPE_REGION))) { if (NULL != (pReg = RGNDATA_LockRgn(hReg))) {
Modified: trunk/reactos/subsystems/win32/win32k/objects/stockobj.c URL: http://svn.reactos.ru/svn/reactos/trunk/reactos/subsystems/win32/win32k/obje... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/objects/stockobj.c (original) +++ trunk/reactos/subsystems/win32/win32k/objects/stockobj.c Sat Apr 1 19:25:40 2006 @@ -147,7 +147,7 @@ { if (NULL != StockObjects[Object]) { - GDIOBJ_ConvertToStockObj(&StockObjects[Object]); + GDIOBJ_ConvertToStockObj(GdiHandleTable, &StockObjects[Object]); } }
@@ -268,7 +268,7 @@ SysColorBrushes[i] = IntGdiCreateSolidBrush(SysColors[i]); if(SysColorBrushes[i] != NULL) { - GDIOBJ_ConvertToStockObj((HGDIOBJ*)&SysColorBrushes[i]); + GDIOBJ_ConvertToStockObj(GdiHandleTable, (HGDIOBJ*)&SysColorBrushes[i]); } } } @@ -285,7 +285,7 @@ SysColorPens[i] = IntGdiCreatePenIndirect(&Pen); if(SysColorPens[i] != NULL) { - GDIOBJ_ConvertToStockObj((HGDIOBJ*)&SysColorPens[i]); + GDIOBJ_ConvertToStockObj(GdiHandleTable, (HGDIOBJ*)&SysColorPens[i]); } } }
Modified: trunk/reactos/subsystems/win32/win32k/win32k.rbuild URL: http://svn.reactos.ru/svn/reactos/trunk/reactos/subsystems/win32/win32k/win3... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/win32k.rbuild (original) +++ trunk/reactos/subsystems/win32/win32k/win32k.rbuild Sat Apr 1 19:25:40 2006 @@ -66,11 +66,11 @@ <file>copy.c</file> </compilationunit> <directory name="i386"> - <file>cos_asm.s</file> - <file>sin_asm.s</file> - <file>atan2_asm.s</file> - <file>floor_asm.s</file> - <file>ceil_asm.s</file> + <file>cos_asm.s</file> + <file>sin_asm.s</file> + <file>atan2_asm.s</file> + <file>floor_asm.s</file> + <file>ceil_asm.s</file> </directory> </directory> <directory name="ntddraw"> @@ -115,7 +115,6 @@ <file>winpos.c</file> <file>winsta.c</file> <file>object.c</file> - <file>ssec.c</file> </compilationunit> </directory> <directory name="objects">