IWMDMDevice3::DeviceIoControl
The DeviceIoControl method sends a Device I/O Control (IOCTL) code to the device. This is a pass-through method; WMDM just forwards the call to the service provider after validating the parameters.
Syntax
HRESULT DeviceIoControl(
DWORD dwIoControlCode,
BYTE* lpInBuffer,
DWORD nInBufferSize,
BYTE* lpOutBuffer,
LPDWORD pnOutBufferSize
);
Parameters
dwIoControlCode
[in] Control code to send to the device.
lpInBuffer
[in] Pointer to an input buffer supplied by the caller. It can be NULL if nInBufferSize is zero.
nInBufferSize
[in] Size of the input buffer, in bytes.
lpOutBuffer
[out] Pointer to the output buffer supplied by the caller. It can be NULL if pnOutBufferSize points to a value of zero.
pnOutBufferSize
[in, out] Size of the output buffer, in bytes. When the call returns, it contains the number of bytes actually returned. This parameter must not be NULL.
Return Values
The method returns an HRESULT. All the interface methods in Windows Media Device Manager and service provider 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 a complete list of possible error codes, see Error Codes.
Possible values include, but are not limited to, those in the following table. If the method fails with an error, it returns a standard error code.
Return code | Description |
S_OK | The method succeeded. |
E_INVALIDARG | One or more of the parameters are invalid. This is possible if
a) lpInBuffer is NULL when nInBufferSize is non-zero. b) lpOutBuffer is NULL when pnOutBufferSize points to a non-zero value. c) pnOutBufferSize is NULL. d) Any of the parameters is invalid for the service provider. |
WMDM_E_NOTSUPPORTED | The service provider or device does not support this method or control code. |
Remarks
This method provides a private mode of communication between the application and the service provider. The service provider can then process this IOCTL, optionally modify it, and pass it to the kernel mode driver.
Compared to SendOpaqueCommand, this method better aligns with the DeviceIoControl Windows API because the output buffer is supplied by the caller. Also, unlike SendOpaqueCommand, this method does not involve any MAC check and is more efficient.
This method can be used, for example, to send custom Media Transport Protocol (MTP) commands to an MTP device.
Requirements
Header: Defined in wmdm.idl.
Library: mssachlp.lib
See Also