Author: gedmurphy
Date: Mon Jul 16 20:00:37 2007
New Revision: 27695
URL:
http://svn.reactos.org/svn/reactos?rev=27695&view=rev
Log:
Wait for the SCM to be fully initialized before calling allowing a call to OpenSCManager
Modified:
trunk/reactos/base/system/services/rpcserver.c
trunk/reactos/base/system/services/services.c
trunk/reactos/base/system/services/services.h
Modified: trunk/reactos/base/system/services/rpcserver.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/services/rpcse…
==============================================================================
--- trunk/reactos/base/system/services/rpcserver.c (original)
+++ trunk/reactos/base/system/services/rpcserver.c Mon Jul 16 20:00:37 2007
@@ -1511,6 +1511,9 @@
if (ScmShutdown)
return ERROR_SHUTDOWN_IN_PROGRESS;
+ if (!ScmWaitForEvent())
+ return ERROR_ACCESS_DENIED;
+
dwError = ScmCreateManagerHandle(lpDatabaseName,
&hHandle);
if (dwError != ERROR_SUCCESS)
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 (original)
+++ trunk/reactos/base/system/services/services.c Mon Jul 16 20:00:37 2007
@@ -91,6 +91,27 @@
*StartEvent = hEvent;
return TRUE;
+}
+
+
+BOOL ScmWaitForEvent()
+{
+ HANDLE hEvent;
+
+ hEvent = OpenEvent(EVENT_ALL_ACCESS,
+ FALSE,
+ TEXT("SvcctrlStartEvent_A3752DX"));
+
+ if (hEvent)
+ {
+ DWORD ret = WaitForSingleObject(hEvent,
+ INFINITE);
+
+ if (ret == WAIT_OBJECT_0)
+ return TRUE;
+ }
+
+ return FALSE;
}
Modified: trunk/reactos/base/system/services/services.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/services/servi…
==============================================================================
--- trunk/reactos/base/system/services/services.h (original)
+++ trunk/reactos/base/system/services/services.h Mon Jul 16 20:00:37 2007
@@ -134,6 +134,7 @@
/* services.c */
+BOOL ScmWaitForEvent();
VOID PrintString(LPCSTR fmt, ...);
/* EOF */