Please enable JavaScript to view this site.

Coverage Validator Help

 

Troubleshooting - Service fails to start

 

If a service takes too long to start the service control manager kills the service.

 

The way to stop this is for a service to call ReportStatusToSCMgr() to tell the service control manager that the service is still OK.

 

Coverage Validator can't do this for you as the call requires some data from any earlier call you have made.

 

The solution is that you provide a callback using svlCVStub_SetServiceCallback() that Coverage Validator can call during the process of attaching to the service, and you can call the appropriate function.

 

Example code to set the callback:

 

 errCode = svlCVStub_SetServiceCallback(serviceCallback,                // the callback

                                              NULL);                                // some user data (we don't have any, so set NULL)

 if (bLogging)

 {

         if (errCode != SVL_OK)

         {

                 svlCVStub_writeToLogFileW(L"Setting service callback failed. \r\n");

                 svlCVStub_writeToLogFile(errCode);

         }

 

         svlCVStub_writeToLogFileW(L"Starting Coverage Validator\r\n");

 }

 

 

 

Example callback:

 

static void serviceCallback(void        *userParam)

{

 // just tell the Service Control Manager that we are still busy

 // in this example userParam is not used

 //

 // note that prior to the Validator loading it's DLL ssStatus.dwCurrentState must have been initialised, most likely to SERVICE_START_PENDING

 // you could pass a fixed value here, but it would need to change once the service has finished starting up so that you don't unintentionally change the service state

 // when this callback is called. This callback is called whenever instrumentation happens (when a DLL is loaded). Thus you can't assume this is only called during service startup,

 // it may also get called later in the service lifetime.

 

 ReportStatusToSCMgr(ssStatus.dwCurrentState,        // service state

                         NO_ERROR,                        // exit code

                         3000);                                // wait hint

}

 

We strongly recommend that you set a service callback. It won't harm your program and it will remove any likelihood of your service being killed by the service control manager.

 

 

Troubleshooting - Service starts, Coverage Validator gets no data

 

If you have problems getting Coverage Validator to monitor your service you'll need to find out what's failing.

 

Until Coverage Validator loads correctly and successfully connects to the graphical user interface you have no way of knowing what is happening.

 

The solution is to set a log file that Coverage Validator can write status messages to. You can also write your own status messages to this log file.

 

Set the log file using svlCVStub_setLogFileName. Write to it using svlCVStub_writeToLogFile(), svlCVStub_writeToLogFileA(), svlCVStub_writeToLogFileW().

 

Then when things are not working as expected take a look at the log file to see the errors. The Coverage Validator will often suggest what the problem is.

 

We strongly recommend that you configure the log file and use it when working with services. It has saved us a lot of time.