mirror of
https://github.com/reactos/reactos.git
synced 2025-01-12 17:16:58 +00:00
- Make the service manager wait for LSA.
- Winlogon must not wait for the service mananger, otherwise we will get another deadlock. svn path=/trunk/; revision=38065
This commit is contained in:
parent
76e4f9ca92
commit
bac49255c5
2 changed files with 53 additions and 23 deletions
|
@ -446,6 +446,46 @@ ScmDeleteMarkedServices(VOID)
|
|||
}
|
||||
|
||||
|
||||
VOID
|
||||
WaitForLSA(VOID)
|
||||
{
|
||||
HANDLE hEvent;
|
||||
DWORD dwError;
|
||||
|
||||
DPRINT1("WaitForLSA() called\n");
|
||||
|
||||
hEvent = CreateEventW(NULL,
|
||||
TRUE,
|
||||
FALSE,
|
||||
L"LSA_RPC_SERVER_ACTIVE");
|
||||
if (hEvent == NULL)
|
||||
{
|
||||
dwError = GetLastError();
|
||||
DPRINT1("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!\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DPRINT1("Wait for LSA!\n");
|
||||
WaitForSingleObject(hEvent, INFINITE);
|
||||
DPRINT1("LSA is available!\n");
|
||||
|
||||
CloseHandle(hEvent);
|
||||
|
||||
DPRINT1("WaitForLSA() done\n");
|
||||
}
|
||||
|
||||
|
||||
DWORD
|
||||
ScmCreateServiceDatabase(VOID)
|
||||
{
|
||||
|
@ -516,6 +556,9 @@ ScmCreateServiceDatabase(VOID)
|
|||
|
||||
RegCloseKey(hServicesKey);
|
||||
|
||||
/* Wait for LSA */
|
||||
WaitForLSA();
|
||||
|
||||
/* Delete services that are marked for delete */
|
||||
ScmDeleteMarkedServices();
|
||||
|
||||
|
|
|
@ -26,14 +26,13 @@ PWLSESSION WLSession = NULL;
|
|||
static BOOL
|
||||
StartServicesManager(VOID)
|
||||
{
|
||||
HANDLE ServicesInitEvent = NULL;
|
||||
STARTUPINFOW StartupInfo;
|
||||
PROCESS_INFORMATION ProcessInformation;
|
||||
DWORD Count;
|
||||
LPCWSTR ServiceString = L"services.exe";
|
||||
BOOL res;
|
||||
|
||||
/* Start the service control manager (services.exe) */
|
||||
ZeroMemory(&StartupInfo, sizeof(STARTUPINFOW));
|
||||
StartupInfo.cb = sizeof(StartupInfo);
|
||||
StartupInfo.lpReserved = NULL;
|
||||
StartupInfo.lpDesktop = NULL;
|
||||
|
@ -61,29 +60,11 @@ StartServicesManager(VOID)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
/* Wait for event creation (by SCM) for max. 20 seconds */
|
||||
for (Count = 0; Count < 20; Count++)
|
||||
{
|
||||
Sleep(1000);
|
||||
TRACE("WL: Created new process - %S\n", ServiceString);
|
||||
|
||||
TRACE("WL: Attempting to open event \"SvcctrlStartEvent_A3752DX\"\n");
|
||||
ServicesInitEvent = OpenEventW(
|
||||
SYNCHRONIZE,
|
||||
FALSE,
|
||||
L"SvcctrlStartEvent_A3752DX");
|
||||
if (ServicesInitEvent)
|
||||
break;
|
||||
}
|
||||
CloseHandle(ProcessInformation.hThread);
|
||||
CloseHandle(ProcessInformation.hProcess);
|
||||
|
||||
if (!ServicesInitEvent)
|
||||
{
|
||||
ERR("WL: Failed to open event \"SvcctrlStartEvent_A3752DX\"\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Wait for event signalization */
|
||||
WaitForSingleObject(ServicesInitEvent, INFINITE);
|
||||
CloseHandle(ServicesInitEvent);
|
||||
TRACE("WL: StartServicesManager() done.\n");
|
||||
|
||||
return TRUE;
|
||||
|
@ -99,6 +80,7 @@ StartLsass(VOID)
|
|||
BOOL res;
|
||||
|
||||
/* Start the service control manager (services.exe) */
|
||||
ZeroMemory(&StartupInfo, sizeof(STARTUPINFOW));
|
||||
StartupInfo.cb = sizeof(StartupInfo);
|
||||
StartupInfo.lpReserved = NULL;
|
||||
StartupInfo.lpDesktop = NULL;
|
||||
|
@ -121,6 +103,11 @@ StartLsass(VOID)
|
|||
&StartupInfo,
|
||||
&ProcessInformation);
|
||||
|
||||
TRACE("WL: Created new process - %S\n", ServiceString);
|
||||
|
||||
CloseHandle(ProcessInformation.hThread);
|
||||
CloseHandle(ProcessInformation.hProcess);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue