ReactOS 0.4.15-dev-8100-g1887773
FxUsbPipe Class Reference

#include <fxusbpipe.hpp>

Inheritance diagram for FxUsbPipe:
Collaboration diagram for FxUsbPipe:

Public Member Functions

 FxUsbPipe (__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in FxUsbDevice *UsbDevice)
 
VOID InitPipe (__in PUSBD_PIPE_INFORMATION PipeInfo, __in UCHAR InterfaceNumber, __in FxUsbInterface *UsbInterface)
 
VOID InitPipe (__in PWINUSB_PIPE_INFORMATION PipeInfo, __in UCHAR InterfaceNumber, __in FxUsbInterface *UsbInterface)
 
virtual _Must_inspect_result_ NTSTATUS GotoStartState (__in PLIST_ENTRY RequestListHead, __in BOOLEAN Lock=TRUE)
 
virtual VOID GotoStopState (__in WDF_IO_TARGET_SENT_IO_ACTION Action, __in PSINGLE_LIST_ENTRY SentRequestListHead, __out PBOOLEAN Wait, __in BOOLEAN LockSelf)
 
VOID GotoPurgeState (__in WDF_IO_TARGET_PURGE_IO_ACTION Action, __in PLIST_ENTRY PendedRequestListHead, __in PSINGLE_LIST_ENTRY SentRequestListHead, __out PBOOLEAN Wait, __in BOOLEAN LockSelf)
 
virtual VOID GotoRemoveState (__in WDF_IO_TARGET_STATE NewState, __in PLIST_ENTRY PendedRequestListHead, __in PSINGLE_LIST_ENTRY SentRequestListHead, __in BOOLEAN Lock, __out PBOOLEAN Wait)
 
virtual VOID WaitForSentIoToComplete (VOID)
 
__inline VOID SetNoCheckPacketSize (VOID)
 
VOID GetInformation (__out PWDF_USB_PIPE_INFORMATION PipeInformation)
 
BOOLEAN IsType (__in WDF_USB_PIPE_TYPE Type)
 
WDF_USB_PIPE_TYPE GetType (VOID)
 
WDFUSBPIPE GetHandle (VOID)
 
__inline BOOLEAN IsInEndpoint (VOID)
 
__inline BOOLEAN IsOutEndpoint (VOID)
 
_Must_inspect_result_ NTSTATUS InitContinuousReader (__in PWDF_USB_CONTINUOUS_READER_CONFIG Config, __in size_t TotalBufferLength)
 
ULONG GetMaxPacketSize (VOID)
 
_Must_inspect_result_ NTSTATUS ValidateTransferLength (__in size_t Length)
 
_Must_inspect_result_ NTSTATUS FormatTransferRequest (__in FxRequestBase *Request, __in FxRequestBuffer *Buffer, __in ULONG TransferFlags=0)
 
_Must_inspect_result_ NTSTATUS FormatAbortRequest (__in FxRequestBase *Request)
 
_Must_inspect_result_ NTSTATUS FormatResetRequest (__in FxRequestBase *Request)
 
USBD_PIPE_HANDLE WdmGetPipeHandle (VOID)
 
NTSTATUS Reset (VOID)
 
USBD_HANDLE GetUSBDHandle (VOID)
 
FX_URB_TYPE GetUrbType (VOID)
 
- Public Member Functions inherited from FxIoTarget
 FxIoTarget (__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in USHORT ObjectSize)
 
 FxIoTarget (__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in USHORT ObjectSize, __in WDFTYPE WdfType)
 
virtual _Must_inspect_result_ NTSTATUS Start (VOID)
 
virtual VOID Stop (__in WDF_IO_TARGET_SENT_IO_ACTION Action)
 
virtual VOID Purge (__in WDF_IO_TARGET_PURGE_IO_ACTION Action)
 
virtual VOID Remove (VOID)
 
NTSTATUS _Must_inspect_result_ QueryInterface (__inout FxQueryInterfaceParams *Params)
 
__inline WDF_IO_TARGET_STATE GetState (VOID)
 
__inline MdDeviceObject GetTargetDevice (VOID)
 
__inline MdDeviceObject GetTargetPDO (VOID)
 
__inline MdFileObject GetTargetFileObject (VOID)
 
__inline WDFDEVICE GetDeviceHandle (VOID)
 
WDFIOTARGET GetHandle (VOID)
 
__inline FxDriverGetDriver (VOID)
 
virtual _Must_inspect_result_ MdDeviceObject GetTargetDeviceObject (_In_ CfxDeviceBase *Device)
 
_Must_inspect_result_ NTSTATUS Init (__in CfxDeviceBase *Device)
 
ULONG Submit (__in FxRequestBase *Request, __in_opt PWDF_REQUEST_SEND_OPTIONS Options, __in_opt ULONG Flags)
 
 FX_DECLARE_VF_FUNCTION_P1 (NTSTATUS, VerifySubmitLocked, _In_ FxRequestBase *)
 
ULONG SubmitLocked (__in FxRequestBase *Request, __in_opt PWDF_REQUEST_SEND_OPTIONS Options, __in ULONG Flags)
 
_Must_inspect_result_ NTSTATUS SubmitSync (__in FxRequestBase *Request, __in_opt PWDF_REQUEST_SEND_OPTIONS Options=NULL, __out_opt PULONG Action=NULL)
 
VOID TimerCallback (__in FxRequestBase *Request)
 
VOID CompleteCanceledRequest (__in FxRequestBase *Request)
 
VOID SubmitPendedRequest (__in FxRequestBase *Request)
 
VOID CompletePendedRequest (__in FxRequestBase *Request)
 
BOOLEAN __inline HasEnoughStackLocations (__in FxIrp *Irp)
 
_Must_inspect_result_ NTSTATUS FormatIoRequest (__inout FxRequestBase *Request, __in UCHAR MajorCode, __in FxRequestBuffer *IoBuffer, __in_opt PLONGLONG StartingOffset, __in_opt FxFileObject *FileObject=NULL)
 
_Must_inspect_result_ NTSTATUS FormatIoctlRequest (__in FxRequestBase *Request, __in ULONG Ioctl, __in BOOLEAN Internal, __in FxRequestBuffer *InputBuffer, __in FxRequestBuffer *OutputBuffer, __in_opt FxFileObject *FileObject=NULL)
 
_Must_inspect_result_ NTSTATUS FormatInternalIoctlOthersRequest (__in FxRequestBase *Request, __in ULONG Ioctl, __in FxRequestBuffer *Buffers)
 
VOID CancelSentIo (VOID)
 
_Must_inspect_result_ NTSTATUS SubmitSyncRequestIgnoreTargetState (__in FxRequestBase *Request, __in_opt PWDF_REQUEST_SEND_OPTIONS RequestOptions)
 
VOID UpdateTargetIoType (VOID)
 
BOOLEAN HasValidStackSize (VOID)
 
virtual VOID Send (_In_ MdIrp Irp)
 
- Public Member Functions inherited from FxNonPagedObject
 FxNonPagedObject (__in WDFTYPE Type, __in USHORT Size, __in PFX_DRIVER_GLOBALS FxDriverGlobals)
 
 FxNonPagedObject (__in WDFTYPE Type, __in USHORT Size, __in PFX_DRIVER_GLOBALS FxDriverGlobals, __in FxObjectType ObjectType)
 
virtual ~FxNonPagedObject (VOID)
 
 _Acquires_lock_ (this->m_NPLock.m_Lock) __drv_maxIRQL(DISPATCH_LEVEL) __drv_setsIRQL(DISPATCH_LEVEL) VOID Lock(__out __drv_deref(__drv_savesIRQL) PKIRQL PreviousIrql)
 
 _Releases_lock_ (this->m_NPLock.m_Lock) __drv_requiresIRQL(DISPATCH_LEVEL) __inline VOID Unlock(__in __drv_restoresIRQL KIRQL PreviousIrql)
 
 _Acquires_lock_ (this->m_NPLock.m_Lock) __drv_requiresIRQL(DISPATCH_LEVEL) VOID LockAtDispatch(VOID)
 
 _Requires_lock_held_ (this->m_NPLock.m_Lock) _Releases_lock_(this -> m_NPLock.m_Lock) __drv_requiresIRQL(DISPATCH_LEVEL) __inline VOID UnlockFromDispatch(VOID)
 
- Public Member Functions inherited from FxObject
PVOID GetCOMWrapper ()
 
void SetCOMWrapper (__drv_aliasesMem PVOID Wrapper)
 
 FxObject (__in WDFTYPE Type, __in USHORT Size, __in PFX_DRIVER_GLOBALS FxDriverGlobals)
 
virtual ~FxObject (VOID)
 
PVOID __inline operator new (__in size_t Size, __in PFX_DRIVER_GLOBALS FxDriverGlobals, __in FxObjectType Type)
 
PVOID __inline operator new (__in size_t Size, __in PFX_DRIVER_GLOBALS FxDriverGlobals, __in_opt PWDF_OBJECT_ATTRIBUTES Attributes, __in USHORT ExtraSize=0)
 
VOID operator delete (__in PVOID Memory)
 
VOID SetNoContextHeader (VOID)
 
PVOID __inline GetObjectHandle (VOID)
 
__inline FxContextHeaderGetContextHeader (VOID)
 
__inline PFX_DRIVER_GLOBALS GetDriverGlobals (VOID)
 
WDFTYPE GetType (VOID)
 
USHORT GetObjectSize (VOID)
 
