ISensorClassExtension::ProcessIoControl method

The ISensorClassExtension::ProcessControl method sends Windows Portable Devices (WPD) I/O control requests to the sensor class extension for processing.

Syntax


HRESULT ProcessIoControl(
  [in] IWDFIoRequest *pRequest
);

Parameters

pRequest [in]

Pointer to the IWDFIoRequest interface that represents the UMDF request object.

Return value

This method returns an HRESULT. Possible values include, but are not limited to, one of the following values.

Return codeDescription
S_OK

The method succeeded.

E_ACCESS_DENIED

No permission. For example, the I/O request sought data for which no permission exists.

E_POINTER

A required pointer argument was NULL.

HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED)

The request did not contain a WPD IOCTL.

 

Remarks

UMDF sends I/O control requests to sensor drivers through IQueueCallbackDeviceIoControl::OnDeviceIoControl. We recommend that you call ProcessIoControl to forward all WPD requests to the sensor class extension for processing. You can use the WPD macro IS_WPD_IOCTL to determine whether a given control code is specific to WPD. Clients of the Sensor API and Location API send only WPD IOCTLs, which can always be process by the sensor class extension.

After processing an I/O control request, the sensor class extension uses the driver's callback interface, ISensorDriver, to provide notifications, as appropriate. WPD requests that the sensor class extension does not handle by default are sent to the driver through ISensorDriver::OnProcessWpdMessage.

The driver must not complete I/O control requests that it forwards to the sensor class extension.

Examples

The following code example provides an implementation of OnDeviceIoControl. The variable named m_pClassExtension contains a pointer to ISensorClassExtension.


STDMETHODIMP_ (void) CMyQueue::OnDeviceIoControl(
    __in IWDFIoQueue*     pQueue,
    __in IWDFIoRequest*   pRequest,
    __in ULONG            ControlCode,
         SIZE_T           InputBufferSizeInBytes,
         SIZE_T           OutputBufferSizeInBytes
    )
{
    DWORD dwWritten = 0;

    if( IS_WPD_IOCTL( ControlCode ) )
    {
        if(m_pClassExtension != NULL)
        {
           m_pClassExtension->ProcessIoControl(pQueue,
                                               pRequest,
                                               ControlCode,
                                               InputBufferSizeInBytes,
                                               OutputBufferSizeInBytes,
                                               &dwWritten);
        }
    }
    else
    {
        // Unsupported request.
        // Complete the request in a way that is appropriate for your driver.
    }
}

Requirements

Minimum supported client

Windows 7

Minimum supported server

None supported

Target platform

Version

Available in Windows 7.

Header

Sensorsclassextension.h

Library

SensorsClassExtension.lib

 

 

Send comments about this topic to Microsoft

Show: