Code: Select all
VOID SvcInit( DWORD dwArgc, LPTSTR *lpszArgv)
{
// TO_DO: Declare and set any required variables.
// Be sure to periodically call rlReportSvcStatus() with
// SERVICE_START_PENDING. If initialization fails, call
// rlReportSvcStatus with SERVICE_STOPPED.
// Create an event. The control handler function, rlSvcCtrlHandler,
// signals this event when it receives the stop control code.
ghSvcStopEvent = CreateEvent(
NULL, // default security attributes
TRUE, // manual reset event
FALSE, // not signaled
NULL); // no name
if ( ghSvcStopEvent == NULL)
{
rlReportSvcStatus( SERVICE_STOPPED, NO_ERROR, 0 );
return true;
}
// Report running status when initialization is complete.
rlReportSvcStatus( SERVICE_RUNNING, NO_ERROR, 0 );
// TO_DO: Perform work until service stops.
wxSQLite3Database db;
while(1)
{
// Check whether to stop the service.
WaitForSingleObject(ghSvcStopEvent, INFINITE);
// This function waits until the event object is in the signaled state or the time-out interval elapses.
rlReportSvcStatus( SERVICE_STOPPED, NO_ERROR, 0 );
return true;
}
}
I'm using wxSQLite3 v2.1.1, VC9 on Windows 7.