LONG GetRefCnt (VOID)
 
FxTagTrackerGetTagTracker (VOID)
 
CfxDeviceGetDevice (VOID)
 
CfxDeviceBaseGetDeviceBase (VOID)
 
VOID SetDeviceBase (__in CfxDeviceBase *DeviceBase)
 
__inline VOID CallCleanup (VOID)
 
ULONG __inline AddRef (__in_opt PVOID Tag=NULL, __in LONG Line=0, __in_opt PSTR File=NULL)
 
virtual ULONG Release (__in_opt PVOID Tag=NULL, __in LONG Line=0, __in_opt PSTR File=NULL)
 
virtual ULONG AddRefOverride (__in WDFOBJECT_OFFSET Offset, __in_opt PVOID Tag=NULL, __in LONG Line=0, __in_opt PSTR File=NULL)
 
virtual ULONG ReleaseOverride (__in WDFOBJECT_OFFSET Offset, __in_opt PVOID Tag=NULL, __in LONG Line=0, __in_opt PSTR File=NULL)
 
virtual _Must_inspect_result_ NTSTATUS QueryInterface (__in FxQueryInterfaceParams *Params)
 
VOID MarkTraceState (VOID)
 
BOOLEAN __inline IsTraceState (VOID)
 
VOID __inline TraceDroppedEvent (__in FxObjectDroppedEvent Event)
 
VOID MarkPassiveDispose (__in FxObjectLockState State=ObjectLock)
 
VOID MarkPassiveCallbacks (__in FxObjectLockState State=ObjectLock)
 
VOID MarkForceDisposeThread (__in FxObjectLockState State=ObjectLock)
 
BOOLEAN IsPassiveCallbacks (__in BOOLEAN AcquireLock=TRUE)
 
BOOLEAN IsPassiveDispose (__in BOOLEAN AcquireLock=TRUE)
 
BOOLEAN IsForceDisposeThread (__in BOOLEAN AcquireLock=TRUE)
 
VOID MarkCommitted (VOID)
 
BOOLEAN IsCommitted (VOID)
 
VOID MarkDisposeOverride (__in FxObjectLockState State=ObjectLock)
 
VOID MarkNoDeleteDDI (__in FxObjectLockState State=ObjectLock)
 
BOOLEAN IsNoDeleteDDI (VOID)
 
_Must_inspect_result_ NTSTATUS Commit (__in_opt PWDF_OBJECT_ATTRIBUTES Attributes, __out_opt WDFOBJECT *ObjectHandle, __in_opt FxObject *Parent=NULL, __in BOOLEAN AssignDriverAsDefaultParent=TRUE)
 
VOID DeleteFromFailedCreate (VOID)
 
VOID ClearEvtCallbacks (VOID)
 
BOOLEAN EarlyDispose (VOID)
 
virtual VOID DeleteObject (VOID)
 
virtual BOOLEAN Dispose (VOID)
 
_Must_inspect_result_ NTSTATUS AssignParentObject (__in FxObject *ParentObject)
 
_Must_inspect_result_ NTSTATUS AddContext (__in FxContextHeader *Header, __in PVOID *Context, __in PWDF_OBJECT_ATTRIBUTES Attributes)
 
_Must_inspect_result_ NTSTATUS RemoveParentAssignment (VOID)
 
_Must_inspect_result_ FxObjectGetParentObjectReferenced (__in PVOID Tag)
 
BOOLEAN IsDisposed (VOID)
 

Static Public Member Functions

static _Must_inspect_result_ NTSTATUS _FormatTransfer (__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in WDFUSBPIPE Pipe, __in WDFREQUEST Request, __in_opt WDFMEMORY TransferMemory, __in_opt PWDFMEMORY_OFFSET TransferOffsets, __in ULONG Flags)
 
static _Must_inspect_result_ NTSTATUS _SendTransfer (__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in WDFUSBPIPE Pipe, __in_opt WDFREQUEST Request, __in_opt PWDF_REQUEST_SEND_OPTIONS RequestOptions, __in_opt PWDF_MEMORY_DESCRIPTOR MemoryDescriptor, __out_opt PULONG BytesTransferred, __in ULONG Flags)
 
static WDF_USB_PIPE_TYPE _UsbdPipeTypeToWdf (__in USBD_PIPE_TYPE UsbdPipeType)
 
- Static Public Member Functions inherited from FxIoTarget
static VOID _CancelSentRequest (__in FxRequestBase *Request)
 
static FxIoTarget_FromEntry (__in FxTransactionedEntry *Entry)
 
- Static Public Member Functions inherited from FxObject
static FxObject_FromDisposeEntry (__in PSINGLE_LIST_ENTRY Entry)
 
static FxObject_GetObjectFromHandle (__in WDFOBJECT Handle, __inout PWDFOBJECT_OFFSET ObjectOffset)
 
static PVOID __inline _ToHandle (__in FxObject *Object)
 
static VOID __inline _ReferenceActual (__in WDFOBJECT Object, __in_opt PVOID Tag, __in LONG Line, __in PSTR File)
 
static VOID __inline _DereferenceActual (__in WDFOBJECT Object, __in_opt PVOID Tag, __in LONG Line, __in PSTR File)
 
static PVOID _GetDebugBase (__in FxObject *Object)
 
static PFX_POOL_HEADER _CleanupPointer (__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in FxObject *Object)
 
static _Must_inspect_result_ NTSTATUS _GetEffectiveLock (__in FxObject *Object, __in_opt IFxHasCallbacks *Callbacks, __in BOOLEAN AutomaticLocking, __in BOOLEAN PassiveCallbacks, __out FxCallbackLock **CallbackLock, __out_opt FxObject **CallbackLockObject)
 
static _Must_inspect_result_ NTSTATUS _ObjectQuery (_In_ FxObject *Object, _In_ CONST GUID *Guid, _In_ ULONG QueryBufferLength, _Out_writes_bytes_(QueryBufferLength) PVOID QueryBuffer)
 

Public Attributes

friend FxUsbDevice
 
friend FxUsbInterface
 
friend FxUsbPipeContinuousReader
 
LIST_ENTRY m_ListEntry
 
- Public Attributes inherited from FxIoTarget
FxTransactionedEntry m_TransactionedEntry
 
BOOLEAN m_InStack
 
BOOLEAN m_AddedToDeviceList
 

Protected Member Functions

 ~FxUsbPipe ()
 
virtual BOOLEAN Dispose (VOID)
 
- Protected Member Functions inherited from FxIoTarget
 ~FxIoTarget ()
 
_Must_inspect_result_ NTSTATUS InitModeSpecific (__in CfxDeviceBase *Device)
 
virtual BOOLEAN Dispose (VOID)
 
VOID FailPendedRequest (__in FxRequestBase *Request, __in NTSTATUS Status)
 
VOID DrainPendedRequestsLocked (__in PLIST_ENTRY RequestListHead, __in BOOLEAN RequestWillBeResent)
 
VOID CompletePendedRequestList (__in PLIST_ENTRY RequestListHead)
 
VOID SubmitPendedRequests (__in PLIST_ENTRY RequestListHeadHead)
 
VOID GetSentRequestsListLocked (__in PSINGLE_LIST_ENTRY RequestListHead, __in PLIST_ENTRY SendList, __out PBOOLEAN AddedToList)
 
virtual _Must_inspect_result_ NTSTATUS GotoStartState (__in PLIST_ENTRY RequestListHead, __in BOOLEAN Lock=TRUE)
 
virtual VOID GotoStopState (__in WDF_IO_TARGET_SENT_IO_ACTION Action, __in PSINGLE_LIST_ENTRY SentRequestListHead, __out PBOOLEAN Wait, __in BOOLEAN LockSelf)
 
virtual VOID GotoPurgeState (__in WDF_IO_TARGET_PURGE_IO_ACTION Action, __in PLIST_ENTRY PendedRequestListHead, __in PSINGLE_LIST_ENTRY SentRequestListHead, __out PBOOLEAN Wait, __in BOOLEAN LockSelf)
 
_Must_inspect_result_ NTSTATUS PendRequestLocked (__in FxRequestBase *Request)
 
__inline VOID CompleteRequest (__in FxRequestBase *Request)
 
VOID HandleFailedResubmit (__in FxRequestBase *Request)
 
VOID RequestCompletionRoutine (__in FxRequestBase *Request)
 
BOOLEAN RemoveCompletedRequestLocked (__in FxRequestBase *Request)
 
virtual VOID ClearTargetPointers (VOID)
 
UCHAR GetTargetIoType (VOID)
 
virtual VOID GotoRemoveState (__in WDF_IO_TARGET_STATE NewState, __in PLIST_ENTRY PendedRequestListHead, __in PSINGLE_LIST_ENTRY SentRequestListHead, __in BOOLEAN Lock, __out PBOOLEAN Wait)
 
virtual VOID WaitForSentIoToComplete (VOID)
 
virtual VOID WaitForDisposeEvent (VOID)
 
virtual VOID Forward (__in MdIrp Irp)
 
__inline VOID CopyFileObjectAndFlags (__in FxRequestBase *Request)
 
__inline VOID IncrementIoCount (VOID)
 
__inline VOID DecrementIoCount (VOID)
 
VOID PrintDisposeMessage (VOID)
 
- Protected Member Functions inherited from FxObject
 FxObject (__in WDFTYPE Type, __in USHORT Size, __in PFX_DRIVER_GLOBALS FxDriverGlobals, __in FxObjectType ObjectType)
 
