1 /*++
2 
3 Copyright (c) Microsoft Corporation.  All rights reserved.
4 
5 Module Name:
6 
7     FxMin.hpp
8 
9 Abstract:
10 
11     This is the minimal version of driver framework include file
12     that is needed to build FxObject
13 
14 
15 
16 
17 
18 
19 Author:
20 
21 
22 
23 Environment:
24 
25     Both kernel and user mode
26 
27 Revision History:
28 
29 --*/
30 
31 #ifndef _FXMIN_HPP
32 #define _FXMIN_HPP
33 
34 extern "C" {
35 #include "mx.h"
36 }
37 #include "FxMacros.hpp"
38 
39 #if (FX_CORE_MODE == FX_CORE_USER_MODE)
40 //
41 // Undef METHOD_FROM_CTL_CODE so that it is prevented from being used
42 // inadvertently in mode-agnostic code. Irp->GetParameterIoctlCodeBufferMethod
43 // should be used instead.
44 //
45 #ifdef METHOD_FROM_CTL_CODE
46 #undef METHOD_FROM_CTL_CODE
47 #endif
48 #endif // FX_CORE_USER_MODE
49 
50 typedef struct _WDF_BIND_INFO *PWDF_BIND_INFO;
51 
52 extern "C" {
53 
54 ///////////////////
55 // Basic definitions (abridged version of wdf.h)
56 
57 #ifdef __cplusplus
58   #define WDF_EXTERN_C       extern "C"
59   #define WDF_EXTERN_C_START extern "C" {
60   #define WDF_EXTERN_C_END   }
61 #else
62   #define WDF_EXTERN_C
63   #define WDF_EXTERN_C_START
64   #define WDF_EXTERN_C_END
65 #endif
66 
67 WDF_EXTERN_C_START
68 
69 typedef VOID (*WDFFUNC) (VOID);
70 extern const WDFFUNC *WdfFunctions;
71 
72 #include "wdftypes.h"
73 #include "wdfglobals.h"
74 #include "wdffuncenum.h"
75 #include "wdfstatus.h"
76 #include "wdfassert.h"
77 #include "wdfverifier.h"
78 
79 // generic object
80 #include "wdfobject.h"
81 
82 #include "wdfcore.h"
83 #include "wdfdevice.h"
84 #include "wdfdevicepri.h"
85 #include "wdfiotargetpri.h"
86 #include "wdfdriver.h"
87 
88 #include "wdfmemory.h"
89 
90 #include "wdfrequest.h"
91 #include "wdfwmi.h"
92 #include "wdfChildList.h"
93 #include "wdfpdo.h"
94 #include "wdffdo.h"
95 #include "wdfiotarget.h"
96 #include "wdfcontrol.h"
97 #include "wdfcx.h"
98 #include "wdfio.h"
99 #include "wdfqueryinterface.h"
100 #include "wdfworkitem.h"
101 
102 #include "wdfcollection.h"
103 
104 #include "wdffileobject.h"
105 #include "wdfinterrupt.h"
106 #include "wdfregistry.h"
107 #include "wdfresource.h"
108 #include "wdfstring.h"
109 #include "wdfsync.h"
110 #include "wdftimer.h"
111 
112 #if (FX_CORE_MODE == FX_CORE_USER_MODE)
113 #include "wdfhid.h"
114 #endif
115 
116 #pragma warning(disable:4200)  // suppress nameless struct/union warning
117 #pragma warning(disable:4201)  // suppress nameless struct/union warning
118 #pragma warning(disable:4214)  // suppress bit field types other than int warning
119 #include <usb.h>
120 #include <usbspec.h>
121 #include "wdfusb.h"
122 #include <initguid.h>
123 #include <usbdlib.h>
124 #include <usbbusif.h>
125 
126 #include "wdfbugcodes.h"
127 
128 WDF_EXTERN_C_END
129 
130 #if (FX_CORE_MODE == FX_CORE_USER_MODE)
131 #define KMDF_ONLY_CODE_PATH_ASSERT()  FX_VERIFY(INTERNAL, TRAPMSG("Not implemented"));
132 #define UMDF_ONLY_CODE_PATH_ASSERT()
133 #else
134 #define KMDF_ONLY_CODE_PATH_ASSERT()
135 #define UMDF_ONLY_CODE_PATH_ASSERT()  ASSERTMSG("Not implemented for KMDF", FALSE);
136 #endif
137 
138 //
139 // Since C does not have strong type checking we must invent our own
140 //
141 typedef struct _WDF_OBJECT_CONTEXT_TYPE_INFO_V1_0 {
142     //
143     // The size of this structure in bytes
144     //
145     ULONG Size;
146 
147     //
148     // String representation of the context's type name, i.e. "DEVICE_CONTEXT"
149     //
150     PCHAR ContextName;
151 
152     //
153     // The size of the context in bytes.  This will be the size of the context
154     // associated with the handle unless
155     // WDF_OBJECT_ATTRIBUTES::ContextSizeOverride is specified.
156     //
157     size_t ContextSize;
158 
159 } WDF_OBJECT_CONTEXT_TYPE_INFO_V1_0, *PWDF_OBJECT_CONTEXT_TYPE_INFO_V1_0;
160 
161 typedef struct _WDF_OBJECT_CONTEXT_TYPE_INFO_V1_0 *PWDF_OBJECT_CONTEXT_TYPE_INFO_V1_0;
162 
163 #include "cobbled.hpp"
164 
165 }  //extern "C"
166 
167 #include <ntstrsafe.h>
168 #include <ntintsafe.h>
169 #include <wmistr.h>
170 #include <evntrace.h>
171 
172 #if FX_CORE_MODE==FX_CORE_USER_MODE
173 typedef enum _TRACE_INFORMATION_CLASS {
174     TraceIdClass,
175     TraceHandleClass,
176     TraceEnableFlagsClass,
177     TraceEnableLevelClass,
178     GlobalLoggerHandleClass,
179     EventLoggerHandleClass,
180     AllLoggerHandlesClass,
181     TraceHandleByNameClass,
182     LoggerEventsLostClass,
183     TraceSessionSettingsClass,
184     MaxTraceInformationClass
185 } TRACE_INFORMATION_CLASS;
186 
187 #include <wmium.h>
188 #endif  // FX_CORE_MODE==FX_CORE_USER_MODE
189 
190 #include "FxForward.hpp"
191 
192 #if (FX_CORE_MODE == FX_CORE_USER_MODE)
193 #include "HostFxUtil.h"
194 #include "wdfplatform.h"
195 #include "wdfplatformimpl.h"
196 #include "debug.h"
197 #include "devreg.h"
198 #include "wudfx_namespace_on.h"
199 #include "wudfx.h"
200 #include "wudfx_namespace_off.h"
201 #include "DriverFrameworks-UserMode-UmEvents.h"
202 #endif
203 
204 #include "fxtypedefs.hpp"
205 
206 #if defined(EVENT_TRACING)
207 #include "fxwmicompat.h"
208 #include "FxTrace.h"
209 #else
210 #include "DbgTrace.h"
211 #endif  // EVENT_TRACING
212 
213 #include "FxTypes.h"
214 #include "fxrequestcontexttypes.h"
215 #include "FxPool.h"
216 
217 #if (FX_CORE_MODE==FX_CORE_KERNEL_MODE)
218 #include "FxGlobalsKm.h"
219 #include "FxPerfTraceKm.hpp"
220 #include "DriverFrameworks-KernelMode-KmEvents.h"
221 #else
222 #include "FxGlobalsUm.h"
223 #endif
224 #include "FxPoolInlines.hpp"
225 #include "fxverifier.h"
226 #if (FX_CORE_MODE==FX_CORE_KERNEL_MODE)
227 #include "FxVerifierKm.h"
228 #else
229 #include "FxVerifierUm.h"
230 #include "device_common.h"
231 #endif
232 #if (FX_CORE_MODE==FX_CORE_KERNEL_MODE)
233 #include "FxMdl.h"
234 #endif
235 
236 #include "FxProbeAndLock.h"
237 //#include "FxPerfTraceKm.hpp"
238 //#include <NtStrSafe.h>
239 
240 #include "FxStump.hpp"
241 #include "FxRequestBuffer.hpp"
242 #include "FxTagTracker.hpp"
243 
244 // internal locks
245 #include "FxVerifierLock.hpp"
246 #include "FxLock.hpp"
247 
248 // base objects
249 #include "FxObject.hpp"
250 #include "FxPagedObject.hpp"
251 #include "FxNonPagedObject.hpp"
252 
253 #include "fxhandle.h"
254 
255 // external locks
256 #include "FxWaitLock.hpp"
257 //#include "FxSpinLock.hpp"
258 
259 // utitilty classes and functions
260 #include "FxTransactionedList.hpp"
261 #include "FxRelatedDeviceList.hpp"
262 #include "FxDisposeList.hpp"
263 #include "FxCollection.hpp"
264 #include "StringUtil.hpp"
265 
266 // abstract classes
267 #include "IFxHasCallbacks.hpp"
268 
269 // callback delegation and locking
270 #include "FxSystemThread.hpp"
271 #include "FxSystemWorkItem.hpp"
272 #include "FxCallbackLock.hpp"
273 #include "FxCallbackSpinLock.hpp"
274 #include "FxCallbackMutexLock.hpp"
275 #include "FxCallback.hpp"
276 #include "FxSystemThread.hpp"
277 
278 #include "IFxMemory.hpp"
279 #include "FxLookasideList.hpp"
280 //#include "FxNPagedLookasideList.hpp"
281 //#include "FxPagedLookasideList.hpp"
282 #include "FxMemoryObject.hpp"
283 #include "FxMemoryBuffer.hpp"
284 #include "FxMemoryBufferFromPool.hpp"
285 #include "FxMemoryBufferPreallocated.hpp"
286 //#include "FxMemoryBufferFromLookaside.hpp"
287 #include "FxRequestMemory.hpp"
288 #include "FxRegKey.hpp"
289 #include "FxAutoRegistry.hpp"
290 #include "FxAutoString.hpp"
291 #include "FxString.hpp"
292 
293 #include "FxValidateFunctions.hpp"
294 
295 #include "FxResource.hpp"
296 #include "FxRelatedDevice.hpp"
297 #include "FxDeviceInterface.hpp"
298 #include "FxQueryInterface.hpp"
299 #include "FxDeviceText.hpp"
300 
301 #if (FX_CORE_MODE == FX_CORE_USER_MODE)
302 #include "FxIrpUm.hpp"
303 #include "FxInterruptThreadpoolUm.hpp"
304 #else
305 #include "FxIrpKm.hpp"
306 #endif
307 #include "FxDriver.hpp"
308 
309 // generic package interface
310 #include "FxPackage.hpp"
311 #include "FxPkgGeneral.hpp"
312 #include "FxDefaultIrpHandler.hpp"
313 //#include "FxPoxKm.hpp"
314 #include "FxPkgPnp.hpp"
315 #include "FxWatchDog.hpp"
316 
317 // Device supportfx
318 #include "FxChildList.hpp"
319 #include "FxCxDeviceInfo.hpp"
320 
321 #include "FxDevice.hpp"
322 
323 #include "FxPkgIo.hpp"
324 
325 #include "FxDeviceToMxInterface.hpp"
326 
327 #include "FxIrpQueue.hpp"
328 #include "FxRequestContext.hpp"
329 #include "FxRequestCallbacks.hpp"
330 #include "FxRequestBase.hpp"
331 #include "FxRequest.hpp"
332 #include "FxSyncRequest.hpp"
333 
334 #include "FxRequestValidateFunctions.hpp"
335 
336 // specialized irp handlers (ie packages)
337 #include "FxPkgFdo.hpp"
338 #include "FxPkgPdo.hpp"
339 
340 //#include "FxWmiIrpHandler.hpp"
341 //#include "FxWmiProvider.hpp"
342 //#include "FxWmiInstance.hpp"
343 
344 // queus for read, write, (internal) IOCTL
345 #include "FxIoQueue.hpp"
346 #include "FxFileObject.hpp"
347 #include "FxIrpPreprocessInfo.hpp"
348 #include "FxIrpDynamicDispatchInfo.hpp"
349 
350 //#include "FxDpc.hpp"
351 #include "FxWorkItem.hpp"
352 #include "FxTimer.hpp"
353 #if FX_CORE_MODE==FX_CORE_USER_MODE
354 #include "FxInterruptUm.hpp"
355 #include "FxMessageDispatchUm.hpp"
356 #else
357 #include "FxInterruptKm.hpp"
358 #endif
359 
360 // IO targets (device lower edge interface)
361 #include "FxIoTarget.hpp"
362 #include "FxIoTargetRemote.hpp"
363 #include "FxIoTargetSelf.hpp"
364 
365 #include "FxUsbDevice.hpp"
366 #include "FxUsbInterface.hpp"
367 #include "FxUsbPipe.hpp"
368 
369 // DMA support
370 //#include "FxDmaEnabler.hpp"
371 //#include "FxDmaTransaction.hpp"
372 //#include "FxCommonBuffer.hpp"
373 
374 // Triage info.
375 #include "wdftriage.h"
376 
377 
378 #include "FxPkgIoShared.hpp"
379 
380 #if FX_CORE_MODE==FX_CORE_USER_MODE
381 #include "UfxVerifier.h"
382 #endif
383 
384 
385 #endif // _FXMIN_HPP
386