Author | Topic: Service name | |
---|---|---|
Angel Lafuente | Service name on Mon, 13 Jan 2020 15:05:18 +0100 Hello, Is possible to obtain the service name inside service. TIA 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: https://stackoverflow.com/questions/11507021/how-do-i-get-the-name-of-a-service-from-the-proccess-id But that example will only work if your program's service account has Query Service Status permission. See also: https://stackoverflow.com/questions/21347562/get-service-name-inside-service Hope this helps to get you started. Maybe you can post your results here, if you get it to work? Andreas Andreas Gehrs-Pahl Absolute Software, LLC phone: (989) 723-9927 email: Andreas@AbsoluteSoftwareLLC.com web: http://www.AbsoluteSoftwareLLC.com [F]: https://www.facebook.com/AbsoluteSoftwareLLC |