diff options
| author | Dave Wilson <[email protected]> | 2015-04-29 09:48:49 -0700 |
|---|---|---|
| committer | Dave Wilson <[email protected]> | 2015-04-29 10:47:29 -0700 |
| commit | d40232638faaab19de557e70a3ee938da7a35295 (patch) | |
| tree | 14e61c973745949af186b7940e3a53d25322f5de /usb/umdf_fx2/driver/queue.cpp | |
| parent | 02e5b090a6131a7cc1b90f4a9373117c9e3c7088 (diff) | |
samples update for //build
Diffstat (limited to 'usb/umdf_fx2/driver/queue.cpp')
| -rw-r--r-- | usb/umdf_fx2/driver/queue.cpp | 147 |
1 files changed, 147 insertions, 0 deletions
diff --git a/usb/umdf_fx2/driver/queue.cpp b/usb/umdf_fx2/driver/queue.cpp new file mode 100644 index 00000000..c56b38bb --- /dev/null +++ b/usb/umdf_fx2/driver/queue.cpp @@ -0,0 +1,147 @@ +/*++ + +Copyright (c) Microsoft Corporation, All Rights Reserved + +Module Name: + + queue.cpp + +Abstract: + + This file implements the I/O queue interface and performs + the read/write/ioctl operations. + +Environment: + + Windows User-Mode Driver Framework (WUDF) + +--*/ + +#include "internal.h" +#include "queue.tmh" + +CMyQueue::CMyQueue( + _In_ PCMyDevice Device + ) : + m_FxQueue(NULL), + m_Device(Device) +{ +} + +// +// Queue destructor. +// Free up the buffer, wait for thread to terminate and +// + +CMyQueue::~CMyQueue( + VOID + ) +/*++ + +Routine Description: + + + IUnknown implementation of Release + +Aruments: + + +Return Value: + + ULONG (reference count after Release) + +--*/ +{ + TraceEvents(TRACE_LEVEL_INFORMATION, + TEST_TRACE_QUEUE, + "%!FUNC! Entry" + ); + +} + + +HRESULT +STDMETHODCALLTYPE +CMyQueue::QueryInterface( + _In_ REFIID InterfaceId, + _Outptr_ PVOID *Object + ) +/*++ + +Routine Description: + + + Query Interface + +Aruments: + + Follows COM specifications + +Return Value: + + HRESULT indicatin success or failure + +--*/ +{ + HRESULT hr; + + hr = CUnknown::QueryInterface(InterfaceId, Object); + + return hr; +} + +// +// Initialize +// + +HRESULT +CMyQueue::Initialize( + _In_ WDF_IO_QUEUE_DISPATCH_TYPE DispatchType, + _In_ bool Default, + _In_ bool PowerManaged + ) +{ + IWDFIoQueue *fxQueue; + HRESULT hr; + + // + // Create the I/O Queue object. + // + + { + 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 +CMyQueue::Configure( + VOID + ) +{ + return S_OK; +} |