FxObjectDebugExtensionGetDebugExtension (VOID)
 
BOOLEAN IsDebug (VOID)
 
VOID AllocateTagTracker (__in WDFTYPE Type)
 
virtual VOID SelfDestruct (VOID)
 
PVOID __inline GetObjectHandleUnchecked (VOID)
 
VOID __inline DestroyChildren (VOID)
 
VOID DeleteEarlyDisposedObject (VOID)
 

Protected Attributes

FxUsbDevicem_UsbDevice
 
FxUsbInterfacem_UsbInterface
 
FxUsbPipeContinuousReaderm_Reader
 
USBD_PIPE_INFORMATION m_PipeInformation
 
WINUSB_PIPE_INFORMATION m_PipeInformationUm
 
UCHAR m_InterfaceNumber
 
BOOLEAN m_CheckPacketSize
 
USBD_HANDLE m_USBDHandle
 
FX_URB_TYPE m_UrbType
 
- Protected Attributes inherited from FxIoTarget
LIST_ENTRY m_SentIoListHead
 
LIST_ENTRY m_IgnoredIoListHead
 
FxCREvent m_SentIoEvent
 
FxCREventm_DisposeEvent
 
FxCREvent m_DisposeEventUm
 
FxIrpQueue m_PendedQueue
 
FxDriverm_Driver
 
MdDeviceObject m_InStackDevice
 
MdDeviceObject m_TargetDevice
 
MdDeviceObject m_TargetPdo
 
MdFileObject m_TargetFileObject
 
WDF_IO_TARGET_STATE m_State
 
LONG m_IoCount
 
CCHAR m_TargetStackSize
 
UCHAR m_TargetIoType
 
BOOLEAN m_WaitingForSentIo
 
BOOLEAN m_Removing
 
- Protected Attributes inherited from FxObject
union {
   CfxDeviceBase *   m_DeviceBase
 
   CfxDevice *   m_Device
 
}; 
 

Additional Inherited Members

- Static Public Attributes inherited from FxIoTarget
static const PVOID m_SentRequestTag = (PVOID) 'lcnC'
 
- Static Protected Member Functions inherited from FxIoTarget
static VOID _CancelSentRequests (__in PSINGLE_LIST_ENTRY RequestListHead)
 
static VOID _RequestCancelled (__in FxIrpQueue *Queue, __in MdIrp Irp, __in PMdIoCsqIrpContext pCsqContext, __in KIRQL CallerIrql)
 
- Static Protected Member Functions inherited from FxObject
static PVOID _GetBase (__in FxObject *Object)
 
- Static Protected Attributes inherited from FxIoTarget
static MdCompletionRoutineType _RequestCompletionRoutine
 
static EVT_WDF_REQUEST_COMPLETION_ROUTINE _SyncCompletionRoutine
 

Detailed Description

Definition at line 409 of file fxusbpipe.hpp.

Constructor & Destructor Documentation

◆ FxUsbPipe()

FxUsbPipe::FxUsbPipe ( __in PFX_DRIVER_GLOBALS  FxDriverGlobals,
__in FxUsbDevice UsbDevice 
)

Definition at line 1050 of file fxusbpipe.cpp.

1053 :
1054 FxIoTarget(FxDriverGlobals, sizeof(FxUsbPipe), FX_TYPE_IO_TARGET_USB_PIPE),
1056{
1059#if (FX_CORE_MODE == FX_CORE_USER_MODE)
1061#endif
1063 m_Reader = NULL;
1066 m_USBDHandle = UsbDevice->m_USBDHandle;
1067 m_UrbType = UsbDevice->m_UrbType;
1068
1070}
VOID MarkNoDeleteDDI(__in FxObjectLockState State=ObjectLock)
Definition: fxobject.hpp:1118
FxUsbDevice * m_UsbDevice
Definition: fxusbpipe.hpp:698
BOOLEAN m_CheckPacketSize
Definition: fxusbpipe.hpp:732
USBD_PIPE_INFORMATION m_PipeInformation
Definition: fxusbpipe.hpp:714
FxUsbPipeContinuousReader * m_Reader
Definition: fxusbpipe.hpp:709
FX_URB_TYPE m_UrbType
Definition: fxusbpipe.hpp:743
UCHAR m_InterfaceNumber
Definition: fxusbpipe.hpp:726
FxUsbInterface * m_UsbInterface
Definition: fxusbpipe.hpp:700
WINUSB_PIPE_INFORMATION m_PipeInformationUm
Definition: fxusbpipe.hpp:720
USBD_HANDLE m_USBDHandle
Definition: fxusbpipe.hpp:737
LIST_ENTRY m_ListEntry
Definition: fxusbpipe.hpp:687
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
@ ObjectDoNotLock
Definition: fxobject.hpp:128
@ FX_TYPE_IO_TARGET_USB_PIPE
Definition: fxtypes.h:103
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
_Must_inspect_result_ _In_ WDFDEVICE _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFUSBDEVICE * UsbDevice
Definition: wdfusb.h:906

◆ ~FxUsbPipe()

FxUsbPipe::~FxUsbPipe ( )
protected

Definition at line 1091 of file fxusbpipe.cpp.

1092{
1093 if (m_UsbInterface != NULL) {
1095 m_UsbInterface->RELEASE(this);
1096 }
1097
1099}
VOID RemoveDeletedPipe(__in FxUsbPipe *Pipe)
#define IsListEmpty(ListHead)
Definition: env_spec_w32.h:954
#define ASSERT(a)
Definition: mode.c:44

Member Function Documentation

◆ _FormatTransfer()

return FxUsbPipe::_FormatTransfer ( __in PFX_DRIVER_GLOBALS  FxDriverGlobals,
__in WDFUSBPIPE  Pipe,
__in WDFREQUEST  Request,
__in_opt WDFMEMORY  TransferMemory,
__in_opt PWDFMEMORY_OFFSET  TransferOffsets,
__in ULONG  Flags 
)
static

Definition at line 1536 of file fxusbpipe.cpp.

1544{
1550
1551 FxObjectHandleGetPtrAndGlobals(FxDriverGlobals,
1552 Pipe,
1554 (PVOID*) &pUsbPipe,
1555 &FxDriverGlobals);
1556
1557 FxObjectHandleGetPtr(FxDriverGlobals,
1558 Request,
1560 (PVOID*) &pRequest);
1561
1562 //
1563 // We allow zero length transfers (which are indicated by TransferMemory == NULL)
1564 //
1565 if (TransferMemory != NULL) {
1566 FxObjectHandleGetPtr(FxDriverGlobals,
1569 (PVOID*) &pMemory);
1570
1571 status = pMemory->ValidateMemoryOffsets(TransferOffsets);
1572 if (!NT_SUCCESS(status)) {
1573 goto Done;
1574 }
1575
1576 buf.SetMemory(pMemory, TransferOffsets);
1577 }
1578 else {
1579 pMemory = NULL;
1580 }
1581
1583
1584 if (NT_SUCCESS(status)) {
1585 FxUsbPipeTransferContext* pContext;
1586
1588
1589 //
1590 // By assuming the fields are at the same offset, we can use simpler
1591 // logic (w/out comparisons for type) to set them.
1592 //
1593 WDFCASSERT(
1596 );
1597
1598 WDFCASSERT(
1601 );
1602
1604 pContext->m_UsbParameters.Parameters.PipeWrite.Length = buf.GetBufferLength();
1605
1606 pContext->m_UsbParameters.Parameters.PipeWrite.Offset =
1607 (TransferOffsets != NULL) ? TransferOffsets->BufferOffset
1608 : 0;
1609 pContext->SetUsbType(
1612 );
1613 }
1614
1615Done:
1617 "WDFUSBPIPE %p, WDFREQUEST %p, WDFMEMORY %p, %!STATUS!",
1619
1620 return status;
1621}
LONG NTSTATUS
Definition: precomp.h:26
__inline FxRequestContext * GetContext(VOID)
_Must_inspect_result_ NTSTATUS FormatTransferRequest(__in FxRequestBase *Request, __in FxRequestBuffer *Buffer, __in ULONG TransferFlags=0)
_Must_inspect_result_ NTSTATUS ValidateMemoryOffsets(__in_opt PWDFMEMORY_OFFSET Offsets)
Definition: ifxmemory.hpp:105
#define TRACINGIOTARGET
Definition: dbgtrace.h:72
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
FxObjectHandleGetPtrAndGlobals(GetFxDriverGlobals(DriverGlobals), Device, FX_TYPE_DEVICE,(PVOID *)&pDevice, &pFxDriverGlobals)
FxObjectHandleGetPtr(GetFxDriverGlobals(DriverGlobals), Fdo, FX_TYPE_DEVICE,(PVOID *)&pFdo)
FxRequest * pRequest
FxMemoryObject * pMemory
@ IFX_TYPE_MEMORY
Definition: fxtypes.h:55
@ FX_TYPE_REQUEST
Definition: fxtypes.h:53
FxUsbPipe * pUsbPipe
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define TRACE_LEVEL_VERBOSE
Definition: storswtr.h:30
VOID SetUsbType(__in WDF_USB_REQUEST_TYPE Type)
WDF_USB_REQUEST_COMPLETION_PARAMS m_UsbParameters
union _WDF_USB_REQUEST_COMPLETION_PARAMS::@3911 Parameters
struct _WDF_USB_REQUEST_COMPLETION_PARAMS::@3911::@3916 PipeRead
struct _WDF_USB_REQUEST_COMPLETION_PARAMS::@3911::@3915 PipeWrite
Definition: ps.c:97
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
#define USBD_TRANSFER_DIRECTION_IN
Definition: usb.h:160
#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
@ WdfUsbRequestTypePipeWrite
Definition: wdfusb.h:92
@ WdfUsbRequestTypePipeRead
Definition: wdfusb.h:93
_Must_inspect_result_ _In_ WDFUSBDEVICE _In_ WDFREQUEST _In_ PWDF_USB_CONTROL_SETUP_PACKET _In_opt_ WDFMEMORY TransferMemory
Definition: wdfusb.h:1384
_In_ WDFUSBPIPE Pipe
Definition: wdfusb.h:1741
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170

