Index: base/system/services/database.c =================================================================== --- base/system/services/database.c (révision 58488) +++ base/system/services/database.c (copie de travail) @@ -1503,7 +1503,7 @@ BOOL Result; DWORD dwError = ERROR_SUCCESS; - DPRINT("ScmStartUserModeService(%p)\n", Service); + DPRINT1("ScmStartUserModeService(%p) %S\n", Service, Service->lpServiceName); /* If the image is already running ... */ if (Service->lpImage->dwImageRunCount > 1) @@ -1577,20 +1577,20 @@ LPCWSTR ErrorLogStrings[2]; WCHAR szErrorBuffer[32]; - DPRINT("ScmStartService() called\n"); + DPRINT1("ScmStartService() called\n"); - DPRINT("Start Service %p (%S)\n", Service, Service->lpServiceName); + DPRINT1("Start Service %p (%S)\n", Service, Service->lpServiceName); EnterCriticalSection(&ControlServiceCriticalSection); if (Service->Status.dwCurrentState != SERVICE_STOPPED) { - DPRINT("Service %S is already running!\n", Service->lpServiceName); + DPRINT1("Service %S is already running!\n", Service->lpServiceName); LeaveCriticalSection(&ControlServiceCriticalSection); return ERROR_SERVICE_ALREADY_RUNNING; } - DPRINT("Service->Type: %lu\n", Service->Status.dwServiceType); + DPRINT1("Service->Type: %lu\n", Service->Status.dwServiceType); if (Service->Status.dwServiceType & SERVICE_DRIVER) { @@ -1627,7 +1627,7 @@ LeaveCriticalSection(&ControlServiceCriticalSection); - DPRINT("ScmStartService() done (Error %lu)\n", dwError); + DPRINT1("ScmStartService() done (Error %lu)\n", dwError); if (dwError == ERROR_SUCCESS) { @@ -1689,6 +1689,8 @@ HKEY hKey; ULONG i; + DPRINT1("ScmAutoStartServices - enter\n"); + /* Clear 'ServiceVisited' flag (or set if not to start in Safe Mode) */ ServiceEntry = ServiceListHead.Flink; while (ServiceEntry != &ServiceListHead) @@ -1848,6 +1850,9 @@ CurrentService->ServiceVisited = FALSE; ServiceEntry = ServiceEntry->Flink; } + + DPRINT1("ScmAutoStartServices - exit\n"); + } Index: base/system/services/lock.c =================================================================== --- base/system/services/lock.c (révision 58488) +++ base/system/services/lock.c (copie de travail) @@ -32,6 +32,8 @@ DWORD dwRequiredSize; DWORD dwError = ERROR_SUCCESS; + DPRINT1("ScmAcquireServiceStartLock(%s) called\n", IsServiceController ? "TRUE" : "FALSE"); + *lpLock = NULL; /* Lock the service database exclusively */ @@ -72,6 +74,8 @@ /* Unlock the service database */ ScmUnlockDatabase(); + DPRINT1("ScmAcquireServiceStartLock exit - error %lu\n", dwError); + return dwError; } @@ -82,13 +86,21 @@ PSTART_LOCK pStartLock; DWORD dwError = ERROR_SUCCESS; + DPRINT1("ScmReleaseServiceStartLock enter\n"); + if (lpLock == NULL) + { + DPRINT1("ScmReleaseServiceStartLock exit(1) - error ERROR_INVALID_SERVICE_LOCK\n"); return ERROR_INVALID_SERVICE_LOCK; + } pStartLock = (PSTART_LOCK)*lpLock; if (pStartLock->Tag != LOCK_TAG) + { + DPRINT1("ScmReleaseServiceStartLock exit(2) - error ERROR_INVALID_SERVICE_LOCK\n"); return ERROR_INVALID_SERVICE_LOCK; + } /* Lock the service database exclusively */ ScmLockDatabaseExclusive(); @@ -111,6 +123,8 @@ /* Unlock the service database */ ScmUnlockDatabase(); + DPRINT1("ScmReleaseServiceStartLock exit - error %lu\n", dwError); + return dwError; } Index: base/system/services/rpcserver.c =================================================================== --- base/system/services/rpcserver.c (révision 58488) +++ base/system/services/rpcserver.c (copie de travail) @@ -12,7 +12,7 @@ #include "services.h" -#define NDEBUG +// #define NDEBUG #include /* GLOBALS *****************************************************************/ @@ -2941,13 +2941,19 @@ if (lpService->bDeleted) return ERROR_SERVICE_MARKED_FOR_DELETE; + DPRINT1("RStartServiceW - Trying to start service %S\n", lpService->lpServiceName); + /* Acquire the service start lock until the service has been started */ dwError = ScmAcquireServiceStartLock(TRUE, &Lock); if (dwError != ERROR_SUCCESS) + { + DPRINT1("RStartServiceW - Starting service %S, failed at locking database, error %lu\n", lpService->lpServiceName, dwError); return dwError; + } /* Start the service */ dwError = ScmStartService(lpService, argc, (LPWSTR*)argv); + DPRINT1("RStartServiceW - Starting service %S, error %lu\n", lpService->lpServiceName, dwError); /* Release the service start lock */ ScmReleaseServiceStartLock(&Lock); @@ -4244,13 +4250,19 @@ } } + DPRINT1("RStartServiceA - Trying to start service %S\n", lpService->lpServiceName); + /* Acquire the service start lock until the service has been started */ dwError = ScmAcquireServiceStartLock(TRUE, &Lock); if (dwError != ERROR_SUCCESS) + { + DPRINT1("RStartServiceA - Starting service %S, failed at locking database, error %lu\n", lpService->lpServiceName, dwError); goto done; + } /* Start the service */ dwError = ScmStartService(lpService, argc, lpVector); + DPRINT1("RStartServiceA - Starting service %S, error %lu\n", lpService->lpServiceName, dwError); /* Release the service start lock */ ScmReleaseServiceStartLock(&Lock);