xref: /reactos/sdk/include/wdf/kmdf/1.17/wdfdevice.h (revision 545df815)
1 /*++
2 
3 Copyright (c) Microsoft Corporation.  All rights reserved.
4 
5 _WdfVersionBuild_
6 
7 Module Name:
8 
9     wdfdevice.h
10 
11 Abstract:
12 
13 
14 Environment:
15 
16     kernel mode only
17 
18 Revision History:
19 
20 --*/
21 
22 //
23 // NOTE: This header is generated by stubwork.  Please make any
24 //       modifications to the corresponding template files
25 //       (.x or .y) and use stubwork to regenerate the header
26 //
27 
28 #ifndef _WDFDEVICE_H_
29 #define _WDFDEVICE_H_
30 
31 #ifndef WDF_EXTERN_C
32   #ifdef __cplusplus
33     #define WDF_EXTERN_C       extern "C"
34     #define WDF_EXTERN_C_START extern "C" {
35     #define WDF_EXTERN_C_END   }
36   #else
37     #define WDF_EXTERN_C
38     #define WDF_EXTERN_C_START
39     #define WDF_EXTERN_C_END
40   #endif
41 #endif
42 
43 WDF_EXTERN_C_START
44 
45 
46 
47 
48 #include <devpropdef.h>
49 
50 
51 #if (NTDDI_VERSION >= NTDDI_WIN2K)
52 
53 
54 // begin_wpp enum
55 typedef enum _WDF_DEVICE_STATE_FLAGS {
56     WdfDevStateNP = 0x8000,
57 } WDF_DEVICE_STATE_FLAGS;
58 
59 // end_wpp
60 
61 // begin_wpp enum
62 typedef enum _WDF_DEVICE_PNP_STATE {
63     WdfDevStatePnpInvalid = 0x00,
64     WdfDevStatePnpObjectCreated = 0x100,
65     WdfDevStatePnpCheckForDevicePresence = 0x101,
66     WdfDevStatePnpEjectFailed = 0x102,
67     WdfDevStatePnpEjectHardware = 0x103,
68     WdfDevStatePnpEjectedWaitingForRemove = 0x104,
69     WdfDevStatePnpInit = 0x105,
70     WdfDevStatePnpInitStarting = 0x106,
71     WdfDevStatePnpInitSurpriseRemoved = 0x107,
72     WdfDevStatePnpHardwareAvailable = 0x108,
73     WdfDevStatePnpEnableInterfaces = 0x109,
74     WdfDevStatePnpHardwareAvailablePowerPolicyFailed = 0x10A,
75     WdfDevStatePnpQueryRemoveAskDriver = 0x10B,
76     WdfDevStatePnpQueryRemovePending = 0x10C,
77     WdfDevStatePnpQueryRemoveStaticCheck = 0x10D,
78     WdfDevStatePnpQueriedRemoving = 0x10E,
79     WdfDevStatePnpQueryStopAskDriver = 0x10F,
80     WdfDevStatePnpQueryStopPending = 0x110,
81     WdfDevStatePnpQueryStopStaticCheck = 0x111,
82     WdfDevStatePnpQueryCanceled = 0x112,
83     WdfDevStatePnpRemoved = 0x113,
84     WdfDevStatePnpPdoRemoved = 0x114,
85     WdfDevStatePnpRemovedPdoWait = 0x115,
86     WdfDevStatePnpRemovedPdoSurpriseRemoved = 0x116,
87     WdfDevStatePnpRemovingDisableInterfaces = 0x117,
88     WdfDevStatePnpRestarting = 0x118,
89     WdfDevStatePnpStarted = 0x119,
90     WdfDevStatePnpStartedCancelStop = 0x11A,
91     WdfDevStatePnpStartedCancelRemove = 0x11B,
92     WdfDevStatePnpStartedRemoving = 0x11C,
93     WdfDevStatePnpStartingFromStopped = 0x11D,
94     WdfDevStatePnpStopped = 0x11E,
95     WdfDevStatePnpStoppedWaitForStartCompletion = 0x11F,
96     WdfDevStatePnpStartedStopping = 0x120,
97     WdfDevStatePnpSurpriseRemove = 0x121,
98     WdfDevStatePnpInitQueryRemove = 0x122,
99     WdfDevStatePnpInitQueryRemoveCanceled = 0x123,
100     WdfDevStatePnpFdoRemoved = 0x124,
101     WdfDevStatePnpRemovedWaitForChildren = 0x125,
102     WdfDevStatePnpQueriedSurpriseRemove = 0x126,
103     WdfDevStatePnpSurpriseRemoveIoStarted = 0x127,
104     WdfDevStatePnpFailedPowerDown = 0x128,
105     WdfDevStatePnpFailedIoStarting = 0x129,
106     WdfDevStatePnpFailedOwnHardware = 0x12A,
107     WdfDevStatePnpFailed = 0x12B,
108     WdfDevStatePnpFailedSurpriseRemoved = 0x12C,
109     WdfDevStatePnpFailedStarted = 0x12D,
110     WdfDevStatePnpFailedWaitForRemove = 0x12E,
111     WdfDevStatePnpFailedInit = 0x12F,
112     WdfDevStatePnpPdoInitFailed = 0x130,
113     WdfDevStatePnpRestart = 0x131,
114     WdfDevStatePnpRestartReleaseHardware = 0x132,
115     WdfDevStatePnpRestartHardwareAvailable = 0x133,
116     WdfDevStatePnpPdoRestart = 0x134,
117     WdfDevStatePnpFinal = 0x135,
118     WdfDevStatePnpRemovedChildrenRemoved = 0x136,
119     WdfDevStatePnpQueryRemoveEnsureDeviceAwake = 0x137,
120     WdfDevStatePnpQueryStopEnsureDeviceAwake = 0x138,
121     WdfDevStatePnpFailedPowerPolicyRemoved = 0x139,
122     WdfDevStatePnpNull = 0x13A,
123 } WDF_DEVICE_PNP_STATE, *PWDF_DEVICE_PNP_STATE;
124 
125 // end_wpp
126 
127 // begin_wpp enum
128 typedef enum _WDF_DEVICE_POWER_STATE {
129     WdfDevStatePowerInvalid = 0x00,
130     WdfDevStatePowerObjectCreated = 0x300,
131     WdfDevStatePowerCheckDeviceType = 0x301,
132     WdfDevStatePowerCheckDeviceTypeNP = 0x302 | WdfDevStateNP,
133     WdfDevStatePowerCheckParentState = 0x303,
134     WdfDevStatePowerCheckParentStateNP = 0x304 | WdfDevStateNP,
135     WdfDevStatePowerEnablingWakeAtBus = 0x305,
136     WdfDevStatePowerEnablingWakeAtBusNP = 0x306 | WdfDevStateNP,
137     WdfDevStatePowerD0 = 0x307,
138     WdfDevStatePowerD0NP = 0x308 | WdfDevStateNP,
139     WdfDevStatePowerD0BusWakeOwner = 0x309,
140     WdfDevStatePowerD0BusWakeOwnerNP = 0x30A | WdfDevStateNP,
141     WdfDevStatePowerD0ArmedForWake = 0x30B,
142     WdfDevStatePowerD0ArmedForWakeNP = 0x30C | WdfDevStateNP,
143     WdfDevStatePowerD0DisarmingWakeAtBus = 0x30D,
144     WdfDevStatePowerD0DisarmingWakeAtBusNP = 0x30E | WdfDevStateNP,
145     WdfDevStatePowerD0Starting = 0x30F,
146     WdfDevStatePowerD0StartingConnectInterrupt = 0x310,
147     WdfDevStatePowerD0StartingDmaEnable = 0x311,
148     WdfDevStatePowerD0StartingStartSelfManagedIo = 0x312,
149     WdfDevStatePowerDecideD0State = 0x313,
150     WdfDevStatePowerGotoD3Stopped = 0x314,
151     WdfDevStatePowerStopped = 0x315,
152     WdfDevStatePowerStartingCheckDeviceType = 0x316,
153     WdfDevStatePowerStartingChild = 0x317,
154     WdfDevStatePowerDxDisablingWakeAtBus = 0x318,
155     WdfDevStatePowerDxDisablingWakeAtBusNP = 0x319 | WdfDevStateNP,
156     WdfDevStatePowerGotoDx = 0x31A,
157     WdfDevStatePowerGotoDxNP = 0x31B | WdfDevStateNP,
158     WdfDevStatePowerGotoDxIoStopped = 0x31C,
159     WdfDevStatePowerGotoDxIoStoppedNP = 0x31D | WdfDevStateNP,
160     WdfDevStatePowerGotoDxNPFailed = 0x31E | WdfDevStateNP,
161     WdfDevStatePowerDx = 0x31F,
162     WdfDevStatePowerDxNP = 0x320 | WdfDevStateNP,
163     WdfDevStatePowerGotoDxArmedForWake = 0x321,
164     WdfDevStatePowerGotoDxArmedForWakeNP = 0x322 | WdfDevStateNP,
165     WdfDevStatePowerGotoDxIoStoppedArmedForWake = 0x323,
166     WdfDevStatePowerGotoDxIoStoppedArmedForWakeNP = 0x324 | WdfDevStateNP,
167     WdfDevStatePowerDxArmedForWake = 0x325,
168     WdfDevStatePowerDxArmedForWakeNP = 0x326 | WdfDevStateNP,
169     WdfDevStatePowerCheckParentStateArmedForWake = 0x327,
170     WdfDevStatePowerCheckParentStateArmedForWakeNP = 0x328 | WdfDevStateNP,
171     WdfDevStatePowerWaitForParentArmedForWake = 0x329,
172     WdfDevStatePowerWaitForParentArmedForWakeNP = 0x32A | WdfDevStateNP,
173     WdfDevStatePowerStartSelfManagedIo = 0x32B,
174     WdfDevStatePowerStartSelfManagedIoNP = 0x32C | WdfDevStateNP,
175     WdfDevStatePowerStartSelfManagedIoFailed = 0x32D,
176     WdfDevStatePowerStartSelfManagedIoFailedNP = 0x32E | WdfDevStateNP,
177     WdfDevStatePowerWaitForParent = 0x32F,
178     WdfDevStatePowerWaitForParentNP = 0x330 | WdfDevStateNP,
179     WdfDevStatePowerWakePending = 0x331,
180     WdfDevStatePowerWakePendingNP = 0x332 | WdfDevStateNP,
181     WdfDevStatePowerWaking = 0x333,
182     WdfDevStatePowerWakingNP = 0x334 | WdfDevStateNP,
183     WdfDevStatePowerWakingConnectInterrupt = 0x335,
184     WdfDevStatePowerWakingConnectInterruptNP = 0x336 | WdfDevStateNP,
185     WdfDevStatePowerWakingConnectInterruptFailed = 0x337,
186     WdfDevStatePowerWakingConnectInterruptFailedNP = 0x338 | WdfDevStateNP,
187     WdfDevStatePowerWakingDmaEnable = 0x339,
188     WdfDevStatePowerWakingDmaEnableNP = 0x33A | WdfDevStateNP,
189     WdfDevStatePowerWakingDmaEnableFailed = 0x33B,
190     WdfDevStatePowerWakingDmaEnableFailedNP = 0x33C | WdfDevStateNP,
191     WdfDevStatePowerReportPowerUpFailedDerefParent = 0x33D,
192     WdfDevStatePowerReportPowerUpFailed = 0x33E,
193     WdfDevStatePowerPowerFailedPowerDown = 0x33F,
194     WdfDevStatePowerReportPowerDownFailed = 0x340,
195     WdfDevStatePowerInitialConnectInterruptFailed = 0x341,
196     WdfDevStatePowerInitialDmaEnableFailed = 0x342,
197     WdfDevStatePowerInitialSelfManagedIoFailed = 0x343,
198     WdfDevStatePowerInitialPowerUpFailedDerefParent = 0x344,
199     WdfDevStatePowerInitialPowerUpFailed = 0x345,
200     WdfDevStatePowerDxStoppedDisarmWake = 0x346,
201     WdfDevStatePowerDxStoppedDisarmWakeNP = 0x347 | WdfDevStateNP,
202     WdfDevStatePowerGotoDxStoppedDisableInterruptNP = 0x348 | WdfDevStateNP,
203     WdfDevStatePowerGotoDxStopped = 0x349,
204     WdfDevStatePowerDxStopped = 0x34A,
205     WdfDevStatePowerGotoStopped = 0x34B,
206     WdfDevStatePowerStoppedCompleteDx = 0x34C,
207     WdfDevStatePowerDxStoppedDecideDxState = 0x34D,
208     WdfDevStatePowerDxStoppedArmForWake = 0x34E,
209     WdfDevStatePowerDxStoppedArmForWakeNP = 0x34F | WdfDevStateNP,
210     WdfDevStatePowerFinalPowerDownFailed = 0x350,
211     WdfDevStatePowerFinal = 0x351,
212     WdfDevStatePowerGotoImplicitD3DisarmWakeAtBus = 0x352,
213     WdfDevStatePowerUpFailed = 0x353,
214     WdfDevStatePowerUpFailedDerefParent = 0x354,
215     WdfDevStatePowerGotoDxFailed = 0x355,
216     WdfDevStatePowerGotoDxStoppedDisableInterrupt = 0x356,
217     WdfDevStatePowerUpFailedNP = 0x357 | WdfDevStateNP,
218     WdfDevStatePowerUpFailedDerefParentNP = 0x358 | WdfDevStateNP,
219     WdfDevStatePowerNotifyingD0ExitToWakeInterrupts = 0x359,
220     WdfDevStatePowerNotifyingD0EntryToWakeInterrupts = 0x35A,
221     WdfDevStatePowerNotifyingD0ExitToWakeInterruptsNP = 0x35B | WdfDevStateNP,
222     WdfDevStatePowerNotifyingD0EntryToWakeInterruptsNP = 0x35C | WdfDevStateNP,
223     WdfDevStatePowerNull = 0x35D,
224 } WDF_DEVICE_POWER_STATE, *PWDF_DEVICE_POWER_STATE;
225 
226 // end_wpp
227 
228 
229 // begin_wpp enum
230 typedef enum _WDF_DEVICE_POWER_POLICY_STATE {
231     WdfDevStatePwrPolInvalid =  0x00,
232     WdfDevStatePwrPolObjectCreated = 0x500,
233     WdfDevStatePwrPolStarting = 0x501,
234     WdfDevStatePwrPolStartingSucceeded = 0x502,
235     WdfDevStatePwrPolStartingFailed = 0x503,
236     WdfDevStatePwrPolStartingDecideS0Wake = 0x504,
237     WdfDevStatePwrPolStartedIdleCapable = 0x505,
238     WdfDevStatePwrPolTimerExpiredNoWake = 0x506,
239     WdfDevStatePwrPolTimerExpiredNoWakeCompletePowerDown = 0x507,
240     WdfDevStatePwrPolWaitingUnarmed = 0x508,
241     WdfDevStatePwrPolWaitingUnarmedQueryIdle = 0x509,
242     WdfDevStatePwrPolS0NoWakePowerUp = 0x50A,
243     WdfDevStatePwrPolS0NoWakeCompletePowerUp = 0x50B,
244     WdfDevStatePwrPolSystemSleepFromDeviceWaitingUnarmed = 0x50C,
245     WdfDevStatePwrPolSystemSleepNeedWake = 0x50D,
246     WdfDevStatePwrPolSystemSleepNeedWakeCompletePowerUp = 0x50E,
247     WdfDevStatePwrPolSystemSleepPowerRequestFailed = 0x50F,
248     WdfDevStatePwrPolCheckPowerPageable = 0x510,
249     WdfDevStatePwrPolSleepingWakeWakeArrived = 0x511,
250     WdfDevStatePwrPolSleepingWakeRevertArmWake = 0x512,
251     WdfDevStatePwrPolSystemAsleepWakeArmed = 0x513,
252     WdfDevStatePwrPolSystemWakeDeviceWakeEnabled = 0x514,
253     WdfDevStatePwrPolSystemWakeDeviceWakeEnabledWakeCanceled = 0x515,
254     WdfDevStatePwrPolSystemWakeDeviceWakeDisarm = 0x516,
255     WdfDevStatePwrPolSystemWakeDeviceWakeTriggered = 0x517,
256     WdfDevStatePwrPolSystemWakeDeviceWakeTriggeredS0 = 0x518,
257     WdfDevStatePwrPolSystemWakeDeviceWokeDisarm = 0x519,
258     WdfDevStatePwrPolSleepingWakeWakeArrivedNP =  0x51A | WdfDevStateNP,
259     WdfDevStatePwrPolSleepingWakeRevertArmWakeNP =  0x51B | WdfDevStateNP,
260     WdfDevStatePwrPolSleepingWakePowerDownFailed = 0x51C,
261     WdfDevStatePwrPolSleepingWakePowerDownFailedWakeCanceled = 0x51D,
262     WdfDevStatePwrPolSystemAsleepWakeArmedNP =  0x51E | WdfDevStateNP,
263     WdfDevStatePwrPolSystemWakeDeviceWakeEnabledNP =  0x51F | WdfDevStateNP,
264     WdfDevStatePwrPolSystemWakeDeviceWakeEnabledWakeCanceledNP =  0x520 | WdfDevStateNP,
265     WdfDevStatePwrPolSystemWakeDeviceWakeDisarmNP =  0x521 | WdfDevStateNP,
266     WdfDevStatePwrPolSystemWakeDeviceWakeTriggeredNP =  0x522 | WdfDevStateNP,
267     WdfDevStatePwrPolSystemWakeDeviceWakeTriggeredS0NP =  0x523 | WdfDevStateNP,
268     WdfDevStatePwrPolSystemWakeDeviceWokeDisarmNP =  0x524 | WdfDevStateNP,
269     WdfDevStatePwrPolSystemWakeDeviceWakeCompletePowerUp = 0x525,
270     WdfDevStatePwrPolSleeping = 0x526,
271     WdfDevStatePwrPolSleepingNoWakePowerDown = 0x527,
272     WdfDevStatePwrPolSleepingNoWakeCompletePowerDown = 0x528,
273     WdfDevStatePwrPolSleepingNoWakeDxRequestFailed = 0x529,
274     WdfDevStatePwrPolSleepingWakePowerDown = 0x52A,
275     WdfDevStatePwrPolSleepingSendWake = 0x52B,
276     WdfDevStatePwrPolSystemAsleepNoWake = 0x52C,
277     WdfDevStatePwrPolSystemWakeDeviceWakeDisabled = 0x52D,
278     WdfDevStatePwrPolSystemWakeDeviceToD0 = 0x52E,
279     WdfDevStatePwrPolSystemWakeDeviceToD0CompletePowerUp = 0x52F,
280     WdfDevStatePwrPolSystemWakeQueryIdle = 0x530,
281     WdfDevStatePwrPolStartedWakeCapable = 0x531,
282     WdfDevStatePwrPolTimerExpiredDecideUsbSS = 0x532,
283     WdfDevStatePwrPolTimerExpiredWakeCapablePowerDown = 0x533,
284     WdfDevStatePwrPolTimerExpiredWakeCapableSendWake = 0x534,
285     WdfDevStatePwrPolTimerExpiredWakeCapableUsbSS = 0x535,
286     WdfDevStatePwrPolTimerExpiredWakeCapableWakeArrived = 0x536,
287     WdfDevStatePwrPolTimerExpiredWakeCapableCancelWake = 0x537,
288     WdfDevStatePwrPolTimerExpiredWakeCapableWakeCanceled = 0x538,
289     WdfDevStatePwrPolTimerExpiredWakeCapableCleanup = 0x539,
290     WdfDevStatePwrPolTimerExpiredWakeCapableDxAllocFailed = 0x53A,
291     WdfDevStatePwrPolTimerExpiredWakeCompletedPowerDown = 0x53B,
292     WdfDevStatePwrPolTimerExpiredWakeCompletedPowerUp = 0x53C,
293     WdfDevStatePwrPolWaitingArmedUsbSS = 0x53D,
294     WdfDevStatePwrPolWaitingArmed = 0x53E,
295     WdfDevStatePwrPolWaitingArmedQueryIdle = 0x53F,
296     WdfDevStatePwrPolIoPresentArmed = 0x540,
297     WdfDevStatePwrPolIoPresentArmedWakeCanceled = 0x541,
298     WdfDevStatePwrPolS0WakeDisarm = 0x542,
299     WdfDevStatePwrPolS0WakeCompletePowerUp = 0x543,
300     WdfDevStatePwrPolTimerExpiredWakeSucceeded = 0x544,
301     WdfDevStatePwrPolTimerExpiredWakeCompletedDisarm = 0x545,
302     WdfDevStatePwrPolTimerExpiredWakeCapableWakeSucceeded = 0x546,
303     WdfDevStatePwrPolTimerExpiredWakeCapableWakeFailed = 0x547,
304     WdfDevStatePwrPolWakeFailedUsbSS = 0x548,
305     WdfDevStatePwrPolTimerExpiredWakeCapablePowerDownFailedCancelWake = 0x549,
306     WdfDevStatePwrPolTimerExpiredWakeCapablePowerDownFailedWakeCanceled = 0x54A,
307     WdfDevStatePwrPolTimerExpiredWakeCapablePowerDownFailedUsbSS = 0x54B,
308     WdfDevStatePwrPolCancelingWakeForSystemSleep = 0x54C,
309     WdfDevStatePwrPolCancelingWakeForSystemSleepWakeCanceled = 0x54D,
310     WdfDevStatePwrPolDisarmingWakeForSystemSleepCompletePowerUp = 0x54E,
311     WdfDevStatePwrPolPowerUpForSystemSleepFailed = 0x54F,
312     WdfDevStatePwrPolWokeFromS0UsbSS = 0x550,
313     WdfDevStatePwrPolWokeFromS0 = 0x551,
314     WdfDevStatePwrPolWokeFromS0NotifyDriver = 0x552,
315     WdfDevStatePwrPolStoppingResetDevice = 0x553,
316     WdfDevStatePwrPolStoppingResetDeviceCompletePowerUp = 0x554,
317     WdfDevStatePwrPolStoppingResetDeviceFailed = 0x555,
318     WdfDevStatePwrPolStoppingD0 = 0x556,
319     WdfDevStatePwrPolStoppingD0Failed = 0x557,
320     WdfDevStatePwrPolStoppingDisarmWake = 0x558,
321     WdfDevStatePwrPolStoppingDisarmWakeCancelWake = 0x559,
322     WdfDevStatePwrPolStoppingDisarmWakeWakeCanceled = 0x55A,
323     WdfDevStatePwrPolStopping = 0x55B,
324     WdfDevStatePwrPolStoppingFailed = 0x55C,
325     WdfDevStatePwrPolStoppingSendStatus = 0x55D,
326     WdfDevStatePwrPolStoppingCancelTimer = 0x55E,
327     WdfDevStatePwrPolStoppingWaitForIdleTimeout = 0x55F,
328     WdfDevStatePwrPolStoppingCancelUsbSS = 0x560,
329     WdfDevStatePwrPolStoppingWaitForUsbSSCompletion = 0x561,
330     WdfDevStatePwrPolStoppingCancelWake = 0x562,
331     WdfDevStatePwrPolStopped = 0x563,
332     WdfDevStatePwrPolCancelUsbSS = 0x564,
333     WdfDevStatePwrPolStarted = 0x565,
334     WdfDevStatePwrPolStartedCancelTimer = 0x566,
335     WdfDevStatePwrPolStartedWaitForIdleTimeout = 0x567,
336     WdfDevStatePwrPolStartedWakeCapableCancelTimerForSleep = 0x568,
337     WdfDevStatePwrPolStartedWakeCapableWaitForIdleTimeout = 0x569,
338     WdfDevStatePwrPolStartedWakeCapableSleepingUsbSS = 0x56A,
339     WdfDevStatePwrPolStartedIdleCapableCancelTimerForSleep = 0x56B,
340     WdfDevStatePwrPolStartedIdleCapableWaitForIdleTimeout = 0x56C,
341     WdfDevStatePwrPolDeviceD0PowerRequestFailed = 0x56D,
342     WdfDevStatePwrPolDevicePowerRequestFailed = 0x56E,
343     WdfDevStatePwrPolGotoDx = 0x56F,
344     WdfDevStatePwrPolGotoDxInDx = 0x570,
345     WdfDevStatePwrPolDx = 0x571,
346     WdfDevStatePwrPolGotoD0 = 0x572,
347     WdfDevStatePwrPolGotoD0InD0 = 0x573,
348     WdfDevStatePwrPolFinal = 0x574,
349     WdfDevStatePwrPolSleepingPowerDownNotProcessed = 0x575,
350     WdfDevStatePwrPolTimerExpiredWakeCapablePowerDownNotProcessed = 0x576,
351     WdfDevStatePwrPolTimerExpiredNoWakePowerDownNotProcessed = 0x577,
352     WdfDevStatePwrPolTimerExpiredNoWakePoweredDownDisableIdleTimer = 0x578,
353     WdfDevStatePwrPolStoppingWaitingForImplicitPowerDown = 0x579,
354     WdfDevStatePwrPolStoppingPoweringUp = 0x57A,
355     WdfDevStatePwrPolStoppingPoweringDown = 0x57B,
356     WdfDevStatePwrPolPowerUpForSystemSleepNotSeen = 0x57C,
357     WdfDevStatePwrPolWaitingArmedStoppingCancelUsbSS = 0x57D,
358     WdfDevStatePwrPolWaitingArmedWakeFailedCancelUsbSS = 0x57E,
359     WdfDevStatePwrPolWaitingArmedIoPresentCancelUsbSS = 0x57F,
360     WdfDevStatePwrPolWaitingArmedWakeSucceededCancelUsbSS = 0x580,
361     WdfDevStatePwrPolCancelingUsbSSForSystemSleep = 0x581,
362     WdfDevStatePwrPolStoppingD0CancelUsbSS = 0x582,
363     WdfDevStatePwrPolStartingPoweredUp = 0x583,
364     WdfDevStatePwrPolIdleCapableDeviceIdle = 0x584,
365     WdfDevStatePwrPolDeviceIdleReturnToActive = 0x585,
366     WdfDevStatePwrPolDeviceIdleSleeping = 0x586,
367     WdfDevStatePwrPolDeviceIdleStopping = 0x587,
368     WdfDevStatePwrPolTimerExpiredNoWakeUndoPowerDown = 0x588,
369     WdfDevStatePwrPolWakeCapableDeviceIdle = 0x589,
370     WdfDevStatePwrPolWakeCapableUsbSSCompleted = 0x58A,
371     WdfDevStatePwrPolTimerExpiredWakeCapableUndoPowerDown = 0x58B,
372     WdfDevStatePwrPolTimerExpiredWakeCompletedHardwareStarted = 0x58C,
373     WdfDevStatePwrPolStoppedRemoving = 0x58D,
374     WdfDevStatePwrPolRemoved = 0x58E,
375     WdfDevStatePwrPolRestarting = 0x58F,
376     WdfDevStatePwrPolRestartingFailed = 0x590,
377     WdfDevStatePwrPolStartingPoweredUpFailed = 0x591,
378     WdfDevStatePwrPolTimerExpiredNoWakeReturnToActive = 0x592,
379     WdfDevStatePwrPolWaitingArmedWakeInterruptFired = 0x593,
380     WdfDevStatePwrPolSystemWakeDeviceWakeInterruptFired = 0x594,
381     WdfDevStatePwrPolSystemWakeDeviceWakeInterruptFiredNP =  0x595 | WdfDevStateNP,
382     WdfDevStatePwrPolTimerExpiredWakeCapableWakeInterruptArrived = 0x596,
383     WdfDevStatePwrPolTimerExpiredWakeCapablePowerDownFailedWakeInterruptArrived = 0x597,
384     WdfDevStatePwrPolWaitingArmedWakeInterruptFiredDuringPowerDown = 0x598,
385     WdfDevStatePwrPolNull = 0x599,
386 } WDF_DEVICE_POWER_POLICY_STATE, *PWDF_DEVICE_POWER_POLICY_STATE;
387 
388 // end_wpp
389 
390 typedef enum _WDF_STATE_NOTIFICATION_TYPE {
391     StateNotificationInvalid =       0x0000,
392     StateNotificationEnterState =       0x0001,
393     StateNotificationPostProcessState = 0x0002,
394     StateNotificationLeaveState =       0x0004,
395     StateNotificationAllStates =       StateNotificationEnterState | StateNotificationPostProcessState | StateNotificationLeaveState,
396 } WDF_STATE_NOTIFICATION_TYPE;
397 
398 typedef enum _WDF_POWER_POLICY_S0_IDLE_CAPABILITIES {
399     IdleCapsInvalid = 0,
400     IdleCannotWakeFromS0,
401     IdleCanWakeFromS0,
402     IdleUsbSelectiveSuspend,
403 } WDF_POWER_POLICY_S0_IDLE_CAPABILITIES;
404 
405 typedef enum _WDF_POWER_POLICY_S0_IDLE_USER_CONTROL {
406     IdleUserControlInvalid = 0,
407     IdleDoNotAllowUserControl,
408     IdleAllowUserControl,
409 } WDF_POWER_POLICY_S0_IDLE_USER_CONTROL;
410 
411 typedef enum _WDF_POWER_POLICY_IDLE_TIMEOUT_CONSTANTS {
412     IdleTimeoutDefaultConstant = 0,
413 } WDF_POWER_POLICY_IDLE_TIMEOUT_CONSTANTS;
414 
415 typedef enum _WDF_POWER_POLICY_SX_WAKE_USER_CONTROL {
416     WakeUserControlInvalid = 0,
417     WakeDoNotAllowUserControl,
418     WakeAllowUserControl,
419 } WDF_POWER_POLICY_SX_WAKE_USER_CONTROL;
420 
421 typedef enum _WDF_POWER_DEVICE_STATE {
422     WdfPowerDeviceInvalid = 0,
423     WdfPowerDeviceD0,
424     WdfPowerDeviceD1,
425     WdfPowerDeviceD2,
426     WdfPowerDeviceD3,
427     WdfPowerDeviceD3Final,
428     WdfPowerDevicePrepareForHibernation,
429     WdfPowerDeviceMaximum,
430 } WDF_POWER_DEVICE_STATE, *PWDF_POWER_DEVICE_STATE;
431 
432 
433 
434 typedef enum _WDF_DISPATCH_IRP_TO_IO_QUEUE_FLAGS {
435     WDF_DISPATCH_IRP_TO_IO_QUEUE_NO_FLAGS = 0x00000000,
436     WDF_DISPATCH_IRP_TO_IO_QUEUE_INVOKE_INCALLERCTX_CALLBACK = 0x00000001,
437     WDF_DISPATCH_IRP_TO_IO_QUEUE_PREPROCESSED_IRP = 0x00000002,
438 } WDF_DISPATCH_IRP_TO_IO_QUEUE_FLAGS;
439 
440 typedef enum _WDF_SPECIAL_FILE_TYPE {
441     WdfSpecialFileUndefined = 0,
442     WdfSpecialFilePaging = 1,
443     WdfSpecialFileHibernation,
444     WdfSpecialFileDump,
445     WdfSpecialFileBoot,
446     WdfSpecialFileMax,
447 } WDF_SPECIAL_FILE_TYPE, *PWDF_SPECIAL_FILE_TYPE;
448 
449 typedef enum _WDF_DEVICE_IO_TYPE {
450     WdfDeviceIoUndefined = 0,
451     WdfDeviceIoNeither,
452     WdfDeviceIoBuffered,
453     WdfDeviceIoDirect,
454     WdfDeviceIoBufferedOrDirect = 4,
455     WdfDeviceIoMaximum,
456 } WDF_DEVICE_IO_TYPE, *PWDF_DEVICE_IO_TYPE;
457 
458 typedef enum _WDF_FILEOBJECT_CLASS {
459     WdfFileObjectInvalid = 0,
460     WdfFileObjectNotRequired = 1,
461     WdfFileObjectWdfCanUseFsContext = 2,
462     WdfFileObjectWdfCanUseFsContext2 = 3,
463     WdfFileObjectWdfCannotUseFsContexts = 4,
464     WdfFileObjectCanBeOptional = 0x80000000,
465 } WDF_FILEOBJECT_CLASS, *PWDF_FILEOBJECT_CLASS;
466 
467 typedef enum _WDF_DEVICE_FAILED_ACTION {
468     WdfDeviceFailedUndefined = 0,
469     WdfDeviceFailedAttemptRestart,
470     WdfDeviceFailedNoRestart,
471 } WDF_DEVICE_FAILED_ACTION;
472 
473 typedef enum _WDF_RELEASE_HARDWARE_ORDER_ON_FAILURE {
474     WdfReleaseHardwareOrderOnFailureInvalid = 0,
475     WdfReleaseHardwareOrderOnFailureEarly,
476     WdfReleaseHardwareOrderOnFailureAfterDescendants,
477 } WDF_RELEASE_HARDWARE_ORDER_ON_FAILURE, *PWDF_RELEASE_HARDWARE_ORDER_ON_FAILURE;
478 
479 
480 
481 //
482 // If you do not want the auto inclusion of wdmsec.h, define
483 // WDF_DEVICE_NO_WDMSEC_H before including this file (or wdf.h)
484 //
485 #ifndef WDF_DEVICE_NO_WDMSEC_H
486 #include <wdmsec.h>
487 #endif // WDF_DEVICE_NO_WDMSEC_H
488 
489 
490 #define WDF_S0_IDLE_ENABLED_VALUE_NAME      L"IdleInWorkingState"
491 #define WDF_SX_WAKE_ENABLED_VALUE_NAME      L"WakeFromSleepState"
492 #define WDF_S0_IDLE_DEFAULT_VALUE_NAME      L"WdfDefaultIdleInWorkingState"
493 #define WDF_SX_WAKE_DEFAULT_VALUE_NAME      L"WdfDefaultWakeFromSleepState"
494 //
495 // Declare empty definitions so that they may be referenced by
496 // routines before they are defined.
497 //
498 
499 // enum _WDF_REQUEST_TYPE;
500 // typedef enum _WDF_REQUEST_TYPE WDF_REQUEST_TYPE;
501 
502 typedef enum _WDF_REQUEST_TYPE { // taken from wdfrequest.h
503     WdfRequestTypeCreate = 0x0,
504     WdfRequestTypeCreateNamedPipe = 0x1,
505     WdfRequestTypeClose = 0x2,
506     WdfRequestTypeRead = 0x3,
507     WdfRequestTypeWrite = 0x4,
508     WdfRequestTypeQueryInformation = 0x5,
509     WdfRequestTypeSetInformation = 0x6,
510     WdfRequestTypeQueryEA = 0x7,
511     WdfRequestTypeSetEA = 0x8,
512     WdfRequestTypeFlushBuffers = 0x9,
513     WdfRequestTypeQueryVolumeInformation = 0xa,
514     WdfRequestTypeSetVolumeInformation = 0xb,
515     WdfRequestTypeDirectoryControl = 0xc,
516     WdfRequestTypeFileSystemControl = 0xd,
517     WdfRequestTypeDeviceControl = 0xe,
518     WdfRequestTypeDeviceControlInternal = 0xf,
519     WdfRequestTypeShutdown = 0x10,
520     WdfRequestTypeLockControl = 0x11,
521     WdfRequestTypeCleanup = 0x12,
522     WdfRequestTypeCreateMailSlot = 0x13,
523     WdfRequestTypeQuerySecurity = 0x14,
524     WdfRequestTypeSetSecurity = 0x15,
525     WdfRequestTypePower = 0x16,
526     WdfRequestTypeSystemControl = 0x17,
527     WdfRequestTypeDeviceChange = 0x18,
528     WdfRequestTypeQueryQuota = 0x19,
529     WdfRequestTypeSetQuota = 0x1A,
530     WdfRequestTypePnp = 0x1B,
531     WdfRequestTypeOther =0x1C,
532     WdfRequestTypeUsb = 0x40,
533     WdfRequestTypeNoFormat = 0xFF,
534     WdfRequestTypeMax,
535 } WDF_REQUEST_TYPE;
536 
537 typedef
538 _Function_class_(EVT_WDF_DEVICE_FILE_CREATE)
539 _IRQL_requires_same_
540 _IRQL_requires_max_(PASSIVE_LEVEL)
541 VOID
542 STDCALL
543 EVT_WDF_DEVICE_FILE_CREATE(
544     _In_
545     WDFDEVICE Device,
546     _In_
547     WDFREQUEST Request,
548     _In_
549     WDFFILEOBJECT FileObject
550     );
551 
552 typedef EVT_WDF_DEVICE_FILE_CREATE *PFN_WDF_DEVICE_FILE_CREATE;
553 
554 typedef
555 _Function_class_(EVT_WDF_FILE_CLOSE)
556 _IRQL_requires_same_
557 _IRQL_requires_max_(PASSIVE_LEVEL)
558 VOID
559 STDCALL
560 EVT_WDF_FILE_CLOSE(
561     _In_
562     WDFFILEOBJECT FileObject
563     );
564 
565 typedef EVT_WDF_FILE_CLOSE *PFN_WDF_FILE_CLOSE;
566 
567 typedef
568 _Function_class_(EVT_WDF_FILE_CLEANUP)
569 _IRQL_requires_same_
570 _IRQL_requires_max_(PASSIVE_LEVEL)
571 VOID
572 STDCALL
573 EVT_WDF_FILE_CLEANUP(
574     _In_
575     WDFFILEOBJECT FileObject
576     );
577 
578 typedef EVT_WDF_FILE_CLEANUP *PFN_WDF_FILE_CLEANUP;
579 
580 typedef struct _WDF_FILEOBJECT_CONFIG {
581     //
582     // Size of this structure in bytes
583     //
584     ULONG Size;
585 
586     //
587     // Event callback for create requests
588     //
589     PFN_WDF_DEVICE_FILE_CREATE  EvtDeviceFileCreate;
590 
591     //
592     // Event callback for close requests
593     //
594     PFN_WDF_FILE_CLOSE   EvtFileClose;
595 
596     //
597     // Event callback for cleanup requests
598     //
599     PFN_WDF_FILE_CLEANUP EvtFileCleanup;
600 
601     //
602     // If WdfTrue, create/cleanup/close file object related requests will be
603     //      sent down the stack.
604     //
605     // If WdfFalse, create/cleanup/close will be completed at this location in
606     //      the device stack.
607     //
608     // If WdfDefault, behavior depends on device type
609     //      FDO, PDO, Control:  use the WdfFalse behavior
610     //      Filter:  use the WdfTrue behavior
611     //
612     WDF_TRI_STATE AutoForwardCleanupClose;
613 
614     //
615     // Specify whether framework should create WDFFILEOBJECT and also
616     // whether it can FsContexts fields in the WDM fileobject to store
617     // WDFFILEOBJECT so that it can avoid table look up and improve perf.
618     //
619     WDF_FILEOBJECT_CLASS FileObjectClass;
620 
621 } WDF_FILEOBJECT_CONFIG, *PWDF_FILEOBJECT_CONFIG;
622 
623 FORCEINLINE
624 VOID
WDF_FILEOBJECT_CONFIG_INIT(_Out_ PWDF_FILEOBJECT_CONFIG FileEventCallbacks,_In_opt_ PFN_WDF_DEVICE_FILE_CREATE EvtDeviceFileCreate,_In_opt_ PFN_WDF_FILE_CLOSE EvtFileClose,_In_opt_ PFN_WDF_FILE_CLEANUP EvtFileCleanup)625 WDF_FILEOBJECT_CONFIG_INIT(
626     _Out_ PWDF_FILEOBJECT_CONFIG FileEventCallbacks,
627     _In_opt_ PFN_WDF_DEVICE_FILE_CREATE EvtDeviceFileCreate,
628     _In_opt_ PFN_WDF_FILE_CLOSE EvtFileClose,
629     _In_opt_ PFN_WDF_FILE_CLEANUP EvtFileCleanup
630     )
631 {
632     FileEventCallbacks->Size = sizeof(WDF_FILEOBJECT_CONFIG);
633 
634     FileEventCallbacks->EvtDeviceFileCreate  = EvtDeviceFileCreate;
635     FileEventCallbacks->EvtFileClose   = EvtFileClose;
636     FileEventCallbacks->EvtFileCleanup = EvtFileCleanup;
637 
638     FileEventCallbacks->FileObjectClass = WdfFileObjectWdfCannotUseFsContexts;
639     FileEventCallbacks->AutoForwardCleanupClose = WdfUseDefault;
640 }
641 
642 typedef struct _WDF_DEVICE_PNP_NOTIFICATION_DATA {
643     //
644     // Type of data
645     //
646     WDF_STATE_NOTIFICATION_TYPE Type;
647 
648     union {
649         struct {
650             //
651             // The current state that is about to be exited
652             //
653             WDF_DEVICE_PNP_STATE CurrentState;
654 
655             //
656             // The new state that is about to be entered
657             //
658             WDF_DEVICE_PNP_STATE NewState;
659         } EnterState;
660 
661         struct {
662             //
663             // The current state
664             //
665             WDF_DEVICE_PNP_STATE CurrentState;
666         } PostProcessState;
667 
668 
669         struct {
670             //
671             // The current state that is about to be exitted
672             //
673             WDF_DEVICE_PNP_STATE CurrentState;
674 
675             //
676             // The state that is about to be entered
677             //
678             WDF_DEVICE_PNP_STATE NewState;
679         } LeaveState;
680     } Data;
681 } WDF_DEVICE_PNP_NOTIFICATION_DATA;
682 
683 typedef const WDF_DEVICE_PNP_NOTIFICATION_DATA* PCWDF_DEVICE_PNP_NOTIFICATION_DATA;
684 
685 typedef struct _WDF_DEVICE_POWER_NOTIFICATION_DATA {
686     //
687     // Type of data
688     //
689     WDF_STATE_NOTIFICATION_TYPE Type;
690 
691     union {
692         struct {
693             //
694             // The current state that is about to be exitted
695             //
696             WDF_DEVICE_POWER_STATE CurrentState;
697 
698             //
699             // The new state that is about to be entered
700             //
701             WDF_DEVICE_POWER_STATE NewState;
702         } EnterState;
703 
704         struct {
705             //
706             // The current state
707             //
708             WDF_DEVICE_POWER_STATE CurrentState;
709         } PostProcessState;
710 
711 
712         struct {
713             //
714             // The current state that is about to be exitted
715             //
716             WDF_DEVICE_POWER_STATE CurrentState;
717 
718             //
719             // The state that is about to be entered
720             //
721             WDF_DEVICE_POWER_STATE NewState;
722         } LeaveState;
723     } Data;
724 } WDF_DEVICE_POWER_NOTIFICATION_DATA;
725 
726 typedef const WDF_DEVICE_POWER_NOTIFICATION_DATA* PCWDF_DEVICE_POWER_NOTIFICATION_DATA;
727 
728 typedef struct _WDF_DEVICE_POWER_POLICY_NOTIFICATION_DATA {
729     //
730     // Type of data
731     //
732     WDF_STATE_NOTIFICATION_TYPE Type;
733 
734     union {
735         struct {
736             //
737             // The current state that is about to be exitted
738             //
739             WDF_DEVICE_POWER_POLICY_STATE CurrentState;
740 
741             //
742             // The new state that is about to be entered
743             //
744             WDF_DEVICE_POWER_POLICY_STATE NewState;
745         } EnterState;
746 
747         struct {
748             //
749             // The current state
750             //
751             WDF_DEVICE_POWER_POLICY_STATE CurrentState;
752         } PostProcessState;
753 
754 
755         struct {
756             //
757             // The current state that is about to be exitted
758             //
759             WDF_DEVICE_POWER_POLICY_STATE CurrentState;
760 
761             //
762             // The state that is about to be entered
763             //
764             WDF_DEVICE_POWER_POLICY_STATE NewState;
765         } LeaveState;
766     } Data;
767 } WDF_DEVICE_POWER_POLICY_NOTIFICATION_DATA;
768 
769 typedef const WDF_DEVICE_POWER_POLICY_NOTIFICATION_DATA* PCWDF_DEVICE_POWER_POLICY_NOTIFICATION_DATA;
770 
771 typedef
772 _Function_class_(EVT_WDF_DEVICE_PNP_STATE_CHANGE_NOTIFICATION)
773 _IRQL_requires_same_
774 _IRQL_requires_max_(PASSIVE_LEVEL)
775 VOID
776 STDCALL
777 EVT_WDF_DEVICE_PNP_STATE_CHANGE_NOTIFICATION(
778     _In_
779     WDFDEVICE Device,
780     _In_
781     PCWDF_DEVICE_PNP_NOTIFICATION_DATA NotificationData
782     );
783 
784 typedef EVT_WDF_DEVICE_PNP_STATE_CHANGE_NOTIFICATION *PFN_WDF_DEVICE_PNP_STATE_CHANGE_NOTIFICATION;
785 
786 typedef
787 _Function_class_(EVT_WDF_DEVICE_POWER_STATE_CHANGE_NOTIFICATION)
788 _IRQL_requires_same_
789 _IRQL_requires_max_(PASSIVE_LEVEL)
790 VOID
791 STDCALL
792 EVT_WDF_DEVICE_POWER_STATE_CHANGE_NOTIFICATION(
793     _In_
794     WDFDEVICE Device,
795     _In_
796     PCWDF_DEVICE_POWER_NOTIFICATION_DATA NotificationData
797     );
798 
799 typedef EVT_WDF_DEVICE_POWER_STATE_CHANGE_NOTIFICATION *PFN_WDF_DEVICE_POWER_STATE_CHANGE_NOTIFICATION;
800 
801 typedef
802 _Function_class_(EVT_WDF_DEVICE_POWER_POLICY_STATE_CHANGE_NOTIFICATION)
803 _IRQL_requires_same_
804 _IRQL_requires_max_(PASSIVE_LEVEL)
805 VOID
806 STDCALL
807 EVT_WDF_DEVICE_POWER_POLICY_STATE_CHANGE_NOTIFICATION(
808     _In_
809     WDFDEVICE Device,
810     _In_
811     PCWDF_DEVICE_POWER_POLICY_NOTIFICATION_DATA NotificationData
812     );
813 
814 typedef EVT_WDF_DEVICE_POWER_POLICY_STATE_CHANGE_NOTIFICATION *PFN_WDF_DEVICE_POWER_POLICY_STATE_CHANGE_NOTIFICATION;
815 
816 #define IdleTimeoutDefaultValue ((ULONG) IdleTimeoutDefaultConstant)
817 
818 typedef
819 _Function_class_(EVT_WDF_DEVICE_D0_ENTRY)
820 _IRQL_requires_same_
821 _IRQL_requires_max_(PASSIVE_LEVEL)
822 NTSTATUS
823 STDCALL
824 EVT_WDF_DEVICE_D0_ENTRY(
825     _In_
826     WDFDEVICE Device,
827     _In_
828     WDF_POWER_DEVICE_STATE PreviousState
829     );
830 
831 typedef EVT_WDF_DEVICE_D0_ENTRY *PFN_WDF_DEVICE_D0_ENTRY;
832 
833 typedef
834 _Function_class_(EVT_WDF_DEVICE_D0_ENTRY_POST_INTERRUPTS_ENABLED)
835 _IRQL_requires_same_
836 _IRQL_requires_max_(PASSIVE_LEVEL)
837 NTSTATUS
838 STDCALL
839 EVT_WDF_DEVICE_D0_ENTRY_POST_INTERRUPTS_ENABLED(
840     _In_
841     WDFDEVICE Device,
842     _In_
843     WDF_POWER_DEVICE_STATE PreviousState
844     );
845 
846 typedef EVT_WDF_DEVICE_D0_ENTRY_POST_INTERRUPTS_ENABLED *PFN_WDF_DEVICE_D0_ENTRY_POST_INTERRUPTS_ENABLED;
847 
848 typedef
849 _Function_class_(EVT_WDF_DEVICE_D0_EXIT)
850 _IRQL_requires_same_
851 _IRQL_requires_max_(PASSIVE_LEVEL)
852 NTSTATUS
853 STDCALL
854 EVT_WDF_DEVICE_D0_EXIT(
855     _In_
856     WDFDEVICE Device,
857     _In_
858     WDF_POWER_DEVICE_STATE TargetState
859     );
860 
861 typedef EVT_WDF_DEVICE_D0_EXIT *PFN_WDF_DEVICE_D0_EXIT;
862 
863 typedef
864 _Function_class_(EVT_WDF_DEVICE_D0_EXIT_PRE_INTERRUPTS_DISABLED)
865 _IRQL_requires_same_
866 _IRQL_requires_max_(PASSIVE_LEVEL)
867 NTSTATUS
868 STDCALL
869 EVT_WDF_DEVICE_D0_EXIT_PRE_INTERRUPTS_DISABLED(
870     _In_
871     WDFDEVICE Device,
872     _In_
873     WDF_POWER_DEVICE_STATE TargetState
874     );
875 
876 typedef EVT_WDF_DEVICE_D0_EXIT_PRE_INTERRUPTS_DISABLED *PFN_WDF_DEVICE_D0_EXIT_PRE_INTERRUPTS_DISABLED;
877 
878 typedef
879 _Function_class_(EVT_WDF_DEVICE_PREPARE_HARDWARE)
880 _IRQL_requires_same_
881 _IRQL_requires_max_(PASSIVE_LEVEL)
882 NTSTATUS
883 STDCALL
884 EVT_WDF_DEVICE_PREPARE_HARDWARE(
885     _In_
886     WDFDEVICE Device,
887     _In_
888     WDFCMRESLIST ResourcesRaw,
889     _In_
890     WDFCMRESLIST ResourcesTranslated
891     );
892 
893 typedef EVT_WDF_DEVICE_PREPARE_HARDWARE *PFN_WDF_DEVICE_PREPARE_HARDWARE;
894 
895 typedef
896 _Function_class_(EVT_WDF_DEVICE_RELEASE_HARDWARE)
897 _IRQL_requires_same_
898 _IRQL_requires_max_(PASSIVE_LEVEL)
899 NTSTATUS
900 STDCALL
901 EVT_WDF_DEVICE_RELEASE_HARDWARE(
902     _In_
903     WDFDEVICE Device,
904     _In_
905     WDFCMRESLIST ResourcesTranslated
906     );
907 
908 typedef EVT_WDF_DEVICE_RELEASE_HARDWARE *PFN_WDF_DEVICE_RELEASE_HARDWARE;
909 
910 typedef
911 _Function_class_(EVT_WDF_DEVICE_SELF_MANAGED_IO_CLEANUP)
912 _IRQL_requires_same_
913 _IRQL_requires_max_(PASSIVE_LEVEL)
914 VOID
915 STDCALL
916 EVT_WDF_DEVICE_SELF_MANAGED_IO_CLEANUP(
917     _In_
918     WDFDEVICE Device
919     );
920 
921 typedef EVT_WDF_DEVICE_SELF_MANAGED_IO_CLEANUP *PFN_WDF_DEVICE_SELF_MANAGED_IO_CLEANUP;
922 
923 typedef
924 _Function_class_(EVT_WDF_DEVICE_SELF_MANAGED_IO_FLUSH)
925 _IRQL_requires_same_
926 _IRQL_requires_max_(PASSIVE_LEVEL)
927 VOID
928 STDCALL
929 EVT_WDF_DEVICE_SELF_MANAGED_IO_FLUSH(
930     _In_
931     WDFDEVICE Device
932     );
933 
934 typedef EVT_WDF_DEVICE_SELF_MANAGED_IO_FLUSH *PFN_WDF_DEVICE_SELF_MANAGED_IO_FLUSH;
935 
936 typedef
937 _Function_class_(EVT_WDF_DEVICE_SELF_MANAGED_IO_INIT)
938 _IRQL_requires_same_
939 _IRQL_requires_max_(PASSIVE_LEVEL)
940 NTSTATUS
941 STDCALL
942 EVT_WDF_DEVICE_SELF_MANAGED_IO_INIT(
943     _In_
944     WDFDEVICE Device
945     );
946 
947 typedef EVT_WDF_DEVICE_SELF_MANAGED_IO_INIT *PFN_WDF_DEVICE_SELF_MANAGED_IO_INIT;
948 
949 typedef
950 _Function_class_(EVT_WDF_DEVICE_SELF_MANAGED_IO_SUSPEND)
951 _IRQL_requires_same_
952 _IRQL_requires_max_(PASSIVE_LEVEL)
953 NTSTATUS
954 STDCALL
955 EVT_WDF_DEVICE_SELF_MANAGED_IO_SUSPEND(
956     _In_
957     WDFDEVICE Device
958     );
959 
960 typedef EVT_WDF_DEVICE_SELF_MANAGED_IO_SUSPEND *PFN_WDF_DEVICE_SELF_MANAGED_IO_SUSPEND;
961 
962 typedef
963 _Function_class_(EVT_WDF_DEVICE_SELF_MANAGED_IO_RESTART)
964 _IRQL_requires_same_
965 _IRQL_requires_max_(PASSIVE_LEVEL)
966 NTSTATUS
967 STDCALL
968 EVT_WDF_DEVICE_SELF_MANAGED_IO_RESTART(
969     _In_
970     WDFDEVICE Device
971     );
972 
973 typedef EVT_WDF_DEVICE_SELF_MANAGED_IO_RESTART *PFN_WDF_DEVICE_SELF_MANAGED_IO_RESTART;
974 
975 typedef
976 _Function_class_(EVT_WDF_DEVICE_QUERY_STOP)
977 _IRQL_requires_same_
978 _IRQL_requires_max_(PASSIVE_LEVEL)
979 NTSTATUS
980 STDCALL
981 EVT_WDF_DEVICE_QUERY_STOP(
982     _In_
983     WDFDEVICE Device
984     );
985 
986 typedef EVT_WDF_DEVICE_QUERY_STOP *PFN_WDF_DEVICE_QUERY_STOP;
987 
988 typedef
989 _Function_class_(EVT_WDF_DEVICE_QUERY_REMOVE)
990 _IRQL_requires_same_
991 _IRQL_requires_max_(PASSIVE_LEVEL)
992 NTSTATUS
993 STDCALL
994 EVT_WDF_DEVICE_QUERY_REMOVE(
995     _In_
996     WDFDEVICE Device
997     );
998 
999 typedef EVT_WDF_DEVICE_QUERY_REMOVE *PFN_WDF_DEVICE_QUERY_REMOVE;
1000 
1001 typedef
1002 _Function_class_(EVT_WDF_DEVICE_SURPRISE_REMOVAL)
1003 _IRQL_requires_same_
1004 _IRQL_requires_max_(PASSIVE_LEVEL)
1005 VOID
1006 STDCALL
1007 EVT_WDF_DEVICE_SURPRISE_REMOVAL(
1008     _In_
1009     WDFDEVICE Device
1010     );
1011 
1012 typedef EVT_WDF_DEVICE_SURPRISE_REMOVAL *PFN_WDF_DEVICE_SURPRISE_REMOVAL;
1013 
1014 typedef
1015 _Function_class_(EVT_WDF_DEVICE_USAGE_NOTIFICATION)
1016 _IRQL_requires_same_
1017 _IRQL_requires_max_(PASSIVE_LEVEL)
1018 VOID
1019 STDCALL
1020 EVT_WDF_DEVICE_USAGE_NOTIFICATION(
1021     _In_
1022     WDFDEVICE Device,
1023     _In_
1024     WDF_SPECIAL_FILE_TYPE NotificationType,
1025     _In_
1026     BOOLEAN IsInNotificationPath
1027     );
1028 
1029 typedef EVT_WDF_DEVICE_USAGE_NOTIFICATION *PFN_WDF_DEVICE_USAGE_NOTIFICATION;
1030 
1031 typedef
1032 _Function_class_(EVT_WDF_DEVICE_USAGE_NOTIFICATION_EX)
1033 _IRQL_requires_same_
1034 _IRQL_requires_max_(PASSIVE_LEVEL)
1035 NTSTATUS
1036 STDCALL
1037 EVT_WDF_DEVICE_USAGE_NOTIFICATION_EX(
1038     _In_
1039     WDFDEVICE Device,
1040     _In_
1041     WDF_SPECIAL_FILE_TYPE NotificationType,
1042     _In_
1043     BOOLEAN IsInNotificationPath
1044     );
1045 
1046 typedef EVT_WDF_DEVICE_USAGE_NOTIFICATION_EX *PFN_WDF_DEVICE_USAGE_NOTIFICATION_EX;
1047 
1048 typedef
1049 _Function_class_(EVT_WDF_DEVICE_RELATIONS_QUERY)
1050 _IRQL_requires_same_
1051 _IRQL_requires_max_(PASSIVE_LEVEL)
1052 VOID
1053 STDCALL
1054 EVT_WDF_DEVICE_RELATIONS_QUERY(
1055     _In_
1056     WDFDEVICE Device,
1057     _In_
1058     DEVICE_RELATION_TYPE RelationType
1059     );
1060 
1061 typedef EVT_WDF_DEVICE_RELATIONS_QUERY *PFN_WDF_DEVICE_RELATIONS_QUERY;
1062 
1063 typedef
1064 _Function_class_(EVT_WDF_DEVICE_ARM_WAKE_FROM_S0)
1065 _IRQL_requires_same_
1066 _IRQL_requires_max_(PASSIVE_LEVEL)
1067 NTSTATUS
1068 STDCALL
1069 EVT_WDF_DEVICE_ARM_WAKE_FROM_S0(
1070     _In_
1071     WDFDEVICE Device
1072     );
1073 
1074 typedef EVT_WDF_DEVICE_ARM_WAKE_FROM_S0 *PFN_WDF_DEVICE_ARM_WAKE_FROM_S0;
1075 
1076 typedef
1077 _Function_class_(EVT_WDF_DEVICE_ARM_WAKE_FROM_SX)
1078 _IRQL_requires_same_
1079 _IRQL_requires_max_(PASSIVE_LEVEL)
1080 NTSTATUS
1081 STDCALL
1082 EVT_WDF_DEVICE_ARM_WAKE_FROM_SX(
1083     _In_
1084     WDFDEVICE Device
1085     );
1086 
1087 typedef EVT_WDF_DEVICE_ARM_WAKE_FROM_SX *PFN_WDF_DEVICE_ARM_WAKE_FROM_SX;
1088 
1089 typedef
1090 _Function_class_(EVT_WDF_DEVICE_ARM_WAKE_FROM_SX_WITH_REASON)
1091 _IRQL_requires_same_
1092 _IRQL_requires_max_(PASSIVE_LEVEL)
1093 NTSTATUS
1094 STDCALL
1095 EVT_WDF_DEVICE_ARM_WAKE_FROM_SX_WITH_REASON(
1096     _In_
1097     WDFDEVICE Device,
1098     _In_
1099     BOOLEAN DeviceWakeEnabled,
1100     _In_
1101     BOOLEAN ChildrenArmedForWake
1102     );
1103 
1104 typedef EVT_WDF_DEVICE_ARM_WAKE_FROM_SX_WITH_REASON *PFN_WDF_DEVICE_ARM_WAKE_FROM_SX_WITH_REASON;
1105 
1106 typedef
1107 _Function_class_(EVT_WDF_DEVICE_DISARM_WAKE_FROM_S0)
1108 _IRQL_requires_same_
1109 _IRQL_requires_max_(PASSIVE_LEVEL)
1110 VOID
1111 STDCALL
1112 EVT_WDF_DEVICE_DISARM_WAKE_FROM_S0(
1113     _In_
1114     WDFDEVICE Device
1115     );
1116 
1117 typedef EVT_WDF_DEVICE_DISARM_WAKE_FROM_S0 *PFN_WDF_DEVICE_DISARM_WAKE_FROM_S0;
1118 
1119 typedef
1120 _Function_class_(EVT_WDF_DEVICE_DISARM_WAKE_FROM_SX)
1121 _IRQL_requires_same_
1122 _IRQL_requires_max_(PASSIVE_LEVEL)
1123 VOID
1124 STDCALL
1125 EVT_WDF_DEVICE_DISARM_WAKE_FROM_SX(
1126     _In_
1127     WDFDEVICE Device
1128     );
1129 
1130 typedef EVT_WDF_DEVICE_DISARM_WAKE_FROM_SX *PFN_WDF_DEVICE_DISARM_WAKE_FROM_SX;
1131 
1132 typedef
1133 _Function_class_(EVT_WDF_DEVICE_WAKE_FROM_S0_TRIGGERED)
1134 _IRQL_requires_same_
1135 _IRQL_requires_max_(PASSIVE_LEVEL)
1136 VOID
1137 STDCALL
1138 EVT_WDF_DEVICE_WAKE_FROM_S0_TRIGGERED(
1139     _In_
1140     WDFDEVICE Device
1141     );
1142 
1143 typedef EVT_WDF_DEVICE_WAKE_FROM_S0_TRIGGERED *PFN_WDF_DEVICE_WAKE_FROM_S0_TRIGGERED;
1144 
1145 typedef
1146 _Function_class_(EVT_WDF_DEVICE_WAKE_FROM_SX_TRIGGERED)
1147 _IRQL_requires_same_
1148 _IRQL_requires_max_(PASSIVE_LEVEL)
1149 VOID
1150 STDCALL
1151 EVT_WDF_DEVICE_WAKE_FROM_SX_TRIGGERED(
1152     _In_
1153     WDFDEVICE Device
1154     );
1155 
1156 typedef EVT_WDF_DEVICE_WAKE_FROM_SX_TRIGGERED *PFN_WDF_DEVICE_WAKE_FROM_SX_TRIGGERED;
1157 
1158 typedef struct _WDF_PNPPOWER_EVENT_CALLBACKS {
1159     //
1160     // Size of this structure in bytes
1161     //
1162     ULONG Size;
1163 
1164     PFN_WDF_DEVICE_D0_ENTRY                 EvtDeviceD0Entry;
1165     PFN_WDF_DEVICE_D0_ENTRY_POST_INTERRUPTS_ENABLED EvtDeviceD0EntryPostInterruptsEnabled;
1166     PFN_WDF_DEVICE_D0_EXIT                  EvtDeviceD0Exit;
1167     PFN_WDF_DEVICE_D0_EXIT_PRE_INTERRUPTS_DISABLED EvtDeviceD0ExitPreInterruptsDisabled;
1168     PFN_WDF_DEVICE_PREPARE_HARDWARE         EvtDevicePrepareHardware;
1169     PFN_WDF_DEVICE_RELEASE_HARDWARE         EvtDeviceReleaseHardware;
1170     PFN_WDF_DEVICE_SELF_MANAGED_IO_CLEANUP  EvtDeviceSelfManagedIoCleanup;
1171     PFN_WDF_DEVICE_SELF_MANAGED_IO_FLUSH    EvtDeviceSelfManagedIoFlush;
1172     PFN_WDF_DEVICE_SELF_MANAGED_IO_INIT     EvtDeviceSelfManagedIoInit;
1173     PFN_WDF_DEVICE_SELF_MANAGED_IO_SUSPEND  EvtDeviceSelfManagedIoSuspend;
1174     PFN_WDF_DEVICE_SELF_MANAGED_IO_RESTART  EvtDeviceSelfManagedIoRestart;
1175     PFN_WDF_DEVICE_SURPRISE_REMOVAL         EvtDeviceSurpriseRemoval;
1176     PFN_WDF_DEVICE_QUERY_REMOVE             EvtDeviceQueryRemove;
1177     PFN_WDF_DEVICE_QUERY_STOP               EvtDeviceQueryStop;
1178     PFN_WDF_DEVICE_USAGE_NOTIFICATION       EvtDeviceUsageNotification;
1179     PFN_WDF_DEVICE_RELATIONS_QUERY          EvtDeviceRelationsQuery;
1180     PFN_WDF_DEVICE_USAGE_NOTIFICATION_EX    EvtDeviceUsageNotificationEx;
1181 } WDF_PNPPOWER_EVENT_CALLBACKS, *PWDF_PNPPOWER_EVENT_CALLBACKS;
1182 
1183 typedef struct _WDF_POWER_POLICY_EVENT_CALLBACKS {
1184     //
1185     // Size of this structure in bytes
1186     //
1187     ULONG Size;
1188 
1189     PFN_WDF_DEVICE_ARM_WAKE_FROM_S0         EvtDeviceArmWakeFromS0;
1190     PFN_WDF_DEVICE_DISARM_WAKE_FROM_S0      EvtDeviceDisarmWakeFromS0;
1191     PFN_WDF_DEVICE_WAKE_FROM_S0_TRIGGERED   EvtDeviceWakeFromS0Triggered;
1192 
1193     PFN_WDF_DEVICE_ARM_WAKE_FROM_SX         EvtDeviceArmWakeFromSx;
1194     PFN_WDF_DEVICE_DISARM_WAKE_FROM_SX      EvtDeviceDisarmWakeFromSx;
1195     PFN_WDF_DEVICE_WAKE_FROM_SX_TRIGGERED   EvtDeviceWakeFromSxTriggered;
1196 
1197     PFN_WDF_DEVICE_ARM_WAKE_FROM_SX_WITH_REASON EvtDeviceArmWakeFromSxWithReason;
1198 
1199 } WDF_POWER_POLICY_EVENT_CALLBACKS, *PWDF_POWER_POLICY_EVENT_CALLBACKS;
1200 
1201 FORCEINLINE
1202 VOID
WDF_POWER_POLICY_EVENT_CALLBACKS_INIT(_Out_ PWDF_POWER_POLICY_EVENT_CALLBACKS Callbacks)1203 WDF_POWER_POLICY_EVENT_CALLBACKS_INIT(
1204     _Out_ PWDF_POWER_POLICY_EVENT_CALLBACKS Callbacks
1205     )
1206 {
1207     RtlZeroMemory(Callbacks, sizeof(WDF_POWER_POLICY_EVENT_CALLBACKS));
1208 
1209     Callbacks->Size = sizeof(WDF_POWER_POLICY_EVENT_CALLBACKS);
1210 }
1211 
1212 FORCEINLINE
1213 VOID
WDF_PNPPOWER_EVENT_CALLBACKS_INIT(_Out_ PWDF_PNPPOWER_EVENT_CALLBACKS Callbacks)1214 WDF_PNPPOWER_EVENT_CALLBACKS_INIT(
1215     _Out_ PWDF_PNPPOWER_EVENT_CALLBACKS Callbacks
1216     )
1217 {
1218     RtlZeroMemory(Callbacks, sizeof(WDF_PNPPOWER_EVENT_CALLBACKS));
1219     Callbacks->Size = sizeof(WDF_PNPPOWER_EVENT_CALLBACKS);
1220 }
1221 
1222 
1223 FORCEINLINE
1224 ULONG
WdfDevStateNormalize(_In_ ULONG State)1225 WdfDevStateNormalize(
1226     _In_ ULONG State
1227     )
1228 {
1229     return State & ~WdfDevStateNP;
1230 }
1231 
1232 
1233 FORCEINLINE
1234 BOOLEAN
WdfDevStateIsNP(_In_ ULONG State)1235 WdfDevStateIsNP(
1236     _In_ ULONG State
1237     )
1238 {
1239     return (State & WdfDevStateNP) ? TRUE : FALSE;
1240 }
1241 
1242 typedef enum _WDF_POWER_POLICY_IDLE_TIMEOUT_TYPE {
1243     DriverManagedIdleTimeout = 0,
1244     SystemManagedIdleTimeout = 1,
1245     SystemManagedIdleTimeoutWithHint = 2
1246 } WDF_POWER_POLICY_IDLE_TIMEOUT_TYPE, *PWDF_POWER_POLICY_IDLE_TIMEOUT_TYPE;
1247 
1248 typedef struct _WDF_DEVICE_POWER_POLICY_IDLE_SETTINGS {
1249     //
1250     // Size of this structure in bytes
1251     //
1252     ULONG Size;
1253 
1254     //
1255     // Indicates whether the device can wake itself up while the machine is in
1256     // S0.
1257     //
1258     WDF_POWER_POLICY_S0_IDLE_CAPABILITIES IdleCaps;
1259 
1260     //
1261     // The low power state in which the device will be placed when it is idled
1262     // out while the machine is in S0.
1263     //
1264     DEVICE_POWER_STATE DxState;
1265 
1266     //
1267     // Amount of time the device must be idle before idling out.  Timeout is in
1268     // milliseconds.
1269     //
1270     ULONG IdleTimeout;
1271 
1272     //
1273     // Inidcates whether a user can control the idle policy of the device.
1274     // By default, a user is allowed to change the policy.
1275     //
1276     WDF_POWER_POLICY_S0_IDLE_USER_CONTROL UserControlOfIdleSettings;
1277 
1278     //
1279     // If WdfTrue, idling out while the machine is in S0 will be enabled.
1280     //
1281     // If WdfFalse, idling out will be disabled.
1282     //
1283     // If WdfUseDefault, the idling out will be enabled.  If
1284     // UserControlOfIdleSettings is set to IdleAllowUserControl, the user's
1285     // settings will override the default.
1286     //
1287     WDF_TRI_STATE Enabled;
1288 
1289     //
1290     // This field is applicable only when IdleCaps == IdleCannotWakeFromS0
1291     // If WdfTrue,device is powered up on System Wake even if device is idle
1292     // If WdfFalse, device is not powered up on system wake if it is idle
1293     // If WdfUseDefault, the behavior is same as WdfFalse
1294     //
1295     WDF_TRI_STATE PowerUpIdleDeviceOnSystemWake;
1296 
1297     //
1298     // This field determines how the IdleTimeout field is used.
1299     //
1300     // If the value is DriverManagedIdleTimeout, then the idle timeout value
1301     // is determined by the IdleTimeout field of this structure.
1302     //
1303     // If the value is SystemManagedIdleTimeout, then the timeout value is
1304     // determined by the power framework (PoFx) on operating systems where
1305     // the PoFx is available (i.e. Windows 8 and later). The IdleTimeout field
1306     // is ignored on these operating systems. On operating systems where the
1307     // PoFx is not available, the behavior is same as DriverManagedIdleTimeout.
1308     //
1309     // If the value is SystemManagedIdleTimeoutWithHint, then the timeout value
1310     // is determined by the power framework (PoFx) on operating systems where
1311     // the PoFx is available (i.e. Windows 8 and later). In addition, the value
1312     // specified in the IdleTimeout field is provided as a hint to the PoFx in
1313     // determining when the device should be allowed to enter a low-power state.
1314     // Since it is only a hint, the actual duration after which the PoFx allows
1315     // the device to enter a low-power state might be greater than or less than
1316     // the IdleTimeout value. On operating systems where the PoFx is not
1317     // available, the behavior is same as DriverManagedIdleTimeout.
1318     //
1319     WDF_POWER_POLICY_IDLE_TIMEOUT_TYPE IdleTimeoutType;
1320 
1321     //
1322     // This field forces the device to avoid idling in the D3cold power state.
1323     // WDF will ensure, with help from the bus drivers, that the device will
1324     // idle in a D-state that can successfully generate a wake signal, if
1325     // necessary.  If the client specifies that DxState == PowerDeviceD3, this
1326     // setting allows the client to distinguish betwen D3hot and D3cold.  If
1327     // the client sets DxState == PowerDeviceMaximum, then WDF will pick the
1328     // deepest idle state identified by the bus driver.  If that deepest state
1329     // is D3cold, this field allows the client to override that and choose
1330     // D3hot.
1331     //
1332     // If WdfTrue, device will not use D3cold in S0.
1333     // If WdfFalse, device will use D3cold in S0 if the ACPI firmware indicates
1334     //      that the device can enter that state, if DxState above does not
1335     //      specify some other D-state and, if the device is armed for
1336     //      wake, that it can generate its wake signal from D3cold.
1337     // If WdfUseDefault, this setting will be derived from the driver's INF,
1338     //      specifically the presence or absence of the following two lines in
1339     //      the DDInstall.HW section:
1340     //          Include=machine.inf
1341     //          Needs=PciD3ColdSupported
1342     //
1343     WDF_TRI_STATE ExcludeD3Cold;
1344 
1345 } WDF_DEVICE_POWER_POLICY_IDLE_SETTINGS, *PWDF_DEVICE_POWER_POLICY_IDLE_SETTINGS;
1346 
1347 FORCEINLINE
1348 VOID
WDF_DEVICE_POWER_POLICY_IDLE_SETTINGS_INIT(_Out_ PWDF_DEVICE_POWER_POLICY_IDLE_SETTINGS Settings,_In_ WDF_POWER_POLICY_S0_IDLE_CAPABILITIES IdleCaps)1349 WDF_DEVICE_POWER_POLICY_IDLE_SETTINGS_INIT(
1350     _Out_ PWDF_DEVICE_POWER_POLICY_IDLE_SETTINGS Settings,
1351     _In_ WDF_POWER_POLICY_S0_IDLE_CAPABILITIES IdleCaps
1352     )
1353 {
1354     RtlZeroMemory(Settings, sizeof(WDF_DEVICE_POWER_POLICY_IDLE_SETTINGS));
1355 
1356     Settings->Size = sizeof(WDF_DEVICE_POWER_POLICY_IDLE_SETTINGS);
1357 
1358     Settings->IdleTimeout = IdleTimeoutDefaultValue;
1359     Settings->UserControlOfIdleSettings = IdleAllowUserControl;
1360     Settings->Enabled = WdfUseDefault;
1361     Settings->PowerUpIdleDeviceOnSystemWake = WdfUseDefault;
1362     Settings->IdleTimeoutType = DriverManagedIdleTimeout;
1363     Settings->ExcludeD3Cold = WdfUseDefault;
1364 
1365     Settings->IdleCaps = IdleCaps;
1366 
1367     switch (IdleCaps) {
1368     case IdleUsbSelectiveSuspend:
1369     case IdleCanWakeFromS0:
1370         Settings->DxState = PowerDeviceMaximum;
1371         break;
1372 
1373     case IdleCannotWakeFromS0:
1374         Settings->DxState = PowerDeviceD3;
1375         break;
1376     }
1377 }
1378 
1379 typedef struct _WDF_DEVICE_POWER_POLICY_WAKE_SETTINGS {
1380     //
1381     // Size of this structure in bytes
1382     //
1383     ULONG Size;
1384 
1385     //
1386     // The low power state in which the device will be placed when it is armed
1387     // for wake from Sx.
1388     //
1389     DEVICE_POWER_STATE DxState;
1390 
1391     //
1392     // Inidcates whether a user can control the idle policy of the device.
1393     // By default, a user is allowed to change the policy.
1394     //
1395     WDF_POWER_POLICY_SX_WAKE_USER_CONTROL UserControlOfWakeSettings;
1396 
1397     //
1398     // If WdfTrue, arming the device for wake while the machine is in Sx is
1399     // enabled.
1400     //
1401     // If WdfFalse, arming the device for wake while the machine is in Sx is
1402     // disabled.
1403     //
1404     // If WdfUseDefault, arming will be enabled.  If UserControlOfWakeSettings
1405     // is set to WakeAllowUserControl, the user's settings will override the
1406     // default.
1407     //
1408     WDF_TRI_STATE Enabled;
1409 
1410     //
1411     // If set to TRUE, arming the parent device can depend on whether there
1412     // is atleast one child device armed for wake.
1413     //
1414     // If set to FALSE, arming of the parent device will be independent of
1415     // whether any of the child devices are armed for wake.
1416     //
1417     BOOLEAN ArmForWakeIfChildrenAreArmedForWake;
1418 
1419     //
1420     // Indicates that whenever the parent device completes the wake irp
1421     // successfully, the status needs to be also propagated to the child
1422     // devices.  This helps in tracking which devices were responsible for
1423     // waking the system.
1424     //
1425     BOOLEAN IndicateChildWakeOnParentWake;
1426 
1427 } WDF_DEVICE_POWER_POLICY_WAKE_SETTINGS, *PWDF_DEVICE_POWER_POLICY_WAKE_SETTINGS;
1428 
1429 FORCEINLINE
1430 VOID
WDF_DEVICE_POWER_POLICY_WAKE_SETTINGS_INIT(_Out_ PWDF_DEVICE_POWER_POLICY_WAKE_SETTINGS Settings)1431 WDF_DEVICE_POWER_POLICY_WAKE_SETTINGS_INIT(
1432     _Out_ PWDF_DEVICE_POWER_POLICY_WAKE_SETTINGS Settings
1433     )
1434 {
1435     RtlZeroMemory(Settings, sizeof(WDF_DEVICE_POWER_POLICY_WAKE_SETTINGS));
1436 
1437     Settings->Size = sizeof(WDF_DEVICE_POWER_POLICY_WAKE_SETTINGS);
1438 
1439     Settings->Enabled = WdfUseDefault;
1440     Settings->DxState = PowerDeviceMaximum;
1441     Settings->UserControlOfWakeSettings = WakeAllowUserControl;
1442 }
1443 
1444 typedef struct _WDF_DEVICE_STATE {
1445     //
1446     // Size of this structure in bytes
1447     //
1448     ULONG Size;
1449 
1450     //
1451     // If set to WdfTrue, the device will be disabled
1452     //
1453     WDF_TRI_STATE Disabled;
1454 
1455     //
1456     // If set to WdfTrue, the device will not be displayed in device manager.
1457     // Once hidden, the device cannot be unhidden.
1458     //
1459     WDF_TRI_STATE DontDisplayInUI;
1460 
1461     //
1462     // If set to WdfTrue, the device is reporting itself as failed.  If set
1463     // in conjuction with ResourcesChanged to WdfTrue, the device will receive
1464     // a PnP stop and then a new PnP start device.
1465     //
1466     WDF_TRI_STATE Failed;
1467 
1468     //
1469     // If set to WdfTrue, the device cannot be subsequently disabled.
1470     //
1471     WDF_TRI_STATE NotDisableable;
1472 
1473 
1474     //
1475     // If set to WdfTrue, the device stack will be torn down.
1476     //
1477     WDF_TRI_STATE Removed;
1478 
1479     //
1480     // If set to WdfTrue, the device will be sent another PnP start.  If the
1481     // Failed field is set to WdfTrue as well, a PnP stop will be sent before
1482     // the start.
1483     //
1484     WDF_TRI_STATE ResourcesChanged;
1485 
1486 } WDF_DEVICE_STATE, *PWDF_DEVICE_STATE;
1487 
1488 FORCEINLINE
1489 VOID
WDF_DEVICE_STATE_INIT(_Out_ PWDF_DEVICE_STATE PnpDeviceState)1490 WDF_DEVICE_STATE_INIT(
1491     _Out_ PWDF_DEVICE_STATE PnpDeviceState
1492     )
1493 {
1494     RtlZeroMemory(PnpDeviceState, sizeof(WDF_DEVICE_STATE));
1495 
1496     PnpDeviceState->Size = sizeof(WDF_DEVICE_STATE);
1497 
1498     //
1499     // Initializes all of the fields to the WdfUseDefault enum value
1500     //
1501     PnpDeviceState->Disabled = WdfUseDefault;
1502     PnpDeviceState->DontDisplayInUI = WdfUseDefault;
1503     PnpDeviceState->Failed = WdfUseDefault;
1504     PnpDeviceState->NotDisableable = WdfUseDefault;
1505     PnpDeviceState->Removed = WdfUseDefault;
1506     PnpDeviceState->ResourcesChanged = WdfUseDefault;
1507 }
1508 
1509 typedef struct _WDF_DEVICE_PNP_CAPABILITIES {
1510     //
1511     // Size of the structure in bytes
1512     //
1513     ULONG Size;
1514 
1515     //
1516     // NOTE: To mark a PDO as raw, call WdfPdoInitAssignRawDevice
1517     //
1518 
1519     WDF_TRI_STATE LockSupported;
1520     WDF_TRI_STATE EjectSupported;
1521     WDF_TRI_STATE Removable;
1522     WDF_TRI_STATE DockDevice;
1523     WDF_TRI_STATE UniqueID;
1524     WDF_TRI_STATE SilentInstall;
1525     WDF_TRI_STATE SurpriseRemovalOK;
1526     WDF_TRI_STATE HardwareDisabled;
1527     WDF_TRI_STATE NoDisplayInUI;
1528 
1529     //
1530     // Default values of -1 indicate not to set this value
1531     //
1532     ULONG Address;
1533     ULONG UINumber;
1534 
1535 } WDF_DEVICE_PNP_CAPABILITIES, *PWDF_DEVICE_PNP_CAPABILITIES;
1536 
1537 FORCEINLINE
1538 VOID
WDF_DEVICE_PNP_CAPABILITIES_INIT(_Out_ PWDF_DEVICE_PNP_CAPABILITIES Caps)1539 WDF_DEVICE_PNP_CAPABILITIES_INIT(
1540     _Out_ PWDF_DEVICE_PNP_CAPABILITIES Caps
1541     )
1542 {
1543     RtlZeroMemory(Caps, sizeof(WDF_DEVICE_PNP_CAPABILITIES));
1544 
1545     Caps->Size = sizeof(WDF_DEVICE_PNP_CAPABILITIES);
1546 
1547     Caps->LockSupported = WdfUseDefault;
1548     Caps->EjectSupported = WdfUseDefault;
1549     Caps->Removable = WdfUseDefault;
1550     Caps->DockDevice = WdfUseDefault;
1551     Caps->UniqueID = WdfUseDefault;
1552     Caps->SilentInstall = WdfUseDefault;
1553     Caps->SurpriseRemovalOK = WdfUseDefault;
1554     Caps->HardwareDisabled = WdfUseDefault;
1555     Caps->NoDisplayInUI = WdfUseDefault;
1556 
1557     Caps->Address = (ULONG) -1;
1558     Caps->UINumber = (ULONG) -1;
1559 }
1560 
1561 typedef struct _WDF_DEVICE_POWER_CAPABILITIES {
1562     //
1563     // Size of the structure in bytes
1564     //
1565     ULONG Size;
1566 
1567     WDF_TRI_STATE DeviceD1;
1568     WDF_TRI_STATE DeviceD2;
1569 
1570     WDF_TRI_STATE WakeFromD0;
1571     WDF_TRI_STATE WakeFromD1;
1572     WDF_TRI_STATE WakeFromD2;
1573     WDF_TRI_STATE WakeFromD3;
1574 
1575     //
1576     // Default value PowerDeviceMaximum indicates not to set this value
1577     //
1578     DEVICE_POWER_STATE DeviceState[PowerSystemMaximum];
1579 
1580     //
1581     // Default value PowerDeviceMaximum, PowerSystemMaximum indicates not to
1582     // set this value.
1583     //
1584     DEVICE_POWER_STATE DeviceWake;
1585     SYSTEM_POWER_STATE SystemWake;
1586 
1587     //
1588     // Default values of -1 indicate not to set this value
1589     //
1590     ULONG D1Latency;
1591     ULONG D2Latency;
1592     ULONG D3Latency;
1593 
1594     //
1595     // Ideal Dx state for the device to be put into when the machine moves into
1596     // Sx and the device is not armed for wake.  By default, the default will be
1597     // placed into D3.  If IdealDxStateForSx is lighter then
1598     // DeviceState[Sx], then DeviceState[Sx] will be used as the Dx state.
1599     //
1600     DEVICE_POWER_STATE IdealDxStateForSx;
1601 
1602 } WDF_DEVICE_POWER_CAPABILITIES, *PWDF_DEVICE_POWER_CAPABILITIES;
1603 
1604 FORCEINLINE
1605 VOID
WDF_DEVICE_POWER_CAPABILITIES_INIT(_Out_ PWDF_DEVICE_POWER_CAPABILITIES Caps)1606 WDF_DEVICE_POWER_CAPABILITIES_INIT(
1607     _Out_ PWDF_DEVICE_POWER_CAPABILITIES Caps
1608     )
1609 {
1610     ULONG i;
1611 
1612     RtlZeroMemory(Caps, sizeof(WDF_DEVICE_POWER_CAPABILITIES));
1613 
1614     Caps->Size = sizeof(WDF_DEVICE_POWER_CAPABILITIES);
1615 
1616     Caps->DeviceD1 = WdfUseDefault;
1617     Caps->DeviceD2 = WdfUseDefault;
1618 
1619     Caps->WakeFromD0 = WdfUseDefault;
1620     Caps->WakeFromD1 = WdfUseDefault;
1621     Caps->WakeFromD2 = WdfUseDefault;
1622     Caps->WakeFromD3 = WdfUseDefault;
1623 
1624     for (i = 0; i < sizeof(Caps->DeviceState)/sizeof(Caps->DeviceState[1]); i++) {
1625         Caps->DeviceState[i] = PowerDeviceMaximum;
1626     }
1627 
1628     Caps->DeviceWake = PowerDeviceMaximum;
1629     Caps->SystemWake = PowerSystemMaximum;
1630 
1631     Caps->D1Latency = (ULONG) -1;
1632     Caps->D2Latency = (ULONG) -1;
1633     Caps->D3Latency = (ULONG) -1;
1634 
1635     Caps->IdealDxStateForSx = PowerDeviceMaximum;
1636 }
1637 
1638 typedef enum _WDF_REMOVE_LOCK_OPTIONS_FLAGS {
1639     WDF_REMOVE_LOCK_OPTION_ACQUIRE_FOR_IO = 0x00000001
1640 } WDF_REMOVE_LOCK_OPTIONS_FLAGS;
1641 
1642 typedef struct _WDF_REMOVE_LOCK_OPTIONS {
1643     //
1644     // Size of the structure in bytes
1645     //
1646     ULONG Size;
1647 
1648     //
1649     // Bit field combination of values from the WDF_REMOVE_LOCK_OPTIONS_FLAGS
1650     // enumeration
1651     //
1652     ULONG Flags;
1653 } WDF_REMOVE_LOCK_OPTIONS, *PWDF_REMOVE_LOCK_OPTIONS;
1654 
1655 
1656 //
1657 // Default remove lock options initialization macro
1658 //
1659 FORCEINLINE
1660 VOID
WDF_REMOVE_LOCK_OPTIONS_INIT(_Out_ PWDF_REMOVE_LOCK_OPTIONS RemoveLockOptions,_In_ ULONG Flags)1661 WDF_REMOVE_LOCK_OPTIONS_INIT(
1662     _Out_ PWDF_REMOVE_LOCK_OPTIONS  RemoveLockOptions,
1663     _In_ ULONG Flags
1664     )
1665 {
1666     RtlZeroMemory(RemoveLockOptions, sizeof(WDF_REMOVE_LOCK_OPTIONS));
1667 
1668     RemoveLockOptions->Size = sizeof(WDF_REMOVE_LOCK_OPTIONS);
1669     RemoveLockOptions->Flags = Flags;
1670 }
1671 
1672 typedef
1673 _Function_class_(EVT_WDFDEVICE_WDM_IRP_PREPROCESS)
1674 _IRQL_requires_same_
1675 _IRQL_requires_max_(DISPATCH_LEVEL)
1676 NTSTATUS
1677 STDCALL
1678 EVT_WDFDEVICE_WDM_IRP_PREPROCESS(
1679     _In_
1680     WDFDEVICE Device,
1681     _Inout_
1682     PIRP Irp
1683     );
1684 
1685 typedef EVT_WDFDEVICE_WDM_IRP_PREPROCESS *PFN_WDFDEVICE_WDM_IRP_PREPROCESS;
1686 
1687 typedef
1688 _Function_class_(EVT_WDFDEVICE_WDM_IRP_DISPATCH)
1689 _IRQL_requires_same_
1690 _IRQL_requires_max_(DISPATCH_LEVEL)
1691 NTSTATUS
1692 STDCALL
1693 EVT_WDFDEVICE_WDM_IRP_DISPATCH(
1694     _In_
1695     WDFDEVICE Device,
1696     _In_
1697     UCHAR MajorFunction,
1698     _In_
1699     UCHAR MinorFunction,
1700     _In_
1701     ULONG Code,
1702     _In_
1703     WDFCONTEXT DriverContext,
1704     _Inout_
1705     PIRP Irp,
1706     _In_
1707     WDFCONTEXT DispatchContext
1708     );
1709 
1710 typedef EVT_WDFDEVICE_WDM_IRP_DISPATCH *PFN_WDFDEVICE_WDM_IRP_DISPATCH;
1711 
1712 //
1713 // This is called to pre-process a request using METHOD_NEITHER
1714 //
1715 typedef
1716 _Function_class_(EVT_WDF_IO_IN_CALLER_CONTEXT)
1717 _IRQL_requires_same_
1718 _IRQL_requires_max_(DISPATCH_LEVEL)
1719 VOID
1720 STDCALL
1721 EVT_WDF_IO_IN_CALLER_CONTEXT(
1722     _In_
1723     WDFDEVICE Device,
1724     _In_
1725     WDFREQUEST Request
1726     );
1727 
1728 typedef EVT_WDF_IO_IN_CALLER_CONTEXT *PFN_WDF_IO_IN_CALLER_CONTEXT;
1729 
1730 typedef
1731 _Function_class_(EVT_WDFDEVICE_WDM_POST_PO_FX_REGISTER_DEVICE)
1732 _IRQL_requires_same_
1733 _IRQL_requires_max_(PASSIVE_LEVEL)
1734 NTSTATUS
1735 STDCALL
1736 EVT_WDFDEVICE_WDM_POST_PO_FX_REGISTER_DEVICE(
1737     _In_
1738     WDFDEVICE Device,
1739     _In_
1740     POHANDLE PoHandle
1741     );
1742 
1743 typedef EVT_WDFDEVICE_WDM_POST_PO_FX_REGISTER_DEVICE *PFN_WDFDEVICE_WDM_POST_PO_FX_REGISTER_DEVICE;
1744 
1745 typedef
1746 _Function_class_(EVT_WDFDEVICE_WDM_PRE_PO_FX_UNREGISTER_DEVICE)
1747 _IRQL_requires_same_
1748 _IRQL_requires_max_(PASSIVE_LEVEL)
1749 VOID
1750 STDCALL
1751 EVT_WDFDEVICE_WDM_PRE_PO_FX_UNREGISTER_DEVICE(
1752     _In_
1753     WDFDEVICE Device,
1754     _In_
1755      POHANDLE PoHandle
1756     );
1757 
1758 typedef EVT_WDFDEVICE_WDM_PRE_PO_FX_UNREGISTER_DEVICE *PFN_WDFDEVICE_WDM_PRE_PO_FX_UNREGISTER_DEVICE;
1759 
1760 typedef struct _WDF_POWER_FRAMEWORK_SETTINGS {
1761     //
1762     // Size of the structure, in bytes.
1763     //
1764     ULONG Size;
1765 
1766     //
1767     // Client driver's callback function that is invoked after KMDF has
1768     // registered with the power framework. This field can be NULL if the
1769     // client driver does not wish to specify this callback.
1770     //
1771     PFN_WDFDEVICE_WDM_POST_PO_FX_REGISTER_DEVICE EvtDeviceWdmPostPoFxRegisterDevice;
1772 
1773     //
1774     // Client driver's callback function that is invoked before KMDF
1775     // unregisters with the power framework. This field can be NULL if the
1776     // client driver does not wish to specify this callback.
1777     //
1778     PFN_WDFDEVICE_WDM_PRE_PO_FX_UNREGISTER_DEVICE EvtDeviceWdmPrePoFxUnregisterDevice;
1779 
1780     //
1781     // Pointer to a PO_FX_COMPONENT structure that describes the only component
1782     // in the single-component device. This field can be NULL if the client
1783     // driver wants KMDF to use the default specification for this component
1784     // (i.e. support for F0 only).
1785     //
1786     PPO_FX_COMPONENT Component;
1787 
1788     //
1789     // Client driver's PO_FX_COMPONENT_ACTIVE_CONDITION_CALLBACK callback
1790     // function. This field can be NULL if the client driver does not wish to
1791     // specify this callback.
1792     //
1793     PPO_FX_COMPONENT_ACTIVE_CONDITION_CALLBACK ComponentActiveConditionCallback;
1794 
1795     //
1796     // Client driver's PO_FX_COMPONENT_IDLE_CONDITION_CALLBACK callback
1797     // function. This field can be NULL if the client driver does not wish to
1798     // specify this callback.
1799     //
1800     PPO_FX_COMPONENT_IDLE_CONDITION_CALLBACK ComponentIdleConditionCallback;
1801 
1802     //
1803     // Client driver's PO_FX_COMPONENT_IDLE_STATE_CALLBACK callback function.
1804     // This field can be NULL if the client driver does not wish to specify
1805     // this callback.
1806     //
1807     PPO_FX_COMPONENT_IDLE_STATE_CALLBACK ComponentIdleStateCallback;
1808 
1809     //
1810     // Client driver's PO_FX_POWER_CONTROL_CALLBACK callback function. This
1811     // field can be NULL if the client driver does not wish to specify this
1812     // callback.
1813     //
1814     PPO_FX_POWER_CONTROL_CALLBACK PowerControlCallback;
1815 
1816     //
1817     // Context value that is passed in to the ComponentIdleStateCallback and
1818     // PowerControlCallback callback functions.
1819     //
1820     PVOID PoFxDeviceContext;
1821 } WDF_POWER_FRAMEWORK_SETTINGS, *PWDF_POWER_FRAMEWORK_SETTINGS;
1822 
1823 FORCEINLINE
1824 VOID
WDF_POWER_FRAMEWORK_SETTINGS_INIT(_Out_ PWDF_POWER_FRAMEWORK_SETTINGS PowerFrameworkSettings)1825 WDF_POWER_FRAMEWORK_SETTINGS_INIT(
1826     _Out_ PWDF_POWER_FRAMEWORK_SETTINGS PowerFrameworkSettings
1827     )
1828 {
1829     RtlZeroMemory(PowerFrameworkSettings,
1830                   sizeof(WDF_POWER_FRAMEWORK_SETTINGS));
1831     PowerFrameworkSettings->Size = sizeof(WDF_POWER_FRAMEWORK_SETTINGS);
1832 }
1833 
1834 
1835 typedef struct _WDF_IO_TYPE_CONFIG {
1836     //
1837     // Size of this structure in bytes
1838     //
1839     ULONG Size;
1840 
1841     //
1842     // <KMDF_DOC/>
1843     // Identifies the method that the driver will use to access data buffers
1844     // that it receives for read and write requests.
1845     //
1846     // <UMDF_DOC/>
1847     // Identifies the method that the driver will "prefer" to use to access data
1848     // buffers that it receives for read and write requests. Note that UMDF
1849     // driver provides just a preference, and not a guarantee.Therefore,
1850     // even if a driver specified direct access method, UMDF might use the
1851     // buffered access method for one or more of the device's requests to
1852     // improve performance. For example, UMDF uses buffered access for small
1853     // buffers, if it can copy the data to the driver's buffer faster than it
1854     // can map the buffers for direct access.
1855     //
1856     WDF_DEVICE_IO_TYPE ReadWriteIoType;
1857 
1858     //
1859     // <UMDF_ONLY/>
1860     // Identifies the method that the driver will "prefer" to use to access data
1861     // buffers that it receives for IOCTL requests. Note that UMDF
1862     // driver provides just a preference, and not a guarantee. Therefore,
1863     // even if a driver specified direct access method, UMDF might use the
1864     // buffered access method for one or more of the device's requests to
1865     // improve performance. For example, UMDF uses buffered access for small
1866     // buffers, if it can copy the data to the driver's buffer faster than it
1867     // can map the buffers for direct access.
1868     //
1869     WDF_DEVICE_IO_TYPE DeviceControlIoType;
1870 
1871     //
1872     // <UMDF_ONLY/>
1873     // Optional, Provides the smallest buffer size (in bytes) for which
1874     // UMDF will use direct access for the buffers. For example, set
1875     // DirectTransferThreshold to "12288" to indicate that UMDF should use buffered
1876     // access for all buffers that are smaller than 12 kilobytes, and direct
1877     // access for buffers equal to or greater than that. Typically, you
1878     // do not need to provide this value because UMDF uses a value that provides
1879     // the best performance. Note that there are other requirements that must be
1880     // met in order to get direct access of buffers. See Docs for details.
1881     //
1882     ULONG DirectTransferThreshold;
1883 
1884 } WDF_IO_TYPE_CONFIG, *PWDF_IO_TYPE_CONFIG;
1885 
1886 FORCEINLINE
1887 VOID
WDF_IO_TYPE_CONFIG_INIT(_Out_ PWDF_IO_TYPE_CONFIG IoTypeConfig)1888 WDF_IO_TYPE_CONFIG_INIT(
1889     _Out_ PWDF_IO_TYPE_CONFIG IoTypeConfig
1890     )
1891 {
1892     RtlZeroMemory(IoTypeConfig, sizeof(WDF_IO_TYPE_CONFIG));
1893     IoTypeConfig->Size = sizeof(WDF_IO_TYPE_CONFIG);
1894     IoTypeConfig->ReadWriteIoType = WdfDeviceIoBuffered;
1895     IoTypeConfig->DeviceControlIoType = WdfDeviceIoBuffered;
1896 }
1897 
1898 
1899 
1900 
1901 
1902 typedef struct _WDF_DEVICE_PROPERTY_DATA {
1903     //
1904     // Size of this structure
1905     //
1906     _In_      ULONG Size;
1907 
1908     //
1909     // A pointer to a DEVPROPKEY structure that specifies the device
1910     // property key.
1911     //
1912     _In_  const DEVPROPKEY * PropertyKey;
1913 
1914     //
1915     // A locale identifier. Set this parameter either to a language-specific
1916     // LCID value or to LOCALE_NEUTRAL. The LOCALE_NEUTRAL LCID specifies
1917     // that the property is language-neutral (that is, not specific to any
1918     // language). Do not set this parameter to LOCALE_SYSTEM_DEFAULT or
1919     // LOCALE_USER_DEFAULT. For more information about language-specific
1920     // LCID values, see LCID Structure.
1921     //
1922     _In_ LCID Lcid;
1923 
1924     //
1925     // Set this parameter to PLUGPLAY_PROPERTY_PERSISTENT if the property
1926     // value set by this routine should persist across computer restarts.
1927     // Otherwise, set Flags to zero. Ignored for Query DDIs.
1928     //
1929     _In_ ULONG Flags;
1930 
1931 } WDF_DEVICE_PROPERTY_DATA, *PWDF_DEVICE_PROPERTY_DATA;
1932 
1933 FORCEINLINE
1934 VOID
WDF_DEVICE_PROPERTY_DATA_INIT(_Out_ PWDF_DEVICE_PROPERTY_DATA PropertyData,_In_ const DEVPROPKEY * PropertyKey)1935 WDF_DEVICE_PROPERTY_DATA_INIT (
1936     _Out_ PWDF_DEVICE_PROPERTY_DATA PropertyData,
1937     _In_ const DEVPROPKEY* PropertyKey
1938     )
1939 {
1940     RtlZeroMemory(PropertyData, sizeof(* PropertyData));
1941 
1942     PropertyData->Size = sizeof(*PropertyData);
1943     PropertyData->PropertyKey = PropertyKey;
1944 }
1945 
1946 //
1947 // VOID
1948 // WdfDeviceStopIdle(
1949 //     _In_ WDFDEVICE Device,
1950 //     _In_ BOOLEAN WaitForD0
1951 //     );
1952 //
1953 // VOID
1954 // WdfDeviceStopIdleWithTag(
1955 //     _In_ WDFDEVICE Device,
1956 //     _In_ BOOLEAN WaitForD0,
1957 //     _In_ PVOID Tag
1958 //     );
1959 //
1960 // VOID
1961 // WdfDeviceResumeIdle(
1962 //     _In_ WDFDEVICE Device
1963 //     );
1964 //
1965 // VOID
1966 // WdfDeviceResumeIdleWithTag(
1967 //     _In_ WDFDEVICE Device
1968 //     _In_ PVOID Tag
1969 //     );
1970 //
1971 #define WdfDeviceStopIdle(Device, WaitForD0) \
1972         WdfDeviceStopIdleWithTag(Device, WaitForD0, NULL)
1973 
1974 #define WdfDeviceStopIdleWithTag(Device, WaitForD0, Tag) \
1975         WdfDeviceStopIdleActual(Device, WaitForD0, Tag, __LINE__, __FILE__)
1976 
1977 #define WdfDeviceResumeIdle(Device) \
1978         WdfDeviceResumeIdleWithTag(Device, NULL)
1979 
1980 #define WdfDeviceResumeIdleWithTag(Device, Tag) \
1981         WdfDeviceResumeIdleActual(Device, Tag, __LINE__, __FILE__)
1982 
1983 
1984 
1985 //
1986 // WDF Function: WdfDeviceGetDeviceState
1987 //
1988 typedef
1989 _IRQL_requires_max_(DISPATCH_LEVEL)
1990 WDFAPI
1991 VOID
1992 (STDCALL *PFN_WDFDEVICEGETDEVICESTATE)(
1993     _In_
1994     PWDF_DRIVER_GLOBALS DriverGlobals,
1995     _In_
1996     WDFDEVICE Device,
1997     _Out_
1998     PWDF_DEVICE_STATE DeviceState
1999     );
2000 
_IRQL_requires_max_(DISPATCH_LEVEL)2001 _IRQL_requires_max_(DISPATCH_LEVEL)
2002 FORCEINLINE
2003 VOID
2004 WdfDeviceGetDeviceState(
2005     _In_
2006     WDFDEVICE Device,
2007     _Out_
2008     PWDF_DEVICE_STATE DeviceState
2009     )
2010 {
2011     ((PFN_WDFDEVICEGETDEVICESTATE) WdfFunctions[WdfDeviceGetDeviceStateTableIndex])(WdfDriverGlobals, Device, DeviceState);
2012 }
2013 
2014 //
2015 // WDF Function: WdfDeviceSetDeviceState
2016 //
2017 typedef
2018 _IRQL_requires_max_(DISPATCH_LEVEL)
2019 WDFAPI
2020 VOID
2021 (STDCALL *PFN_WDFDEVICESETDEVICESTATE)(
2022     _In_
2023     PWDF_DRIVER_GLOBALS DriverGlobals,
2024     _In_
2025     WDFDEVICE Device,
2026     _In_
2027     PWDF_DEVICE_STATE DeviceState
2028     );
2029 
_IRQL_requires_max_(DISPATCH_LEVEL)2030 _IRQL_requires_max_(DISPATCH_LEVEL)
2031 FORCEINLINE
2032 VOID
2033 WdfDeviceSetDeviceState(
2034     _In_
2035     WDFDEVICE Device,
2036     _In_
2037     PWDF_DEVICE_STATE DeviceState
2038     )
2039 {
2040     ((PFN_WDFDEVICESETDEVICESTATE) WdfFunctions[WdfDeviceSetDeviceStateTableIndex])(WdfDriverGlobals, Device, DeviceState);
2041 }
2042 
2043 //
2044 // WDF Function: WdfWdmDeviceGetWdfDeviceHandle
2045 //
2046 typedef
2047 _IRQL_requires_max_(DISPATCH_LEVEL)
2048 WDFAPI
2049 WDFDEVICE
2050 (STDCALL *PFN_WDFWDMDEVICEGETWDFDEVICEHANDLE)(
2051     _In_
2052     PWDF_DRIVER_GLOBALS DriverGlobals,
2053     _In_
2054     PDEVICE_OBJECT DeviceObject
2055     );
2056 
_IRQL_requires_max_(DISPATCH_LEVEL)2057 _IRQL_requires_max_(DISPATCH_LEVEL)
2058 FORCEINLINE
2059 WDFDEVICE
2060 WdfWdmDeviceGetWdfDeviceHandle(
2061     _In_
2062     PDEVICE_OBJECT DeviceObject
2063     )
2064 {
2065     return ((PFN_WDFWDMDEVICEGETWDFDEVICEHANDLE) WdfFunctions[WdfWdmDeviceGetWdfDeviceHandleTableIndex])(WdfDriverGlobals, DeviceObject);
2066 }
2067 
2068 //
2069 // WDF Function: WdfDeviceWdmGetDeviceObject
2070 //
2071 typedef
2072 _IRQL_requires_max_(DISPATCH_LEVEL)
2073 WDFAPI
2074 PDEVICE_OBJECT
2075 (STDCALL *PFN_WDFDEVICEWDMGETDEVICEOBJECT)(
2076     _In_
2077     PWDF_DRIVER_GLOBALS DriverGlobals,
2078     _In_
2079     WDFDEVICE Device
2080     );
2081 
_IRQL_requires_max_(DISPATCH_LEVEL)2082 _IRQL_requires_max_(DISPATCH_LEVEL)
2083 FORCEINLINE
2084 PDEVICE_OBJECT
2085 WdfDeviceWdmGetDeviceObject(
2086     _In_
2087     WDFDEVICE Device
2088     )
2089 {
2090     return ((PFN_WDFDEVICEWDMGETDEVICEOBJECT) WdfFunctions[WdfDeviceWdmGetDeviceObjectTableIndex])(WdfDriverGlobals, Device);
2091 }
2092 
2093 //
2094 // WDF Function: WdfDeviceWdmGetAttachedDevice
2095 //
2096 typedef
2097 _IRQL_requires_max_(DISPATCH_LEVEL)
2098 WDFAPI
2099 PDEVICE_OBJECT
2100 (STDCALL *PFN_WDFDEVICEWDMGETATTACHEDDEVICE)(
2101     _In_
2102     PWDF_DRIVER_GLOBALS DriverGlobals,
2103     _In_
2104     WDFDEVICE Device
2105     );
2106 
_IRQL_requires_max_(DISPATCH_LEVEL)2107 _IRQL_requires_max_(DISPATCH_LEVEL)
2108 FORCEINLINE
2109 PDEVICE_OBJECT
2110 WdfDeviceWdmGetAttachedDevice(
2111     _In_
2112     WDFDEVICE Device
2113     )
2114 {
2115     return ((PFN_WDFDEVICEWDMGETATTACHEDDEVICE) WdfFunctions[WdfDeviceWdmGetAttachedDeviceTableIndex])(WdfDriverGlobals, Device);
2116 }
2117 
2118 //
2119 // WDF Function: WdfDeviceWdmGetPhysicalDevice
2120 //
2121 typedef
2122 _IRQL_requires_max_(DISPATCH_LEVEL)
2123 WDFAPI
2124 PDEVICE_OBJECT
2125 (STDCALL *PFN_WDFDEVICEWDMGETPHYSICALDEVICE)(
2126     _In_
2127     PWDF_DRIVER_GLOBALS DriverGlobals,
2128     _In_
2129     WDFDEVICE Device
2130     );
2131 
_IRQL_requires_max_(DISPATCH_LEVEL)2132 _IRQL_requires_max_(DISPATCH_LEVEL)
2133 FORCEINLINE
2134 PDEVICE_OBJECT
2135 WdfDeviceWdmGetPhysicalDevice(
2136     _In_
2137     WDFDEVICE Device
2138     )
2139 {
2140     return ((PFN_WDFDEVICEWDMGETPHYSICALDEVICE) WdfFunctions[WdfDeviceWdmGetPhysicalDeviceTableIndex])(WdfDriverGlobals, Device);
2141 }
2142 
2143 //
2144 // WDF Function: WdfDeviceWdmDispatchPreprocessedIrp
2145 //
2146 typedef
2147 _Must_inspect_result_
2148 _IRQL_requires_max_(DISPATCH_LEVEL)
2149 WDFAPI
2150 NTSTATUS
2151 (STDCALL *PFN_WDFDEVICEWDMDISPATCHPREPROCESSEDIRP)(
2152     _In_
2153     PWDF_DRIVER_GLOBALS DriverGlobals,
2154     _In_
2155     WDFDEVICE Device,
2156     _In_
2157     PIRP Irp
2158     );
2159 
2160 _Must_inspect_result_
_IRQL_requires_max_(DISPATCH_LEVEL)2161 _IRQL_requires_max_(DISPATCH_LEVEL)
2162 FORCEINLINE
2163 NTSTATUS
2164 WdfDeviceWdmDispatchPreprocessedIrp(
2165     _In_
2166     WDFDEVICE Device,
2167     _In_
2168     PIRP Irp
2169     )
2170 {
2171     return ((PFN_WDFDEVICEWDMDISPATCHPREPROCESSEDIRP) WdfFunctions[WdfDeviceWdmDispatchPreprocessedIrpTableIndex])(WdfDriverGlobals, Device, Irp);
2172 }
2173 
2174 //
2175 // WDF Function: WdfDeviceWdmDispatchIrp
2176 //
2177 typedef
2178 _Must_inspect_result_
2179 _IRQL_requires_max_(DISPATCH_LEVEL)
2180 WDFAPI
2181 NTSTATUS
2182 (STDCALL *PFN_WDFDEVICEWDMDISPATCHIRP)(
2183     _In_
2184     PWDF_DRIVER_GLOBALS DriverGlobals,
2185     _In_
2186     WDFDEVICE Device,
2187     _In_
2188     PIRP Irp,
2189     _In_
2190     WDFCONTEXT DispatchContext
2191     );
2192 
2193 _Must_inspect_result_
_IRQL_requires_max_(DISPATCH_LEVEL)2194 _IRQL_requires_max_(DISPATCH_LEVEL)
2195 FORCEINLINE
2196 NTSTATUS
2197 WdfDeviceWdmDispatchIrp(
2198     _In_
2199     WDFDEVICE Device,
2200     _In_
2201     PIRP Irp,
2202     _In_
2203     WDFCONTEXT DispatchContext
2204     )
2205 {
2206     return ((PFN_WDFDEVICEWDMDISPATCHIRP) WdfFunctions[WdfDeviceWdmDispatchIrpTableIndex])(WdfDriverGlobals, Device, Irp, DispatchContext);
2207 }
2208 
2209 //
2210 // WDF Function: WdfDeviceWdmDispatchIrpToIoQueue
2211 //
2212 typedef
2213 _Must_inspect_result_
2214 _IRQL_requires_max_(DISPATCH_LEVEL)
2215 WDFAPI
2216 NTSTATUS
2217 (STDCALL *PFN_WDFDEVICEWDMDISPATCHIRPTOIOQUEUE)(
2218     _In_
2219     PWDF_DRIVER_GLOBALS DriverGlobals,
2220     _In_
2221     WDFDEVICE Device,
2222     _In_
2223     PIRP Irp,
2224     _In_
2225     WDFQUEUE Queue,
2226     _In_
2227     ULONG Flags
2228     );
2229 
2230 _Must_inspect_result_
_IRQL_requires_max_(DISPATCH_LEVEL)2231 _IRQL_requires_max_(DISPATCH_LEVEL)
2232 FORCEINLINE
2233 NTSTATUS
2234 WdfDeviceWdmDispatchIrpToIoQueue(
2235     _In_
2236     WDFDEVICE Device,
2237     _In_
2238     PIRP Irp,
2239     _In_
2240     WDFQUEUE Queue,
2241     _In_
2242     ULONG Flags
2243     )
2244 {
2245     return ((PFN_WDFDEVICEWDMDISPATCHIRPTOIOQUEUE) WdfFunctions[WdfDeviceWdmDispatchIrpToIoQueueTableIndex])(WdfDriverGlobals, Device, Irp, Queue, Flags);
2246 }
2247 
2248 //
2249 // WDF Function: WdfDeviceAddDependentUsageDeviceObject
2250 //
2251 typedef
2252 _Must_inspect_result_
2253 _IRQL_requires_max_(DISPATCH_LEVEL)
2254 WDFAPI
2255 NTSTATUS
2256 (STDCALL *PFN_WDFDEVICEADDDEPENDENTUSAGEDEVICEOBJECT)(
2257     _In_
2258     PWDF_DRIVER_GLOBALS DriverGlobals,
2259     _In_
2260     WDFDEVICE Device,
2261     _In_
2262     PDEVICE_OBJECT DependentDevice
2263     );
2264 
2265 _Must_inspect_result_
_IRQL_requires_max_(DISPATCH_LEVEL)2266 _IRQL_requires_max_(DISPATCH_LEVEL)
2267 FORCEINLINE
2268 NTSTATUS
2269 WdfDeviceAddDependentUsageDeviceObject(
2270     _In_
2271     WDFDEVICE Device,
2272     _In_
2273     PDEVICE_OBJECT DependentDevice
2274     )
2275 {
2276     return ((PFN_WDFDEVICEADDDEPENDENTUSAGEDEVICEOBJECT) WdfFunctions[WdfDeviceAddDependentUsageDeviceObjectTableIndex])(WdfDriverGlobals, Device, DependentDevice);
2277 }
2278 
2279 //
2280 // WDF Function: WdfDeviceRemoveDependentUsageDeviceObject
2281 //
2282 typedef
2283 _IRQL_requires_max_(DISPATCH_LEVEL)
2284 WDFAPI
2285 VOID
2286 (STDCALL *PFN_WDFDEVICEREMOVEDEPENDENTUSAGEDEVICEOBJECT)(
2287     _In_
2288     PWDF_DRIVER_GLOBALS DriverGlobals,
2289     _In_
2290     WDFDEVICE Device,
2291     _In_
2292     PDEVICE_OBJECT DependentDevice
2293     );
2294 
_IRQL_requires_max_(DISPATCH_LEVEL)2295 _IRQL_requires_max_(DISPATCH_LEVEL)
2296 FORCEINLINE
2297 VOID
2298 WdfDeviceRemoveDependentUsageDeviceObject(
2299     _In_
2300     WDFDEVICE Device,
2301     _In_
2302     PDEVICE_OBJECT DependentDevice
2303     )
2304 {
2305     ((PFN_WDFDEVICEREMOVEDEPENDENTUSAGEDEVICEOBJECT) WdfFunctions[WdfDeviceRemoveDependentUsageDeviceObjectTableIndex])(WdfDriverGlobals, Device, DependentDevice);
2306 }
2307 
2308 //
2309 // WDF Function: WdfDeviceAddRemovalRelationsPhysicalDevice
2310 //
2311 typedef
2312 _Must_inspect_result_
2313 _IRQL_requires_max_(DISPATCH_LEVEL)
2314 WDFAPI
2315 NTSTATUS
2316 (STDCALL *PFN_WDFDEVICEADDREMOVALRELATIONSPHYSICALDEVICE)(
2317     _In_
2318     PWDF_DRIVER_GLOBALS DriverGlobals,
2319     _In_
2320     WDFDEVICE Device,
2321     _In_
2322     PDEVICE_OBJECT PhysicalDevice
2323     );
2324 
2325 _Must_inspect_result_
_IRQL_requires_max_(DISPATCH_LEVEL)2326 _IRQL_requires_max_(DISPATCH_LEVEL)
2327 FORCEINLINE
2328 NTSTATUS
2329 WdfDeviceAddRemovalRelationsPhysicalDevice(
2330     _In_
2331     WDFDEVICE Device,
2332     _In_
2333     PDEVICE_OBJECT PhysicalDevice
2334     )
2335 {
2336     return ((PFN_WDFDEVICEADDREMOVALRELATIONSPHYSICALDEVICE) WdfFunctions[WdfDeviceAddRemovalRelationsPhysicalDeviceTableIndex])(WdfDriverGlobals, Device, PhysicalDevice);
2337 }
2338 
2339 //
2340 // WDF Function: WdfDeviceRemoveRemovalRelationsPhysicalDevice
2341 //
2342 typedef
2343 _IRQL_requires_max_(DISPATCH_LEVEL)
2344 WDFAPI
2345 VOID
2346 (STDCALL *PFN_WDFDEVICEREMOVEREMOVALRELATIONSPHYSICALDEVICE)(
2347     _In_
2348     PWDF_DRIVER_GLOBALS DriverGlobals,
2349     _In_
2350     WDFDEVICE Device,
2351     _In_
2352     PDEVICE_OBJECT PhysicalDevice
2353     );
2354 
_IRQL_requires_max_(DISPATCH_LEVEL)2355 _IRQL_requires_max_(DISPATCH_LEVEL)
2356 FORCEINLINE
2357 VOID
2358 WdfDeviceRemoveRemovalRelationsPhysicalDevice(
2359     _In_
2360     WDFDEVICE Device,
2361     _In_
2362     PDEVICE_OBJECT PhysicalDevice
2363     )
2364 {
2365     ((PFN_WDFDEVICEREMOVEREMOVALRELATIONSPHYSICALDEVICE) WdfFunctions[WdfDeviceRemoveRemovalRelationsPhysicalDeviceTableIndex])(WdfDriverGlobals, Device, PhysicalDevice);
2366 }
2367 
2368 //
2369 // WDF Function: WdfDeviceClearRemovalRelationsDevices
2370 //
2371 typedef
2372 _IRQL_requires_max_(DISPATCH_LEVEL)
2373 WDFAPI
2374 VOID
2375 (STDCALL *PFN_WDFDEVICECLEARREMOVALRELATIONSDEVICES)(
2376     _In_
2377     PWDF_DRIVER_GLOBALS DriverGlobals,
2378     _In_
2379     WDFDEVICE Device
2380     );
2381 
_IRQL_requires_max_(DISPATCH_LEVEL)2382 _IRQL_requires_max_(DISPATCH_LEVEL)
2383 FORCEINLINE
2384 VOID
2385 WdfDeviceClearRemovalRelationsDevices(
2386     _In_
2387     WDFDEVICE Device
2388     )
2389 {
2390     ((PFN_WDFDEVICECLEARREMOVALRELATIONSDEVICES) WdfFunctions[WdfDeviceClearRemovalRelationsDevicesTableIndex])(WdfDriverGlobals, Device);
2391 }
2392 
2393 //
2394 // WDF Function: WdfDeviceGetDriver
2395 //
2396 typedef
2397 _IRQL_requires_max_(DISPATCH_LEVEL)
2398 WDFAPI
2399 WDFDRIVER
2400 (STDCALL *PFN_WDFDEVICEGETDRIVER)(
2401     _In_
2402     PWDF_DRIVER_GLOBALS DriverGlobals,
2403     _In_
2404     WDFDEVICE Device
2405     );
2406 
_IRQL_requires_max_(DISPATCH_LEVEL)2407 _IRQL_requires_max_(DISPATCH_LEVEL)
2408 FORCEINLINE
2409 WDFDRIVER
2410 WdfDeviceGetDriver(
2411     _In_
2412     WDFDEVICE Device
2413     )
2414 {
2415     return ((PFN_WDFDEVICEGETDRIVER) WdfFunctions[WdfDeviceGetDriverTableIndex])(WdfDriverGlobals, Device);
2416 }
2417 
2418 //
2419 // WDF Function: WdfDeviceRetrieveDeviceName
2420 //
2421 typedef
2422 _Must_inspect_result_
2423 _IRQL_requires_max_(PASSIVE_LEVEL)
2424 WDFAPI
2425 NTSTATUS
2426 (STDCALL *PFN_WDFDEVICERETRIEVEDEVICENAME)(
2427     _In_
2428     PWDF_DRIVER_GLOBALS DriverGlobals,
2429     _In_
2430     WDFDEVICE Device,
2431     _In_
2432     WDFSTRING String
2433     );
2434 
2435 _Must_inspect_result_
_IRQL_requires_max_(PASSIVE_LEVEL)2436 _IRQL_requires_max_(PASSIVE_LEVEL)
2437 FORCEINLINE
2438 NTSTATUS
2439 WdfDeviceRetrieveDeviceName(
2440     _In_
2441     WDFDEVICE Device,
2442     _In_
2443     WDFSTRING String
2444     )
2445 {
2446     return ((PFN_WDFDEVICERETRIEVEDEVICENAME) WdfFunctions[WdfDeviceRetrieveDeviceNameTableIndex])(WdfDriverGlobals, Device, String);
2447 }
2448 
2449 //
2450 // WDF Function: WdfDeviceAssignMofResourceName
2451 //
2452 typedef
2453 _Must_inspect_result_
2454 _IRQL_requires_max_(PASSIVE_LEVEL)
2455 WDFAPI
2456 NTSTATUS
2457 (STDCALL *PFN_WDFDEVICEASSIGNMOFRESOURCENAME)(
2458     _In_
2459     PWDF_DRIVER_GLOBALS DriverGlobals,
2460     _In_
2461     WDFDEVICE Device,
2462     _In_
2463     PCUNICODE_STRING MofResourceName
2464     );
2465 
2466 _Must_inspect_result_
_IRQL_requires_max_(PASSIVE_LEVEL)2467 _IRQL_requires_max_(PASSIVE_LEVEL)
2468 FORCEINLINE
2469 NTSTATUS
2470 WdfDeviceAssignMofResourceName(
2471     _In_
2472     WDFDEVICE Device,
2473     _In_
2474     PCUNICODE_STRING MofResourceName
2475     )
2476 {
2477     return ((PFN_WDFDEVICEASSIGNMOFRESOURCENAME) WdfFunctions[WdfDeviceAssignMofResourceNameTableIndex])(WdfDriverGlobals, Device, MofResourceName);
2478 }
2479 
2480 //
2481 // WDF Function: WdfDeviceGetIoTarget
2482 //
2483 typedef
2484 _IRQL_requires_max_(DISPATCH_LEVEL)
2485 WDFAPI
2486 WDFIOTARGET
2487 (STDCALL *PFN_WDFDEVICEGETIOTARGET)(
2488     _In_
2489     PWDF_DRIVER_GLOBALS DriverGlobals,
2490     _In_
2491     WDFDEVICE Device
2492     );
2493 
_IRQL_requires_max_(DISPATCH_LEVEL)2494 _IRQL_requires_max_(DISPATCH_LEVEL)
2495 FORCEINLINE
2496 WDFIOTARGET
2497 WdfDeviceGetIoTarget(
2498     _In_
2499     WDFDEVICE Device
2500     )
2501 {
2502     return ((PFN_WDFDEVICEGETIOTARGET) WdfFunctions[WdfDeviceGetIoTargetTableIndex])(WdfDriverGlobals, Device);
2503 }
2504 
2505 //
2506 // WDF Function: WdfDeviceGetDevicePnpState
2507 //
2508 typedef
2509 _IRQL_requires_max_(DISPATCH_LEVEL)
2510 WDFAPI
2511 WDF_DEVICE_PNP_STATE
2512 (STDCALL *PFN_WDFDEVICEGETDEVICEPNPSTATE)(
2513     _In_
2514     PWDF_DRIVER_GLOBALS DriverGlobals,
2515     _In_
2516     WDFDEVICE Device
2517     );
2518 
_IRQL_requires_max_(DISPATCH_LEVEL)2519 _IRQL_requires_max_(DISPATCH_LEVEL)
2520 FORCEINLINE
2521 WDF_DEVICE_PNP_STATE
2522 WdfDeviceGetDevicePnpState(
2523     _In_
2524     WDFDEVICE Device
2525     )
2526 {
2527     return ((PFN_WDFDEVICEGETDEVICEPNPSTATE) WdfFunctions[WdfDeviceGetDevicePnpStateTableIndex])(WdfDriverGlobals, Device);
2528 }
2529 
2530 //
2531 // WDF Function: WdfDeviceGetDevicePowerState
2532 //
2533 typedef
2534 _IRQL_requires_max_(DISPATCH_LEVEL)
2535 WDFAPI
2536 WDF_DEVICE_POWER_STATE
2537 (STDCALL *PFN_WDFDEVICEGETDEVICEPOWERSTATE)(
2538     _In_
2539     PWDF_DRIVER_GLOBALS DriverGlobals,
2540     _In_
2541     WDFDEVICE Device
2542     );
2543 
_IRQL_requires_max_(DISPATCH_LEVEL)2544 _IRQL_requires_max_(DISPATCH_LEVEL)
2545 FORCEINLINE
2546 WDF_DEVICE_POWER_STATE
2547 WdfDeviceGetDevicePowerState(
2548     _In_
2549     WDFDEVICE Device
2550     )
2551 {
2552     return ((PFN_WDFDEVICEGETDEVICEPOWERSTATE) WdfFunctions[WdfDeviceGetDevicePowerStateTableIndex])(WdfDriverGlobals, Device);
2553 }
2554 
2555 //
2556 // WDF Function: WdfDeviceGetDevicePowerPolicyState
2557 //
2558 typedef
2559 _IRQL_requires_max_(DISPATCH_LEVEL)
2560 WDFAPI
2561 WDF_DEVICE_POWER_POLICY_STATE
2562 (STDCALL *PFN_WDFDEVICEGETDEVICEPOWERPOLICYSTATE)(
2563     _In_
2564     PWDF_DRIVER_GLOBALS DriverGlobals,
2565     _In_
2566     WDFDEVICE Device
2567     );
2568 
_IRQL_requires_max_(DISPATCH_LEVEL)2569 _IRQL_requires_max_(DISPATCH_LEVEL)
2570 FORCEINLINE
2571 WDF_DEVICE_POWER_POLICY_STATE
2572 WdfDeviceGetDevicePowerPolicyState(
2573     _In_
2574     WDFDEVICE Device
2575     )
2576 {
2577     return ((PFN_WDFDEVICEGETDEVICEPOWERPOLICYSTATE) WdfFunctions[WdfDeviceGetDevicePowerPolicyStateTableIndex])(WdfDriverGlobals, Device);
2578 }
2579 
2580 //
2581 // WDF Function: WdfDeviceAssignS0IdleSettings
2582 //
2583 typedef
2584 _Must_inspect_result_
2585 _IRQL_requires_max_(DISPATCH_LEVEL)
2586 WDFAPI
2587 NTSTATUS
2588 (STDCALL *PFN_WDFDEVICEASSIGNS0IDLESETTINGS)(
2589     _In_
2590     PWDF_DRIVER_GLOBALS DriverGlobals,
2591     _In_
2592     WDFDEVICE Device,
2593     _In_
2594     PWDF_DEVICE_POWER_POLICY_IDLE_SETTINGS Settings
2595     );
2596 
2597 _Must_inspect_result_
_IRQL_requires_max_(DISPATCH_LEVEL)2598 _IRQL_requires_max_(DISPATCH_LEVEL)
2599 FORCEINLINE
2600 NTSTATUS
2601 WdfDeviceAssignS0IdleSettings(
2602     _In_
2603     WDFDEVICE Device,
2604     _In_
2605     PWDF_DEVICE_POWER_POLICY_IDLE_SETTINGS Settings
2606     )
2607 {
2608     return ((PFN_WDFDEVICEASSIGNS0IDLESETTINGS) WdfFunctions[WdfDeviceAssignS0IdleSettingsTableIndex])(WdfDriverGlobals, Device, Settings);
2609 }
2610 
2611 //
2612 // WDF Function: WdfDeviceAssignSxWakeSettings
2613 //
2614 typedef
2615 _Must_inspect_result_
2616 _IRQL_requires_max_(DISPATCH_LEVEL)
2617 WDFAPI
2618 NTSTATUS
2619 (STDCALL *PFN_WDFDEVICEASSIGNSXWAKESETTINGS)(
2620     _In_
2621     PWDF_DRIVER_GLOBALS DriverGlobals,
2622     _In_
2623     WDFDEVICE Device,
2624     _In_
2625     PWDF_DEVICE_POWER_POLICY_WAKE_SETTINGS Settings
2626     );
2627 
2628 _Must_inspect_result_
_IRQL_requires_max_(DISPATCH_LEVEL)2629 _IRQL_requires_max_(DISPATCH_LEVEL)
2630 FORCEINLINE
2631 NTSTATUS
2632 WdfDeviceAssignSxWakeSettings(
2633     _In_
2634     WDFDEVICE Device,
2635     _In_
2636     PWDF_DEVICE_POWER_POLICY_WAKE_SETTINGS Settings
2637     )
2638 {
2639     return ((PFN_WDFDEVICEASSIGNSXWAKESETTINGS) WdfFunctions[WdfDeviceAssignSxWakeSettingsTableIndex])(WdfDriverGlobals, Device, Settings);
2640 }
2641 
2642 //
2643 // WDF Function: WdfDeviceOpenRegistryKey
2644 //
2645 typedef
2646 _Must_inspect_result_
2647 _IRQL_requires_max_(PASSIVE_LEVEL)
2648 WDFAPI
2649 NTSTATUS
2650 (STDCALL *PFN_WDFDEVICEOPENREGISTRYKEY)(
2651     _In_
2652     PWDF_DRIVER_GLOBALS DriverGlobals,
2653     _In_
2654     WDFDEVICE Device,
2655     _In_
2656     ULONG DeviceInstanceKeyType,
2657     _In_
2658     ACCESS_MASK DesiredAccess,
2659     _In_opt_
2660     PWDF_OBJECT_ATTRIBUTES KeyAttributes,
2661     _Out_
2662     WDFKEY* Key
2663     );
2664 
2665 _Must_inspect_result_
_IRQL_requires_max_(PASSIVE_LEVEL)2666 _IRQL_requires_max_(PASSIVE_LEVEL)
2667 FORCEINLINE
2668 NTSTATUS
2669 WdfDeviceOpenRegistryKey(
2670     _In_
2671     WDFDEVICE Device,
2672     _In_
2673     ULONG DeviceInstanceKeyType,
2674     _In_
2675     ACCESS_MASK DesiredAccess,
2676     _In_opt_
2677     PWDF_OBJECT_ATTRIBUTES KeyAttributes,
2678     _Out_
2679     WDFKEY* Key
2680     )
2681 {
2682     return ((PFN_WDFDEVICEOPENREGISTRYKEY) WdfFunctions[WdfDeviceOpenRegistryKeyTableIndex])(WdfDriverGlobals, Device, DeviceInstanceKeyType, DesiredAccess, KeyAttributes, Key);
2683 }
2684 
2685 //
2686 // WDF Function: WdfDeviceOpenDevicemapKey
2687 //
2688 typedef
2689 _Must_inspect_result_
2690 _IRQL_requires_max_(PASSIVE_LEVEL)
2691 WDFAPI
2692 NTSTATUS
2693 (STDCALL *PFN_WDFDEVICEOPENDEVICEMAPKEY)(
2694     _In_
2695     PWDF_DRIVER_GLOBALS DriverGlobals,
2696     _In_
2697     WDFDEVICE Device,
2698     _In_
2699     PCUNICODE_STRING KeyName,
2700     _In_
2701     ACCESS_MASK DesiredAccess,
2702     _In_opt_
2703     PWDF_OBJECT_ATTRIBUTES KeyAttributes,
2704     _Out_
2705     WDFKEY* Key
2706     );
2707 
2708 _Must_inspect_result_
_IRQL_requires_max_(PASSIVE_LEVEL)2709 _IRQL_requires_max_(PASSIVE_LEVEL)
2710 FORCEINLINE
2711 NTSTATUS
2712 WdfDeviceOpenDevicemapKey(
2713     _In_
2714     WDFDEVICE Device,
2715     _In_
2716     PCUNICODE_STRING KeyName,
2717     _In_
2718     ACCESS_MASK DesiredAccess,
2719     _In_opt_
2720     PWDF_OBJECT_ATTRIBUTES KeyAttributes,
2721     _Out_
2722     WDFKEY* Key
2723     )
2724 {
2725     return ((PFN_WDFDEVICEOPENDEVICEMAPKEY) WdfFunctions[WdfDeviceOpenDevicemapKeyTableIndex])(WdfDriverGlobals, Device, KeyName, DesiredAccess, KeyAttributes, Key);
2726 }
2727 
2728 //
2729 // WDF Function: WdfDeviceSetSpecialFileSupport
2730 //
2731 typedef
2732 _IRQL_requires_max_(DISPATCH_LEVEL)
2733 WDFAPI
2734 VOID
2735 (STDCALL *PFN_WDFDEVICESETSPECIALFILESUPPORT)(
2736     _In_
2737     PWDF_DRIVER_GLOBALS DriverGlobals,
2738     _In_
2739     WDFDEVICE Device,
2740     _In_
2741     WDF_SPECIAL_FILE_TYPE FileType,
2742     _In_
2743     BOOLEAN FileTypeIsSupported
2744     );
2745 
_IRQL_requires_max_(DISPATCH_LEVEL)2746 _IRQL_requires_max_(DISPATCH_LEVEL)
2747 FORCEINLINE
2748 VOID
2749 WdfDeviceSetSpecialFileSupport(
2750     _In_
2751     WDFDEVICE Device,
2752     _In_
2753     WDF_SPECIAL_FILE_TYPE FileType,
2754     _In_
2755     BOOLEAN FileTypeIsSupported
2756     )
2757 {
2758     ((PFN_WDFDEVICESETSPECIALFILESUPPORT) WdfFunctions[WdfDeviceSetSpecialFileSupportTableIndex])(WdfDriverGlobals, Device, FileType, FileTypeIsSupported);
2759 }
2760 
2761 //
2762 // WDF Function: WdfDeviceSetCharacteristics
2763 //
2764 typedef
2765 _IRQL_requires_max_(DISPATCH_LEVEL)
2766 WDFAPI
2767 VOID
2768 (STDCALL *PFN_WDFDEVICESETCHARACTERISTICS)(
2769     _In_
2770     PWDF_DRIVER_GLOBALS DriverGlobals,
2771     _In_
2772     WDFDEVICE Device,
2773     _In_
2774     ULONG DeviceCharacteristics
2775     );
2776 
_IRQL_requires_max_(DISPATCH_LEVEL)2777 _IRQL_requires_max_(DISPATCH_LEVEL)
2778 FORCEINLINE
2779 VOID
2780 WdfDeviceSetCharacteristics(
2781     _In_
2782     WDFDEVICE Device,
2783     _In_
2784     ULONG DeviceCharacteristics
2785     )
2786 {
2787     ((PFN_WDFDEVICESETCHARACTERISTICS) WdfFunctions[WdfDeviceSetCharacteristicsTableIndex])(WdfDriverGlobals, Device, DeviceCharacteristics);
2788 }
2789 
2790 //
2791 // WDF Function: WdfDeviceGetCharacteristics
2792 //
2793 typedef
2794 _IRQL_requires_max_(DISPATCH_LEVEL)
2795 WDFAPI
2796 ULONG
2797 (STDCALL *PFN_WDFDEVICEGETCHARACTERISTICS)(
2798     _In_
2799     PWDF_DRIVER_GLOBALS DriverGlobals,
2800     _In_
2801     WDFDEVICE Device
2802     );
2803 
_IRQL_requires_max_(DISPATCH_LEVEL)2804 _IRQL_requires_max_(DISPATCH_LEVEL)
2805 FORCEINLINE
2806 ULONG
2807 WdfDeviceGetCharacteristics(
2808     _In_
2809     WDFDEVICE Device
2810     )
2811 {
2812     return ((PFN_WDFDEVICEGETCHARACTERISTICS) WdfFunctions[WdfDeviceGetCharacteristicsTableIndex])(WdfDriverGlobals, Device);
2813 }
2814 
2815 //
2816 // WDF Function: WdfDeviceGetAlignmentRequirement
2817 //
2818 typedef
2819 _IRQL_requires_max_(DISPATCH_LEVEL)
2820 WDFAPI
2821 ULONG
2822 (STDCALL *PFN_WDFDEVICEGETALIGNMENTREQUIREMENT)(
2823     _In_
2824     PWDF_DRIVER_GLOBALS DriverGlobals,
2825     _In_
2826     WDFDEVICE Device
2827     );
2828 
_IRQL_requires_max_(DISPATCH_LEVEL)2829 _IRQL_requires_max_(DISPATCH_LEVEL)
2830 FORCEINLINE
2831 ULONG
2832 WdfDeviceGetAlignmentRequirement(
2833     _In_
2834     WDFDEVICE Device
2835     )
2836 {
2837     return ((PFN_WDFDEVICEGETALIGNMENTREQUIREMENT) WdfFunctions[WdfDeviceGetAlignmentRequirementTableIndex])(WdfDriverGlobals, Device);
2838 }
2839 
2840 //
2841 // WDF Function: WdfDeviceSetAlignmentRequirement
2842 //
2843 typedef
2844 _IRQL_requires_max_(DISPATCH_LEVEL)
2845 WDFAPI
2846 VOID
2847 (STDCALL *PFN_WDFDEVICESETALIGNMENTREQUIREMENT)(
2848     _In_
2849     PWDF_DRIVER_GLOBALS DriverGlobals,
2850     _In_
2851     WDFDEVICE Device,
2852     _In_
2853     ULONG AlignmentRequirement
2854     );
2855 
_IRQL_requires_max_(DISPATCH_LEVEL)2856 _IRQL_requires_max_(DISPATCH_LEVEL)
2857 FORCEINLINE
2858 VOID
2859 WdfDeviceSetAlignmentRequirement(
2860     _In_
2861     WDFDEVICE Device,
2862     _In_
2863     ULONG AlignmentRequirement
2864     )
2865 {
2866     ((PFN_WDFDEVICESETALIGNMENTREQUIREMENT) WdfFunctions[WdfDeviceSetAlignmentRequirementTableIndex])(WdfDriverGlobals, Device, AlignmentRequirement);
2867 }
2868 
2869 //
2870 // WDF Function: WdfDeviceInitFree
2871 //
2872 typedef
2873 _IRQL_requires_max_(DISPATCH_LEVEL)
2874 WDFAPI
2875 VOID
2876 (STDCALL *PFN_WDFDEVICEINITFREE)(
2877     _In_
2878     PWDF_DRIVER_GLOBALS DriverGlobals,
2879     _In_
2880     PWDFDEVICE_INIT DeviceInit
2881     );
2882 
_IRQL_requires_max_(DISPATCH_LEVEL)2883 _IRQL_requires_max_(DISPATCH_LEVEL)
2884 FORCEINLINE
2885 VOID
2886 WdfDeviceInitFree(
2887     _In_
2888     PWDFDEVICE_INIT DeviceInit
2889     )
2890 {
2891     ((PFN_WDFDEVICEINITFREE) WdfFunctions[WdfDeviceInitFreeTableIndex])(WdfDriverGlobals, DeviceInit);
2892 }
2893 
2894 //
2895 // WDF Function: WdfDeviceInitSetPnpPowerEventCallbacks
2896 //
2897 typedef
2898 _IRQL_requires_max_(DISPATCH_LEVEL)
2899 WDFAPI
2900 VOID
2901 (STDCALL *PFN_WDFDEVICEINITSETPNPPOWEREVENTCALLBACKS)(
2902     _In_
2903     PWDF_DRIVER_GLOBALS DriverGlobals,
2904     _In_
2905     PWDFDEVICE_INIT DeviceInit,
2906     _In_
2907     PWDF_PNPPOWER_EVENT_CALLBACKS PnpPowerEventCallbacks
2908     );
2909 
_IRQL_requires_max_(DISPATCH_LEVEL)2910 _IRQL_requires_max_(DISPATCH_LEVEL)
2911 FORCEINLINE
2912 VOID
2913 WdfDeviceInitSetPnpPowerEventCallbacks(
2914     _In_
2915     PWDFDEVICE_INIT DeviceInit,
2916     _In_
2917     PWDF_PNPPOWER_EVENT_CALLBACKS PnpPowerEventCallbacks
2918     )
2919 {
2920     ((PFN_WDFDEVICEINITSETPNPPOWEREVENTCALLBACKS) WdfFunctions[WdfDeviceInitSetPnpPowerEventCallbacksTableIndex])(WdfDriverGlobals, DeviceInit, PnpPowerEventCallbacks);
2921 }
2922 
2923 //
2924 // WDF Function: WdfDeviceInitSetPowerPolicyEventCallbacks
2925 //
2926 typedef
2927 _IRQL_requires_max_(DISPATCH_LEVEL)
2928 WDFAPI
2929 VOID
2930 (STDCALL *PFN_WDFDEVICEINITSETPOWERPOLICYEVENTCALLBACKS)(
2931     _In_
2932     PWDF_DRIVER_GLOBALS DriverGlobals,
2933     _In_
2934     PWDFDEVICE_INIT DeviceInit,
2935     _In_
2936     PWDF_POWER_POLICY_EVENT_CALLBACKS PowerPolicyEventCallbacks
2937     );
2938 
_IRQL_requires_max_(DISPATCH_LEVEL)2939 _IRQL_requires_max_(DISPATCH_LEVEL)
2940 FORCEINLINE
2941 VOID
2942 WdfDeviceInitSetPowerPolicyEventCallbacks(
2943     _In_
2944     PWDFDEVICE_INIT DeviceInit,
2945     _In_
2946     PWDF_POWER_POLICY_EVENT_CALLBACKS PowerPolicyEventCallbacks
2947     )
2948 {
2949     ((PFN_WDFDEVICEINITSETPOWERPOLICYEVENTCALLBACKS) WdfFunctions[WdfDeviceInitSetPowerPolicyEventCallbacksTableIndex])(WdfDriverGlobals, DeviceInit, PowerPolicyEventCallbacks);
2950 }
2951 
2952 //
2953 // WDF Function: WdfDeviceInitSetPowerPolicyOwnership
2954 //
2955 typedef
2956 _IRQL_requires_max_(DISPATCH_LEVEL)
2957 WDFAPI
2958 VOID
2959 (STDCALL *PFN_WDFDEVICEINITSETPOWERPOLICYOWNERSHIP)(
2960     _In_
2961     PWDF_DRIVER_GLOBALS DriverGlobals,
2962     _In_
2963     PWDFDEVICE_INIT DeviceInit,
2964     _In_
2965     BOOLEAN IsPowerPolicyOwner
2966     );
2967 
_IRQL_requires_max_(DISPATCH_LEVEL)2968 _IRQL_requires_max_(DISPATCH_LEVEL)
2969 FORCEINLINE
2970 VOID
2971 WdfDeviceInitSetPowerPolicyOwnership(
2972     _In_
2973     PWDFDEVICE_INIT DeviceInit,
2974     _In_
2975     BOOLEAN IsPowerPolicyOwner
2976     )
2977 {
2978     ((PFN_WDFDEVICEINITSETPOWERPOLICYOWNERSHIP) WdfFunctions[WdfDeviceInitSetPowerPolicyOwnershipTableIndex])(WdfDriverGlobals, DeviceInit, IsPowerPolicyOwner);
2979 }
2980 
2981 //
2982 // WDF Function: WdfDeviceInitRegisterPnpStateChangeCallback
2983 //
2984 typedef
2985 _Must_inspect_result_
2986 _IRQL_requires_max_(PASSIVE_LEVEL)
2987 WDFAPI
2988 NTSTATUS
2989 (STDCALL *PFN_WDFDEVICEINITREGISTERPNPSTATECHANGECALLBACK)(
2990     _In_
2991     PWDF_DRIVER_GLOBALS DriverGlobals,
2992     _In_
2993     PWDFDEVICE_INIT DeviceInit,
2994     _In_
2995     WDF_DEVICE_PNP_STATE PnpState,
2996     _In_
2997     PFN_WDF_DEVICE_PNP_STATE_CHANGE_NOTIFICATION EvtDevicePnpStateChange,
2998     _In_
2999     ULONG CallbackTypes
3000     );
3001 
3002 _Must_inspect_result_
_IRQL_requires_max_(PASSIVE_LEVEL)3003 _IRQL_requires_max_(PASSIVE_LEVEL)
3004 FORCEINLINE
3005 NTSTATUS
3006 WdfDeviceInitRegisterPnpStateChangeCallback(
3007     _In_
3008     PWDFDEVICE_INIT DeviceInit,
3009     _In_
3010     WDF_DEVICE_PNP_STATE PnpState,
3011     _In_
3012     PFN_WDF_DEVICE_PNP_STATE_CHANGE_NOTIFICATION EvtDevicePnpStateChange,
3013     _In_
3014     ULONG CallbackTypes
3015     )
3016 {
3017     return ((PFN_WDFDEVICEINITREGISTERPNPSTATECHANGECALLBACK) WdfFunctions[WdfDeviceInitRegisterPnpStateChangeCallbackTableIndex])(WdfDriverGlobals, DeviceInit, PnpState, EvtDevicePnpStateChange, CallbackTypes);
3018 }
3019 
3020 //
3021 // WDF Function: WdfDeviceInitRegisterPowerStateChangeCallback
3022 //
3023 typedef
3024 _Must_inspect_result_
3025 _IRQL_requires_max_(PASSIVE_LEVEL)
3026 WDFAPI
3027 NTSTATUS
3028 (STDCALL *PFN_WDFDEVICEINITREGISTERPOWERSTATECHANGECALLBACK)(
3029     _In_
3030     PWDF_DRIVER_GLOBALS DriverGlobals,
3031     _In_
3032     PWDFDEVICE_INIT DeviceInit,
3033     _In_
3034     WDF_DEVICE_POWER_STATE PowerState,
3035     _In_
3036     PFN_WDF_DEVICE_POWER_STATE_CHANGE_NOTIFICATION EvtDevicePowerStateChange,
3037     _In_
3038     ULONG CallbackTypes
3039     );
3040 
3041 _Must_inspect_result_
_IRQL_requires_max_(PASSIVE_LEVEL)3042 _IRQL_requires_max_(PASSIVE_LEVEL)
3043 FORCEINLINE
3044 NTSTATUS
3045 WdfDeviceInitRegisterPowerStateChangeCallback(
3046     _In_
3047     PWDFDEVICE_INIT DeviceInit,
3048     _In_
3049     WDF_DEVICE_POWER_STATE PowerState,
3050     _In_
3051     PFN_WDF_DEVICE_POWER_STATE_CHANGE_NOTIFICATION EvtDevicePowerStateChange,
3052     _In_
3053     ULONG CallbackTypes
3054     )
3055 {
3056     return ((PFN_WDFDEVICEINITREGISTERPOWERSTATECHANGECALLBACK) WdfFunctions[WdfDeviceInitRegisterPowerStateChangeCallbackTableIndex])(WdfDriverGlobals, DeviceInit, PowerState, EvtDevicePowerStateChange, CallbackTypes);
3057 }
3058 
3059 //
3060 // WDF Function: WdfDeviceInitRegisterPowerPolicyStateChangeCallback
3061 //
3062 typedef
3063 _Must_inspect_result_
3064 _IRQL_requires_max_(PASSIVE_LEVEL)
3065 WDFAPI
3066 NTSTATUS
3067 (STDCALL *PFN_WDFDEVICEINITREGISTERPOWERPOLICYSTATECHANGECALLBACK)(
3068     _In_
3069     PWDF_DRIVER_GLOBALS DriverGlobals,
3070     _In_
3071     PWDFDEVICE_INIT DeviceInit,
3072     _In_
3073     WDF_DEVICE_POWER_POLICY_STATE PowerPolicyState,
3074     _In_
3075     PFN_WDF_DEVICE_POWER_POLICY_STATE_CHANGE_NOTIFICATION EvtDevicePowerPolicyStateChange,
3076     _In_
3077     ULONG CallbackTypes
3078     );
3079 
3080 _Must_inspect_result_
_IRQL_requires_max_(PASSIVE_LEVEL)3081 _IRQL_requires_max_(PASSIVE_LEVEL)
3082 FORCEINLINE
3083 NTSTATUS
3084 WdfDeviceInitRegisterPowerPolicyStateChangeCallback(
3085     _In_
3086     PWDFDEVICE_INIT DeviceInit,
3087     _In_
3088     WDF_DEVICE_POWER_POLICY_STATE PowerPolicyState,
3089     _In_
3090     PFN_WDF_DEVICE_POWER_POLICY_STATE_CHANGE_NOTIFICATION EvtDevicePowerPolicyStateChange,
3091     _In_
3092     ULONG CallbackTypes
3093     )
3094 {
3095     return ((PFN_WDFDEVICEINITREGISTERPOWERPOLICYSTATECHANGECALLBACK) WdfFunctions[WdfDeviceInitRegisterPowerPolicyStateChangeCallbackTableIndex])(WdfDriverGlobals, DeviceInit, PowerPolicyState, EvtDevicePowerPolicyStateChange, CallbackTypes);
3096 }
3097 
3098 //
3099 // WDF Function: WdfDeviceInitSetExclusive
3100 //
3101 typedef
3102 _IRQL_requires_max_(DISPATCH_LEVEL)
3103 WDFAPI
3104 VOID
3105 (STDCALL *PFN_WDFDEVICEINITSETEXCLUSIVE)(
3106     _In_
3107     PWDF_DRIVER_GLOBALS DriverGlobals,
3108     _In_
3109     PWDFDEVICE_INIT DeviceInit,
3110     _In_
3111     BOOLEAN IsExclusive
3112     );
3113 
_IRQL_requires_max_(DISPATCH_LEVEL)3114 _IRQL_requires_max_(DISPATCH_LEVEL)
3115 FORCEINLINE
3116 VOID
3117 WdfDeviceInitSetExclusive(
3118     _In_
3119     PWDFDEVICE_INIT DeviceInit,
3120     _In_
3121     BOOLEAN IsExclusive
3122     )
3123 {
3124     ((PFN_WDFDEVICEINITSETEXCLUSIVE) WdfFunctions[WdfDeviceInitSetExclusiveTableIndex])(WdfDriverGlobals, DeviceInit, IsExclusive);
3125 }
3126 
3127 //
3128 // WDF Function: WdfDeviceInitSetIoType
3129 //
3130 typedef
3131 _IRQL_requires_max_(DISPATCH_LEVEL)
3132 WDFAPI
3133 VOID
3134 (STDCALL *PFN_WDFDEVICEINITSETIOTYPE)(
3135     _In_
3136     PWDF_DRIVER_GLOBALS DriverGlobals,
3137     _In_
3138     PWDFDEVICE_INIT DeviceInit,
3139     _In_
3140     WDF_DEVICE_IO_TYPE IoType
3141     );
3142 
_IRQL_requires_max_(DISPATCH_LEVEL)3143 _IRQL_requires_max_(DISPATCH_LEVEL)
3144 FORCEINLINE
3145 VOID
3146 WdfDeviceInitSetIoType(
3147     _In_
3148     PWDFDEVICE_INIT DeviceInit,
3149     _In_
3150     WDF_DEVICE_IO_TYPE IoType
3151     )
3152 {
3153     ((PFN_WDFDEVICEINITSETIOTYPE) WdfFunctions[WdfDeviceInitSetIoTypeTableIndex])(WdfDriverGlobals, DeviceInit, IoType);
3154 }
3155 
3156 //
3157 // WDF Function: WdfDeviceInitSetPowerNotPageable
3158 //
3159 typedef
3160 _IRQL_requires_max_(DISPATCH_LEVEL)
3161 WDFAPI
3162 VOID
3163 (STDCALL *PFN_WDFDEVICEINITSETPOWERNOTPAGEABLE)(
3164     _In_
3165     PWDF_DRIVER_GLOBALS DriverGlobals,
3166     _In_
3167     PWDFDEVICE_INIT DeviceInit
3168     );
3169 
_IRQL_requires_max_(DISPATCH_LEVEL)3170 _IRQL_requires_max_(DISPATCH_LEVEL)
3171 FORCEINLINE
3172 VOID
3173 WdfDeviceInitSetPowerNotPageable(
3174     _In_
3175     PWDFDEVICE_INIT DeviceInit
3176     )
3177 {
3178     ((PFN_WDFDEVICEINITSETPOWERNOTPAGEABLE) WdfFunctions[WdfDeviceInitSetPowerNotPageableTableIndex])(WdfDriverGlobals, DeviceInit);
3179 }
3180 
3181 //
3182 // WDF Function: WdfDeviceInitSetPowerPageable
3183 //
3184 typedef
3185 _IRQL_requires_max_(DISPATCH_LEVEL)
3186 WDFAPI
3187 VOID
3188 (STDCALL *PFN_WDFDEVICEINITSETPOWERPAGEABLE)(
3189     _In_
3190     PWDF_DRIVER_GLOBALS DriverGlobals,
3191     _In_
3192     PWDFDEVICE_INIT DeviceInit
3193     );
3194 
_IRQL_requires_max_(DISPATCH_LEVEL)3195 _IRQL_requires_max_(DISPATCH_LEVEL)
3196 FORCEINLINE
3197 VOID
3198 WdfDeviceInitSetPowerPageable(
3199     _In_
3200     PWDFDEVICE_INIT DeviceInit
3201     )
3202 {
3203     ((PFN_WDFDEVICEINITSETPOWERPAGEABLE) WdfFunctions[WdfDeviceInitSetPowerPageableTableIndex])(WdfDriverGlobals, DeviceInit);
3204 }
3205 
3206 //
3207 // WDF Function: WdfDeviceInitSetPowerInrush
3208 //
3209 typedef
3210 _IRQL_requires_max_(DISPATCH_LEVEL)
3211 WDFAPI
3212 VOID
3213 (STDCALL *PFN_WDFDEVICEINITSETPOWERINRUSH)(
3214     _In_
3215     PWDF_DRIVER_GLOBALS DriverGlobals,
3216     _In_
3217     PWDFDEVICE_INIT DeviceInit
3218     );
3219 
_IRQL_requires_max_(DISPATCH_LEVEL)3220 _IRQL_requires_max_(DISPATCH_LEVEL)
3221 FORCEINLINE
3222 VOID
3223 WdfDeviceInitSetPowerInrush(
3224     _In_
3225     PWDFDEVICE_INIT DeviceInit
3226     )
3227 {
3228     ((PFN_WDFDEVICEINITSETPOWERINRUSH) WdfFunctions[WdfDeviceInitSetPowerInrushTableIndex])(WdfDriverGlobals, DeviceInit);
3229 }
3230 
3231 //
3232 // WDF Function: WdfDeviceInitSetDeviceType
3233 //
3234 typedef
3235 _IRQL_requires_max_(DISPATCH_LEVEL)
3236 WDFAPI
3237 VOID
3238 (STDCALL *PFN_WDFDEVICEINITSETDEVICETYPE)(
3239     _In_
3240     PWDF_DRIVER_GLOBALS DriverGlobals,
3241     _In_
3242     PWDFDEVICE_INIT DeviceInit,
3243     _In_
3244     DEVICE_TYPE DeviceType
3245     );
3246 
_IRQL_requires_max_(DISPATCH_LEVEL)3247 _IRQL_requires_max_(DISPATCH_LEVEL)
3248 FORCEINLINE
3249 VOID
3250 WdfDeviceInitSetDeviceType(
3251     _In_
3252     PWDFDEVICE_INIT DeviceInit,
3253     _In_
3254     DEVICE_TYPE DeviceType
3255     )
3256 {
3257     ((PFN_WDFDEVICEINITSETDEVICETYPE) WdfFunctions[WdfDeviceInitSetDeviceTypeTableIndex])(WdfDriverGlobals, DeviceInit, DeviceType);
3258 }
3259 
3260 //
3261 // WDF Function: WdfDeviceInitAssignName
3262 //
3263 typedef
3264 _Must_inspect_result_
3265 _IRQL_requires_max_(PASSIVE_LEVEL)
3266 WDFAPI
3267 NTSTATUS
3268 (STDCALL *PFN_WDFDEVICEINITASSIGNNAME)(
3269     _In_
3270     PWDF_DRIVER_GLOBALS DriverGlobals,
3271     _In_
3272     PWDFDEVICE_INIT DeviceInit,
3273     _In_opt_
3274     PCUNICODE_STRING DeviceName
3275     );
3276 
3277 _Must_inspect_result_
_IRQL_requires_max_(PASSIVE_LEVEL)3278 _IRQL_requires_max_(PASSIVE_LEVEL)
3279 FORCEINLINE
3280 NTSTATUS
3281 WdfDeviceInitAssignName(
3282     _In_
3283     PWDFDEVICE_INIT DeviceInit,
3284     _In_opt_
3285     PCUNICODE_STRING DeviceName
3286     )
3287 {
3288     return ((PFN_WDFDEVICEINITASSIGNNAME) WdfFunctions[WdfDeviceInitAssignNameTableIndex])(WdfDriverGlobals, DeviceInit, DeviceName);
3289 }
3290 
3291 //
3292 // WDF Function: WdfDeviceInitAssignSDDLString
3293 //
3294 typedef
3295 _Must_inspect_result_
3296 _IRQL_requires_max_(PASSIVE_LEVEL)
3297 WDFAPI
3298 NTSTATUS
3299 (STDCALL *PFN_WDFDEVICEINITASSIGNSDDLSTRING)(
3300     _In_
3301     PWDF_DRIVER_GLOBALS DriverGlobals,
3302     _In_
3303     PWDFDEVICE_INIT DeviceInit,
3304     _In_opt_
3305     PCUNICODE_STRING SDDLString
3306     );
3307 
3308 _Must_inspect_result_
_IRQL_requires_max_(PASSIVE_LEVEL)3309 _IRQL_requires_max_(PASSIVE_LEVEL)
3310 FORCEINLINE
3311 NTSTATUS
3312 WdfDeviceInitAssignSDDLString(
3313     _In_
3314     PWDFDEVICE_INIT DeviceInit,
3315     _In_opt_
3316     PCUNICODE_STRING SDDLString
3317     )
3318 {
3319     return ((PFN_WDFDEVICEINITASSIGNSDDLSTRING) WdfFunctions[WdfDeviceInitAssignSDDLStringTableIndex])(WdfDriverGlobals, DeviceInit, SDDLString);
3320 }
3321 
3322 //
3323 // WDF Function: WdfDeviceInitSetDeviceClass
3324 //
3325 typedef
3326 _IRQL_requires_max_(DISPATCH_LEVEL)
3327 WDFAPI
3328 VOID
3329 (STDCALL *PFN_WDFDEVICEINITSETDEVICECLASS)(
3330     _In_
3331     PWDF_DRIVER_GLOBALS DriverGlobals,
3332     _In_
3333     PWDFDEVICE_INIT DeviceInit,
3334     _In_
3335     CONST GUID* DeviceClassGuid
3336     );
3337 
_IRQL_requires_max_(DISPATCH_LEVEL)3338 _IRQL_requires_max_(DISPATCH_LEVEL)
3339 FORCEINLINE
3340 VOID
3341 WdfDeviceInitSetDeviceClass(
3342     _In_
3343     PWDFDEVICE_INIT DeviceInit,
3344     _In_
3345     CONST GUID* DeviceClassGuid
3346     )
3347 {
3348     ((PFN_WDFDEVICEINITSETDEVICECLASS) WdfFunctions[WdfDeviceInitSetDeviceClassTableIndex])(WdfDriverGlobals, DeviceInit, DeviceClassGuid);
3349 }
3350 
3351 //
3352 // WDF Function: WdfDeviceInitSetCharacteristics
3353 //
3354 typedef
3355 _IRQL_requires_max_(DISPATCH_LEVEL)
3356 WDFAPI
3357 VOID
3358 (STDCALL *PFN_WDFDEVICEINITSETCHARACTERISTICS)(
3359     _In_
3360     PWDF_DRIVER_GLOBALS DriverGlobals,
3361     _In_
3362     PWDFDEVICE_INIT DeviceInit,
3363     _In_
3364     ULONG DeviceCharacteristics,
3365     _In_
3366     BOOLEAN OrInValues
3367     );
3368 
_IRQL_requires_max_(DISPATCH_LEVEL)3369 _IRQL_requires_max_(DISPATCH_LEVEL)
3370 FORCEINLINE
3371 VOID
3372 WdfDeviceInitSetCharacteristics(
3373     _In_
3374     PWDFDEVICE_INIT DeviceInit,
3375     _In_
3376     ULONG DeviceCharacteristics,
3377     _In_
3378     BOOLEAN OrInValues
3379     )
3380 {
3381     ((PFN_WDFDEVICEINITSETCHARACTERISTICS) WdfFunctions[WdfDeviceInitSetCharacteristicsTableIndex])(WdfDriverGlobals, DeviceInit, DeviceCharacteristics, OrInValues);
3382 }
3383 
3384 //
3385 // WDF Function: WdfDeviceInitSetFileObjectConfig
3386 //
3387 typedef
3388 _IRQL_requires_max_(DISPATCH_LEVEL)
3389 WDFAPI
3390 VOID
3391 (STDCALL *PFN_WDFDEVICEINITSETFILEOBJECTCONFIG)(
3392     _In_
3393     PWDF_DRIVER_GLOBALS DriverGlobals,
3394     _In_
3395     PWDFDEVICE_INIT DeviceInit,
3396     _In_
3397     PWDF_FILEOBJECT_CONFIG FileObjectConfig,
3398     _In_opt_
3399     PWDF_OBJECT_ATTRIBUTES FileObjectAttributes
3400     );
3401 
_IRQL_requires_max_(DISPATCH_LEVEL)3402 _IRQL_requires_max_(DISPATCH_LEVEL)
3403 FORCEINLINE
3404 VOID
3405 WdfDeviceInitSetFileObjectConfig(
3406     _In_
3407     PWDFDEVICE_INIT DeviceInit,
3408     _In_
3409     PWDF_FILEOBJECT_CONFIG FileObjectConfig,
3410     _In_opt_
3411     PWDF_OBJECT_ATTRIBUTES FileObjectAttributes
3412     )
3413 {
3414     ((PFN_WDFDEVICEINITSETFILEOBJECTCONFIG) WdfFunctions[WdfDeviceInitSetFileObjectConfigTableIndex])(WdfDriverGlobals, DeviceInit, FileObjectConfig, FileObjectAttributes);
3415 }
3416 
3417 //
3418 // WDF Function: WdfDeviceInitSetRequestAttributes
3419 //
3420 typedef
3421 _IRQL_requires_max_(DISPATCH_LEVEL)
3422 WDFAPI
3423 VOID
3424 (STDCALL *PFN_WDFDEVICEINITSETREQUESTATTRIBUTES)(
3425     _In_
3426     PWDF_DRIVER_GLOBALS DriverGlobals,
3427     _In_
3428     PWDFDEVICE_INIT DeviceInit,
3429     _In_
3430     PWDF_OBJECT_ATTRIBUTES RequestAttributes
3431     );
3432 
_IRQL_requires_max_(DISPATCH_LEVEL)3433 _IRQL_requires_max_(DISPATCH_LEVEL)
3434 FORCEINLINE
3435 VOID
3436 WdfDeviceInitSetRequestAttributes(
3437     _In_
3438     PWDFDEVICE_INIT DeviceInit,
3439     _In_
3440     PWDF_OBJECT_ATTRIBUTES RequestAttributes
3441     )
3442 {
3443     ((PFN_WDFDEVICEINITSETREQUESTATTRIBUTES) WdfFunctions[WdfDeviceInitSetRequestAttributesTableIndex])(WdfDriverGlobals, DeviceInit, RequestAttributes);
3444 }
3445 
3446 //
3447 // WDF Function: WdfDeviceInitAssignWdmIrpPreprocessCallback
3448 //
3449 typedef
3450 _Must_inspect_result_
3451 _IRQL_requires_max_(DISPATCH_LEVEL)
3452 WDFAPI
3453 NTSTATUS
3454 (STDCALL *PFN_WDFDEVICEINITASSIGNWDMIRPPREPROCESSCALLBACK)(
3455     _In_
3456     PWDF_DRIVER_GLOBALS DriverGlobals,
3457     _In_
3458     PWDFDEVICE_INIT DeviceInit,
3459     _In_
3460     PFN_WDFDEVICE_WDM_IRP_PREPROCESS EvtDeviceWdmIrpPreprocess,
3461     _In_
3462     UCHAR MajorFunction,
3463     _When_(NumMinorFunctions > 0, _In_reads_bytes_(NumMinorFunctions))
3464     _When_(NumMinorFunctions == 0, _In_opt_)
3465     PUCHAR MinorFunctions,
3466     _In_
3467     ULONG NumMinorFunctions
3468     );
3469 
3470 _Must_inspect_result_
_IRQL_requires_max_(DISPATCH_LEVEL)3471 _IRQL_requires_max_(DISPATCH_LEVEL)
3472 FORCEINLINE
3473 NTSTATUS
3474 WdfDeviceInitAssignWdmIrpPreprocessCallback(
3475     _In_
3476     PWDFDEVICE_INIT DeviceInit,
3477     _In_
3478     PFN_WDFDEVICE_WDM_IRP_PREPROCESS EvtDeviceWdmIrpPreprocess,
3479     _In_
3480     UCHAR MajorFunction,
3481     _When_(NumMinorFunctions > 0, _In_reads_bytes_(NumMinorFunctions))
3482     _When_(NumMinorFunctions == 0, _In_opt_)
3483     PUCHAR MinorFunctions,
3484     _In_
3485     ULONG NumMinorFunctions
3486     )
3487 {
3488     return ((PFN_WDFDEVICEINITASSIGNWDMIRPPREPROCESSCALLBACK) WdfFunctions[WdfDeviceInitAssignWdmIrpPreprocessCallbackTableIndex])(WdfDriverGlobals, DeviceInit, EvtDeviceWdmIrpPreprocess, MajorFunction, MinorFunctions, NumMinorFunctions);
3489 }
3490 
3491 //
3492 // WDF Function: WdfDeviceInitSetIoInCallerContextCallback
3493 //
3494 typedef
3495 _IRQL_requires_max_(DISPATCH_LEVEL)
3496 WDFAPI
3497 VOID
3498 (STDCALL *PFN_WDFDEVICEINITSETIOINCALLERCONTEXTCALLBACK)(
3499     _In_
3500     PWDF_DRIVER_GLOBALS DriverGlobals,
3501     _In_
3502     PWDFDEVICE_INIT DeviceInit,
3503     _In_
3504     PFN_WDF_IO_IN_CALLER_CONTEXT EvtIoInCallerContext
3505     );
3506 
_IRQL_requires_max_(DISPATCH_LEVEL)3507 _IRQL_requires_max_(DISPATCH_LEVEL)
3508 FORCEINLINE
3509 VOID
3510 WdfDeviceInitSetIoInCallerContextCallback(
3511     _In_
3512     PWDFDEVICE_INIT DeviceInit,
3513     _In_
3514     PFN_WDF_IO_IN_CALLER_CONTEXT EvtIoInCallerContext
3515     )
3516 {
3517     ((PFN_WDFDEVICEINITSETIOINCALLERCONTEXTCALLBACK) WdfFunctions[WdfDeviceInitSetIoInCallerContextCallbackTableIndex])(WdfDriverGlobals, DeviceInit, EvtIoInCallerContext);
3518 }
3519 
3520 //
3521 // WDF Function: WdfDeviceInitSetRemoveLockOptions
3522 //
3523 typedef
3524 _IRQL_requires_max_(DISPATCH_LEVEL)
3525 WDFAPI
3526 VOID
3527 (STDCALL *PFN_WDFDEVICEINITSETREMOVELOCKOPTIONS)(
3528     _In_
3529     PWDF_DRIVER_GLOBALS DriverGlobals,
3530     _In_
3531     PWDFDEVICE_INIT DeviceInit,
3532     _In_
3533     PWDF_REMOVE_LOCK_OPTIONS Options
3534     );
3535 
_IRQL_requires_max_(DISPATCH_LEVEL)3536 _IRQL_requires_max_(DISPATCH_LEVEL)
3537 FORCEINLINE
3538 VOID
3539 WdfDeviceInitSetRemoveLockOptions(
3540     _In_
3541     PWDFDEVICE_INIT DeviceInit,
3542     _In_
3543     PWDF_REMOVE_LOCK_OPTIONS Options
3544     )
3545 {
3546     ((PFN_WDFDEVICEINITSETREMOVELOCKOPTIONS) WdfFunctions[WdfDeviceInitSetRemoveLockOptionsTableIndex])(WdfDriverGlobals, DeviceInit, Options);
3547 }
3548 
3549 //
3550 // WDF Function: WdfDeviceCreate
3551 //
3552 typedef
3553 _Must_inspect_result_
3554 _IRQL_requires_max_(PASSIVE_LEVEL)
3555 WDFAPI
3556 NTSTATUS
3557 (STDCALL *PFN_WDFDEVICECREATE)(
3558     _In_
3559     PWDF_DRIVER_GLOBALS DriverGlobals,
3560     _Inout_
3561     PWDFDEVICE_INIT* DeviceInit,
3562     _In_opt_
3563     PWDF_OBJECT_ATTRIBUTES DeviceAttributes,
3564     _Out_
3565     WDFDEVICE* Device
3566     );
3567 
3568 _Must_inspect_result_
_IRQL_requires_max_(PASSIVE_LEVEL)3569 _IRQL_requires_max_(PASSIVE_LEVEL)
3570 FORCEINLINE
3571 NTSTATUS
3572 WdfDeviceCreate(
3573     _Inout_
3574     PWDFDEVICE_INIT* DeviceInit,
3575     _In_opt_
3576     PWDF_OBJECT_ATTRIBUTES DeviceAttributes,
3577     _Out_
3578     WDFDEVICE* Device
3579     )
3580 {
3581     return ((PFN_WDFDEVICECREATE) WdfFunctions[WdfDeviceCreateTableIndex])(WdfDriverGlobals, DeviceInit, DeviceAttributes, Device);
3582 }
3583 
3584 //
3585 // WDF Function: WdfDeviceSetStaticStopRemove
3586 //
3587 typedef
3588 _IRQL_requires_max_(DISPATCH_LEVEL)
3589 WDFAPI
3590 VOID
3591 (STDCALL *PFN_WDFDEVICESETSTATICSTOPREMOVE)(
3592     _In_
3593     PWDF_DRIVER_GLOBALS DriverGlobals,
3594     _In_
3595     WDFDEVICE Device,
3596     _In_
3597     BOOLEAN Stoppable
3598     );
3599 
_IRQL_requires_max_(DISPATCH_LEVEL)3600 _IRQL_requires_max_(DISPATCH_LEVEL)
3601 FORCEINLINE
3602 VOID
3603 WdfDeviceSetStaticStopRemove(
3604     _In_
3605     WDFDEVICE Device,
3606     _In_
3607     BOOLEAN Stoppable
3608     )
3609 {
3610     ((PFN_WDFDEVICESETSTATICSTOPREMOVE) WdfFunctions[WdfDeviceSetStaticStopRemoveTableIndex])(WdfDriverGlobals, Device, Stoppable);
3611 }
3612 
3613 //
3614 // WDF Function: WdfDeviceCreateDeviceInterface
3615 //
3616 typedef
3617 _Must_inspect_result_
3618 _IRQL_requires_max_(PASSIVE_LEVEL)
3619 WDFAPI
3620 NTSTATUS
3621 (STDCALL *PFN_WDFDEVICECREATEDEVICEINTERFACE)(
3622     _In_
3623     PWDF_DRIVER_GLOBALS DriverGlobals,
3624     _In_
3625     WDFDEVICE Device,
3626     _In_
3627     CONST GUID* InterfaceClassGUID,
3628     _In_opt_
3629     PCUNICODE_STRING ReferenceString
3630     );
3631 
3632 _Must_inspect_result_
_IRQL_requires_max_(PASSIVE_LEVEL)3633 _IRQL_requires_max_(PASSIVE_LEVEL)
3634 FORCEINLINE
3635 NTSTATUS
3636 WdfDeviceCreateDeviceInterface(
3637     _In_
3638     WDFDEVICE Device,
3639     _In_
3640     CONST GUID* InterfaceClassGUID,
3641     _In_opt_
3642     PCUNICODE_STRING ReferenceString
3643     )
3644 {
3645     return ((PFN_WDFDEVICECREATEDEVICEINTERFACE) WdfFunctions[WdfDeviceCreateDeviceInterfaceTableIndex])(WdfDriverGlobals, Device, InterfaceClassGUID, ReferenceString);
3646 }
3647 
3648 //
3649 // WDF Function: WdfDeviceSetDeviceInterfaceState
3650 //
3651 typedef
3652 _IRQL_requires_max_(PASSIVE_LEVEL)
3653 WDFAPI
3654 VOID
3655 (STDCALL *PFN_WDFDEVICESETDEVICEINTERFACESTATE)(
3656     _In_
3657     PWDF_DRIVER_GLOBALS DriverGlobals,
3658     _In_
3659     WDFDEVICE Device,
3660     _In_
3661     CONST GUID* InterfaceClassGUID,
3662     _In_opt_
3663     PCUNICODE_STRING ReferenceString,
3664     _In_
3665     BOOLEAN IsInterfaceEnabled
3666     );
3667 
_IRQL_requires_max_(PASSIVE_LEVEL)3668 _IRQL_requires_max_(PASSIVE_LEVEL)
3669 FORCEINLINE
3670 VOID
3671 WdfDeviceSetDeviceInterfaceState(
3672     _In_
3673     WDFDEVICE Device,
3674     _In_
3675     CONST GUID* InterfaceClassGUID,
3676     _In_opt_
3677     PCUNICODE_STRING ReferenceString,
3678     _In_
3679     BOOLEAN IsInterfaceEnabled
3680     )
3681 {
3682     ((PFN_WDFDEVICESETDEVICEINTERFACESTATE) WdfFunctions[WdfDeviceSetDeviceInterfaceStateTableIndex])(WdfDriverGlobals, Device, InterfaceClassGUID, ReferenceString, IsInterfaceEnabled);
3683 }
3684 
3685 //
3686 // WDF Function: WdfDeviceRetrieveDeviceInterfaceString
3687 //
3688 typedef
3689 _Must_inspect_result_
3690 _IRQL_requires_max_(PASSIVE_LEVEL)
3691 WDFAPI
3692 NTSTATUS
3693 (STDCALL *PFN_WDFDEVICERETRIEVEDEVICEINTERFACESTRING)(
3694     _In_
3695     PWDF_DRIVER_GLOBALS DriverGlobals,
3696     _In_
3697     WDFDEVICE Device,
3698     _In_
3699     CONST GUID* InterfaceClassGUID,
3700     _In_opt_
3701     PCUNICODE_STRING ReferenceString,
3702     _In_
3703     WDFSTRING String
3704     );
3705 
3706 _Must_inspect_result_
_IRQL_requires_max_(PASSIVE_LEVEL)3707 _IRQL_requires_max_(PASSIVE_LEVEL)
3708 FORCEINLINE
3709 NTSTATUS
3710 WdfDeviceRetrieveDeviceInterfaceString(
3711     _In_
3712     WDFDEVICE Device,
3713     _In_
3714     CONST GUID* InterfaceClassGUID,
3715     _In_opt_
3716     PCUNICODE_STRING ReferenceString,
3717     _In_
3718     WDFSTRING String
3719     )
3720 {
3721     return ((PFN_WDFDEVICERETRIEVEDEVICEINTERFACESTRING) WdfFunctions[WdfDeviceRetrieveDeviceInterfaceStringTableIndex])(WdfDriverGlobals, Device, InterfaceClassGUID, ReferenceString, String);
3722 }
3723 
3724 //
3725 // WDF Function: WdfDeviceCreateSymbolicLink
3726 //
3727 typedef
3728 _Must_inspect_result_
3729 _IRQL_requires_max_(PASSIVE_LEVEL)
3730 WDFAPI
3731 NTSTATUS
3732 (STDCALL *PFN_WDFDEVICECREATESYMBOLICLINK)(
3733     _In_
3734     PWDF_DRIVER_GLOBALS DriverGlobals,
3735     _In_
3736     WDFDEVICE Device,
3737     _In_
3738     PCUNICODE_STRING SymbolicLinkName
3739     );
3740 
3741 _Must_inspect_result_
_IRQL_requires_max_(PASSIVE_LEVEL)3742 _IRQL_requires_max_(PASSIVE_LEVEL)
3743 FORCEINLINE
3744 NTSTATUS
3745 WdfDeviceCreateSymbolicLink(
3746     _In_
3747     WDFDEVICE Device,
3748     _In_
3749     PCUNICODE_STRING SymbolicLinkName
3750     )
3751 {
3752     return ((PFN_WDFDEVICECREATESYMBOLICLINK) WdfFunctions[WdfDeviceCreateSymbolicLinkTableIndex])(WdfDriverGlobals, Device, SymbolicLinkName);
3753 }
3754 
3755 //
3756 // WDF Function: WdfDeviceQueryProperty
3757 //
3758 typedef
3759 _Must_inspect_result_
3760 _IRQL_requires_max_(PASSIVE_LEVEL)
3761 WDFAPI
3762 NTSTATUS
3763 (STDCALL *PFN_WDFDEVICEQUERYPROPERTY)(
3764     _In_
3765     PWDF_DRIVER_GLOBALS DriverGlobals,
3766     _In_
3767     WDFDEVICE Device,
3768     _In_
3769     DEVICE_REGISTRY_PROPERTY DeviceProperty,
3770     _In_
3771     ULONG BufferLength,
3772     _Out_writes_bytes_all_(BufferLength)
3773     PVOID PropertyBuffer,
3774     _Out_
3775     PULONG ResultLength
3776     );
3777 
3778 _Must_inspect_result_
_IRQL_requires_max_(PASSIVE_LEVEL)3779 _IRQL_requires_max_(PASSIVE_LEVEL)
3780 FORCEINLINE
3781 NTSTATUS
3782 WdfDeviceQueryProperty(
3783     _In_
3784     WDFDEVICE Device,
3785     _In_
3786     DEVICE_REGISTRY_PROPERTY DeviceProperty,
3787     _In_
3788     ULONG BufferLength,
3789     _Out_writes_bytes_all_(BufferLength)
3790     PVOID PropertyBuffer,
3791     _Out_
3792     PULONG ResultLength
3793     )
3794 {
3795     return ((PFN_WDFDEVICEQUERYPROPERTY) WdfFunctions[WdfDeviceQueryPropertyTableIndex])(WdfDriverGlobals, Device, DeviceProperty, BufferLength, PropertyBuffer, ResultLength);
3796 }
3797 
3798 //
3799 // WDF Function: WdfDeviceAllocAndQueryProperty
3800 //
3801 typedef
3802 _Must_inspect_result_
3803 _IRQL_requires_max_(PASSIVE_LEVEL)
3804 WDFAPI
3805 NTSTATUS
3806 (STDCALL *PFN_WDFDEVICEALLOCANDQUERYPROPERTY)(
3807     _In_
3808     PWDF_DRIVER_GLOBALS DriverGlobals,
3809     _In_
3810     WDFDEVICE Device,
3811     _In_
3812     DEVICE_REGISTRY_PROPERTY DeviceProperty,
3813     _In_
3814     _Strict_type_match_
3815     POOL_TYPE PoolType,
3816     _In_opt_
3817     PWDF_OBJECT_ATTRIBUTES PropertyMemoryAttributes,
3818     _Out_
3819     WDFMEMORY* PropertyMemory
3820     );
3821 
3822 _Must_inspect_result_
_IRQL_requires_max_(PASSIVE_LEVEL)3823 _IRQL_requires_max_(PASSIVE_LEVEL)
3824 FORCEINLINE
3825 NTSTATUS
3826 WdfDeviceAllocAndQueryProperty(
3827     _In_
3828     WDFDEVICE Device,
3829     _In_
3830     DEVICE_REGISTRY_PROPERTY DeviceProperty,
3831     _In_
3832     _Strict_type_match_
3833     POOL_TYPE PoolType,
3834     _In_opt_
3835     PWDF_OBJECT_ATTRIBUTES PropertyMemoryAttributes,
3836     _Out_
3837     WDFMEMORY* PropertyMemory
3838     )
3839 {
3840     return ((PFN_WDFDEVICEALLOCANDQUERYPROPERTY) WdfFunctions[WdfDeviceAllocAndQueryPropertyTableIndex])(WdfDriverGlobals, Device, DeviceProperty, PoolType, PropertyMemoryAttributes, PropertyMemory);
3841 }
3842 
3843 //
3844 // WDF Function: WdfDeviceSetPnpCapabilities
3845 //
3846 typedef
3847 _IRQL_requires_max_(DISPATCH_LEVEL)
3848 WDFAPI
3849 VOID
3850 (STDCALL *PFN_WDFDEVICESETPNPCAPABILITIES)(
3851     _In_
3852     PWDF_DRIVER_GLOBALS DriverGlobals,
3853     _In_
3854     WDFDEVICE Device,
3855     _In_
3856     PWDF_DEVICE_PNP_CAPABILITIES PnpCapabilities
3857     );
3858 
_IRQL_requires_max_(DISPATCH_LEVEL)3859 _IRQL_requires_max_(DISPATCH_LEVEL)
3860 FORCEINLINE
3861 VOID
3862 WdfDeviceSetPnpCapabilities(
3863     _In_
3864     WDFDEVICE Device,
3865     _In_
3866     PWDF_DEVICE_PNP_CAPABILITIES PnpCapabilities
3867     )
3868 {
3869     ((PFN_WDFDEVICESETPNPCAPABILITIES) WdfFunctions[WdfDeviceSetPnpCapabilitiesTableIndex])(WdfDriverGlobals, Device, PnpCapabilities);
3870 }
3871 
3872 //
3873 // WDF Function: WdfDeviceSetPowerCapabilities
3874 //
3875 typedef
3876 _IRQL_requires_max_(DISPATCH_LEVEL)
3877 WDFAPI
3878 VOID
3879 (STDCALL *PFN_WDFDEVICESETPOWERCAPABILITIES)(
3880     _In_
3881     PWDF_DRIVER_GLOBALS DriverGlobals,
3882     _In_
3883     WDFDEVICE Device,
3884     _In_
3885     PWDF_DEVICE_POWER_CAPABILITIES PowerCapabilities
3886     );
3887 
_IRQL_requires_max_(DISPATCH_LEVEL)3888 _IRQL_requires_max_(DISPATCH_LEVEL)
3889 FORCEINLINE
3890 VOID
3891 WdfDeviceSetPowerCapabilities(
3892     _In_
3893     WDFDEVICE Device,
3894     _In_
3895     PWDF_DEVICE_POWER_CAPABILITIES PowerCapabilities
3896     )
3897 {
3898     ((PFN_WDFDEVICESETPOWERCAPABILITIES) WdfFunctions[WdfDeviceSetPowerCapabilitiesTableIndex])(WdfDriverGlobals, Device, PowerCapabilities);
3899 }
3900 
3901 //
3902 // WDF Function: WdfDeviceSetBusInformationForChildren
3903 //
3904 typedef
3905 _IRQL_requires_max_(DISPATCH_LEVEL)
3906 WDFAPI
3907 VOID
3908 (STDCALL *PFN_WDFDEVICESETBUSINFORMATIONFORCHILDREN)(
3909     _In_
3910     PWDF_DRIVER_GLOBALS DriverGlobals,
3911     _In_
3912     WDFDEVICE Device,
3913     _In_
3914     PPNP_BUS_INFORMATION BusInformation
3915     );
3916 
_IRQL_requires_max_(DISPATCH_LEVEL)3917 _IRQL_requires_max_(DISPATCH_LEVEL)
3918 FORCEINLINE
3919 VOID
3920 WdfDeviceSetBusInformationForChildren(
3921     _In_
3922     WDFDEVICE Device,
3923     _In_
3924     PPNP_BUS_INFORMATION BusInformation
3925     )
3926 {
3927     ((PFN_WDFDEVICESETBUSINFORMATIONFORCHILDREN) WdfFunctions[WdfDeviceSetBusInformationForChildrenTableIndex])(WdfDriverGlobals, Device, BusInformation);
3928 }
3929 
3930 //
3931 // WDF Function: WdfDeviceIndicateWakeStatus
3932 //
3933 typedef
3934 _Must_inspect_result_
3935 _IRQL_requires_max_(DISPATCH_LEVEL)
3936 WDFAPI
3937 NTSTATUS
3938 (STDCALL *PFN_WDFDEVICEINDICATEWAKESTATUS)(
3939     _In_
3940     PWDF_DRIVER_GLOBALS DriverGlobals,
3941     _In_
3942     WDFDEVICE Device,
3943     _In_
3944     NTSTATUS WaitWakeStatus
3945     );
3946 
3947 _Must_inspect_result_
_IRQL_requires_max_(DISPATCH_LEVEL)3948 _IRQL_requires_max_(DISPATCH_LEVEL)
3949 FORCEINLINE
3950 NTSTATUS
3951 WdfDeviceIndicateWakeStatus(
3952     _In_
3953     WDFDEVICE Device,
3954     _In_
3955     NTSTATUS WaitWakeStatus
3956     )
3957 {
3958     return ((PFN_WDFDEVICEINDICATEWAKESTATUS) WdfFunctions[WdfDeviceIndicateWakeStatusTableIndex])(WdfDriverGlobals, Device, WaitWakeStatus);
3959 }
3960 
3961 //
3962 // WDF Function: WdfDeviceSetFailed
3963 //
3964 typedef
3965 _IRQL_requires_max_(DISPATCH_LEVEL)
3966 WDFAPI
3967 VOID
3968 (STDCALL *PFN_WDFDEVICESETFAILED)(
3969     _In_
3970     PWDF_DRIVER_GLOBALS DriverGlobals,
3971     _In_
3972     WDFDEVICE Device,
3973     _In_
3974     WDF_DEVICE_FAILED_ACTION FailedAction
3975     );
3976 
_IRQL_requires_max_(DISPATCH_LEVEL)3977 _IRQL_requires_max_(DISPATCH_LEVEL)
3978 FORCEINLINE
3979 VOID
3980 WdfDeviceSetFailed(
3981     _In_
3982     WDFDEVICE Device,
3983     _In_
3984     WDF_DEVICE_FAILED_ACTION FailedAction
3985     )
3986 {
3987     ((PFN_WDFDEVICESETFAILED) WdfFunctions[WdfDeviceSetFailedTableIndex])(WdfDriverGlobals, Device, FailedAction);
3988 }
3989 
3990 //
3991 // WDF Function: WdfDeviceStopIdleNoTrack
3992 //
3993 typedef
3994 _Must_inspect_result_
3995 _When_(WaitForD0 == 0, _IRQL_requires_max_(DISPATCH_LEVEL))
3996 _When_(WaitForD0 != 0, _IRQL_requires_max_(PASSIVE_LEVEL))
3997 WDFAPI
3998 NTSTATUS
3999 (STDCALL *PFN_WDFDEVICESTOPIDLENOTRACK)(
4000     _In_
4001     PWDF_DRIVER_GLOBALS DriverGlobals,
4002     _In_
4003     WDFDEVICE Device,
4004     _In_
4005     BOOLEAN WaitForD0
4006     );
4007 
4008 _Must_inspect_result_
4009 _When_(WaitForD0 == 0, _IRQL_requires_max_(DISPATCH_LEVEL))
4010 _When_(WaitForD0 != 0, _IRQL_requires_max_(PASSIVE_LEVEL))
4011 FORCEINLINE
4012 NTSTATUS
WdfDeviceStopIdleNoTrack(_In_ WDFDEVICE Device,_In_ BOOLEAN WaitForD0)4013 WdfDeviceStopIdleNoTrack(
4014     _In_
4015     WDFDEVICE Device,
4016     _In_
4017     BOOLEAN WaitForD0
4018     )
4019 {
4020     return ((PFN_WDFDEVICESTOPIDLENOTRACK) WdfFunctions[WdfDeviceStopIdleNoTrackTableIndex])(WdfDriverGlobals, Device, WaitForD0);
4021 }
4022 
4023 //
4024 // WDF Function: WdfDeviceResumeIdleNoTrack
4025 //
4026 typedef
4027 _IRQL_requires_max_(DISPATCH_LEVEL)
4028 WDFAPI
4029 VOID
4030 (STDCALL *PFN_WDFDEVICERESUMEIDLENOTRACK)(
4031     _In_
4032     PWDF_DRIVER_GLOBALS DriverGlobals,
4033     _In_
4034     WDFDEVICE Device
4035     );
4036 
_IRQL_requires_max_(DISPATCH_LEVEL)4037 _IRQL_requires_max_(DISPATCH_LEVEL)
4038 FORCEINLINE
4039 VOID
4040 WdfDeviceResumeIdleNoTrack(
4041     _In_
4042     WDFDEVICE Device
4043     )
4044 {
4045     ((PFN_WDFDEVICERESUMEIDLENOTRACK) WdfFunctions[WdfDeviceResumeIdleNoTrackTableIndex])(WdfDriverGlobals, Device);
4046 }
4047 
4048 //
4049 // WDF Function: WdfDeviceStopIdleActual
4050 //
4051 typedef
4052 _Must_inspect_result_
4053 _When_(WaitForD0 == 0, _IRQL_requires_max_(DISPATCH_LEVEL))
4054 _When_(WaitForD0 != 0, _IRQL_requires_max_(PASSIVE_LEVEL))
4055 WDFAPI
4056 NTSTATUS
4057 (STDCALL *PFN_WDFDEVICESTOPIDLEACTUAL)(
4058     _In_
4059     PWDF_DRIVER_GLOBALS DriverGlobals,
4060     _In_
4061     WDFDEVICE Device,
4062     _In_
4063     BOOLEAN WaitForD0,
4064     _In_opt_
4065     PVOID Tag,
4066     _In_
4067     LONG Line,
4068     _In_z_
4069     PCHAR File
4070     );
4071 
4072 _Must_inspect_result_
4073 _When_(WaitForD0 == 0, _IRQL_requires_max_(DISPATCH_LEVEL))
4074 _When_(WaitForD0 != 0, _IRQL_requires_max_(PASSIVE_LEVEL))
4075 FORCEINLINE
4076 NTSTATUS
WdfDeviceStopIdleActual(_In_ WDFDEVICE Device,_In_ BOOLEAN WaitForD0,_In_opt_ PVOID Tag,_In_ LONG Line,_In_z_ PCHAR File)4077 WdfDeviceStopIdleActual(
4078     _In_
4079     WDFDEVICE Device,
4080     _In_
4081     BOOLEAN WaitForD0,
4082     _In_opt_
4083     PVOID Tag,
4084     _In_
4085     LONG Line,
4086     _In_z_
4087     PCHAR File
4088     )
4089 {
4090     return ((PFN_WDFDEVICESTOPIDLEACTUAL) WdfFunctions[WdfDeviceStopIdleActualTableIndex])(WdfDriverGlobals, Device, WaitForD0, Tag, Line, File);
4091 }
4092 
4093 //
4094 // WDF Function: WdfDeviceResumeIdleActual
4095 //
4096 typedef
4097 _IRQL_requires_max_(DISPATCH_LEVEL)
4098 WDFAPI
4099 VOID
4100 (STDCALL *PFN_WDFDEVICERESUMEIDLEACTUAL)(
4101     _In_
4102     PWDF_DRIVER_GLOBALS DriverGlobals,
4103     _In_
4104     WDFDEVICE Device,
4105     _In_opt_
4106     PVOID Tag,
4107     _In_
4108     LONG Line,
4109     _In_z_
4110     PCHAR File
4111     );
4112 
_IRQL_requires_max_(DISPATCH_LEVEL)4113 _IRQL_requires_max_(DISPATCH_LEVEL)
4114 FORCEINLINE
4115 VOID
4116 WdfDeviceResumeIdleActual(
4117     _In_
4118     WDFDEVICE Device,
4119     _In_opt_
4120     PVOID Tag,
4121     _In_
4122     LONG Line,
4123     _In_z_
4124     PCHAR File
4125     )
4126 {
4127     ((PFN_WDFDEVICERESUMEIDLEACTUAL) WdfFunctions[WdfDeviceResumeIdleActualTableIndex])(WdfDriverGlobals, Device, Tag, Line, File);
4128 }
4129 
4130 //
4131 // WDF Function: WdfDeviceGetFileObject
4132 //
4133 typedef
4134 _IRQL_requires_max_(DISPATCH_LEVEL)
4135 WDFAPI
4136 WDFFILEOBJECT
4137 (STDCALL *PFN_WDFDEVICEGETFILEOBJECT)(
4138     _In_
4139     PWDF_DRIVER_GLOBALS DriverGlobals,
4140     _In_
4141     WDFDEVICE Device,
4142     _In_
4143     PFILE_OBJECT FileObject
4144     );
4145 
_IRQL_requires_max_(DISPATCH_LEVEL)4146 _IRQL_requires_max_(DISPATCH_LEVEL)
4147 FORCEINLINE
4148 WDFFILEOBJECT
4149 WdfDeviceGetFileObject(
4150     _In_
4151     WDFDEVICE Device,
4152     _In_
4153     PFILE_OBJECT FileObject
4154     )
4155 {
4156     return ((PFN_WDFDEVICEGETFILEOBJECT) WdfFunctions[WdfDeviceGetFileObjectTableIndex])(WdfDriverGlobals, Device, FileObject);
4157 }
4158 
4159 //
4160 // WDF Function: WdfDeviceEnqueueRequest
4161 //
4162 typedef
4163 _Must_inspect_result_
4164 _IRQL_requires_max_(DISPATCH_LEVEL)
4165 WDFAPI
4166 NTSTATUS
4167 (STDCALL *PFN_WDFDEVICEENQUEUEREQUEST)(
4168     _In_
4169     PWDF_DRIVER_GLOBALS DriverGlobals,
4170     _In_
4171     WDFDEVICE Device,
4172     _In_
4173     WDFREQUEST Request
4174     );
4175 
4176 _Must_inspect_result_
_IRQL_requires_max_(DISPATCH_LEVEL)4177 _IRQL_requires_max_(DISPATCH_LEVEL)
4178 FORCEINLINE
4179 NTSTATUS
4180 WdfDeviceEnqueueRequest(
4181     _In_
4182     WDFDEVICE Device,
4183     _In_
4184     WDFREQUEST Request
4185     )
4186 {
4187     return ((PFN_WDFDEVICEENQUEUEREQUEST) WdfFunctions[WdfDeviceEnqueueRequestTableIndex])(WdfDriverGlobals, Device, Request);
4188 }
4189 
4190 //
4191 // WDF Function: WdfDeviceGetDefaultQueue
4192 //
4193 typedef
4194 _IRQL_requires_max_(DISPATCH_LEVEL)
4195 WDFAPI
4196 WDFQUEUE
4197 (STDCALL *PFN_WDFDEVICEGETDEFAULTQUEUE)(
4198     _In_
4199     PWDF_DRIVER_GLOBALS DriverGlobals,
4200     _In_
4201     WDFDEVICE Device
4202     );
4203 
_IRQL_requires_max_(DISPATCH_LEVEL)4204 _IRQL_requires_max_(DISPATCH_LEVEL)
4205 FORCEINLINE
4206 WDFQUEUE
4207 WdfDeviceGetDefaultQueue(
4208     _In_
4209     WDFDEVICE Device
4210     )
4211 {
4212     return ((PFN_WDFDEVICEGETDEFAULTQUEUE) WdfFunctions[WdfDeviceGetDefaultQueueTableIndex])(WdfDriverGlobals, Device);
4213 }
4214 
4215 //
4216 // WDF Function: WdfDeviceConfigureRequestDispatching
4217 //
4218 typedef
4219 _Must_inspect_result_
4220 _IRQL_requires_max_(DISPATCH_LEVEL)
4221 WDFAPI
4222 NTSTATUS
4223 (STDCALL *PFN_WDFDEVICECONFIGUREREQUESTDISPATCHING)(
4224     _In_
4225     PWDF_DRIVER_GLOBALS DriverGlobals,
4226     _In_
4227     WDFDEVICE Device,
4228     _In_
4229     WDFQUEUE Queue,
4230     _In_
4231     _Strict_type_match_
4232     WDF_REQUEST_TYPE RequestType
4233     );
4234 
4235 _Must_inspect_result_
_IRQL_requires_max_(DISPATCH_LEVEL)4236 _IRQL_requires_max_(DISPATCH_LEVEL)
4237 FORCEINLINE
4238 NTSTATUS
4239 WdfDeviceConfigureRequestDispatching(
4240     _In_
4241     WDFDEVICE Device,
4242     _In_
4243     WDFQUEUE Queue,
4244     _In_
4245     _Strict_type_match_
4246     WDF_REQUEST_TYPE RequestType
4247     )
4248 {
4249     return ((PFN_WDFDEVICECONFIGUREREQUESTDISPATCHING) WdfFunctions[WdfDeviceConfigureRequestDispatchingTableIndex])(WdfDriverGlobals, Device, Queue, RequestType);
4250 }
4251 
4252 //
4253 // WDF Function: WdfDeviceConfigureWdmIrpDispatchCallback
4254 //
4255 typedef
4256 _Must_inspect_result_
4257 _IRQL_requires_max_(DISPATCH_LEVEL)
4258 WDFAPI
4259 NTSTATUS
4260 (STDCALL *PFN_WDFDEVICECONFIGUREWDMIRPDISPATCHCALLBACK)(
4261     _In_
4262     PWDF_DRIVER_GLOBALS DriverGlobals,
4263     _In_
4264     WDFDEVICE Device,
4265     _In_opt_
4266     WDFDRIVER Driver,
4267     _In_
4268     UCHAR MajorFunction,
4269     _In_
4270     PFN_WDFDEVICE_WDM_IRP_DISPATCH EvtDeviceWdmIrpDisptach,
4271     _In_opt_
4272     WDFCONTEXT DriverContext
4273     );
4274 
4275 _Must_inspect_result_
_IRQL_requires_max_(DISPATCH_LEVEL)4276 _IRQL_requires_max_(DISPATCH_LEVEL)
4277 FORCEINLINE
4278 NTSTATUS
4279 WdfDeviceConfigureWdmIrpDispatchCallback(
4280     _In_
4281     WDFDEVICE Device,
4282     _In_opt_
4283     WDFDRIVER Driver,
4284     _In_
4285     UCHAR MajorFunction,
4286     _In_
4287     PFN_WDFDEVICE_WDM_IRP_DISPATCH EvtDeviceWdmIrpDisptach,
4288     _In_opt_
4289     WDFCONTEXT DriverContext
4290     )
4291 {
4292     return ((PFN_WDFDEVICECONFIGUREWDMIRPDISPATCHCALLBACK) WdfFunctions[WdfDeviceConfigureWdmIrpDispatchCallbackTableIndex])(WdfDriverGlobals, Device, Driver, MajorFunction, EvtDeviceWdmIrpDisptach, DriverContext);
4293 }
4294 
4295 //
4296 // WDF Function: WdfDeviceGetSystemPowerAction
4297 //
4298 typedef
4299 _IRQL_requires_max_(DISPATCH_LEVEL)
4300 WDFAPI
4301 POWER_ACTION
4302 (STDCALL *PFN_WDFDEVICEGETSYSTEMPOWERACTION)(
4303     _In_
4304     PWDF_DRIVER_GLOBALS DriverGlobals,
4305     _In_
4306     WDFDEVICE Device
4307     );
4308 
_IRQL_requires_max_(DISPATCH_LEVEL)4309 _IRQL_requires_max_(DISPATCH_LEVEL)
4310 FORCEINLINE
4311 POWER_ACTION
4312 WdfDeviceGetSystemPowerAction(
4313     _In_
4314     WDFDEVICE Device
4315     )
4316 {
4317     return ((PFN_WDFDEVICEGETSYSTEMPOWERACTION) WdfFunctions[WdfDeviceGetSystemPowerActionTableIndex])(WdfDriverGlobals, Device);
4318 }
4319 
4320 //
4321 // WDF Function: WdfDeviceWdmAssignPowerFrameworkSettings
4322 //
4323 typedef
4324 _Must_inspect_result_
4325 _IRQL_requires_max_(PASSIVE_LEVEL)
4326 WDFAPI
4327 NTSTATUS
4328 (STDCALL *PFN_WDFDEVICEWDMASSIGNPOWERFRAMEWORKSETTINGS)(
4329     _In_
4330     PWDF_DRIVER_GLOBALS DriverGlobals,
4331     _In_
4332     WDFDEVICE Device,
4333     _In_
4334     PWDF_POWER_FRAMEWORK_SETTINGS PowerFrameworkSettings
4335     );
4336 
4337 _Must_inspect_result_
_IRQL_requires_max_(PASSIVE_LEVEL)4338 _IRQL_requires_max_(PASSIVE_LEVEL)
4339 FORCEINLINE
4340 NTSTATUS
4341 WdfDeviceWdmAssignPowerFrameworkSettings(
4342     _In_
4343     WDFDEVICE Device,
4344     _In_
4345     PWDF_POWER_FRAMEWORK_SETTINGS PowerFrameworkSettings
4346     )
4347 {
4348     return ((PFN_WDFDEVICEWDMASSIGNPOWERFRAMEWORKSETTINGS) WdfFunctions[WdfDeviceWdmAssignPowerFrameworkSettingsTableIndex])(WdfDriverGlobals, Device, PowerFrameworkSettings);
4349 }
4350 
4351 //
4352 // WDF Function: WdfDeviceInitSetReleaseHardwareOrderOnFailure
4353 //
4354 typedef
4355 _IRQL_requires_max_(DISPATCH_LEVEL)
4356 WDFAPI
4357 VOID
4358 (STDCALL *PFN_WDFDEVICEINITSETRELEASEHARDWAREORDERONFAILURE)(
4359     _In_
4360     PWDF_DRIVER_GLOBALS DriverGlobals,
4361     _In_
4362     PWDFDEVICE_INIT DeviceInit,
4363     _In_
4364     WDF_RELEASE_HARDWARE_ORDER_ON_FAILURE ReleaseHardwareOrderOnFailure
4365     );
4366 
_IRQL_requires_max_(DISPATCH_LEVEL)4367 _IRQL_requires_max_(DISPATCH_LEVEL)
4368 FORCEINLINE
4369 VOID
4370 WdfDeviceInitSetReleaseHardwareOrderOnFailure(
4371     _In_
4372     PWDFDEVICE_INIT DeviceInit,
4373     _In_
4374     WDF_RELEASE_HARDWARE_ORDER_ON_FAILURE ReleaseHardwareOrderOnFailure
4375     )
4376 {
4377     ((PFN_WDFDEVICEINITSETRELEASEHARDWAREORDERONFAILURE) WdfFunctions[WdfDeviceInitSetReleaseHardwareOrderOnFailureTableIndex])(WdfDriverGlobals, DeviceInit, ReleaseHardwareOrderOnFailure);
4378 }
4379 
4380 //
4381 // WDF Function: WdfDeviceInitSetIoTypeEx
4382 //
4383 typedef
4384 _IRQL_requires_max_(PASSIVE_LEVEL)
4385 WDFAPI
4386 VOID
4387 (STDCALL *PFN_WDFDEVICEINITSETIOTYPEEX)(
4388     _In_
4389     PWDF_DRIVER_GLOBALS DriverGlobals,
4390     _In_
4391     PWDFDEVICE_INIT DeviceInit,
4392     _In_
4393     PWDF_IO_TYPE_CONFIG IoTypeConfig
4394     );
4395 
_IRQL_requires_max_(PASSIVE_LEVEL)4396 _IRQL_requires_max_(PASSIVE_LEVEL)
4397 FORCEINLINE
4398 VOID
4399 WdfDeviceInitSetIoTypeEx(
4400     _In_
4401     PWDFDEVICE_INIT DeviceInit,
4402     _In_
4403     PWDF_IO_TYPE_CONFIG IoTypeConfig
4404     )
4405 {
4406     ((PFN_WDFDEVICEINITSETIOTYPEEX) WdfFunctions[WdfDeviceInitSetIoTypeExTableIndex])(WdfDriverGlobals, DeviceInit, IoTypeConfig);
4407 }
4408 
4409 
4410 
4411 
4412 
4413 
4414 
4415 
4416 
4417 
4418 
4419 //
4420 // WDF Function: WdfDeviceQueryPropertyEx
4421 //
4422 typedef
4423 _Must_inspect_result_
4424 _IRQL_requires_max_(APC_LEVEL)
4425 WDFAPI
4426 NTSTATUS
4427 (STDCALL *PFN_WDFDEVICEQUERYPROPERTYEX)(
4428     _In_
4429     PWDF_DRIVER_GLOBALS DriverGlobals,
4430     _In_
4431     WDFDEVICE Device,
4432     _In_
4433     PWDF_DEVICE_PROPERTY_DATA DeviceProperty,
4434     _In_
4435     ULONG BufferLength,
4436     _Out_
4437     PVOID PropertyBuffer,
4438     _Out_
4439     PULONG RequiredSize,
4440     _Out_
4441     PDEVPROPTYPE Type
4442     );
4443 
4444 _Must_inspect_result_
_IRQL_requires_max_(APC_LEVEL)4445 _IRQL_requires_max_(APC_LEVEL)
4446 FORCEINLINE
4447 NTSTATUS
4448 WdfDeviceQueryPropertyEx(
4449     _In_
4450     WDFDEVICE Device,
4451     _In_
4452     PWDF_DEVICE_PROPERTY_DATA DeviceProperty,
4453     _In_
4454     ULONG BufferLength,
4455     _Out_
4456     PVOID PropertyBuffer,
4457     _Out_
4458     PULONG RequiredSize,
4459     _Out_
4460     PDEVPROPTYPE Type
4461     )
4462 {
4463     return ((PFN_WDFDEVICEQUERYPROPERTYEX) WdfFunctions[WdfDeviceQueryPropertyExTableIndex])(WdfDriverGlobals, Device, DeviceProperty, BufferLength, PropertyBuffer, RequiredSize, Type);
4464 }
4465 
4466 //
4467 // WDF Function: WdfDeviceAllocAndQueryPropertyEx
4468 //
4469 typedef
4470 _Must_inspect_result_
4471 _IRQL_requires_max_(APC_LEVEL)
4472 WDFAPI
4473 NTSTATUS
4474 (STDCALL *PFN_WDFDEVICEALLOCANDQUERYPROPERTYEX)(
4475     _In_
4476     PWDF_DRIVER_GLOBALS DriverGlobals,
4477     _In_
4478     WDFDEVICE Device,
4479     _In_
4480     PWDF_DEVICE_PROPERTY_DATA DeviceProperty,
4481     _In_
4482     _Strict_type_match_
4483     POOL_TYPE PoolType,
4484     _In_opt_
4485     PWDF_OBJECT_ATTRIBUTES PropertyMemoryAttributes,
4486     _Out_
4487     WDFMEMORY* PropertyMemory,
4488     _Out_
4489     PDEVPROPTYPE Type
4490     );
4491 
4492 _Must_inspect_result_
_IRQL_requires_max_(APC_LEVEL)4493 _IRQL_requires_max_(APC_LEVEL)
4494 FORCEINLINE
4495 NTSTATUS
4496 WdfDeviceAllocAndQueryPropertyEx(
4497     _In_
4498     WDFDEVICE Device,
4499     _In_
4500     PWDF_DEVICE_PROPERTY_DATA DeviceProperty,
4501     _In_
4502     _Strict_type_match_
4503     POOL_TYPE PoolType,
4504     _In_opt_
4505     PWDF_OBJECT_ATTRIBUTES PropertyMemoryAttributes,
4506     _Out_
4507     WDFMEMORY* PropertyMemory,
4508     _Out_
4509     PDEVPROPTYPE Type
4510     )
4511 {
4512     return ((PFN_WDFDEVICEALLOCANDQUERYPROPERTYEX) WdfFunctions[WdfDeviceAllocAndQueryPropertyExTableIndex])(WdfDriverGlobals, Device, DeviceProperty, PoolType, PropertyMemoryAttributes, PropertyMemory, Type);
4513 }
4514 
4515 //
4516 // WDF Function: WdfDeviceAssignProperty
4517 //
4518 typedef
4519 _Must_inspect_result_
4520 _IRQL_requires_max_(APC_LEVEL)
4521 WDFAPI
4522 NTSTATUS
4523 (STDCALL *PFN_WDFDEVICEASSIGNPROPERTY)(
4524     _In_
4525     PWDF_DRIVER_GLOBALS DriverGlobals,
4526     _In_
4527     WDFDEVICE Device,
4528     _In_
4529     PWDF_DEVICE_PROPERTY_DATA DeviceProperty,
4530     _In_
4531     DEVPROPTYPE Type,
4532     _In_
4533     ULONG Size,
4534     _In_opt_
4535     PVOID Data
4536     );
4537 
4538 _Must_inspect_result_
_IRQL_requires_max_(APC_LEVEL)4539 _IRQL_requires_max_(APC_LEVEL)
4540 FORCEINLINE
4541 NTSTATUS
4542 WdfDeviceAssignProperty(
4543     _In_
4544     WDFDEVICE Device,
4545     _In_
4546     PWDF_DEVICE_PROPERTY_DATA DeviceProperty,
4547     _In_
4548     DEVPROPTYPE Type,
4549     _In_
4550     ULONG Size,
4551     _In_opt_
4552     PVOID Data
4553     )
4554 {
4555     return ((PFN_WDFDEVICEASSIGNPROPERTY) WdfFunctions[WdfDeviceAssignPropertyTableIndex])(WdfDriverGlobals, Device, DeviceProperty, Type, Size, Data);
4556 }
4557 
4558 
4559 
4560 #endif // (NTDDI_VERSION >= NTDDI_WIN2K)
4561 
4562 
4563 WDF_EXTERN_C_END
4564 
4565 #endif // _WDFDEVICE_H_
4566 
4567 
4568