summaryrefslogtreecommitdiff
path: root/wpd/WpdBasicHardwareDriver/Queue.h
diff options
context:
space:
mode:
authorDave Wilson <[email protected]>2015-03-17 19:50:07 -0700
committerDave Wilson <[email protected]>2015-03-17 19:50:07 -0700
commit97cf5197cf5b882b2c689d8dc2b555f2edf8f418 (patch)
tree46f3701832d70b420eb0fc0eb93261f9da45db3f /wpd/WpdBasicHardwareDriver/Queue.h
parentef1905bf1e8825bb31120dfb27e0daf3154d859a (diff)
Initial publish
Diffstat (limited to 'wpd/WpdBasicHardwareDriver/Queue.h')
-rw-r--r--wpd/WpdBasicHardwareDriver/Queue.h93
1 files changed, 93 insertions, 0 deletions
diff --git a/wpd/WpdBasicHardwareDriver/Queue.h b/wpd/WpdBasicHardwareDriver/Queue.h
new file mode 100644
index 00000000..e5cea69d
--- /dev/null
+++ b/wpd/WpdBasicHardwareDriver/Queue.h
@@ -0,0 +1,93 @@
+// Queue.h : Declaration of the CQueue
+
+#pragma once
+#include "resource.h" // main symbols
+#include "WpdBasicHardwareDriver.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;
+};
+