ReactOS 0.4.16-dev-1946-g52006dd
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 1052 of file fxusbpipe.cpp.

1055 :
1056 FxIoTarget(FxDriverGlobals, sizeof(FxUsbPipe), FX_TYPE_IO_TARGET_USB_PIPE),
1058{
1061#if (FX_CORE_MODE == FX_CORE_USER_MODE)
1063#endif
1065 m_Reader = NULL;
1068 m_USBDHandle = UsbDevice->m_USBDHandle;
1069 m_UrbType = UsbDevice->m_UrbType;
1070
1072}
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 1093 of file fxusbpipe.cpp.

1094{
1095 if (m_UsbInterface != NULL) {
1097 m_UsbInterface->RELEASE(this);
1098 }
1099
1101}
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 1538 of file fxusbpipe.cpp.

1546{
1552
1553 FxObjectHandleGetPtrAndGlobals(FxDriverGlobals,
1554 Pipe,
1556 (PVOID*) &pUsbPipe,
1557 &FxDriverGlobals);
1558
1559 FxObjectHandleGetPtr(FxDriverGlobals,
1560 Request,
1562 (PVOID*) &pRequest);
1563
1564 //
1565 // We allow zero length transfers (which are indicated by TransferMemory == NULL)
1566 //
1567 if (TransferMemory != NULL) {
1568 FxObjectHandleGetPtr(FxDriverGlobals,
1571 (PVOID*) &pMemory);
1572
1573 status = pMemory->ValidateMemoryOffsets(TransferOffsets);
1574 if (!NT_SUCCESS(status)) {
1575 goto Done;
1576 }
1577
1578 buf.SetMemory(pMemory, TransferOffsets);
1579 }
1580 else {
1581 pMemory = NULL;
1582 }
1583
1585
1586 if (NT_SUCCESS(status)) {
1587 FxUsbPipeTransferContext* pContext;
1588
1590
1591 //
1592 // By assuming the fields are at the same offset, we can use simpler
1593 // logic (w/out comparisons for type) to set them.
1594 //
1595 WDFCASSERT(
1598 );
1599
1600 WDFCASSERT(
1603 );
1604
1606 pContext->m_UsbParameters.Parameters.PipeWrite.Length = buf.GetBufferLength();
1607
1608 pContext->m_UsbParameters.Parameters.PipeWrite.Offset =
1609 (TransferOffsets != NULL) ? TransferOffsets->BufferOffset
1610 : 0;
1611 pContext->SetUsbType(
1614 );
1615 }
1616
1617Done:
1619 "WDFUSBPIPE %p, WDFREQUEST %p, WDFMEMORY %p, %!STATUS!",
1621
1622 return status;
1623}
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:33
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::@4014 Parameters
struct _WDF_USB_REQUEST_COMPLETION_PARAMS::@4014::@4018 PipeWrite
struct _WDF_USB_REQUEST_COMPLETION_PARAMS::@4014::@4019 PipeRead
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 1627 of file fxusbpipe.cpp.

1636{
1640
1641 FxObjectHandleGetPtrAndGlobals(FxDriverGlobals,
1642 Pipe,
1644 (PVOID*) &pUsbPipe,
1645 &FxDriverGlobals);
1646
1648
1649 FxSyncRequest request(FxDriverGlobals, &context, Request);
1650
1651 //
1652 // FxSyncRequest always succeesds for KM but can fail for UM.
1653 //
1654 status = request.Initialize();
1655 if (!NT_SUCCESS(status)) {
1657 "Failed to initialize FxSyncRequest");
1658 return status;
1659 }
1660
1661 if (BytesTransferred != NULL) {
1662 *BytesTransferred = 0;
1663 }
1664
1665 status = FxVerifierCheckIrqlLevel(FxDriverGlobals, PASSIVE_LEVEL);
1666 if (!NT_SUCCESS(status)) {
1667 return status;
1668 }
1669
1671 if (!NT_SUCCESS(status)) {
1672 return status;
1673 }
1674
1675 //
1676 // We allow zero length writes (which are indicated by MemoryDescriptor == NULL)
1677 //
1678 if (MemoryDescriptor != NULL) {
1679 status = buf.ValidateMemoryDescriptor(FxDriverGlobals, MemoryDescriptor);
1680 if (!NT_SUCCESS(status)) {
1681 return status;
1682 }
1683 }
1684
1686
1687 if (NT_SUCCESS(status)) {
1689 FxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGIOTARGET,
1690 "WDFUSBPIPE %p, WDFREQUEST %p being submitted",
1691 Pipe, request.m_TrueRequest->GetTraceObjectHandle());
1692
1693 status = pUsbPipe->SubmitSync(request.m_TrueRequest, RequestOptions);
1694
1695 //
1696 // Even on error we want to set this value. USBD should be clearing
1697 // it if the transfer fails.
1698 //
1699 if (BytesTransferred != NULL) {
1700 *BytesTransferred = context.GetUrbTransferLength();
1701 }
1702 }
1703
1705 "WDFUSBPIPE %p, %!STATUS!", Pipe, status);
1706
1707 return status;
1708}
_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 1104 of file fxusbpipe.cpp.

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

