ReactOS  0.4.15-dev-2956-g61e7ea5
fxrequest.cpp File Reference
#include "coreprivshared.hpp"
Include dependency graph for fxrequest.cpp:

Go to the source code of this file.

Functions

VOID FX_VF_METHOD (FxRequest, VerifyCompleteInternal)(_In_ PFX_DRIVER_GLOBALS FxDriverGlobals
 
 PAGED_CODE_LOCKED ()
 
 if (GetDriverGlobals() ->FxVerifierIO)
 
 if ((m_VerifierFlags &FXREQUEST_FLAG_DRIVER_CANCELABLE) &&(m_VerifierFlags &FXREQUEST_FLAG_CANCELLED)==0x0)
 
 switch (m_Irp.GetMajorFunction())
 
 if (validateLength &&NT_SUCCESS(Status) &&m_Irp.GetInformation() > length)
 
 Unlock (irql)
 
VOID FX_VF_METHOD (FxRequest, VerifyPreProcessSendAndForget)(_In_ PFX_DRIVER_GLOBALS FxDriverGlobals)
 
_Must_inspect_result_ NTSTATUS FX_VF_METHOD (FxRequest, VerifyInsertIrpQueue)(_In_ PFX_DRIVER_GLOBALS FxDriverGlobals
 
 if (m_IrpQueue !=NULL)
 
_Must_inspect_result_ NTSTATUS FX_VF_METHOD (FxRequest, VerifyProbeAndLock)(_In_ PFX_DRIVER_GLOBALS FxDriverGlobals)
 
_Must_inspect_result_ NTSTATUS FX_VF_METHOD (FxRequest, VerifyStopAcknowledge)(_In_ PFX_DRIVER_GLOBALS FxDriverGlobals
 
 if (!NT_SUCCESS(status))
 
 if (m_Completed==FALSE &&Requeue)
 
VOID FX_VF_METHOD (FxRequest, VerifierBreakpoint_RequestEarlyDisposeDeferred)(_In_ PFX_DRIVER_GLOBALS FxDriverGlobals)
 
_Must_inspect_result_ NTSTATUS FX_VF_METHOD (FxRequest, VerifyRequestIsDriverOwned)(_In_ PFX_DRIVER_GLOBALS FxDriverGlobals)
 
_Must_inspect_result_ NTSTATUS FX_VF_METHOD (FxRequest, VerifyRequestIsCancelable)(_In_ PFX_DRIVER_GLOBALS FxDriverGlobals)
 
_Must_inspect_result_ NTSTATUS FX_VF_METHOD (FxRequest, VerifyRequestIsNotCancelable)(_In_ PFX_DRIVER_GLOBALS FxDriverGlobals)
 
_Must_inspect_result_ NTSTATUS FX_VF_METHOD (FxRequest, VerifyRequestIsInCallerContext)(_In_ PFX_DRIVER_GLOBALS FxDriverGlobals)
 
_Must_inspect_result_ NTSTATUS FX_VF_METHOD (FxRequest, VerifyRequestIsInEvtIoStopContext)(_In_ PFX_DRIVER_GLOBALS FxDriverGlobals)
 
_Must_inspect_result_ NTSTATUS FX_VF_METHOD (FxRequest, VerifyRequestIsNotCompleted)(_In_ PFX_DRIVER_GLOBALS FxDriverGlobals)
 
_Must_inspect_result_ NTSTATUS FX_VF_METHOD (FxRequest, VerifyRequestIsTagRequest)(_In_ PFX_DRIVER_GLOBALS FxDriverGlobals)
 
_Must_inspect_result_ NTSTATUS FX_VF_METHOD (FxRequest, VerifyRequestIsAllocatedFromIo)(_In_ PFX_DRIVER_GLOBALS FxDriverGlobals)
 
_Must_inspect_result_ NTSTATUS FX_VF_METHOD (FxRequest, VerifyRequestIsCurrentStackValid)(_In_ PFX_DRIVER_GLOBALS FxDriverGlobals)
 
_Must_inspect_result_ NTSTATUS FX_VF_METHOD (FxRequest, VerifyRequestCanBeCompleted)(_In_ PFX_DRIVER_GLOBALS FxDriverGlobals)
 

Variables

VOID _In_ NTSTATUS Status
 
ULONG length = 0
 
KIRQL irql
 
BOOLEAN validateLength = FALSE
 
 else
 
 m_Completed = TRUE
 
_Must_inspect_result_ NTSTATUS _In_ FxIrpQueueIrpQueue
 
 status = VerifyRequestIsNotCompleted(FxDriverGlobals)
 
Done __pad0__
 
_Must_inspect_result_ NTSTATUS _In_ BOOLEAN Requeue
 
Done __pad1__
 

Function Documentation

◆ FX_VF_METHOD() [1/16]

VOID FX_VF_METHOD ( FxRequest  ,
VerifyCompleteInternal   
)

◆ FX_VF_METHOD() [2/16]

VOID FX_VF_METHOD ( FxRequest  ,
VerifyPreProcessSendAndForget   
)

Definition at line 1056 of file fxrequest.cpp.

1059 {
1061 
1062  if (m_CompletionRoutine.m_Completion != NULL) {
1064  FxDriverGlobals, TRACE_LEVEL_ERROR, TRACINGREQUEST,
1065  "WDFREQUEST %p cannot send and forget will not execute completion "
1066  "routine %p",
1067  GetHandle(), m_CompletionRoutine.m_Completion);
1068 
1069  FxVerifierDbgBreakPoint(FxDriverGlobals);
1070 
1071 
1072 
1073 
1074 
1075 
1076 
1077 
1078  }
1079 
1080  //
1081  // You cannot fire and forget a create irp if we created a WDFFILEOBJECT
1082  // for it since you must post process the status of the create because
1083  // the create can fail in the driver to which we are sending the irp.
1084  //
1085  if ((m_Irp.GetMajorFunction() == IRP_MJ_CREATE)
1086  &&
1087  (FxFileObjectClassNormalize(GetDevice()->GetFileObjectClass()) !=
1089 
1091  FxDriverGlobals, TRACE_LEVEL_ERROR, TRACINGREQUEST,
1092  "WDFREQUEST %p cannot send and forget a create request which "
1093  "has a WDFFILEOBJECT created for it, it must have a completion "
1094  "routine and be post processsed", GetHandle());
1095 
1096  FxVerifierDbgBreakPoint(FxDriverGlobals);
1097  }
1098 }
#define GetHandle(h)
Definition: treelist.c:116
#define IRP_MJ_CREATE
Definition: rdpdr.c:44
PAGED_CODE_LOCKED()
#define TRACINGREQUEST
Definition: dbgtrace.h:65
WDF_FILEOBJECT_CLASS __inline FxFileObjectClassNormalize(__in WDF_FILEOBJECT_CLASS FileObjectClass)
Definition: fxdevice.hpp:103
return pList GetDevice()
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
#define NULL
Definition: types.h:112
FxVerifierDbgBreakPoint(pFxDriverGlobals)

◆ FX_VF_METHOD() [3/16]

_Must_inspect_result_ NTSTATUS FX_VF_METHOD ( FxRequest  ,
VerifyInsertIrpQueue   
)

◆ FX_VF_METHOD() [4/16]

_Must_inspect_result_ NTSTATUS FX_VF_METHOD ( FxRequest  ,
VerifyProbeAndLock   
)

Definition at line 2547 of file fxrequest.cpp.

2550 {
2552 
2554 
2555  MdEThread thread = m_Irp.GetThread();
2556 
2557  //
2558  // Some kernel mode drivers issue I/O without setting this
2559  //
2560  if (thread != NULL) {
2561  //
2562  // Currently DDK level headers don't let us reach into a threads
2563  // parent process, so we can't do the process level check, just
2564  // a thread level check.
2565  //
2566  if (m_Irp.GetRequestorMode() == UserMode && thread != Mx::GetCurrentEThread()) {
2568 
2569  // Error, wrong process context...
2571  FxDriverGlobals, TRACE_LEVEL_ERROR, TRACINGREQUEST,
2572  "Attempt to access user mode memory from the wrong process "
2573  "Irp->Tail.Overlay.Thread 0x%p, PsGetCurrentThread 0x%p, "
2574  "%!STATUS!", thread, Mx::GetCurrentEThread(), status);
2575 
2576  return status;
2577  }
2578  }
2579  else {
2580  // Irp->Thread should be issued for all user mode requests
2581  ASSERT(m_Irp.GetRequestorMode() == KernelMode);
2582  }
2583 
2584  return status;
2585 }
LONG NTSTATUS
Definition: precomp.h:26
status
Definition: fxrequest.cpp:1850
PAGED_CODE_LOCKED()
#define TRACINGREQUEST
Definition: dbgtrace.h:65
#define ASSERT(a)
Definition: mode.c:44
static HANDLE thread
Definition: service.c:33
static __inline MdEThread GetCurrentEThread()
Definition: mxgeneralkm.h:69
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
#define STATUS_ACCESS_VIOLATION
Definition: ntstatus.h:242
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
#define NULL
Definition: types.h:112
#define STATUS_SUCCESS
Definition: shellext.h:65
Definition: ps.c:97

◆ FX_VF_METHOD() [5/16]

_Must_inspect_result_ NTSTATUS FX_VF_METHOD ( FxRequest  ,
VerifyStopAcknowledge   
)

◆ FX_VF_METHOD() [6/16]

VOID FX_VF_METHOD ( FxRequest  ,
VerifierBreakpoint_RequestEarlyDisposeDeferred   
)

Definition at line 2743 of file fxrequest.cpp.

2746 {
2748 
2749  //
2750  // For backwards compatibility break only if WDF is v1.11 or above, or if
2751  // the developer/client enabled these tests on down-level drivers.
2752  //
2753  if (FxDriverGlobals->IsVerificationEnabled(1, 11, OkForDownLevel)) {
2755  FxDriverGlobals, TRACE_LEVEL_ERROR, TRACINGREQUEST,
2756  "WDFREQUEST %p deferred the dispose operation. This normally "
2757  "indicates that at least one of its children asked for passive "
2758  "level disposal. This is not supported.", GetHandle());
2759 
2760  FxVerifierDbgBreakPoint(FxDriverGlobals);
2761  }
2762 }
#define GetHandle(h)
Definition: treelist.c:116
PAGED_CODE_LOCKED()
#define TRACINGREQUEST
Definition: dbgtrace.h:65
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
FxVerifierDbgBreakPoint(pFxDriverGlobals)

