ReactOS  0.4.15-dev-3017-g1d9542d
FxUsbPipeTransferContext Struct Reference

#include <fxusbpipe.hpp>

Inheritance diagram for FxUsbPipeTransferContext:
Collaboration diagram for FxUsbPipeTransferContext:

Public Member Functions

 FxUsbPipeTransferContext (__in FX_URB_TYPE UrbType)
 
 ~FxUsbPipeTransferContext (VOID)
 
__checkReturn NTSTATUS AllocateUrb (__in USBD_HANDLE USBDHandle)
 
virtual VOID Dispose (VOID)
 
virtual VOID CopyParameters (__in FxRequestBase *Request)
 
virtual VOID StoreAndReferenceMemory (__in FxRequestBuffer *Buffer)
 
virtual VOID ReleaseAndRestore (__in FxRequestBase *Request)
 
VOID SetUrbInfo (__in USBD_PIPE_HANDLE PipeHandle, __in ULONG TransferFlags)
 
USBD_STATUS GetUsbdStatus (VOID)
 
ULONG GetUrbTransferLength (VOID)
 
- Public Member Functions inherited from FxUsbRequestContext
 FxUsbRequestContext (__in FX_REQUEST_CONTEXT_TYPE Type)
 
VOID SetUsbType (__in WDF_USB_REQUEST_TYPE Type)
 
VOID __inline InitUsbParameters (VOID)
 
- Public Member Functions inherited from FxRequestContext
 FxRequestContext (__in FX_REQUEST_CONTEXT_TYPE Type)
 
virtual ~FxRequestContext (VOID)
 
__inline BOOLEAN IsType (__in FX_REQUEST_CONTEXT_TYPE Type)
 
VOID FormatWriteParams (__in_opt IFxMemory *WriteMemory, __in_opt PWDFMEMORY_OFFSET WriteOffsets)
 
VOID FormatReadParams (__in_opt IFxMemory *ReadMemory, __in_opt PWDFMEMORY_OFFSET ReadOffsets)
 
VOID FormatOtherParams (__in FxInternalIoctlParams *InternalIoctlParams)
 
- Public Member Functions inherited from FxStump
PVOID operator new (__in size_t Size, __in PFX_DRIVER_GLOBALS FxDriverGlobals)
 
PVOID operator new (__in size_t Size, __in PFX_DRIVER_GLOBALS FxDriverGlobals, __in POOL_TYPE PoolType)
 
VOID operator delete (__in PVOID pointer)
 
PVOID operator new[] (__in size_t Size, __in PFX_DRIVER_GLOBALS FxDriverGlobals)
 
VOID operator delete[] (__in PVOID pointer)
 

Public Attributes

_URB_BULK_OR_INTERRUPT_TRANSFER m_UrbLegacy
 
_URB_BULK_OR_INTERRUPT_TRANSFERm_Urb
 
PMDL m_PartialMdl
 
BOOLEAN m_UnlockPages
 
- Public Attributes inherited from FxUsbRequestContext
WDF_USB_REQUEST_COMPLETION_PARAMS m_UsbParameters
 
UMURB m_UmUrb
 
- Public Attributes inherited from FxRequestContext
WDF_REQUEST_COMPLETION_PARAMS m_CompletionParams
 
IFxMemorym_RequestMemory
 
FX_REQUEST_CONTEXT_TYPE m_RequestType
 

Private Attributes

USBD_HANDLE m_USBDHandle
 

Additional Inherited Members

- Protected Member Functions inherited from FxRequestContext
VOID __inline InitCompletionParams (VOID)
 
- Protected Member Functions inherited from FxStump
 FxStump (VOID)
 
- Static Protected Member Functions inherited from FxRequestContext
static VOID _StoreAndReferenceMemoryWorker (__in PVOID Tag, __deref_out_opt IFxMemory **PPMemory, __in FxRequestBuffer *Buffer)
 

Detailed Description

Definition at line 20 of file fxusbpipe.hpp.

Constructor & Destructor Documentation

◆ FxUsbPipeTransferContext()

FxUsbPipeTransferContext::FxUsbPipeTransferContext ( __in FX_URB_TYPE  UrbType)

Definition at line 794 of file fxusbpipe.cpp.

796  :
798 {
800  m_PartialMdl = NULL;
801  m_USBDHandle = NULL;
802 
803  if (FxUrbType == FxUrbTypeLegacy) {
804  m_Urb = &m_UrbLegacy;
805  }
806  else {
807  m_Urb = NULL;
808  }
809 
810 }
USBD_HANDLE m_USBDHandle
Definition: fxusbpipe.hpp:83
#define FALSE
Definition: types.h:117
_URB_BULK_OR_INTERRUPT_TRANSFER m_UrbLegacy
Definition: fxusbpipe.hpp:86
#define NULL
Definition: types.h:112
FxUsbRequestContext(__in FX_REQUEST_CONTEXT_TYPE Type)
_URB_BULK_OR_INTERRUPT_TRANSFER * m_Urb
Definition: fxusbpipe.hpp:91

