xref: /reactos/win32ss/gdi/ntgdi/init.c (revision 114bc2b9)
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 DBG_DEFAULT_CHANNEL(UserMisc);
11 
12 USHORT gusLanguageID;
13 
14 BOOL NTAPI GDI_CleanupForProcess(struct _EPROCESS *Process);
15 
16 NTSTATUS
GdiProcessCreate(PEPROCESS Process)17 GdiProcessCreate(PEPROCESS Process)
18 {
19     PPROCESSINFO ppiCurrent = PsGetProcessWin32Process(Process);
20     ASSERT(ppiCurrent);
21 
22     InitializeListHead(&ppiCurrent->PrivateFontListHead);
23     InitializeListHead(&ppiCurrent->PrivateMemFontListHead);
24     ppiCurrent->PrivateMemFontHandleCount = 0;
25     ExInitializeFastMutex(&ppiCurrent->PrivateFontListLock);
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 }
44 
45 NTSTATUS
GdiProcessDestroy(PEPROCESS Process)46 GdiProcessDestroy(PEPROCESS Process)
47 {
48     PPROCESSINFO ppiCurrent = PsGetProcessWin32Process(Process);
49     ASSERT(ppiCurrent);
50     ASSERT(ppiCurrent->peProcess == Process);
51 
52     IntGdiCleanupPrivateFontsForProcess();
53 
54     /* And GDI ones too */
55     GDI_CleanupForProcess(Process);
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 }
64 
65 
66 NTSTATUS
GdiThreadCreate(PETHREAD Thread)67 GdiThreadCreate(PETHREAD Thread)
68 {
69     return STATUS_SUCCESS;
70 }
71 
72 NTSTATUS
GdiThreadDestroy(PETHREAD Thread)73 GdiThreadDestroy(PETHREAD Thread)
74 {
75     return STATUS_SUCCESS;
76 }
77 
78 
79 BOOL
InitializeGreCSRSS(VOID)80 InitializeGreCSRSS(VOID)
81 {
82     /* Initialize DirectX graphics driver */
83     if (DxDdStartupDxGraphics(0, NULL, 0, NULL, NULL, gpepCSRSS) != STATUS_SUCCESS)
84     {
85         ERR("Unable to initialize DirectX graphics\n");
86         return FALSE;
87     }
88 
89     /* Get global language ID */
90     gusLanguageID = UserGetLanguageID();
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 }
101 
102 /*
103  * @implemented
104  */
105 BOOL
106 APIENTRY
NtGdiInit(VOID)107 NtGdiInit(VOID)
108 {
109     return TRUE;
110 }
111 
112 /* EOF */
113