◆ FX_VF_METHOD() [7/16]

Definition at line 2766 of file fxrequest.cpp.

2769 {
2770  NTSTATUS status;
2771 
2773 
2774  if ((m_VerifierFlags & FXREQUEST_FLAG_DRIVER_OWNED) == 0) {
2776 
2778  FxDriverGlobals, TRACE_LEVEL_ERROR, TRACINGREQUEST,
2779  "WDFREQUEST 0x%p is not owned by the driver, %!STATUS!",
2780  GetHandle(), status);
2781 
2782  //
2783  // See if it's a tag request, since this could be a common mistake
2784  //
2785  if (m_VerifierFlags & FXREQUEST_FLAG_TAG_REQUEST) {
2787  FxDriverGlobals, TRACE_LEVEL_ERROR, TRACINGREQUEST,
2788  "WDFREQUEST 0x%p has been "
2789  "used as a TagRequest in WdfIoQueueFindRequest. "
2790  "A TagRequest cannot be used until it is retrieved "
2791  "by WdfIoQueueRetrieveFoundRequest",
2792  GetHandle());
2793  }
2794 
2795  FxVerifierDbgBreakPoint(FxDriverGlobals);
2796  }
2797  else {
2799  }
2800 
2801  return status;
2802 }
#define GetHandle(h)
Definition: treelist.c:116
LONG NTSTATUS
Definition: precomp.h:26
#define STATUS_INVALID_DEVICE_REQUEST
Definition: udferr_usr.h:138
status
Definition: fxrequest.cpp:1850
PAGED_CODE_LOCKED()
#define TRACINGREQUEST
Definition: dbgtrace.h:65
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
#define STATUS_SUCCESS
Definition: shellext.h:65
FxVerifierDbgBreakPoint(pFxDriverGlobals)
Definition: ps.c:97