◆ ~FxUsbPipeTransferContext()

FxUsbPipeTransferContext::~FxUsbPipeTransferContext ( VOID  )

Definition at line 812 of file fxusbpipe.cpp.

815 {
816  if (m_Urb && (m_Urb != &m_UrbLegacy)) {
818  }
819  m_Urb = NULL;
820  m_USBDHandle = NULL;
821 }
USBD_HANDLE m_USBDHandle
Definition: fxusbpipe.hpp:83
_URB_BULK_OR_INTERRUPT_TRANSFER m_UrbLegacy
Definition: fxusbpipe.hpp:86
VOID USBD_UrbFree(_In_ USBD_HANDLE USBDHandle, _In_ PURB Urb)
Definition: usbstubum.cpp:33
Definition: usb.h:529
#define NULL
Definition: types.h:112
_URB_BULK_OR_INTERRUPT_TRANSFER * m_Urb
Definition: fxusbpipe.hpp:91

Member Function Documentation

◆ AllocateUrb()

__checkReturn NTSTATUS FxUsbPipeTransferContext::AllocateUrb ( __in USBD_HANDLE  USBDHandle)

Definition at line 825 of file fxusbpipe.cpp.

828 {
830 
831  if (m_Urb) {
833  goto Done;
834  }
835 
836  status = USBD_UrbAllocate(USBDHandle, (PURB*)&m_Urb);
837 
838  if (!NT_SUCCESS(status)) {
839  goto Done;
840  }
841 
842  m_USBDHandle = USBDHandle;
843 
844 Done:
845  return status;
846 }
USBD_HANDLE m_USBDHandle
Definition: fxusbpipe.hpp:83
LONG NTSTATUS
Definition: precomp.h:26
#define STATUS_INVALID_DEVICE_STATE
Definition: udferr_usr.h:178
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
Definition: usb.h:529
NTSTATUS USBD_UrbAllocate(_In_ USBD_HANDLE USBDHandle, _Outptr_result_bytebuffer_(sizeof(URB)) PURB *Urb)
Definition: usbstubum.cpp:46
static SERVICE_STATUS status
Definition: service.c:31
_URB_BULK_OR_INTERRUPT_TRANSFER * m_Urb
Definition: fxusbpipe.hpp:91
Definition: ps.c:97

Referenced by FxUsbPipe::FormatTransferRequest().

◆ CopyParameters()

VOID FxUsbPipeTransferContext::CopyParameters ( __in FxRequestBase Request)
virtual

Reimplemented from FxUsbRequestContext.

Definition at line 883 of file fxusbpipe.cpp.

886 {
888 
889  //
890  // If both are at the same offset, we don't have to compare type for
891  // Read or Write
892  //
894  Parameters.PipeRead.Length) ==
896  Parameters.PipeWrite.Length));
897 
900 }
_Must_inspect_result_ _In_ WDFQUEUE _In_opt_ WDFREQUEST _In_opt_ WDFFILEOBJECT _Inout_opt_ PWDF_REQUEST_PARAMETERS Parameters
Definition: wdfio.h:863
WDFCASSERT(sizeof(WDF_DRIVER_CONFIG_V1_0)==sizeof(WDF_DRIVER_CONFIG_V1_1))
ULONG GetUrbTransferLength(VOID)
Definition: fxusbpipe.hpp:71
_In_ WDFREQUEST Request
Definition: wdfdevice.h:547
virtual VOID CopyParameters(__in FxRequestBase *Request)
union _WDF_USB_REQUEST_COMPLETION_PARAMS::@3672 Parameters
struct _WDF_USB_REQUEST_COMPLETION_PARAMS::@3672::@3677 PipeRead
WDF_USB_REQUEST_COMPLETION_PARAMS m_UsbParameters
WDF_REQUEST_COMPLETION_PARAMS m_CompletionParams
struct _WDF_USB_REQUEST_COMPLETION_PARAMS::@3672::@3676 PipeWrite
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255

◆ Dispose()

VOID FxUsbPipeTransferContext::Dispose ( VOID  )
virtual

Reimplemented from FxRequestContext.

Definition at line 849 of file fxusbpipe.cpp.

852 {
853  if (m_Urb && (m_Urb != &m_UrbLegacy)){
855  m_Urb = NULL;
856  m_USBDHandle = NULL;
857  }
858 }
USBD_HANDLE m_USBDHandle
Definition: fxusbpipe.hpp:83
_URB_BULK_OR_INTERRUPT_TRANSFER m_UrbLegacy
Definition: fxusbpipe.hpp:86
VOID USBD_UrbFree(_In_ USBD_HANDLE USBDHandle, _In_ PURB Urb)
Definition: usbstubum.cpp:33
Definition: usb.h:529
#define NULL
Definition: types.h:112
_URB_BULK_OR_INTERRUPT_TRANSFER * m_Urb
Definition: fxusbpipe.hpp:91

