The ISideShowClassExtension2::InitializeAsync method initializes an instance of the class extension object used for raising events, and registers the SideShow driver's ISideShowDriver interface.
HRESULT InitializeAsync( [in, optional] IUnknown *pWdfDeviceUnknown, [in, optional] IUnknown *pSideShowDriverUnknown );
- pWdfDeviceUnknown [in, optional]
A pointer to the IUnknown interface that supports the IWDFDevice interface. The class extension object uses the methods of IWDFDevice to interact with the User-Mode Driver Framework (UMDF) platform and communicate with other Windows SideShow platform components.
- pSideShowDriverUnknown [in, optional]
A pointer to the IUnknown interface that supports the driver's ISideShowDriver interface.
The InitializeAsync method returns S_OK if the class extension object registers the driver's ISideShowDriver interface. Otherwise, this method returns one of the error codes that are defined in Winerror.h. If the class extension object returns an error code, the Windows SideShow platform will not allow the associated device to work.
Use this method instead of ISideShowClassExtension::Initialize when you want to use the SideShow class extension in asynchronous mode. This mode changes the behavior of ISideShowClassExtension::OnProcessIoControl, although, your code does not need to handle OnProcessIoControl differently than in the past. The following list describes these changes in behavior:
I/O requests that are processed asynchronously return E_PENDING. The pcbWritten parameter is set to zero. The class extension calls IWDFIoRequest::CompleteWithInformation when the request has been completed.
I/O requests that can be processed synchronously return S_OK. The pcbWritten parameter is set to zero. The class extension calls IWDFIoRequest::CompleteWithInformation before returning.
To uninitialize the SideShow class extension, you must first call IWDFIoQueue::DrainSynchronously, and then call ISideShowClassExtension::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.
|Available in Windows 7|