◆ FX_VF_METHOD() [8/16]

_Must_inspect_result_ NTSTATUS FX_VF_METHOD ( FxRequest  ,
VerifyRequestIsCancelable   
)

Definition at line 2806 of file fxrequest.cpp.

2809 {
2810  NTSTATUS status;
2811 
2813 
2814  if ((m_VerifierFlags & FXREQUEST_FLAG_DRIVER_CANCELABLE) == 0) {
2816 
2818  FxDriverGlobals, TRACE_LEVEL_ERROR, TRACINGREQUEST,
2819  "WDFREQUEST 0x%p is not cancelable, %!STATUS!",
2820  GetHandle(), status);
2821 
2822  FxVerifierDbgBreakPoint(FxDriverGlobals);
2823  }
2824  else {
2826  }
2827 
2828  return status;
2829 }
#define GetHandle(h)
Definition: treelist.c:116
LONG NTSTATUS
Definition: precomp.h:26
#define STATUS_INVALID_DEVICE_REQUEST
Definition: udferr_usr.h:138
status
Definition: fxrequest.cpp:1850
PAGED_CODE_LOCKED()
#define TRACINGREQUEST
Definition: dbgtrace.h:65
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
#define STATUS_SUCCESS
Definition: shellext.h:65
FxVerifierDbgBreakPoint(pFxDriverGlobals)
Definition: ps.c:97

