03-15-2004 08:44 AM
03-16-2004 04:10 AM
06-11-2009 08:27 AM
This is dated early 2004. Is there any different way?
06-11-2009 01:06 PM
I chose to go the route of brute forcing it. I have an executible that accepts an install or uninstall option which then calls the appropriate functions to install itself or uninstall itself as a service .
To install as a service, you'll want to use the functions "OpenSCManager", "CreateService", "ChangeServiceConfig2" and "StartService".
For the uninstall, you'll need "OpenService" and "DeleteService"
You can google these functions and find examples of their usage.
In your main function, if there is no install/uninstall switch given, call "StartServiceCtrlDispatcher" to start your service