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 PrintString(LPCSTR fmt,...)
ULONG_PTR ServicesProcessId
VOID ScmAutoStartServices(VOID)
static HANDLE hScmShutdownEvent
_CONST_RETURN wchar_t *__cdecl wcsstr(_In_z_ const wchar_t *_Str, _In_z_ const wchar_t *_SubStr)
VOID ScmAutoShutdownServices(VOID)
DWORD ScmCreateLastKnownGoodControlSet(VOID)
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
DWORD WINAPI GetLastError(VOID)
DWORD SetSecurityServicesEvent(VOID)
DWORD ScmInitializeSecurity(VOID)
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventW(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCWSTR lpName OPTIONAL)
HANDLE WINAPI DECLSPEC_HOTPATCH OpenEventW(IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN LPCWSTR lpName)
BOOL WINAPI SetProcessShutdownParameters(IN DWORD dwLevel, IN DWORD dwFlags)
VOID ScmGetBootAndSystemDriverState(VOID)
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
DWORD ScmAcquireServiceStartLock(IN BOOL IsServiceController, OUT LPSC_RPC_LOCK lpLock)
BOOL WINAPI DECLSPEC_HOTPATCH SetConsoleCtrlHandler(PHANDLER_ROUTINE HandlerRoutine, BOOL Add)
VOID WINAPI ExitThread(IN DWORD uExitCode)
VOID ScmLogEvent(DWORD dwEventId, WORD wType, WORD wStrings, LPCWSTR *lpStrings)
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
VOID ScmStartRpcServer(VOID)
#define CTRL_LOGOFF_EVENT
DWORD ScmReleaseServiceStartLock(IN OUT LPSC_RPC_LOCK lpLock)
int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nShowCmd)
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)
VOID ScmInitNamedPipeCriticalSection(VOID)
VOID ScmDeleteNamedPipeCriticalSection(VOID)
static HANDLE hScmSecurityServicesEvent
#define CTRL_SHUTDOWN_EVENT
BOOL WINAPI ShutdownHandlerRoutine(DWORD dwCtrlType)
int __cdecl vsprintf(char *_Dest, const char *_Format, va_list _Args)
DWORD ScmCreateServiceDatabase(VOID)
BOOL WINAPI DeregisterEventSource(IN HANDLE hEventLog)
NTSYSAPI NTSTATUS __cdecl RtlSetProcessIsCritical(_In_ BOOLEAN NewValue, _Out_opt_ PBOOLEAN OldValue, _In_ BOOLEAN NeedBreaks)
void int int ULONGLONG int va_list * ap
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFWAITLOCK * Lock
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
#define EVENT_MODIFY_STATE
DWORD CheckForLiveCD(VOID)
#define ERROR_ALREADY_EXISTS
#define SCM_AUTOSTARTCOMPLETE_EVENT
HANDLE WINAPI RegisterEventSourceW(IN LPCWSTR lpUNCServerName, IN LPCWSTR lpSourceName)
VOID ScmShutdownServiceDatabase(VOID)
void WINAPI SHIM_OBJ_NAME() OutputDebugStringA(LPCSTR lpOutputString)
VOID ScmShutdownSecurity(VOID)
#define RegCloseKey(hKey)
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
int WINAPI RegisterServicesProcess(DWORD ServicesProcessId)
DWORD WINAPI GetCurrentProcessId(VOID)
#define HKEY_LOCAL_MACHINE