[WIN32K:NTUSER] Correctly delete menus in failure cases in MENU_GetSystemMenu. CORE...
[reactos.git] / win32ss / gdi / ntgdi / init.c
1 /*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS Win32k subsystem
4 * PURPOSE: Initialization of GDI
5 * FILE: win32ss/gdi/ntgdi/init.c
6 * PROGRAMER:
7 */
8
9 #include <win32k.h>
10
11 #define NDEBUG
12 #include <debug.h>
13 #include <kdros.h>
14
15 BOOL NTAPI GDI_CleanupForProcess(struct _EPROCESS *Process);
16
17 NTSTATUS
18 GdiProcessCreate(PEPROCESS Process)
19 {
20 PPROCESSINFO ppiCurrent = PsGetProcessWin32Process(Process);
21 ASSERT(ppiCurrent);
22
23 InitializeListHead(&ppiCurrent->PrivateFontListHead);
24 InitializeListHead(&ppiCurrent->PrivateMemFontListHead);
25 ppiCurrent->PrivateMemFontHandleCount = 0;
26 ExInitializeFastMutex(&ppiCurrent->PrivateFontListLock);
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 }
45
46 NTSTATUS
47 GdiProcessDestroy(PEPROCESS Process)
48 {
49 PPROCESSINFO ppiCurrent = PsGetProcessWin32Process(Process);
50 ASSERT(ppiCurrent);
51 ASSERT(ppiCurrent->peProcess == Process);
52
53 IntGdiCleanupPrivateFontsForProcess();
54
55 /* And GDI ones too */
56 GDI_CleanupForProcess(Process);
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 }
65
66
67 NTSTATUS
68 GdiThreadCreate(PETHREAD Thread)
69 {
70 return STATUS_SUCCESS;
71 }
72
73 NTSTATUS
74 GdiThreadDestroy(PETHREAD Thread)
75 {
76 return STATUS_SUCCESS;
77 }
78
79
80 /*
81 * @implemented
82 */
83 BOOL
84 APIENTRY
85 NtGdiInit(VOID)
86 {
87 return TRUE;
88 }
89
90 /* EOF */