◆ FX_VF_METHOD() [9/16]

_Must_inspect_result_ NTSTATUS FX_VF_METHOD ( FxRequest  ,
VerifyRequestIsNotCancelable   
)

Definition at line 2833 of file fxrequest.cpp.

2836 {
2837  NTSTATUS status;
2838 
2840 
2841  if (m_VerifierFlags & FXREQUEST_FLAG_DRIVER_CANCELABLE) {
2843 
2845  FxDriverGlobals, TRACE_LEVEL_ERROR, TRACINGREQUEST,
2846  "WDFREQUEST 0x%p should be unmarked cancelable by calling "
2847  "WdfRequestUnmarkCancelable, %!STATUS!",
2848  GetHandle(), status);
2849 
2850  FxVerifierDbgBreakPoint(FxDriverGlobals);
2851  }
2852  else {
2854  }
2855 
2856  return status;
2857 }
#define GetHandle(h)
Definition: treelist.c:116
LONG NTSTATUS
Definition: precomp.h:26
#define STATUS_INVALID_DEVICE_REQUEST
Definition: udferr_usr.h:138
status
Definition: fxrequest.cpp:1850
PAGED_CODE_LOCKED()
#define TRACINGREQUEST
Definition: dbgtrace.h:65
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
#define STATUS_SUCCESS
Definition: shellext.h:65
FxVerifierDbgBreakPoint(pFxDriverGlobals)
Definition: ps.c:97

◆ FX_VF_METHOD() [10/16]

_Must_inspect_result_ NTSTATUS FX_VF_METHOD ( FxRequest  ,
VerifyRequestIsInCallerContext   
)

Definition at line 2861 of file fxrequest.cpp.

2864 {
2865  NTSTATUS status;
2866 
2868 
2869  if ((m_VerifierFlags & FXREQUEST_FLAG_DRIVER_INPROCESS_CONTEXT) == 0) {
2871 
2873  FxDriverGlobals, TRACE_LEVEL_ERROR, TRACINGREQUEST,
2874  "This call is valid only in EvtIoInCallerContext callback, "
2875  "WDFREQUEST 0x%p, %!STATUS!", GetHandle(), status);
2876 
2877  FxVerifierDbgBreakPoint(FxDriverGlobals);
2878  }
2879  else {
2881  }
2882 
2883  return status;
2884 }
#define GetHandle(h)
Definition: treelist.c:116
LONG NTSTATUS
Definition: precomp.h:26
#define STATUS_INVALID_DEVICE_REQUEST
Definition: udferr_usr.h:138
status
Definition: fxrequest.cpp:1850
PAGED_CODE_LOCKED()
#define TRACINGREQUEST
Definition: dbgtrace.h:65
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
#define STATUS_SUCCESS
Definition: shellext.h:65
FxVerifierDbgBreakPoint(pFxDriverGlobals)
Definition: ps.c:97

◆ FX_VF_METHOD() [11/16]

_Must_inspect_result_ NTSTATUS FX_VF_METHOD ( FxRequest  ,
VerifyRequestIsInEvtIoStopContext   
)

Definition at line 2888 of file fxrequest.cpp.