Referenced by ValidateTransferLength().

◆ _SendTransfer()

return FxUsbPipe::_SendTransfer ( __in PFX_DRIVER_GLOBALS  FxDriverGlobals,
__in WDFUSBPIPE  Pipe,
__in_opt WDFREQUEST  Request,
__in_opt PWDF_REQUEST_SEND_OPTIONS  RequestOptions,
__in_opt PWDF_MEMORY_DESCRIPTOR  MemoryDescriptor,
__out_opt PULONG  BytesTransferred,
__in ULONG  Flags 
)
static

Definition at line 1625 of file fxusbpipe.cpp.

1634{
1638
1639 FxObjectHandleGetPtrAndGlobals(FxDriverGlobals,
1640 Pipe,
1642 (PVOID*) &pUsbPipe,
1643 &FxDriverGlobals);
1644
1646
1647 FxSyncRequest request(FxDriverGlobals, &context, Request);
1648
1649 //
1650 // FxSyncRequest always succeesds for KM but can fail for UM.
1651 //
1652 status = request.Initialize();
1653 if (!NT_SUCCESS(status)) {
1655 "Failed to initialize FxSyncRequest");
1656 return status;
1657 }
1658
1659 if (BytesTransferred != NULL) {
1660 *BytesTransferred = 0;
1661 }
1662
1663 status = FxVerifierCheckIrqlLevel(FxDriverGlobals, PASSIVE_LEVEL);
1664 if (!NT_SUCCESS(status)) {
1665 return status;
1666 }
1667
1669 if (!NT_SUCCESS(status)) {
1670 return status;
1671 }
1672
1673 //
1674 // We allow zero length writes (which are indicated by MemoryDescriptor == NULL)
1675 //
1676 if (MemoryDescriptor != NULL) {
1677 status = buf.ValidateMemoryDescriptor(FxDriverGlobals, MemoryDescriptor);
1678 if (!NT_SUCCESS(status)) {
1679 return status;
1680 }
1681 }
1682
1684
1685 if (NT_SUCCESS(status)) {
1687 FxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGIOTARGET,
1688 "WDFUSBPIPE %p, WDFREQUEST %p being submitted",
1689 Pipe, request.m_TrueRequest->GetTraceObjectHandle());
1690
1691 status = pUsbPipe->SubmitSync(request.m_TrueRequest, RequestOptions);
1692
1693 //
1694 // Even on error we want to set this value. USBD should be clearing
1695 // it if the transfer fails.
1696 //
1697 if (BytesTransferred != NULL) {
1698 *BytesTransferred = context.GetUrbTransferLength();
1699 }
1700 }
1701
1703 "WDFUSBPIPE %p, %!STATUS!", Pipe, status);
1704
1705 return status;
1706}
_Must_inspect_result_ NTSTATUS SubmitSync(__in FxRequestBase *Request, __in_opt PWDF_REQUEST_SEND_OPTIONS Options=NULL, __out_opt PULONG Action=NULL)
#define PASSIVE_LEVEL
Definition: env_spec_w32.h:693
NTSTATUS __inline FxValidateRequestOptions(_In_ PFX_DRIVER_GLOBALS FxDriverGlobals, _In_ PWDF_REQUEST_SEND_OPTIONS Options, _In_opt_ FxRequestBase *Request=NULL)
@ FxUrbTypeLegacy
Definition: fxusbdevice.hpp:27
__inline NTSTATUS FxVerifierCheckIrqlLevel(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in KIRQL Irql)
Definition: fxverifier.h:158
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
Definition: http.c:7252
Definition: tftpd.h:86
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR _In_opt_ PLONGLONG _In_opt_ PWDF_REQUEST_SEND_OPTIONS RequestOptions
Definition: wdfiotarget.h:867
_Must_inspect_result_ _In_ WDFUSBDEVICE _In_opt_ WDFREQUEST _In_opt_ PWDF_REQUEST_SEND_OPTIONS _In_ PWDF_USB_CONTROL_SETUP_PACKET _In_opt_ PWDF_MEMORY_DESCRIPTOR MemoryDescriptor
Definition: wdfusb.h:1339
_Must_inspect_result_ _In_ WDFUSBDEVICE _In_opt_ WDFREQUEST _In_opt_ PWDF_REQUEST_SEND_OPTIONS _In_ PWDF_USB_CONTROL_SETUP_PACKET _In_opt_ PWDF_MEMORY_DESCRIPTOR _Out_opt_ PULONG BytesTransferred
Definition: wdfusb.h:1342

Referenced by ValidateTransferLength().

◆ _UsbdPipeTypeToWdf()

static WDF_USB_PIPE_TYPE FxUsbPipe::_UsbdPipeTypeToWdf ( __in USBD_PIPE_TYPE  UsbdPipeType)
inlinestatic

Definition at line 643 of file fxusbpipe.hpp.

646 {
647 const static WDF_USB_PIPE_TYPE types[] = {
648 WdfUsbPipeTypeControl, // UsbdPipeTypeControl
649 WdfUsbPipeTypeIsochronous, // UsbdPipeTypeIsochronous
650 WdfUsbPipeTypeBulk, // UsbdPipeTypeBulk
651 WdfUsbPipeTypeInterrupt, // UsbdPipeTypeInterrupt
652 };
653
654 if (UsbdPipeType < sizeof(types)/sizeof(types[0])) {
655 return types[UsbdPipeType];
656 }
657 else {
659 }
660 }
Definition: cmds.c:130
@ WdfUsbPipeTypeInterrupt
Definition: wdfusb.h:122
@ WdfUsbPipeTypeControl
Definition: wdfusb.h:119
@ WdfUsbPipeTypeBulk
Definition: wdfusb.h:121
@ WdfUsbPipeTypeIsochronous
Definition: wdfusb.h:120
@ WdfUsbPipeTypeInvalid
Definition: wdfusb.h:118
enum _WDF_USB_PIPE_TYPE WDF_USB_PIPE_TYPE

Referenced by FxUsbInterface::CopyEndpointFieldsFromDescriptor(), GetInformation(), GetType(), and IsType().

◆ Dispose()

BOOLEAN FxUsbPipe::Dispose ( VOID  )
protectedvirtual

Reimplemented from FxIoTarget.

Definition at line 1102 of file fxusbpipe.cpp.

1103{
1104 BOOLEAN callCleanup;
1105
1106 //
1107 // Call base class: callbacks, terminates I/Os, etc.
1108 //
1109 callCleanup = FxIoTarget::Dispose(); // __super call
1110
1111 //
1112 // Don't need the reader anymore. The reader is deleted after calling the
1113 // parent class Dispose() to preserve the existing deletion order (it was
1114 // deleted in the Pipe's dtor() before this change).
1115 //
1116 if (m_Reader != NULL)
1117 {
1118 delete m_Reader;
1119
1120 //
1121 // By doing this assignment we prevent misbehaved drivers
1122 // from crashing the system when they call WdfIoTargetStop from their
1123 // usb pipe's destroy callback.
1124 //
1125 m_Reader = NULL;
1126 }
1127
1128 return callCleanup;
1129}
unsigned char BOOLEAN
virtual BOOLEAN Dispose(VOID)
Definition: fxiotarget.cpp:154

◆ FormatAbortRequest()

_Must_inspect_result_ NTSTATUS FxUsbPipe::FormatAbortRequest ( __in FxRequestBase Request)

Definition at line 1710 of file fxusbpipe.cpp.