◆ GetUrbTransferLength()

ULONG FxUsbPipeTransferContext::GetUrbTransferLength ( VOID  )
inline

Definition at line 71 of file fxusbpipe.hpp.

74  {
75 #if (FX_CORE_MODE == FX_CORE_KERNEL_MODE)
77 #elif (FX_CORE_MODE == FX_CORE_USER_MODE)
78  return m_UmUrb.UmUrbBulkOrInterruptTransfer.TransferBufferLength;
79 #endif
80  }
struct _UMURB_BULK_OR_INTERRUPT_TRANSFER UmUrbBulkOrInterruptTransfer
Definition: umusb.h:203
_URB_BULK_OR_INTERRUPT_TRANSFER * m_Urb
Definition: fxusbpipe.hpp:91

Referenced by CopyParameters().

◆ GetUsbdStatus()

USBD_STATUS FxUsbPipeTransferContext::GetUsbdStatus ( VOID  )
virtual

Implements FxUsbRequestContext.

Definition at line 913 of file fxusbpipe.cpp.

916 {
917  return m_Urb->Hdr.Status;
918 }
struct _URB_HEADER Hdr
Definition: usb.h:498
_URB_BULK_OR_INTERRUPT_TRANSFER * m_Urb
Definition: fxusbpipe.hpp:91

◆ ReleaseAndRestore()

VOID FxUsbPipeTransferContext::ReleaseAndRestore ( __in FxRequestBase Request)
virtual

Reimplemented from FxRequestContext.

Definition at line 861 of file fxusbpipe.cpp.

864 {
865 #if (FX_CORE_MODE == FX_CORE_KERNEL_MODE)
866  //
867  // Check now because Init will NULL out the field
868  //
869  if (m_PartialMdl != NULL) {
870  if (m_UnlockPages) {
873  }
874 
875  FxMdlFree(Request->GetDriverGlobals(), m_PartialMdl);
876  m_PartialMdl = NULL;
877  }
878 #endif
880 }
_In_ WDFREQUEST Request
Definition: wdfdevice.h:547
VOID NTAPI MmUnlockPages(IN PMDL Mdl)
Definition: mdlsup.c:1426
#define FALSE
Definition: types.h:117
virtual VOID ReleaseAndRestore(__in FxRequestBase *Request)
VOID __inline FxMdlFree(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in PMDL Mdl)
Definition: fxmdl.h:60
#define NULL
Definition: types.h:112

◆ SetUrbInfo()

VOID FxUsbPipeTransferContext::SetUrbInfo ( __in USBD_PIPE_HANDLE  PipeHandle,
__in ULONG  TransferFlags 
)

Definition at line 903 of file fxusbpipe.cpp.

907 {
908  m_Urb->TransferFlags = TransferFlags;
910 }
USBD_PIPE_HANDLE PipeHandle
Definition: usb.h:499
static HANDLE PipeHandle
Definition: dhcpcsvc.c:21
_URB_BULK_OR_INTERRUPT_TRANSFER * m_Urb
Definition: fxusbpipe.hpp:91

Referenced by FxUsbPipe::FormatTransferRequest().

◆ StoreAndReferenceMemory()

VOID FxUsbPipeTransferContext::StoreAndReferenceMemory ( __in FxRequestBuffer Buffer)
virtual

Reimplemented from FxRequestContext.

Definition at line 13 of file fxusbpipekm.cpp.

29 {
30  RtlZeroMemory(m_Urb, sizeof(*m_Urb));
31 
33  m_Urb->Hdr.Length = sizeof(*m_Urb);
34 
36 
37  Buffer->AssignValues(&m_Urb->TransferBuffer,
40 
41  //
42  // If we have built a partial MDL, use that instead. TransferBufferLength
43  // is still valid because the Offsets or length in Buffer will have been
44  // used to create this PartialMdl by the caller.
45  //
46  if (m_PartialMdl != NULL) {
48  }
49 }
struct _URB_HEADER Hdr
Definition: usb.h:498
Definition: bufpool.h:45
virtual VOID StoreAndReferenceMemory(__in FxRequestBuffer *Buffer)
#define NULL
Definition: types.h:112
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
#define URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER
Definition: usb.h:95
_URB_BULK_OR_INTERRUPT_TRANSFER * m_Urb
Definition: fxusbpipe.hpp:91

Referenced by FxUsbPipe::FormatTransferRequest().

Member Data Documentation

◆ m_PartialMdl

PMDL FxUsbPipeTransferContext::m_PartialMdl

◆ m_UnlockPages

BOOLEAN FxUsbPipeTransferContext::m_UnlockPages

◆ m_Urb

◆ m_UrbLegacy

_URB_BULK_OR_INTERRUPT_TRANSFER FxUsbPipeTransferContext::m_UrbLegacy

◆ m_USBDHandle

USBD_HANDLE FxUsbPipeTransferContext::m_USBDHandle
private

The documentation for this struct was generated from the following files: