2 * PROJECT: ReactOS Service Host
3 * LICENSE: BSD - See COPYING.ARM in the top level directory
4 * FILE: base/services/svchost/svchost.h
5 * PURPOSE: Precompiled Header for Service Host
6 * PROGRAMMERS: ReactOS Portable Systems Group
12 #define WIN32_NO_STATUS
13 #define WIN32_LEAN_AND_MEAN
16 #include <ndk/rtlfuncs.h>
17 #include <ndk/kdtypes.h>
20 // FIXME: Should go in public headers
22 #define DPFLTR_SVCHOST_ID 28
25 // This prints out a SVCHOST-specific debug print, with the PID/TID
27 #define SvchostDbgPrint(lev, fmt, ...) \
28 DbgPrintEx(DPFLTR_SVCHOST_ID, \
30 "[SVCHOST] %lx.%lx: " fmt, \
31 GetCurrentProcessId(), \
32 GetCurrentThreadId(), \
35 #define DBG_ERR(fmt, ...) SvchostDbgPrint(1, fmt, __VA_ARGS__)
36 #define DBG_TRACE(fmt, ...) SvchostDbgPrint(4, fmt, __VA_ARGS__)
39 // This is the callback that a hosted service can register for stop notification
40 // FIXME: GLOBAL HEADER
43 (CALLBACK
*PSVCHOST_STOP_CALLBACK
) (
44 _In_ PVOID lpParameter
,
45 _In_ BOOLEAN TimerOrWaitFired
49 // Hosted Services and SvcHost Use this Structure
50 // FIXME: GLOBAL HEADER
52 typedef struct _SVCHOST_GLOBALS
59 PVOID LocalServiceSid
;
60 PVOID NetworkServiceSid
;
61 PVOID BuiltinDomainSid
;
62 PVOID AuthenticatedUserSid
;
63 PVOID AnonymousLogonSid
;
67 PVOID AliasPowerUsersSid
;
68 PVOID AliasAccountOpsSid
;
69 PVOID AliasSystemOpsSid
;
70 PVOID AliasPrintOpsSid
;
71 PVOID AliasBackupOpsSid
;
72 PVOID RpcpStartRpcServer
;
73 PVOID RpcpStopRpcServer
;
74 PVOID RpcpStopRpcServerEx
;
76 PVOID SvcNetBiosClose
;
77 PVOID SvcNetBiosReset
;
78 PVOID SvcRegisterStopCallback
;
79 } SVCHOST_GLOBALS
, *PSVCHOST_GLOBALS
;
82 // This is the callback for them to receive it
85 (WINAPI
*PSVCHOST_INIT_GLOBALS
) (
86 _In_ PSVCHOST_GLOBALS Globals
89 // Initialization Stages
91 #define SVCHOST_RPC_INIT_COMPLETE 1
92 #define SVCHOST_NBT_INIT_COMPLETE 2
93 #define SVCHOST_SID_INIT_COMPLETE 4
96 // Domain Alias SID Structure
98 typedef struct _DOMAIN_SID_DATA
105 // Well-known SID Structure
107 typedef struct _SID_DATA
110 SID_IDENTIFIER_AUTHORITY Authority
;
115 // This contains all the settings (from the registry) for a hosted service
117 typedef struct _SVCHOST_OPTIONS
119 PWCHAR CmdLineBuffer
;
121 BOOL HasServiceGroup
;
122 LPWSTR ServiceGroupName
;
123 DWORD CoInitializeSecurityParam
;
124 DWORD AuthenticationLevel
;
125 SECURITY_IMPERSONATION_LEVEL ImpersonationLevel
;
126 DWORD AuthenticationCapabilities
;
127 DWORD DefaultRpcStackSize
;
128 BOOLEAN SystemCritical
;
129 } SVCHOST_OPTIONS
, *PSVCHOST_OPTIONS
;
132 // This represents the DLL used to hold a hosted service
134 typedef struct _SVCHOST_DLL
139 LPCWSTR pszManifestPath
;
141 struct _SVCHOST_SERVICE
* pService
;
142 } SVCHOST_DLL
, *PSVCHOST_DLL
;
145 // This represents an actual hosted service
147 typedef struct _SVCHOST_SERVICE
149 LPCWSTR pszServiceName
;
150 LPCSTR pszServiceMain
;
151 LONG cServiceActiveThreadCount
;
153 PSVCHOST_STOP_CALLBACK pfnStopCallback
;
154 } SVCHOST_SERVICE
, *PSVCHOST_SERVICE
;
157 // This is the context that a hosted service with a stop callback has
159 typedef struct _SVCHOST_CALLBACK_CONTEXT
162 PSVCHOST_SERVICE pService
;
163 } SVCHOST_CALLBACK_CONTEXT
, *PSVCHOST_CALLBACK_CONTEXT
;
174 _In_ RPC_IF_HANDLE IfSpec
179 RpcpStopRpcServerEx (
180 _In_ RPC_IF_HANDLE IfSpec
187 _In_ RPC_IF_HANDLE IfSpec
192 SvchostBuildSharedGlobals (
199 _In_ LPCWSTR lpSrcStr
204 ScCreateWellKnownSids (
255 _In_ DWORD dwAuthnLevel
,
256 _In_ DWORD dwImpLevel
,
257 _In_ DWORD dwCapabilities
265 _In_ LPCWSTR pszValueName
,
266 _Out_ PDWORD pdwValue
273 _In_ LPCWSTR pszValueName
,
274 _In_ DWORD dwExpectedType
,
282 _In_ LPCWSTR pszValueName
,
283 _In_ DWORD dwExpectedType
,
284 _Out_ LPCSTR
* ppszData
289 SvcRegisterStopCallback (
290 _In_ PHANDLE phNewWaitObject
,
291 _In_ LPCWSTR ServiceName
,
293 _In_ PSVCHOST_STOP_CALLBACK pfnStopCallback
,
298 extern PSVCHOST_GLOBALS g_pSvchostSharedGlobals
;
300 #endif /* _SVCHOST_PCH_ */