◆ FormatAbortRequest()

_Must_inspect_result_ NTSTATUS FxUsbPipe::FormatAbortRequest ( __in FxRequestBase Request)

Definition at line 1712 of file fxusbpipe.cpp.

1715{
1716 FxUsbPipeRequestContext* pContext;
1718 FX_URB_TYPE urbType;
1719
1720 status = Request->ValidateTarget(this);
1721 if (!NT_SUCCESS(status)) {
1723 "Pipe %p, Request %p, setting target failed, "
1724 "status %!STATUS!", this, Request, status);
1725
1726 return status;
1727 }
1728
1729 if (Request->HasContextType(FX_RCT_USB_PIPE_REQUEST)) {
1730 pContext = (FxUsbPipeRequestContext*) Request->GetContext();
1731 }
1732 else {
1733
1735 pContext = new(GetDriverGlobals()) FxUsbPipeRequestContext(urbType);
1736 if (pContext == NULL) {
1738 }
1739
1740#if (FX_CORE_MODE == FX_CORE_KERNEL_MODE)
1741 if (urbType == FxUrbTypeUsbdAllocated) {
1742 status = pContext->AllocateUrb(m_USBDHandle);
1743 if (!NT_SUCCESS(status)) {
1744 delete pContext;
1745 return status;
1746 }
1747 //
1748 // Since the AllocateUrb routine calls USBD_xxxUrbAllocate APIs to allocate an Urb, it is
1749 // important to release those resorces before the devnode is removed. Those
1750 // resoruces are removed at the time Request is disposed.
1751 //
1752 Request->EnableContextDisposeNotification();
1753 }
1754#endif
1755
1756 Request->SetContext(pContext);
1757 }
1758
1759#if (FX_CORE_MODE == FX_CORE_KERNEL_MODE)
1763
1764 if (pContext->m_Urb == &pContext->m_UrbLegacy) {
1765 urbType = FxUrbTypeLegacy;
1766 }
1767 else {
1768 urbType = FxUrbTypeUsbdAllocated;
1769 }
1770
1771 FxFormatUsbRequest(Request, (PURB)pContext->m_Urb, urbType, m_USBDHandle);
1772#elif (FX_CORE_MODE == FX_CORE_USER_MODE)
1775 m_PipeInformationUm.PipeId,
1778#endif
1779
1780 return STATUS_SUCCESS;
1781}
__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:994
_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:1030
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:31
VOID FxUsbUmFormatRequest(__in FxRequestBase *Request, __in_xcount(Urb->Length) PUMURB_HEADER Urb, __in IWudfFile *HostFile, __in BOOLEAN Reuse)
Definition: usbutil.cpp:488
@ WdfUsbRequestTypePipeAbort
Definition: wdfusb.h:94

Referenced by ValidateTransferLength().

◆ FormatResetRequest()

_Must_inspect_result_ NTSTATUS FxUsbPipe::FormatResetRequest ( __in FxRequestBase Request)

Definition at line 1785 of file fxusbpipe.cpp.

