IMDServiceProvider::EnumDevices

banner art

The EnumDevices method enumerates the installed physical or software devices that are currently attached and are known by the service provider.

Syntax

HRESULT EnumDevices(IMDSPEnumDevice**ppEnumDevice);

Parameters

ppEnumDevice

[out]  Pointer to an IMDSPEnumDevice interface. If the service provider implements IMDServiceProvider2::CreateDevice, this enumerator should only enumerate non-Plug and Play devices.

Return Values

The method returns an HRESULT. All the interface methods in Windows Media Device Manager can return any of the following classes of error codes:

  • Standard COM error codes
  • Windows error codes converted to HRESULT values
  • Windows Media Device Manager error codes

For an extenstive list of possible error codes, see Error Codes.

Possible values include, but are not limited to, those in the following table.

Return code Description
S_OK The method succeeded.
E_INVALIDARG The ppEnumDevice parameter is an invalid or NULL pointer.
WMDM_E_NOTCERTIFIED The caller is not authorized, and calls to other service provider interfaces will also fail and return this code.

Remarks

This method is called on service providers that are not registered as Plug and Play aware (see Enabling PnP for Devices and Enumerating Devices for details). A service provider should return only the enumerator, which will enumerate only the devices that are currently attached to the computer and are supported by the service provider.

This method will be called only when an application starts, or when the application calls IWMDeviceManager2::Reinitialize.

At present, Windows Media Device Manager does not support returning installed devices.

The service provider cannot alert the application when devices connect or disconnect from the computer. If a Plug and Play device connects or disconnects and an application implements IWMDMNotification, then Windows Media Device Manager will send a notification to the application.

This method must be implemented. It must not return WMDM_E_NOTSUPPORTED or E_NOTIMPL. For more information, see Mandatory and Optional Interfaces.

Requirements

Header: Defined in mswmdm.h.

Library: mssachlp.lib

See Also