ReactOS  0.4.15-dev-1632-g4e289ce
fxdmatransactionapi.cpp File Reference
#include "fxdmapch.hpp"
Include dependency graph for fxdmatransactionapi.cpp:

Go to the source code of this file.

Functions

_Must_inspect_result_ __drv_maxIRQL (DISPATCH_LEVEL) NTSTATUS WDFEXPORT(WdfDmaTransactionCreate)(__in PWDF_DRIVER_GLOBALS DriverGlobals
 
 FxObjectHandleGetPtrAndGlobals (GetFxDriverGlobals(DriverGlobals), DmaEnabler, FX_TYPE_DMA_ENABLER,(PVOID *) &pDmaEnabler, &pFxDriverGlobals)
 
 FxPointerNotNull (pFxDriverGlobals, DmaTransactionHandle)
 
 if (!NT_SUCCESS(status))
 
 switch (pDmaEnabler->GetProfile())
 
 FxObjectHandleGetPtrAndGlobals (GetFxDriverGlobals(DriverGlobals), DmaTransaction, FX_TYPE_DMA_TRANSACTION,(PVOID *) &pDmaTrans, &pFxDriverGlobals)
 
 FxPointerNotNull (pFxDriverGlobals, EvtProgramDmaFunction)
 
 if (DmaDirection !=WdfDmaDirectionReadFromDevice &&DmaDirection !=WdfDmaDirectionWriteToDevice)
 
 FxObjectHandleGetPtr (pFxDriverGlobals, Request, FX_TYPE_REQUEST,(PVOID *) &pReqObj)
 
 switch (stack->MajorFunction)
 
 if (reqLength==0)
 
 if (pDmaTrans->GetDmaEnabler() ->SupportsChainedMdls()==FALSE)
 
pDmaTrans SetRequest (pReqObj)
 
_Must_inspect_result_ __in WDFDMATRANSACTION __in PFN_WDF_PROGRAM_DMA __in WDF_DMA_DIRECTION __in PMDL __in size_t __in __drv_when (Length==0, __drv_reportError(Length cannot be zero)) size_t Length)
 
 FxObjectHandleGetPtr (GetFxDriverGlobals(DriverGlobals), DmaTransaction, FX_TYPE_DMA_TRANSACTION,(PVOID *) &pDmaTrans)
 