1788{
1789 FxUsbPipeRequestContext* pContext;
1791 FX_URB_TYPE urbType;
1792
1793 status = Request->ValidateTarget(this);
1794 if (!NT_SUCCESS(status)) {
1796 "Pipe %p, Request %p, setting target failed, "
1797 "status %!STATUS!", this, Request, status);
1798
1799 return status;
1800 }
1801
1802 if (Request->HasContextType(FX_RCT_USB_PIPE_REQUEST)) {
1803 pContext = (FxUsbPipeRequestContext*) Request->GetContext();
1804 }
1805 else {
1807 pContext = new(GetDriverGlobals()) FxUsbPipeRequestContext(urbType);
1808 if (pContext == NULL) {
1810 }
1811
1812#if (FX_CORE_MODE == FX_CORE_KERNEL_MODE)
1813 if (urbType == FxUrbTypeUsbdAllocated) {
1814 status = pContext->AllocateUrb(m_USBDHandle);
1815 if (!NT_SUCCESS(status)) {
1816 delete pContext;
1817 return status;
1818 }
1819 //
1820 // Since the AllocateUrb routine calls USBD_xxxUrbAllocate APIs to allocate an Urb, it is
1821 // important to release those resorces before the devnode is removed. Those
1822 // resoruces are removed at the time Request is disposed.
1823 //
1824 Request->EnableContextDisposeNotification();
1825 }
1826#endif
1827
1828 Request->SetContext(pContext);
1829 }
1830
1831#if (FX_CORE_MODE == FX_CORE_KERNEL_MODE)
1832 //
1833 // URB_FUNCTION_RESET_PIPE and URB_FUNCTION_SYNC_RESET_PIPE_AND_CLEAR_STALL
1834 // are the same value
1835 //
1839
1840 if (pContext->m_Urb == &pContext->m_UrbLegacy) {
1841 urbType = FxUrbTypeLegacy;
1842 }
1843 else {
1844 urbType = FxUrbTypeUsbdAllocated;
1845 }
1846
1847 FxFormatUsbRequest(Request, (PURB)pContext->m_Urb, urbType, m_USBDHandle);
1848#elif (FX_CORE_MODE == FX_CORE_USER_MODE)
1851 m_PipeInformationUm.PipeId,
1854#endif
1855
1856 return STATUS_SUCCESS;
1857}
#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 208 of file fxusbpipekm.cpp.

213{
214 FxUsbPipeTransferContext* pContext;
216 size_t bufferSize;
217 ULONG dummyLength;
218 FX_URB_TYPE urbType;
219
220 //
221 // Make sure request is for the right type
222 //
225
227 "WDFUSBPIPE %p not the right type, %!STATUS!",
228 GetHandle(), status);
229
230 return status;
231 }
232
233 bufferSize = Buffer->GetBufferLength();
234
235 status = RtlSizeTToULong(bufferSize, &dummyLength);
236 if (!NT_SUCCESS(status)) {
238 "WDFUSBPIPE %p, buffer size truncated, %!STATUS!",
239 GetHandle(), status);
240 return status;
241 }
242
243 //
244 // On reads, check to make sure the read in value is an integral number of
245 // packet sizes
246 //
247 if (TransferFlags & USBD_TRANSFER_DIRECTION_IN) {
248 if (IsInEndpoint() == FALSE) {
250 "Pipe %p, sending __in transaction on a __out endpoint",
251 this);
252
254 }
255
256 if (m_CheckPacketSize &&
259 }
260 }
261 else {
262 if (IsOutEndpoint() == FALSE) {
264 "Pipe %p, sending __out transaction on an __in endpoint",
265 this);
266
268 }
269 }
270
271 status = Request->ValidateTarget(this);
272 if (!NT_SUCCESS(status)) {
274 "Pipe %p, Request %p, setting target failed, "
275 "status %!STATUS!", this, Request, status);
276
277 return status;
278 }
279
280 if (Request->HasContextType(FX_RCT_USB_PIPE_XFER)) {
281 pContext = (FxUsbPipeTransferContext*) Request->GetContext();
282 }
283 else {
285
286 pContext = new(GetDriverGlobals()) FxUsbPipeTransferContext(urbType);
287 if (pContext == NULL) {
289 }
290
291 if (urbType == FxUrbTypeUsbdAllocated) {
292 status = pContext->AllocateUrb(m_USBDHandle);
293 if (!NT_SUCCESS(status)) {
294 delete pContext;
295 return status;
296 }
297 //
298 // Since the AllocateUrb routine calls USBD_xxxUrbAllocate APIs to allocate an Urb, it is
299 // important to release those resorces before the devnode is removed. Those
300 // resoruces are removed at the time Request is disposed.
301 //
302 Request->EnableContextDisposeNotification();
303 }
304
305 Request->SetContext(pContext);
306 }
307
308 //
309 // Always set the memory after determining the context. This way we can
310 // free a previously referenced memory object if necessary.
311 //
312 if (Buffer->HasMdl()) {
313 PMDL pMdl;
314
315 pMdl=NULL;
316 ASSERT(pContext->m_PartialMdl == NULL);
317
318 //
319 // If it is an __in endpoint, the buffer will be written to by the
320 // controller, so request IoWriteAccess locking.
321 //
322 status = Buffer->GetOrAllocateMdl(
324 &pMdl,
325 &pContext->m_PartialMdl,
326 &pContext->m_UnlockPages,
328
329 if (!NT_SUCCESS(status)) {
330 return status;
331 }
332
333 ASSERT(pMdl != NULL);
334 }
335
337
338 pContext->SetUrbInfo(m_PipeInformation.PipeHandle, TransferFlags);
339
340 if (pContext->m_Urb == &pContext->m_UrbLegacy) {
341 urbType = FxUrbTypeLegacy;
342 }
343 else {
344 urbType = FxUrbTypeUsbdAllocated;
345 }
346
347 FxFormatUsbRequest(Request, (PURB)pContext->m_Urb, urbType, m_USBDHandle);
348
349 return STATUS_SUCCESS;
350}
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:772
_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:17
__checkReturn NTSTATUS AllocateUrb(__in USBD_HANDLE USBDHandle)
Definition: fxusbpipe.cpp:827
VOID SetUrbInfo(__in USBD_PIPE_HANDLE PipeHandle, __in ULONG TransferFlags)
Definition: fxusbpipe.cpp:905
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:915
@ IoWriteAccess
Definition: ketypes.h:916

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

