12.8. Getting and Setting Configuration Information

The information passed in the call to CreateService in Section 12.5 gets stored in the registry when the SCM creates the service. You can view the information directly using the normal registry viewer, regedt32.exe, or you can run the winmsd command and view all service information there. Inside a program, it is possible both to retrieve a copy of this information and to modify it. The QueryServiceConfig function lets you obtain a copy of the configuration information.

QueryServiceConfigRetrieves configuration information in the registry for the specified service
BOOL QueryServiceConfig(
   SC_HANDLE service,
   LPQUERY_SERVICE_CONFIG config,
   DWORD bufSize,
   LPDWORD sizeNeeded)
serviceA handle ...

Get Win32 System Services: The Heart of Windows® 98 and Windows® 2000 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.