ReactOS  0.4.13-dev-73-gcfe54aa
init.c File Reference
#include <win32k.h>
#include <debug.h>
#include <kdros.h>
Include dependency graph for init.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

BOOL NTAPI GDI_CleanupForProcess (struct _EPROCESS *Process)
 
NTSTATUS GdiProcessCreate (PEPROCESS Process)
 
NTSTATUS GdiProcessDestroy (PEPROCESS Process)
 
NTSTATUS GdiThreadCreate (PETHREAD Thread)
 
NTSTATUS GdiThreadDestroy (PETHREAD Thread)
 
BOOL APIENTRY NtGdiInit (VOID)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 11 of file init.c.

Function Documentation

◆ GDI_CleanupForProcess()

BOOL NTAPI GDI_CleanupForProcess ( struct _EPROCESS Process)

Definition at line 1543 of file gdiobj.c.

1544 {
1545  PENTRY pentry;
1546  ULONG ulIndex;
1547  DWORD dwProcessId;
1548  PPROCESSINFO ppi;
1549 
1550  DPRINT("CleanupForProcess prochandle %p Pid %p\n",
1551  Process, Process->UniqueProcessId);
1552 
1554 
1555  /* Get the current process Id */
1556  dwProcessId = PtrToUlong(PsGetCurrentProcessId());
1557 
1558  /* Loop all handles in the handle table */
1560  {
1561  pentry = &gpentHmgr[ulIndex];
1562 
1563  /* Check if the object is owned by the process */
1564  if (pentry->ObjectOwner.ulObj == dwProcessId)
1565  {
1566  ASSERT(pentry->einfo.pobj->cExclusiveLock == 0);
1567 
1568  /* Reference the object and delete it */
1570  GDIOBJ_vDeleteObject(pentry->einfo.pobj);
1571  }
1572  }
1573 
1574 #if DBG
1576 #endif
1577 
1579  DPRINT("Completed cleanup for process %p\n", Process->UniqueProcessId);
1580  if (ppi->GDIHandleCount != 0)
1581  {
1582  DPRINT1("Leaking %d handles!\n", ppi->GDIHandleCount);
1583  ASSERT(FALSE);
1584  }
1585 
1586  /* Loop all handles in the handle table */
1588  {
1589  pentry = &gpentHmgr[ulIndex];
1590 
1591  /* Check if the object is owned by the process */
1592  if (pentry->ObjectOwner.ulObj == dwProcessId)
1593  {
1594  DPRINT1("Leaking object. Index=%lx, type=0x%x, refcount=%lx\n",
1595  ulIndex, pentry->Objt, gpaulRefCount[ulIndex]);
1596  DBG_DUMP_EVENT_LIST(&pentry->einfo.pobj->slhLog);
1597  //DBG_CLEANUP_EVENT_LIST(&pentry->einfo.pobj->slhLog);
1598  ASSERT(FALSE);
1599  }
1600  }
1601 
1602  return TRUE;
1603 }
#define TRUE
Definition: types.h:120
volatile ULONG gulFirstUnused
Definition: gdiobj.c:150
UCHAR Objt
Definition: ntgdihdl.h:245
struct _BASEOBJECT * pobj
Definition: ntgdihdl.h:230
union _ENTRY::_EINFO einfo
BOOL NTAPI DbgGdiHTIntegrityCheck(VOID)
long LONG
Definition: pedump.c:60
#define PsGetCurrentProcess
Definition: psfuncs.h:17
PULONG gpaulRefCount
Definition: gdiobj.c:148
void DPRINT(...)
Definition: polytest.cpp:61
#define PtrToUlong(u)
Definition: config.h:107
VOID NTAPI GDIOBJ_vDeleteObject(POBJ pobj)
Definition: gdiobj.c:1106
unsigned long DWORD
Definition: ntddk_ex.h:95
ULONG ulObj
Definition: ntgdihdl.h:241
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define DBG_DUMP_EVENT_LIST(pslh)
Definition: gdidebug.h:111
PENTRY gpentHmgr
Definition: gdiobj.c:147
static const unsigned RESERVE_ENTRIES_COUNT
Definition: gdiobj.h:11
ULONG ulIndex
Definition: symbols.c:92
#define InterlockedIncrement
Definition: armddk.h:53
HANDLE NTAPI PsGetCurrentProcessId(VOID)
Definition: process.c:1123
PVOID NTAPI PsGetCurrentProcessWin32Process(VOID)
Definition: process.c:1183
#define DPRINT1
Definition: precomp.h:8
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:219
unsigned int ULONG
Definition: retypes.h:1
union _ENTRY::_OBJECTOWNER ObjectOwner
Definition: ntgdihdl.h:226

Referenced by GdiProcessDestroy().

◆ GdiProcessCreate()

NTSTATUS GdiProcessCreate ( PEPROCESS  Process)

Definition at line 18 of file init.c.

19 {
21  ASSERT(ppiCurrent);
22 
25  ppiCurrent->PrivateMemFontHandleCount = 0;
27 
28  InitializeListHead(&ppiCurrent->GDIBrushAttrFreeList);
29  InitializeListHead(&ppiCurrent->GDIDcAttrFreeList);
30 
31  /* Map the GDI handle table to user land */
32  Process->Peb->GdiSharedHandleTable = GDI_MapHandleTable(Process);
33  Process->Peb->GdiDCAttributeList = GDI_BATCH_LIMIT;
34 
35  /* Create pools for GDI object attributes */
36  ppiCurrent->pPoolDcAttr = GdiPoolCreate(sizeof(DC_ATTR), 'acdG');
37  ppiCurrent->pPoolBrushAttr = GdiPoolCreate(sizeof(BRUSH_ATTR), 'arbG');
38  ppiCurrent->pPoolRgnAttr = GdiPoolCreate(sizeof(RGN_ATTR), 'agrG');
39  ASSERT(ppiCurrent->pPoolDcAttr);
40  ASSERT(ppiCurrent->pPoolBrushAttr);
41  ASSERT(ppiCurrent->pPoolRgnAttr);
42 
43  return STATUS_SUCCESS;
44 }
struct _GDI_POOL * pPoolBrushAttr
Definition: win32.h:283
UINT PrivateMemFontHandleCount
Definition: win32.h:277
PVOID NTAPI GDI_MapHandleTable(PEPROCESS pProcess)
Definition: gdiobj.c:1513
PVOID NTAPI PsGetProcessWin32Process(PEPROCESS Process)
Definition: process.c:1193
#define GDI_BATCH_LIMIT
Definition: ntgdityp.h:198
PGDI_POOL NTAPI GdiPoolCreate(ULONG cjAllocSize, ULONG ulTag)
Definition: gdipool.c:316
struct _GDI_POOL * pPoolDcAttr
Definition: win32.h:282
FAST_MUTEX PrivateFontListLock
Definition: win32.h:274
LIST_ENTRY PrivateMemFontListHead
Definition: win32.h:276
FORCEINLINE VOID ExInitializeFastMutex(_Out_ PFAST_MUTEX FastMutex)
Definition: exfuncs.h:274
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
struct _GDI_POOL * pPoolRgnAttr
Definition: win32.h:284
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:219
return STATUS_SUCCESS
Definition: btrfs.c:2725
LIST_ENTRY PrivateFontListHead
Definition: win32.h:275

Referenced by InitProcessCallback().

◆ GdiProcessDestroy()

NTSTATUS GdiProcessDestroy ( PEPROCESS  Process)

Definition at line 47 of file init.c.

48 {
50  ASSERT(ppiCurrent);
51  ASSERT(ppiCurrent->peProcess == Process);
52 
54 
55  /* And GDI ones too */
57 
58  /* So we can now free the pools */
59  GdiPoolDestroy(ppiCurrent->pPoolDcAttr);
60  GdiPoolDestroy(ppiCurrent->pPoolBrushAttr);
61  GdiPoolDestroy(ppiCurrent->pPoolRgnAttr);
62 
63  return STATUS_SUCCESS;
64 }
struct _GDI_POOL * pPoolBrushAttr
Definition: win32.h:283
PVOID NTAPI PsGetProcessWin32Process(PEPROCESS Process)
Definition: process.c:1193
BOOL NTAPI GDI_CleanupForProcess(struct _EPROCESS *Process)
Definition: gdiobj.c:1543
VOID FASTCALL IntGdiCleanupPrivateFontsForProcess(VOID)
Definition: freetype.c:1630
struct _GDI_POOL * pPoolDcAttr
Definition: win32.h:282
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
struct _GDI_POOL * pPoolRgnAttr
Definition: win32.h:284
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:219
return STATUS_SUCCESS
Definition: btrfs.c:2725
VOID NTAPI GdiPoolDestroy(PGDI_POOL pPool)
Definition: gdipool.c:343

Referenced by ExitProcessCallback().

◆ GdiThreadCreate()

NTSTATUS GdiThreadCreate ( PETHREAD  Thread)

Definition at line 68 of file init.c.

69 {
70  return STATUS_SUCCESS;
71 }
return STATUS_SUCCESS
Definition: btrfs.c:2725

◆ GdiThreadDestroy()

NTSTATUS GdiThreadDestroy ( PETHREAD  Thread)

Definition at line 74 of file init.c.

75 {
76  return STATUS_SUCCESS;
77 }
return STATUS_SUCCESS
Definition: btrfs.c:2725

◆ NtGdiInit()

BOOL APIENTRY NtGdiInit ( VOID  )

Definition at line 85 of file init.c.

86 {
87  return TRUE;
88 }
#define TRUE
Definition: types.h:120

Referenced by GdiDllInitialize().