2891 {
2892  NTSTATUS status;
2893 
2895 
2896  if ((m_VerifierFlags & FXREQUEST_FLAG_DRIVER_IN_EVTIOSTOP_CONTEXT) == 0) {
2898 
2900  FxDriverGlobals, TRACE_LEVEL_ERROR, TRACINGIO,
2901  "This call is valid only in EvtIoStop callback, "
2902  "WDFREQUEST 0x%p, %!STATUS!", GetHandle(), status);
2903 
2904  FxVerifierDbgBreakPoint(FxDriverGlobals);
2905  }
2906  else {
2908  }
2909 
2910  return status;
2911 }
#define GetHandle(h)
Definition: treelist.c:116
LONG NTSTATUS
Definition: precomp.h:26
#define STATUS_INVALID_DEVICE_REQUEST
Definition: udferr_usr.h:138
status
Definition: fxrequest.cpp:1850
PAGED_CODE_LOCKED()
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
#define STATUS_SUCCESS
Definition: shellext.h:65
#define TRACINGIO
Definition: dbgtrace.h:66
FxVerifierDbgBreakPoint(pFxDriverGlobals)
Definition: ps.c:97

◆ FX_VF_METHOD() [12/16]

_Must_inspect_result_ NTSTATUS FX_VF_METHOD ( FxRequest  ,
VerifyRequestIsNotCompleted   
)

Definition at line 2915 of file fxrequest.cpp.

2918 {
2919  NTSTATUS status;
2920 
2922 
2923  if (m_Completed) {
2925 
2927  FxDriverGlobals, TRACE_LEVEL_ERROR, TRACINGREQUEST,
2928  "WDFREQUEST 0x%p is already completed, %!STATUS!",
2929  GetHandle(), status);
2930 
2931  FxVerifierDbgBreakPoint(FxDriverGlobals);
2932  }
2933  else {
2935  }
2936 
2937  return status;
2938 }
#define GetHandle(h)
Definition: treelist.c:116
LONG NTSTATUS
Definition: precomp.h:26
status
Definition: fxrequest.cpp:1850
PAGED_CODE_LOCKED()
#define TRACINGREQUEST
Definition: dbgtrace.h:65
m_Completed
Definition: fxrequest.cpp:509
#define STATUS_INTERNAL_ERROR
Definition: ntstatus.h:465
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
#define STATUS_SUCCESS
Definition: shellext.h:65
FxVerifierDbgBreakPoint(pFxDriverGlobals)
Definition: ps.c:97

◆ FX_VF_METHOD() [13/16]

_Must_inspect_result_ NTSTATUS FX_VF_METHOD ( FxRequest  ,
VerifyRequestIsTagRequest   
)

Definition at line 2942 of file fxrequest.cpp.

2945 {
2946  NTSTATUS status;
2947 
2949 
2950  //
2951  // A request that has been marked as a tag request can be retrieved
2952  // by the driver by calling WdfIoQueueRetrieveNextRequest instead of
2953  // WdfIoQueueRetrieveFoundRequest. Some drivers use multiple threads
2954  // to scan the queue, not the best design but allowed. This means that
2955  // it is possible for one thread to remove and complete a request that is
2956  // used as a tag by another thread.
2957  //
2958  if (FALSE == m_Completed && (0x0 == (m_VerifierFlags &
2960 
2963  "Request 0x%p is not returned by WdfIoQueueFindRequest, "
2964  "%!STATUS!", GetHandle(), status);
2965  FxVerifierDbgBreakPoint(FxDriverGlobals);
2966  }
2967  else {
2969  }
2970 
2971  return status;
2972 }
#define GetHandle(h)
Definition: treelist.c:116
GLint x0
Definition: linetemp.h:95
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
status
Definition: fxrequest.cpp:1850
PAGED_CODE_LOCKED()
m_Completed
Definition: fxrequest.cpp:509
#define FALSE
Definition: types.h:117
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
#define STATUS_SUCCESS
Definition: shellext.h:65
#define TRACINGIO
Definition: dbgtrace.h:66
FxVerifierDbgBreakPoint(pFxDriverGlobals)
Definition: ps.c:97

◆ FX_VF_METHOD() [14/16]

_Must_inspect_result_ NTSTATUS FX_VF_METHOD ( FxRequest  ,
VerifyRequestIsAllocatedFromIo   
)

Definition at line 2976 of file fxrequest.cpp.

2979 {
2980  NTSTATUS status;
2981 
2983 
2984  if (IsAllocatedFromIo() == FALSE) {
2987  "Request 0x%p was not allocated for an incoming IRP, "
2988  "%!STATUS!", GetHandle(), status);
2989  FxVerifierDbgBreakPoint(FxDriverGlobals);
2990 
2991  } else {
2993  }
2994 
2995  return status;
2996 }
#define GetHandle(h)
Definition: treelist.c:116
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
status
Definition: fxrequest.cpp:1850
PAGED_CODE_LOCKED()
#define FALSE
Definition: types.h:117
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
#define STATUS_SUCCESS
Definition: shellext.h:65
#define TRACINGIO
Definition: dbgtrace.h:66
FxVerifierDbgBreakPoint(pFxDriverGlobals)
Definition: ps.c:97

◆ FX_VF_METHOD() [15/16]

_Must_inspect_result_ NTSTATUS FX_VF_METHOD ( FxRequest  ,
VerifyRequestIsCurrentStackValid   
)

Definition at line 3000 of file fxrequest.cpp.

3003 {
3004  NTSTATUS status;
3005  MdIrp irp;
3006 
3008 
3009  //
3010  //Make sure there is an IRP.
3011  //
3012  irp = GetFxIrp()->GetIrp();
3013  if (NULL == irp) {
3016  "WDFREQUEST %p doesn't have an IRP, %!STATUS!",
3017  GetHandle(), status);
3018  FxVerifierDbgBreakPoint(FxDriverGlobals);
3019  goto Done;
3020  }
3021 
3022  //
3023  // Validate the IRP's stack location values.
3024  //
3025  if (m_Irp.IsCurrentIrpStackLocationValid() == FALSE) {
3028  "IRP %p of WDFREQUEST %p doesn't have a valid"
3029  " stack location, %!STATUS!",
3030  irp, GetHandle(), status);
3031  FxVerifierDbgBreakPoint(FxDriverGlobals);
3032  goto Done;
3033  }
3034 
3036 
3037 Done:
3038  return status;
3039 }
#define GetHandle(h)
Definition: treelist.c:116
LONG NTSTATUS
Definition: precomp.h:26
pRequest GetFxIrp() -> GetIoIrp() ->SetUserModeDriverInitiatedIo(IsUserModeDriverInitiated)
#define STATUS_INVALID_DEVICE_REQUEST
Definition: udferr_usr.h:138
status
Definition: fxrequest.cpp:1850
PAGED_CODE_LOCKED()
#define TRACINGREQUEST
Definition: dbgtrace.h:65
#define FALSE
Definition: types.h:117
IWudfIrp * MdIrp
Definition: mxum.h:103
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
#define NULL
Definition: types.h:112
#define STATUS_SUCCESS
Definition: shellext.h:65
FxIrp * irp
FxVerifierDbgBreakPoint(pFxDriverGlobals)
Definition: ps.c:97

◆ FX_VF_METHOD() [16/16]

_Must_inspect_result_ NTSTATUS FX_VF_METHOD ( FxRequest  ,
VerifyRequestCanBeCompleted   
)

Definition at line 3043 of file fxrequest.cpp.

3046 {
3047  NTSTATUS status;
3048 
3050 
3051  if (GetDriverGlobals()->IsVersionGreaterThanOrEqualTo(1,11) == FALSE) {
3052  status = VerifyRequestIsAllocatedFromIo(FxDriverGlobals);
3053  goto Done;
3054  }
3055 
3056  //
3057  // Validate the IRP's stack location.
3058  //
3059  status = VerifyRequestIsCurrentStackValid(FxDriverGlobals);
3060  if (!NT_SUCCESS(status)) {
3061  goto Done;
3062  }
3063 
3064  //
3065  // Note: There is no guarantees that the request has a completion routine in the current
3066  // IRP stack location; thus we cannot check for it.
3067  //
3068 
3069  //
3070  // Make sure this request can be completed.
3071  //
3072  if (IsCanComplete() == FALSE) {
3075  "IRP %p of WDFREQUEST %p cannot be completed, "
3076  "%!STATUS!",
3077  GetFxIrp()->GetIrp(), GetHandle(), status);
3078  FxVerifierDbgBreakPoint(FxDriverGlobals);
3079  goto Done;
3080  }
3081 
3083 
3084 Done:
3085  return status;
3086 }
#define GetHandle(h)
Definition: treelist.c:116
LONG NTSTATUS
Definition: precomp.h:26
pRequest GetFxIrp() -> GetIoIrp() ->SetUserModeDriverInitiatedIo(IsUserModeDriverInitiated)
#define STATUS_INVALID_DEVICE_REQUEST
Definition: udferr_usr.h:138
status
Definition: fxrequest.cpp:1850
PAGED_CODE_LOCKED()
#define TRACINGREQUEST
Definition: dbgtrace.h:65
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
#define STATUS_SUCCESS
Definition: shellext.h:65
FxVerifierDbgBreakPoint(pFxDriverGlobals)
Definition: ps.c:97

