Please enable JavaScript to view this site.

Bug 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.

 

Bug 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 svlBVStub_SetServiceCallback() that Bug 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 = svlBVStub_SetServiceCallback(serviceCallback,                // the callback

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

 if (bLogging)

 {

         if (errCode != SVL_OK)

         {

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

                 svlBVStub_writeToLogFile(errCode);

         }

 

         svlBVStub_writeToLogFileW(L"Starting Bug 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, Bug Validator gets no data

 

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

 

Until Bug 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 Bug Validator can write status messages to. You can also write your own status messages to this log file.

 

Set the log file using svlBVStub_setLogFileName. Write to it using svlBVStub_writeToLogFile(), svlBVStub_writeToLogFileA(), svlBVStub_writeToLogFileW().

 

Then when things are not working as expected take a look at the log file to see the errors. The Bug 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.