Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to check if an EXE is a Window service or not?

Status
Not open for further replies.

djjd47130

Programmer
Nov 1, 2010
480
0
0
US
I have been building services for various reasons lately, and also a tool to manage such services. I just need a single function to identify if a specified EXE file is a windows service or not.

function FileIsService(Filename: String): Bool;
begin
//Must be a way to check an EXE for certain parameters
//to see if it is an installable windows service
end;


JD Solutions
 
This is a bit tricky. Service applications are just normal .exe files.

From here the advice is to check the import table of the executable for a function link that all (and only) services use.

From here is some structure, which I'm not 100% sure applies to all .exe files.

Hopefully that's got you thinking. I'm sure you can find out more from this. Post back if you need more help.
 
Thanks. BTW, not to be confusing... I don't need to check if it's a valid "Installed" service, as I can find that out in the Registry. I need to check the file its self if it is a service or another type of exe file.

JD Solutions
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top