return pDmaTrans Execute (Context)
 
 __success (TRUE) __drv_maxIRQL(DISPATCH_LEVEL) NTSTATUS WDFEXPORT(WdfDmaTransactionRelease)(__in PWDF_DRIVER_GLOBALS DriverGlobals
 
pDmaTrans ReleaseForReuse (FALSE)
 
 FxPointerNotNull (pDmaTrans->GetDriverGlobals(), pStatus)
 
return pDmaTrans DmaCompleted (0, pStatus, FxDmaCompletionTypeFull)
 
return pDmaTrans DmaCompleted (TransferredLength, pStatus, FxDmaCompletionTypePartial)
 
return pDmaTrans DmaCompleted (FinalTransferredLength, pStatus, FxDmaCompletionTypeAbort)
 
return pDmaTrans GetBytesTransferred ()
 
pDmaTrans SetMaximumFragmentLength (MaximumLength)
 
 if (pRequest !=NULL)
 
return pDmaTrans GetCurrentFragmentLength ()
 
return pDmaTrans GetDmaEnabler () -> GetDeviceHandle()
 
 if ((profile !=WdfDmaProfileSystem) &&(profile !=WdfDmaProfileSystemDuplex))
 
systemTransaction SetConfigureChannelCallback (ConfigureRoutine, ConfigureContext)
 
systemTransaction SetTransferCompleteCallback (DmaCompletionRoutine, DmaCompletionContext)
 
systemTransaction SetDeviceAddressOffset (Offset)
 
 if (pDmaTrans->GetDmaEnabler() ->UsesDmaV3()==FALSE)
 
 if ((state==FxDmaTransactionStateInvalid)||(state==FxDmaTransactionStateCreated)||(state==FxDmaTransactionStateReleased)||(state==FxDmaTransactionStateDeleted))
 
return pDmaTrans GetTransferContext ()
 
pDmaTrans GetTransferInfo (MapRegisterCount, ScatterGatherElementCount)
 
pDmaTrans SetImmediateExecution (UseImmediateExecution)
 
 if ((profile !=WdfDmaProfilePacket) &&(profile !=WdfDmaProfilePacket64) &&(profile !=WdfDmaProfileSystem) &&(profile !=WdfDmaProfileSystemDuplex))
 
 FxPointerNotNull (pFxDriverGlobals, EvtReserveDmaFunction)
 
pDmaTrans ReleaseAdapter ()
 
return pDmaTrans CancelResourceAllocation ()
 
systemTransaction StopTransfer ()
 

Variables

_Must_inspect_result_ __in WDFDMAENABLER DmaEnabler
 
_Must_inspect_result_ __in WDFDMAENABLER __in_opt WDF_OBJECT_ATTRIBUTESAttributes
 
_Must_inspect_result_ __in WDFDMAENABLER __in_opt WDF_OBJECT_ATTRIBUTES __out WDFDMATRANSACTION * DmaTransactionHandle
 
FxDmaEnablerpDmaEnabler
 
PFX_DRIVER_GLOBALS pFxDriverGlobals
 
 status
 
_Must_inspect_result_ __in WDFDMATRANSACTION DmaTransaction
 
_Must_inspect_result_ __in WDFDMATRANSACTION __in WDFREQUEST Request
 
_Must_inspect_result_ __in WDFDMATRANSACTION __in WDFREQUEST __in PFN_WDF_PROGRAM_DMA EvtProgramDmaFunction
 
_Must_inspect_result_ __in WDFDMATRANSACTION __in WDFREQUEST __in PFN_WDF_PROGRAM_DMA __in WDF_DMA_DIRECTION DmaDirection
 
FxDmaTransactionBasepDmaTrans
 
FxRequestpReqObj
 
MDLmdl = NULL
 
PIO_STACK_LOCATION stack = pReqObj->GetFxIrp()->GetCurrentIrpStackLocation()
 
ULONG reqLength = 0
 
return STATUS_SUCCESS
 
_Must_inspect_result_ __in WDFDMATRANSACTION __in PFN_WDF_PROGRAM_DMA __in WDF_DMA_DIRECTION __in PMDL Mdl
 
_Must_inspect_result_ __in WDFDMATRANSACTION __in PFN_WDF_PROGRAM_DMA __in WDF_DMA_DIRECTION __in PMDL __in size_t Offset
 
_Must_inspect_result_ __in WDFDMATRANSACTION __in PFN_WDF_PROGRAM_DMA __in WDF_DMA_DIRECTION __in PMDL __in PVOID VirtualAddress
 
_Must_inspect_result_ __in WDFDMATRANSACTION __in_opt WDFCONTEXT Context
 
__in WDFDMATRANSACTION __out NTSTATUSpStatus
 
__in WDFDMATRANSACTION __in size_t TransferredLength
 
__in WDFDMATRANSACTION __in size_t FinalTransferredLength
 
__in WDFDMATRANSACTION __in size_t MaximumLength
 
FxRequestpRequest = pDmaTrans->GetRequest()
 
 else
 
__in WDFDMATRANSACTION __in_opt PFN_WDF_DMA_TRANSACTION_CONFIGURE_DMA_CHANNEL ConfigureRoutine
 
__in WDFDMATRANSACTION __in_opt PFN_WDF_DMA_TRANSACTION_CONFIGURE_DMA_CHANNEL __in_opt PVOID ConfigureContext
 
WDF_DMA_PROFILE profile = pDmaTrans->GetDmaEnabler()->GetProfile()
 
FxDmaSystemTransactionsystemTransaction = (FxDmaSystemTransaction*) pDmaTrans
 
__in WDFDMATRANSACTION __in_opt PFN_WDF_DMA_TRANSACTION_DMA_TRANSFER_COMPLETE DmaCompletionRoutine
 
__in WDFDMATRANSACTION __in_opt PFN_WDF_DMA_TRANSACTION_DMA_TRANSFER_COMPLETE __in_opt PVOID DmaCompletionContext
 
FxDmaTransactionState state = pDmaTrans->GetTransactionState()
 
__in WDFDMATRANSACTION __out_opt ULONGMapRegisterCount
 
__in WDFDMATRANSACTION __out_opt ULONG __out_opt ULONGScatterGatherElementCount
 
__in WDFDMATRANSACTION __in BOOLEAN UseImmediateExecution
 
__in WDFDMATRANSACTION __in WDF_DMA_DIRECTION __in ULONG RequiredMapRegisters
 
__in WDFDMATRANSACTION __in WDF_DMA_DIRECTION __in ULONG __in PFN_WDF_RESERVE_DMA EvtReserveDmaFunction
 
__in WDFDMATRANSACTION __in WDF_DMA_DIRECTION __in ULONG __in PFN_WDF_RESERVE_DMA __in PVOID EvtReserveDmaContext
 
 return
 

Function Documentation

◆ __drv_maxIRQL()

◆ __drv_when()

Definition at line 377 of file fxdmatransactionapi.cpp.

380 {
381  //
382  // Stub this out by calling the regular initialize method. Eventually
383  // the regular initialize method will call this instead.
384  //
385 
386  return WDFEXPORT(WdfDmaTransactionInitialize)(
390  DmaDirection,
391  Mdl,
393  Length
394  );
395 }
_Must_inspect_result_ __in WDFDMATRANSACTION __in PFN_WDF_PROGRAM_DMA __in WDF_DMA_DIRECTION __in PMDL Mdl
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
#define MmGetMdlVirtualAddress(_Mdl)
DriverGlobals
_Must_inspect_result_ __in WDFDMATRANSACTION __in WDFREQUEST __in PFN_WDF_PROGRAM_DMA __in WDF_DMA_DIRECTION DmaDirection
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define WDFEXPORT(a)
Definition: fxmacros.hpp:157
void * PVOID
Definition: retypes.h:9
_Must_inspect_result_ __in WDFDMATRANSACTION DmaTransaction
_Must_inspect_result_ __in WDFDMATRANSACTION __in WDFREQUEST __in PFN_WDF_PROGRAM_DMA EvtProgramDmaFunction
_In_ WDFDEVICE _In_ PVOID _In_opt_ PMDL Mdl
_Must_inspect_result_ __in WDFDMATRANSACTION __in PFN_WDF_PROGRAM_DMA __in WDF_DMA_DIRECTION __in PMDL __in size_t Offset

◆ __success()

__success ( TRUE  )

◆ CancelResourceAllocation()

return pDmaTrans CancelResourceAllocation ( )

◆ DmaCompleted() [1/3]

return pDmaTrans DmaCompleted ( ,
pStatus  ,
FxDmaCompletionTypeFull   
)

◆ DmaCompleted() [2/3]

◆ DmaCompleted() [3/3]

◆ Execute()

return pDmaTrans Execute ( Context  )

◆ FxObjectHandleGetPtr() [1/2]

FxObjectHandleGetPtr ( pFxDriverGlobals  ,
Request  ,
FX_TYPE_REQUEST  ,
(PVOID *) &  pReqObj 
)

◆ FxObjectHandleGetPtr() [2/2]

FxObjectHandleGetPtr ( GetFxDriverGlobals(DriverGlobals ,
DmaTransaction  ,
FX_TYPE_DMA_TRANSACTION  ,
(PVOID *) &  pDmaTrans 
)

◆ FxObjectHandleGetPtrAndGlobals() [1/2]

FxObjectHandleGetPtrAndGlobals ( GetFxDriverGlobals(DriverGlobals ,
DmaEnabler  ,
FX_TYPE_DMA_ENABLER  ,
(PVOID *) &  pDmaEnabler,
pFxDriverGlobals 
)

◆ FxObjectHandleGetPtrAndGlobals() [2/2]

FxObjectHandleGetPtrAndGlobals ( GetFxDriverGlobals(DriverGlobals ,
DmaTransaction  ,
FX_TYPE_DMA_TRANSACTION  ,
(PVOID *) &  pDmaTrans,
pFxDriverGlobals 
)

◆ FxPointerNotNull() [1/4]

FxPointerNotNull ( pFxDriverGlobals  ,
DmaTransactionHandle   
)

◆ FxPointerNotNull() [2/4]

FxPointerNotNull ( pFxDriverGlobals  ,
EvtProgramDmaFunction   
)

◆ FxPointerNotNull() [3/4]

FxPointerNotNull ( pDmaTrans->  GetDriverGlobals(),
pStatus   
)

◆ FxPointerNotNull() [4/4]

FxPointerNotNull ( pFxDriverGlobals  ,
EvtReserveDmaFunction   
)

◆ GetBytesTransferred()

return pDmaTrans GetBytesTransferred ( )

◆ GetCurrentFragmentLength()

return pDmaTrans GetCurrentFragmentLength ( )

◆ GetDmaEnabler()

return pDmaTrans GetDmaEnabler ( ) -> GetDeviceHandle()

◆ GetTransferContext()

return pDmaTrans GetTransferContext ( )

◆ GetTransferInfo()

◆ if() [1/9]

if ( NT_SUCCESSstatus)

Definition at line 67 of file fxdmatransactionapi.cpp.

67  {
68  return status;
69  }

◆ if() [2/9]

Definition at line 142 of file fxdmatransactionapi.cpp.

143  {
147  "Initialization of WDFDMATRANSACTION 0x%p using WDFREQUEST %p, "
148  "DmaDirection 0x%x is an invalid value, %!STATUS!",
150  return status;
151  }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
_In_ WDFREQUEST Request
Definition: wdfdevice.h:547
#define TRACINGDMA
Definition: dbgtrace.h:71
_In_ WDFDMAENABLER _In_ WDF_DMA_DIRECTION DmaDirection
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
PFX_DRIVER_GLOBALS pFxDriverGlobals
_Must_inspect_result_ _In_ WDFDMAENABLER _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFDMATRANSACTION * DmaTransaction
Definition: ps.c:97

◆ if() [3/9]

if ( reqLength  = = 0)

Definition at line 303 of file fxdmatransactionapi.cpp.

303  {
307  "Zero length request, %!STATUS!", status);
308  return status;
309  }
#define STATUS_INVALID_DEVICE_REQUEST
Definition: udferr_usr.h:138
#define TRACINGDMA
Definition: dbgtrace.h:71
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
PFX_DRIVER_GLOBALS pFxDriverGlobals
Definition: ps.c:97

◆ if() [4/9]

if ( pDmaTrans->  GetDmaEnabler) ->SupportsChainedMdls( = FALSE)

Definition at line 317 of file fxdmatransactionapi.cpp.

317  {
318  ULONG length;
319 
321 
322  if (reqLength > length) {
326  "WDFREQUEST %p transfer length (%d) is out of bounds of MDL "
327  "Byte count (%d), %!STATUS!",
329 
330  return status;
331  }
332  }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
_In_ WDFREQUEST Request
Definition: wdfdevice.h:547
#define TRACINGDMA
Definition: dbgtrace.h:71
ULONG reqLength
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
MDL * mdl
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
#define MmGetMdlByteCount(_Mdl)
unsigned int ULONG
Definition: retypes.h:1
PFX_DRIVER_GLOBALS pFxDriverGlobals
Definition: ps.c:97

◆ if() [5/9]

if ( pRequest = NULL)

Definition at line 716 of file fxdmatransactionapi.cpp.

716  {
717  return pRequest->GetHandle();
718  }
FxRequest * pRequest
__inline WDFREQUEST GetHandle(VOID)

◆ if() [6/9]

Definition at line 790 of file fxdmatransactionapi.cpp.

791  {
793  "Cannot call %!FUNC! on non-system-profile "
794  "WDFDMATRANSACTION (%p) (transaction profile "
795  "is %!WDF_DMA_PROFILE!).",
797  profile);
799  return;
800  }
#define TRACINGDMA
Definition: dbgtrace.h:71
WDF_DMA_PROFILE profile
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
PFX_DRIVER_GLOBALS pFxDriverGlobals
_Must_inspect_result_ _In_ WDFDMAENABLER _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFDMATRANSACTION * DmaTransaction
FxVerifierDbgBreakPoint(pFxDriverGlobals)

◆ if() [7/9]

if ( pDmaTrans->  GetDmaEnabler) ->UsesDmaV3( = FALSE)

Definition at line 926 of file fxdmatransactionapi.cpp.

926  {
928  "Cannot call %!FUNC! for WDFDMATRANSACTION %p "
929  "because the parent WDFDMAENABLER (%p) is not "
930  "configured to use DMA version 3.",
934  return NULL;
935  }
#define TRACINGDMA
Definition: dbgtrace.h:71
__inline WDFDMAENABLER GetHandle(VOID)
__forceinline FxDmaEnabler * GetDmaEnabler(VOID)
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
#define NULL
Definition: types.h:112
FxDmaTransactionBase * pDmaTrans
PFX_DRIVER_GLOBALS pFxDriverGlobals
_Must_inspect_result_ _In_ WDFDMAENABLER _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFDMATRANSACTION * DmaTransaction
FxVerifierDbgBreakPoint(pFxDriverGlobals)

◆ if() [8/9]

Definition at line 939 of file fxdmatransactionapi.cpp.

942  {
944  "Cannot call %!FUNC! on WDFDMATRANSACTION %p "
945  "becuase it is uninitialized, reused, deleted "
946  "(state is %!FxDmaTransactionState!).",
948  state
949  );
951  return NULL;
952  }
#define TRACINGDMA
Definition: dbgtrace.h:71
FxDmaTransactionState state
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
#define NULL
Definition: types.h:112
PFX_DRIVER_GLOBALS pFxDriverGlobals
_Must_inspect_result_ _In_ WDFDMAENABLER _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFDMATRANSACTION * DmaTransaction
FxVerifierDbgBreakPoint(pFxDriverGlobals)

◆ if() [9/9]

Definition at line 1072 of file fxdmatransactionapi.cpp.

1075  {
1076 
1078 
1080  "Cannot call %!FUNC! on non packet or system "
1081  "profile WDFDMATRANSACTION (%p) (transaction "
1082  "profile is %!WDF_DMA_PROFILE!) - %!STATUS!.",
1084  profile,
1085  status);
1087  return status;
1088  }
#define STATUS_INVALID_DEVICE_REQUEST
Definition: udferr_usr.h:138
#define TRACINGDMA
Definition: dbgtrace.h:71
WDF_DMA_PROFILE profile
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
PFX_DRIVER_GLOBALS pFxDriverGlobals
_Must_inspect_result_ _In_ WDFDMAENABLER _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFDMATRANSACTION * DmaTransaction
FxVerifierDbgBreakPoint(pFxDriverGlobals)
Definition: ps.c:97

