please dont rip this site Prev Next

QueryServiceConfig info  Overview  Group

The QueryServiceConfig function retrieves the configuration parameters of the specified service.

BOOL QueryServiceConfig(

    SC_HANDLE hService,

// handle of service


// address of service config. structure

    DWORD cbBufSize,

// size of service configuration buffer

    LPDWORD pcbBytesNeeded 

// address of variable for bytes needed



Identifies the service. This handle is returned by the OpenService or CreateService function, and it must have SERVICE_QUERY_CONFIG access.
Points to a buffer that receives the QUERY_SERVICE_CONFIG structure in which the service configuration information is returned, plus the strings to which its members point.
Specifies the size, in bytes, of the buffer pointed to by the lpServiceConfig parameter.
Points to a variable that receives the number of bytes needed to return all the configuration information if the function fails.

Return Values

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To get extended error information, call GetLastError.


The following error codes can be set by the service control manager. Others can be set by the registry functions that are called by the service control manager.




The specified handle was not opened with SERVICE_QUERY_CONFIG access.


There is more service configuration information than would fit into the lpServiceConfig buffer. The number of bytes required to get all the information is returned in the pcbBytesNeeded parameter. Nothing is written to the lpServiceConfig buffer.


The specified handle is invalid.


The QueryServiceConfig function returns the service configuration information kept in the registry for a particular service. This configuration information is first set by a service control program using the CreateService function. This information may have been updated by a service configuration program using the ChangeServiceConfig function.

If the service was running when the configuration information was last changed, the information returned by QueryServiceConfig will not reflect the current configuration of the service. Instead, it will reflect the configuration of the service when it is next run. The DisplayName key is an exception to this. When the DisplayName key is changed, it takes effect immediately, regardless of whether the service is running.

See Also

ChangeServiceConfig, CreateService, OpenService, QUERY_SERVICE_CONFIG, QueryServiceObjectSecurity, QueryServiceStatus 

file: /Techref/os/win/api/win32/func/src/f69_8.htm, 5KB, , updated: 2000/4/7 11:19, local time: 2023/1/27 07:18,

 ©2023 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE!

<A HREF=""> QueryServiceConfig</A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type a nice message (short messages are blocked as spam) in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.

Link? Put it here: 
if you want a response, please enter your email address: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?


Welcome to!

Site supported by
sales, advertizing,
& kind contributors
just like you!

Please don't rip/copy
(here's why

Copies of the site on CD
are available at minimal cost.

Welcome to!