Reputation: 599
I'm creating simple service manager in C# because we create services as an extensions to application. I'm able to get list of installed services with path to exe file but one of feature in wishlist is to recognize services in given path which are not installed and list them with install button.
Is there a way to recognize if exe file is Windows service?
Upvotes: 1
Views: 967
Reputation: 101764
A service has no special attributes nor properties, the only way to detect if a .exe is a service is to see if it calls one of the service functions. Looking for StartServiceCtrlDispatcher
as a string is probably the best option.
Note: If somebody knows that you are looking for this they could easily "encrypt" the StartServiceCtrlDispatcher string and bind to the function at run-time with GetProcAddress
.
Upvotes: 3