- change the GDI code a bit so it's able to handle multiple tables (e.g. separate Dd table)

- patch by Thomas Weidenmueller

svn path=/trunk/; revision=21433
This commit is contained in:
Ged Murphy 2006-04-01 15:25:40 +00:00
parent 018539280c
commit b5c963889c
31 changed files with 270 additions and 744 deletions

View file

@ -44,7 +44,7 @@ EngCreatePalette(ULONG Mode, ULONG NumColors, ULONG *Colors,
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 @@ EngCreatePalette(ULONG Mode, ULONG NumColors, ULONG *Colors,
BOOL STDCALL
EngDeletePalette(IN HPALETTE Palette)
{
GDIOBJ_SetOwnership(Palette, PsGetCurrentProcess());
GDIOBJ_SetOwnership(GdiHandleTable, Palette, PsGetCurrentProcess());
return PALETTE_FreePalette(Palette);
}

View file

@ -373,7 +373,7 @@ EngCreateBitmap(IN SIZEL Size,
if ( !NewBitmap )
return 0;
GDIOBJ_SetOwnership(NewBitmap, NULL);
GDIOBJ_SetOwnership(GdiHandleTable, NewBitmap, NULL);
return NewBitmap;
}
@ -394,7 +394,7 @@ EngCreateDeviceSurface(IN DHSURF dhsurf,
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 @@ EngModifySurface(
BOOL STDCALL
EngDeleteSurface(IN HSURF Surface)
{
GDIOBJ_SetOwnership(Surface, PsGetCurrentProcess());
GDIOBJ_SetOwnership(GdiHandleTable, Surface, PsGetCurrentProcess());
BITMAPOBJ_FreeBitmap(Surface);
return TRUE;
}
@ -533,7 +533,7 @@ EngEraseSurface(SURFOBJ *Surface,
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 @@ VOID STDCALL
EngUnlockSurface(IN SURFOBJ *Surface)
{
if (Surface != NULL)
GDIOBJ_UnlockObjByPtr(Surface);
GDIOBJ_UnlockObjByPtr(GdiHandleTable, Surface);
}
/* EOF */

View file

@ -25,9 +25,9 @@ typedef struct _BITMAPOBJ
/* 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)

View file

@ -68,10 +68,10 @@ typedef struct
#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

View file

@ -166,9 +166,9 @@ typedef struct
/* 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);

View file

@ -44,10 +44,10 @@ typedef struct tagDCE
#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);

View file

@ -9,6 +9,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;
typedef BOOL (INTERNAL_CALL *GDICLEANUPPROC)(PVOID ObjectBody);
@ -28,11 +43,11 @@ typedef struct _GDIOBJHDR
#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 @@ VOID INTERNAL_CALL GDIOBJ_UnlockObjByPtr(PGDIOBJ Object);
#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)

View file

@ -125,8 +125,6 @@ typedef struct _USER_REFERENCE_ENTRY
\
}
VOID INTERNAL_CALL InitGdiObjectHandleTable (VOID);
VOID FASTCALL CreateStockObjects (VOID);
VOID FASTCALL CreateSysColorObjects (VOID);

View file

@ -35,9 +35,9 @@ HPALETTE FASTCALL PALETTE_AllocPalette(ULONG Mode,
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);

View file

@ -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

View file

@ -11,9 +11,9 @@ typedef struct _ROSRGNDATA {
} 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);

View file

@ -1,73 +0,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 */

View file

@ -12,10 +12,10 @@ typedef struct
/* 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);

View file

@ -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>

View file

@ -27,14 +27,16 @@
#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
Win32kProcessCallback(struct _EPROCESS *Process,
@ -84,7 +86,7 @@ Win32kProcessCallback(struct _EPROCESS *Process,
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 @@ Win32kProcessCallback(struct _EPROCESS *Process,
/* 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 @@ DriverEntry (
*/
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 @@ DriverEntry (
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())

View file

@ -16,6 +16,8 @@
/* swtich this off to get rid of all dx debug msg */
#define DX_DEBUG
#define DdHandleTable GdiHandleTable
/************************************************************************/
/* DIRECT DRAW OBJECT */
@ -95,7 +97,7 @@ HANDLE STDCALL NtGdiDdCreateDirectDrawObject(
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 @@ HANDLE STDCALL NtGdiDdCreateDirectDrawObject(
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 @@ HANDLE STDCALL NtGdiDdCreateDirectDrawObject(
/* 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 @@ BOOL STDCALL NtGdiDdDeleteDirectDrawObject(
#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 @@ BOOL STDCALL NtGdiDdQueryDirectDrawObject(
}
pDirectDraw = GDIOBJ_LockObj(hDirectDrawLocal, GDI_OBJECT_TYPE_DIRECTDRAW);
pDirectDraw = GDIOBJ_LockObj(DdHandleTable, hDirectDrawLocal, GDI_OBJECT_TYPE_DIRECTDRAW);
if (!pDirectDraw)
@ -226,7 +228,7 @@ BOOL STDCALL NtGdiDdQueryDirectDrawObject(
#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 @@ BOOL STDCALL NtGdiDdQueryDirectDrawObject(
}
#endif
GDIOBJ_UnlockObjByPtr(pDirectDraw);
GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw);
return TRUE;
}
@ -364,7 +366,7 @@ DWORD STDCALL NtGdiDdGetDriverInfo(
{
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 @@ DWORD STDCALL NtGdiDdGetDriverInfo(
else
ddRVal = pDirectDraw->Hal.GetDriverInfo(puGetDriverInfoData);
GDIOBJ_UnlockObjByPtr(pDirectDraw);
GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw);
return ddRVal;
}
@ -425,7 +427,7 @@ DWORD STDCALL NtGdiDdCreateSurface(
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 @@ DWORD STDCALL NtGdiDdCreateSurface(
/* But back the orignal PDev */
puCreateSurfaceData->lpDD = lgpl;
GDIOBJ_UnlockObjByPtr(pDirectDraw);
GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw);
return ddRVal;
}
@ -473,7 +475,7 @@ DWORD STDCALL NtGdiDdWaitForVerticalBlank(
#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 @@ DWORD STDCALL NtGdiDdWaitForVerticalBlank(
/* But back the orignal PDev */
puWaitForVerticalBlankData->lpDD = lgpl;
GDIOBJ_UnlockObjByPtr(pDirectDraw);
GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw);
return ddRVal;
}
@ -504,7 +506,7 @@ DWORD STDCALL NtGdiDdCanCreateSurface(
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 @@ DWORD STDCALL NtGdiDdCanCreateSurface(
/* But back the orignal PDev */
puCanCreateSurfaceData->lpDD = lgpl;
GDIOBJ_UnlockObjByPtr(pDirectDraw);
GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw);
return ddRVal;
}
@ -538,7 +540,7 @@ DWORD STDCALL NtGdiDdGetScanLine(
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 @@ DWORD STDCALL NtGdiDdGetScanLine(
/* But back the orignal PDev */
puGetScanLineData->lpDD = lgpl;
GDIOBJ_UnlockObjByPtr(pDirectDraw);
GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw);
return ddRVal;
}
@ -579,7 +581,7 @@ DWORD STDCALL NtGdiDdDestroySurface(
{
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 @@ DWORD STDCALL NtGdiDdDestroySurface(
}
GDIOBJ_UnlockObjByPtr(pDirectDraw);
GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw);
return ddRVal;
}
@ -620,7 +622,7 @@ DWORD STDCALL NtGdiDdFlip(
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 @@ DWORD STDCALL NtGdiDdFlip(
/* But back the orignal PDev */
puFlipData->lpDD = lgpl;
GDIOBJ_UnlockObjByPtr(pDirectDraw);
GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw);
return ddRVal;
}
@ -656,7 +658,7 @@ DWORD STDCALL NtGdiDdLock(
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 @@ DWORD STDCALL NtGdiDdLock(
/* But back the orignal PDev */
puLockData->lpDD = lgpl;
GDIOBJ_UnlockObjByPtr(pDirectDraw);
GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw);
return ddRVal;
}
@ -690,7 +692,7 @@ DWORD STDCALL NtGdiDdUnlock(
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 @@ DWORD STDCALL NtGdiDdUnlock(
/* But back the orignal PDev */
puUnlockData->lpDD = lgpl;
GDIOBJ_UnlockObjByPtr(pDirectDraw);
GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw);
return ddRVal;
}
@ -725,7 +727,7 @@ DWORD STDCALL NtGdiDdBlt(
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 @@ DWORD STDCALL NtGdiDdBlt(
/* But back the orignal PDev */
puBltData->lpDD = lgpl;
GDIOBJ_UnlockObjByPtr(pDirectDraw);
GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw);
return ddRVal;
}
@ -759,7 +761,7 @@ DWORD STDCALL NtGdiDdSetColorKey(
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 @@ DWORD STDCALL NtGdiDdSetColorKey(
/* But back the orignal PDev */
puSetColorKeyData->lpDD = lgpl;
GDIOBJ_UnlockObjByPtr(pDirectDraw);
GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw);
return ddRVal;
}
@ -795,7 +797,7 @@ DWORD STDCALL NtGdiDdAddAttachedSurface(
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 @@ DWORD STDCALL NtGdiDdAddAttachedSurface(
/* But back the orignal PDev */
puAddAttachedSurfaceData->lpDD = lgpl;
GDIOBJ_UnlockObjByPtr(pDirectDraw);
GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw);
return ddRVal;
}
@ -829,7 +831,7 @@ DWORD STDCALL NtGdiDdGetBltStatus(
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 @@ DWORD STDCALL NtGdiDdGetBltStatus(
/* But back the orignal PDev */
puGetBltStatusData->lpDD = lgpl;
GDIOBJ_UnlockObjByPtr(pDirectDraw);
GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw);
return ddRVal;
}
@ -863,7 +865,7 @@ DWORD STDCALL NtGdiDdGetFlipStatus(
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 @@ DWORD STDCALL NtGdiDdGetFlipStatus(
/* But back the orignal PDev */
puGetFlipStatusData->lpDD = lgpl;
GDIOBJ_UnlockObjByPtr(pDirectDraw);
GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw);
return ddRVal;
}
@ -898,7 +900,7 @@ DWORD STDCALL NtGdiDdUpdateOverlay(
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 @@ DWORD STDCALL NtGdiDdUpdateOverlay(
/* But back the orignal PDev */
puUpdateOverlayData->lpDD = lgpl;
GDIOBJ_UnlockObjByPtr(pDirectDraw);
GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw);
return ddRVal;
}
@ -933,7 +935,7 @@ DWORD STDCALL NtGdiDdSetOverlayPosition(
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 @@ DWORD STDCALL NtGdiDdSetOverlayPosition(
/* But back the orignal PDev */
puSetOverlayPositionData->lpDD = lgpl;
GDIOBJ_UnlockObjByPtr(pDirectDraw);
GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw);
return ddRVal;
}
@ -985,7 +987,7 @@ HANDLE STDCALL NtGdiDdCreateSurfaceObject(
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 @@ HANDLE STDCALL NtGdiDdCreateSurfaceObject(
return NULL;
if (!hSurface)
hSurface = GDIOBJ_AllocObj(GDI_OBJECT_TYPE_DD_SURFACE);
hSurface = GDIOBJ_AllocObj(DdHandleTable, GDI_OBJECT_TYPE_DD_SURFACE);
pSurface = GDIOBJ_LockObj(hSurface, 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 @@ HANDLE STDCALL NtGdiDdCreateSurfaceObject(
// 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 @@ BOOL STDCALL NtGdiDdDeleteSurfaceObject(
/* 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 STDCALL NtGdiDdGetAvailDriverMemory(
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 @@ DWORD STDCALL NtGdiDdGetAvailDriverMemory(
/* make the call */
// ddRVal = pDirectDraw->DdGetAvailDriverMemory(puGetAvailDriverMemoryData);
GDIOBJ_UnlockObjByPtr(pDirectDraw);
GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw);
/* But back the orignal PDev */
@ -1106,7 +1108,7 @@ DWORD STDCALL NtGdiDdSetExclusiveMode(
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 @@ DWORD STDCALL NtGdiDdSetExclusiveMode(
/* make the call */
ddRVal = pDirectDraw->DdSetExclusiveMode(puSetExclusiveModeData);
GDIOBJ_UnlockObjByPtr(pDirectDraw);
GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw);
/* But back the orignal PDev */
puSetExclusiveModeData->lpDD = lgpl;

View file

@ -490,12 +490,12 @@ IntDestroyCurIconObject(PWINSTATION_OBJECT WinSta, PCURICON_OBJECT CurIcon, BOOL
/* 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 @@ NtUserCreateCursorIconHandle(PICONINFO IconInfo OPTIONAL, BOOL Indirect)
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 @@ NtUserCreateCursorIconHandle(PICONINFO IconInfo OPTIONAL, BOOL Indirect)
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 @@ NtUserSetCursorIconContents(
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 @@ NtUserSetCursorIconContents(
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;

View file

@ -1052,7 +1052,7 @@ IntSystemParametersInfo(
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)

View file

@ -194,7 +194,7 @@ IntGetNCUpdateRgn(PWINDOW_OBJECT Window, BOOL Validate)
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 @@ co_IntPaintWindows(PWINDOW_OBJECT Window, ULONG Flags)
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 @@ IntInvalidateWindows(PWINDOW_OBJECT Window, HRGN hRgn, ULONG Flags)
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 @@ IntInvalidateWindows(PWINDOW_OBJECT Window, HRGN hRgn, ULONG Flags)
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 @@ NtUserBeginPaint(HWND hWnd, PAINTSTRUCT* UnsafePs)
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 @@ NtUserBeginPaint(HWND hWnd, PAINTSTRUCT* UnsafePs)
{
IntGetClientRect(Window, &Ps.rcPaint);
}
GDIOBJ_SetOwnership(Window->UpdateRegion, PsGetCurrentProcess());
GDIOBJ_SetOwnership(GdiHandleTable, Window->UpdateRegion, PsGetCurrentProcess());
Window->UpdateRegion = NULL;
}
else

View file

@ -1,421 +0,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;
}

View file

@ -123,7 +123,7 @@ DceAllocDCE(PWINDOW_OBJECT Window OPTIONAL, DCE_TYPE Type)
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 @@ DceFreeDCE(PDCE dce, BOOLEAN Force)
SetDCHook(dce->hDC, NULL, 0L);
#endif
if(Force && !GDIOBJ_OwnedByCurrentProcess(dce->hDC))
if(Force && !GDIOBJ_OwnedByCurrentProcess(GdiHandleTable, dce->hDC))
{
GDIOBJ_SetOwnership(dce->Self, PsGetCurrentProcess());
GDIOBJ_SetOwnership(GdiHandleTable, dce->Self, PsGetCurrentProcess());
DC_SetOwnership(dce->hDC, PsGetCurrentProcess());
}

View file

@ -1516,7 +1516,7 @@ BITMAPOBJ_CopyBitmap(HBITMAP hBitmap)
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 @@ BITMAPOBJ_CopyBitmap(HBITMAP hBitmap)
ExFreePool (buf);
}
GDIOBJ_UnlockObjByPtr(Bitmap);
GDIOBJ_UnlockObjByPtr(GdiHandleTable, Bitmap);
return res;
}

View file

@ -42,7 +42,7 @@ BRUSH_Cleanup(PVOID ObjectBody)
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 @@ IntGdiCreateDIBBrush(
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 @@ IntGdiCreateHatchBrush(
BrushObject->hbmPattern = hPattern;
BrushObject->BrushAttr.lbColor = Color & 0xFFFFFF;
GDIOBJ_SetOwnership(hPattern, NULL);
GDIOBJ_SetOwnership(GdiHandleTable, hPattern, NULL);
BRUSHOBJ_UnlockBrush(BrushObject);
@ -377,7 +377,7 @@ IntGdiCreatePatternBrush(
BrushObject->hbmPattern = hPattern;
/* FIXME: Fill in the rest of fields!!! */
GDIOBJ_SetOwnership(hPattern, NULL);
GDIOBJ_SetOwnership(GdiHandleTable, hPattern, NULL);
BRUSHOBJ_UnlockBrush(BrushObject);

View file

@ -81,7 +81,7 @@ NtGdiSelectVisRgn(HDC hdc, HRGN hrgn)
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
{

View file

@ -616,7 +616,7 @@ NtGdiUnrealizeObject(HGDIOBJ hgdiobj)
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 @@ NtGdiUnrealizeObject(HGDIOBJ hgdiobj)
break;
}
GDIOBJ_UnlockObjByPtr(ptr);
GDIOBJ_UnlockObjByPtr(GdiHandleTable, ptr);
return Ret;
}

View file

@ -1065,7 +1065,7 @@ NtGdiDeleteObjectApp(HANDLE DCHandle)
{
PDC DCToDelete;
if (!GDIOBJ_OwnedByCurrentProcess(DCHandle))
if (!GDIOBJ_OwnedByCurrentProcess(GdiHandleTable, DCHandle))
{
SetLastWin32Error(ERROR_INVALID_HANDLE);
return FALSE;
@ -1739,7 +1739,7 @@ IntGdiGetObject(HANDLE Handle, INT Count, LPVOID Buffer)
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 @@ IntGdiGetObject(HANDLE Handle, INT Count, LPVOID Buffer)
break;
}
GDIOBJ_UnlockObjByPtr(GdiObject);
GDIOBJ_UnlockObjByPtr(GdiHandleTable, GdiObject);
return Result;
}
@ -1857,7 +1857,7 @@ NtGdiGetObjectType(HANDLE handle)
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 @@ NtGdiGetObjectType(HANDLE handle)
result = 0;
break;
}
GDIOBJ_UnlockObjByPtr(ptr);
GDIOBJ_UnlockObjByPtr(GdiHandleTable, ptr);
return result;
}
@ -2263,7 +2263,7 @@ DC_AllocDC(PUNICODE_STRING Driver)
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 @@ DC_InitDC(HDC DCHandle)
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 @@ DC_SetOwnership(HDC hDC, PEPROCESS Owner)
{
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);
}

View file

@ -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 @@ typedef struct
/*
* Dummy GDI Cleanup Callback
*/
BOOL INTERNAL_CALL
static BOOL INTERNAL_CALL
GDI_CleanupDummy(PVOID ObjectBody)
{
return TRUE;
@ -71,7 +58,7 @@ GDI_CleanupDummy(PVOID ObjectBody)
/* 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 @@ GDI_OBJ_INFO ObjInfo[] =
#define OBJTYPE_COUNT (sizeof(ObjInfo) / sizeof(ObjInfo[0]))
static PGDI_HANDLE_TABLE HandleTable = NULL;
static LARGE_INTEGER ShortDelay;
#define DelayExecution() \
@ -113,57 +99,80 @@ ULONG STDCALL KeRosGetStackFrames(PULONG Frames, ULONG FrameCount);
* 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 INTERNAL_CALL
GDIOBJ_iAllocHandleTable(OUT PSECTION_OBJECT *SectionObject)
{
PGDI_HANDLE_TABLE handleTable;
ULONG htSize;
PGDI_HANDLE_TABLE HandleTable = NULL;
LARGE_INTEGER htSize;
UINT ObjType;
UINT i;
ULONG ViewSize = 0;
PGDI_TABLE_ENTRY Entry;
NTSTATUS Status;
handleTable = NULL;
htSize = sizeof(GDI_HANDLE_TABLE);
ASSERT(SectionObject != NULL);
IntUserCreateSharedSection(SessionSharedSectionPool,
(PVOID*)&handleTable,
&htSize);
ASSERT( handleTable );
RtlZeroMemory(handleTable, sizeof(GDI_HANDLE_TABLE));
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]);
InterlockedPushEntrySList(&HandleTable->FreeEntriesHead, &HandleTable->FreeEntries[i]);
}
handleTable->LookasideLists = ExAllocatePoolWithTag(NonPagedPool,
HandleTable->LookasideLists = ExAllocatePoolWithTag(NonPagedPool,
OBJTYPE_COUNT * sizeof(PAGED_LOOKASIDE_LIST),
TAG_GDIHNDTBLE);
if(handleTable->LookasideLists == NULL)
if(HandleTable->LookasideLists == NULL)
{
InUserDeleteSharedSection(SessionSharedSectionPool,
handleTable);
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 @@ struct DbgOpenGDIHandle
#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 @@ done:
*/
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 @@ GDIOBJ_AllocObj(ULONG ObjectType)
ASSERT(ObjectType != GDI_OBJECT_TYPE_DONTCARE);
LookasideList = FindLookasideList(ObjectType);
LookasideList = FindLookasideList(HandleTable, ObjectType);
if(LookasideList != NULL)
{
newObject = ExAllocateFromPagedLookasideList(LookasideList);
@ -434,7 +443,7 @@ LockHandle:
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 @@ LockHandle:
*/
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 @@ LockHandle:
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);
@ -603,18 +612,6 @@ LockHandle:
return FALSE;
}
/*!
* Initialization of the GDI object engine.
*/
VOID INTERNAL_CALL
InitGdiObjectHandleTable (VOID)
{
DPRINT("InitGdiObjectHandleTable\n");
HandleTable = GDIOBJ_iAllocHandleTable();
DPRINT("HandleTable: %x\n", HandleTable);
}
/*!
* Delete GDI object
* \param hObject object handle
@ -626,7 +623,7 @@ NtGdiDeleteObject(HGDIOBJ hObject)
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 @@ NtGdiDeleteObject(HGDIOBJ hObject)
* \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 @@ GDI_CleanupForProcess (struct _EPROCESS *Process)
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 @@ GDI_CleanupForProcess (struct _EPROCESS *Process)
*/
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 @@ GDIOBJ_LockObj (HGDIOBJ hObj, DWORD ObjectType)
*/
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 @@ GDIOBJ_ShareLockObj (HGDIOBJ hObj, DWORD ObjectType)
* \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 @@ GDIOBJ_UnlockObjByPtr(PGDIOBJ Object)
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 @@ GDIOBJ_OwnedByCurrentProcess(HGDIOBJ ObjectHandle)
}
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 @@ LockHandle:
}
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 @@ LockHandle:
}
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 @@ LockHandleFrom:
/* 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 @@ LockHandleFrom:
}
PVOID INTERNAL_CALL
GDI_MapHandleTable(PEPROCESS Process)
GDI_MapHandleTable(PSECTION_OBJECT SectionObject, 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;
}
PVOID MappedView = NULL;
NTSTATUS Status;
LARGE_INTEGER Offset;
ULONG ViewSize = sizeof(GDI_HANDLE_TABLE);
return NULL;
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 */

View file

@ -63,7 +63,7 @@ PALETTE_AllocPalette(ULONG Mode,
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 @@ PALETTE_AllocPaletteIndexedRGB(ULONG NumColors,
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;

View file

@ -1905,7 +1905,7 @@ HRGN FASTCALL RGNDATA_AllocRgn(INT n)
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)))
{

View file

@ -147,7 +147,7 @@ CreateStockObjects(void)
{
if (NULL != StockObjects[Object])
{
GDIOBJ_ConvertToStockObj(&StockObjects[Object]);
GDIOBJ_ConvertToStockObj(GdiHandleTable, &StockObjects[Object]);
}
}
@ -268,7 +268,7 @@ CreateSysColorObjects(VOID)
SysColorBrushes[i] = IntGdiCreateSolidBrush(SysColors[i]);
if(SysColorBrushes[i] != NULL)
{
GDIOBJ_ConvertToStockObj((HGDIOBJ*)&SysColorBrushes[i]);
GDIOBJ_ConvertToStockObj(GdiHandleTable, (HGDIOBJ*)&SysColorBrushes[i]);
}
}
}
@ -285,7 +285,7 @@ CreateSysColorObjects(VOID)
SysColorPens[i] = IntGdiCreatePenIndirect(&Pen);
if(SysColorPens[i] != NULL)
{
GDIOBJ_ConvertToStockObj((HGDIOBJ*)&SysColorPens[i]);
GDIOBJ_ConvertToStockObj(GdiHandleTable, (HGDIOBJ*)&SysColorPens[i]);
}
}
}

View file

@ -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">