NT Service problem
-
Hi All, I have a NT Service.I want to shut down the service without the interpretation of SCM.So, I calling CServiceModule::Handler() with opcode "SERVICE_CONTROL_STOP" and the service to shutdown.But, my service is shutting down at the same time it's giving error "Error :2140 An Internal error occured" . How can I rectify the problem.I would like to know what happens after I say service shutdown. Thanx in advance for the help. Regards, yamini
-
Hi All, I have a NT Service.I want to shut down the service without the interpretation of SCM.So, I calling CServiceModule::Handler() with opcode "SERVICE_CONTROL_STOP" and the service to shutdown.But, my service is shutting down at the same time it's giving error "Error :2140 An Internal error occured" . How can I rectify the problem.I would like to know what happens after I say service shutdown. Thanx in advance for the help. Regards, yamini
Try this: http://support.microsoft.com/support/kb/articles/Q115/8/29.asp Kind regards, Martin
-
Try this: http://support.microsoft.com/support/kb/articles/Q115/8/29.asp Kind regards, Martin
Hi, Thanx for the idea.But, I am using ATL Service.I ahve a function CServiceModule::ServiceShutDown() & the function code goes as below. void CServieModule::ServiceShutDown() { SetServiceStatus(SERVICE_STOPPED); PostQuitMessage(dwThreadID,WM_QUIT,0,0); } I am calling this function from CServiceModule::Run() before the Loop and I put a MessageBox in CServiceModule::Handler() case SERVICE_CONTROL_STOP to indicate that the service is stopped.When I try to start the service thro' SCM I am getting MessageBox and also error that "Error :2140 An internal Error occured>". How can I update the SCM UI and notify that the Service has terminated(When the service terminates instead of Error I need to notify that Service cannot be started ).I mean, how can I terminate the service without such errors as I am using ATL generated Code & I want to achieve the service termination with this ATL Generated Code only. Thanx.
-
Hi, Thanx for the idea.But, I am using ATL Service.I ahve a function CServiceModule::ServiceShutDown() & the function code goes as below. void CServieModule::ServiceShutDown() { SetServiceStatus(SERVICE_STOPPED); PostQuitMessage(dwThreadID,WM_QUIT,0,0); } I am calling this function from CServiceModule::Run() before the Loop and I put a MessageBox in CServiceModule::Handler() case SERVICE_CONTROL_STOP to indicate that the service is stopped.When I try to start the service thro' SCM I am getting MessageBox and also error that "Error :2140 An internal Error occured>". How can I update the SCM UI and notify that the Service has terminated(When the service terminates instead of Error I need to notify that Service cannot be started ).I mean, how can I terminate the service without such errors as I am using ATL generated Code & I want to achieve the service termination with this ATL Generated Code only. Thanx.
SCM shows error 2140 in a case, when your service terminates with 'process return value' equal to 0. You have to find a way, how to return proper value (!= 0) when service process terminates. However, I cannot help you with ATL service class, because I have never used it - sorry.
-
Hi All, I have a NT Service.I want to shut down the service without the interpretation of SCM.So, I calling CServiceModule::Handler() with opcode "SERVICE_CONTROL_STOP" and the service to shutdown.But, my service is shutting down at the same time it's giving error "Error :2140 An Internal error occured" . How can I rectify the problem.I would like to know what happens after I say service shutdown. Thanx in advance for the help. Regards, yamini
I had the same problem. I made this. I saw that the problem was that the service didn't stop normally. You have a thread that is dowing the service but the service didn't know that. I put saome global variables for that. For example when I recive the SEVICE_CONTROL_STOP I update a variable like bRuning = FALSE; In the Run I always Ask about this variable, I if I find that this variable is FALSE, I go out. (Kill all process like threads, etc, and go out from Run.) Sometimes the problem is an error in the code that you in debug mode don't see. I work with trace file and with the Event log for test my Release version. Sometimes I have a mistake. I hope to Help!!!! ;) ;) ;) ;) Regards:-D Carlos Antollini.