HRESULT CMyQueue::Initialize( __in WDF_IO_QUEUE_DISPATCH_TYPE DispatchType, __in bool Default, __in bool PowerManaged ) { IWDFIoQueue *fxQueue = NULL; HRESULT hr = S_OK; // // Create the I/O Queue object. // if (SUCCEEDED(hr)) { IUnknown *callback = QueryIUnknown(); hr = m_Device->GetFxDevice()->CreateIoQueue( callback, Default, DispatchType, PowerManaged, FALSE, &fxQueue ); callback->Release(); } if (SUCCEEDED(hr)) { m_FxQueue = fxQueue; // // Release the creation reference on the queue. This object will be // destroyed before the queue so we don't need to have a reference out // on it. // fxQueue->Release(); } return hr; }
HRESULT CSimdeviceQueue::Initialize( _In_ IWDFDevice *FxDevice ) { IWDFIoQueue *fxQueue; HRESULT hr; // // Initialize the critical section before we continue // if (!InitializeCriticalSectionAndSpinCount(&m_Crit,0x80000400)) { hr = HRESULT_FROM_WIN32(GetLastError()); goto Exit; } m_InitCritSec = TRUE; // // Create the framework queue // { IUnknown *unknown = QueryIUnknown(); hr = FxDevice->CreateIoQueue(unknown, TRUE, WdfIoQueueDispatchSequential, TRUE, FALSE, &fxQueue); unknown->Release(); } if (FAILED(hr)) { goto Exit; } m_FxQueue = fxQueue; fxQueue->Release(); Exit: return hr; }
HRESULT CMyQueue::Initialize( _In_ IWDFDevice *FxDevice ) { IWDFIoQueue *fxQueue; IUnknown *unknown = NULL; HRESULT hr; // // Initialize ring buffer // hr = m_RingBuffer.Initialize(DATA_BUFFER_SIZE); if (FAILED(hr)) { goto Exit; } unknown = QueryIUnknown(); // // Create the default queue // { hr = FxDevice->CreateIoQueue(unknown, TRUE, WdfIoQueueDispatchParallel, TRUE, FALSE, &fxQueue); } if (FAILED(hr)) { goto Exit; } m_FxQueue = fxQueue; fxQueue->Release(); // // Create a manual queue to hold pending read requests. By keeping // them in the queue, framework takes care of cancelling them if the app // exits // { hr = FxDevice->CreateIoQueue(NULL, FALSE, WdfIoQueueDispatchManual, TRUE, FALSE, &fxQueue); } if (FAILED(hr)) { goto Exit; } m_FxReadQueue = fxQueue; fxQueue->Release(); Exit: SAFE_RELEASE(unknown); return hr; }