◆ GetHandle()

◆ GetInformation()

VOID FxUsbPipe::GetInformation ( __out PWDF_USB_PIPE_INFORMATION  PipeInformation)

Definition at line 353 of file fxusbpipekm.cpp.

356{
357 //
358 // Do a field by field copy for the WDF structure, since fields could change.
359 //
366}
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 369 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 1296 of file fxusbpipe.cpp.

1303{
1304 KIRQL irql;
1306
1309
1310 if (LockSelf) {
1311 Lock(&irql);
1312 }
1313
1314 if (m_Reader != NULL) {
1315 //
1316 // If we are a continuous reader, always wait for the sent io, so that we
1317 // can resubmit it later on a restart.
1318 //
1321 "WDFUSBPIPE %p converting purge action %!WDF_IO_TARGET_PURGE_IO_ACTION!"
1322 " to %!WDF_IO_TARGET_PURGE_IO_ACTION!", GetHandle(), Action,
1324
1326 }
1327
1328 FxIoTarget::GotoPurgeState(Action, // __super call
1329 PendedRequestListHead,
1330 SentRequestListHead,
1331 Wait,
1332 FALSE);
1333
1334 if (m_Reader != NULL) {
1335 //
1336 // The continuous reader requests are no longer enqueued. Remember that
1337 // state, so when we restart, we resend them.
1338 //
1340
1341 //
1342 // Log a message when misbehaved drivers call WdfIoTargetPurge
1343 // from EvtUsbTargetPipeReadersFailed callback.
1344 //
1348 "WDFUSBPIPE %p is purged from EvtUsbTargetPipeReadersFailed"
1349 " callback", GetHandle());
1350
1352 }
1353
1354 //
1355 // Make sure work item is done. It is possible for the upper class
1356 // to return wait = false if the list of sent requests is empty. We
1357 // still want to wait anyway for making sure work item is not about
1358 // to run or it is running.
1359 //
1360 *Wait = TRUE;
1361 }
1362
1363 if (LockSelf) {
1364 Unlock(irql);
1365 }
1366}
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 1369 of file fxusbpipe.cpp.

