update for HEAD-2003050101
[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   Status = InitTimerImpl();
95   if (!NT_SUCCESS(Status))
96     {
97       DbgPrint("Failed to initialize timer implementation.\n");
98       return(Status);
99     }
100
101   return STATUS_SUCCESS;
102 }
103
104 PEPROCESS W32kDeviceProcess;
105
106 BOOLEAN
107 STDCALL
108 W32kInitialize (VOID)
109 {
110   DPRINT("in W32kInitialize\n");
111
112   W32kDeviceProcess = PsGetCurrentProcess();
113
114   InitGdiObjectHandleTable ();
115
116   // Create surface used to draw the internal font onto
117 #ifdef TODO
118   CreateCellCharSurface();
119 #endif
120
121   // Initialize FreeType library
122   if(!InitFontSupport()) return FALSE;
123
124   // Create stock objects, ie. precreated objects commonly used by win32 applications
125   CreateStockObjects();
126
127   return TRUE;
128 }
129
130 /* EOF */