ReactOS  0.4.15-dev-3440-g915569a
fxioqueue.cpp File Reference
#include "ioprivshared.hpp"
#include "fxioqueue.hpp"
Include dependency graph for fxioqueue.cpp:

Go to the source code of this file.

Functions

_Must_inspect_result_ NTSTATUS FX_VF_METHOD (FxIoQueue, VerifyGetRequestUpdateFlags)(_In_ PFX_DRIVER_GLOBALS FxDriverGlobals
 
 PAGED_CODE_LOCKED ()
 
 if (TagRequest !=NULL)
 
 if ((m_Type==WdfIoQueueDispatchSequential) &&(m_DriverIoCount==0))
 
 Unlock (irql)
 
VOID FX_VF_METHOD (FxIoQueue, VerifyGetRequestRestoreFlags)(_In_ PFX_DRIVER_GLOBALS FxDriverGlobals
 
pRequest ClearVerifierFlagsLocked (FXREQUEST_FLAG_TAG_REQUEST)
 
pRequest SetVerifierFlagsLocked (FXREQUEST_FLAG_DRIVER_OWNED)
 
_Must_inspect_result_ NTSTATUS FX_VF_METHOD (FxIoQueue, VerifyPeekRequest)(_In_ PFX_DRIVER_GLOBALS FxDriverGlobals
 
SHORT FX_VF_METHOD (FxIoQueue, VerifyForwardRequestUpdateFlags)(_In_ PFX_DRIVER_GLOBALS FxDriverGlobals
 
Request SetVerifierFlagsLocked (FXREQUEST_FLAG_FORWARDED)
 
 ASSERT ((Request->GetVerifierFlagsLocked() &FXREQUEST_FLAG_DRIVER_OWNED) !=0)
 
Request ClearVerifierFlagsLocked (FXREQUEST_FLAG_DRIVER_OWNED|FXREQUEST_FLAG_DRIVER_DISPATCH)
 
_Must_inspect_result_ NTSTATUS FX_VF_METHOD (FxIoQueue, VerifyForwardRequestToParent)(_In_ PFX_DRIVER_GLOBALS FxDriverGlobals
 
 if (m_Device->m_ParentDevice==NULL)
 
 if (NT_SUCCESS(status))
 
 if (!NT_SUCCESS(status))
 
 if (DestQueue==this)
 
 if (m_Device->m_ParentDevice !=DestQueue->m_Device)
 
 if (Request->IsReserved())
 
 ASSERT (m_Device->IsPdo())
 
 if (m_Device->IsPnp() &&m_Device->GetPdoPkg() ->m_AllowForwardRequestToParent==FALSE)
 
_Must_inspect_result_ NTSTATUS FX_VF_METHOD (FxIoQueue, VerifyForwardRequest)(_In_ PFX_DRIVER_GLOBALS FxDriverGlobals
 
 if (pDestQueue==this)
 
 if ((m_Device !=pDestQueue->m_Device))
 
_Must_inspect_result_ NTSTATUS FX_VF_METHOD (FxIoQueue, VerifyQueueDriverCreatedRequest)(_In_ PFX_DRIVER_GLOBALS FxDriverGlobals
 
 ASSERT ((FXREQUEST_FLAG_DRIVER_DISPATCH &(*OldFlags))==0)
 
_Must_inspect_result_ NTSTATUS FX_VF_METHOD (FxIoQueue, VerifyRequeue)(_In_ PFX_DRIVER_GLOBALS FxDriverGlobals
 
_Must_inspect_result_ NTSTATUS FX_VF_METHOD (FxIoQueue, VerifyRequestCancelable)(_In_ PFX_DRIVER_GLOBALS FxDriverGlobals
 
 if (Cancelable)
 
 _Releases_lock_ (this->m_SpinLock.m_Lock) __drv_requiresIRQL(DISPATCH_LEVEL) BOOLEAN FxIoQueue
 
VOID FX_VF_METHOD (FxIoQueue, VerifyValidateCompletedRequest)(_In_ PFX_DRIVER_GLOBALS FxDriverGlobals
 
VOID Request VerifyRequestIsDriverOwned (FxDriverGlobals)
 
Request ClearVerifierFlagsLocked (FXREQUEST_FLAG_DRIVER_OWNED)
 
 if (!IsListEmpty(pEntry))
 
VOID FX_VF_METHOD (FxIoQueue, VerifyCancelForDriver)(_In_ PFX_DRIVER_GLOBALS FxDriverGlobals
 
 DoTraceLevelMessage (FxDriverGlobals, TRACE_LEVEL_WARNING, TRACINGIO, "WDFREQUEST 0x%p " "was cancelled in driver for WDFQUEUE 0x%p", Request->GetHandle(), GetObjectHandle())
 
 __drv_requiresIRQL (DISPATCH_LEVEL) VOID FxIoQueue
 

Variables

_Must_inspect_result_ NTSTATUS _In_ FxRequestTagRequest
 
NTSTATUS status = TagRequest->VerifyRequestIsTagRequest(FxDriverGlobals)
 
Lockirql
 
return STATUS_SUCCESS
 
VOID _In_ FxRequestpRequest
 
SHORT _In_ FxRequestRequest
 
SHORT OldFlags = 0
 
_Must_inspect_result_ NTSTATUS _In_ FxIoQueueDestQueue
 
Done __pad0__
 
_Must_inspect_result_ NTSTATUS _In_ FxIoQueuepDestQueue
 
_Must_inspect_result_ NTSTATUS _In_ FxRequest _In_ BOOLEAN Cancelable
 
 else
 
Done __pad1__
 
PLIST_ENTRY pEntry = Request->GetListEntry(FxListEntryQueueOwned)
 

Function Documentation

◆ __drv_requiresIRQL()

__drv_requiresIRQL ( DISPATCH_LEVEL  )

Definition at line 4667 of file fxioqueue.cpp.

4692 {
4693  PFX_DRIVER_GLOBALS FxDriverGlobals = GetDriverGlobals();
4694  WDFCONTEXT ctx;
4696 
4697 
4698  callback = m_IdleComplete;
4699  ctx = m_IdleCompleteContext;
4700 
4701  m_IdleComplete.Method = NULL;
4702  m_IdleCompleteContext = NULL;
4703 
4704  Unlock(*PreviousIrql);
4705 
4707  "WDFQUEUE 0x%p is idle, calling driver callback",
4708  GetHandle());
4709 
4710  // Notify driver by callback
4711  if (callback.Method != NULL) {
4712  callback.Invoke(GetHandle(), ctx);
4713  }
4714 
4715  Lock(PreviousIrql);
4716 
4717  return;
4718 }
Unlock(irql)
#define GetHandle(h)
Definition: treelist.c:116
DoTraceLevelMessage(FxDriverGlobals, TRACE_LEVEL_WARNING, TRACINGIO, "WDFREQUEST 0x%p " "was cancelled in driver for WDFQUEUE 0x%p", Request->GetHandle(), GetObjectHandle())
#define TRACE_LEVEL_VERBOSE
Definition: storswtr.h:30
#define NULL
Definition: types.h:112
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFWAITLOCK * Lock
Definition: wdfsync.h:124
#define TRACINGIO
Definition: dbgtrace.h:66
static IPrintDialogCallback callback
Definition: printdlg.c:326

◆ _Releases_lock_()

_Releases_lock_ ( this->m_SpinLock.  m_Lock)

Definition at line 2730 of file fxioqueue.cpp.

2779 {
2781  ULONG totalIoCount;
2782  NTSTATUS status;
2783  PFX_DRIVER_GLOBALS FxDriverGlobals = GetDriverGlobals();
2784 
2785  if (m_Deleted) {
2786  ASSERT(NewRequest == NULL);
2787  Unlock(PreviousIrql);
2788  return FALSE;
2789  }
2790 
2791  //
2792  // The design of the I/O Queue allows all "events" to notify the driver of
2793  // to be deferred until the opportune time to deliver them.
2794  // Depending on the drivers configured locking and threading
2795  // mode, this may have to be deferred to a worker thread or a DPC
2796  // to be in a compatible IRQL level, or to prevent a lock recursion
2797  // when a parent objects lock is in effect.
2798  //
2799 
2800  if (CanThreadDispatchEventsLocked(PreviousIrql) == FALSE) {
2801  //
2802  // Previous workitem or Dpc might be running the DispatchEvents right now.
2803  // But it may be at a point where it might miss out to process the event
2804  // that we have been asked to dispatch. This is possible because the
2805  // DispatchEvent is reentrant as it acquires and drops lock along
2806  // the way. So we make a note of this, so that when the current Dpc or
2807  // workItem runs to completion, it will requeue itself to handle our message.
2808  //
2809  m_RequeueDeferredDispatcher = TRUE;
2810 
2811  //
2812  // Queue the request in to FxIrpQueue and return.
2813  //
2814  InsertNewRequest(&NewRequest, PreviousIrql);
2815  Unlock(PreviousIrql);
2816  return TRUE;
2817  }
2818 
2819  //
2820  // This must be incremented before attempting to deliver any
2821  // events to the driver. This prevents recursion on the presentation lock,
2822  // and limits the stack depth in a Start/Complete/Start/... recursion
2823  //
2824  m_Dispatching++;
2825 
2827  "Thread %p is processing WDFQUEUE 0x%p",
2829 
2830  //
2831  // At this point all constaints such as IRQL level, locks held,
2832  // and stack recursion protection has been satisfied, and we can
2833  // make callbacks into the device driver.
2834  //
2835  // Process events and requests until we either have an empty queue,
2836  // the driver stops taking requests, or some queue state does not
2837  // allow the driver to take new requests
2838  //
2839  #pragma warning(disable:4127)
2840  while (TRUE) {
2841  #pragma warning(default:4127)
2842  //
2843  // totoalIoCount is sum of requests pending in the queue and requests
2844  // currently owned by the driver.
2845  //
2846  totalIoCount = m_Queue.GetRequestCount() + m_DriverIoCount;
2847 
2848  //
2849  // Increment the count if there is a new request to be dispatched.
2850  //
2851  totalIoCount += ((NewRequest != NULL) ? 1 : 0);
2852 
2853  if (!IsListEmpty(&this->m_Cancelled)) {
2854  status = InsertNewRequest(&NewRequest, PreviousIrql);
2855  if (!NT_SUCCESS(status)) {
2856  continue; // totalIoCount may be zero now.
2857  }
2858 
2859  //
2860  // This can drop and re-acquire the queue lock
2861  // ProcessCancelledRequests returns FALSE if the queue is
2862  // notifying driver about power state changes.
2863  //
2864  if(ProcessCancelledRequests(&PreviousIrql)) {
2865  continue;
2866  }
2867  }
2868 
2869  if (!IsListEmpty(&this->m_CanceledOnQueueList)) {
2870  status = InsertNewRequest(&NewRequest, PreviousIrql);
2871  if (!NT_SUCCESS(status)) {
2872  continue; // totalIoCount may be zero now.
2873  }
2874 
2875  //
2876  // This can drop and re-acquire the queue lock
2877  // ProcessCancelledRequests returns FALSE if the queue is
2878  // notifying driver about power state changes.
2879  //
2880  if (ProcessCancelledRequestsOnQueue(&PreviousIrql)) {
2881  continue;
2882  }
2883  }
2884 
2885  if (m_IdleComplete.Method != NULL &&
2886  m_Dispatching == 1L &&
2887  m_DriverIoCount == 0L) {
2888 
2889  InsertNewRequest(&NewRequest, PreviousIrql);
2890 
2891  // no more driver owned requests, we can clear the following flag:
2892  m_CancelDispatchedRequests = FALSE;
2893 
2894  // This can drop and re-acquire the queue lock
2895  ProcessIdleComplete(&PreviousIrql);
2896  continue;
2897  }
2898 
2899  if (m_PurgeComplete.Method != NULL &&
2900  totalIoCount == 0L &&
2901  m_Dispatching == 1L) {
2902 
2903  InsertNewRequest(&NewRequest, PreviousIrql);
2904 
2905  // no more driver owned requests, we can clear the following flag:
2906  m_CancelDispatchedRequests = FALSE;
2907 
2908  // This can drop and re-acquire the queue lock
2909  ProcessPurgeComplete(&PreviousIrql);
2910  continue;
2911  }
2912 
2913  if (m_IsDevicePowerPolicyOwner &&
2914  m_PowerManaged &&
2915  m_PowerReferenced &&
2916  totalIoCount == 0L &&
2917  m_Dispatching == 1L) {
2918 
2919  //
2920  // Queue has no requests, and is going idle. Notify
2921  // PNP/Power.
2922  //
2923  m_Device->m_PkgPnp->PowerDereference();
2924  m_PowerReferenced = FALSE;
2925  continue;
2926  }
2927 
2928  //
2929  // Look for power state transitions
2930  //
2931  if (m_PowerState != FxIoQueuePowerOn &&
2932  m_PowerState != FxIoQueuePowerOff) {
2933 
2935  "WDFQUEUE 0x%p Power Transition State "
2936  "%!FxIoQueuePowerState!", GetObjectHandle(),
2937  m_PowerState);
2938 
2939  status = InsertNewRequest(&NewRequest, PreviousIrql);
2940  if (!NT_SUCCESS(status)) {
2941  continue; // totalIoCount may be zero now.
2942  }
2943 
2944  // Process intermediate power state
2945  // This can drop and re-acquire the queue lock
2946  if (ProcessPowerEvents(&PreviousIrql)) {
2947  continue;
2948  }
2949  else {
2950 
2951  //
2952  // Return, awaiting some response from the driver
2953  //
2954  goto Done;
2955  }
2956  }
2957  else {
2958  // Queue is either in PowerOn or PowerOff state
2959  DO_NOTHING();
2960  }
2961 
2962  //
2963  // Check for queue disposing should be made after processing all
2964  // the events.
2965  //
2966  if (m_Disposing &&
2967  totalIoCount == 0L &&
2968  m_Dispatching == 1L) {
2969 
2970  m_Deleted = TRUE;
2971 
2972  //
2973  // After this point, no other thread will be able to dispatch
2974  // events from this queue. Also threads that are about to call
2975  // this function as soon as we drop the lock below should have
2976  // a reference on the queue to prevent queue object from being
2977  // freed when we signal the dispose thread to run through.
2978  //
2979  Unlock(PreviousIrql);
2980 
2981  m_FinishDisposing.Set();
2982  return TRUE;
2983  }
2984 
2985 
2986  //
2987  // Return if power is off, can't deliver any request oriented events
2988  // to the driver.
2989  //
2990  if (m_PowerState == FxIoQueuePowerOff) {
2991  status = InsertNewRequest(&NewRequest, PreviousIrql);
2992  if (!NT_SUCCESS(status)) {
2993  continue; // totalIoCount may be zero now.
2994  }
2995 
2996  goto Done;
2997  }
2998 
2999  //
3000  // See if the queue is (still) processing requests
3001  //
3002  if (!IsState(WdfIoQueueDispatchRequests)) {
3003 
3005  "WDFQUEUE 0x%p not in dispatching state, "
3006  "current state is %!WDF_IO_QUEUE_STATE!",
3007  GetObjectHandle(), m_QueueState);
3008 
3009  status = InsertNewRequest(&NewRequest, PreviousIrql);
3010  if (!NT_SUCCESS(status)) {
3011  continue; // totalIoCount may be zero now.
3012  }
3013 
3014  goto Done;
3015  }
3016 
3017  //
3018  // A manual dispatch queue can have a request ready notification
3019  //
3020  if (m_Type == WdfIoQueueDispatchManual) {
3021 
3022  status = InsertNewRequest(&NewRequest, PreviousIrql);
3023  if (!NT_SUCCESS(status)) {
3024  continue; // totalIoCount may be zero now.
3025  }
3026 
3027  if (m_ReadyNotify.Method != NULL && m_TransitionFromEmpty) {
3028 
3029  // This can drop and re-acquire the lock to callback to the driver
3030  ProcessReadyNotify(&PreviousIrql);
3031  continue;
3032  }
3033 
3034  goto Done;
3035  }
3036 
3037  if (m_Type == WdfIoQueueDispatchSequential && m_DriverIoCount > 0) {
3038  status = InsertNewRequest(&NewRequest, PreviousIrql);
3039  if (!NT_SUCCESS(status)) {
3040  continue; // totalIoCount may be zero now.
3041  }
3042 
3043  goto Done;
3044  }
3045 
3046  //
3047  // For counted Queue's dont dispatch request to driver if the
3048  // m_DriverIoCount exceeds the one set by the driver writer.
3049  //
3050  if (m_Type == WdfIoQueueDispatchParallel &&
3051  (ULONG)m_DriverIoCount >= m_MaxParallelQueuePresentedRequests) {
3052  status = InsertNewRequest(&NewRequest, PreviousIrql);
3053  if (!NT_SUCCESS(status)) {
3054  continue; // totalIoCount may be zero now.
3055  }
3056 
3057  goto Done;
3058  }
3059 
3060  //
3061  // If there is a request in the queue, then retrieve that.
3062  //
3063  pRequest = NULL;
3064  if (m_Queue.GetRequestCount() > 0L) {
3065  pRequest = FxRequest::GetNextRequest(&m_Queue);
3066  }
3067 
3068  //
3069  // The request from the queue should be dispatched first
3070  // to preserve the ordering.
3071  //
3072  if (pRequest != NULL) {
3073  InsertNewRequest(&NewRequest, PreviousIrql);
3074  }
3075  else {
3076  //
3077  // If there is no request in the queue then dispatch
3078  // the incoming one.
3079  //
3080  pRequest = NewRequest;
3081  if (pRequest != NULL) {
3082  pRequest->SetCurrentQueue(this);
3083  SetTransitionFromEmpty();
3084  NewRequest = NULL;
3085  }
3086  else {
3087  goto Done;
3088  }
3089  }
3090 
3091  //
3092  // pRequest is not cancellable now
3093  //
3094  InsertInDriverOwnedList(pRequest);
3095 
3096  Unlock(PreviousIrql);
3097 
3098  DispatchRequestToDriver(pRequest);
3099 
3100  Lock(&PreviousIrql);
3101  }
3102 
3103 Done:
3104  m_Dispatching--;
3105  Unlock(PreviousIrql);
3106  return TRUE;
3107 }
static _Must_inspect_result_ FxRequest * GetNextRequest(__in FxIrpQueue *IrpQueue)
Definition: fxrequest.cpp:2025
Unlock(irql)
#define TRUE
Definition: types.h:120
LONG NTSTATUS
Definition: precomp.h:26
_Must_inspect_result_ FORCEINLINE BOOLEAN IsListEmpty(_In_ const LIST_ENTRY *ListHead)
Definition: rtlfuncs.h:57
return pObject GetObjectHandle()
DoTraceLevelMessage(FxDriverGlobals, TRACE_LEVEL_WARNING, TRACINGIO, "WDFREQUEST 0x%p " "was cancelled in driver for WDFQUEUE 0x%p", Request->GetHandle(), GetObjectHandle())
#define L(x)
Definition: ntvdm.h:50
#define FALSE
Definition: types.h:117
#define TRACE_LEVEL_VERBOSE
Definition: storswtr.h:30
VOID _In_ FxRequest * pRequest
Definition: fxioqueue.cpp:947
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define TRACE_LEVEL_WARNING
Definition: storswtr.h:28
static __inline MxThread MxGetCurrentThread()
Definition: mxgeneralkm.h:61
NTSTATUS status
Definition: fxioqueue.cpp:887
#define NULL
Definition: types.h:112
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFWAITLOCK * Lock
Definition: wdfsync.h:124
unsigned int ULONG
Definition: retypes.h:1
#define TRACINGIO
Definition: dbgtrace.h:66
ASSERT((Request->GetVerifierFlagsLocked() &FXREQUEST_FLAG_DRIVER_OWNED) !=0)
#define DO_NOTHING()
Definition: mxgeneral.h:32
Definition: ps.c:97

◆ ASSERT() [1/3]

◆ ASSERT() [2/3]

ASSERT ( m_Device->  IsPdo())

◆ ASSERT() [3/3]

ASSERT ( (FXREQUEST_FLAG_DRIVER_DISPATCH &(*OldFlags))  = =0)

◆ ClearVerifierFlagsLocked() [1/3]

pRequest ClearVerifierFlagsLocked ( FXREQUEST_FLAG_TAG_REQUEST  )

◆ ClearVerifierFlagsLocked() [2/3]

Request ClearVerifierFlagsLocked ( FXREQUEST_FLAG_DRIVER_OWNED FXREQUEST_FLAG_DRIVER_DISPATCH)

◆ ClearVerifierFlagsLocked() [3/3]

Request ClearVerifierFlagsLocked ( FXREQUEST_FLAG_DRIVER_OWNED  )

◆ DoTraceLevelMessage()

◆ FX_VF_METHOD() [1/11]

_Must_inspect_result_ NTSTATUS FX_VF_METHOD ( FxIoQueue  ,
VerifyGetRequestUpdateFlags   
)

◆ FX_VF_METHOD() [2/11]

VOID FX_VF_METHOD ( FxIoQueue  ,
VerifyGetRequestRestoreFlags   
)

◆ FX_VF_METHOD() [3/11]

_Must_inspect_result_ NTSTATUS FX_VF_METHOD ( FxIoQueue  ,
VerifyPeekRequest   
)

◆ FX_VF_METHOD() [4/11]

SHORT FX_VF_METHOD ( FxIoQueue  ,
VerifyForwardRequestUpdateFlags   
)

◆ FX_VF_METHOD() [5/11]

_Must_inspect_result_ NTSTATUS FX_VF_METHOD ( FxIoQueue  ,
VerifyForwardRequestToParent   
)

◆ FX_VF_METHOD() [6/11]

_Must_inspect_result_ NTSTATUS FX_VF_METHOD ( FxIoQueue  ,
VerifyForwardRequest   
)

◆ FX_VF_METHOD() [7/11]

_Must_inspect_result_ NTSTATUS FX_VF_METHOD ( FxIoQueue  ,
VerifyQueueDriverCreatedRequest   
)

◆ FX_VF_METHOD() [8/11]

_Must_inspect_result_ NTSTATUS FX_VF_METHOD ( FxIoQueue  ,
VerifyRequeue   
)

◆ FX_VF_METHOD() [9/11]

_Must_inspect_result_ NTSTATUS FX_VF_METHOD ( FxIoQueue  ,
VerifyRequestCancelable   
)

◆ FX_VF_METHOD() [10/11]

VOID FX_VF_METHOD ( FxIoQueue  ,
VerifyValidateCompletedRequest   
)

◆ FX_VF_METHOD() [11/11]

VOID FX_VF_METHOD ( FxIoQueue  ,
VerifyCancelForDriver   
)

◆ if() [1/13]

if ( TagRequest = NULL)

Definition at line 891 of file fxioqueue.cpp.

891  {
892  //
893  // WdfIoQueueRetrieveFoundRequest is only valid on manual queues.
894  // v1.11 and above: driver is not required to find the request
895  // using WdfIoQueueFindRequest.
896  // v1.9 and below: driver is required to find the request
897  // using WdfIoQueueFindRequest.
898  //
899  if (FxDriverGlobals->IsVersionGreaterThanOrEqualTo(1,11)) {
900  if (m_Type != WdfIoQueueDispatchManual) {
903  FxDriverGlobals, TRACE_LEVEL_ERROR, TRACINGIO,
904  "WdfIoQueueRetrieveFoundRequest is allowed "
905  "only on a manual queue 0x%p, %!STATUS!",
906  GetHandle(), status);
907  FxVerifierDbgBreakPoint(FxDriverGlobals);
908  return status;
909  }
910  }
911  else {
912  //
913  // Legacy validation.
914  //
915  TagRequest->Lock(&irql);
916  status = TagRequest->VerifyRequestIsTagRequest(FxDriverGlobals);
917  TagRequest->Unlock(irql);
918  if (!NT_SUCCESS(status)) {
919  return status;
920  }
921  }
922  }
#define GetHandle(h)
Definition: treelist.c:116
Lock & irql
Definition: fxioqueue.cpp:924
#define STATUS_INVALID_DEVICE_REQUEST
Definition: udferr_usr.h:138
DoTraceLevelMessage(FxDriverGlobals, TRACE_LEVEL_WARNING, TRACINGIO, "WDFREQUEST 0x%p " "was cancelled in driver for WDFQUEUE 0x%p", Request->GetHandle(), GetObjectHandle())
_Must_inspect_result_ NTSTATUS _In_ FxRequest * TagRequest
Definition: fxioqueue.cpp:885
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
NTSTATUS status
Definition: fxioqueue.cpp:887
#define TRACINGIO
Definition: dbgtrace.h:66
FxVerifierDbgBreakPoint(pFxDriverGlobals)
Definition: ps.c:97

◆ if() [2/13]

if ( (m_Type==WdfIoQueueDispatchSequential) &&(m_DriverIoCount==0)  )

Definition at line 925 of file fxioqueue.cpp.

925  {
926 
928  "Driver called WdfIoQueueRetrieveNextRequest on a sequential WDFQUEUE 0x%p with no "
929  "outstanding requests. This can cause a race with automatically dispatched "
930  "requests. Call WdfIoQueueRetrieveNextRequest before completing the current request(s)",
931  GetObjectHandle());
932 
933  FxVerifierDbgBreakPoint(FxDriverGlobals);
934 
935  // Allow them to continue, though this is a race condition in their driver
936  }
return pObject GetObjectHandle()
DoTraceLevelMessage(FxDriverGlobals, TRACE_LEVEL_WARNING, TRACINGIO, "WDFREQUEST 0x%p " "was cancelled in driver for WDFQUEUE 0x%p", Request->GetHandle(), GetObjectHandle())
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
#define TRACINGIO
Definition: dbgtrace.h:66
FxVerifierDbgBreakPoint(pFxDriverGlobals)

◆ if() [3/13]

if ( m_Device->  m_ParentDevice = NULL)

Definition at line 1485 of file fxioqueue.cpp.

1485  {
1488  "No parent device for WDFQUEUE 0x%p Device, %!STATUS!",
1490  FxVerifierDbgBreakPoint(FxDriverGlobals);
1491  goto Done;
1492  }
CfxDevice * m_Device
Definition: fxobject.hpp:329
WDFDEVICE __inline GetHandle(VOID)
Definition: fxdevice.hpp:237
#define STATUS_INVALID_DEVICE_REQUEST
Definition: udferr_usr.h:138
DoTraceLevelMessage(FxDriverGlobals, TRACE_LEVEL_WARNING, TRACINGIO, "WDFREQUEST 0x%p " "was cancelled in driver for WDFQUEUE 0x%p", Request->GetHandle(), GetObjectHandle())
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
NTSTATUS status
Definition: fxioqueue.cpp:887
_Must_inspect_result_ NTSTATUS _In_ FxIoQueue * DestQueue
Definition: fxioqueue.cpp:1476
#define TRACINGIO
Definition: dbgtrace.h:66
FxVerifierDbgBreakPoint(pFxDriverGlobals)
Definition: ps.c:97

◆ if() [4/13]

if ( NT_SUCCESS(status )

Definition at line 1498 of file fxioqueue.cpp.

1498  {
1499  status = Request->VerifyRequestIsNotCancelable(FxDriverGlobals);
1500  }
_In_ WDFREQUEST Request
Definition: wdfdevice.h:547
Definition: ps.c:97

◆ if() [5/13]

if ( NT_SUCCESSstatus)

Definition at line 1504 of file fxioqueue.cpp.

1504  {
1505  goto Done;
1506  }

◆ if() [6/13]

if ( DestQueue  = = this)

Definition at line 1508 of file fxioqueue.cpp.

1508  {
1511  "Cannot forward a request to the same WDFQUEUE 0x%p"
1512  " %!STATUS!", GetObjectHandle(), status);
1513  FxVerifierDbgBreakPoint(FxDriverGlobals);
1514  goto Done;
1515  }
#define STATUS_INVALID_DEVICE_REQUEST
Definition: udferr_usr.h:138
return pObject GetObjectHandle()
DoTraceLevelMessage(FxDriverGlobals, TRACE_LEVEL_WARNING, TRACINGIO, "WDFREQUEST 0x%p " "was cancelled in driver for WDFQUEUE 0x%p", Request->GetHandle(), GetObjectHandle())
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
#define TRACINGIO
Definition: dbgtrace.h:66
FxVerifierDbgBreakPoint(pFxDriverGlobals)
Definition: ps.c:97

◆ if() [7/13]

if ( m_Device->m_ParentDevice !  = DestQueue->m_Device)

Definition at line 1517 of file fxioqueue.cpp.

1517  {
1520  "Cannot forward a request to "
1521  "a different WDFDEVICE 0x%p which is not the "
1522  "parent, %!STATUS!",
1524  status);
1525  FxVerifierDbgBreakPoint(FxDriverGlobals);
1526  goto Done;
1527  }
CfxDevice * m_Device
Definition: fxobject.hpp:329
WDFDEVICE __inline GetHandle(VOID)
Definition: fxdevice.hpp:237
#define STATUS_INVALID_DEVICE_REQUEST
Definition: udferr_usr.h:138
DoTraceLevelMessage(FxDriverGlobals, TRACE_LEVEL_WARNING, TRACINGIO, "WDFREQUEST 0x%p " "was cancelled in driver for WDFQUEUE 0x%p", Request->GetHandle(), GetObjectHandle())
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
NTSTATUS status
Definition: fxioqueue.cpp:887
_Must_inspect_result_ NTSTATUS _In_ FxIoQueue * DestQueue
Definition: fxioqueue.cpp:1476
#define TRACINGIO
Definition: dbgtrace.h:66
FxVerifierDbgBreakPoint(pFxDriverGlobals)
Definition: ps.c:97

◆ if() [8/13]

if ( Request->  IsReserved())

Definition at line 1529 of file fxioqueue.cpp.

1529  {
1532  "Cannot forward reserved WDFREQUEST 0x%p to a "
1533  "parent WDFDEVICE 0x%p, %!STATUS!",
1534  Request->GetHandle(),
1536  status);
1537  FxVerifierDbgBreakPoint(FxDriverGlobals);
1538  goto Done;
1539  }
CfxDevice * m_Device
Definition: fxobject.hpp:329
WDFDEVICE __inline GetHandle(VOID)
Definition: fxdevice.hpp:237
#define STATUS_INVALID_DEVICE_REQUEST
Definition: udferr_usr.h:138
_In_ WDFREQUEST Request
Definition: wdfdevice.h:547
DoTraceLevelMessage(FxDriverGlobals, TRACE_LEVEL_WARNING, TRACINGIO, "WDFREQUEST 0x%p " "was cancelled in driver for WDFQUEUE 0x%p", Request->GetHandle(), GetObjectHandle())
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
NTSTATUS status
Definition: fxioqueue.cpp:887
_Must_inspect_result_ NTSTATUS _In_ FxIoQueue * DestQueue
Definition: fxioqueue.cpp:1476
#define TRACINGIO
Definition: dbgtrace.h:66
FxVerifierDbgBreakPoint(pFxDriverGlobals)
Definition: ps.c:97

◆ if() [9/13]

if ( m_Device->IsPnp() &&m_Device->GetPdoPkg() ->  m_AllowForwardRequestToParent = FALSE)

Definition at line 1551 of file fxioqueue.cpp.

1553  {
1556  "WdfPdoInitSetForwardRequestToParent not called on "
1557  "WDFDEVICE 0x%p, %!STATUS!", m_Device->GetHandle(),
1558  status);
1559  FxVerifierDbgBreakPoint(FxDriverGlobals);
1560  goto Done;
1561  }
#define STATUS_INVALID_DEVICE_REQUEST
Definition: udferr_usr.h:138
DoTraceLevelMessage(FxDriverGlobals, TRACE_LEVEL_WARNING, TRACINGIO, "WDFREQUEST 0x%p " "was cancelled in driver for WDFQUEUE 0x%p", Request->GetHandle(), GetObjectHandle())
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
NTSTATUS status
Definition: fxioqueue.cpp:887
#define TRACINGIO
Definition: dbgtrace.h:66
FxVerifierDbgBreakPoint(pFxDriverGlobals)
Definition: ps.c:97

◆ if() [10/13]

if ( pDestQueue  = = this)

Definition at line 1689 of file fxioqueue.cpp.

1689  {
1691  "Cannot forward a request to the same WDFQUEUE 0x%p"
1692  " %!STATUS!",
1693  GetObjectHandle(),
1695  FxVerifierDbgBreakPoint(FxDriverGlobals);
1697  }
#define STATUS_INVALID_DEVICE_REQUEST
Definition: udferr_usr.h:138
return pObject GetObjectHandle()
DoTraceLevelMessage(FxDriverGlobals, TRACE_LEVEL_WARNING, TRACINGIO, "WDFREQUEST 0x%p " "was cancelled in driver for WDFQUEUE 0x%p", Request->GetHandle(), GetObjectHandle())
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
#define TRACINGIO
Definition: dbgtrace.h:66
FxVerifierDbgBreakPoint(pFxDriverGlobals)

◆ if() [11/13]

if ( (m_Device !=pDestQueue->m_Device)  )

Definition at line 1699 of file fxioqueue.cpp.

1699  {
1701  "Cannot forward a request to a different WDFDEVICE 0x%p",
1703  FxVerifierDbgBreakPoint(FxDriverGlobals);
1705  }
CfxDevice * m_Device
Definition: fxobject.hpp:329
WDFDEVICE __inline GetHandle(VOID)
Definition: fxdevice.hpp:237
#define STATUS_INVALID_DEVICE_REQUEST
Definition: udferr_usr.h:138
DoTraceLevelMessage(FxDriverGlobals, TRACE_LEVEL_WARNING, TRACINGIO, "WDFREQUEST 0x%p " "was cancelled in driver for WDFQUEUE 0x%p", Request->GetHandle(), GetObjectHandle())
_Must_inspect_result_ NTSTATUS _In_ FxIoQueue * pDestQueue
Definition: fxioqueue.cpp:1667
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
#define TRACINGIO
Definition: dbgtrace.h:66
FxVerifierDbgBreakPoint(pFxDriverGlobals)

◆ if() [12/13]

if ( Cancelable  )

Definition at line 2065 of file fxioqueue.cpp.

2065  {
2066  //
2067  // Make sure the request is not cancelable for it to be made
2068  // cancelable.
2069  //
2070  status = pRequest->VerifyRequestIsNotCancelable(FxDriverGlobals);
2071  if (!NT_SUCCESS(status)) {
2072  goto Done;
2073  }
2074  }
VOID _In_ FxRequest * pRequest
Definition: fxioqueue.cpp:947
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
Definition: ps.c:97

◆ if() [13/13]

if ( IsListEmptypEntry)

Definition at line 4498 of file fxioqueue.cpp.

4498  {
4500  GetDriverGlobals(), TRACE_LEVEL_ERROR, TRACINGIO,
4501  "WDFREQUEST 0x%p is on a cancellation list for WDFQUEUE 0x%p",
4502  Request->GetHandle(), GetObjectHandle());
4503  FxVerifierDbgBreakPoint(GetDriverGlobals());
4504  }
_In_ WDFREQUEST Request
Definition: wdfdevice.h:547
return pObject GetObjectHandle()
DoTraceLevelMessage(FxDriverGlobals, TRACE_LEVEL_WARNING, TRACINGIO, "WDFREQUEST 0x%p " "was cancelled in driver for WDFQUEUE 0x%p", Request->GetHandle(), GetObjectHandle())
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
#define TRACINGIO
Definition: dbgtrace.h:66
FxVerifierDbgBreakPoint(pFxDriverGlobals)

◆ PAGED_CODE_LOCKED()

PAGED_CODE_LOCKED ( )

◆ SetVerifierFlagsLocked() [1/2]

pRequest SetVerifierFlagsLocked ( FXREQUEST_FLAG_DRIVER_OWNED  )

◆ SetVerifierFlagsLocked() [2/2]

Request SetVerifierFlagsLocked ( FXREQUEST_FLAG_FORWARDED  )

◆ Unlock()

Unlock ( irql  )

Referenced by _Releases_lock_().

◆ VerifyRequestIsDriverOwned()

VOID Request VerifyRequestIsDriverOwned ( FxDriverGlobals  )

Referenced by if().

Variable Documentation

◆ __pad0__

Done __pad0__

Definition at line 1564 of file fxioqueue.cpp.

◆ __pad1__

Done __pad1__

Definition at line 2087 of file fxioqueue.cpp.

◆ Cancelable

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

Definition at line 2051 of file fxioqueue.cpp.

Referenced by FxIoQueue::RequestCancelable().

◆ DestQueue

◆ else

else
Initial value:
{
status = pRequest->VerifyRequestIsCancelable(FxDriverGlobals)
VOID _In_ FxRequest * pRequest
Definition: fxioqueue.cpp:947
Definition: ps.c:97

Definition at line 2075 of file fxioqueue.cpp.

◆ irql

◆ OldFlags

◆ pDestQueue

Definition at line 1667 of file fxioqueue.cpp.

Referenced by FxIoQueue::ForwardRequest(), and if().

◆ pEntry

Definition at line 4484 of file fxioqueue.cpp.

Referenced by _chm_parse_cword(), _chm_parse_PMGL_entry(), _chm_parse_UTF8(), _chm_skip_cword(), _chm_skip_PMGL_entry_data(), _FindPort(), _HandleDeletePort(), FxChildList::Add(), AddMonitorW(), AddPortExW(), AddPortW(), AddPrinterDriverExW(), AddPrinterExW(), AddPrinterW(), CDefaultContextMenu::AddShellExtensionsToMenu(), CDefaultContextMenu::AddStaticContextMenusToMenu(), CDefaultContextMenu::AddStaticEntry(), ArcOpen(), FxChildList::BeginScan(), CDefaultContextMenu::BrowserFlagsFromVerb(), CachedGetUserFromSid(), CallbackEntry(), CallbackExtra(), chm_resolve_object(), FxPkgPdo::ClearEjectionDevicesList(), FxPkgPnp::ClearRemovalDevicesList(), ConfigurePortW(), CreateDragImage(), DdGetFreeHandle(), DdHmgAlloc(), DdHmgFree(), DdHmgLock(), DeleteMonitorW(), DeletePortW(), DeletePrinterDriverExW(), DestroyAcceleratorTable(), DoEntry(), DoRudeAppTest1(), DoRudeAppTest2(), DoTestEntry(), DoTestEntryPart1(), DoTestEntryPart2(), FxChildList::DrainFreeListHead(), FxDisposeList::DrainListLocked(), EditTypeDlg_OnChangeIcon(), EditTypeDlg_OnInitDialog(), EditTypeDlg_OnOK(), EditTypeDlg_UpdateEntryIcon(), EditTypeDlg_WriteClass(), enable_caching(), FxChildList::EndScan(), EnumMonitorsW(), EnumPortsW(), EnumPrinterDriversW(), EnumPrintersW(), Ext2ExpandLast(), ExtSelectClipRgn(), fcbopen_main(), FileTypesDlg_OnItemChanging(), FindPort(), FindPrintMonitor(), FindPrintProcessor(), FolderOptionsFileTypesDlg(), FxChildList::GetAddressDescription(), CDefaultContextMenu::GetCommandString(), GetConfigurationEntry(), FxChildList::GetDeviceFromId(), CDefaultContextMenu::GetDynamicEntry(), GetFontFamilyInfoForSubstitutes(), FxChildList::GetNextDevice(), FxRelatedDeviceList::GetNextEntry(), FxChildList::GetNextStaticDevice(), GetPrinterDriverDirectoryW(), HandleList_Update(), CDefaultContextMenu::HandleMenuMsg2(), FxChildList::IndicateWakeStatus(), InitializePortList(), InitializeTransferParameters(), IntLoadFontSubstList(), CDefaultContextMenu::InvokePidl(), CDefaultContextMenu::InvokeRegVerb(), FxChildList::InvokeReportedMissingCallback(), CDefaultContextMenu::InvokeShellExt(), CDefaultContextMenu::IsShellExtensionAlreadyLoaded(), IsUrlCacheEntryExpiredA(), JapaneseEra_Find(), JapaneseEra_Load(), CDefaultContextMenu::LoadDynamicContextMenuHandler(), LocalEnumMonitors(), LocalEnumPorts(), LocalmonEnumPorts(), LocalmonShutdown(), LsapAddNotification(), LsapRemoveNotification(), nfs41_CreateVNetRoot(), nfs41_downcall(), nfs41_remove_fcb_entry(), nfs41_upcall(), nfs41_update_fcb_list(), FxChildList::NotifyDeviceRemove(), FxChildList::NotifyDeviceSurpriseRemove(), OpenPrinterW(), ParaNdis5_CancelSendPackets(), ParaNdis5_StopSend(), ParaNdis_OnTransmitBufferReleased(), ParaNdis_ProcessTx(), PerfDataUninitialize(), FxChildList::PostParentToD0(), FxRelatedDeviceList::ProcessAdd(), FxChildList::ProcessBusRelations(), FxChildList::ProcessModificationsLocked(), FxTransactionedList::ProcessObjectsToRelease(), FxTransactionedList::ProcessTransactionList(), QUARTZ_InsertAviseEntryFromQueue(), QUARTZ_RemoveAviseEntryFromQueue(), FxResourceCollection::RemoveAndDelete(), ScanAdvancedSettings(), FxChildList::SearchBackwardsForMatchingDescriptionLocked(), FxChildList::SearchBackwardsForMatchingModificationLocked(), FxTransactionedList::SearchForAndRemove(), SetPortW(), SetUrlCacheEntryInfoA(), ShimLib_NotifyShims(), START_TEST(), FxCollection::StealCollection(), SystemClockImpl_AdvisePeriodic(), SystemClockImpl_AdviseTime(), SystemClockImpl_Unadvise(), TestEntry(), TreeListChangeCheckbox(), TreeListChar(), TreeListDeleteItem(), TreeListDraw(), TreeListEditLabel(), TreeListEndLabelEdit(), TreeListEnsureVisible(), TreeListFindItem(), TreeListGetItem(), TreeListGetItemColor(), TreeListGetItemRect(), TreeListGetNextItem(), TreeListHitTest(), TreeListInsertItem(), TreeListIsVisible(), TreeListKeyDown(), TreeListMouseClick(), TreeListMouseNotify(), TreeListNextSelUntil(), TreeListNextUnselUntil(), TreeListProc(), TreeListRemoveFocus(), TreeListScanColumn(), TreeListSelectChilds(), TreeListSelectItem(), TreeListSetFocus(), TreeListSetInsertMark(), TreeListSetItem(), TreeListSetItemColor(), TreeListSetTrackItem(), TreeListSortItems(), TreeListSortItemsCb(), TreeListSortItemsEx(), TreeListStartAutoEdit(), TreeListStartNotifyEdit(), TreeListToggleItem(), TreeListXorSelectItem(), U32AccelCacheAdd(), U32LoadAccelerators(), UnlockUrlCacheEntryFileA(), FxChildList::UpdateAllAsPresent(), FxChildList::UpdateAsMissing(), FxChildList::UpdateDeviceAsMissing(), UpdateFont(), UpdateItems(), UpdateRect(), UpdateRow(), UpdateToolTip(), UpdateVisRgn(), urlcache_entry_delete(), urlcache_find_next_entry(), ValidateCallProc(), ValidateHandle(), ValidateHandleNoErr(), VerifyObjectOwner(), vfat8Dot3ToString(), ViewDlg_Apply(), ViewDlg_OnTreeCustomDraw(), ViewDlg_RestoreDefaults(), ViewDlg_ToggleCheckItem(), ViewTree_GetImage(), ViewTree_GetItem(), ViewTree_InsertAll(), ViewTree_InsertEntry(), ViewTree_LoadTree(), and FxTransactionedList::~FxTransactionedList().

◆ pRequest

◆ Request

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

Definition at line 1323 of file fxioqueue.cpp.

◆ status

◆ STATUS_SUCCESS

◆ TagRequest

_Must_inspect_result_ __in WDFQUEUE __in_opt WDFREQUEST TagRequest
Initial value:
{
Lock & irql
Definition: fxioqueue.cpp:924
UCHAR KIRQL
Definition: env_spec_w32.h:591

Definition at line 885 of file fxioqueue.cpp.

Referenced by FxIoQueue::GetRequest(), if(), and FxIoQueue::PeekRequest().