Compartilhar via


EnumServices

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

This function returns information about all running services on the device.

Syntax

BOOL EnumServices(
  PBYTE pBuffer,
  DWORD pdwServiceEntries,
  DWORD pdwBufferLen
);

Parameters

  • pBuffer
    [in] Pointer to the buffer to hold the output. The first part of the buffer is an array that contains a total of pdwServiceEntries ServiceEnumInfo structures. The next part of the buffer contains the szDllName member of the ServiceEnumInfo structures.
  • pdwServiceEntries
    [out] Pointer to the DWORD that specifies the number of running service instances.
  • pdwBufferLen
    [in, out] Pointer to the DWORD that specifies the size, in bytes, of pBuffer when calling EnumServices. If pdwBufferLen is not large enough to hold the entire list of service entries, then SetLastError is called with ERROR_INSUFFICIENT_BUFFER.

Return Value

A nonzero value indicates success. A value of zero indicates failure. To get extended error information, call GetLastError.

Remarks

The number of services running in the system may change between calls to EnumServices. It is possible for an application to call EnumServices to retrieve the required buffer length, allocate a buffer of the required size, and then call EnumServices again only to have it fail because the buffer was not big enough because a new service was activated between the calls.

Requirements

Header service.h
Library coredll.lib
Windows Embedded CE Windows CE .NET 4.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also

Reference

ServiceEnumInfo

Other Resources

Services.exe