195fb19fd0a3050c06febf7ad9f01d72666a913b
[reactos.git] / reactos / 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 /* And GDI ones too */
54 GDI_CleanupForProcess(Process);
55
56 /* So we can now free the pools */
57 GdiPoolDestroy(ppiCurrent->pPoolDcAttr);
58 GdiPoolDestroy(ppiCurrent->pPoolBrushAttr);
59 GdiPoolDestroy(ppiCurrent->pPoolRgnAttr);
60
61 return STATUS_SUCCESS;
62 }
63
64
65 NTSTATUS
66 GdiThreadCreate(PETHREAD Thread)
67 {
68 return STATUS_SUCCESS;
69 }
70
71 NTSTATUS
72 GdiThreadDestroy(PETHREAD Thread)
73 {
74 return STATUS_SUCCESS;
75 }
76
77
78 /*
79 * @implemented
80 */
81 BOOL
82 APIENTRY
83 NtGdiInit(VOID)
84 {
85 return TRUE;
86 }
87
88 /* EOF */