diff options
| author | Dave Wilson <[email protected]> | 2015-03-17 19:50:07 -0700 |
|---|---|---|
| committer | Dave Wilson <[email protected]> | 2015-03-17 19:50:07 -0700 |
| commit | 97cf5197cf5b882b2c689d8dc2b555f2edf8f418 (patch) | |
| tree | 46f3701832d70b420eb0fc0eb93261f9da45db3f /wpd/WpdWudfSampleDriver/Queue.h | |
| parent | ef1905bf1e8825bb31120dfb27e0daf3154d859a (diff) | |
Initial publish
Diffstat (limited to 'wpd/WpdWudfSampleDriver/Queue.h')
| -rw-r--r-- | wpd/WpdWudfSampleDriver/Queue.h | 93 |
1 files changed, 93 insertions, 0 deletions
diff --git a/wpd/WpdWudfSampleDriver/Queue.h b/wpd/WpdWudfSampleDriver/Queue.h new file mode 100644 index 00000000..d53ce76e --- /dev/null +++ b/wpd/WpdWudfSampleDriver/Queue.h @@ -0,0 +1,93 @@ +// Queue.h : Declaration of the CQueue + +#pragma once +#include "resource.h" // main symbols +#include "WpdWudfSampleDriver.h" + + +class ATL_NO_VTABLE CQueue : + public CComObjectRootEx<CComMultiThreadModel>, + public IQueueCallbackDeviceIoControl, + public IQueueCallbackCreate, + public IObjectCleanup +{ +public: + CQueue() + { + + } + + DECLARE_NOT_AGGREGATABLE(CQueue) + + BEGIN_COM_MAP(CQueue) + COM_INTERFACE_ENTRY(IQueueCallbackDeviceIoControl) + COM_INTERFACE_ENTRY(IQueueCallbackCreate) + END_COM_MAP() + +public: + static + HRESULT CreateInstance( + _COM_Outptr_ IUnknown** ppUkwn) + { + *ppUkwn = NULL; + CComObject< CQueue> *pMyQueue = NULL; + HRESULT hr = CComObject<CQueue>::CreateInstance( &pMyQueue ); + if( SUCCEEDED (hr) ) + { + pMyQueue->AddRef(); + hr = pMyQueue->QueryInterface( __uuidof(IUnknown), (void **) ppUkwn ); + pMyQueue->Release(); + pMyQueue = NULL; + } + return hr; + } + + // + // Wdf Callbacks + // + + // IQueueCallbackCreateClose + // + STDMETHOD_ (void, OnCreateFile)( + _In_ IWDFIoQueue* pQueue, + _In_ IWDFIoRequest* pRequest, + _In_ IWDFFile* pFileObject + ); + + // + // IQueueCallbackDeviceIoControl + // + STDMETHOD_ (void, OnDeviceIoControl)( + _In_ IWDFIoQueue* pQueue, + _In_ IWDFIoRequest* pRequest, + ULONG ControlCode, + SIZE_T InputBufferSizeInBytes, + SIZE_T OutputBufferSizeInBytes + ); + + // + // IObjectCleanup + // + STDMETHOD_ (void, OnCleanup)( + _In_ IWDFObject* pWdfObject + ); + +private: + HRESULT ProcessWpdMessage( + ULONG ControlCode, + _In_ ContextMap* pClientContextMap, + _In_ IWDFDevice* pDevice, + _In_reads_bytes_(ulInputBufferLength) PVOID pInBuffer, + ULONG ulInputBufferLength, + _Out_writes_bytes_to_(ulOutputBufferLength, *pdwBytesWritten) PVOID pOutBuffer, + ULONG ulOutputBufferLength, + _Out_ DWORD* pdwBytesWritten); + + HRESULT GetWpdBaseDriver( + _In_ IWDFDevice* pDevice, + _Outptr_result_nullonfailure_ WpdBaseDriver** ppWpdBaseDriver); + + CComPtr<IWpdSerializer> m_pWpdSerializer; + CComAutoCriticalSection m_CriticalSection; +}; + |
