:pserver:cvsanon@mok.lvcm.com:/CVS/ReactOS reactos
[reactos.git] / subsys / win32k / main / dllmain.c
1 /* $Id$
2  *
3  *  Entry Point for win32k.sys
4  */
5
6 #undef WIN32_LEAN_AND_MEAN
7 #define WIN32_NO_STATUS
8 #include <windows.h>
9 #include <ddk/ntddk.h>
10 #include <ddk/winddi.h>
11 #include <ddk/service.h>
12
13 #include <napi/win32.h>
14 #include <win32k/win32k.h>
15
16 #include <include/winsta.h>
17 #include <include/class.h>
18 #include <include/window.h>
19
20 //#define NDEBUG
21 #include <win32k/debug1.h>
22
23 extern SSDT Win32kSSDT[];
24 extern SSPT Win32kSSPT[];
25 extern ULONG Win32kNumberOfSysCalls;
26
27 /*
28  * This definition doesn't work
29  */
30 // WINBOOL STDCALL DllMain(VOID)
31 NTSTATUS
32 STDCALL
33 DllMain (
34   IN    PDRIVER_OBJECT  DriverObject,
35   IN    PUNICODE_STRING RegistryPath)
36 {
37   NTSTATUS Status;
38   BOOLEAN Result;
39
40   /*
41    * Register user mode call interface
42    * (system service table index = 1)
43    */
44   Result = KeAddSystemServiceTable (Win32kSSDT, NULL,
45                                     Win32kNumberOfSysCalls, Win32kSSPT, 1);
46   if (Result == FALSE)
47   {
48     DbgPrint("Adding system services failed!\n");
49     return STATUS_UNSUCCESSFUL;
50   }
51
52   /*
53    * Register our per-process and per-thread structures.
54    */
55   PsEstablishWin32Callouts(0, 0, 0, 0, sizeof(W32THREAD), sizeof(W32PROCESS));
56
57   WinPosSetupInternalPos();
58
59   Status = InitWindowStationImpl();
60   if (!NT_SUCCESS(Status))
61   {
62     DbgPrint("Failed to initialize window station implementation!\n");
63     return STATUS_UNSUCCESSFUL;
64   }
65
66   Status = InitClassImpl();
67   if (!NT_SUCCESS(Status))
68   {
69     DbgPrint("Failed to initialize window class implementation!\n");
70     return STATUS_UNSUCCESSFUL;
71   }
72
73   Status = InitWindowImpl();
74   if (!NT_SUCCESS(Status))
75   {
76     DbgPrint("Failed to initialize window implementation!\n");
77     return STATUS_UNSUCCESSFUL;
78   }
79
80   Status = InitInputImpl();
81   if (!NT_SUCCESS(Status))
82     {
83       DbgPrint("Failed to initialize input implementation.\n");
84       return(Status);
85     }
86
87   Status = MsqInitializeImpl();
88   if (!NT_SUCCESS(Status))
89     {
90       DbgPrint("Failed to initialize message queue implementation.\n");
91       return(Status);
92     }
93
94   return STATUS_SUCCESS;
95 }
96
97
98 BOOLEAN
99 STDCALL
100 W32kInitialize (VOID)
101 {
102   DPRINT("in W32kInitialize\n");
103   InitGdiObjectHandleTable ();
104
105   // Create surface used to draw the internal font onto
106   CreateCellCharSurface();
107
108   // Create stock objects, ie. precreated objects commonly used by win32 applications
109   CreateStockObjects();
110
111   // Initialize FreeType library
112   if(!InitFontSupport()) return FALSE;
113
114   return TRUE;
115 }
116
117 /* EOF */