2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS User API Server DLL
4 * FILE: win32ss/user/winsrv/usersrv/init.c
5 * PURPOSE: Initialization
6 * PROGRAMMERS: Dmitry Philippov (shedon@mail.ru)
7 * Hermes Belusca-Maito (hermes.belusca@sfr.fr)
10 /* INCLUDES *******************************************************************/
19 /* GLOBALS ********************************************************************/
21 HINSTANCE UserServerDllInstance
= NULL
;
24 HANDLE UserServerHeap
= NULL
; // Our own heap.
26 // Windows Server 2003 table from http://j00ru.vexillium.org/csrss_list/api_list.html#Windows_2k3
27 PCSR_API_ROUTINE UserServerApiDispatchTable
[UserpMaxApiNumber
- USERSRV_FIRST_API_NUMBER
] =
32 SrvRegisterServicesProcess
, // Not present in Win7
34 SrvGetThreadConsoleDesktop
, // Not present in Win7
36 SrvRegisterLogonProcess
, // Not present in Win7
37 SrvCreateSystemThreads
,
38 SrvRecordShutdownReason
,
39 // SrvCancelShutdown, // Added in Vista
40 // SrvConsoleHandleOperation, // Added in Win7
41 // SrvGetSetShutdownBlockReason, // Added in Vista
44 BOOLEAN UserServerApiServerValidTable
[UserpMaxApiNumber
- USERSRV_FIRST_API_NUMBER
] =
46 FALSE
, // SrvExitWindowsEx
49 FALSE
, // SrvRegisterServicesProcess
50 FALSE
, // SrvActivateDebugger
51 TRUE
, // SrvGetThreadConsoleDesktop
52 FALSE
, // SrvDeviceEvent
53 FALSE
, // SrvRegisterLogonProcess
54 FALSE
, // SrvCreateSystemThreads
55 FALSE
, // SrvRecordShutdownReason
56 // FALSE, // SrvCancelShutdown
57 // FALSE, // SrvConsoleHandleOperation
58 // FALSE, // SrvGetSetShutdownBlockReason
62 * On Windows Server 2003, CSR Servers contain
63 * the API Names Table only in Debug Builds.
66 PCHAR UserServerApiNameTable
[UserpMaxApiNumber
- USERSRV_FIRST_API_NUMBER
] =
71 "SrvRegisterServicesProcess",
72 "SrvActivateDebugger",
73 "SrvGetThreadConsoleDesktop",
75 "SrvRegisterLogonProcess",
76 "SrvCreateSystemThreads",
77 "SrvRecordShutdownReason",
78 // "SrvCancelShutdown",
79 // "SrvConsoleHandleOperation",
80 // "SrvGetSetShutdownBlockReason",
84 /* FUNCTIONS ******************************************************************/
86 // PUSER_SOUND_SENTRY. Used in basesrv.dll
87 BOOL WINAPI
_UserSoundSentry(VOID
)
89 // TODO: Do something.
95 CreateSystemThreads(PVOID pParam
)
97 NtUserCallOneParam((DWORD
)pParam
, ONEPARAM_ROUTINE_CREATESYSTEMTHREADS
);
98 DPRINT1("This thread should not terminate!\n");
102 CSR_API(SrvCreateSystemThreads
)
104 DPRINT1("%s not yet implemented\n", __FUNCTION__
);
105 return STATUS_NOT_IMPLEMENTED
;
108 CSR_API(SrvActivateDebugger
)
110 DPRINT1("%s not yet implemented\n", __FUNCTION__
);
111 return STATUS_NOT_IMPLEMENTED
;
114 CSR_API(SrvGetThreadConsoleDesktop
)
116 PUSER_GET_THREAD_CONSOLE_DESKTOP GetThreadConsoleDesktopRequest
= &((PUSER_API_MESSAGE
)ApiMessage
)->Data
.GetThreadConsoleDesktopRequest
;
118 DPRINT1("%s not yet implemented\n", __FUNCTION__
);
120 /* Return nothing for the moment... */
121 GetThreadConsoleDesktopRequest
->ConsoleDesktop
= NULL
;
123 /* Always succeeds */
124 return STATUS_SUCCESS
;
127 CSR_API(SrvDeviceEvent
)
129 DPRINT1("%s not yet implemented\n", __FUNCTION__
);
130 return STATUS_NOT_IMPLEMENTED
;
133 CSR_SERVER_DLL_INIT(UserServerDllInitialization
)
135 /*** From win32csr... ***/
140 /*** END - From win32csr... ***/
142 /* Initialize the memory */
143 UserServerHeap
= RtlGetProcessHeap();
145 /* Initialize the video */
146 NtUserInitialize(0, NULL
, NULL
);
148 /* Setup the DLL Object */
149 LoadedServerDll
->ApiBase
= USERSRV_FIRST_API_NUMBER
;
150 LoadedServerDll
->HighestApiSupported
= UserpMaxApiNumber
;
151 LoadedServerDll
->DispatchTable
= UserServerApiDispatchTable
;
152 LoadedServerDll
->ValidTable
= UserServerApiServerValidTable
;
154 LoadedServerDll
->NameTable
= UserServerApiNameTable
;
156 LoadedServerDll
->SizeOfProcessData
= 0;
157 LoadedServerDll
->ConnectCallback
= NULL
;
158 LoadedServerDll
->DisconnectCallback
= NULL
;
159 LoadedServerDll
->HardErrorCallback
= UserServerHardError
;
160 LoadedServerDll
->ShutdownProcessCallback
= UserClientShutdown
;
162 UserServerDllInstance
= LoadedServerDll
->ServerHandle
;
164 /*** From win32csr... See r54125 ***/
165 /* Start the Raw Input Thread and the Desktop Thread */
166 for (i
= 0; i
< 2; ++i
)
168 Status
= RtlCreateUserThread(NtCurrentProcess(),
171 (PVOID
)i
, &ServerThread
, &ClientId
);
172 if (NT_SUCCESS(Status
))
174 NtResumeThread(ServerThread
, NULL
);
175 NtClose(ServerThread
);
178 DPRINT1("Cannot start Raw Input Thread!\n");
180 /*** END - From win32csr... ***/
183 return STATUS_SUCCESS
;