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.