ReactOS 0.4.15-dev-6068-g8061a6f
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 1582 of file gdiobj.c.

1583{
1584 PENTRY pentry;
1585 ULONG ulIndex;
1586 DWORD dwProcessId;
1587 PPROCESSINFO ppi;
1588
1589 DPRINT("CleanupForProcess prochandle %p Pid %p\n",
1590 Process, Process->UniqueProcessId);
1591
1593
1594 /* Get the current process Id */
1595 dwProcessId = PtrToUlong(PsGetCurrentProcessId());
1596
1597 /* Loop all handles in the handle table */
1598 for (ulIndex = RESERVE_ENTRIES_COUNT; ulIndex < gulFirstUnused; ulIndex++)
1599 {
1600 pentry = &gpentHmgr[ulIndex];
1601
1602 /* Check if the object is owned by the process */
1603 if (pentry->ObjectOwner.ulObj == dwProcessId)
1604 {
1605 ASSERT(pentry->einfo.pobj->cExclusiveLock == 0);
1606
1607 /* Reference the object and delete it */
1610 }
1611 }
1612
1613#if DBG
1615#endif
1616
1618 DPRINT("Completed cleanup for process %p\n", Process->UniqueProcessId);
1619 if (ppi->GDIHandleCount != 0)
1620 {
1621 DPRINT1("Leaking %d handles!\n", ppi->GDIHandleCount);
1622 ASSERT(FALSE);
1623 }
1624
1625 /* Loop all handles in the handle table */
1626 for (ulIndex = RESERVE_ENTRIES_COUNT; ulIndex < gulFirstUnused; ulIndex++)
1627 {
1628 pentry = &gpentHmgr[ulIndex];
1629
1630 /* Check if the object is owned by the process */
1631 if (pentry->ObjectOwner.ulObj == dwProcessId)
1632 {
1633 DPRINT1("Leaking object. Index=%lx, type=0x%x, refcount=%lx\n",
1634 ulIndex, pentry->Objt, gpaulRefCount[ulIndex]);
1635 DBG_DUMP_EVENT_LIST(&pentry->einfo.pobj->slhLog);
1636 //DBG_CLEANUP_EVENT_LIST(&pentry->einfo.pobj->slhLog);
1637 ASSERT(FALSE);
1638 }
1639 }
1640
1641 return TRUE;
1642}
#define InterlockedIncrement
Definition: armddk.h:53
#define DPRINT1
Definition: precomp.h:8
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define PtrToUlong(u)
Definition: config.h:107
unsigned long DWORD
Definition: ntddk_ex.h:95
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:223
#define DBG_DUMP_EVENT_LIST(pslh)
Definition: gdidebug.h:111
BOOL NTAPI DbgGdiHTIntegrityCheck(VOID)
static const unsigned RESERVE_ENTRIES_COUNT
Definition: gdiobj.h:11
#define ASSERT(a)
Definition: mode.c:44
PVOID NTAPI PsGetCurrentProcessWin32Process(VOID)
Definition: process.c:1183
HANDLE NTAPI PsGetCurrentProcessId(VOID)
Definition: process.c:1123
long LONG
Definition: pedump.c:60
#define DPRINT
Definition: sndvol32.h:71
Definition: ntgdihdl.h:218
union _ENTRY::_OBJECTOWNER ObjectOwner
UCHAR Objt
Definition: ntgdihdl.h:236
union _ENTRY::_EINFO einfo
uint32_t ULONG
Definition: typedefs.h:59
struct _BASEOBJECT * pobj
Definition: ntgdihdl.h:221
ULONG ulObj
Definition: ntgdihdl.h:232
volatile ULONG gulFirstUnused
Definition: gdiobj.c:152
PENTRY gpentHmgr
Definition: gdiobj.c:149
PULONG gpaulRefCount
Definition: gdiobj.c:150
VOID NTAPI GDIOBJ_vDeleteObject(POBJ pobj)
Definition: gdiobj.c:1111
#define PsGetCurrentProcess
Definition: psfuncs.h:17

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}
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
PGDI_POOL NTAPI GdiPoolCreate(ULONG cjAllocSize, ULONG ulTag)
Definition: gdipool.c:316
#define GDI_BATCH_LIMIT
Definition: ntgdityp.h:201
PVOID NTAPI PsGetProcessWin32Process(PEPROCESS Process)
Definition: process.c:1193
#define STATUS_SUCCESS
Definition: shellext.h:65
LIST_ENTRY PrivateMemFontListHead
Definition: win32.h:285
FAST_MUTEX PrivateFontListLock
Definition: win32.h:283
struct _GDI_POOL * pPoolRgnAttr
Definition: win32.h:293
struct _GDI_POOL * pPoolBrushAttr
Definition: win32.h:292
UINT PrivateMemFontHandleCount
Definition: win32.h:286
LIST_ENTRY PrivateFontListHead
Definition: win32.h:284
struct _GDI_POOL * pPoolDcAttr
Definition: win32.h:291
PVOID NTAPI GDI_MapHandleTable(PEPROCESS pProcess)
Definition: gdiobj.c:1552
FORCEINLINE VOID ExInitializeFastMutex(_Out_ PFAST_MUTEX FastMutex)
Definition: exfuncs.h:274

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}
VOID FASTCALL IntGdiCleanupPrivateFontsForProcess(VOID)
Definition: freetype.c:1917
VOID NTAPI GdiPoolDestroy(PGDI_POOL pPool)
Definition: gdipool.c:343
BOOL NTAPI GDI_CleanupForProcess(struct _EPROCESS *Process)
Definition: gdiobj.c:1582

Referenced by ExitProcessCallback().

◆ GdiThreadCreate()

NTSTATUS GdiThreadCreate ( PETHREAD  Thread)

Definition at line 68 of file init.c.

69{
70 return STATUS_SUCCESS;
71}

◆ GdiThreadDestroy()

NTSTATUS GdiThreadDestroy ( PETHREAD  Thread)

Definition at line 74 of file init.c.

75{
76 return STATUS_SUCCESS;
77}

◆ NtGdiInit()

BOOL APIENTRY NtGdiInit ( VOID  )

Definition at line 85 of file init.c.

86{
87 return TRUE;
88}

Referenced by GdiDllInitialize().