1713{
1714 FxUsbPipeRequestContext* pContext;
1716 FX_URB_TYPE urbType;
1717
1718 status = Request->ValidateTarget(this);
1719 if (!NT_SUCCESS(status)) {
1721 "Pipe %p, Request %p, setting target failed, "
1722 "status %!STATUS!", this, Request, status);
1723
1724 return status;
1725 }
1726
1727 if (Request->HasContextType(FX_RCT_USB_PIPE_REQUEST)) {
1728 pContext = (FxUsbPipeRequestContext*) Request->GetContext();
1729 }
1730 else {
1731
1733 pContext = new(GetDriverGlobals()) FxUsbPipeRequestContext(urbType);
1734 if (pContext == NULL) {
1736 }
1737
1738#if (FX_CORE_MODE == FX_CORE_KERNEL_MODE)
1739 if (urbType == FxUrbTypeUsbdAllocated) {
1740 status = pContext->AllocateUrb(m_USBDHandle);
1741 if (!NT_SUCCESS(status)) {
1742 delete pContext;
1743 return status;
1744 }
1745 //
1746 // Since the AllocateUrb routine calls USBD_xxxUrbAllocate APIs to allocate an Urb, it is
1747 // important to release those resorces before the devnode is removed. Those
1748 // resoruces are removed at the time Request is disposed.
1749 //
1750 Request->EnableContextDisposeNotification();
1751 }
1752#endif
1753
1754 Request->SetContext(pContext);
1755 }
1756
1757#if (FX_CORE_MODE == FX_CORE_KERNEL_MODE)
1761
1762 if (pContext->m_Urb == &pContext->m_UrbLegacy) {
1763 urbType = FxUrbTypeLegacy;
1764 }
1765 else {
1766 urbType = FxUrbTypeUsbdAllocated;
1767 }
1768
1769 FxFormatUsbRequest(Request, (PURB)pContext->m_Urb, urbType, m_USBDHandle);
1770#elif (FX_CORE_MODE == FX_CORE_USER_MODE)
1773 m_PipeInformationUm.PipeId,
1776#endif
1777
1778 return STATUS_SUCCESS;
1779}
__inline PFX_DRIVER_GLOBALS GetDriverGlobals(VOID)
Definition: fxobject.hpp:734
IWudfFile * m_pHostTargetFile
FX_URB_TYPE GetFxUrbTypeForRequest(__in FxRequestBase *Request)
WINUSB_INTERFACE_HANDLE m_WinUsbHandle
@ FX_RCT_USB_PIPE_REQUEST
@ FxUrbTypeUsbdAllocated
Definition: fxusbdevice.hpp:28
enum _FX_URB_TYPE FX_URB_TYPE
#define STATUS_SUCCESS
Definition: shellext.h:65
__checkReturn NTSTATUS AllocateUrb(__in USBD_HANDLE USBDHandle)
Definition: fxusbpipe.cpp:992
_URB_PIPE_REQUEST m_UrbLegacy
Definition: fxusbpipe.hpp:170
_URB_PIPE_REQUEST * m_Urb
Definition: fxusbpipe.hpp:175
VOID SetInfo(__in WDF_USB_REQUEST_TYPE Type, __in USBD_PIPE_HANDLE PipeHandle, __in USHORT Function)
Definition: fxusbpipe.cpp:1028
struct _UMURB_PIPE_REQUEST UmUrbPipeRequest
Definition: umusb.h:186
Definition: usb.h:529
USBD_PIPE_HANDLE PipeHandle
Definition: usb.h:264
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define UMURB_FUNCTION_ABORT_PIPE
Definition: umusb.h:10
#define URB_FUNCTION_ABORT_PIPE
Definition: usb.h:88
VOID FxFormatUsbRequest(__in FxRequestBase *Request, __in PURB Urb, __in FX_URB_TYPE FxUrbType, __drv_when(FxUrbType==FxUrbTypeUsbdAllocated, __in) __drv_when(FxUrbType !=FxUrbTypeUsbdAllocated, __in_opt) USBD_HANDLE UsbdHandle)
Definition: usbutil.cpp:29
VOID FxUsbUmFormatRequest(__in FxRequestBase *Request, __in_xcount(Urb->Length) PUMURB_HEADER Urb, __in IWudfFile *HostFile, __in BOOLEAN Reuse)
Definition: usbutil.cpp:486
@ WdfUsbRequestTypePipeAbort
Definition: wdfusb.h:94

Referenced by ValidateTransferLength().

◆ FormatResetRequest()

_Must_inspect_result_ NTSTATUS FxUsbPipe::FormatResetRequest ( __in FxRequestBase Request)

Definition at line 1783 of file fxusbpipe.cpp.

1786{
1787 FxUsbPipeRequestContext* pContext;
1789 FX_URB_TYPE urbType;
1790
1791 status = Request->ValidateTarget(this);
1792 if (!NT_SUCCESS(status)) {
1794 "Pipe %p, Request %p, setting target failed, "
1795 "status %!STATUS!", this, Request, status);
1796
1797 return status;
1798 }
1799
1800 if (Request->HasContextType(FX_RCT_USB_PIPE_REQUEST)) {
1801 pContext = (FxUsbPipeRequestContext*) Request->GetContext();
1802 }
1803 else {
1805 pContext = new(GetDriverGlobals()) FxUsbPipeRequestContext(urbType);
1806 if (pContext == NULL) {
1808 }
1809
1810#if (FX_CORE_MODE == FX_CORE_KERNEL_MODE)
1811 if (urbType == FxUrbTypeUsbdAllocated) {
1812 status = pContext->AllocateUrb(m_USBDHandle);
1813 if (!NT_SUCCESS(status)) {
1814 delete pContext;
1815 return status;
1816 }
1817 //
1818 // Since the AllocateUrb routine calls USBD_xxxUrbAllocate APIs to allocate an Urb, it is
1819 // important to release those resorces before the devnode is removed. Those
1820 // resoruces are removed at the time Request is disposed.
1821 //
1822 Request->EnableContextDisposeNotification();
1823 }
1824#endif
1825
1826 Request->SetContext(pContext);
1827 }
1828
1829#if (FX_CORE_MODE == FX_CORE_KERNEL_MODE)
1830 //
1831 // URB_FUNCTION_RESET_PIPE and URB_FUNCTION_SYNC_RESET_PIPE_AND_CLEAR_STALL
1832 // are the same value
1833 //
1837
1838 if (pContext->m_Urb == &pContext->m_UrbLegacy) {
1839 urbType = FxUrbTypeLegacy;
1840 }
1841 else {
1842 urbType = FxUrbTypeUsbdAllocated;
1843 }
1844
1845 FxFormatUsbRequest(Request, (PURB)pContext->m_Urb, urbType, m_USBDHandle);
1846#elif (FX_CORE_MODE == FX_CORE_USER_MODE)
1849 m_PipeInformationUm.PipeId,
1852#endif
1853
1854 return STATUS_SUCCESS;
1855}
#define UMURB_FUNCTION_SYNC_RESET_PIPE_AND_CLEAR_STALL
Definition: umusb.h:38
#define URB_FUNCTION_RESET_PIPE
Definition: usb.h:151
@ WdfUsbRequestTypePipeReset
Definition: wdfusb.h:95

Referenced by Reset(), and ValidateTransferLength().

◆ FormatTransferRequest()

_Must_inspect_result_ NTSTATUS FxUsbPipe::FormatTransferRequest ( __in FxRequestBase Request,
__in FxRequestBuffer Buffer,
__in ULONG  TransferFlags = 0 
)

Definition at line 204 of file fxusbpipekm.cpp.

209{
210 FxUsbPipeTransferContext* pContext;
212 size_t bufferSize;
213 ULONG dummyLength;
214 FX_URB_TYPE urbType;
215
216 //
217 // Make sure request is for the right type
218 //
221
223 "WDFUSBPIPE %p not the right type, %!STATUS!",
224 GetHandle(), status);
225
226 return status;
227 }
228
229 bufferSize = Buffer->GetBufferLength();
230
231 status = RtlSizeTToULong(bufferSize, &dummyLength);
232 if (!NT_SUCCESS(status)) {
234 "WDFUSBPIPE %p, buffer size truncated, %!STATUS!",
235 GetHandle(), status);
236 return status;
237 }
238
239 //
240 // On reads, check to make sure the read in value is an integral number of
241 // packet sizes
242 //
243 if (TransferFlags & USBD_TRANSFER_DIRECTION_IN) {
244 if (IsInEndpoint() == FALSE) {
246 "Pipe %p, sending __in transaction on a __out endpoint",
247 this);
248
250 }
251
252 if (m_CheckPacketSize &&
255 }
256 }
257 else {
258 if (IsOutEndpoint() == FALSE) {
260 "Pipe %p, sending __out transaction on an __in endpoint",
261 this);
262
264 }
265 }
266
267 status = Request->ValidateTarget(this);
268 if (!NT_SUCCESS(status)) {
270 "Pipe %p, Request %p, setting target failed, "
271 "status %!STATUS!", this, Request, status);
272
273 return status;
274 }
275
276 if (Request->HasContextType(FX_RCT_USB_PIPE_XFER)) {
277 pContext = (FxUsbPipeTransferContext*) Request->GetContext();
278 }
279 else {
281
282 pContext = new(GetDriverGlobals()) FxUsbPipeTransferContext(urbType);
283 if (pContext == NULL) {
285 }
286
287 if (urbType == FxUrbTypeUsbdAllocated) {
288 status = pContext->AllocateUrb(m_USBDHandle);
289 if (!NT_SUCCESS(status)) {
290 delete pContext;
291 return status;
292 }
293 //
294 // Since the AllocateUrb routine calls USBD_xxxUrbAllocate APIs to allocate an Urb, it is
295 // important to release those resorces before the devnode is removed. Those
296 // resoruces are removed at the time Request is disposed.
297 //
298 Request->EnableContextDisposeNotification();
299 }
300
301 Request->SetContext(pContext);
302 }
303
304 //
305 // Always set the memory after determining the context. This way we can
306 // free a previously referenced memory object if necessary.
307 //
308 if (Buffer->HasMdl()) {
309 PMDL pMdl;
310
311 pMdl=NULL;
312 ASSERT(pContext->m_PartialMdl == NULL);
313
314 //
315 // If it is an __in endpoint, the buffer will be written to by the
316 // controller, so request IoWriteAccess locking.
317 //
318 status = Buffer->GetOrAllocateMdl(
320 &pMdl,
321 &pContext->m_PartialMdl,
322 &pContext->m_UnlockPages,
324
325 if (!NT_SUCCESS(status)) {
326 return status;
327 }
328
329 ASSERT(pMdl != NULL);
330 }
331
333
334 pContext->SetUrbInfo(m_PipeInformation.PipeHandle, TransferFlags);
335
336 if (pContext->m_Urb == &pContext->m_UrbLegacy) {
337 urbType = FxUrbTypeLegacy;
338 }
339 else {
340 urbType = FxUrbTypeUsbdAllocated;
341 }
342
343 FxFormatUsbRequest(Request, (PURB)pContext->m_Urb, urbType, m_USBDHandle);
344
345 return STATUS_SUCCESS;
346}
Definition: bufpool.h:45
BOOLEAN IsType(__in WDF_USB_PIPE_TYPE Type)
#define FALSE
Definition: types.h:117
#define RtlSizeTToULong
@ FX_RCT_USB_PIPE_XFER
size_t bufferSize
return pUsbPipe IsOutEndpoint()
return pUsbPipe IsInEndpoint()
#define STATUS_INVALID_BUFFER_SIZE
Definition: ntstatus.h:650
_URB_BULK_OR_INTERRUPT_TRANSFER m_UrbLegacy
Definition: fxusbpipe.hpp:86
_URB_BULK_OR_INTERRUPT_TRANSFER * m_Urb
Definition: fxusbpipe.hpp:91
virtual VOID StoreAndReferenceMemory(__in FxRequestBuffer *Buffer)
Definition: fxusbpipekm.cpp:13
__checkReturn NTSTATUS AllocateUrb(__in USBD_HANDLE USBDHandle)
Definition: fxusbpipe.cpp:825
VOID SetUrbInfo(__in USBD_PIPE_HANDLE PipeHandle, __in ULONG TransferFlags)
Definition: fxusbpipe.cpp:903
USHORT MaximumPacketSize
Definition: usb.h:260
#define GetHandle(h)
Definition: treelist.c:116
uint32_t ULONG
Definition: typedefs.h:59
#define STATUS_INVALID_DEVICE_REQUEST
Definition: udferr_usr.h:138
@ IoReadAccess
Definition: ketypes.h:863
@ IoWriteAccess
Definition: ketypes.h:864

