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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
|
/*++
Copyright (C) Microsoft Corporation, All Rights Reserved
Module Name:
Internal.h
Abstract:
This module contains the local type definitions for the UMDF OSR Fx2
driver sample.
Environment:
Windows User-Mode Driver Framework (WUDF)
--*/
#pragma once
#ifndef ARRAY_SIZE
#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
#endif
//
// Include the WUDF Headers
//
#include "wudfddi.h"
//
// Include SetupDi functions.
//
#include "setupapi.h"
//
// Use specstrings for in/out annotation of function parameters.
//
#include "specstrings.h"
//
// Include the safestring functions.
//
#include "strsafe.h"
//
// Get limits on common data types (ULONG_MAX for example)
//
#include "limits.h"
//
// We need usb I/O targets to talk to the OSR device.
//
#include "wudfusb.h"
//
// Include the header shared between the drivers and the test applications.
//
#include "public.h"
//
// Include the header shared between the drivers and the test applications.
//
#include "WUDFOsrUsbPublic.h"
//
// Forward definitions of classes in the other header files.
//
typedef class CMyDriver *PCMyDriver;
typedef class CMyDevice *PCMyDevice;
typedef class CMyQueue *PCMyQueue;
typedef class CMyControlQueue *PCMyControlQueue;
typedef class CMyReadWriteQueue *PCMyReadWriteQueue;
typedef class CCancelCallback *PCCancelCallback;
//
// Define the tracing flags.
//
// TODO: Choose a different trace control GUID
//
#define WPP_CONTROL_GUIDS \
WPP_DEFINE_CONTROL_GUID( \
WudfOsrUsbFx2TraceGuid, (da5fbdfd,1eae,4ecf,b426,a3818f325ddb), \
\
WPP_DEFINE_BIT(MYDRIVER_ALL_INFO) \
WPP_DEFINE_BIT(TEST_TRACE_DRIVER) \
WPP_DEFINE_BIT(TEST_TRACE_DEVICE) \
WPP_DEFINE_BIT(TEST_TRACE_QUEUE) \
)
#define WPP_FLAG_LEVEL_LOGGER(flag, level) \
WPP_LEVEL_LOGGER(flag)
#define WPP_FLAG_LEVEL_ENABLED(flag, level) \
(WPP_LEVEL_ENABLED(flag) && \
WPP_CONTROL(WPP_BIT_ ## flag).Level >= level)
#define WPP_LEVEL_FLAGS_LOGGER(lvl,flags) \
WPP_LEVEL_LOGGER(flags)
#define WPP_LEVEL_FLAGS_ENABLED(lvl, flags) \
(WPP_LEVEL_ENABLED(flags) && WPP_CONTROL(WPP_BIT_ ## flags).Level >= lvl)
//
// This comment block is scanned by the trace preprocessor to define our
// Trace function.
//
// begin_wpp config
// FUNC Trace{FLAG=MYDRIVER_ALL_INFO}(LEVEL, MSG, ...);
// FUNC TraceEvents(LEVEL, FLAGS, MSG, ...);
// end_wpp
//
//
// Driver specific #defines
//
// TODO: Change these values to be appropriate for your driver.
//
#define MYDRIVER_TRACING_ID L"Microsoft\\UMDF\\OsrUsb"
#define MYDRIVER_CLASS_ID {0x0865b2b0, 0x6b73, 0x428f, {0xa3, 0xea, 0x21, 0x72, 0x83, 0x2d, 0x6b, 0xfc}}
//
// Include the type specific headers.
//
#include "comsup.h"
#include "driver.h"
#include "device.h"
#include "queue.h"
#include "ControlQueue.h"
#include "ReadWriteQueue.h"
#include "list.h"
__forceinline
#ifdef _PREFAST_
__declspec(noreturn)
#endif
VOID
WdfTestNoReturn(
VOID
)
{
// do nothing.
}
#define WUDF_TEST_DRIVER_ASSERT(p) \
{ \
if ( !(p) ) \
{ \
DebugBreak(); \
WdfTestNoReturn(); \
} \
}
#define SAFE_RELEASE(p) {if ((p)) { (p)->Release(); (p) = NULL; }}
#define IDLE_TIMEOUT_IN_MSEC 10*1000
|