Split the initial status code for drivers and services.

You can easily test services by uncommenting '#define USE_SERVICE_STATUS_PENDING'.

svn path=/trunk/; revision=45663
This commit is contained in:
Eric Kohl 2010-02-22 23:17:03 +00:00
parent 606504c918
commit b37ba9e7e6

View file

@ -17,6 +17,11 @@
#define NDEBUG #define NDEBUG
#include <debug.h> #include <debug.h>
/*
* Uncomment the line below to start services
* using the SERVICE_START_PENDING state
*/
// #define USE_SERVICE_START_PENDING
/* GLOBALS *******************************************************************/ /* GLOBALS *******************************************************************/
@ -1038,12 +1043,23 @@ ScmStartService(PSERVICE Service, DWORD argc, LPWSTR *argv)
/* Load driver */ /* Load driver */
dwError = ScmLoadDriver(Service); dwError = ScmLoadDriver(Service);
if (dwError == ERROR_SUCCESS) if (dwError == ERROR_SUCCESS)
{
Service->Status.dwControlsAccepted = SERVICE_ACCEPT_STOP; Service->Status.dwControlsAccepted = SERVICE_ACCEPT_STOP;
Service->Status.dwCurrentState = SERVICE_RUNNING;
}
} }
else else
{ {
/* Start user-mode service */ /* Start user-mode service */
dwError = ScmStartUserModeService(Service, argc, argv); dwError = ScmStartUserModeService(Service, argc, argv);
if (dwError == ERROR_SUCCESS)
{
#ifdef USE_SERVICE_START_PENDING
Service->Status.dwCurrentState = SERVICE_START_PENDING;
#else
Service->Status.dwCurrentState = SERVICE_RUNNING;
#endif
}
} }
DPRINT("ScmStartService() done (Error %lu)\n", dwError); DPRINT("ScmStartService() done (Error %lu)\n", dwError);
@ -1054,7 +1070,6 @@ ScmStartService(PSERVICE Service, DWORD argc, LPWSTR *argv)
{ {
Group->ServicesRunning = TRUE; Group->ServicesRunning = TRUE;
} }
Service->Status.dwCurrentState = SERVICE_RUNNING;
} }
#if 0 #if 0
else else