mirror of
https://github.com/reactos/reactos.git
synced 2024-08-19 18:02:55 +00:00
Make Services.exe and Winlogon.exe wait for the LSA server to be up and running. Otherwise calls to any LSA function might fail.
Thanks to Roel Messiant for testing and analyzing the debug logs. See issue #5497 for more details. svn path=/trunk/; revision=48757
This commit is contained in:
parent
2270e330b0
commit
46d89d3a50
|
@ -80,6 +80,42 @@ ScmCreateStartEvent(PHANDLE StartEvent)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static VOID
|
||||||
|
ScmWaitForLsass(VOID)
|
||||||
|
{
|
||||||
|
HANDLE hEvent;
|
||||||
|
DWORD dwError;
|
||||||
|
|
||||||
|
hEvent = CreateEventW(NULL,
|
||||||
|
TRUE,
|
||||||
|
FALSE,
|
||||||
|
L"LSA_RPC_SERVER_ACTIVE");
|
||||||
|
if (hEvent == NULL)
|
||||||
|
{
|
||||||
|
dwError = GetLastError();
|
||||||
|
DPRINT("Failed to create the notication event (Error %lu)\n", dwError);
|
||||||
|
|
||||||
|
if (dwError == ERROR_ALREADY_EXISTS)
|
||||||
|
{
|
||||||
|
hEvent = OpenEventW(SYNCHRONIZE,
|
||||||
|
FALSE,
|
||||||
|
L"LSA_RPC_SERVER_ACTIVE");
|
||||||
|
if (hEvent == NULL)
|
||||||
|
{
|
||||||
|
DPRINT1("Could not open the notification event (Error %lu)\n", GetLastError());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
DPRINT("Wait for the LSA server!\n");
|
||||||
|
WaitForSingleObject(hEvent, INFINITE);
|
||||||
|
DPRINT("LSA server running!\n");
|
||||||
|
|
||||||
|
CloseHandle(hEvent);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
BOOL
|
BOOL
|
||||||
ScmNamedPipeHandleRequest(PVOID Request,
|
ScmNamedPipeHandleRequest(PVOID Request,
|
||||||
DWORD RequestSize,
|
DWORD RequestSize,
|
||||||
|
@ -304,9 +340,6 @@ wWinMain(HINSTANCE hInstance,
|
||||||
|
|
||||||
DPRINT("SERVICES: Service Control Manager\n");
|
DPRINT("SERVICES: Service Control Manager\n");
|
||||||
|
|
||||||
/* Acquire privileges to load drivers */
|
|
||||||
AcquireLoadDriverPrivilege();
|
|
||||||
|
|
||||||
/* Create start event */
|
/* Create start event */
|
||||||
if (!ScmCreateStartEvent(&hScmStartEvent))
|
if (!ScmCreateStartEvent(&hScmStartEvent))
|
||||||
{
|
{
|
||||||
|
@ -346,6 +379,12 @@ wWinMain(HINSTANCE hInstance,
|
||||||
/* Register event handler (used for system shutdown) */
|
/* Register event handler (used for system shutdown) */
|
||||||
SetConsoleCtrlHandler(ShutdownHandlerRoutine, TRUE);
|
SetConsoleCtrlHandler(ShutdownHandlerRoutine, TRUE);
|
||||||
|
|
||||||
|
/* Wait for the LSA server */
|
||||||
|
ScmWaitForLsass();
|
||||||
|
|
||||||
|
/* Acquire privileges to load drivers */
|
||||||
|
AcquireLoadDriverPrivilege();
|
||||||
|
|
||||||
/* Start auto-start services */
|
/* Start auto-start services */
|
||||||
ScmAutoStartServices();
|
ScmAutoStartServices();
|
||||||
|
|
||||||
|
|
|
@ -199,6 +199,43 @@ StartLsass(VOID)
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static VOID
|
||||||
|
WaitForLsass(VOID)
|
||||||
|
{
|
||||||
|
HANDLE hEvent;
|
||||||
|
DWORD dwError;
|
||||||
|
|
||||||
|
hEvent = CreateEventW(NULL,
|
||||||
|
TRUE,
|
||||||
|
FALSE,
|
||||||
|
L"LSA_RPC_SERVER_ACTIVE");
|
||||||
|
if (hEvent == NULL)
|
||||||
|
{
|
||||||
|
dwError = GetLastError();
|
||||||
|
TRACE("WL: Failed to create the notication event (Error %lu)\n", dwError);
|
||||||
|
|
||||||
|
if (dwError == ERROR_ALREADY_EXISTS)
|
||||||
|
{
|
||||||
|
hEvent = OpenEventW(SYNCHRONIZE,
|
||||||
|
FALSE,
|
||||||
|
L"LSA_RPC_SERVER_ACTIVE");
|
||||||
|
if (hEvent == NULL)
|
||||||
|
{
|
||||||
|
ERR("WL: Could not open the notification event (Error %lu)\n", GetLastError());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TRACE("WL: Wait for the LSA server!\n");
|
||||||
|
WaitForSingleObject(hEvent, INFINITE);
|
||||||
|
TRACE("WL: LSA server running!\n");
|
||||||
|
|
||||||
|
CloseHandle(hEvent);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
BOOL
|
BOOL
|
||||||
DisplayStatusMessage(
|
DisplayStatusMessage(
|
||||||
IN PWLSESSION Session,
|
IN PWLSESSION Session,
|
||||||
|
@ -348,6 +385,10 @@ WinMain(
|
||||||
|
|
||||||
DisplayStatusMessage(WLSession, WLSession->WinlogonDesktop, IDS_REACTOSISSTARTINGUP);
|
DisplayStatusMessage(WLSession, WLSession->WinlogonDesktop, IDS_REACTOSISSTARTINGUP);
|
||||||
|
|
||||||
|
|
||||||
|
/* Wait for the LSA server */
|
||||||
|
WaitForLsass();
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
/* Connect to NetLogon service (lsass.exe) */
|
/* Connect to NetLogon service (lsass.exe) */
|
||||||
/* Real winlogon uses "Winlogon" */
|
/* Real winlogon uses "Winlogon" */
|
||||||
|
|
|
@ -45,9 +45,10 @@ LsapInitLsa(VOID)
|
||||||
hEvent = OpenEventW(GENERIC_WRITE,
|
hEvent = OpenEventW(GENERIC_WRITE,
|
||||||
FALSE,
|
FALSE,
|
||||||
L"LSA_RPC_SERVER_ACTIVE");
|
L"LSA_RPC_SERVER_ACTIVE");
|
||||||
if (hEvent != NULL)
|
if (hEvent == NULL)
|
||||||
{
|
{
|
||||||
ERR("Could not open the notification event!");
|
ERR("Could not open the notification event (Error %lu)\n", GetLastError());
|
||||||
|
return STATUS_UNSUCCESSFUL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue