xref: /reactos/sdk/include/wdf/kmdf/1.17/wdfrequest.h (revision 545df815)
1 /*++
2 
3 Copyright (c) Microsoft Corporation.  All rights reserved.
4 
5 _WdfVersionBuild_
6 
7 Module Name:
8 
9     wdfrequest.h
10 
11 Abstract:
12 
13     This module contains contains the Windows Driver Framework Request object
14     interfaces.
15 
16 Environment:
17 
18     kernel mode only
19 
20 Revision History:
21 
22 
23 --*/
24 
25 //
26 // NOTE: This header is generated by stubwork.  Please make any
27 //       modifications to the corresponding template files
28 //       (.x or .y) and use stubwork to regenerate the header
29 //
30 
31 #ifndef _WDFREQUEST_H_
32 #define _WDFREQUEST_H_
33 
34 #ifndef WDF_EXTERN_C
35   #ifdef __cplusplus
36     #define WDF_EXTERN_C       extern "C"
37     #define WDF_EXTERN_C_START extern "C" {
38     #define WDF_EXTERN_C_END   }
39   #else
40     #define WDF_EXTERN_C
41     #define WDF_EXTERN_C_START
42     #define WDF_EXTERN_C_END
43   #endif
44 #endif
45 
46 WDF_EXTERN_C_START
47 
48 
49 
50 #if (NTDDI_VERSION >= NTDDI_WIN2K)
51 
52 //
53 // Types
54 //
55 
56 /* typedef enum _WDF_REQUEST_TYPE { // declaration moved to wdfdevice.h
57     WdfRequestTypeCreate = 0x0,
58     WdfRequestTypeCreateNamedPipe = 0x1,
59     WdfRequestTypeClose = 0x2,
60     WdfRequestTypeRead = 0x3,
61     WdfRequestTypeWrite = 0x4,
62     WdfRequestTypeQueryInformation = 0x5,
63     WdfRequestTypeSetInformation = 0x6,
64     WdfRequestTypeQueryEA = 0x7,
65     WdfRequestTypeSetEA = 0x8,
66     WdfRequestTypeFlushBuffers = 0x9,
67     WdfRequestTypeQueryVolumeInformation = 0xa,
68     WdfRequestTypeSetVolumeInformation = 0xb,
69     WdfRequestTypeDirectoryControl = 0xc,
70     WdfRequestTypeFileSystemControl = 0xd,
71     WdfRequestTypeDeviceControl = 0xe,
72     WdfRequestTypeDeviceControlInternal = 0xf,
73     WdfRequestTypeShutdown = 0x10,
74     WdfRequestTypeLockControl = 0x11,
75     WdfRequestTypeCleanup = 0x12,
76     WdfRequestTypeCreateMailSlot = 0x13,
77     WdfRequestTypeQuerySecurity = 0x14,
78     WdfRequestTypeSetSecurity = 0x15,
79     WdfRequestTypePower = 0x16,
80     WdfRequestTypeSystemControl = 0x17,
81     WdfRequestTypeDeviceChange = 0x18,
82     WdfRequestTypeQueryQuota = 0x19,
83     WdfRequestTypeSetQuota = 0x1A,
84     WdfRequestTypePnp = 0x1B,
85     WdfRequestTypeOther =0x1C,
86     WdfRequestTypeUsb = 0x40,
87     WdfRequestTypeNoFormat = 0xFF,
88     WdfRequestTypeMax,
89 } WDF_REQUEST_TYPE; */
90 
91 typedef enum _WDF_REQUEST_REUSE_FLAGS {
92     WDF_REQUEST_REUSE_NO_FLAGS = 0x00000000,
93     WDF_REQUEST_REUSE_SET_NEW_IRP = 0x00000001,
94 } WDF_REQUEST_REUSE_FLAGS;
95 
96 //
97 // This defines the actions to take on a request
98 // in EvtIoStop.
99 //
100 typedef enum _WDF_REQUEST_STOP_ACTION_FLAGS {
101     WdfRequestStopActionInvalid = 0,
102     WdfRequestStopActionSuspend = 0x01, //  Device is being suspended
103     WdfRequestStopActionPurge = 0x2, //  Device/queue is being removed
104     WdfRequestStopRequestCancelable = 0x10000000, //  This bit is set if the request is marked cancelable
105 } WDF_REQUEST_STOP_ACTION_FLAGS;
106 
107 typedef enum _WDF_REQUEST_SEND_OPTIONS_FLAGS {
108     WDF_REQUEST_SEND_OPTION_TIMEOUT = 0x00000001,
109     WDF_REQUEST_SEND_OPTION_SYNCHRONOUS = 0x00000002,
110     WDF_REQUEST_SEND_OPTION_IGNORE_TARGET_STATE = 0x00000004,
111     WDF_REQUEST_SEND_OPTION_SEND_AND_FORGET = 0x00000008,
112     WDF_REQUEST_SEND_OPTION_IMPERSONATE_CLIENT = 0x00010000,
113     WDF_REQUEST_SEND_OPTION_IMPERSONATION_IGNORE_FAILURE = 0x00020000,
114 } WDF_REQUEST_SEND_OPTIONS_FLAGS;
115 
116 
117 
118 // Request cancel is called if a request that has been marked cancelable is cancelled
119 typedef
120 _Function_class_(EVT_WDF_REQUEST_CANCEL)
121 _IRQL_requires_same_
122 _IRQL_requires_max_(DISPATCH_LEVEL)
123 VOID
124 STDCALL
125 EVT_WDF_REQUEST_CANCEL(
126     _In_
127     WDFREQUEST Request
128     );
129 
130 typedef EVT_WDF_REQUEST_CANCEL *PFN_WDF_REQUEST_CANCEL;
131 
132 
133 //
134 // This parameters structure allows general access to a requests parameters
135 //
136 typedef struct _WDF_REQUEST_PARAMETERS {
137 
138     USHORT Size;
139 
140     UCHAR MinorFunction;
141 
142     WDF_REQUEST_TYPE Type;
143 
144     //
145     // The following user parameters are based on the service that is being
146     // invoked.  Drivers and file systems can determine which set to use based
147     // on the above major and minor function codes.
148     //
149     union {
150 
151         //
152         // System service parameters for:  Create
153         //
154 
155         struct {
156             PIO_SECURITY_CONTEXT SecurityContext;
157             ULONG Options;
158             USHORT POINTER_ALIGNMENT FileAttributes;
159             USHORT ShareAccess;
160             ULONG POINTER_ALIGNMENT EaLength;
161         } Create;
162 
163 
164         //
165         // System service parameters for:  Read
166         //
167 
168         struct {
169             size_t Length;
170             ULONG POINTER_ALIGNMENT Key;
171             LONGLONG DeviceOffset;
172         } Read;
173 
174         //
175         // System service parameters for:  Write
176         //
177 
178         struct {
179             size_t Length;
180             ULONG POINTER_ALIGNMENT Key;
181             LONGLONG DeviceOffset;
182         } Write;
183 
184         //
185         // System service parameters for:  Device Control
186         //
187         // Note that the user's output buffer is stored in the UserBuffer field
188         // and the user's input buffer is stored in the SystemBuffer field.
189         //
190 
191         struct {
192             size_t OutputBufferLength;
193             size_t POINTER_ALIGNMENT InputBufferLength;
194             ULONG POINTER_ALIGNMENT IoControlCode;
195             PVOID Type3InputBuffer;
196         } DeviceIoControl;
197 
198         struct {
199             PVOID Arg1;
200             PVOID  Arg2;
201             ULONG POINTER_ALIGNMENT IoControlCode;
202             PVOID Arg4;
203         } Others;
204 
205     } Parameters;
206 
207 } WDF_REQUEST_PARAMETERS, *PWDF_REQUEST_PARAMETERS;
208 
209 FORCEINLINE
210 VOID
WDF_REQUEST_PARAMETERS_INIT(_Out_ PWDF_REQUEST_PARAMETERS Parameters)211 WDF_REQUEST_PARAMETERS_INIT(
212     _Out_ PWDF_REQUEST_PARAMETERS Parameters
213     )
214 {
215     RtlZeroMemory(Parameters, sizeof(WDF_REQUEST_PARAMETERS));
216 
217     Parameters->Size = sizeof(WDF_REQUEST_PARAMETERS);
218 }
219 
220 typedef struct _WDF_USB_REQUEST_COMPLETION_PARAMS *PWDF_USB_REQUEST_COMPLETION_PARAMS;
221 
222 typedef struct _WDF_REQUEST_COMPLETION_PARAMS {
223     //
224     // Size of the structure in bytes
225     //
226     ULONG Size;
227 
228     WDF_REQUEST_TYPE Type;
229 
230     IO_STATUS_BLOCK IoStatus;
231 
232     union {
233         struct {
234             WDFMEMORY Buffer;
235             size_t Length;
236             size_t Offset;
237         } Write;
238 
239         struct {
240             WDFMEMORY Buffer;
241             size_t Length;
242             size_t Offset;
243         } Read;
244 
245         struct {
246             ULONG IoControlCode;
247 
248             struct {
249                 WDFMEMORY Buffer;
250                 size_t Offset;
251             } Input;
252 
253             struct {
254                 WDFMEMORY Buffer;
255                 size_t Offset;
256                 size_t Length;
257             } Output;
258         } Ioctl;
259 
260         struct {
261             union {
262                 PVOID Ptr;
263                 ULONG_PTR Value;
264             } Argument1;
265             union {
266                 PVOID Ptr;
267                 ULONG_PTR Value;
268             } Argument2;
269             union {
270                 PVOID Ptr;
271                 ULONG_PTR Value;
272             } Argument3;
273             union {
274                 PVOID Ptr;
275                 ULONG_PTR Value;
276             } Argument4;
277         } Others;
278 
279         struct {
280             PWDF_USB_REQUEST_COMPLETION_PARAMS Completion;
281         } Usb;
282     } Parameters;
283 
284 } WDF_REQUEST_COMPLETION_PARAMS, *PWDF_REQUEST_COMPLETION_PARAMS;
285 
286 FORCEINLINE
287 VOID
WDF_REQUEST_COMPLETION_PARAMS_INIT(_Out_ PWDF_REQUEST_COMPLETION_PARAMS Params)288 WDF_REQUEST_COMPLETION_PARAMS_INIT(
289     _Out_ PWDF_REQUEST_COMPLETION_PARAMS Params
290     )
291 {
292     RtlZeroMemory(Params, sizeof(WDF_REQUEST_COMPLETION_PARAMS));
293     Params->Size = sizeof(WDF_REQUEST_COMPLETION_PARAMS);
294     Params->Type = WdfRequestTypeNoFormat;
295 }
296 
297 typedef
298 _Function_class_(EVT_WDF_REQUEST_COMPLETION_ROUTINE)
299 _IRQL_requires_same_
300 VOID
301 STDCALL
302 EVT_WDF_REQUEST_COMPLETION_ROUTINE(
303     _In_
304     WDFREQUEST Request,
305     _In_
306     WDFIOTARGET Target,
307     _In_
308     PWDF_REQUEST_COMPLETION_PARAMS Params,
309     _In_
310     WDFCONTEXT Context
311     );
312 
313 typedef EVT_WDF_REQUEST_COMPLETION_ROUTINE *PFN_WDF_REQUEST_COMPLETION_ROUTINE;
314 
315 /*++
316 
317 Routine Description:
318     Clears out the internal state of the irp, which includes, but is not limited
319     to:
320     a)  Any internal allocations for the previously formatted request
321     b)  The completion routine and its context
322     c)  The request's intended i/o target
323     d)  All of the internal IRP's stack locations
324 
325 Arguments:
326     Request - The request to be reused.
327 
328     ReuseParams - Parameters controlling the reuse of the request, see comments
329         for each field in the structure for usage
330 
331 Return Value:
332     None
333 
334   --*/
335 
336 typedef struct _WDF_REQUEST_REUSE_PARAMS {
337     //
338     // Size of this structure in bytes
339     //
340     ULONG Size;
341 
342     //
343     // Bit field combination of WDF_REQUEST_REUSE_Xxx values
344     //
345     ULONG Flags;
346 
347     //
348     // The new status of the request.
349     //
350     NTSTATUS Status;
351 
352     //
353     // New PIRP  to be contained in the WDFREQUEST.   Setting a new PIRP value
354     // is only valid for WDFREQUESTs created by WdfRequestCreateFromIrp where
355     // RequestFreesIrp == FALSE.  No other WDFREQUESTs (presented by the
356     // I/O queue for instance) may have their IRPs changed.
357     //
358     PIRP NewIrp;
359 
360 } WDF_REQUEST_REUSE_PARAMS, *PWDF_REQUEST_REUSE_PARAMS;
361 
362 FORCEINLINE
363 VOID
WDF_REQUEST_REUSE_PARAMS_INIT(_Out_ PWDF_REQUEST_REUSE_PARAMS Params,_In_ ULONG Flags,_In_ NTSTATUS Status)364 WDF_REQUEST_REUSE_PARAMS_INIT(
365     _Out_ PWDF_REQUEST_REUSE_PARAMS Params,
366     _In_ ULONG Flags,
367     _In_ NTSTATUS Status
368     )
369 {
370     RtlZeroMemory(Params, sizeof(WDF_REQUEST_REUSE_PARAMS));
371 
372     Params->Size = sizeof(WDF_REQUEST_REUSE_PARAMS);
373     Params->Flags = Flags;
374     Params->Status = Status;
375 }
376 
377 FORCEINLINE
378 VOID
WDF_REQUEST_REUSE_PARAMS_SET_NEW_IRP(_Inout_ PWDF_REQUEST_REUSE_PARAMS Params,_In_ PIRP NewIrp)379 WDF_REQUEST_REUSE_PARAMS_SET_NEW_IRP(
380     _Inout_ PWDF_REQUEST_REUSE_PARAMS Params,
381     _In_ PIRP NewIrp
382     )
383 {
384     Params->Flags |= WDF_REQUEST_REUSE_SET_NEW_IRP;
385     Params->NewIrp = NewIrp;
386 }
387 
388 typedef struct _WDF_REQUEST_SEND_OPTIONS {
389     //
390     // Size of the structure in bytes
391     //
392     ULONG Size;
393 
394     //
395     // Bit field combination of values from the WDF_REQUEST_SEND_OPTIONS_FLAGS
396     // enumeration
397     //
398     ULONG Flags;
399 
400     //
401     // Valid when WDF_REQUEST_SEND_OPTION_TIMEOUT is set
402     //
403     LONGLONG Timeout;
404 
405 } WDF_REQUEST_SEND_OPTIONS, *PWDF_REQUEST_SEND_OPTIONS;
406 
407 FORCEINLINE
408 VOID
WDF_REQUEST_SEND_OPTIONS_INIT(_Out_ PWDF_REQUEST_SEND_OPTIONS Options,_In_ ULONG Flags)409 WDF_REQUEST_SEND_OPTIONS_INIT(
410     _Out_ PWDF_REQUEST_SEND_OPTIONS Options,
411     _In_ ULONG Flags
412     )
413 {
414     RtlZeroMemory(Options, sizeof(WDF_REQUEST_SEND_OPTIONS));
415     Options->Size = sizeof(WDF_REQUEST_SEND_OPTIONS);
416     Options->Flags = Flags;
417 }
418 
419 FORCEINLINE
420 VOID
WDF_REQUEST_SEND_OPTIONS_SET_TIMEOUT(_Inout_ PWDF_REQUEST_SEND_OPTIONS Options,_In_ LONGLONG Timeout)421 WDF_REQUEST_SEND_OPTIONS_SET_TIMEOUT(
422     _Inout_ PWDF_REQUEST_SEND_OPTIONS Options,
423     _In_ LONGLONG Timeout
424     )
425 {
426     Options->Flags |= WDF_REQUEST_SEND_OPTION_TIMEOUT;
427     Options->Timeout = Timeout;
428 }
429 
430 typedef enum _WDF_REQUEST_FORWARD_OPTIONS_FLAGS {
431     WDF_REQUEST_FORWARD_OPTION_SEND_AND_FORGET = 0x00000001
432 } WDF_REQUEST_FORWARD_OPTIONS_FLAGS;
433 
434 typedef struct _WDF_REQUEST_FORWARD_OPTIONS {
435     //
436     // Size of the structure in bytes
437     //
438     ULONG Size;
439 
440     //
441     // Bit field combination of values from the WDF_REQUEST_FORWARD_OPTIONS_FLAGS
442     // enumeration
443     //
444     ULONG Flags;
445 } WDF_REQUEST_FORWARD_OPTIONS, *PWDF_REQUEST_FORWARD_OPTIONS;
446 
447 
448 //
449 // Default REquest forward initialization macro
450 //
451 FORCEINLINE
452 VOID
WDF_REQUEST_FORWARD_OPTIONS_INIT(_Out_ PWDF_REQUEST_FORWARD_OPTIONS ForwardOptions)453 WDF_REQUEST_FORWARD_OPTIONS_INIT(
454     _Out_ PWDF_REQUEST_FORWARD_OPTIONS  ForwardOptions
455     )
456 {
457     RtlZeroMemory(ForwardOptions, sizeof(WDF_REQUEST_FORWARD_OPTIONS));
458 
459     ForwardOptions->Size = sizeof(WDF_REQUEST_FORWARD_OPTIONS);
460     ForwardOptions->Flags |= WDF_REQUEST_FORWARD_OPTION_SEND_AND_FORGET;
461 }
462 
463 
464 
465 
466 //
467 // WDF Function: WdfRequestCreate
468 //
469 typedef
470 _Must_inspect_result_
471 _IRQL_requires_max_(DISPATCH_LEVEL)
472 WDFAPI
473 NTSTATUS
474 (STDCALL *PFN_WDFREQUESTCREATE)(
475     _In_
476     PWDF_DRIVER_GLOBALS DriverGlobals,
477     _In_opt_
478     PWDF_OBJECT_ATTRIBUTES RequestAttributes,
479     _In_opt_
480     WDFIOTARGET IoTarget,
481     _Out_
482     WDFREQUEST* Request
483     );
484 
485 _Must_inspect_result_
_IRQL_requires_max_(DISPATCH_LEVEL)486 _IRQL_requires_max_(DISPATCH_LEVEL)
487 FORCEINLINE
488 NTSTATUS
489 WdfRequestCreate(
490     _In_opt_
491     PWDF_OBJECT_ATTRIBUTES RequestAttributes,
492     _In_opt_
493     WDFIOTARGET IoTarget,
494     _Out_
495     WDFREQUEST* Request
496     )
497 {
498     return ((PFN_WDFREQUESTCREATE) WdfFunctions[WdfRequestCreateTableIndex])(WdfDriverGlobals, RequestAttributes, IoTarget, Request);
499 }
500 
501 //
502 // WDF Function: WdfRequestCreateFromIrp
503 //
504 typedef
505 _Must_inspect_result_
506 _IRQL_requires_max_(DISPATCH_LEVEL)
507 WDFAPI
508 NTSTATUS
509 (STDCALL *PFN_WDFREQUESTCREATEFROMIRP)(
510     _In_
511     PWDF_DRIVER_GLOBALS DriverGlobals,
512     _In_opt_
513     PWDF_OBJECT_ATTRIBUTES RequestAttributes,
514     _In_
515     PIRP Irp,
516     _In_
517     BOOLEAN RequestFreesIrp,
518     _Out_
519     WDFREQUEST* Request
520     );
521 
522 _Must_inspect_result_
_IRQL_requires_max_(DISPATCH_LEVEL)523 _IRQL_requires_max_(DISPATCH_LEVEL)
524 FORCEINLINE
525 NTSTATUS
526 WdfRequestCreateFromIrp(
527     _In_opt_
528     PWDF_OBJECT_ATTRIBUTES RequestAttributes,
529     _In_
530     PIRP Irp,
531     _In_
532     BOOLEAN RequestFreesIrp,
533     _Out_
534     WDFREQUEST* Request
535     )
536 {
537     return ((PFN_WDFREQUESTCREATEFROMIRP) WdfFunctions[WdfRequestCreateFromIrpTableIndex])(WdfDriverGlobals, RequestAttributes, Irp, RequestFreesIrp, Request);
538 }
539 
540 //
541 // WDF Function: WdfRequestReuse
542 //
543 typedef
544 _IRQL_requires_max_(DISPATCH_LEVEL)
545 WDFAPI
546 NTSTATUS
547 (STDCALL *PFN_WDFREQUESTREUSE)(
548     _In_
549     PWDF_DRIVER_GLOBALS DriverGlobals,
550     _In_
551     WDFREQUEST Request,
552     _In_
553     PWDF_REQUEST_REUSE_PARAMS ReuseParams
554     );
555 
_IRQL_requires_max_(DISPATCH_LEVEL)556 _IRQL_requires_max_(DISPATCH_LEVEL)
557 FORCEINLINE
558 NTSTATUS
559 WdfRequestReuse(
560     _In_
561     WDFREQUEST Request,
562     _In_
563     PWDF_REQUEST_REUSE_PARAMS ReuseParams
564     )
565 {
566     return ((PFN_WDFREQUESTREUSE) WdfFunctions[WdfRequestReuseTableIndex])(WdfDriverGlobals, Request, ReuseParams);
567 }
568 
569 //
570 // WDF Function: WdfRequestChangeTarget
571 //
572 typedef
573 _Must_inspect_result_
574 _IRQL_requires_max_(DISPATCH_LEVEL)
575 WDFAPI
576 NTSTATUS
577 (STDCALL *PFN_WDFREQUESTCHANGETARGET)(
578     _In_
579     PWDF_DRIVER_GLOBALS DriverGlobals,
580     _In_
581     WDFREQUEST Request,
582     _In_
583     WDFIOTARGET IoTarget
584     );
585 
586 _Must_inspect_result_
_IRQL_requires_max_(DISPATCH_LEVEL)587 _IRQL_requires_max_(DISPATCH_LEVEL)
588 FORCEINLINE
589 NTSTATUS
590 WdfRequestChangeTarget(
591     _In_
592     WDFREQUEST Request,
593     _In_
594     WDFIOTARGET IoTarget
595     )
596 {
597     return ((PFN_WDFREQUESTCHANGETARGET) WdfFunctions[WdfRequestChangeTargetTableIndex])(WdfDriverGlobals, Request, IoTarget);
598 }
599 
600 //
601 // WDF Function: WdfRequestFormatRequestUsingCurrentType
602 //
603 typedef
604 _IRQL_requires_max_(DISPATCH_LEVEL)
605 WDFAPI
606 VOID
607 (STDCALL *PFN_WDFREQUESTFORMATREQUESTUSINGCURRENTTYPE)(
608     _In_
609     PWDF_DRIVER_GLOBALS DriverGlobals,
610     _In_
611     WDFREQUEST Request
612     );
613 
_IRQL_requires_max_(DISPATCH_LEVEL)614 _IRQL_requires_max_(DISPATCH_LEVEL)
615 FORCEINLINE
616 VOID
617 WdfRequestFormatRequestUsingCurrentType(
618     _In_
619     WDFREQUEST Request
620     )
621 {
622     ((PFN_WDFREQUESTFORMATREQUESTUSINGCURRENTTYPE) WdfFunctions[WdfRequestFormatRequestUsingCurrentTypeTableIndex])(WdfDriverGlobals, Request);
623 }
624 
625 //
626 // WDF Function: WdfRequestWdmFormatUsingStackLocation
627 //
628 typedef
629 _IRQL_requires_max_(DISPATCH_LEVEL)
630 WDFAPI
631 VOID
632 (STDCALL *PFN_WDFREQUESTWDMFORMATUSINGSTACKLOCATION)(
633     _In_
634     PWDF_DRIVER_GLOBALS DriverGlobals,
635     _In_
636     WDFREQUEST Request,
637     _In_
638     PIO_STACK_LOCATION Stack
639     );
640 
_IRQL_requires_max_(DISPATCH_LEVEL)641 _IRQL_requires_max_(DISPATCH_LEVEL)
642 FORCEINLINE
643 VOID
644 WdfRequestWdmFormatUsingStackLocation(
645     _In_
646     WDFREQUEST Request,
647     _In_
648     PIO_STACK_LOCATION Stack
649     )
650 {
651     ((PFN_WDFREQUESTWDMFORMATUSINGSTACKLOCATION) WdfFunctions[WdfRequestWdmFormatUsingStackLocationTableIndex])(WdfDriverGlobals, Request, Stack);
652 }
653 
654 //
655 // WDF Function: WdfRequestSend
656 //
657 typedef
658 _IRQL_requires_max_(DISPATCH_LEVEL)
659 _When_(Options->Flags & WDF_REQUEST_SEND_OPTION_SYNCHRONOUS == 0, _Must_inspect_result_)
660 WDFAPI
661 BOOLEAN
662 (STDCALL *PFN_WDFREQUESTSEND)(
663     _In_
664     PWDF_DRIVER_GLOBALS DriverGlobals,
665     _In_
666     WDFREQUEST Request,
667     _In_
668     WDFIOTARGET Target,
669     _In_opt_
670     PWDF_REQUEST_SEND_OPTIONS Options
671     );
672 
673 _IRQL_requires_max_(DISPATCH_LEVEL)
674 _When_(Options->Flags & WDF_REQUEST_SEND_OPTION_SYNCHRONOUS == 0, _Must_inspect_result_)
675 FORCEINLINE
676 BOOLEAN
WdfRequestSend(_In_ WDFREQUEST Request,_In_ WDFIOTARGET Target,_In_opt_ PWDF_REQUEST_SEND_OPTIONS Options)677 WdfRequestSend(
678     _In_
679     WDFREQUEST Request,
680     _In_
681     WDFIOTARGET Target,
682     _In_opt_
683     PWDF_REQUEST_SEND_OPTIONS Options
684     )
685 {
686     return ((PFN_WDFREQUESTSEND) WdfFunctions[WdfRequestSendTableIndex])(WdfDriverGlobals, Request, Target, Options);
687 }
688 
689 //
690 // WDF Function: WdfRequestGetStatus
691 //
692 typedef
693 _Must_inspect_result_
694 _IRQL_requires_max_(DISPATCH_LEVEL)
695 WDFAPI
696 NTSTATUS
697 (STDCALL *PFN_WDFREQUESTGETSTATUS)(
698     _In_
699     PWDF_DRIVER_GLOBALS DriverGlobals,
700     _In_
701     WDFREQUEST Request
702     );
703 
704 _Must_inspect_result_
_IRQL_requires_max_(DISPATCH_LEVEL)705 _IRQL_requires_max_(DISPATCH_LEVEL)
706 FORCEINLINE
707 NTSTATUS
708 WdfRequestGetStatus(
709     _In_
710     WDFREQUEST Request
711     )
712 {
713     return ((PFN_WDFREQUESTGETSTATUS) WdfFunctions[WdfRequestGetStatusTableIndex])(WdfDriverGlobals, Request);
714 }
715 
716 //
717 // WDF Function: WdfRequestMarkCancelable
718 //
719 typedef
720 _IRQL_requires_max_(DISPATCH_LEVEL)
721 WDFAPI
722 VOID
723 (STDCALL *PFN_WDFREQUESTMARKCANCELABLE)(
724     _In_
725     PWDF_DRIVER_GLOBALS DriverGlobals,
726     _In_
727     WDFREQUEST Request,
728     _In_
729     PFN_WDF_REQUEST_CANCEL EvtRequestCancel
730     );
731 
_IRQL_requires_max_(DISPATCH_LEVEL)732 _IRQL_requires_max_(DISPATCH_LEVEL)
733 FORCEINLINE
734 VOID
735 WdfRequestMarkCancelable(
736     _In_
737     WDFREQUEST Request,
738     _In_
739     PFN_WDF_REQUEST_CANCEL EvtRequestCancel
740     )
741 {
742     ((PFN_WDFREQUESTMARKCANCELABLE) WdfFunctions[WdfRequestMarkCancelableTableIndex])(WdfDriverGlobals, Request, EvtRequestCancel);
743 }
744 
745 //
746 // WDF Function: WdfRequestMarkCancelableEx
747 //
748 typedef
749 _Must_inspect_result_
750 _IRQL_requires_max_(DISPATCH_LEVEL)
751 WDFAPI
752 NTSTATUS
753 (STDCALL *PFN_WDFREQUESTMARKCANCELABLEEX)(
754     _In_
755     PWDF_DRIVER_GLOBALS DriverGlobals,
756     _In_
757     WDFREQUEST Request,
758     _In_
759     PFN_WDF_REQUEST_CANCEL EvtRequestCancel
760     );
761 
762 _Must_inspect_result_
_IRQL_requires_max_(DISPATCH_LEVEL)763 _IRQL_requires_max_(DISPATCH_LEVEL)
764 FORCEINLINE
765 NTSTATUS
766 WdfRequestMarkCancelableEx(
767     _In_
768     WDFREQUEST Request,
769     _In_
770     PFN_WDF_REQUEST_CANCEL EvtRequestCancel
771     )
772 {
773     return ((PFN_WDFREQUESTMARKCANCELABLEEX) WdfFunctions[WdfRequestMarkCancelableExTableIndex])(WdfDriverGlobals, Request, EvtRequestCancel);
774 }
775 
776 //
777 // WDF Function: WdfRequestUnmarkCancelable
778 //
779 typedef
780 _Must_inspect_result_
781 _IRQL_requires_max_(DISPATCH_LEVEL)
782 WDFAPI
783 NTSTATUS
784 (STDCALL *PFN_WDFREQUESTUNMARKCANCELABLE)(
785     _In_
786     PWDF_DRIVER_GLOBALS DriverGlobals,
787     _In_
788     WDFREQUEST Request
789     );
790 
791 _Must_inspect_result_
_IRQL_requires_max_(DISPATCH_LEVEL)792 _IRQL_requires_max_(DISPATCH_LEVEL)
793 FORCEINLINE
794 NTSTATUS
795 WdfRequestUnmarkCancelable(
796     _In_
797     WDFREQUEST Request
798     )
799 {
800     return ((PFN_WDFREQUESTUNMARKCANCELABLE) WdfFunctions[WdfRequestUnmarkCancelableTableIndex])(WdfDriverGlobals, Request);
801 }
802 
803 //
804 // WDF Function: WdfRequestIsCanceled
805 //
806 typedef
807 _Must_inspect_result_
808 _IRQL_requires_max_(DISPATCH_LEVEL)
809 WDFAPI
810 BOOLEAN
811 (STDCALL *PFN_WDFREQUESTISCANCELED)(
812     _In_
813     PWDF_DRIVER_GLOBALS DriverGlobals,
814     _In_
815     WDFREQUEST Request
816     );
817 
818 _Must_inspect_result_
_IRQL_requires_max_(DISPATCH_LEVEL)819 _IRQL_requires_max_(DISPATCH_LEVEL)
820 FORCEINLINE
821 BOOLEAN
822 WdfRequestIsCanceled(
823     _In_
824     WDFREQUEST Request
825     )
826 {
827     return ((PFN_WDFREQUESTISCANCELED) WdfFunctions[WdfRequestIsCanceledTableIndex])(WdfDriverGlobals, Request);
828 }
829 
830 //
831 // WDF Function: WdfRequestCancelSentRequest
832 //
833 typedef
834 _IRQL_requires_max_(DISPATCH_LEVEL)
835 WDFAPI
836 BOOLEAN
837 (STDCALL *PFN_WDFREQUESTCANCELSENTREQUEST)(
838     _In_
839     PWDF_DRIVER_GLOBALS DriverGlobals,
840     _In_
841     WDFREQUEST Request
842     );
843 
_IRQL_requires_max_(DISPATCH_LEVEL)844 _IRQL_requires_max_(DISPATCH_LEVEL)
845 FORCEINLINE
846 BOOLEAN
847 WdfRequestCancelSentRequest(
848     _In_
849     WDFREQUEST Request
850     )
851 {
852     return ((PFN_WDFREQUESTCANCELSENTREQUEST) WdfFunctions[WdfRequestCancelSentRequestTableIndex])(WdfDriverGlobals, Request);
853 }
854 
855 //
856 // WDF Function: WdfRequestIsFrom32BitProcess
857 //
858 typedef
859 _Must_inspect_result_
860 _IRQL_requires_max_(APC_LEVEL)
861 WDFAPI
862 BOOLEAN
863 (STDCALL *PFN_WDFREQUESTISFROM32BITPROCESS)(
864     _In_
865     PWDF_DRIVER_GLOBALS DriverGlobals,
866     _In_
867     WDFREQUEST Request
868     );
869 
870 _Must_inspect_result_
_IRQL_requires_max_(APC_LEVEL)871 _IRQL_requires_max_(APC_LEVEL)
872 FORCEINLINE
873 BOOLEAN
874 WdfRequestIsFrom32BitProcess(
875     _In_
876     WDFREQUEST Request
877     )
878 {
879     return ((PFN_WDFREQUESTISFROM32BITPROCESS) WdfFunctions[WdfRequestIsFrom32BitProcessTableIndex])(WdfDriverGlobals, Request);
880 }
881 
882 //
883 // WDF Function: WdfRequestSetCompletionRoutine
884 //
885 typedef
886 _IRQL_requires_max_(DISPATCH_LEVEL)
887 WDFAPI
888 VOID
889 (STDCALL *PFN_WDFREQUESTSETCOMPLETIONROUTINE)(
890     _In_
891     PWDF_DRIVER_GLOBALS DriverGlobals,
892     _In_
893     WDFREQUEST Request,
894     _In_opt_
895     PFN_WDF_REQUEST_COMPLETION_ROUTINE CompletionRoutine,
896     _In_opt_ __drv_aliasesMem
897     WDFCONTEXT CompletionContext
898     );
899 
_IRQL_requires_max_(DISPATCH_LEVEL)900 _IRQL_requires_max_(DISPATCH_LEVEL)
901 FORCEINLINE
902 VOID
903 WdfRequestSetCompletionRoutine(
904     _In_
905     WDFREQUEST Request,
906     _In_opt_
907     PFN_WDF_REQUEST_COMPLETION_ROUTINE CompletionRoutine,
908     _In_opt_ __drv_aliasesMem
909     WDFCONTEXT CompletionContext
910     )
911 {
912     ((PFN_WDFREQUESTSETCOMPLETIONROUTINE) WdfFunctions[WdfRequestSetCompletionRoutineTableIndex])(WdfDriverGlobals, Request, CompletionRoutine, CompletionContext);
913 }
914 
915 //
916 // WDF Function: WdfRequestGetCompletionParams
917 //
918 typedef
919 _IRQL_requires_max_(DISPATCH_LEVEL)
920 WDFAPI
921 VOID
922 (STDCALL *PFN_WDFREQUESTGETCOMPLETIONPARAMS)(
923     _In_
924     PWDF_DRIVER_GLOBALS DriverGlobals,
925     _In_
926     WDFREQUEST Request,
927     _Out_
928     PWDF_REQUEST_COMPLETION_PARAMS Params
929     );
930 
_IRQL_requires_max_(DISPATCH_LEVEL)931 _IRQL_requires_max_(DISPATCH_LEVEL)
932 FORCEINLINE
933 VOID
934 WdfRequestGetCompletionParams(
935     _In_
936     WDFREQUEST Request,
937     _Out_
938     PWDF_REQUEST_COMPLETION_PARAMS Params
939     )
940 {
941     ((PFN_WDFREQUESTGETCOMPLETIONPARAMS) WdfFunctions[WdfRequestGetCompletionParamsTableIndex])(WdfDriverGlobals, Request, Params);
942 }
943 
944 //
945 // WDF Function: WdfRequestAllocateTimer
946 //
947 typedef
948 _Must_inspect_result_
949 _IRQL_requires_max_(DISPATCH_LEVEL)
950 WDFAPI
951 NTSTATUS
952 (STDCALL *PFN_WDFREQUESTALLOCATETIMER)(
953     _In_
954     PWDF_DRIVER_GLOBALS DriverGlobals,
955     _In_
956     WDFREQUEST Request
957     );
958 
959 _Must_inspect_result_
_IRQL_requires_max_(DISPATCH_LEVEL)960 _IRQL_requires_max_(DISPATCH_LEVEL)
961 FORCEINLINE
962 NTSTATUS
963 WdfRequestAllocateTimer(
964     _In_
965     WDFREQUEST Request
966     )
967 {
968     return ((PFN_WDFREQUESTALLOCATETIMER) WdfFunctions[WdfRequestAllocateTimerTableIndex])(WdfDriverGlobals, Request);
969 }
970 
971 //
972 // WDF Function: WdfRequestComplete
973 //
974 typedef
975 _IRQL_requires_max_(DISPATCH_LEVEL)
976 WDFAPI
977 VOID
978 (STDCALL *PFN_WDFREQUESTCOMPLETE)(
979     _In_
980     PWDF_DRIVER_GLOBALS DriverGlobals,
981     _In_
982     WDFREQUEST Request,
983     _In_
984     NTSTATUS Status
985     );
986 
_IRQL_requires_max_(DISPATCH_LEVEL)987 _IRQL_requires_max_(DISPATCH_LEVEL)
988 FORCEINLINE
989 VOID
990 WdfRequestComplete(
991     _In_
992     WDFREQUEST Request,
993     _In_
994     NTSTATUS Status
995     )
996 {
997     ((PFN_WDFREQUESTCOMPLETE) WdfFunctions[WdfRequestCompleteTableIndex])(WdfDriverGlobals, Request, Status);
998 }
999 
1000 //
1001 // WDF Function: WdfRequestCompleteWithPriorityBoost
1002 //
1003 typedef
1004 _IRQL_requires_max_(DISPATCH_LEVEL)
1005 WDFAPI
1006 VOID
1007 (STDCALL *PFN_WDFREQUESTCOMPLETEWITHPRIORITYBOOST)(
1008     _In_
1009     PWDF_DRIVER_GLOBALS DriverGlobals,
1010     _In_
1011     WDFREQUEST Request,
1012     _In_
1013     NTSTATUS Status,
1014     _In_
1015     CCHAR PriorityBoost
1016     );
1017 
_IRQL_requires_max_(DISPATCH_LEVEL)1018 _IRQL_requires_max_(DISPATCH_LEVEL)
1019 FORCEINLINE
1020 VOID
1021 WdfRequestCompleteWithPriorityBoost(
1022     _In_
1023     WDFREQUEST Request,
1024     _In_
1025     NTSTATUS Status,
1026     _In_
1027     CCHAR PriorityBoost
1028     )
1029 {
1030     ((PFN_WDFREQUESTCOMPLETEWITHPRIORITYBOOST) WdfFunctions[WdfRequestCompleteWithPriorityBoostTableIndex])(WdfDriverGlobals, Request, Status, PriorityBoost);
1031 }
1032 
1033 //
1034 // WDF Function: WdfRequestCompleteWithInformation
1035 //
1036 typedef
1037 _IRQL_requires_max_(DISPATCH_LEVEL)
1038 WDFAPI
1039 VOID
1040 (STDCALL *PFN_WDFREQUESTCOMPLETEWITHINFORMATION)(
1041     _In_
1042     PWDF_DRIVER_GLOBALS DriverGlobals,
1043     _In_
1044     WDFREQUEST Request,
1045     _In_
1046     NTSTATUS Status,
1047     _In_
1048     ULONG_PTR Information
1049     );
1050 
_IRQL_requires_max_(DISPATCH_LEVEL)1051 _IRQL_requires_max_(DISPATCH_LEVEL)
1052 FORCEINLINE
1053 VOID
1054 WdfRequestCompleteWithInformation(
1055     _In_
1056     WDFREQUEST Request,
1057     _In_
1058     NTSTATUS Status,
1059     _In_
1060     ULONG_PTR Information
1061     )
1062 {
1063     ((PFN_WDFREQUESTCOMPLETEWITHINFORMATION) WdfFunctions[WdfRequestCompleteWithInformationTableIndex])(WdfDriverGlobals, Request, Status, Information);
1064 }
1065 
1066 //
1067 // WDF Function: WdfRequestGetParameters
1068 //
1069 typedef
1070 _IRQL_requires_max_(DISPATCH_LEVEL)
1071 WDFAPI
1072 VOID
1073 (STDCALL *PFN_WDFREQUESTGETPARAMETERS)(
1074     _In_
1075     PWDF_DRIVER_GLOBALS DriverGlobals,
1076     _In_
1077     WDFREQUEST Request,
1078     _Out_
1079     PWDF_REQUEST_PARAMETERS Parameters
1080     );
1081 
_IRQL_requires_max_(DISPATCH_LEVEL)1082 _IRQL_requires_max_(DISPATCH_LEVEL)
1083 FORCEINLINE
1084 VOID
1085 WdfRequestGetParameters(
1086     _In_
1087     WDFREQUEST Request,
1088     _Out_
1089     PWDF_REQUEST_PARAMETERS Parameters
1090     )
1091 {
1092     ((PFN_WDFREQUESTGETPARAMETERS) WdfFunctions[WdfRequestGetParametersTableIndex])(WdfDriverGlobals, Request, Parameters);
1093 }
1094 
1095 //
1096 // WDF Function: WdfRequestRetrieveInputMemory
1097 //
1098 typedef
1099 _Must_inspect_result_
1100 _IRQL_requires_max_(DISPATCH_LEVEL)
1101 WDFAPI
1102 NTSTATUS
1103 (STDCALL *PFN_WDFREQUESTRETRIEVEINPUTMEMORY)(
1104     _In_
1105     PWDF_DRIVER_GLOBALS DriverGlobals,
1106     _In_
1107     WDFREQUEST Request,
1108     _Out_
1109     WDFMEMORY* Memory
1110     );
1111 
1112 _Must_inspect_result_
_IRQL_requires_max_(DISPATCH_LEVEL)1113 _IRQL_requires_max_(DISPATCH_LEVEL)
1114 FORCEINLINE
1115 NTSTATUS
1116 WdfRequestRetrieveInputMemory(
1117     _In_
1118     WDFREQUEST Request,
1119     _Out_
1120     WDFMEMORY* Memory
1121     )
1122 {
1123     return ((PFN_WDFREQUESTRETRIEVEINPUTMEMORY) WdfFunctions[WdfRequestRetrieveInputMemoryTableIndex])(WdfDriverGlobals, Request, Memory);
1124 }
1125 
1126 //
1127 // WDF Function: WdfRequestRetrieveOutputMemory
1128 //
1129 typedef
1130 _Must_inspect_result_
1131 _IRQL_requires_max_(DISPATCH_LEVEL)
1132 WDFAPI
1133 NTSTATUS
1134 (STDCALL *PFN_WDFREQUESTRETRIEVEOUTPUTMEMORY)(
1135     _In_
1136     PWDF_DRIVER_GLOBALS DriverGlobals,
1137     _In_
1138     WDFREQUEST Request,
1139     _Out_
1140     WDFMEMORY* Memory
1141     );
1142 
1143 _Must_inspect_result_
_IRQL_requires_max_(DISPATCH_LEVEL)1144 _IRQL_requires_max_(DISPATCH_LEVEL)
1145 FORCEINLINE
1146 NTSTATUS
1147 WdfRequestRetrieveOutputMemory(
1148     _In_
1149     WDFREQUEST Request,
1150     _Out_
1151     WDFMEMORY* Memory
1152     )
1153 {
1154     return ((PFN_WDFREQUESTRETRIEVEOUTPUTMEMORY) WdfFunctions[WdfRequestRetrieveOutputMemoryTableIndex])(WdfDriverGlobals, Request, Memory);
1155 }
1156 
1157 //
1158 // WDF Function: WdfRequestRetrieveInputBuffer
1159 //
1160 typedef
1161 _Must_inspect_result_
1162 _IRQL_requires_max_(DISPATCH_LEVEL)
1163 WDFAPI
1164 NTSTATUS
1165 (STDCALL *PFN_WDFREQUESTRETRIEVEINPUTBUFFER)(
1166     _In_
1167     PWDF_DRIVER_GLOBALS DriverGlobals,
1168     _In_
1169     WDFREQUEST Request,
1170     _In_
1171     size_t MinimumRequiredLength,
1172     _Outptr_result_bytebuffer_(*Length)
1173     PVOID* Buffer,
1174     _Out_opt_
1175     size_t* Length
1176     );
1177 
1178 _Must_inspect_result_
_IRQL_requires_max_(DISPATCH_LEVEL)1179 _IRQL_requires_max_(DISPATCH_LEVEL)
1180 FORCEINLINE
1181 NTSTATUS
1182 WdfRequestRetrieveInputBuffer(
1183     _In_
1184     WDFREQUEST Request,
1185     _In_
1186     size_t MinimumRequiredLength,
1187     _Outptr_result_bytebuffer_(*Length)
1188     PVOID* Buffer,
1189     _Out_opt_
1190     size_t* Length
1191     )
1192 {
1193     return ((PFN_WDFREQUESTRETRIEVEINPUTBUFFER) WdfFunctions[WdfRequestRetrieveInputBufferTableIndex])(WdfDriverGlobals, Request, MinimumRequiredLength, Buffer, Length);
1194 }
1195 
1196 //
1197 // WDF Function: WdfRequestRetrieveOutputBuffer
1198 //
1199 typedef
1200 _Must_inspect_result_
1201 _IRQL_requires_max_(DISPATCH_LEVEL)
1202 WDFAPI
1203 NTSTATUS
1204 (STDCALL *PFN_WDFREQUESTRETRIEVEOUTPUTBUFFER)(
1205     _In_
1206     PWDF_DRIVER_GLOBALS DriverGlobals,
1207     _In_
1208     WDFREQUEST Request,
1209     _In_
1210     size_t MinimumRequiredSize,
1211     _Outptr_result_bytebuffer_(*Length)
1212     PVOID* Buffer,
1213     _Out_opt_
1214     size_t* Length
1215     );
1216 
1217 _Must_inspect_result_
_IRQL_requires_max_(DISPATCH_LEVEL)1218 _IRQL_requires_max_(DISPATCH_LEVEL)
1219 FORCEINLINE
1220 NTSTATUS
1221 WdfRequestRetrieveOutputBuffer(
1222     _In_
1223     WDFREQUEST Request,
1224     _In_
1225     size_t MinimumRequiredSize,
1226     _Outptr_result_bytebuffer_(*Length)
1227     PVOID* Buffer,
1228     _Out_opt_
1229     size_t* Length
1230     )
1231 {
1232     return ((PFN_WDFREQUESTRETRIEVEOUTPUTBUFFER) WdfFunctions[WdfRequestRetrieveOutputBufferTableIndex])(WdfDriverGlobals, Request, MinimumRequiredSize, Buffer, Length);
1233 }
1234 
1235 //
1236 // WDF Function: WdfRequestRetrieveInputWdmMdl
1237 //
1238 typedef
1239 _Must_inspect_result_
1240 _IRQL_requires_max_(DISPATCH_LEVEL)
1241 WDFAPI
1242 NTSTATUS
1243 (STDCALL *PFN_WDFREQUESTRETRIEVEINPUTWDMMDL)(
1244     _In_
1245     PWDF_DRIVER_GLOBALS DriverGlobals,
1246     _In_
1247     WDFREQUEST Request,
1248     _Outptr_
1249     PMDL* Mdl
1250     );
1251 
1252 _Must_inspect_result_
_IRQL_requires_max_(DISPATCH_LEVEL)1253 _IRQL_requires_max_(DISPATCH_LEVEL)
1254 FORCEINLINE
1255 NTSTATUS
1256 WdfRequestRetrieveInputWdmMdl(
1257     _In_
1258     WDFREQUEST Request,
1259     _Outptr_
1260     PMDL* Mdl
1261     )
1262 {
1263     return ((PFN_WDFREQUESTRETRIEVEINPUTWDMMDL) WdfFunctions[WdfRequestRetrieveInputWdmMdlTableIndex])(WdfDriverGlobals, Request, Mdl);
1264 }
1265 
1266 //
1267 // WDF Function: WdfRequestRetrieveOutputWdmMdl
1268 //
1269 typedef
1270 _Must_inspect_result_
1271 _IRQL_requires_max_(DISPATCH_LEVEL)
1272 WDFAPI
1273 NTSTATUS
1274 (STDCALL *PFN_WDFREQUESTRETRIEVEOUTPUTWDMMDL)(
1275     _In_
1276     PWDF_DRIVER_GLOBALS DriverGlobals,
1277     _In_
1278     WDFREQUEST Request,
1279     _Outptr_
1280     PMDL* Mdl
1281     );
1282 
1283 _Must_inspect_result_
_IRQL_requires_max_(DISPATCH_LEVEL)1284 _IRQL_requires_max_(DISPATCH_LEVEL)
1285 FORCEINLINE
1286 NTSTATUS
1287 WdfRequestRetrieveOutputWdmMdl(
1288     _In_
1289     WDFREQUEST Request,
1290     _Outptr_
1291     PMDL* Mdl
1292     )
1293 {
1294     return ((PFN_WDFREQUESTRETRIEVEOUTPUTWDMMDL) WdfFunctions[WdfRequestRetrieveOutputWdmMdlTableIndex])(WdfDriverGlobals, Request, Mdl);
1295 }
1296 
1297 //
1298 // WDF Function: WdfRequestRetrieveUnsafeUserInputBuffer
1299 //
1300 typedef
1301 _Must_inspect_result_
1302 _IRQL_requires_max_(PASSIVE_LEVEL)
1303 WDFAPI
1304 NTSTATUS
1305 (STDCALL *PFN_WDFREQUESTRETRIEVEUNSAFEUSERINPUTBUFFER)(
1306     _In_
1307     PWDF_DRIVER_GLOBALS DriverGlobals,
1308     _In_
1309     WDFREQUEST Request,
1310     _In_
1311     size_t MinimumRequiredLength,
1312     _Outptr_result_bytebuffer_maybenull_(*Length)
1313     PVOID* InputBuffer,
1314     _Out_opt_
1315     size_t* Length
1316     );
1317 
1318 _Must_inspect_result_
_IRQL_requires_max_(PASSIVE_LEVEL)1319 _IRQL_requires_max_(PASSIVE_LEVEL)
1320 FORCEINLINE
1321 NTSTATUS
1322 WdfRequestRetrieveUnsafeUserInputBuffer(
1323     _In_
1324     WDFREQUEST Request,
1325     _In_
1326     size_t MinimumRequiredLength,
1327     _Outptr_result_bytebuffer_maybenull_(*Length)
1328     PVOID* InputBuffer,
1329     _Out_opt_
1330     size_t* Length
1331     )
1332 {
1333     return ((PFN_WDFREQUESTRETRIEVEUNSAFEUSERINPUTBUFFER) WdfFunctions[WdfRequestRetrieveUnsafeUserInputBufferTableIndex])(WdfDriverGlobals, Request, MinimumRequiredLength, InputBuffer, Length);
1334 }
1335 
1336 //
1337 // WDF Function: WdfRequestRetrieveUnsafeUserOutputBuffer
1338 //
1339 typedef
1340 _Must_inspect_result_
1341 _IRQL_requires_max_(PASSIVE_LEVEL)
1342 WDFAPI
1343 NTSTATUS
1344 (STDCALL *PFN_WDFREQUESTRETRIEVEUNSAFEUSEROUTPUTBUFFER)(
1345     _In_
1346     PWDF_DRIVER_GLOBALS DriverGlobals,
1347     _In_
1348     WDFREQUEST Request,
1349     _In_
1350     size_t MinimumRequiredLength,
1351     _Outptr_result_bytebuffer_maybenull_(*Length)
1352     PVOID* OutputBuffer,
1353     _Out_opt_
1354     size_t* Length
1355     );
1356 
1357 _Must_inspect_result_
_IRQL_requires_max_(PASSIVE_LEVEL)1358 _IRQL_requires_max_(PASSIVE_LEVEL)
1359 FORCEINLINE
1360 NTSTATUS
1361 WdfRequestRetrieveUnsafeUserOutputBuffer(
1362     _In_
1363     WDFREQUEST Request,
1364     _In_
1365     size_t MinimumRequiredLength,
1366     _Outptr_result_bytebuffer_maybenull_(*Length)
1367     PVOID* OutputBuffer,
1368     _Out_opt_
1369     size_t* Length
1370     )
1371 {
1372     return ((PFN_WDFREQUESTRETRIEVEUNSAFEUSEROUTPUTBUFFER) WdfFunctions[WdfRequestRetrieveUnsafeUserOutputBufferTableIndex])(WdfDriverGlobals, Request, MinimumRequiredLength, OutputBuffer, Length);
1373 }
1374 
1375 //
1376 // WDF Function: WdfRequestSetInformation
1377 //
1378 typedef
1379 _IRQL_requires_max_(DISPATCH_LEVEL)
1380 WDFAPI
1381 VOID
1382 (STDCALL *PFN_WDFREQUESTSETINFORMATION)(
1383     _In_
1384     PWDF_DRIVER_GLOBALS DriverGlobals,
1385     _In_
1386     WDFREQUEST Request,
1387     _In_
1388     ULONG_PTR Information
1389     );
1390 
_IRQL_requires_max_(DISPATCH_LEVEL)1391 _IRQL_requires_max_(DISPATCH_LEVEL)
1392 FORCEINLINE
1393 VOID
1394 WdfRequestSetInformation(
1395     _In_
1396     WDFREQUEST Request,
1397     _In_
1398     ULONG_PTR Information
1399     )
1400 {
1401     ((PFN_WDFREQUESTSETINFORMATION) WdfFunctions[WdfRequestSetInformationTableIndex])(WdfDriverGlobals, Request, Information);
1402 }
1403 
1404 //
1405 // WDF Function: WdfRequestGetInformation
1406 //
1407 typedef
1408 _IRQL_requires_max_(DISPATCH_LEVEL)
1409 WDFAPI
1410 ULONG_PTR
1411 (STDCALL *PFN_WDFREQUESTGETINFORMATION)(
1412     _In_
1413     PWDF_DRIVER_GLOBALS DriverGlobals,
1414     _In_
1415     WDFREQUEST Request
1416     );
1417 
_IRQL_requires_max_(DISPATCH_LEVEL)1418 _IRQL_requires_max_(DISPATCH_LEVEL)
1419 FORCEINLINE
1420 ULONG_PTR
1421 WdfRequestGetInformation(
1422     _In_
1423     WDFREQUEST Request
1424     )
1425 {
1426     return ((PFN_WDFREQUESTGETINFORMATION) WdfFunctions[WdfRequestGetInformationTableIndex])(WdfDriverGlobals, Request);
1427 }
1428 
1429 //
1430 // WDF Function: WdfRequestGetFileObject
1431 //
1432 typedef
1433 _IRQL_requires_max_(DISPATCH_LEVEL)
1434 WDFAPI
1435 WDFFILEOBJECT
1436 (STDCALL *PFN_WDFREQUESTGETFILEOBJECT)(
1437     _In_
1438     PWDF_DRIVER_GLOBALS DriverGlobals,
1439     _In_
1440     WDFREQUEST Request
1441     );
1442 
_IRQL_requires_max_(DISPATCH_LEVEL)1443 _IRQL_requires_max_(DISPATCH_LEVEL)
1444 FORCEINLINE
1445 WDFFILEOBJECT
1446 WdfRequestGetFileObject(
1447     _In_
1448     WDFREQUEST Request
1449     )
1450 {
1451     return ((PFN_WDFREQUESTGETFILEOBJECT) WdfFunctions[WdfRequestGetFileObjectTableIndex])(WdfDriverGlobals, Request);
1452 }
1453 
1454 //
1455 // WDF Function: WdfRequestProbeAndLockUserBufferForRead
1456 //
1457 typedef
1458 _Must_inspect_result_
1459 _IRQL_requires_max_(PASSIVE_LEVEL)
1460 WDFAPI
1461 NTSTATUS
1462 (STDCALL *PFN_WDFREQUESTPROBEANDLOCKUSERBUFFERFORREAD)(
1463     _In_
1464     PWDF_DRIVER_GLOBALS DriverGlobals,
1465     _In_
1466     WDFREQUEST Request,
1467     _In_reads_bytes_(Length)
1468     PVOID Buffer,
1469     _In_
1470     size_t Length,
1471     _Out_
1472     WDFMEMORY* MemoryObject
1473     );
1474 
1475 _Must_inspect_result_
_IRQL_requires_max_(PASSIVE_LEVEL)1476 _IRQL_requires_max_(PASSIVE_LEVEL)
1477 FORCEINLINE
1478 NTSTATUS
1479 WdfRequestProbeAndLockUserBufferForRead(
1480     _In_
1481     WDFREQUEST Request,
1482     _In_reads_bytes_(Length)
1483     PVOID Buffer,
1484     _In_
1485     size_t Length,
1486     _Out_
1487     WDFMEMORY* MemoryObject
1488     )
1489 {
1490     return ((PFN_WDFREQUESTPROBEANDLOCKUSERBUFFERFORREAD) WdfFunctions[WdfRequestProbeAndLockUserBufferForReadTableIndex])(WdfDriverGlobals, Request, Buffer, Length, MemoryObject);
1491 }
1492 
1493 //
1494 // WDF Function: WdfRequestProbeAndLockUserBufferForWrite
1495 //
1496 typedef
1497 _Must_inspect_result_
1498 _IRQL_requires_max_(PASSIVE_LEVEL)
1499 WDFAPI
1500 NTSTATUS
1501 (STDCALL *PFN_WDFREQUESTPROBEANDLOCKUSERBUFFERFORWRITE)(
1502     _In_
1503     PWDF_DRIVER_GLOBALS DriverGlobals,
1504     _In_
1505     WDFREQUEST Request,
1506     _In_reads_bytes_(Length)
1507     PVOID Buffer,
1508     _In_
1509     size_t Length,
1510     _Out_
1511     WDFMEMORY* MemoryObject
1512     );
1513 
1514 _Must_inspect_result_
_IRQL_requires_max_(PASSIVE_LEVEL)1515 _IRQL_requires_max_(PASSIVE_LEVEL)
1516 FORCEINLINE
1517 NTSTATUS
1518 WdfRequestProbeAndLockUserBufferForWrite(
1519     _In_
1520     WDFREQUEST Request,
1521     _In_reads_bytes_(Length)
1522     PVOID Buffer,
1523     _In_
1524     size_t Length,
1525     _Out_
1526     WDFMEMORY* MemoryObject
1527     )
1528 {
1529     return ((PFN_WDFREQUESTPROBEANDLOCKUSERBUFFERFORWRITE) WdfFunctions[WdfRequestProbeAndLockUserBufferForWriteTableIndex])(WdfDriverGlobals, Request, Buffer, Length, MemoryObject);
1530 }
1531 
1532 //
1533 // WDF Function: WdfRequestGetRequestorMode
1534 //
1535 typedef
1536 _IRQL_requires_max_(DISPATCH_LEVEL)
1537 WDFAPI
1538 KPROCESSOR_MODE
1539 (STDCALL *PFN_WDFREQUESTGETREQUESTORMODE)(
1540     _In_
1541     PWDF_DRIVER_GLOBALS DriverGlobals,
1542     _In_
1543     WDFREQUEST Request
1544     );
1545 
_IRQL_requires_max_(DISPATCH_LEVEL)1546 _IRQL_requires_max_(DISPATCH_LEVEL)
1547 FORCEINLINE
1548 KPROCESSOR_MODE
1549 WdfRequestGetRequestorMode(
1550     _In_
1551     WDFREQUEST Request
1552     )
1553 {
1554     return ((PFN_WDFREQUESTGETREQUESTORMODE) WdfFunctions[WdfRequestGetRequestorModeTableIndex])(WdfDriverGlobals, Request);
1555 }
1556 
1557 //
1558 // WDF Function: WdfRequestForwardToIoQueue
1559 //
1560 typedef
1561 _Must_inspect_result_
1562 _IRQL_requires_max_(DISPATCH_LEVEL)
1563 WDFAPI
1564 NTSTATUS
1565 (STDCALL *PFN_WDFREQUESTFORWARDTOIOQUEUE)(
1566     _In_
1567     PWDF_DRIVER_GLOBALS DriverGlobals,
1568     _In_
1569     WDFREQUEST Request,
1570     _In_
1571     WDFQUEUE DestinationQueue
1572     );
1573 
1574 _Must_inspect_result_
_IRQL_requires_max_(DISPATCH_LEVEL)1575 _IRQL_requires_max_(DISPATCH_LEVEL)
1576 FORCEINLINE
1577 NTSTATUS
1578 WdfRequestForwardToIoQueue(
1579     _In_
1580     WDFREQUEST Request,
1581     _In_
1582     WDFQUEUE DestinationQueue
1583     )
1584 {
1585     return ((PFN_WDFREQUESTFORWARDTOIOQUEUE) WdfFunctions[WdfRequestForwardToIoQueueTableIndex])(WdfDriverGlobals, Request, DestinationQueue);
1586 }
1587 
1588 //
1589 // WDF Function: WdfRequestGetIoQueue
1590 //
1591 typedef
1592 _IRQL_requires_max_(DISPATCH_LEVEL)
1593 WDFAPI
1594 WDFQUEUE
1595 (STDCALL *PFN_WDFREQUESTGETIOQUEUE)(
1596     _In_
1597     PWDF_DRIVER_GLOBALS DriverGlobals,
1598     _In_
1599     WDFREQUEST Request
1600     );
1601 
_IRQL_requires_max_(DISPATCH_LEVEL)1602 _IRQL_requires_max_(DISPATCH_LEVEL)
1603 FORCEINLINE
1604 WDFQUEUE
1605 WdfRequestGetIoQueue(
1606     _In_
1607     WDFREQUEST Request
1608     )
1609 {
1610     return ((PFN_WDFREQUESTGETIOQUEUE) WdfFunctions[WdfRequestGetIoQueueTableIndex])(WdfDriverGlobals, Request);
1611 }
1612 
1613 //
1614 // WDF Function: WdfRequestRequeue
1615 //
1616 typedef
1617 _Must_inspect_result_
1618 _IRQL_requires_max_(DISPATCH_LEVEL)
1619 WDFAPI
1620 NTSTATUS
1621 (STDCALL *PFN_WDFREQUESTREQUEUE)(
1622     _In_
1623     PWDF_DRIVER_GLOBALS DriverGlobals,
1624     _In_
1625     WDFREQUEST Request
1626     );
1627 
1628 _Must_inspect_result_
_IRQL_requires_max_(DISPATCH_LEVEL)1629 _IRQL_requires_max_(DISPATCH_LEVEL)
1630 FORCEINLINE
1631 NTSTATUS
1632 WdfRequestRequeue(
1633     _In_
1634     WDFREQUEST Request
1635     )
1636 {
1637     return ((PFN_WDFREQUESTREQUEUE) WdfFunctions[WdfRequestRequeueTableIndex])(WdfDriverGlobals, Request);
1638 }
1639 
1640 //
1641 // WDF Function: WdfRequestStopAcknowledge
1642 //
1643 typedef
1644 _IRQL_requires_max_(DISPATCH_LEVEL)
1645 WDFAPI
1646 VOID
1647 (STDCALL *PFN_WDFREQUESTSTOPACKNOWLEDGE)(
1648     _In_
1649     PWDF_DRIVER_GLOBALS DriverGlobals,
1650     _In_
1651     WDFREQUEST Request,
1652     _In_
1653     BOOLEAN Requeue
1654     );
1655 
_IRQL_requires_max_(DISPATCH_LEVEL)1656 _IRQL_requires_max_(DISPATCH_LEVEL)
1657 FORCEINLINE
1658 VOID
1659 WdfRequestStopAcknowledge(
1660     _In_
1661     WDFREQUEST Request,
1662     _In_
1663     BOOLEAN Requeue
1664     )
1665 {
1666     ((PFN_WDFREQUESTSTOPACKNOWLEDGE) WdfFunctions[WdfRequestStopAcknowledgeTableIndex])(WdfDriverGlobals, Request, Requeue);
1667 }
1668 
1669 //
1670 // WDF Function: WdfRequestWdmGetIrp
1671 //
1672 typedef
1673 _IRQL_requires_max_(DISPATCH_LEVEL)
1674 WDFAPI
1675 PIRP
1676 (STDCALL *PFN_WDFREQUESTWDMGETIRP)(
1677     _In_
1678     PWDF_DRIVER_GLOBALS DriverGlobals,
1679     _In_
1680     WDFREQUEST Request
1681     );
1682 
_IRQL_requires_max_(DISPATCH_LEVEL)1683 _IRQL_requires_max_(DISPATCH_LEVEL)
1684 FORCEINLINE
1685 PIRP
1686 WdfRequestWdmGetIrp(
1687     _In_
1688     WDFREQUEST Request
1689     )
1690 {
1691     return ((PFN_WDFREQUESTWDMGETIRP) WdfFunctions[WdfRequestWdmGetIrpTableIndex])(WdfDriverGlobals, Request);
1692 }
1693 
1694 //
1695 // WDF Function: WdfRequestIsReserved
1696 //
1697 typedef
1698 _IRQL_requires_max_(DISPATCH_LEVEL)
1699 WDFAPI
1700 BOOLEAN
1701 (STDCALL *PFN_WDFREQUESTISRESERVED)(
1702     _In_
1703     PWDF_DRIVER_GLOBALS DriverGlobals,
1704     _In_
1705     WDFREQUEST Request
1706     );
1707 
_IRQL_requires_max_(DISPATCH_LEVEL)1708 _IRQL_requires_max_(DISPATCH_LEVEL)
1709 FORCEINLINE
1710 BOOLEAN
1711 WdfRequestIsReserved(
1712     _In_
1713     WDFREQUEST Request
1714     )
1715 {
1716     return ((PFN_WDFREQUESTISRESERVED) WdfFunctions[WdfRequestIsReservedTableIndex])(WdfDriverGlobals, Request);
1717 }
1718 
1719 //
1720 // WDF Function: WdfRequestForwardToParentDeviceIoQueue
1721 //
1722 typedef
1723 _Must_inspect_result_
1724 _IRQL_requires_max_(DISPATCH_LEVEL)
1725 WDFAPI
1726 NTSTATUS
1727 (STDCALL *PFN_WDFREQUESTFORWARDTOPARENTDEVICEIOQUEUE)(
1728     _In_
1729     PWDF_DRIVER_GLOBALS DriverGlobals,
1730     _In_
1731     WDFREQUEST Request,
1732     _In_
1733     WDFQUEUE ParentDeviceQueue,
1734     _In_
1735     PWDF_REQUEST_FORWARD_OPTIONS ForwardOptions
1736     );
1737 
1738 _Must_inspect_result_
_IRQL_requires_max_(DISPATCH_LEVEL)1739 _IRQL_requires_max_(DISPATCH_LEVEL)
1740 FORCEINLINE
1741 NTSTATUS
1742 WdfRequestForwardToParentDeviceIoQueue(
1743     _In_
1744     WDFREQUEST Request,
1745     _In_
1746     WDFQUEUE ParentDeviceQueue,
1747     _In_
1748     PWDF_REQUEST_FORWARD_OPTIONS ForwardOptions
1749     )
1750 {
1751     return ((PFN_WDFREQUESTFORWARDTOPARENTDEVICEIOQUEUE) WdfFunctions[WdfRequestForwardToParentDeviceIoQueueTableIndex])(WdfDriverGlobals, Request, ParentDeviceQueue, ForwardOptions);
1752 }
1753 
1754 
1755 
1756 
1757 
1758 
1759 
1760 
1761 
1762 
1763 
1764 #endif // (NTDDI_VERSION >= NTDDI_WIN2K)
1765 
1766 
1767 WDF_EXTERN_C_END
1768 
1769 #endif // _WDFREQUEST_H_
1770 
1771