please dont rip this site Prev Next

EnumDependentServices info  Overview  Group

The EnumDependentServices function provides the name and status of each service that depends on the specified service; that is, the specified service must be running before the dependent services can run.

BOOL EnumDependentServices(

    SC_HANDLE hService,

// handle to service

    DWORD dwServiceState,

// state of services to enumerate

    LPENUM_SERVICE_STATUS lpServices,

// pointer to service status buffer

    DWORD cbBufSize,

// size of service status buffer

    LPDWORD pcbBytesNeeded,

// pointer to variable for bytes needed

    LPDWORD lpServicesReturned 

// pointer to variable for number returned

   );

Parameters

hService
Handle that identifies the service. This handle is returned by the OpenService or CreateService function, and it must have SERVICE_ENUMERATE_DEPENDENTS access.
dwServiceState
Specifies the services to enumerate based on their running state. It must be one or both of the following values:

Value

Meaning

SERVICE_ACTIVE

Enumerates services that are in the following states: SERVICE_START_PENDING, SERVICE_STOP_PENDING, SERVICE_RUNNING, SERVICE_CONTINUE_PENDING, SERVICE_PAUSE_PENDING, and SERVICE_PAUSED.

SERVICE_INACTIVE

Enumerates services that are in the SERVICE_STOPPED state.

SERVICE_STATE_ALL

Combines the following states: SERVICE_ACTIVE and SERVICE_INACTIVE.

lpServices
Pointer to an array of ENUM_SERVICE_STATUS structures in which name and service status information for each dependent service in the database is returned. The buffer includes the structures, plus the strings to which their members point. The order of the services in this array is the reverse of the start order of the services. In other words, the first service in the array is the one that would be started last, and the last service in the array is the one that would be started first.
cbBufSize
Specifies the size, in bytes, of the buffer pointed to by the lpServices parameter.
pcbBytesNeeded
Pointer to a variable that receives the number of bytes needed to store the array of service entries. The variable only receives this value if the buffer pointed to by lpServices is too small, indicated by function failure and the ERROR_MORE_DATA error; otherwise, the contents of pcbBytesNeeded are undefined.
lpServicesReturned
Pointer to a variable that receives the number of service entries returned.

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.

Errors

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

Value

Meaning

ERROR_ACCESS_DENIED

The specified handle was not opened with SERVICE_ENUMERATE_DEPENDENTS access.

ERROR_INVALID_HANDLE

The specified handle is invalid.

ERROR_INVALID_PARAMETER

A parameter that was specified is invalid.

ERROR_MORE_DATA

The buffer pointed to by lpServices is not large enough. The function sets the variable pointed to by lpServicesReturned to the actual number of service entries stored into the buffer. The function sets the variable pointed to by pcbBytesNeeded to the number of bytes required to store all of the service entries.

Remarks

The returned services entries are ordered in the reverse order of the start order, with group order taken into account. If you need to stop the dependent services, you can use the order of entries written to the lpServices buffer to stop the dependent services in the proper order.

See Also

CreateService, ENUM_SERVICE_STATUS, EnumServicesStatus, OpenService

 


file: /Techref/os/win/api/win32/func/src/f19_19.htm, 7KB, , updated: 2000/4/7 11:19, local time: 2024/11/15 19:24,
TOP NEW HELP FIND: 
3.136.236.3:LOG IN

 ©2024 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="http://sxlist.com/Techref/os/win/api/win32/func/src/f19_19.htm"> EnumDependentServices</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 sxlist.com!


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 sxlist.com!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  .