summaryrefslogtreecommitdiff
path: root/wpd/WpdBasicHardwareDriver/Queue.h
diff options
context:
space:
mode:
authorJ M Rossy <[email protected]>2015-07-29 15:40:09 -0700
committerJ M Rossy <[email protected]>2015-07-29 16:34:40 -0700
commit5d61a4a79a1e96dc5d9af1e5e712c84507307544 (patch)
tree49ed270893578cd18758b74ffcca16dc7ab948d6 /wpd/WpdBasicHardwareDriver/Queue.h
parent5d41613e26e147d2300c786bb2b34cb4b4067a25 (diff)
Samples update for public Windows 10 release
Fix #2 Enabling WPP Recorder in Sensors Samples causes errors Fix #4 Add back fixed KMDOD sample Add new BarcodeScanner sample in pos folder Add new MagneticStripeReader sample in pos folder Add new SynpaticsTouch sample in input folder Add new Power Engine Plugin sample in pofx folder Add new DeviceMft sample in avstream folder Add new AvsCamera sample in root Add new SimBatt sample in root Add other pre-existing samples not yet released for Win10
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;
+};
+