mirror of
https://github.com/reactos/reactos.git
synced 2025-04-29 10:39:07 +00:00
[SERVICES]
Correct comments and code error introduced in rev 56844. Patch by Hermes Belusca. I used a helper variable to determine whether or not ScmDeleteNamedPipeCriticalSection must be called. Changing the order in which functions are called could cause a deadlock. See issue #7172 for more details. svn path=/trunk/; revision=56861
This commit is contained in:
parent
aec110d514
commit
84b02d3d64
3 changed files with 11 additions and 11 deletions
|
@ -22,9 +22,9 @@ static PSTART_LOCK pServiceStartLock = NULL;
|
|||
/* 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 @@ ScmQueryServiceLockStatusW(OUT LPQUERY_SERVICE_LOCK_STATUSW lpLockStatus)
|
|||
lpLockStatus->dwLockDuration = 0;
|
||||
}
|
||||
|
||||
/* Unlock the whole SC manager */
|
||||
/* Unlock the service database */
|
||||
ScmUnlockDatabase();
|
||||
|
||||
return;
|
||||
|
@ -178,7 +178,7 @@ ScmQueryServiceLockStatusA(OUT LPQUERY_SERVICE_LOCK_STATUSA lpLockStatus)
|
|||
lpLockStatus->dwLockDuration = 0;
|
||||
}
|
||||
|
||||
/* Unlock the whole SC manager */
|
||||
/* Unlock the service database */
|
||||
ScmUnlockDatabase();
|
||||
|
||||
return;
|
||||
|
|
|
@ -2877,7 +2877,7 @@ DWORD RQueryServiceLockStatusW(
|
|||
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,16 +4243,13 @@ DWORD RStartServiceA(
|
|||
}
|
||||
}
|
||||
|
||||
/* 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);
|
||||
|
|
|
@ -378,6 +378,7 @@ wWinMain(HINSTANCE hInstance,
|
|||
{
|
||||
HANDLE hScmStartEvent = NULL;
|
||||
SC_RPC_LOCK Lock = NULL;
|
||||
BOOL bDeleteCriticalSection = FALSE;
|
||||
DWORD dwError;
|
||||
|
||||
DPRINT("SERVICES: Service Control Manager\n");
|
||||
|
@ -442,6 +443,7 @@ wWinMain(HINSTANCE hInstance,
|
|||
AcquireLoadDriverPrivilege();
|
||||
|
||||
ScmInitNamedPipeCriticalSection();
|
||||
bDeleteCriticalSection = TRUE;
|
||||
|
||||
/* Acquire the service start lock until autostart services have been started */
|
||||
dwError = ScmAcquireServiceStartLock(TRUE, &Lock);
|
||||
|
@ -465,7 +467,8 @@ wWinMain(HINSTANCE hInstance,
|
|||
WaitForSingleObject(hScmShutdownEvent, INFINITE);
|
||||
|
||||
done:
|
||||
ScmDeleteNamedPipeCriticalSection();
|
||||
if (bDeleteCriticalSection == TRUE)
|
||||
ScmDeleteNamedPipeCriticalSection();
|
||||
|
||||
/* Close the shutdown event */
|
||||
if (hScmShutdownEvent != NULL)
|
||||
|
|
Loading…
Reference in a new issue