◆ if() [1/6]

if ( GetDriverGlobals() ->  FxVerifierIO)

Definition at line 386 of file fxrequest.cpp.

386  {
387  (VOID) VerifyRequestIsNotCompleted(GetDriverGlobals());
388  } else {
#define VOID
Definition: acefi.h:82

◆ if() [2/6]

if ( (m_VerifierFlags &FXREQUEST_FLAG_DRIVER_CANCELABLE) &&(m_VerifierFlags &FXREQUEST_FLAG_CANCELLED = = 0x0)

Definition at line 393 of file fxrequest.cpp.

394  {
395 
396  //
397  // We could trace each sentence separate, but that takes up valuable
398  // room in the IFR. Instead, trace the entire "paragraph" as one
399  // message so that we have more room in the IFR.
400  //
402  GetDriverGlobals(), TRACE_LEVEL_ERROR, TRACINGREQUEST,
403  "Completing Cancelable WDFREQUEST %p. "
404 
405  "This results in a race condition in the device driver that can "
406  "cause double completions. "
407 
408  "Call WdfRequestUnmarkCancelable before WdfRequestComplete. "
409 
410  "If WdfRequestUnmarkCancelable returns STATUS_CANCELLED, "
411  "do not complete the request until the EvtIoCancel handler is called. "
412 
413  "The straightforward way to ensure this is to complete a canceled "
414  "request from the EvIoCancel callback.",
415 
416  GetHandle()
417  );
418 
419  FxVerifierDbgBreakPoint(GetDriverGlobals());
420 
421  }
#define GetHandle(h)
Definition: treelist.c:116
#define TRACINGREQUEST
Definition: dbgtrace.h:65
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
FxVerifierDbgBreakPoint(pFxDriverGlobals)

◆ if() [3/6]

if ( validateLength &&  NT_SUCCESSStatus) &&m_Irp.GetInformation(,
length   
)

Definition at line 480 of file fxrequest.cpp.

482  {
483 
485 
487  GetDriverGlobals(), TRACE_LEVEL_ERROR, TRACINGREQUEST,
488  "WDFREQUEST %p, MJ 0x%x, Information 0x%I64x is greater then "
489  "buffer length 0x%x", GetHandle(), m_Irp.GetMajorFunction(),
490  m_Irp.GetInformation(), length);
491 
492  data.Request = GetHandle();
493  data.Irp = reinterpret_cast<PIRP>(m_Irp.GetIrp());
494  data.OutputBufferLength = length;
495  data.Information = m_Irp.GetInformation();
496  data.MajorFunction = m_Irp.GetMajorFunction();
497 
499  GetDriverGlobals(),
502  (ULONG_PTR) &data
503  );
504 
505  // will not get here
506  }
#define GetHandle(h)
Definition: treelist.c:116
#define TRACINGREQUEST
Definition: dbgtrace.h:65
#define FxVerifierBugCheck(FxDriverGlobals, Error,...)
Definition: fxverifier.h:58
uint32_t ULONG_PTR
Definition: typedefs.h:65
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
ULONG length
Definition: fxrequest.cpp:378
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)

◆ if() [4/6]

if ( m_IrpQueue !  = NULL)

Definition at line 1831 of file fxrequest.cpp.

1831  {
1833 
1835  FxDriverGlobals, TRACE_LEVEL_ERROR, TRACINGREQUEST,
1836  "Already in FxIrpQueue 0x%p WDFREQUEST 0x%p %!STATUS!",
1837  IrpQueue, GetHandle(), status);
1838 
1839  FxVerifierDbgBreakPoint(FxDriverGlobals);
1840 
1841  goto Done;
1842  }
#define GetHandle(h)
Definition: treelist.c:116
#define TRACINGREQUEST
Definition: dbgtrace.h:65
#define STATUS_INTERNAL_ERROR
Definition: ntstatus.h:465
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
_Must_inspect_result_ NTSTATUS _In_ FxIrpQueue * IrpQueue
Definition: fxrequest.cpp:1823
FxVerifierDbgBreakPoint(pFxDriverGlobals)
Definition: ps.c:97

