Author: ekohl
Date: Sat Feb 20 14:04:56 2010
New Revision: 45633
URL:
http://svn.reactos.org/svn/reactos?rev=45633&view=rev
Log:
[SERVICES] When autostart services are up, signal an event.
[SYSSETUP] Wait until all autostart services are up. Bug #4194.
Patches by Dmitry Gorbachev.
See issue #4142 for more details.
Modified:
trunk/reactos/base/system/services/services.c
trunk/reactos/dll/win32/syssetup/install.c
Modified: trunk/reactos/base/system/services/services.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/services/servi…
==============================================================================
--- trunk/reactos/base/system/services/services.c [iso-8859-1] (original)
+++ trunk/reactos/base/system/services/services.c [iso-8859-1] Sat Feb 20 14:04:56 2010
@@ -48,35 +48,34 @@
BOOL
-ScmCreateStartEvent(PHANDLE StartEvent)
+ScmCreateEvent(PHANDLE Event,
+ LPCWSTR Name)
{
HANDLE hEvent;
- hEvent = CreateEvent(NULL,
- TRUE,
- FALSE,
- TEXT("SvcctrlStartEvent_A3752DX"));
+ hEvent = CreateEventW(NULL,
+ TRUE,
+ FALSE,
+ Name);
if (hEvent == NULL)
{
if (GetLastError() == ERROR_ALREADY_EXISTS)
{
- hEvent = OpenEvent(EVENT_ALL_ACCESS,
- FALSE,
- TEXT("SvcctrlStartEvent_A3752DX"));
- if (hEvent == NULL)
- {
- return FALSE;
- }
- }
- else
- {
- return FALSE;
- }
- }
-
- *StartEvent = hEvent;
-
- return TRUE;
+ hEvent = OpenEventW(EVENT_ALL_ACCESS,
+ FALSE,
+ Name);
+ }
+ }
+
+ if (hEvent)
+ {
+ DPRINT("SERVICES: created event %S with handle %x\n", Name, hEvent);
+ *Event = hEvent;
+ return TRUE;
+ }
+
+ DPRINT1("SERVICES: Failed to create event %S\n", Name);
+ return FALSE;
}
@@ -299,6 +298,7 @@
int nShowCmd)
{
HANDLE hScmStartEvent;
+ HANDLE hScmAutoStartCompleteEvent;
HANDLE hEvent;
DWORD dwError;
@@ -307,14 +307,16 @@
/* Acquire privileges to load drivers */
AcquireLoadDriverPrivilege();
- /* Create start event */
- if (!ScmCreateStartEvent(&hScmStartEvent))
- {
- DPRINT1("SERVICES: Failed to create start event\n");
+ /* Create events */
+ if (!ScmCreateEvent(&hScmAutoStartCompleteEvent,
L"SC_AutoStartComplete"))
+ {
ExitThread(0);
}
- DPRINT("SERVICES: created start event with handle %x.\n", hScmStartEvent);
+ if (!ScmCreateEvent(&hScmStartEvent, L"SvcctrlStartEvent_A3752DX"))
+ {
+ ExitThread(0);
+ }
// ScmInitThreadManager();
@@ -353,6 +355,9 @@
DPRINT("SERVICES: Running.\n");
+
+ /* Signal complete event */
+ SetEvent(hScmAutoStartCompleteEvent);
#if 1
hEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
Modified: trunk/reactos/dll/win32/syssetup/install.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/syssetup/install…
==============================================================================
--- trunk/reactos/dll/win32/syssetup/install.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/syssetup/install.c [iso-8859-1] Sat Feb 20 14:04:56 2010
@@ -481,9 +481,20 @@
DWORD BytesNeeded = 0;
DWORD dwWaitTime;
DWORD dwMaxWait;
+ HANDLE hEvent;
BOOL ret = FALSE;
- hSCManager = OpenSCManager(NULL, NULL, 0);
+ hEvent = OpenEventW(EVENT_ALL_ACCESS,
+ FALSE,
+ L"SC_AutoStartComplete");
+ if (hEvent == NULL)
+ goto cleanup;
+
+ WaitForSingleObject(hEvent, INFINITE);
+
+ hSCManager = OpenSCManager(NULL,
+ NULL,
+ SC_MANAGER_CONNECT);
if (hSCManager == NULL)
goto cleanup;