mirror of
https://github.com/reactos/reactos.git
synced 2025-01-13 01:22:03 +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
|
DWORD
|
||||||
ScmCreateServiceDatabase(VOID)
|
ScmCreateServiceDatabase(VOID)
|
||||||
{
|
{
|
||||||
|
@ -516,6 +556,9 @@ ScmCreateServiceDatabase(VOID)
|
||||||
|
|
||||||
RegCloseKey(hServicesKey);
|
RegCloseKey(hServicesKey);
|
||||||
|
|
||||||
|
/* Wait for LSA */
|
||||||
|
WaitForLSA();
|
||||||
|
|
||||||
/* Delete services that are marked for delete */
|
/* Delete services that are marked for delete */
|
||||||
ScmDeleteMarkedServices();
|
ScmDeleteMarkedServices();
|
||||||
|
|
||||||
|
|
|
@ -26,14 +26,13 @@ PWLSESSION WLSession = NULL;
|
||||||
static BOOL
|
static BOOL
|
||||||
StartServicesManager(VOID)
|
StartServicesManager(VOID)
|
||||||
{
|
{
|
||||||
HANDLE ServicesInitEvent = NULL;
|
|
||||||
STARTUPINFOW StartupInfo;
|
STARTUPINFOW StartupInfo;
|
||||||
PROCESS_INFORMATION ProcessInformation;
|
PROCESS_INFORMATION ProcessInformation;
|
||||||
DWORD Count;
|
|
||||||
LPCWSTR ServiceString = L"services.exe";
|
LPCWSTR ServiceString = L"services.exe";
|
||||||
BOOL res;
|
BOOL res;
|
||||||
|
|
||||||
/* Start the service control manager (services.exe) */
|
/* Start the service control manager (services.exe) */
|
||||||
|
ZeroMemory(&StartupInfo, sizeof(STARTUPINFOW));
|
||||||
StartupInfo.cb = sizeof(StartupInfo);
|
StartupInfo.cb = sizeof(StartupInfo);
|
||||||
StartupInfo.lpReserved = NULL;
|
StartupInfo.lpReserved = NULL;
|
||||||
StartupInfo.lpDesktop = NULL;
|
StartupInfo.lpDesktop = NULL;
|
||||||
|
@ -61,29 +60,11 @@ StartServicesManager(VOID)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Wait for event creation (by SCM) for max. 20 seconds */
|
TRACE("WL: Created new process - %S\n", ServiceString);
|
||||||
for (Count = 0; Count < 20; Count++)
|
|
||||||
{
|
|
||||||
Sleep(1000);
|
|
||||||
|
|
||||||
TRACE("WL: Attempting to open event \"SvcctrlStartEvent_A3752DX\"\n");
|
CloseHandle(ProcessInformation.hThread);
|
||||||
ServicesInitEvent = OpenEventW(
|
CloseHandle(ProcessInformation.hProcess);
|
||||||
SYNCHRONIZE,
|
|
||||||
FALSE,
|
|
||||||
L"SvcctrlStartEvent_A3752DX");
|
|
||||||
if (ServicesInitEvent)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
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");
|
TRACE("WL: StartServicesManager() done.\n");
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -99,6 +80,7 @@ StartLsass(VOID)
|
||||||
BOOL res;
|
BOOL res;
|
||||||
|
|
||||||
/* Start the service control manager (services.exe) */
|
/* Start the service control manager (services.exe) */
|
||||||
|
ZeroMemory(&StartupInfo, sizeof(STARTUPINFOW));
|
||||||
StartupInfo.cb = sizeof(StartupInfo);
|
StartupInfo.cb = sizeof(StartupInfo);
|
||||||
StartupInfo.lpReserved = NULL;
|
StartupInfo.lpReserved = NULL;
|
||||||
StartupInfo.lpDesktop = NULL;
|
StartupInfo.lpDesktop = NULL;
|
||||||
|
@ -121,6 +103,11 @@ StartLsass(VOID)
|
||||||
&StartupInfo,
|
&StartupInfo,
|
||||||
&ProcessInformation);
|
&ProcessInformation);
|
||||||
|
|
||||||
|
TRACE("WL: Created new process - %S\n", ServiceString);
|
||||||
|
|
||||||
|
CloseHandle(ProcessInformation.hThread);
|
||||||
|
CloseHandle(ProcessInformation.hProcess);
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue