Share via


IMDServiceProvider2::CreateDevice

banner art

The CreateDevice method is called by the Windows Media Device Manager to get the IMDSPDevice object(s) corresponding to a device path name obtained from the PnP subsystem. This method must be implemented for PnP and Windows Explorer support, but otherwise it is optional. For more information, see the second table under Implementing Service Providers.

Syntax

HRESULT CreateDevice(
  LPCWSTR  pwszDevicePath,
  DWORD*  pdwCount,
  IMDSPDevice***  pppDeviceArray
);

Parameters

pwszDevicePath

[in]  Pointer to a wide-character null-terminated string containing device path name for which IMDSPDevice object(s) are to be created.

pdwCount

[out]  Pointer to a DWORD containing the number of IMDSPDevice objects that are created.

pppDeviceArray

[out]  An array of IMDSPDevice objects.

Return Values

If the method succeeds it returns S_OK. If the method fails, it returns the Windows Media Device Manager error codes.

For a complete list of possible error codes, see Error Codes.

Remarks

Windows Media Device Manager calls this method on device arrival. In the pwszDevicePath parameter, Windows Media Device Manager passes the device path name it obtained from the PnP subsystem. The service provider should create the corresponding IMDSPDevice object(s).

The pwszDevicePath parameter contains a device path name that can be directly passed to functions such as CreateFile to gain access to the underlying kernel device object.

A service provider can create more than one IMDSPDevice object corresponding to a device path name if it creates an IMDSPDevice object for each top-level storage. This is subject to change in the future, and the count may be restricted to 1.

Requirements

Header: Defined in wmsp.idl.

Library: mssachlp.lib

See Also