[SERVICES] Revert f6d81f22 because it breaks the advapi32 LockServiceDatabase test.

This commit is contained in:
Eric Kohl 2018-10-05 09:41:50 +02:00
parent f6d81f2257
commit 1820aa8fe6

View file

@ -1671,43 +1671,6 @@ ScmIsValidServiceState(DWORD dwCurrentState)
} }
static
DWORD
WINAPI
ScmStopThread(
_In_ PVOID pParam)
{
PSERVICE pService;
DPRINT("ScmStopThread(%p)\n", pParam);
pService = (PSERVICE)pParam;
if (pService->lpImage->dwImageRunCount != 0)
return 0;
Sleep(2000);
/* Lock the service database exclusively */
ScmLockDatabaseExclusive();
/* Stop the dispatcher thread */
ScmControlService(pService->lpImage->hControlPipe,
L"",
(SERVICE_STATUS_HANDLE)pService,
SERVICE_CONTROL_STOP);
/* Remove the service image */
ScmRemoveServiceImage(pService->lpImage);
/* Unlock the service database */
ScmUnlockDatabase();
DPRINT("ScmStopThread done!\n");
return 0;
}
/* Function 7 */ /* Function 7 */
DWORD DWORD
WINAPI WINAPI
@ -1720,8 +1683,6 @@ RSetServiceStatus(
DWORD dwPreviousType; DWORD dwPreviousType;
LPCWSTR lpLogStrings[2]; LPCWSTR lpLogStrings[2];
WCHAR szLogBuffer[80]; WCHAR szLogBuffer[80];
HANDLE hStopThread = NULL;
DWORD dwStopThreadId;
UINT uID; UINT uID;
DPRINT("RSetServiceStatus() called\n"); DPRINT("RSetServiceStatus() called\n");
@ -1801,17 +1762,15 @@ RSetServiceStatus(
/* If we just stopped the last running service... */ /* If we just stopped the last running service... */
if (lpService->lpImage->dwImageRunCount == 0) if (lpService->lpImage->dwImageRunCount == 0)
{ {
/* Run the stop thread to stop the service dispatcher */ /* Stop the dispatcher thread */
hStopThread = CreateThread(NULL, ScmControlService(lpService->lpImage->hControlPipe,
0, L"",
(LPTHREAD_START_ROUTINE)ScmStopThread, (SERVICE_STATUS_HANDLE)lpService,
(LPVOID)lpService, SERVICE_CONTROL_STOP);
0,
&dwStopThreadId); /* Remove the service image */
if (hStopThread != NULL) ScmRemoveServiceImage(lpService->lpImage);
{ lpService->lpImage = NULL;
CloseHandle(hStopThread);
}
} }
} }