Index: base/system/services/lock.c =================================================================== --- base/system/services/lock.c (révision 56850) +++ base/system/services/lock.c (copie de travail) @@ -22,9 +22,9 @@ /* FUNCTIONS *****************************************************************/ /* - * TRUE if locked by the Service Control Manager, FALSE otherwise + * NOTE: IsServiceController is TRUE if locked by the + * Service Control Manager, and FALSE otherwise. */ - DWORD ScmAcquireServiceStartLock(IN BOOL IsServiceController, OUT LPSC_RPC_LOCK lpLock) @@ -146,7 +146,7 @@ lpLockStatus->dwLockDuration = 0; } - /* Unlock the whole SC manager */ + /* Unlock the service database */ ScmUnlockDatabase(); return; @@ -178,7 +178,7 @@ lpLockStatus->dwLockDuration = 0; } - /* Unlock the whole SC manager */ + /* Unlock the service database */ ScmUnlockDatabase(); return; Index: base/system/services/rpcserver.c =================================================================== --- base/system/services/rpcserver.c (révision 56850) +++ base/system/services/rpcserver.c (copie de travail) @@ -2877,7 +2877,7 @@ return ERROR_ACCESS_DENIED; } - /* HACK: we need to compute instead the real length of the owner name */ + /* FIXME: we need to compute instead the real length of the owner name */ dwRequiredSize = sizeof(QUERY_SERVICE_LOCK_STATUSW) + sizeof(WCHAR); *pcbBytesNeeded = dwRequiredSize; @@ -4243,19 +4243,16 @@ } } - /* Start the service */ - dwError = ScmStartService(lpService, argc, lpVector); - /* Acquire the service start lock until the service has been started */ dwError = ScmAcquireServiceStartLock(TRUE, &Lock); if (dwError != ERROR_SUCCESS) goto done; - /* Start the service */ - dwError = ScmStartService(lpService, argc, lpVector); + /* Start the service */ + dwError = ScmStartService(lpService, argc, lpVector); - /* Release the service start lock */ - ScmReleaseServiceStartLock(&Lock); + /* Release the service start lock */ + ScmReleaseServiceStartLock(&Lock); done: /* Free the Unicode argument vector */ Index: base/system/services/services.c =================================================================== --- base/system/services/services.c (révision 56850) +++ base/system/services/services.c (copie de travail) @@ -441,8 +441,6 @@ /* Acquire privileges to load drivers */ AcquireLoadDriverPrivilege(); - ScmInitNamedPipeCriticalSection(); - /* Acquire the service start lock until autostart services have been started */ dwError = ScmAcquireServiceStartLock(TRUE, &Lock); if (dwError != ERROR_SUCCESS) @@ -451,6 +449,8 @@ goto done; } + ScmInitNamedPipeCriticalSection(); + /* Start auto-start services */ ScmAutoStartServices(); @@ -464,9 +464,9 @@ /* Wait until the shutdown event gets signaled */ WaitForSingleObject(hScmShutdownEvent, INFINITE); -done: ScmDeleteNamedPipeCriticalSection(); +done: /* Close the shutdown event */ if (hScmShutdownEvent != NULL) CloseHandle(hScmShutdownEvent);