Referenced by _FormatTransfer(), _SendTransfer(), FxUsbPipeContinuousReader::FormatRepeater(), and ValidateTransferLength().

◆ GetHandle()

◆ GetInformation()

VOID FxUsbPipe::GetInformation ( __out PWDF_USB_PIPE_INFORMATION  PipeInformation)

Definition at line 349 of file fxusbpipekm.cpp.

352{
353 //
354 // Do a field by field copy for the WDF structure, since fields could change.
355 //
362}
UCHAR GetConfiguredSettingIndex(VOID)
static WDF_USB_PIPE_TYPE _UsbdPipeTypeToWdf(__in USBD_PIPE_TYPE UsbdPipeType)
Definition: fxusbpipe.hpp:643
ULONG MaximumTransferSize
Definition: usb.h:265
USBD_PIPE_TYPE PipeType
Definition: usb.h:263
UCHAR EndpointAddress
Definition: usb.h:261
_In_ WDFUSBPIPE _Out_ PWDF_USB_PIPE_INFORMATION PipeInformation
Definition: wdfusb.h:1744

Referenced by FxUsbInterface::GetConfiguredPipe().

◆ GetMaxPacketSize()

ULONG FxUsbPipe::GetMaxPacketSize ( VOID  )
inline

Definition at line 555 of file fxusbpipe.hpp.

558 {
559#if (FX_CORE_MODE == FX_CORE_KERNEL_MODE)
561#elif (FX_CORE_MODE == FX_CORE_USER_MODE)
562 return m_PipeInformationUm.MaximumPacketSize;
563#endif
564 }

◆ GetType()

WDF_USB_PIPE_TYPE FxUsbPipe::GetType ( VOID  )

Definition at line 365 of file fxusbpipekm.cpp.

Referenced by if().

◆ GetUrbType()

FX_URB_TYPE FxUsbPipe::GetUrbType ( VOID  )
inline

Definition at line 676 of file fxusbpipe.hpp.

679 {
680 return m_UrbType;
681 }

Referenced by __in_xcount().

◆ GetUSBDHandle()

USBD_HANDLE FxUsbPipe::GetUSBDHandle ( VOID  )
inline

Definition at line 668 of file fxusbpipe.hpp.

671 {
672 return m_USBDHandle;
673 }

Referenced by __in_xcount().

◆ GotoPurgeState()

VOID FxUsbPipe::GotoPurgeState ( __in WDF_IO_TARGET_PURGE_IO_ACTION  Action,
__in PLIST_ENTRY  PendedRequestListHead,
__in PSINGLE_LIST_ENTRY  SentRequestListHead,
__out PBOOLEAN  Wait,
__in BOOLEAN  LockSelf 
)
virtual

Reimplemented from FxIoTarget.

Definition at line 1294 of file fxusbpipe.cpp.

1301{
1302 KIRQL irql;
1304
1307
1308 if (LockSelf) {
1309 Lock(&irql);
1310 }
1311
1312 if (m_Reader != NULL) {
1313 //
1314 // If we are a continuous reader, always wait for the sent io, so that we
1315 // can resubmit it later on a restart.
1316 //
1319 "WDFUSBPIPE %p converting purge action %!WDF_IO_TARGET_PURGE_IO_ACTION!"
1320 " to %!WDF_IO_TARGET_PURGE_IO_ACTION!", GetHandle(), Action,
1322
1324 }
1325
1326 FxIoTarget::GotoPurgeState(Action, // __super call
1327 PendedRequestListHead,
1328 SentRequestListHead,
1329 Wait,
1330 FALSE);
1331
1332 if (m_Reader != NULL) {
1333 //
1334 // The continuous reader requests are no longer enqueued. Remember that
1335 // state, so when we restart, we resend them.
1336 //
1338
1339 //
1340 // Log a message when misbehaved drivers call WdfIoTargetPurge
1341 // from EvtUsbTargetPipeReadersFailed callback.
1342 //
1346 "WDFUSBPIPE %p is purged from EvtUsbTargetPipeReadersFailed"
1347 " callback", GetHandle());
1348
1350 }
1351
1352 //
1353 // Make sure work item is done. It is possible for the upper class
1354 // to return wait = false if the list of sent requests is empty. We
1355 // still want to wait anyway for making sure work item is not about
1356 // to run or it is running.
1357 //
1358 *Wait = TRUE;
1359 }
1360
1361 if (LockSelf) {
1362 Unlock(irql);
1363 }
1364}
virtual VOID GotoPurgeState(__in WDF_IO_TARGET_PURGE_IO_ACTION Action, __in PLIST_ENTRY PendedRequestListHead, __in PSINGLE_LIST_ENTRY SentRequestListHead, __out PBOOLEAN Wait, __in BOOLEAN LockSelf)
Definition: fxiotarget.cpp:790
__drv_restoresIRQL KIRQL __in BOOLEAN Unlock
Definition: fxobject.hpp:1474
static __inline MxThread MxGetCurrentThread()
Definition: mxgeneralkm.h:61
KIRQL irql
Definition: wave.h:1
UCHAR KIRQL
Definition: env_spec_w32.h:591
PFX_DRIVER_GLOBALS pFxDriverGlobals
FxVerifierDbgBreakPoint(pFxDriverGlobals)
#define TRACE_LEVEL_INFORMATION
Definition: storswtr.h:29
volatile POINTER_ALIGNMENT MxThread m_WorkItemThread
Definition: fxusbpipe.hpp:372
_In_ WDFDPC _In_ BOOLEAN Wait
Definition: wdfdpc.h:170
_In_ WDFIOTARGET _In_ _Strict_type_match_ WDF_IO_TARGET_SENT_IO_ACTION Action
Definition: wdfiotarget.h:510
@ WdfIoTargetPurgeIoAndWait
Definition: wdfiotarget.h:78
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFWAITLOCK * Lock
Definition: wdfsync.h:127

Referenced by FxUsbDevice::Purge().

◆ GotoRemoveState()

VOID FxUsbPipe::GotoRemoveState ( __in WDF_IO_TARGET_STATE  NewState,
__in PLIST_ENTRY  PendedRequestListHead,
__in PSINGLE_LIST_ENTRY  SentRequestListHead,
__in BOOLEAN  Lock,
__out PBOOLEAN  Wait 
)
virtual

Reimplemented from FxIoTarget.

Definition at line 1367 of file fxusbpipe.cpp.

1374{
1375 KIRQL irql;
1376
1378
1379 if (LockSelf) {
1380 Lock(&irql);
1381 }
1382
1385 //
1386 // Driver forgot to stop the pipe on D0Exit.
1387 //
1390 "WDFUSBPIPE %p was not stopped in EvtDeviceD0Exit callback",
1391 GetHandle());
1392
1393 if (GetDriverGlobals()->IsVerificationEnabled(1,9,OkForDownLevel)) {
1395 }
1396 }
1397
1398 FxIoTarget::GotoRemoveState(NewState, // __super call
1399 PendedRequestListHead,
1400 SentRequestListHead,
1401 FALSE,
1402 Wait);
1403 if (m_Reader != NULL) {
1404 //
1405 // Make sure work item is done. It is possible for the upper class to
1406 // return wait = false if the list of sent requests is empty. We still
1407 // want to wait anyway for making sure work item is not about to run or
1408 // it is running.
1409 //
1410 *Wait = TRUE;
1411 }
1412
1413 if (LockSelf) {
1414 Unlock(irql);
1415 }
1416}
WDF_IO_TARGET_STATE m_State
Definition: fxiotarget.hpp:928
virtual VOID GotoRemoveState(__in WDF_IO_TARGET_STATE NewState, __in PLIST_ENTRY PendedRequestListHead, __in PSINGLE_LIST_ENTRY SentRequestListHead, __in BOOLEAN Lock, __out PBOOLEAN Wait)
Definition: fxiotarget.cpp:964
@ OkForDownLevel
Definition: fxglobals.h:80
@ WdfIoTargetStarted
Definition: wdfiotarget.h:53