◆ ReleaseAdapter()

pDmaTrans ReleaseAdapter ( )

◆ ReleaseForReuse()

pDmaTrans ReleaseForReuse ( FALSE  )

◆ SetConfigureChannelCallback()

systemTransaction SetConfigureChannelCallback ( ConfigureRoutine  ,
ConfigureContext   
)

◆ SetDeviceAddressOffset()

systemTransaction SetDeviceAddressOffset ( Offset  )

◆ SetImmediateExecution()

pDmaTrans SetImmediateExecution ( UseImmediateExecution  )

◆ SetMaximumFragmentLength()

pDmaTrans SetMaximumFragmentLength ( MaximumLength  )

◆ SetRequest()

pDmaTrans SetRequest ( pReqObj  )

◆ SetTransferCompleteCallback()

systemTransaction SetTransferCompleteCallback ( DmaCompletionRoutine  ,
DmaCompletionContext   
)

◆ StopTransfer()

systemTransaction StopTransfer ( )

◆ switch() [1/2]

switch ( pDmaEnabler->  GetProfile())

Definition at line 71 of file fxdmatransactionapi.cpp.

72  {
76  Attributes,
79  break;
80 
87  Attributes,
90  );
91  break;
92 
96  Attributes,
99  break;
100 
101  default:
102  NT_ASSERTMSG("Unknown profile for DMA enabler", FALSE);
104  break;
105  }
#define NT_ASSERTMSG
Definition: rtlfuncs.h:3313
_Must_inspect_result_ __in WDFDMAENABLER __in_opt WDF_OBJECT_ATTRIBUTES __out WDFDMATRANSACTION * DmaTransactionHandle
#define FALSE
Definition: types.h:117
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
static _Must_inspect_result_ NTSTATUS _Create(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in PWDF_OBJECT_ATTRIBUTES Attributes, __in FxDmaEnabler *DmaEnabler, __out WDFDMATRANSACTION *Transaction)
static _Must_inspect_result_ NTSTATUS _Create(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in PWDF_OBJECT_ATTRIBUTES Attributes, __in FxDmaEnabler *DmaEnabler, __out WDFDMATRANSACTION *Transaction)
FxDmaEnabler * pDmaEnabler
static _Must_inspect_result_ NTSTATUS _Create(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in PWDF_OBJECT_ATTRIBUTES Attributes, __in FxDmaEnabler *DmaEnabler, __out WDFDMATRANSACTION *Transaction)
PFX_DRIVER_GLOBALS pFxDriverGlobals
_Must_inspect_result_ _In_ WDFDMAENABLER _In_ _In_opt_ PWDF_OBJECT_ATTRIBUTES Attributes
Definition: ps.c:97

