1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
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;
}
|