https://git.reactos.org/?p=reactos.git;a=commitdiff;h=1820aa8fe621372258c07b...
commit 1820aa8fe621372258c07b283f2ff8aee13f3565 Author: Eric Kohl eric.kohl@reactos.org AuthorDate: Fri Oct 5 09:41:50 2018 +0200 Commit: Eric Kohl eric.kohl@reactos.org CommitDate: Fri Oct 5 09:41:50 2018 +0200
[SERVICES] Revert f6d81f22 because it breaks the advapi32 LockServiceDatabase test. --- base/system/services/rpcserver.c | 59 ++++++---------------------------------- 1 file changed, 9 insertions(+), 50 deletions(-)
diff --git a/base/system/services/rpcserver.c b/base/system/services/rpcserver.c index 8e383a5bdc..7f251c8760 100644 --- a/base/system/services/rpcserver.c +++ b/base/system/services/rpcserver.c @@ -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 */ DWORD WINAPI @@ -1720,8 +1683,6 @@ RSetServiceStatus( DWORD dwPreviousType; LPCWSTR lpLogStrings[2]; WCHAR szLogBuffer[80]; - HANDLE hStopThread = NULL; - DWORD dwStopThreadId; UINT uID;
DPRINT("RSetServiceStatus() called\n"); @@ -1801,17 +1762,15 @@ RSetServiceStatus( /* If we just stopped the last running service... */ if (lpService->lpImage->dwImageRunCount == 0) { - /* Run the stop thread to stop the service dispatcher */ - hStopThread = CreateThread(NULL, - 0, - (LPTHREAD_START_ROUTINE)ScmStopThread, - (LPVOID)lpService, - 0, - &dwStopThreadId); - if (hStopThread != NULL) - { - CloseHandle(hStopThread); - } + /* Stop the dispatcher thread */ + ScmControlService(lpService->lpImage->hControlPipe, + L"", + (SERVICE_STATUS_HANDLE)lpService, + SERVICE_CONTROL_STOP); + + /* Remove the service image */ + ScmRemoveServiceImage(lpService->lpImage); + lpService->lpImage = NULL; } }