◆ switch() [2/2]

switch ( stack->  MajorFunction)

Definition at line 165 of file fxdmatransactionapi.cpp.

165  {
166 
167  case IRP_MJ_READ:
168 
171 
173  "Dma direction %!WDF_DMA_DIRECTION! of WDFTRANSACTION "
174  "0x%p doesn't match with the WDFREQUEST 0x%p type "
175  "%!WDF_REQUEST_TYPE! %!STATUS!",
177  stack->MajorFunction, status);
178 
179  return status;
180  }
181 
182  reqLength = stack->Parameters.Read.Length;
183 
184  status = pReqObj->GetMdl(&mdl);
185  break;
186 
187  case IRP_MJ_WRITE:
188 
191 
193  "Dma direction %!WDF_DMA_DIRECTION! of WDFTRANSACTION "
194  "0x%p doesn't match with the WDFREQUEST 0x%p type "
195  "%!WDF_REQUEST_TYPE! %!STATUS!",
197  stack->MajorFunction, status);
198 
199  return status;
200  }
201 
202  reqLength = stack->Parameters.Write.Length;
203 
204  status = pReqObj->GetMdl(&mdl);
205  break;
206 
209 
210  switch (METHOD_FROM_CTL_CODE(stack->Parameters.DeviceIoControl.IoControlCode)) {
211  case METHOD_BUFFERED:
212 
214  reqLength = stack->Parameters.DeviceIoControl.InputBufferLength;
215  } else {
216  reqLength = stack->Parameters.DeviceIoControl.OutputBufferLength;
217  }
218 
219  //
220  // In this case both input buffer and output buffer map
221  // to the same MDL and it's probed for read & write access.
222  // So it's okay for DMA transfer in either direction.
223  //
224  status = pReqObj->GetMdl(&mdl);
225  break;
226 
227  case METHOD_IN_DIRECT:
228  //
229  // For this type, the output buffer is probed for read access.
230  // So the direction of DMA transfer is WdfDmaDirectionWriteToDevice.
231  //
233 
235 
238  "Dma direction %!WDF_DMA_DIRECTION! of WDFTRANSACTION "
239  "0x%p doesn't match with WDFREQUEST 0x%p ioctl type "
240  "METHOD_IN_DIRECT %!STATUS!",
242  return status;
243  }
244 
245  reqLength = stack->Parameters.DeviceIoControl.OutputBufferLength;
246 
248 
249  break;
250 
251  case METHOD_OUT_DIRECT:
252  //
253  // For this type, the output buffer is probed for write access.
254  // So the direction of DMA transfer is WdfDmaDirectionReadFromDevice.
255  //
257 
259 
262  "Dma direction %!WDF_DMA_DIRECTION! of WDFTRANSACTION "
263  "0x%p doesn't match with WDFREQUEST 0x%p ioctl type "
264  "METHOD_OUT_DIRECT %!STATUS!",
266 
267  return status;
268  }
269 
270  reqLength = stack->Parameters.DeviceIoControl.OutputBufferLength;
271 
273 
274  break;
275  default:
276 
278 
280  "Invalid ioctl code in WDFREQUEST 0x%p %!STATUS!",
281  Request, status);
282 
284  break;
285 
286  }// End of switch(ioctType)
287  break;
288 
289  default:
291  break;
292 
293  }
#define METHOD_FROM_CTL_CODE(ctrlCode)
#define STATUS_INVALID_DEVICE_REQUEST
Definition: udferr_usr.h:138
_In_ WDFREQUEST Request
Definition: wdfdevice.h:547
_Must_inspect_result_ NTSTATUS GetDeviceControlOutputMdl(__out PMDL *pMdl)
_Must_inspect_result_ NTSTATUS GetMdl(__out PMDL *pMdl)
Definition: fxrequestkm.cpp:80
#define METHOD_IN_DIRECT
Definition: nt_native.h:595
#define TRACINGDMA
Definition: dbgtrace.h:71
ULONG reqLength
_In_ WDFDMAENABLER _In_ WDF_DMA_DIRECTION DmaDirection
Definition: _stack.h:47
#define METHOD_OUT_DIRECT
Definition: nt_native.h:596
#define IRP_MJ_INTERNAL_DEVICE_CONTROL
MDL * mdl
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
FxRequest * pReqObj
#define METHOD_BUFFERED
Definition: nt_native.h:594
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
#define IRP_MJ_READ
Definition: rdpdr.c:46
#define IRP_MJ_WRITE
Definition: rdpdr.c:47
PFX_DRIVER_GLOBALS pFxDriverGlobals
_Must_inspect_result_ _In_ WDFDMAENABLER _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFDMATRANSACTION * DmaTransaction
FxVerifierDbgBreakPoint(pFxDriverGlobals)
#define IRP_MJ_DEVICE_CONTROL
Definition: rdpdr.c:52
Definition: ps.c:97

