26#define SCM_AUTOSTARTCOMPLETE_EVENT L"SC_AutoStartComplete"
59 DWORD dwSetupInProgress;
91 dwSize =
sizeof(CommandLine);
108 DPRINT1(
"Running on LiveCD\n");
115 L"SystemSetupInProgress",
118 (
LPBYTE)&dwSetupInProgress,
128 if (dwSetupInProgress == 1)
130 DPRINT1(
"ReactOS Setup currently in progress!\n");
153 L"SECURITY_SERVICES_STARTED");
162 L"SECURITY_SERVICES_STARTED");
182 L"Service Control Manager");
216 DPRINT(
"Wait for the LSA server\n");
218 DPRINT(
"LSA server running\n");
222 DPRINT(
"ScmWaitForLsa() done\n");
229 DPRINT1(
"ShutdownHandlerRoutine() called\n");
233 DPRINT1(
"Shutdown event received\n");
256 BOOL bCanDeleteNamedPipeCriticalSection =
FALSE;
259 DPRINT(
"SERVICES: Service Control Manager\n");
264 DPRINT1(
"SERVICES: Failed to check for LiveCD (Error %lu)\n", dwError);
276 if (hScmStartEvent ==
NULL)
278 DPRINT1(
"SERVICES: Failed to create the start event\n");
281 DPRINT(
"SERVICES: Created start event with handle %p\n", hScmStartEvent);
285 if (hScmAutoStartCompleteEvent ==
NULL)
287 DPRINT1(
"SERVICES: Failed to create the auto-start complete event\n");
290 DPRINT(
"SERVICES: created auto-start complete event with handle %p\n", hScmAutoStartCompleteEvent);
296 DPRINT1(
"SERVICES: Failed to create the shutdown event\n");
302 bCanDeleteNamedPipeCriticalSection =
TRUE;
314 DPRINT1(
"SERVICES: Failed to create the 'Last Known Good' control set (Error %lu)\n", dwError);
322 DPRINT1(
"SERVICES: Failed to create SCM database (Error %lu)\n", dwError);
332 DPRINT1(
"SERVICES: Could not register SCM process\n");
343 DPRINT1(
"SERVICES: Failed to acquire service start lock (Error %lu)\n", dwError);
353 DPRINT(
"SERVICES: Initialized\n");
368 SetEvent(hScmAutoStartCompleteEvent);
378 DPRINT(
"SERVICES: Running\n");
387 if (bCanDeleteNamedPipeCriticalSection !=
FALSE)
398 if (hScmAutoStartCompleteEvent !=
NULL)
402 if (hScmStartEvent !=
NULL)
405 DPRINT(
"SERVICES: Finished\n");
VOID ScmAutoStartServices(VOID)
VOID ScmInitNamedPipeCriticalSection(VOID)
DWORD ScmCreateServiceDatabase(VOID)
VOID ScmAutoShutdownServices(VOID)
VOID ScmGetBootAndSystemDriverState(VOID)
VOID ScmDeleteNamedPipeCriticalSection(VOID)
VOID ScmShutdownServiceDatabase(VOID)
DWORD ScmAcquireServiceStartLock(IN BOOL IsServiceController, OUT LPSC_RPC_LOCK lpLock)
DWORD ScmReleaseServiceStartLock(IN OUT LPSC_RPC_LOCK lpLock)
VOID ScmStartRpcServer(VOID)
VOID ScmShutdownSecurity(VOID)
DWORD ScmInitializeSecurity(VOID)
DWORD CheckForLiveCD(VOID)
VOID PrintString(LPCSTR fmt,...)
int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nShowCmd)
static HANDLE hScmShutdownEvent
#define SCM_AUTOSTARTCOMPLETE_EVENT
static HANDLE hScmSecurityServicesEvent
DWORD SetSecurityServicesEvent(VOID)
BOOL WINAPI ShutdownHandlerRoutine(DWORD dwCtrlType)
int WINAPI RegisterServicesProcess(DWORD ServicesProcessId)
VOID ScmLogEvent(DWORD dwEventId, WORD wType, WORD wStrings, LPCWSTR *lpStrings)
#define RegCloseKey(hKey)
DWORD ScmCreateLastKnownGoodControlSet(VOID)
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
BOOL WINAPI ReportEventW(IN HANDLE hEventLog, IN WORD wType, IN WORD wCategory, IN DWORD dwEventID, IN PSID lpUserSid, IN WORD wNumStrings, IN DWORD dwDataSize, IN LPCWSTR *lpStrings, IN LPVOID lpRawData)
BOOL WINAPI DeregisterEventSource(IN HANDLE hEventLog)
HANDLE WINAPI RegisterEventSourceW(IN LPCWSTR lpUNCServerName, IN LPCWSTR lpSourceName)
BOOL WINAPI DECLSPEC_HOTPATCH SetConsoleCtrlHandler(PHANDLER_ROUTINE HandlerRoutine, BOOL Add)
BOOL WINAPI SetProcessShutdownParameters(IN DWORD dwLevel, IN DWORD dwFlags)
VOID WINAPI ExitThread(IN DWORD uExitCode)
void WINAPI SHIM_OBJ_NAME() OutputDebugStringA(LPCSTR lpOutputString)
int __cdecl vsprintf(char *_Dest, const char *_Format, va_list _Args)
_CONST_RETURN wchar_t *__cdecl wcsstr(_In_z_ const wchar_t *_Str, _In_z_ const wchar_t *_SubStr)
#define ERROR_ALREADY_EXISTS
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
NTSYSAPI NTSTATUS __cdecl RtlSetProcessIsCritical(_In_ BOOLEAN NewValue, _Out_opt_ PBOOLEAN OldValue, _In_ BOOLEAN NeedBreaks)
HANDLE WINAPI DECLSPEC_HOTPATCH OpenEventW(IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN LPCWSTR lpName)
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventW(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCWSTR lpName OPTIONAL)
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFWAITLOCK * Lock
ULONG_PTR ServicesProcessId
DWORD WINAPI GetLastError(void)
#define EVENT_MODIFY_STATE
DWORD WINAPI GetCurrentProcessId(void)
#define CTRL_SHUTDOWN_EVENT
#define CTRL_LOGOFF_EVENT
void int int ULONGLONG int va_list * ap
#define HKEY_LOCAL_MACHINE