PDA

View Full Version : Service Path



NewsArchive
05-14-2010, 01:23 AM
Is there a way to get more info on a Service than just whether or not it is
running?
I would like to know the path it is running from.

Any ideas?

Thanks,
--Glenn.

NewsArchive
05-14-2010, 01:24 AM
Glenn,

> Is there a way to get more info on a Service than just whether or not it
> is running?
> I would like to know the path it is running from.
>
> Any ideas?

With the Windows Service APIs (Advapi32.dll), it should be possible to use
the "QueryServiceConfig" API to retrieve the binary path. But there is no
built-in function in SetupBuilder to handle this, so you have to develop
your own small DLL and call this from the installer.

Open a handle to the service using the "OpenService" API, then call
"QueryServiceConfig" and the second parameter (lpServiceConfig) holds the
fully-qualified path to the service binary file in
lpServiceConfig->lpBinaryPathName.

Friedrich

NewsArchive
05-14-2010, 01:25 AM
That sounds good. In the mean time I found this:

Set Variable %MYSERVICEREGENTRY% to FUNCTION:Get Registry Key
Value("MyServiceName") from
"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Servic es"
Set Variable %MYSERVICECURPATH% to FUNCTION:Extract Full
Folder(%MYSERVICEREGENTRY%)

Thanks!

Glenn Paschal