ReactOS 0.4.16-dev-122-g325d74c
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)
 
virtual USBD_STATUS GetUsbdStatus (VOID)=0
 
virtual VOID CopyParameters (__in FxRequestBase *Request)
 
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)
 
virtual VOID Dispose (VOID)
 
virtual VOID StoreAndReferenceMemory (__in FxRequestBuffer *Buffer)
 
virtual VOID ReleaseAndRestore (__in FxRequestBase *Request)
 
__inline BOOLEAN IsType (__in FX_REQUEST_CONTEXT_TYPE Type)
 
virtual VOID CopyParameters (__in FxRequestBase *Request)
 
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{
802
803 if (FxUrbType == FxUrbTypeLegacy) {
805 }
806 else {
807 m_Urb = NULL;
808 }
809
810}
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
@ FX_RCT_USB_PIPE_XFER
@ FxUrbTypeLegacy
Definition: fxusbdevice.hpp:27
_URB_BULK_OR_INTERRUPT_TRANSFER m_UrbLegacy
Definition: fxusbpipe.hpp:86
_URB_BULK_OR_INTERRUPT_TRANSFER * m_Urb
Definition: fxusbpipe.hpp:91
USBD_HANDLE m_USBDHandle
Definition: fxusbpipe.hpp:83

◆ ~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;
821}
Definition: usb.h:529
VOID USBD_UrbFree(_In_ USBD_HANDLE USBDHandle, _In_ PURB Urb)
Definition: usbstubum.cpp:33

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
844Done:
845 return status;
846}
LONG NTSTATUS
Definition: precomp.h:26
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
Definition: ps.c:97
#define STATUS_INVALID_DEVICE_STATE
Definition: udferr_usr.h:178
NTSTATUS USBD_UrbAllocate(_In_ USBD_HANDLE USBDHandle, _Outptr_result_bytebuffer_(sizeof(URB)) PURB *Urb)
Definition: usbstubum.cpp:46

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}
WDF_REQUEST_COMPLETION_PARAMS m_CompletionParams
ULONG GetUrbTransferLength(VOID)
Definition: fxusbpipe.hpp:71
WDF_USB_REQUEST_COMPLETION_PARAMS m_UsbParameters
virtual VOID CopyParameters(__in FxRequestBase *Request)
struct _WDF_USB_REQUEST_COMPLETION_PARAMS::@3903::@3907 PipeWrite
union _WDF_USB_REQUEST_COMPLETION_PARAMS::@3903 Parameters
struct _WDF_USB_REQUEST_COMPLETION_PARAMS::@3903::@3908 PipeRead
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
#define WDFCASSERT(c)
Definition: wdfassert.h:93
_In_ WDFREQUEST Request
Definition: wdfdevice.h:547
_Must_inspect_result_ _In_ WDFQUEUE _In_opt_ WDFREQUEST _In_opt_ WDFFILEOBJECT _Inout_opt_ PWDF_REQUEST_PARAMETERS Parameters
Definition: wdfio.h:869

◆ 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;
857 }
858}

◆ 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

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

◆ 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);
877 }
878#endif
880}
VOID __inline FxMdlFree(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in PMDL Mdl)
Definition: fxmdl.h:60
VOID NTAPI MmUnlockPages(IN PMDL Mdl)
Definition: mdlsup.c:1435
virtual VOID ReleaseAndRestore(__in FxRequestBase *Request)

◆ 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}
static HANDLE PipeHandle
Definition: dhcpcsvc.c:22
USBD_PIPE_HANDLE PipeHandle
Definition: usb.h:499

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}
Definition: bufpool.h:45
virtual VOID StoreAndReferenceMemory(__in FxRequestBuffer *Buffer)
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
#define URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER
Definition: usb.h:95

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: