ReactOS  0.4.14-dev-98-gb0d4763
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 1545 of file gdiobj.c.

1546 {
1547  PENTRY pentry;
1548  ULONG ulIndex;
1549  DWORD dwProcessId;
1550  PPROCESSINFO ppi;
1551 
1552  DPRINT("CleanupForProcess prochandle %p Pid %p\n",
1553  Process, Process->UniqueProcessId);
1554 
1556 
1557  /* Get the current process Id */
1558  dwProcessId = PtrToUlong(PsGetCurrentProcessId());
1559 
1560  /* Loop all handles in the handle table */
1562  {
1563  pentry = &gpentHmgr[ulIndex];
1564 
1565  /* Check if the object is owned by the process */
1566  if (pentry->ObjectOwner.ulObj == dwProcessId)
1567  {
1568  ASSERT(pentry->einfo.pobj->cExclusiveLock == 0);
1569 
1570  /* Reference the object and delete it */
1572  GDIOBJ_vDeleteObject(pentry->einfo.pobj);
1573  }
1574  }
1575 
1576 #if DBG
1578 #endif
1579 
1581  DPRINT("Completed cleanup for process %p\n", Process->UniqueProcessId);
1582  if (ppi->GDIHandleCount != 0)
1583  {
1584  DPRINT1("Leaking %d handles!\n", ppi->GDIHandleCount);
1585  ASSERT(FALSE);
1586  }
1587 
1588  /* Loop all handles in the handle table */
1590  {
1591  pentry = &gpentHmgr[ulIndex];
1592 
1593  /* Check if the object is owned by the process */
1594  if (pentry->ObjectOwner.ulObj == dwProcessId)
1595  {
1596  DPRINT1("Leaking object. Index=%lx, type=0x%x, refcount=%lx\n",
1597  ulIndex, pentry->Objt, gpaulRefCount[ulIndex]);
1598  DBG_DUMP_EVENT_LIST(&pentry->einfo.pobj->slhLog);
1599  //DBG_CLEANUP_EVENT_LIST(&pentry->einfo.pobj->slhLog);
1600  ASSERT(FALSE);
1601  }
1602  }
1603 
1604  return TRUE;
1605 }
#define TRUE
Definition: types.h:120
volatile ULONG gulFirstUnused
Definition: gdiobj.c:152
UCHAR Objt
Definition: ntgdihdl.h:249
struct _BASEOBJECT * pobj
Definition: ntgdihdl.h:234
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:150
void DPRINT(...)
Definition: polytest.cpp:61
#define PtrToUlong(u)
Definition: config.h:107
VOID NTAPI GDIOBJ_vDeleteObject(POBJ pobj)
Definition: gdiobj.c:1108
unsigned long DWORD
Definition: ntddk_ex.h:95
ULONG ulObj
Definition: ntgdihdl.h:245
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define DBG_DUMP_EVENT_LIST(pslh)
Definition: gdidebug.h:111
PENTRY gpentHmgr
Definition: gdiobj.c:149
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:230

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:1515
PVOID NTAPI PsGetProcessWin32Process(PEPROCESS Process)
Definition: process.c:1193
#define GDI_BATCH_LIMIT
Definition: ntgdityp.h:200
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:2966
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:1545
VOID FASTCALL IntGdiCleanupPrivateFontsForProcess(VOID)
Definition: freetype.c:2087
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:2966
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:2966

◆ 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:2966

◆ 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().