viewpoint-particle

Author Topic: dllcall for Service Description  (Read 90 times)

bkeadle

  • Newbie
  • *
  • Posts: 2
dllcall for Service Description
« on: March 02, 2017, 12:22:02 pm »
Service descriptions used to be easily read from the registry, but now I see many service descriptions are using string redirection, e.g. "@%SystemRoot%\System32\hidserv.dll, -102".  I *think* I need to use DllCall to retrieve the service description from the specified .DLL?  I have no idea how to go about doing this.

I have a utility that prepends the Service Description with the current startup and running state which makes troubleshooting service statuses (and new services) easy.  But with the string redirection, it makes the result ugly:


td

  • Tech Support
  • *****
  • Posts: 1955
    • WinBatch
Re: dllcall for Service Description
« Reply #1 on: March 02, 2017, 01:23:53 pm »
Assuming by redirection you are referring to the %SystemRoot% environmental variable in the path, you don't need to use  any DllCall calls.  You can use the  RegQueryExpSz function if the registry value is of type REG_EXPAND_SZ or you can perform a string replacement on the value yourself by using the Enviroment function to get the current value of SystemRoot and use StrReplace to perform the string replacement.  Just remember to escape the percent ('%') character with 2 percent signs ('%%') in any string literals.
"DON'T PANIC”
The Hitchhiker's Guide to the Galaxy, Douglas Adams


ChuckC

  • Full Member
  • ***
  • Posts: 110
Re: dllcall for Service Description
« Reply #2 on: March 03, 2017, 07:38:14 am »
What kind of string value do you get when you use the Win32 Network Extender's wntSvcCfgGet() function with Request # 10 to retrieve the service description?  Is it returning the proper description value that you'd expect to see, or is it returning the same redirection string that's stored in the registry?



bkeadle

  • Newbie
  • *
  • Posts: 2
Re: dllcall for Service Description
« Reply #3 on: March 03, 2017, 08:50:48 am »
That did the trick, wntSvcCfgGet().  Thank you!

td

  • Tech Support
  • *****
  • Posts: 1955
    • WinBatch
Re: dllcall for Service Description
« Reply #4 on: March 03, 2017, 09:05:34 am »
Thanks Chuck.
"DON'T PANIC”
The Hitchhiker's Guide to the Galaxy, Douglas Adams


ChuckC

  • Full Member
  • ***
  • Posts: 110
Re: dllcall for Service Description
« Reply #5 on: March 03, 2017, 09:07:00 am »
you're welcome :)