◆ if() [5/6]

if ( NT_SUCCESSstatus)

Definition at line 2606 of file fxrequest.cpp.

2606  {
2607  goto Done;
2608  }

◆ if() [6/6]

if ( m_Completed  = FALSE && Requeue)

Definition at line 2610 of file fxrequest.cpp.

2610  {
2611 
2612  // Make sure the driver owns the request
2613 
2614  status = VerifyRequestIsDriverOwned(FxDriverGlobals);
2615  if (!NT_SUCCESS(status)) {
2616  goto Done;
2617  }
2618 
2619  //
2620  // Can't re-enqueue a cancelable request
2621  //
2622  status = VerifyRequestIsNotCancelable(FxDriverGlobals);
2623  if (!NT_SUCCESS(status)) {
2624  goto Done;
2625  }
2626  }
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
VOID Request VerifyRequestIsDriverOwned(FxDriverGlobals)
Definition: ps.c:97

◆ PAGED_CODE_LOCKED()

PAGED_CODE_LOCKED ( )

Referenced by FX_VF_METHOD().

◆ switch()

switch ( m_Irp.  GetMajorFunction())

Definition at line 426 of file fxrequest.cpp.

426  {
427  case IRP_MJ_READ:
428  length = m_Irp.GetParameterReadLength();
430  break;
431 
432  case IRP_MJ_WRITE:
433  length = m_Irp.GetParameterWriteLength();
435  break;
436 
438  if (m_Irp.GetRequestorMode() == UserMode) {
439  length = m_Irp.GetParameterIoctlOutputBufferLength();
440 
441  if (length > 0) {
443  }
444  else {
445  //
446  // For an output length == 0, a driver can indicate the number
447  // of bytes used of the input buffer.
448  //
449  DO_NOTHING();
450  }
451  }
452  else {
453  //
454  // If the IOCTL came from kernel mode, the same reasoning applies
455  // here as for an internal IOCTL...we don't know deterministically
456  // how to find the output buffer length.
457  //
458  DO_NOTHING();
459  }
460  break;
461 
463  //
464  // Because the current stack location can use any part of the union
465  // (like Parameters.Others instead of Parameters.DeviceIoControl), we
466  // cannot deterministically figure out the output buffer length for
467  // internal IOCTLs.
468  //
469  // || || Fall through || ||
470  // \/ \/ \/ \/
471  default:
472  DO_NOTHING();
473  }
#define TRUE
Definition: types.h:120
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
#define IRP_MJ_INTERNAL_DEVICE_CONTROL
BOOLEAN validateLength
Definition: fxrequest.cpp:380
#define IRP_MJ_READ
Definition: rdpdr.c:46
#define IRP_MJ_WRITE
Definition: rdpdr.c:47
#define IRP_MJ_DEVICE_CONTROL
Definition: rdpdr.c:52
#define DO_NOTHING()
Definition: mxgeneral.h:32

◆ Unlock()

pList Unlock ( irql  )

Variable Documentation

◆ __pad0__

Done __pad0__

Definition at line 1853 of file fxrequest.cpp.

◆ __pad1__

Done __pad1__

Definition at line 2629 of file fxrequest.cpp.

◆ else

else
Initial value:
{
m_Completed
Definition: fxrequest.cpp:509
#define FALSE
Definition: types.h:117
#define ASSERT(a)
Definition: mode.c:44

Definition at line 388 of file fxrequest.cpp.

◆ IrpQueue

◆ irql

◆ length

◆ m_Completed

m_Completed = TRUE

Definition at line 509 of file fxrequest.cpp.

Referenced by FX_VF_METHOD().

◆ Requeue

Initial value:
{
LONG NTSTATUS
Definition: precomp.h:26
Definition: ps.c:97

Definition at line 2593 of file fxrequest.cpp.

◆ Status

Initial value:
{
UNREFERENCED_PARAMETER(FxDriverGlobals)
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317

Definition at line 376 of file fxrequest.cpp.

Referenced by FxRequest::CompleteInternal(), FxRequest::GetNextRequest(), and FxRequest::PeekRequest().

◆ status

◆ validateLength

validateLength = FALSE

Definition at line 380 of file fxrequest.cpp.

Referenced by switch().