Well, I've recently been getting into developing drivers, so I thought I should make a class to programmatically start services. But of course, I ran into some trouble on the way, as usual.

I'm using StartService to start it, but for some reason it just hangs, I've done some research over the internet and it seems it waits for ensurance from the ServiceMain function to tell the control manager that the service has successfully initialized and is now running.

The problem is, nothing seems to be working, I've initialized the ServiceMain function using StartServiceCtrlDispatcher() but it never seems to be called, I've inserted some code into the servicemain function to ensure it's being called, and it isn't for some odd reason.

I've made sure no other function in the process is failing, CreateService returns success, as does OpenService, but as soon as I get to StartService, it hangs, and the only way it'll let me call StartService again is after I reboot.

So, I guess what I'm asking is, if there are any simple explanations of how I can fix this, maybe some code if you guys don't mind.

Thanks in advance.
Much appreciated.

6 Years
Discussion Span
Last Post by Davidm44

I'm running Windows XP Professional 32-bit.

I don't believe I'm getting access right issues, since I'm able to get the first service running, it just hangs after that. Or maybe I'm not getting something here.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.