Variable Documentation

◆ Attributes

◆ ConfigureContext

◆ ConfigureRoutine

◆ Context

Initial value:

Definition at line 531 of file fxdmatransactionapi.cpp.

◆ DmaCompletionContext

◆ DmaCompletionRoutine

◆ DmaDirection

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

Definition at line 125 of file fxdmatransactionapi.cpp.

Referenced by __drv_when().

◆ DmaEnabler

Definition at line 42 of file fxdmatransactionapi.cpp.

◆ DmaTransaction

__in WDFDMATRANSACTION DmaTransaction
Initial value:

Definition at line 117 of file fxdmatransactionapi.cpp.

Referenced by __drv_when().

◆ DmaTransactionHandle

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

Definition at line 48 of file fxdmatransactionapi.cpp.

Referenced by switch().

◆ else

else
Initial value:
{
return NULL
#define NULL
Definition: types.h:112

Definition at line 719 of file fxdmatransactionapi.cpp.

◆ EvtProgramDmaFunction

◆ EvtReserveDmaContext

◆ EvtReserveDmaFunction

◆ FinalTransferredLength

Definition at line 632 of file fxdmatransactionapi.cpp.

◆ MapRegisterCount

__in WDFDMATRANSACTION __out_opt ULONG* MapRegisterCount

Definition at line 963 of file fxdmatransactionapi.cpp.

◆ MaximumLength

__in WDFDMATRANSACTION __in size_t MaximumLength
Initial value:

Definition at line 686 of file fxdmatransactionapi.cpp.

◆ mdl

◆ Mdl

◆ Offset

__in WDFDMATRANSACTION __in ULONG Offset
Initial value:

Definition at line 367 of file fxdmatransactionapi.cpp.

Referenced by __drv_when().

◆ pDmaEnabler

FxDmaEnabler* pDmaEnabler

Definition at line 50 of file fxdmatransactionapi.cpp.

Referenced by switch().

◆ pDmaTrans

Definition at line 127 of file fxdmatransactionapi.cpp.

Referenced by if().

◆ pFxDriverGlobals

PFX_DRIVER_GLOBALS pFxDriverGlobals

Definition at line 51 of file fxdmatransactionapi.cpp.

Referenced by if(), and switch().

◆ pReqObj

FxRequest* pReqObj

Definition at line 128 of file fxdmatransactionapi.cpp.

Referenced by switch().

◆ pRequest

◆ profile

Definition at line 789 of file fxdmatransactionapi.cpp.

Referenced by AssociateColorProfileWithDeviceA(), AssociateColorProfileWithDeviceW(), CloseColorProfile(), ColorContext_InitializeFromFilename(), ColorContext_InitializeFromMemory(), compile_pixel_shader9(), ConvertColorNameToIndex(), ConvertIndexToColorName(), CreateColorTransformW(), CreateMultiProfileTransform(), D3DXCompileShader(), D3DXCompileShaderFromFileA(), D3DXCompileShaderFromFileW(), D3DXCompileShaderFromResourceA(), D3DXCompileShaderFromResourceW(), DECLARE_INTERFACE_(), DelOld(), DisassociateColorProfileFromDeviceA(), DisassociateColorProfileFromDeviceW(), EnumTfInputProcessorProfiles_Next(), fw_policy_get_CurrentProfile(), fw_policy_GetProfileByType(), fwpolicy2_get_CurrentProfileTypes(), get_active_textservice(), GetColorProfileElement(), GetColorProfileElementTag(), GetColorProfileFromHandle(), GetColorProfileHeader(), GetCountColorProfileElements(), GetNamedProfileInfo(), GetPS2ColorRenderingDictionary(), GetPS2ColorRenderingIntent(), GetPS2ColorSpaceArray(), GetStandardColorSpaceProfileA(), GetStandardColorSpaceProfileW(), header_from_file(), if(), InputProcessorProfiles_GetActiveLanguageProfile(), InsNew(), InstallColorProfileA(), InstallColorProfileW(), is_firewall_enabled(), IsColorProfileTagPresent(), IsColorProfileValid(), load_profile(), MAPILogon(), MAPILogonEx(), next_LanguageProfile(), OpenColorProfileA(), OpenColorProfileW(), set_firewall(), set_profile_device_key(), SetColorProfileElement(), SetColorProfileElementReference(), SetColorProfileElementSize(), SetColorProfileHeader(), SetStandardColorSpaceProfileA(), SetStandardColorSpaceProfileW(), test_AssociateColorProfileWithDeviceA(), test_CreateMultiProfileTransform(), test_EnumLanguageProfiles(), test_GetColorProfileElement(), test_GetColorProfileElementTag(), test_GetColorProfileFromHandle(), test_GetColorProfileHeader(), test_GetCountColorProfileElements(), test_IsColorProfileTagPresent(), test_OpenColorProfileA(), test_OpenColorProfileW(), test_profile_manager_interfaces(), test_SetColorProfileElement(), test_SetColorProfileHeader(), test_SetICMProfileA(), test_SetICMProfileW(), test_wmreader_interfaces(), test_wmsyncreader_interfaces(), UninstallColorProfileA(), UninstallColorProfileW(), WMProfileManager_LoadProfileByData(), WMProfileManager_SaveProfile(), WMWriter_SetProfile(), xsltApplyStylesheetInternal(), xsltApplyStylesheetUser(), and xsltRunStylesheetUser().

◆ pStatus

◆ reqLength

reqLength = 0

Definition at line 131 of file fxdmatransactionapi.cpp.

Referenced by if(), and switch().

◆ Request

_Must_inspect_result_ __in WDFDMATRANSACTION __in WDFREQUEST Request

Definition at line 117 of file fxdmatransactionapi.cpp.

◆ RequiredMapRegisters

Definition at line 1027 of file fxdmatransactionapi.cpp.

◆ return

return

Definition at line 1168 of file fxdmatransactionapi.cpp.

◆ ScatterGatherElementCount

Initial value:

Definition at line 969 of file fxdmatransactionapi.cpp.

◆ stack

stack = pReqObj->GetFxIrp()->GetCurrentIrpStackLocation()

Definition at line 130 of file fxdmatransactionapi.cpp.

◆ state

FxDmaTransactionState state = pDmaTrans->GetTransactionState()

Definition at line 937 of file fxdmatransactionapi.cpp.

Referenced by if().

◆ status

Initial value:
)
_Must_inspect_result_ NTSTATUS FxValidateObjectAttributes(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in PWDF_OBJECT_ATTRIBUTES Attributes, __in ULONG Flags=FX_VALIDATE_OPTION_NONE_SPECIFIED)
PFX_DRIVER_GLOBALS pFxDriverGlobals
_Must_inspect_result_ _In_ WDFDMAENABLER _In_ _In_opt_ PWDF_OBJECT_ATTRIBUTES Attributes

Definition at line 63 of file fxdmatransactionapi.cpp.

Referenced by if(), and switch().

◆ STATUS_SUCCESS

return STATUS_SUCCESS

Definition at line 356 of file fxdmatransactionapi.cpp.

◆ systemTransaction

◆ TransferredLength

__in WDFDMATRANSACTION __in size_t TransferredLength

Definition at line 602 of file fxdmatransactionapi.cpp.

◆ UseImmediateExecution

Initial value:

Definition at line 996 of file fxdmatransactionapi.cpp.

◆ VirtualAddress