Referenced by FxUsbDevice::CleanupInterfacePipesAndDelete(), and FxUsbDevice::PipesGotoRemoveState().

◆ GotoStartState()

_Must_inspect_result_ NTSTATUS FxUsbPipe::GotoStartState ( __in PLIST_ENTRY  RequestListHead,
__in BOOLEAN  Lock = TRUE 
)
virtual

Reimplemented from FxIoTarget.

Definition at line 1133 of file fxusbpipe.cpp.

1137{
1139 LONG i;
1140
1141 if (m_Reader != NULL) {
1144
1145 for (i = 0; i < m_Reader->m_NumReaders; i++) {
1147
1149
1150 UNREFERENCED_PARAMETER(pRequest); //for fre build
1153 }
1154 }
1155 }
1156
1157 status = FxIoTarget::GotoStartState(RequestListHead, Lock);
1158
1159 if (m_Reader == NULL || !NT_SUCCESS(status)) {
1160 return status;
1161 }
1162
1163 //
1164 // Add the repeater requests to the list head so that they are sent by the
1165 // caller of this function when this function returns IFF they have not yet
1166 // been queued. (They can be queued on a start -> start transition.)
1167 //
1169 for (i = 0; i < m_Reader->m_NumReaders; i++) {
1170 //
1171 // This will clear ReadCompletedEvent as well
1172 //
1174
1175 if (!NT_SUCCESS(status)) {
1176 return status;
1177 }
1178 }
1179
1180 //
1181 // Reset the number of failed readers in case we had failure in a
1182 // previously started state.
1183 //
1185
1186 for (i = 0; i < m_Reader->m_NumReaders; i++) {
1188
1190 pRequest->SetTarget(this);
1191 pRequest->ADDREF(this);
1192
1193 //
1194 // NOTE: This is an elusive backdoor to send the Request down
1195 // since it is inserted directly into the IoTargets pended list.
1196 // The IoTarget is not started so we add the request to the
1197 // pended list so that it is processed when the IoTarget starts.
1198 //
1200 InsertTailList(RequestListHead, &pRequest->m_ListEntry);
1201
1202 //
1203 // Clear the event only when we know it will be submitted to the
1204 // target. It will be set when the request is submitted to the
1205 // target and the submit fails or if it is cancelled.
1206 //
1208 }
1209
1211 }
1212
1213 return status;
1214}
virtual _Must_inspect_result_ NTSTATUS GotoStartState(__in PLIST_ENTRY RequestListHead, __in BOOLEAN Lock=TRUE)
Definition: fxiotarget.cpp:306
LIST_ENTRY m_SentIoListHead
Definition: fxiotarget.hpp:868
__inline VOID IncrementIoCount(VOID)
Definition: fxiotarget.hpp:767
SINGLE_LIST_ENTRY m_DrainSingleEntry
LIST_ENTRY m_ListEntry
VOID __inline SetTarget(__in FxIoTarget *Target)
__inline VOID Clear()
Definition: mxeventkm.h:102
#define InsertTailList(ListHead, Entry)
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
long LONG
Definition: pedump.c:60
FxUsbPipeRepeatReader m_Readers[1]
Definition: fxusbpipe.hpp:406
_Must_inspect_result_ NTSTATUS FormatRepeater(__in FxUsbPipeRepeatReader *Repeater)
Definition: fxusbpipe.cpp:687
struct _SINGLE_LIST_ENTRY * Next
Definition: ntbasedef.h:629

Referenced by FxUsbDevice::Start().

◆ GotoStopState()

VOID FxUsbPipe::GotoStopState ( __in WDF_IO_TARGET_SENT_IO_ACTION  Action,
__in PSINGLE_LIST_ENTRY  SentRequestListHead,
__out PBOOLEAN  Wait,
__in BOOLEAN  LockSelf 
)
virtual

Reimplemented from FxIoTarget.

Definition at line 1217 of file fxusbpipe.cpp.

1223{
1224 KIRQL irql;
1226
1229
1230 if (LockSelf) {
1231 Lock(&irql);
1232 }
1233
1234 if (m_Reader != NULL) {
1235 //
1236 // If we are a continuous reader, always cancel the sent io so that we
1237 // can resubmit it later on a restart.
1238 //
1241 "WDFUSBPIPE %p converting stop action %!WDF_IO_TARGET_SENT_IO_ACTION!"
1242 " to %!WDF_IO_TARGET_SENT_IO_ACTION!", GetHandle(), Action,
1244
1246 }
1247
1248 FxIoTarget::GotoStopState(Action, SentRequestListHead, Wait, FALSE); // __super call
1249
1250 if (m_Reader != NULL) {
1251 //
1252 // The continuous reader requests are no longer enqueued. Remember that
1253 // state, so when we restart, we resend them.
1254 //
1256
1257 //
1258 // Log a message when misbehaved drivers call WdfIoTargetStop
1259 // from EvtUsbTargetPipeReadersFailed callback.
1260 //
1264 "WDFUSBPIPE %p is stopped from EvtUsbTargetPipeReadersFailed"
1265 " callback", GetHandle());
1266
1269 }
1270 }
1271
1272 //
1273 // Do not deadlock when misbehaved drivers (< v1.9) call
1274 // WdfIoTargetStop from EvtUsbTargetPipeReadersFailed callback.
1275 //
1278 //
1279 // Make sure work item is done. It is possible for the upper class
1280 // to return wait = false if the list of sent requests is empty. We
1281 // still want to wait anyway for making sure work item is not about
1282 // to run or it is running.
1283 //
1284 *Wait = TRUE;
1285 }
1286 }
1287
1288 if (LockSelf) {
1289 Unlock(irql);
1290 }
1291}
virtual VOID GotoStopState(__in WDF_IO_TARGET_SENT_IO_ACTION Action, __in PSINGLE_LIST_ENTRY SentRequestListHead, __out PBOOLEAN Wait, __in BOOLEAN LockSelf)
Definition: fxiotarget.cpp:617
_Must_inspect_result_ BOOLEAN IsVersionGreaterThanOrEqualTo(__in ULONG Major, __in ULONG Minor)
Definition: globalskm.cpp:92
_Must_inspect_result_ BOOLEAN IsVerificationEnabled(__in ULONG Major, __in ULONG Minor, __in FxVerifierDownlevelOption DownLevel)
Definition: fxglobals.h:286
@ WdfIoTargetCancelSentIo
Definition: wdfiotarget.h:71

Referenced by FxUsbDevice::Stop().

◆ InitContinuousReader()

_Must_inspect_result_ NTSTATUS FxUsbPipe::InitContinuousReader ( __in PWDF_USB_CONTINUOUS_READER_CONFIG  Config,
__in size_t  TotalBufferLength 
)

Definition at line 1463 of file fxusbpipe.cpp.

1467{
1470 UCHAR numReaders;
1471
1472 pReader = NULL;
1473
1474 if (m_Reader != NULL) {
1476
1479 "Continuous reader already initialized on WDFUSBPIPE %p %!STATUS!",
1480 GetHandle(), status);
1481
1482 return status;
1483 }
1484
1485 numReaders = Config->NumPendingReads;
1486
1487 if (numReaders == 0) {
1488 numReaders = NUM_PENDING_READS_DEFAULT;
1489 }
1490 else if (numReaders > NUM_PENDING_READS_MAX) {
1491 numReaders = NUM_PENDING_READS_MAX;
1492 }
1493
1494 pReader = new(GetDriverGlobals(), numReaders)
1495 FxUsbPipeContinuousReader(this, numReaders);
1496
1497 if (pReader == NULL) {
1499 }
1500
1501 //
1502 // Allocate all of the structurs and objects required
1503 //
1504 status = pReader->Config(Config, TotalBufferLength);
1505
1506 if (!NT_SUCCESS(status)) {
1507 delete pReader;
1508 return status;
1509 }
1510
1511 pReader->m_ReadCompleteCallback = Config->EvtUsbTargetPipeReadComplete;
1512 pReader->m_ReadCompleteContext = Config->EvtUsbTargetPipeReadCompleteContext;
1513
1514 pReader->m_ReadersFailedCallback = Config->EvtUsbTargetPipeReadersFailed;
1515
1517 pReader,
1518 NULL) == NULL) {
1519 //
1520 // We set the field, do nothing.
1521 //
1522 DO_NOTHING();
1523 }
1524 else {
1525 //
1526 // Some other thread came in and set the field, free our allocation.
1527 //
1528 delete pReader;
1529 }
1530
1531 return STATUS_SUCCESS;
1532}
friend FxUsbPipeContinuousReader
Definition: fxusbpipe.hpp:413
#define NUM_PENDING_READS_MAX
Definition: fxusbpipe.hpp:222
#define NUM_PENDING_READS_DEFAULT
Definition: fxusbpipe.hpp:221
#define InterlockedCompareExchangePointer
Definition: interlocked.h:129
#define DO_NOTHING()
Definition: mxgeneral.h:32
PFN_WDF_USB_READERS_FAILED m_ReadersFailedCallback
Definition: fxusbpipe.hpp:335
PFN_WDF_USB_READER_COMPLETION_ROUTINE m_ReadCompleteCallback
Definition: fxusbpipe.hpp:325
WDFCONTEXT m_ReadCompleteContext
Definition: fxusbpipe.hpp:330
_Must_inspect_result_ NTSTATUS Config(__in PWDF_USB_CONTINUOUS_READER_CONFIG Config, __in size_t TotalBufferLength)
Definition: fxusbpipekm.cpp:88
#define STATUS_INVALID_DEVICE_STATE
Definition: udferr_usr.h:178
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_CHILD_LIST_CONFIG Config
Definition: wdfchildlist.h:476
unsigned char UCHAR
Definition: xmlstorage.h:181

