v_sowmya
January 23rd, 2008, 01:33 AM
Hi,
I hope this is the correct forum for my query..
My problem is to restart a windows service whenever a particular exception arises.
My main() function is as below:
void main(int argc,char ** argv)
{
SERVICE_TABLE_ENTRY ServiceTable[] =
{
{
argv[0],
(LPSERVICE_MAIN_FUNCTION) ServiceMain
},
{NULL, NULL}
};
BOOL success;
//Register with SCM
success = StartServiceCtrlDispatcher(ServiceTable) ;
if (!success)
{
printf("Error in StartServiceCtrlDispatcher call ");
ErrorHandler("In StartServiceCtrlDispatcher", GetLastError()) ;
}
return;
}
Pls suggest how to write the code to restart the service. I tried to invoke the StartServiceCtrlDispatcher again to restart the service. But that does not work and the return value is 0 (during the second invocation).
Pls help. I am completely new to C++.
I hope this is the correct forum for my query..
My problem is to restart a windows service whenever a particular exception arises.
My main() function is as below:
void main(int argc,char ** argv)
{
SERVICE_TABLE_ENTRY ServiceTable[] =
{
{
argv[0],
(LPSERVICE_MAIN_FUNCTION) ServiceMain
},
{NULL, NULL}
};
BOOL success;
//Register with SCM
success = StartServiceCtrlDispatcher(ServiceTable) ;
if (!success)
{
printf("Error in StartServiceCtrlDispatcher call ");
ErrorHandler("In StartServiceCtrlDispatcher", GetLastError()) ;
}
return;
}
Pls suggest how to write the code to restart the service. I tried to invoke the StartServiceCtrlDispatcher again to restart the service. But that does not work and the return value is 0 (during the second invocation).
Pls help. I am completely new to C++.