ISensorClassExtension::Uninitialize method

The ISensorClassExtension::Uninitialize method uninitializes the sensor class extension object.

Syntax


HRESULT Uninitialize();

Parameters

This method has no parameters.

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.

HRESULT_FROM_WIN32(ERROR_CAN_NOT_COMPLETE)

The class extension is not initialized.

 

Remarks

Typically, you will uninitialize the sensor class extension when the driver is unloading. We recommend that you perform uninitialization steps when called by UMDF in IPnpCallbackHardware::OnReleaseHardware.

If you must, for some reason, otherwise release and uninitialize the sensor class extension, you must call IWDFIoQueue::DrainSynchronously before calling ISensorClassExtension::Uninitialize. You can retrieve the queue interface by calling IWDFDevice::GetDefaultIoQueue on the WDF device object. Then, call IWDFIoQueue::DrainSynchronously to process all the queued requests. Calling IWDFIoQueue::DrainSynchronously blocks the queuing of new requests, so you must call IWDFIoQueue::Start after you reinitialize the class extension.

Examples

The following example code shows a snippet from an implementation of IPnpCallbackHardware::OnReleaseHardware that releases the sensor class extension.


if (m_pClassExtension != NULL)
{
    hr = m_pClassExtension->Uninitialize();
 
    SAFE_RELEASE(m_pClassExtension);
}

The following example code shows how to use IWDFIoQueue::DrainSynchronously.


CComPtr<IWDFIoQueue> spQueue ;
pWdfDevice->GetDefaultIoQueue(&spQueue);
if (NULL != spQueue)
{
 spQueue->DrainSynchronously();
 spQqueue.Release();
}

Requirements

Minimum supported client

Windows 7

Minimum supported server

None supported

Target platform

Version

Available in Windows 7.

Header

Sensorsclassextension.h

Library

SensorsClassExtension.lib

See also

ISensorClassExtension::Initialize

 

 

Send comments about this topic to Microsoft

Show: