X-Git-Url: https://git.reactos.org/?p=reactos.git;a=blobdiff_plain;f=reactos%2Fbase%2Fsystem%2Fservices%2Fdatabase.c;h=9a332a096d1fffbea68e3ef6872fc9f61c81d46c;hp=ed0bdcb61d673ecfb3d7bba6a55102371eae8c32;hb=62de69219afec2bd407c34ee0228d0e1d983512c;hpb=27b33c3045beaeda3cd8ebfb18bd4660b4ab733f diff --git a/reactos/base/system/services/database.c b/reactos/base/system/services/database.c index ed0bdcb61d6..9a332a096d1 100644 --- a/reactos/base/system/services/database.c +++ b/reactos/base/system/services/database.c @@ -922,8 +922,6 @@ ScmStartUserModeService(PSERVICE Service, return Status; } - EnterCriticalSection(&StartServiceCriticalSection); - /* Create '\\.\pipe\net\NtControlPipeXXX' instance */ swprintf(NtControlPipeName, L"\\\\.\\pipe\\net\\NtControlPipe%u", ServiceCurrent); Service->ControlPipeHandle = CreateNamedPipeW(NtControlPipeName, @@ -938,7 +936,6 @@ ScmStartUserModeService(PSERVICE Service, if (Service->ControlPipeHandle == INVALID_HANDLE_VALUE) { DPRINT1("Failed to create control pipe!\n"); - LeaveCriticalSection(&StartServiceCriticalSection); return GetLastError(); } @@ -970,7 +967,6 @@ ScmStartUserModeService(PSERVICE Service, Service->ControlPipeHandle = INVALID_HANDLE_VALUE; DPRINT1("Starting '%S' failed!\n", Service->lpServiceName); - LeaveCriticalSection(&StartServiceCriticalSection); return dwError; } @@ -1030,8 +1026,6 @@ ScmStartUserModeService(PSERVICE Service, CloseHandle(ProcessInformation.hThread); CloseHandle(ProcessInformation.hProcess); - LeaveCriticalSection(&StartServiceCriticalSection); - return dwError; } @@ -1042,6 +1036,8 @@ ScmStartService(PSERVICE Service, DWORD argc, LPWSTR *argv) PSERVICE_GROUP Group = Service->lpGroup; DWORD dwError = ERROR_SUCCESS; + EnterCriticalSection(&StartServiceCriticalSection); + DPRINT("ScmStartService() called\n"); Service->ControlPipeHandle = INVALID_HANDLE_VALUE; @@ -1072,6 +1068,7 @@ ScmStartService(PSERVICE Service, DWORD argc, LPWSTR *argv) } DPRINT("ScmStartService() done (Error %lu)\n", dwError); + LeaveCriticalSection(&StartServiceCriticalSection); if (dwError == ERROR_SUCCESS) {