◆ InitPipe() [1/2]

VOID FxUsbPipe::InitPipe ( __in PUSBD_PIPE_INFORMATION  PipeInfo,
__in UCHAR  InterfaceNumber,
__in FxUsbInterface UsbInterface 
)

Definition at line 1073 of file fxusbpipe.cpp.

1078{
1081
1082 if (m_UsbInterface != NULL) {
1083 m_UsbInterface->RELEASE(this);
1085 }
1086
1088 m_UsbInterface->ADDREF(this);
1089}
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
_In_ PVOID _In_ LONG InterfaceNumber
Definition: usbdlib.h:169
_In_ WDFUSBINTERFACE _In_ UCHAR _Out_opt_ PWDF_USB_PIPE_INFORMATION PipeInfo
Definition: wdfusb.h:2543
_In_ WDFUSBINTERFACE UsbInterface
Definition: wdfusb.h:2276

Referenced by FxUsbInterface::MakeAndConfigurePipes(), and FxUsbInterface::SetInfo().

◆ InitPipe() [2/2]

VOID FxUsbPipe::InitPipe ( __in PWINUSB_PIPE_INFORMATION  PipeInfo,
__in UCHAR  InterfaceNumber,
__in FxUsbInterface UsbInterface 
)

Definition at line 199 of file fxusbpipeum.cpp.

204{
207
208 if (m_UsbInterface != NULL) {
209 m_UsbInterface->RELEASE(this);
211 }
212
214 m_UsbInterface->ADDREF(this);
215}

◆ IsInEndpoint()

__inline BOOLEAN FxUsbPipe::IsInEndpoint ( VOID  )
inline

Definition at line 513 of file fxusbpipe.hpp.

516 {
517 //
518 // USB_ENDPOINT_DIRECTION_IN just does a bitwise compre so it could
519 // return 0 or some non zero value. Make sure the non zero value is
520 // TRUE
521 //
522#if (FX_CORE_MODE == FX_CORE_KERNEL_MODE)
524#elif (FX_CORE_MODE == FX_CORE_USER_MODE)
526#endif
527 }
#define USB_ENDPOINT_DIRECTION_IN(x)
Definition: usb100.h:76

◆ IsOutEndpoint()

__inline BOOLEAN FxUsbPipe::IsOutEndpoint ( VOID  )
inline

Definition at line 531 of file fxusbpipe.hpp.

534 {
535 //
536 // USB_ENDPOINT_DIRECTION_OUT just does a bitwise compre so it could
537 // return 0 or some non zero value. Make sure the non zero value is
538 // TRUE
539 //
540#if (FX_CORE_MODE == FX_CORE_KERNEL_MODE)
542#elif (FX_CORE_MODE == FX_CORE_USER_MODE)
544#endif
545 }
#define USB_ENDPOINT_DIRECTION_OUT(x)
Definition: usb100.h:75

◆ IsType()

BOOLEAN FxUsbPipe::IsType ( __in WDF_USB_PIPE_TYPE  Type)

Definition at line 373 of file fxusbpipekm.cpp.

376{
378}
Type
Definition: Type.h:7

Referenced by FormatTransferRequest().

◆ Reset()

NTSTATUS FxUsbPipe::Reset ( VOID  )

Definition at line 1858 of file fxusbpipe.cpp.

1861{
1863
1864 FxSyncRequest request(GetDriverGlobals(), &context);
1866
1867 //
1868 // FxSyncRequest always succeesds for KM but can fail for UM.
1869 //
1870 status = request.Initialize();
1871 if (!NT_SUCCESS(status)) {
1873 "Failed to initialize FxSyncRequest");
1874 return status;
1875 }
1876
1877 status = FormatResetRequest(request.m_TrueRequest);
1878 if (NT_SUCCESS(status)) {
1879 if (m_Reader != NULL) {
1880 //
1881 // This assumes that no other I/O besides reader I/O is going on.
1882 //
1884 }
1885 else {
1886 CancelSentIo();
1887 }
1889 }
1890 return status;
1891}
VOID CancelSentIo(VOID)
_Must_inspect_result_ NTSTATUS SubmitSyncRequestIgnoreTargetState(__in FxRequestBase *Request, __in_opt PWDF_REQUEST_SEND_OPTIONS RequestOptions)
_Must_inspect_result_ NTSTATUS FormatResetRequest(__in FxRequestBase *Request)
Definition: fxusbpipe.cpp:1783

Referenced by FxUsbPipeContinuousReader::FxUsbPipeRequestWorkItemHandler().

◆ SetNoCheckPacketSize()

__inline VOID FxUsbPipe::SetNoCheckPacketSize ( VOID  )
inline

Definition at line 480 of file fxusbpipe.hpp.

483 {
485 }

◆ ValidateTransferLength()

_Must_inspect_result_ NTSTATUS FxUsbPipe::ValidateTransferLength ( __in size_t  Length)
inline

Definition at line 568 of file fxusbpipe.hpp.

571 {
572 //
573 // Assumes this is not a control pipe
574 //
575 if (m_CheckPacketSize &&
576#if (FX_CORE_MODE == FX_CORE_KERNEL_MODE)
578#elif (FX_CORE_MODE == FX_CORE_USER_MODE)
579 (Length % m_PipeInformationUm.MaximumPacketSize) != 0) {
580#endif
582 }
583 else {
584 return STATUS_SUCCESS;
585 }
586 }
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102

◆ WaitForSentIoToComplete()

VOID FxUsbPipe::WaitForSentIoToComplete ( VOID  )
virtual

Reimplemented from FxIoTarget.

Definition at line 1419 of file fxusbpipe.cpp.

1422{
1423 if (m_Reader != NULL) {
1426 "WDFUSBPIPE %p, waiting for continuous reader work item to complete",
1427 GetHandle());
1428
1429 //
1430 // First, wait for the work item to complete if it is running.
1431 //
1432 // NOTE: We don't wait for the DPC to complete because
1433 // they are flushed in FxUsbDevice::Dispose
1434 //
1436
1439 "WDFUSBPIPE %p, cancelling for continuous reader (max of %d)",
1441
1442 //
1443 // Now that the work item is not running, make sure all the readers are
1444 // truly canceled and *NOT* in the pended queue. In between the call to
1445 // GotoStopState and here, the work item could have run and retried to
1446 // send the I/O.
1447 //
1449 }
1450
1453 "WDFUSBPIPE %p, waiting for all i/o to complete", GetHandle());
1454
1455 //
1456 // Finally, let the parent class wait for all I/O to complete
1457 //
1458 FxIoTarget::WaitForSentIoToComplete(); // __super call
1459}
virtual VOID WaitForSentIoToComplete(VOID)
Definition: fxiotarget.hpp:676
FxSystemWorkItem * m_WorkItem
Definition: fxusbpipe.hpp:360

Referenced by FxUsbDevice::CleanupInterfacePipesAndDelete().

◆ WdmGetPipeHandle()

USBD_PIPE_HANDLE FxUsbPipe::WdmGetPipeHandle ( VOID  )
inline

Definition at line 634 of file fxusbpipe.hpp.

637 {
639 }

Member Data Documentation

◆ FxUsbDevice

friend FxUsbPipe::FxUsbDevice

Definition at line 411 of file fxusbpipe.hpp.

◆ FxUsbInterface

friend FxUsbPipe::FxUsbInterface

Definition at line 412 of file fxusbpipe.hpp.

◆ FxUsbPipeContinuousReader

friend FxUsbPipe::FxUsbPipeContinuousReader

Definition at line 413 of file fxusbpipe.hpp.

Referenced by InitContinuousReader().

◆ m_CheckPacketSize

BOOLEAN FxUsbPipe::m_CheckPacketSize
protected

◆ m_InterfaceNumber

UCHAR FxUsbPipe::m_InterfaceNumber
protected

Definition at line 726 of file fxusbpipe.hpp.

Referenced by FxUsbPipe(), and InitPipe().

◆ m_ListEntry

LIST_ENTRY FxUsbPipe::m_ListEntry

Definition at line 687 of file fxusbpipe.hpp.

Referenced by FxUsbPipe(), and ~FxUsbPipe().

◆ m_PipeInformation

◆ m_PipeInformationUm

WINUSB_PIPE_INFORMATION FxUsbPipe::m_PipeInformationUm
protected

◆ m_Reader

◆ m_UrbType

FX_URB_TYPE FxUsbPipe::m_UrbType
protected

Definition at line 743 of file fxusbpipe.hpp.

Referenced by FxUsbPipe(), and GetUrbType().

◆ m_UsbDevice

◆ m_USBDHandle

USBD_HANDLE FxUsbPipe::m_USBDHandle
protected

◆ m_UsbInterface

FxUsbInterface* FxUsbPipe::m_UsbInterface
protected

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