1376{
1377 KIRQL irql;
1378
1380
1381 if (LockSelf) {
1382 Lock(&irql);
1383 }
1384
1387 //
1388 // Driver forgot to stop the pipe on D0Exit.
1389 //
1392 "WDFUSBPIPE %p was not stopped in EvtDeviceD0Exit callback",
1393 GetHandle());
1394
1395 if (GetDriverGlobals()->IsVerificationEnabled(1,9,OkForDownLevel)) {
1397 }
1398 }
1399
1400 FxIoTarget::GotoRemoveState(NewState, // __super call
1401 PendedRequestListHead,
1402 SentRequestListHead,
1403 FALSE,
1404 Wait);
1405 if (m_Reader != NULL) {
1406 //
1407 // Make sure work item is done. It is possible for the upper class to
1408 // return wait = false if the list of sent requests is empty. We still
1409 // want to wait anyway for making sure work item is not about to run or
1410 // it is running.
1411 //
1412 *Wait = TRUE;
1413 }
1414
1415 if (LockSelf) {
1416 Unlock(irql);
1417 }
1418}
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 1135 of file fxusbpipe.cpp.

1139{
1141 LONG i;
1142
1143 if (m_Reader != NULL) {
1146
1147 for (i = 0; i < m_Reader->m_NumReaders; i++) {
1149
1151
1152 UNREFERENCED_PARAMETER(pRequest); //for fre build
1155 }
1156 }
1157 }
1158
1159 status = FxIoTarget::GotoStartState(RequestListHead, Lock);
1160
1161 if (m_Reader == NULL || !NT_SUCCESS(status)) {
1162 return status;
1163 }
1164
1165 //
1166 // Add the repeater requests to the list head so that they are sent by the
1167 // caller of this function when this function returns IFF they have not yet
1168 // been queued. (They can be queued on a start -> start transition.)
1169 //
1171 for (i = 0; i < m_Reader->m_NumReaders; i++) {
1172 //
1173 // This will clear ReadCompletedEvent as well
1174 //
1176
1177 if (!NT_SUCCESS(status)) {
1178 return status;
1179 }
1180 }
1181
1182 //
1183 // Reset the number of failed readers in case we had failure in a
1184 // previously started state.
1185 //
1187
1188 for (i = 0; i < m_Reader->m_NumReaders; i++) {
1190
1192 pRequest->SetTarget(this);
1193 pRequest->ADDREF(this);
1194
1195 //
1196 // NOTE: This is an elusive backdoor to send the Request down
1197 // since it is inserted directly into the IoTargets pended list.
1198 // The IoTarget is not started so we add the request to the
1199 // pended list so that it is processed when the IoTarget starts.
1200 //
1202 InsertTailList(RequestListHead, &pRequest->m_ListEntry);
1203
1204 //
1205 // Clear the event only when we know it will be submitted to the
1206 // target. It will be set when the request is submitted to the
1207 // target and the submit fails or if it is cancelled.
1208 //
1210 }
1211
1213 }
1214
1215 return status;
1216}
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:329
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:689
struct _SINGLE_LIST_ENTRY * Next
Definition: ntbasedef.h:641

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 1219 of file fxusbpipe.cpp.

1225{
1226 KIRQL irql;
1228
1231
1232 if (LockSelf) {
1233 Lock(&irql);
1234 }
1235
1236 if (m_Reader != NULL) {
1237 //
1238 // If we are a continuous reader, always cancel the sent io so that we
1239 // can resubmit it later on a restart.
1240 //
1243 "WDFUSBPIPE %p converting stop action %!WDF_IO_TARGET_SENT_IO_ACTION!"
1244 " to %!WDF_IO_TARGET_SENT_IO_ACTION!", GetHandle(), Action,
1246
1248 }
1249
1250 FxIoTarget::GotoStopState(Action, SentRequestListHead, Wait, FALSE); // __super call
1251
1252 if (m_Reader != NULL) {
1253 //
1254 // The continuous reader requests are no longer enqueued. Remember that
1255 // state, so when we restart, we resend them.
1256 //
1258
1259 //
1260 // Log a message when misbehaved drivers call WdfIoTargetStop
1261 // from EvtUsbTargetPipeReadersFailed callback.
1262 //
1266 "WDFUSBPIPE %p is stopped from EvtUsbTargetPipeReadersFailed"
1267 " callback", GetHandle());
1268
1271 }
1272 }
1273
1274 //
1275 // Do not deadlock when misbehaved drivers (< v1.9) call
1276 // WdfIoTargetStop from EvtUsbTargetPipeReadersFailed callback.
1277 //
1280 //
1281 // Make sure work item is done. It is possible for the upper class
1282 // to return wait = false if the list of sent requests is empty. We
1283 // still want to wait anyway for making sure work item is not about
1284 // to run or it is running.
1285 //
1286 *Wait = TRUE;
1287 }
1288 }
1289
1290 if (LockSelf) {
1291 Unlock(irql);
1292 }
1293}
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 1465 of file fxusbpipe.cpp.

