Alaska Software Inc. - Service name
Username: Password:
AuthorTopic: Service name
Angel LafuenteService name
on Mon, 13 Jan 2020 15:05:18 +0100

Is possible to obtain the service name inside service.


José Angel Ramírez
Andreas Gehrs-Pahl
Re: Service name
on Sun, 26 Jan 2020 08:08:13 -0500
José Angel Ramírez,

>Is possible to obtain the service name inside service.

Probably with OT4Xb, but I don't know how, exactly.

You need to get the Names and ProcessIDs of all (running) Services (of type 
SERVICE_WIN32_OWN_PROCESS) (using the EnumServicesStatusExA function) and 
compare them with your service's ProcessID (using the GetCurrentProcessId 
function). But because EnumServicesStatusEx deals with (nested) structures, 
you will probably need OT4Xb to determine which Service corresponds with 
your program's ProcessID.

Here is an example:

But that example will only work if your program's service account has Query 
Service Status permission. See also:

Hope this helps to get you started.

Maybe you can post your results here, if you get it to work?


Andreas Gehrs-Pahl
Absolute Software, LLC

phone: (989) 723-9927