ReactOS 0.4.15-dev-8222-g9164419
init.c File Reference
#include <win32k.h>
Include dependency graph for init.c:

Go to the source code of this file.

Functions

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

Variables

USHORT gusLanguageID
 

Function Documentation

◆ DBG_DEFAULT_CHANNEL()

DBG_DEFAULT_CHANNEL ( UserMisc  )

◆ 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:73
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 17 of file init.c.

18{
20 ASSERT(ppiCurrent);
21
24 ppiCurrent->PrivateMemFontHandleCount = 0;
26
27 InitializeListHead(&ppiCurrent->GDIBrushAttrFreeList);
28 InitializeListHead(&ppiCurrent->GDIDcAttrFreeList);
29
30 /* Map the GDI handle table to user land */
31 Process->Peb->GdiSharedHandleTable = GDI_MapHandleTable(Process);
32 Process->Peb->GdiDCAttributeList = GDI_BATCH_LIMIT;
33
34 /* Create pools for GDI object attributes */
35 ppiCurrent->pPoolDcAttr = GdiPoolCreate(sizeof(DC_ATTR), 'acdG');
36 ppiCurrent->pPoolBrushAttr = GdiPoolCreate(sizeof(BRUSH_ATTR), 'arbG');
37 ppiCurrent->pPoolRgnAttr = GdiPoolCreate(sizeof(RGN_ATTR), 'agrG');
38 ASSERT(ppiCurrent->pPoolDcAttr);
39 ASSERT(ppiCurrent->pPoolBrushAttr);
40 ASSERT(ppiCurrent->pPoolRgnAttr);
41
42 return STATUS_SUCCESS;
43}
#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 46 of file init.c.

47{
49 ASSERT(ppiCurrent);
50 ASSERT(ppiCurrent->peProcess == Process);
51
53
54 /* And GDI ones too */
56
57 /* So we can now free the pools */
58 GdiPoolDestroy(ppiCurrent->pPoolDcAttr);
59 GdiPoolDestroy(ppiCurrent->pPoolBrushAttr);
60 GdiPoolDestroy(ppiCurrent->pPoolRgnAttr);
61
62 return STATUS_SUCCESS;
63}
VOID FASTCALL IntGdiCleanupPrivateFontsForProcess(VOID)
Definition: freetype.c:1974
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 67 of file init.c.

68{
69 return STATUS_SUCCESS;
70}

◆ GdiThreadDestroy()

NTSTATUS GdiThreadDestroy ( PETHREAD  Thread)

Definition at line 73 of file init.c.

74{
75 return STATUS_SUCCESS;
76}

◆ InitializeGreCSRSS()

BOOL InitializeGreCSRSS ( VOID  )

Definition at line 80 of file init.c.

81{
82 /* Initialize DirectX graphics driver */
84 {
85 ERR("Unable to initialize DirectX graphics\n");
86 return FALSE;
87 }
88
89 /* Get global language ID */
91
92 /* Initialize FreeType library */
93 if (!InitFontSupport())
94 {
95 ERR("Unable to initialize font support\n");
96 return FALSE;
97 }
98
99 return TRUE;
100}
#define ERR(fmt,...)
Definition: debug.h:113
PEPROCESS gpepCSRSS
Definition: csr.c:15
#define NULL
Definition: types.h:112
BOOL FASTCALL InitFontSupport(VOID)
Definition: freetype.c:670
USHORT gusLanguageID
Definition: init.c:12
USHORT FASTCALL UserGetLanguageID(VOID)
Definition: misc.c:105
NTSTATUS APIENTRY DxDdStartupDxGraphics(ULONG SizeEngDrv, PDRVENABLEDATA pDxEngDrv, ULONG SizeDxgDrv, PDRVENABLEDATA pDxgDrv, PULONG DirectDrawContext, PEPROCESS Proc)
Definition: main.c:34

Referenced by NtUserInitialize().

◆ NtGdiInit()

BOOL APIENTRY NtGdiInit ( VOID  )

Definition at line 107 of file init.c.

108{
109 return TRUE;
110}

Referenced by GdiDllInitialize().

Variable Documentation

◆ gusLanguageID