IMDServiceProvider::EnumDevices method (mswmdm.h)

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


HRESULT EnumDevices(
  IMDSPEnumDevice **ppEnumDevice



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

Return value

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 extensive list of possible error codes, see Error Codes.


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.


Target Platform Windows
Header mswmdm.h
Library Mssachlp.lib

See also

Enumerating Devices

IMDServiceProvider Interface