G
Guest
I am writing a service. Before exiting the ServiceMain(), I want to call
SetServiceStatus(hServiceHandle, SERVICE_STOPPED) to set the service status
to SERVICE_STOPPED, but the SetServiceStatus() function crash immediately.
For example:
ServiceMain(...)
{
SERVICE_STATUS MyServiceStatus;
SERVICE_STATUS_HANDLE MyServiceStatusHandle;
...
MyServiceStatus.dwCurrentState = SERVICE_STOPPED;
MyServiceStatus. ... (other values)
SetServiceStatus(MyServiceStatusHandle, &MyServiceStatus); // this line
crash
MyLog("ServiceMain Existed"); // this line never reach.
}
Any idea? or I don't need to call SetServiceStatus(hServiceHandle,
SERVICE_STOPPED) to set the service status to SERVICE_STOPPED in the
ServiceMina()?
Thanks in advance,
lauch2.
SetServiceStatus(hServiceHandle, SERVICE_STOPPED) to set the service status
to SERVICE_STOPPED, but the SetServiceStatus() function crash immediately.
For example:
ServiceMain(...)
{
SERVICE_STATUS MyServiceStatus;
SERVICE_STATUS_HANDLE MyServiceStatusHandle;
...
MyServiceStatus.dwCurrentState = SERVICE_STOPPED;
MyServiceStatus. ... (other values)
SetServiceStatus(MyServiceStatusHandle, &MyServiceStatus); // this line
crash
MyLog("ServiceMain Existed"); // this line never reach.
}
Any idea? or I don't need to call SetServiceStatus(hServiceHandle,
SERVICE_STOPPED) to set the service status to SERVICE_STOPPED in the
ServiceMina()?
Thanks in advance,
lauch2.