1469{
1472 UCHAR numReaders;
1473
1474 pReader = NULL;
1475
1476 if (m_Reader != NULL) {
1478
1481 "Continuous reader already initialized on WDFUSBPIPE %p %!STATUS!",
1482 GetHandle(), status);
1483
1484 return status;
1485 }
1486
1487 numReaders = Config->NumPendingReads;
1488
1489 if (numReaders == 0) {
1490 numReaders = NUM_PENDING_READS_DEFAULT;
1491 }
1492 else if (numReaders > NUM_PENDING_READS_MAX) {
1493 numReaders = NUM_PENDING_READS_MAX;
1494 }
1495
1496 pReader = new(GetDriverGlobals(), numReaders)
1497 FxUsbPipeContinuousReader(this, numReaders);
1498
1499 if (pReader == NULL) {
1501 }
1502
1503 //
1504 // Allocate all of the structurs and objects required
1505 //
1506 status = pReader->Config(Config, TotalBufferLength);
1507
1508 if (!NT_SUCCESS(status)) {
1509 delete pReader;
1510 return status;
1511 }
1512
1513 pReader->m_ReadCompleteCallback = Config->EvtUsbTargetPipeReadComplete;
1514 pReader->m_ReadCompleteContext = Config->EvtUsbTargetPipeReadCompleteContext;
1515
1516 pReader->m_ReadersFailedCallback = Config->EvtUsbTargetPipeReadersFailed;
1517
1519 pReader,
1520 NULL) == NULL) {
1521 //
1522 // We set the field, do nothing.
1523 //
1524 DO_NOTHING();
1525 }
1526 else {
1527 //
1528 // Some other thread came in and set the field, free our allocation.
1529 //
1530 delete pReader;
1531 }
1532
1533 return STATUS_SUCCESS;
1534}
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:144
#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:92
#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 1075 of file fxusbpipe.cpp.

1080{
1083
1084 if (m_UsbInterface != NULL) {
1085 m_UsbInterface->RELEASE(this);
1087 }
1088
1090 m_UsbInterface->ADDREF(this);
1091}
#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 377 of file fxusbpipekm.cpp.

380{
382}
Type
Definition: Type.h:7

Referenced by FormatTransferRequest().

◆ Reset()

NTSTATUS FxUsbPipe::Reset ( VOID  )

Definition at line 1860 of file fxusbpipe.cpp.

1863{
1865
1866 FxSyncRequest request(GetDriverGlobals(), &context);
1868
1869 //
1870 // FxSyncRequest always succeesds for KM but can fail for UM.
1871 //
1872 status = request.Initialize();
1873 if (!NT_SUCCESS(status)) {
1875 "Failed to initialize FxSyncRequest");
1876 return status;
1877 }
1878
1879 status = FormatResetRequest(request.m_TrueRequest);
1880 if (NT_SUCCESS(status)) {
1881 if (m_Reader != NULL) {
1882 //
1883 // This assumes that no other I/O besides reader I/O is going on.
1884 //
1886 }
1887 else {
1888 CancelSentIo();
1889 }
1891 }
1892 return status;
1893}
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:1785

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 1421 of file fxusbpipe.cpp.

1424{
1425 if (m_Reader != NULL) {
1428 "WDFUSBPIPE %p, waiting for continuous reader work item to complete",
1429 GetHandle());
1430
1431 //
1432 // First, wait for the work item to complete if it is running.
1433 //
1434 // NOTE: We don't wait for the DPC to complete because
1435 // they are flushed in FxUsbDevice::Dispose
1436 //
1438
1441 "WDFUSBPIPE %p, cancelling for continuous reader (max of %d)",
1443
1444 //
1445 // Now that the work item is not running, make sure all the readers are
1446 // truly canceled and *NOT* in the pended queue. In between the call to
1447 // GotoStopState and here, the work item could have run and retried to
1448 // send the I/O.
1449 //
1451 }
1452
1455 "WDFUSBPIPE %p, waiting for all i/o to complete", GetHandle());
1456
1457 //
1458 // Finally, let the parent class wait for all I/O to complete
1459 //
1460 FxIoTarget::WaitForSentIoToComplete(); // __super call
1461}
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: