M
McKool
Hello Group,
I'm writting a Windows Services under C# to get some USB events. Because the ServiceBase class does not supports the SERVICE_CONTROL_DEVICEEVENT handler, I'm using P/Invoke to call the RegisterServiceCtrlHandlerEx funtion, using a callback to manage the needed handler. The invoke looks ok, it works.
The problem is when the services stops. My callback function receives the SERVICE_CONTROL_STOP handler but the function don't return. The Services Control shows an Error like: "The Services "myService" could not be stopped". The Service did not returned an error code.
If i hook my debug code to the service and try to stop the service again after the Error Message. I get the cursor in the Dispose function.
I think that with the calling of the ...Ex function, I have to do something more than to "return 0" when the SERVICE_CONTROL_STOP handler is received, .. Know somebody what should it be?
Thanks in advance.
I'm writting a Windows Services under C# to get some USB events. Because the ServiceBase class does not supports the SERVICE_CONTROL_DEVICEEVENT handler, I'm using P/Invoke to call the RegisterServiceCtrlHandlerEx funtion, using a callback to manage the needed handler. The invoke looks ok, it works.
The problem is when the services stops. My callback function receives the SERVICE_CONTROL_STOP handler but the function don't return. The Services Control shows an Error like: "The Services "myService" could not be stopped". The Service did not returned an error code.
If i hook my debug code to the service and try to stop the service again after the Error Message. I get the cursor in the Dispose function.
I think that with the calling of the ...Ex function, I have to do something more than to "return 0" when the SERVICE_CONTROL_STOP handler is received, .. Know somebody what should it be?
Thanks in advance.