Microsoft DirectX 9.0

IDirectPlay8Server::EnumServiceProviders Method

Enumerates the registered service providers available to the application.


HRESULT EnumServiceProviders(      

    const GUID *const pguidServiceProvider,     const GUID *const pguidApplication,     DPN_SERVICE_PROVIDER_INFO *const pSPInfoBuffer,     PDWORD const pcbEnumData,     PDWORD const pcReturned,     const DWORD dwFlags );


[in] Pointer to a variable of type globally unique identifier (GUID) that specifies a service provider. This optional parameter forces the enumeration of subdevices for the specified service provider. You should normally set this value to NULL, to enumerate all available service providers. Otherwise, set pguidServiceProvider to one of the following predefined values.
Internet Protocol (IP) service providers
DP8Sim service providers
Serial service providers
Modem service providers
IPX service providers
[in] Pointer to a variable of type GUID that specifies an application. If a pointer is passed in this parameter, only service providers who can be connected to the application are enumerated. You can also pass NULL to enumerate the registered service providers for the system.
[out] Pointer to an array of DPN_SERVICE_PROVIDER_INFO structures that will be filled with service provider information.
[out] Pointer to DWORD, which is filled with the size of the pSPInfoBuffer buffer if the buffer is too small.
[out] Pointer to a variable of type DWORD that specifies the number of DPN_SERVICE_PROVIDER_INFO structures returned in the pcbEnumData array.
[in] The following flag can be specified.
Enumerates all the registered service providers for the system including those that are not available to the application or do not have devices installed.

Return Value

Returns S_OK if successful, or one of the following error values.

DPNERR_BUFFERTOOSMALLThe supplied buffer is not large enough to contain the requested data.
DPNERR_INVALIDPARAMOne or more of the parameters passed to the method are invalid.


Call this method initially by specifying NULL in the pguidServiceProvider parameter to determine the base service providers available to the system. Specific devices for a service provider can be obtained by passing a pointer to a specific service provider GUID in the pguidServiceProvider. This is useful, for example, when using the Modem Connection for Microsoft?DirectPlay?service provider. You can choose between different modems for dialing out and select specific modems for hosting.

If the pcbEnumData buffer is not big enough to hold the requested service provider information, the method returns DPNERR_BUFFERTOOSMALL and the pcbEnumData parameter contains the required buffer size. Typically, the best strategy is to call the method once with a zero-length buffer to determine the required size. Then call the method again with the appropriate sized buffer.

Normally, this method will return only those service providers that can be used by the application. For example, if the Internetwork Packet Exchange (IPX) networking protocol is not installed, DirectPlay will not return the IPX service provider. To have DirectPlay return all service providers, even those that cannot be used by the application, set the DPNENUMSERVICEPROVIDERS_ALL flag in dwFlags.

© 2002 Microsoft Corporation. All rights reserved.