ReactOS 0.4.16-dev-1946-g52006dd
FxUsbDevice Class Reference

#include <fxusbdevice.hpp>

Inheritance diagram for FxUsbDevice:
Collaboration diagram for FxUsbDevice:

Public Member Functions

 FxUsbDevice (__in PFX_DRIVER_GLOBALS FxDriverGlobals)
 
_Must_inspect_result_ NTSTATUS InitDevice (__in ULONG USBDClientContractVersionForWdfClient)
 
_Must_inspect_result_ NTSTATUS GetConfigDescriptor (__out PVOID ConfigDescriptor, __inout PUSHORT ConfigDescriptorLength)
 
_Must_inspect_result_ NTSTATUS GetString (__in_ecount(*NumCharacters) PUSHORT String, __in PUSHORT NumCharacters, __in UCHAR StringIndex, __in_opt USHORT LangID, __in_opt WDFREQUEST Request=NULL, __in_opt PWDF_REQUEST_SEND_OPTIONS Options=NULL)
 
__inline VOID CopyDeviceDescriptor (__out PUSB_DEVICE_DESCRIPTOR UsbDeviceDescriptor)
 
VOID GetInformation (__out PWDF_USB_DEVICE_INFORMATION Information)
 
__inline USBD_CONFIGURATION_HANDLE GetConfigHandle (VOID)
 
_Must_inspect_result_ __inline NTSTATUS GetCurrentFrameNumber (__in PULONG Current)
 
_Must_inspect_result_ NTSTATUS SelectConfigAuto (__in PWDF_OBJECT_ATTRIBUTES PipeAttributes)
 
_Must_inspect_result_ NTSTATUS SelectConfigInterfaces (__in PWDF_OBJECT_ATTRIBUTES PipesAttributes, __in PUSB_CONFIGURATION_DESCRIPTOR ConfigurationDescriptor, __in_ecount(NumInterfaces) PUSB_INTERFACE_DESCRIPTOR *InterfaceDescriptors, __in ULONG NumInterfaces)
 
_Must_inspect_result_ NTSTATUS SelectConfig (__in PWDF_OBJECT_ATTRIBUTES PipesAttributes, __in PURB Urb, __in FX_URB_TYPE FxUrbType, __out_opt PUCHAR NumConfiguredInterfaces)
 
_Must_inspect_result_ NTSTATUS Deconfig (VOID)
 
_Must_inspect_result_ NTSTATUS SelectInterfaceByInterface (__in PWDF_OBJECT_ATTRIBUTES PipesAttributes, __in PUSB_INTERFACE_DESCRIPTOR InterfaceDescriptor)
 
_Must_inspect_result_ NTSTATUS SelectInterface (__in PWDF_OBJECT_ATTRIBUTES PipesAttributes, __in PURB Urb)
 
UCHAR GetNumInterfaces (VOID)
 
UCHAR GetInterfaceNumEndpoints (__in UCHAR InterfaceNumber)
 
WDFUSBPIPE GetInterfacePipeReferenced (__in UCHAR InterfaceNumber, __in UCHAR EndpointNumber)
 
_Must_inspect_result_ NTSTATUS FormatStringRequest (__in FxRequestBase *Request, __in FxRequestBuffer *RequestBuffer, __in UCHAR StringIndex, __in USHORT LangID)
 
_Must_inspect_result_ NTSTATUS FormatControlRequest (__in FxRequestBase *Request, __in PWDF_USB_CONTROL_SETUP_PACKET Packet, __in FxRequestBuffer *RequestBuffer)
 
_Must_inspect_result_ NTSTATUS IsConnected (VOID)
 
_Must_inspect_result_ NTSTATUS Reset (VOID)
 
_Must_inspect_result_ NTSTATUS CyclePort (VOID)
 
_Must_inspect_result_ NTSTATUS FormatCycleRequest (__in FxRequestBase *Request)
 
BOOLEAN OnUSBD (VOID)
 
USBD_PIPE_HANDLE GetControlPipeHandle (VOID)
 
_Must_inspect_result_ NTSTATUS CreateInterfaces (VOID)
 
_Must_inspect_result_ NTSTATUS SelectConfigSingle (__in PWDF_OBJECT_ATTRIBUTES PipeAttributes, __in PWDF_USB_DEVICE_SELECT_CONFIG_PARAMS Params)
 
_Must_inspect_result_ NTSTATUS SelectConfigMulti (__in PWDF_OBJECT_ATTRIBUTES PipeAttributes, __in PWDF_USB_DEVICE_SELECT_CONFIG_PARAMS Params)
 
_Must_inspect_result_ NTSTATUS SelectConfigDescriptor (__in PWDF_OBJECT_ATTRIBUTES PipeAttributes, __in PWDF_USB_DEVICE_SELECT_CONFIG_PARAMS Params)
 
FxUsbInterfaceGetInterfaceFromIndex (__in UCHAR InterfaceIndex)
 
BOOLEAN HasMismatchedInterfacesInConfigDescriptor (VOID)
 
VOID CancelSentIo (VOID)
 
BOOLEAN IsEnabled (VOID)
 
_Must_inspect_result_ NTSTATUS QueryUsbCapability (__in CONST GUID *CapabilityType, __in ULONG CapabilityBufferLength, __drv_when(CapabilityBufferLength==0, __out_opt) __drv_when(CapabilityBufferLength !=0 &&ResultLength==NULL, __out_bcount(CapabilityBufferLength)) __drv_when(CapabilityBufferLength !=0 &&ResultLength !=NULL, __out_bcount_part_opt(CapabilityBufferLength, *ResultLength)) PVOID CapabilityBuffer, __out_opt __drv_when(ResultLength !=NULL, __deref_out_range(<=, CapabilityBufferLength)) PULONG ResultLength)
 
__checkReturn NTSTATUS CreateUrb (__in_opt PWDF_OBJECT_ATTRIBUTES Attributes, __out WDFMEMORY *UrbMemory, __deref_opt_out_bcount(sizeof(URB)) PURB *Urb)
 
__checkReturn NTSTATUS CreateIsochUrb (__in_opt PWDF_OBJECT_ATTRIBUTES Attributes, __in ULONG NumberOfIsochPackets, __out WDFMEMORY *UrbMemory, __deref_opt_out_bcount(GET_ISOCH_URB_SIZE(NumberOfIsochPackets)) PURB *Urb)
 
USBD_HANDLE GetUSBDHandle (VOID)
 
FX_URB_TYPE GetUrbType (VOID)
 
FX_URB_TYPE GetFxUrbTypeForRequest (__in FxRequestBase *Request)
 
BOOLEAN IsObjectDisposedOnRemove (__in FxObject *Object)
 
- 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)
 

Public Attributes

friend FxUsbPipe
 
friend FxUsbInterface
 
- Public Attributes inherited from FxIoTarget
FxTransactionedEntry m_TransactionedEntry
 
BOOLEAN m_InStack
 
BOOLEAN m_AddedToDeviceList
 

Protected Member Functions

 ~FxUsbDevice (VOID)
 
VOID RemoveDeletedInterface (__in FxUsbInterface *Interface)
 
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)
 
VOID PipesGotoRemoveState (__in BOOLEAN ForceRemovePipes)
 
FxUsbInterfaceGetInterfaceFromNumber (__in UCHAR InterfaceNumber)
 
_Must_inspect_result_ NTSTATUS GetInterfaceNumberFromInterface (__in WDFUSBINTERFACE UsbInterface, __out PUCHAR InterfaceNumber)
 
VOID CleanupInterfacePipesAndDelete (__in FxUsbInterface *UsbInterface)
 
 _Acquires_lock_ (_Global_critical_region_) VOID AcquireInterfaceIterationLock(VOID)
 
 _Releases_lock_ (_Global_critical_region_) VOID ReleaseInterfaceIterationLock(VOID)
 
ULONG GetDefaultMaxTransferSize (VOID)
 
VOID FormatInterfaceSelectSettingUrb (__in PURB Urb, __in USHORT NumEndpoints, __in UCHAR InterfaceNumber, __in UCHAR SettingNumber)
 
virtual BOOLEAN Dispose (VOID)
 
_Must_inspect_result_ NTSTATUS GetPortStatus (__out PULONG PortStatus)
 
_Must_inspect_result_ NTSTATUS SendSyncRequest (__in FxSyncRequest *Request, __in ULONGLONG Time)
 
_Must_inspect_result_ NTSTATUS SendSyncUmUrb (__inout PUMURB Urb, __in ULONGLONG Time, __in_opt WDFREQUEST Request=NULL, __in_opt PWDF_REQUEST_SEND_OPTIONS Options=NULL)
 
- 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)
 

Static Protected Member Functions

static VOID _CleanupPipesRequests (__in PLIST_ENTRY PendHead, __in PSINGLE_LIST_ENTRY SentHead)
 
- 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)
 

Protected Attributes

USBD_HANDLE m_USBDHandle
 
USBD_PIPE_HANDLE m_ControlPipe
 
FxUsbInterface ** m_Interfaces
 
USBD_CONFIGURATION_HANDLE m_ConfigHandle
 
USB_DEVICE_DESCRIPTOR m_DeviceDescriptor
 
PUSB_CONFIGURATION_DESCRIPTOR m_ConfigDescriptor
 
USBD_VERSION_INFORMATION m_UsbdVersionInformation
 
PUSB_BUSIFFN_QUERY_BUS_TIME m_QueryBusTime
 
PVOID m_BusInterfaceContext
 
PINTERFACE_DEREFERENCE m_BusInterfaceDereference
 
FxWaitLockInternal m_InterfaceIterationLock
 
ULONG m_HcdPortCapabilities
 
ULONG m_Traits
 
BOOLEAN m_OnUSBD
 
UCHAR m_NumInterfaces
 
BOOLEAN m_MismatchedInterfacesInConfigDescriptor
 
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
 
}; 
 

Private Attributes

IWudfFile * m_pHostTargetFile
 
WINUSB_INTERFACE_HANDLE m_WinUsbHandle
 

Additional Inherited Members

- 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)
 
- Static Public Attributes inherited from FxIoTarget
static const PVOID m_SentRequestTag = (PVOID) 'lcnC'
 
- Static Protected Attributes inherited from FxIoTarget
static MdCompletionRoutineType _RequestCompletionRoutine
 
static EVT_WDF_REQUEST_COMPLETION_ROUTINE _SyncCompletionRoutine
 

Detailed Description

Definition at line 183 of file fxusbdevice.hpp.

Constructor & Destructor Documentation

◆ FxUsbDevice()

FxUsbDevice::FxUsbDevice ( __in PFX_DRIVER_GLOBALS  FxDriverGlobals)

Definition at line 375 of file fxusbdevice.cpp.

377 :
378 FxIoTarget(FxDriverGlobals, sizeof(FxUsbDevice), FX_TYPE_IO_TARGET_USB_DEVICE)
379{
382
383 m_OnUSBD = FALSE;
385 m_NumInterfaces = 0;
386
387 m_Traits = 0;
395
397
400
401#if (FX_CORE_MODE == FX_CORE_USER_MODE)
404#endif
405
407}
VOID MarkDisposeOverride(__in FxObjectLockState State=ObjectLock)
Definition: fxobject.hpp:1101
WINUSB_INTERFACE_HANDLE m_WinUsbHandle
USBD_PIPE_HANDLE m_ControlPipe
USB_DEVICE_DESCRIPTOR m_DeviceDescriptor
PINTERFACE_DEREFERENCE m_BusInterfaceDereference
PUSB_BUSIFFN_QUERY_BUS_TIME m_QueryBusTime
USBD_VERSION_INFORMATION m_UsbdVersionInformation
USBD_HANDLE m_USBDHandle
IWudfFile * m_pHostTargetFile
PUSB_CONFIGURATION_DESCRIPTOR m_ConfigDescriptor
FX_URB_TYPE m_UrbType
UCHAR m_NumInterfaces
ULONG m_HcdPortCapabilities
PVOID m_BusInterfaceContext
FxUsbInterface ** m_Interfaces
BOOLEAN m_OnUSBD
USBD_CONFIGURATION_HANDLE m_ConfigHandle
BOOLEAN m_MismatchedInterfacesInConfigDescriptor
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
@ ObjectDoNotLock
Definition: fxobject.hpp:128
@ FX_TYPE_IO_TARGET_USB_DEVICE
Definition: fxtypes.h:102
@ FxUrbTypeLegacy
Definition: fxusbdevice.hpp:27
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262

◆ ~FxUsbDevice()

FxUsbDevice::~FxUsbDevice ( VOID  )
protected

Definition at line 439 of file fxusbdevice.cpp.

440{
441 UCHAR i;
442
446 }
447
448 if (m_ConfigDescriptor != NULL) {
451 }
452
453 for (i = 0; i < m_NumInterfaces; i++) {
455 }
456
457 if (m_Interfaces != NULL){
460 }
461
462 m_NumInterfaces = 0;
463}
void FxPoolFree(__in_xcount(ptr is at an offset from AllocationStart) PVOID ptr)
Definition: wdfpool.cpp:361
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 ASSERT(a)
Definition: mode.c:44
unsigned char UCHAR
Definition: xmlstorage.h:181

Member Function Documentation

◆ _Acquires_lock_()

FxUsbDevice::_Acquires_lock_ ( _Global_critical_region_  )
inlineprotected

Definition at line 557 of file fxusbdevice.hpp.

562 {
564 }
__inline PFX_DRIVER_GLOBALS GetDriverGlobals(VOID)
Definition: fxobject.hpp:734
FxWaitLockInternal m_InterfaceIterationLock

◆ _CleanupPipesRequests()

VOID FxUsbDevice::_CleanupPipesRequests ( __in PLIST_ENTRY  PendHead,
__in PSINGLE_LIST_ENTRY  SentHead 
)
staticprotected

Definition at line 796 of file fxusbdevice.cpp.

800{
801 while (!IsListEmpty(PendHead)) {
804
805 ple = RemoveHeadList(PendHead);
806
808
811 }
812
813 _CancelSentRequests(SentHead);
814}
VOID CompletePendedRequest(__in FxRequestBase *Request)
Definition: fxiotarget.cpp:508
static VOID _CancelSentRequests(__in PSINGLE_LIST_ENTRY RequestListHead)
Definition: fxiotarget.cpp:550
static __inline FxRequestBase * _FromListEntry(__in PLIST_ENTRY Entry)
__inline FxIoTarget * GetTarget(VOID)
#define IsListEmpty(ListHead)
Definition: env_spec_w32.h:954
#define RemoveHeadList(ListHead)
Definition: env_spec_w32.h:964
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
PSINGLE_LIST_ENTRY ple
FxRequest * pRequest
Definition: typedefs.h:120

Referenced by CleanupInterfacePipesAndDelete(), and PipesGotoRemoveState().

◆ _Releases_lock_()

FxUsbDevice::_Releases_lock_ ( _Global_critical_region_  )
inlineprotected

Definition at line 566 of file fxusbdevice.hpp.

571 {
573 }

◆ CancelSentIo()

VOID FxUsbDevice::CancelSentIo ( VOID  )

Definition at line 2100 of file fxusbdevice.cpp.

2103{
2105 ULONG iInterface, iPipe;
2106
2107 for (iInterface = 0; iInterface < m_NumInterfaces; iInterface++) {
2108 pUsbInterface = m_Interfaces[iInterface];
2109
2111 for (iPipe = 0;
2113 iPipe++) {
2114
2115 if (pUsbInterface->m_ConfiguredPipes[iPipe] != NULL) {
2117 }
2118
2119 }
2120 }
2121 }
2122 FxIoTarget::CancelSentIo(); // __super call
2123}
VOID CancelSentIo(VOID)
FxUsbPipe ** m_ConfiguredPipes
UCHAR m_NumberOfConfiguredPipes
FxUsbInterface * pUsbInterface
uint32_t ULONG
Definition: typedefs.h:59

Referenced by CyclePort(), and Reset().

◆ CleanupInterfacePipesAndDelete()

VOID FxUsbDevice::CleanupInterfacePipesAndDelete ( __in FxUsbInterface UsbInterface)
protected

Definition at line 2057 of file fxusbdevice.cpp.

2060{
2061 SINGLE_LIST_ENTRY sentHead;
2062 LIST_ENTRY pendHead;
2063 ULONG iPipe;
2064 FxUsbPipe *pPipe;
2065 KIRQL irql;
2066
2067 sentHead.Next = NULL;
2068 InitializeListHead(&pendHead);
2069
2070 AcquireInterfaceIterationLock();
2071
2072 Lock(&irql);
2073 for (iPipe = 0; iPipe < UsbInterface->m_NumberOfConfiguredPipes; iPipe++) {
2074 BOOLEAN wait;
2075
2076 wait = FALSE;
2077 pPipe = UsbInterface->m_ConfiguredPipes[iPipe];
2078 pPipe->GotoRemoveState(
2080 &pendHead,
2081 &sentHead,
2082 TRUE,
2083 &wait);
2084 }
2085 Unlock(irql);
2086
2087 _CleanupPipesRequests(&pendHead, &sentHead);
2088
2089 for (iPipe = 0; iPipe < UsbInterface->m_NumberOfConfiguredPipes; iPipe++) {
2090 pPipe = UsbInterface->m_ConfiguredPipes[iPipe];
2091 pPipe->WaitForSentIoToComplete();
2092 }
2093
2094 UsbInterface->CleanUpAndDelete(FALSE);
2095
2096 ReleaseInterfaceIterationLock();
2097}
unsigned char BOOLEAN
__drv_restoresIRQL KIRQL __in BOOLEAN Unlock
Definition: fxobject.hpp:1474
static VOID _CleanupPipesRequests(__in PLIST_ENTRY PendHead, __in PSINGLE_LIST_ENTRY SentHead)
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: fxusbpipe.cpp:1369
virtual VOID WaitForSentIoToComplete(VOID)
Definition: fxusbpipe.cpp:1421
#define TRUE
Definition: types.h:120
KIRQL irql
Definition: wave.h:1
UCHAR KIRQL
Definition: env_spec_w32.h:591
Definition: ntbasedef.h:640
struct _SINGLE_LIST_ENTRY * Next
Definition: ntbasedef.h:641
@ WdfIoTargetDeleted
Definition: wdfiotarget.h:57
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFWAITLOCK * Lock
Definition: wdfsync.h:127
_In_ WDFUSBINTERFACE UsbInterface
Definition: wdfusb.h:2276

Referenced by FxUsbInterface::MakeAndConfigurePipes(), SelectConfig(), and FxUsbInterface::SelectSetting().

◆ CopyDeviceDescriptor()

__inline VOID FxUsbDevice::CopyDeviceDescriptor ( __out PUSB_DEVICE_DESCRIPTOR  UsbDeviceDescriptor)
inline

Definition at line 218 of file fxusbdevice.hpp.

221 {
224 sizeof(m_DeviceDescriptor));
225 }
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
_In_ WDFUSBDEVICE _Out_ PUSB_DEVICE_DESCRIPTOR UsbDeviceDescriptor
Definition: wdfusb.h:1008

◆ CreateInterfaces()

_Must_inspect_result_ NTSTATUS FxUsbDevice::CreateInterfaces ( VOID  )

Definition at line 902 of file fxusbdevice.cpp.

905{
907 UCHAR descCountBitMap[UCHAR_MAX / sizeof(UCHAR)];
908 PUSB_INTERFACE_DESCRIPTOR pInterfaceDescriptor;
909 UCHAR iInterface, numFound;
911 ULONG size;
912 ULONG totalLength;
913
916 totalLength = m_ConfigDescriptor->wTotalLength;
917
918 //
919 // Make sure each PCOMMON_DESCRIPTOR_HEADER within the entire config descriptor is well formed.
920 // If successful, we can walk the config descriptor using common headers without any more top
921 // level error checking. Task specific checking of the specialized header types must still occur.
922 //
927 );
928
929 if (!NT_SUCCESS(status)) {
932 "Validation of the config descriptor failed due to a bad common descriptor header, %!STATUS!",
933 status);
934 return status;
935 }
936
937 //
938 // Validate all interface descriptors in config descriptor are at least
939 // sizeof(USB_INTERFACE_DESCRIPTOR).
940 //
941
942
943
944
945
954 0
955 );
956
957 if (!NT_SUCCESS(status)) {
960 "Validation of interface descriptors in config descriptor failed, %!STATUS!",
961 status);
962
963 return status;
964 }
965
967 //
968 // Use an array of one in the zero case
969 //
970 size = sizeof(FxUsbInterface*);
971 }
972 else {
974 }
975
976 //
977 // Allocate an array large enough to hold pointers to interfaces
978 //
980 FxPoolAllocate(pFxDriverGlobals, NonPagedPool, size);
981
982 if (m_Interfaces == NULL) {
984
987 "Could not allocate memory for %d interfaces, %!STATUS!",
989
990 goto Done;
991 }
992
995
996 //
997 // Iterate over the desciptors again, this time allocating an FxUsbInterface
998 // for each one and capturing the interface information.
999 //
1000 RtlZeroMemory(descCountBitMap, sizeof(descCountBitMap));
1001 iInterface = 0;
1002 numFound = 0;
1003 UNREFERENCED_PARAMETER(numFound);
1004
1005 pInterfaceDescriptor = (PUSB_INTERFACE_DESCRIPTOR) FxUsbFindDescriptorType(
1010 );
1011
1012 while (pInterfaceDescriptor != NULL &&
1013 iInterface < m_ConfigDescriptor->bNumInterfaces) {
1014
1015 //
1016 // This function will retun false if the bit wasn't already set
1017 //
1018 if (FxBitArraySet(descCountBitMap,
1019 pInterfaceDescriptor->bInterfaceNumber) == FALSE) {
1021
1024 this,
1025 pInterfaceDescriptor);
1026
1027 if (pInterface == NULL) {
1031 "Could not allocate memory for interface object #%d, %!STATUS!",
1032 iInterface, status);
1033 goto Done;
1034 }
1035
1037
1038 //
1039 // This should never fail
1040 //
1042
1043 if (!NT_SUCCESS(status)) {
1044 goto Done;
1045 }
1046
1047 status = pInterface->CreateSettings();
1048 if (!NT_SUCCESS(status)) {
1049 goto Done;
1050 }
1051
1052#if (FX_CORE_MODE == FX_CORE_USER_MODE)
1053 status = pInterface->SetWinUsbHandle(iInterface);
1054 if (!NT_SUCCESS(status)) {
1055 goto Done;
1056 }
1057
1058 status = pInterface->MakeAndConfigurePipes(WDF_NO_OBJECT_ATTRIBUTES,
1059 pInterfaceDescriptor->bNumEndpoints);
1060 if (!NT_SUCCESS(status)) {
1061 goto Done;
1062 }
1063#endif
1064
1065 m_Interfaces[iInterface] = pInterface;
1066
1067 iInterface++;
1068 }
1069
1070 pInterfaceDescriptor = (PUSB_INTERFACE_DESCRIPTOR) FxUsbFindDescriptorType(
1072 totalLength,
1073 WDF_PTR_ADD_OFFSET(pInterfaceDescriptor,
1074 pInterfaceDescriptor->bLength),
1076 );
1077 }
1078
1079 //
1080 // We cannot check for the error case of
1081 //
1082 // pInterfaceDescriptor != NULL &&
1083 // iInterface == m_ConfigDescriptor->bNumInterfaces
1084 //
1085 // Because if there are multiple alternative settings for the last interface
1086 // in the config descriptor, we will have hit the limit of interfaces
1087 // (correctly), but have found another pInterfaceDescriptor (the next alt
1088 // setting).
1089 //
1090
1091 //
1092 // We already logged and found the case where iInterface >= m_NumInterfaces.
1093 // Check for the case where we found too few interfaces and when we found
1094 // no interfaces even though the config descriptor says otherwise.
1095 //
1096 //
1097 if (iInterface == 0 && m_NumInterfaces > 0) {
1099
1102 "Config descriptor indicated there were %d interfaces, but did not "
1103 "find any interface descriptors in config descriptor %p, %!STATUS!",
1105 }
1106 else if (pInterfaceDescriptor != NULL && m_NumInterfaces == 0) {
1109 "Config descriptor indicated there were 0 interfaces, but an interface "
1110 "descriptor was found");
1111
1113 }
1114 else if (iInterface < m_NumInterfaces) {
1117 "Config descriptor indicated there were %d interfaces, only found "
1118 "%d interfaces", m_NumInterfaces, iInterface);
1119
1120 //
1121 // Instead of considering this an error, just use the number found.
1122 // This will not have an adverse affect elsewhere and since the framework
1123 // is probably more strict then previous USB code, this would have not
1124 // been found earlier by a WDM driver.
1125 //
1126 m_NumInterfaces = iInterface;
1127 }
1128
1129Done:
1130 return status;
1131}
LONG NTSTATUS
Definition: precomp.h:26
friend FxUsbInterface
#define TRACINGIOTARGET
Definition: dbgtrace.h:72
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
#define NonPagedPool
Definition: env_spec_w32.h:307
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
PFX_DRIVER_GLOBALS pFxDriverGlobals
PINTERFACE pInterface
GLsizeiptr size
Definition: glext.h:5919
#define UCHAR_MAX
Definition: limits.h:25
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:329
#define STATUS_SUCCESS
Definition: shellext.h:65
#define TRACE_LEVEL_WARNING
Definition: storswtr.h:28
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
Definition: ps.c:97
#define STATUS_INVALID_DEVICE_REQUEST
Definition: udferr_usr.h:138
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
struct _USB_INTERFACE_DESCRIPTOR * PUSB_INTERFACE_DESCRIPTOR
#define USB_INTERFACE_DESCRIPTOR_TYPE
Definition: usb100.h:52
PUSB_COMMON_DESCRIPTOR FxUsbFindDescriptorType(__in PVOID Buffer, __in size_t BufferLength, __in PVOID Start, __in LONG DescriptorType)
Definition: usbutil.cpp:176
NTSTATUS FxUsbValidateDescriptorType(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in PUSB_CONFIGURATION_DESCRIPTOR ConfigDescriptor, __in PVOID Start, __in PVOID End, __in LONG DescriptorType, __in size_t SizeToValidate, __in FxUsbValidateDescriptorOp Op, __in ULONG MaximumNumDescriptorsToValidate)
Definition: usbutil.cpp:209
NTSTATUS FxUsbValidateConfigDescriptorHeaders(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in PUSB_CONFIGURATION_DESCRIPTOR ConfigDescriptor, __in size_t ConfigDescriptorLength)
Definition: usbutil.cpp:113
@ FxUsbValidateDescriptorOpAtLeast
Definition: usbutil.hpp:128
BOOLEAN __inline FxBitArraySet(__inout_xcount((BitNumber/sizeof(UCHAR))+1) PUCHAR BitArray, __in UCHAR BitNumber)
Definition: usbutil.hpp:9
#define WDF_PTR_ADD_OFFSET(_ptr, _offset)
Definition: wdfcore.h:144
#define WDF_NO_OBJECT_ATTRIBUTES
Definition: wdftypes.h:105

◆ CreateIsochUrb()

__checkReturn NTSTATUS FxUsbDevice::CreateIsochUrb ( __in_opt PWDF_OBJECT_ATTRIBUTES  Attributes,
__in ULONG  NumberOfIsochPackets,
__out WDFMEMORY *  UrbMemory,
__deref_opt_out_bcount(GET_ISOCH_URB_SIZE(NumberOfIsochPackets)) PURB Urb 
)

Definition at line 2242 of file fxusbdevice.cpp.

2252{
2254 PURB urbLocal = NULL;
2256 FxUsbUrb * pUrb = NULL;
2257 WDFMEMORY hMemory;
2258 ULONG size;
2260
2261 //
2262 // Get the parent's globals if it is present, else use the ones for FxUsbDevice
2263 //
2266
2267 if (NT_SUCCESS(status)) {
2268
2270 Attributes->ParentObject,
2272 (PVOID*)&pParent,
2274
2278 "Urb must be parented to FxDevice or IoAllocated Request");
2280 goto Done;
2281 }
2282
2283 }
2285
2287 pParent = this;
2289
2290 }
2291 else {
2292
2293 goto Done;
2294 }
2295
2297 if (!NT_SUCCESS(status)) {
2298 goto Done;
2299 }
2300
2302
2303 *UrbMemory = NULL;
2304
2306
2307 if (!NT_SUCCESS(status)) {
2308
2309 urbLocal = NULL;
2312 "USBDEVICE Must have been created with Client Contract Version Info, %!STATUS!",
2313 status);
2314
2315 goto Done;
2316
2317 }
2318
2320
2321 pUrb = new(pFxDriverGlobals, Attributes)
2323
2324 if (pUrb == NULL) {
2326 goto Done;
2327 }
2328
2329 urbLocal = NULL;
2330
2332
2333 if (!NT_SUCCESS(status)) {
2334 goto Done;
2335 }
2336
2337 *UrbMemory = hMemory;
2338
2339 if (Urb) {
2340 *Urb = (PURB) pUrb->GetBuffer();
2341 }
2342
2343Done:
2344
2345 if (!NT_SUCCESS(status)) {
2346
2347 if (pUrb) {
2348 pUrb->DeleteFromFailedCreate();
2349 }
2350
2351 if (urbLocal) {
2352 USBD_UrbFree(m_USBDHandle, urbLocal);
2353 }
2354
2355 }
2356
2357 return status;
2358}
VOID DeleteFromFailedCreate(VOID)
Definition: fxobject.cpp:391
_Must_inspect_result_ NTSTATUS Commit(__in_opt PWDF_OBJECT_ATTRIBUTES Attributes, __out_opt WDFOBJECT *ObjectHandle, __in_opt FxObject *Parent=NULL, __in BOOLEAN AssignDriverAsDefaultParent=TRUE)
Definition: fxobject.cpp:904
BOOLEAN IsObjectDisposedOnRemove(__in FxObject *Object)
FxObjectHandleGetPtrAndGlobals(GetFxDriverGlobals(DriverGlobals), Device, FX_TYPE_DEVICE,(PVOID *)&pDevice, &pFxDriverGlobals)
FxObject * pParent
Definition: fxdpcapi.cpp:86
WDFMEMORY hMemory
#define FxPointerNotNull(FxDriverGlobals, Ptr)
Definition: fxmacros.hpp:253
@ FX_TYPE_OBJECT
Definition: fxtypes.h:45
_Must_inspect_result_ NTSTATUS __inline FxValidateObjectAttributesForParentHandle(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in PWDF_OBJECT_ATTRIBUTES Attributes, __in ULONG Flags=FX_VALIDATE_OPTION_NONE_SPECIFIED)
_Must_inspect_result_ NTSTATUS FxValidateObjectAttributes(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in PWDF_OBJECT_ATTRIBUTES Attributes, __in ULONG Flags=FX_VALIDATE_OPTION_NONE_SPECIFIED)
Definition: usb.h:529
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
struct _URB * PURB
NTSTATUS USBD_IsochUrbAllocate(_In_ USBD_HANDLE USBDHandle, _In_ ULONG NumberOfIsochPacket, _Outptr_result_bytebuffer_(sizeof(struct _URB_ISOCH_TRANSFER)+(NumberOfIsochPackets *sizeof(USBD_ISO_PACKET_DESCRIPTOR)) - sizeof(USBD_ISO_PACKET_DESCRIPTOR)) PURB *Urb)
Definition: usbdex.c:69
VOID USBD_UrbFree(_In_ USBD_HANDLE USBDHandle, _In_ PURB Urb)
Definition: usbdex.c:83
_In_ PIO_STACK_LOCATION _In_ PURB Urb
Definition: usbdlib.h:267
#define GET_ISO_URB_SIZE(n)
Definition: usbdlib.h:125
_Must_inspect_result_ _In_ WDFDMAENABLER _In_ _In_opt_ PWDF_OBJECT_ATTRIBUTES Attributes
#define STATUS_WDF_PARENT_NOT_SPECIFIED
Definition: wdfstatus.h:252
_Must_inspect_result_ _In_ WDFUSBDEVICE _In_ WDFREQUEST _In_ WDFMEMORY UrbMemory
Definition: wdfusb.h:1576
_Must_inspect_result_ _In_ WDFUSBDEVICE _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ ULONG NumberOfIsochPackets
Definition: wdfusb.h:1703

◆ CreateUrb()

__checkReturn NTSTATUS FxUsbDevice::CreateUrb ( __in_opt PWDF_OBJECT_ATTRIBUTES  Attributes,
__out WDFMEMORY *  UrbMemory,
__deref_opt_out_bcount(sizeof(URB)) PURB Urb 
)

Definition at line 2127 of file fxusbdevice.cpp.

2135{
2137 PURB urbLocal = NULL;
2139 FxUsbUrb * pUrb = NULL;
2140 WDFMEMORY hMemory;
2142
2143 //
2144 // Get the parent's globals if it is present, else use the ones for FxUsbDevice
2145 //
2148
2149 if (NT_SUCCESS(status)) {
2150
2152 Attributes->ParentObject,
2154 (PVOID*)&pParent,
2156
2160 "Urb must be parented to FxDevice or an IoAllocated Request");
2162 goto Done;
2163 }
2164
2165 }
2167
2169 pParent = this;
2171
2172 }
2173 else {
2174
2175 goto Done;
2176 }
2177
2179 if (!NT_SUCCESS(status)) {
2180 goto Done;
2181 }
2182
2184
2185 *UrbMemory = NULL;
2186
2187 status = USBD_UrbAllocate(m_USBDHandle, &urbLocal);
2188
2189 if (!NT_SUCCESS(status)) {
2190
2191 urbLocal = NULL;
2194 "USBDEVICE Must have been created with Client Contract Version Info, %!STATUS!",
2195 status);
2196
2197 goto Done;
2198
2199 }
2200
2201 pUrb = new(pFxDriverGlobals, Attributes)
2202 FxUsbUrb(pFxDriverGlobals, m_USBDHandle, urbLocal, sizeof(URB));
2203
2204 if (pUrb == NULL) {
2206 goto Done;
2207 }
2208
2209 urbLocal = NULL;
2210
2212
2213 if (!NT_SUCCESS(status)) {
2214 goto Done;
2215 }
2216
2217 *UrbMemory = hMemory;
2218
2219 if (Urb) {
2220 *Urb = (PURB) pUrb->GetBuffer();
2221 }
2222
2223Done:
2224
2225 if (!NT_SUCCESS(status)) {
2226
2227 if (pUrb) {
2228 pUrb->DeleteFromFailedCreate();
2229 }
2230
2231 if (urbLocal) {
2232 USBD_UrbFree(m_USBDHandle, urbLocal);
2233 }
2234
2235 }
2236
2237 return status;
2238}
NTSTATUS USBD_UrbAllocate(_In_ USBD_HANDLE USBDHandle, _Outptr_result_bytebuffer_(sizeof(URB)) PURB *Urb)
Definition: usbdex.c:59

Referenced by __deref_opt_out_bcount().

◆ CyclePort()

_Must_inspect_result_ NTSTATUS FxUsbDevice::CyclePort ( VOID  )

Definition at line 1232 of file fxusbdevice.cpp.

1235{
1237 FxSyncRequest request(GetDriverGlobals(), &context);
1239
1240 //
1241 // FxSyncRequest always succeesds for KM.
1242 //
1243 status = request.Initialize();
1244 if (!NT_SUCCESS(status)) {
1246 "Failed to initialize FxSyncRequest");
1247 return status;
1248 }
1249
1250 status = FormatCycleRequest(request.m_TrueRequest);
1251
1252 if (NT_SUCCESS(status)) {
1253 CancelSentIo();
1255 //
1256 // NOTE: CyclePort causes the device to be removed and re-enumerated so
1257 // don't do anymore operations after this point.
1258 //
1259 }
1260
1261 return status;
1262}
_Must_inspect_result_ NTSTATUS SubmitSyncRequestIgnoreTargetState(__in FxRequestBase *Request, __in_opt PWDF_REQUEST_SEND_OPTIONS RequestOptions)
_Must_inspect_result_ NTSTATUS FormatCycleRequest(__in FxRequestBase *Request)
VOID CancelSentIo(VOID)
Definition: http.c:7252
Definition: tftpd.h:86

◆ Deconfig()

_Must_inspect_result_ NTSTATUS FxUsbDevice::Deconfig ( VOID  )

Definition at line 1882 of file fxusbdevice.cpp.

1885{
1888
1889 FxSyncRequest request(GetDriverGlobals(), NULL);
1891
1892 //
1893 // FxSyncRequest always succeesds for KM but can fail for UM.
1894 //
1895 status = request.Initialize();
1896 if (!NT_SUCCESS(status)) {
1898 "Failed to initialize FxSyncRequest");
1899 return status;
1900 }
1901
1902 status = request.m_TrueRequest->ValidateTarget(this);
1903 if (!NT_SUCCESS(status)) {
1904 return status;
1905 }
1906
1907 //
1908 // This will remove and free all interfaces and associated pipes
1909 //
1911
1912 RtlZeroMemory(&urb, sizeof(urb));
1913
1914#pragma prefast(suppress: __WARNING_BUFFER_OVERFLOW, "this annotation change in usb.h is communicated to usb team");
1915 UsbBuildSelectConfigurationRequest((PURB) &urb, sizeof(urb), NULL);
1916#pragma prefast(suppress: __WARNING_BUFFER_OVERFLOW, "this annotation change in usb.h is communicated to usb team");
1917 FxFormatUsbRequest(request.m_TrueRequest, (PURB) &urb, FxUrbTypeLegacy, NULL);
1918
1921
1922 status = SubmitSync(request.m_TrueRequest, &options);
1923
1924 return status;
1925}
_Must_inspect_result_ NTSTATUS SubmitSync(__in FxRequestBase *Request, __in_opt PWDF_REQUEST_SEND_OPTIONS Options=NULL, __out_opt PULONG Action=NULL)
VOID PipesGotoRemoveState(__in BOOLEAN ForceRemovePipes)
#define UsbBuildSelectConfigurationRequest(urb, length, configurationDescriptor)
Definition: usbdlib.h:53
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
FORCEINLINE VOID WDF_REQUEST_SEND_OPTIONS_INIT(_Out_ PWDF_REQUEST_SEND_OPTIONS Options, _In_ ULONG Flags)
Definition: wdfrequest.h:409
@ WDF_REQUEST_SEND_OPTION_IGNORE_TARGET_STATE
Definition: wdfrequest.h:110

◆ Dispose()

BOOLEAN FxUsbDevice::Dispose ( VOID  )
protectedvirtual

Reimplemented from FxIoTarget.

Definition at line 410 of file fxusbdevice.cpp.

413{
414#if ((FX_CORE_MODE)==(FX_CORE_KERNEL_MODE))
415 KeFlushQueuedDpcs();
416#endif
417
418 if (m_USBDHandle) {
421 }
422
423#if (FX_CORE_MODE == FX_CORE_USER_MODE)
424 IWudfDevice* device = NULL;
425 IWudfDeviceStack* devstack = NULL;
426
428 devstack = device->GetDeviceStackInterface();
429
430 if (m_pHostTargetFile) {
431 devstack->CloseFile(m_pHostTargetFile);
433 }
434#endif
435
436 return FxIoTarget::Dispose(); // __super call
437}
MdDeviceObject __inline GetDeviceObject(VOID)
Definition: fxdevice.hpp:174
virtual BOOLEAN Dispose(VOID)
Definition: fxiotarget.cpp:154
CfxDeviceBase * m_DeviceBase
Definition: fxobject.hpp:328
Definition: devices.h:37
VOID USBD_CloseHandle(_In_ USBD_HANDLE USBDHandle)
Definition: usbdex.c:51
#define SAFE_RELEASE(p)

◆ FormatControlRequest()

_Must_inspect_result_ NTSTATUS FxUsbDevice::FormatControlRequest ( __in FxRequestBase Request,
__in PWDF_USB_CONTROL_SETUP_PACKET  Packet,
__in FxRequestBuffer RequestBuffer 
)

Definition at line 591 of file fxusbdevicekm.cpp.

596{
599 size_t bufferSize;
600 FX_URB_TYPE urbType;
601
602 bufferSize = RequestBuffer->GetBufferLength();
603
604 //
605 // We can only transfer 2 bytes worth of data, so if the buffer is larger,
606 // fail here.
607 //
608 if (bufferSize > 0xFFFF) {
611 "Control transfer buffer is limited to 0xFFFF bytes in size, "
612 "%I64d requested ", bufferSize);
613
615 }
616
617 status = Request->ValidateTarget(this);
618 if (!NT_SUCCESS(status)) {
620 "WDFUSBDEVICE %p, Request %p, setting target failed, "
621 "%!STATUS!", GetHandle(), Request, status);
622
623 return status;
624 }
625
626 if (Request->HasContextType(FX_RCT_USB_CONTROL_REQUEST)) {
627 pContext = (FxUsbDeviceControlContext*) Request->GetContext();
628 }
629 else {
630
632 pContext = new(GetDriverGlobals()) FxUsbDeviceControlContext(urbType);
633 if (pContext == NULL) {
635 }
636
637 if (urbType == FxUrbTypeUsbdAllocated) {
638 status = pContext->AllocateUrb(m_USBDHandle);
639 if (!NT_SUCCESS(status)) {
641 "FxUsbDeviceControlContext::AllocateUrb Failed, %!STATUS!", status);
642
643 delete pContext;
644 return status;
645 }
646 //
647 // Since the AllocateUrb routine calls USBD_xxxUrbAllocate APIs to allocate an Urb, it is
648 // important to release those resorces before the devnode is removed. Those
649 // resoruces are removed at the time Request is disposed.
650 //
651 Request->EnableContextDisposeNotification();
652 }
653
654 Request->SetContext(pContext);
655 }
656
657 if (RequestBuffer->HasMdl()) {
658 PMDL pMdl;
659
660 pMdl = NULL;
661 ASSERT(pContext->m_PartialMdl == NULL);
662
663 status = RequestBuffer->GetOrAllocateMdl(GetDriverGlobals(),
664 &pMdl,
665 &pContext->m_PartialMdl,
666 &pContext->m_UnlockPages,
668
669 if (!NT_SUCCESS(status)) {
670 return status;
671 }
672
673 ASSERT(pMdl != NULL);
674 }
675
676 pContext->StoreAndReferenceMemory(this, RequestBuffer, SetupPacket);
677
678 if (pContext->m_Urb == &pContext->m_UrbLegacy) {
679 urbType = FxUrbTypeLegacy;
680 }
681 else {
682 urbType = FxUrbTypeUsbdAllocated;
683 }
684
685 FxFormatUsbRequest(Request, (PURB)pContext->m_Urb, urbType, m_USBDHandle);
686
687 return STATUS_SUCCESS;
688}
FX_URB_TYPE GetFxUrbTypeForRequest(__in FxRequestBase *Request)
@ FX_RCT_USB_CONTROL_REQUEST
@ FxUrbTypeUsbdAllocated
Definition: fxusbdevice.hpp:28
enum _FX_URB_TYPE FX_URB_TYPE
size_t bufferSize
_URB_CONTROL_TRANSFER * m_Urb
Definition: fxusbdevice.hpp:86
_URB_CONTROL_TRANSFER m_UrbLegacy
Definition: fxusbdevice.hpp:81
__checkReturn NTSTATUS AllocateUrb(__in USBD_HANDLE USBDHandle)
Definition: fxusbdevice.cpp:70
VOID StoreAndReferenceMemory(__in FxUsbDevice *Device, __in FxRequestBuffer *Buffer, __in PWDF_USB_CONTROL_SETUP_PACKET SetupPacket)
#define GetHandle(h)
Definition: treelist.c:116
_In_ WDFREQUEST Request
Definition: wdfdevice.h:547
_Must_inspect_result_ _In_ WDFUSBDEVICE _In_opt_ WDFREQUEST _In_opt_ PWDF_REQUEST_SEND_OPTIONS _In_ PWDF_USB_CONTROL_SETUP_PACKET SetupPacket
Definition: wdfusb.h:1337
@ IoModifyAccess
Definition: ketypes.h:917

◆ FormatCycleRequest()

_Must_inspect_result_ NTSTATUS FxUsbDevice::FormatCycleRequest ( __in FxRequestBase Request)

Definition at line 1266 of file fxusbdevice.cpp.

1269{
1270 FxRequestBuffer emptyBuffer;
1271
1274 TRUE,
1275 &emptyBuffer,
1276 &emptyBuffer);
1277}
_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)
#define IOCTL_INTERNAL_USB_CYCLE_PORT
Definition: usbioctl.h:53

Referenced by CyclePort().

◆ FormatInterfaceSelectSettingUrb()

VOID FxUsbDevice::FormatInterfaceSelectSettingUrb ( __in PURB  Urb,
__in USHORT  NumEndpoints,
__in UCHAR  InterfaceNumber,
__in UCHAR  SettingNumber 
)
protected

◆ FormatStringRequest()

_Must_inspect_result_ NTSTATUS FxUsbDevice::FormatStringRequest ( __in FxRequestBase Request,
__in FxRequestBuffer RequestBuffer,
__in UCHAR  StringIndex,
__in USHORT  LangID 
)

Definition at line 499 of file fxusbdevicekm.cpp.

523{
524 FxUsbDeviceStringContext* pContext;
526 FX_URB_TYPE urbType;
527
528 status = Request->ValidateTarget(this);
529 if (!NT_SUCCESS(status)) {
531 "WDFUSBDEVICE %p, Request %p, setting target failed, "
532 "%!STATUS!", GetHandle(), Request, status);
533
534 return status;
535 }
536
537 if (Request->HasContextType(FX_RCT_USB_STRING_REQUEST)) {
538 pContext = (FxUsbDeviceStringContext*) Request->GetContext();
539 }
540 else {
541
543 pContext = new(GetDriverGlobals()) FxUsbDeviceStringContext(urbType);
544 if (pContext == NULL) {
546 }
547
548 if (urbType == FxUrbTypeUsbdAllocated) {
549 status = pContext->AllocateUrb(m_USBDHandle);
550 if (!NT_SUCCESS(status)) {
552 "FxUsbDeviceStringContext::AllocateUrb failed, %!STATUS!", status);
553 delete pContext;
554 return status;
555 }
556
557 //
558 // Since the AllocateUrb routine calls USBD_xxxUrbAllocate APIs to allocate an Urb, it is
559 // important to release those resorces before the devnode is removed. Those
560 // resoruces are removed at the time Request is disposed.
561 //
562 Request->EnableContextDisposeNotification();
563 }
564
565 Request->SetContext(pContext);
566 }
567
569 RequestBuffer->GetBufferLength());
570 if (!NT_SUCCESS(status)) {
571 return status;
572 }
573
574 pContext->StoreAndReferenceMemory(RequestBuffer);
575 pContext->SetUrbInfo(StringIndex, LangID);
576
577 if (pContext->m_Urb == &pContext->m_UrbLegacy) {
578 urbType = FxUrbTypeLegacy;
579 }
580 else {
581 urbType = FxUrbTypeUsbdAllocated;
582 }
583
584 FxFormatUsbRequest(Request, (PURB)pContext->m_Urb, urbType, m_USBDHandle);
585
586 return STATUS_SUCCESS;
587}
@ FX_RCT_USB_STRING_REQUEST
virtual VOID StoreAndReferenceMemory(__in FxRequestBuffer *Buffer)
VOID SetUrbInfo(__in UCHAR StringIndex, __in USHORT LangID)
_Must_inspect_result_ NTSTATUS AllocateDescriptor(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in size_t BufferSize)
__checkReturn NTSTATUS AllocateUrb(__in USBD_HANDLE USBDHandle)
_URB_CONTROL_DESCRIPTOR_REQUEST m_UrbLegacy
_URB_CONTROL_DESCRIPTOR_REQUEST * m_Urb
_Must_inspect_result_ _In_ WDFUSBDEVICE _In_opt_ WDFREQUEST _In_opt_ PWDF_REQUEST_SEND_OPTIONS _Out_writes_opt_ NumCharacters PUSHORT _Inout_ PUSHORT _In_ UCHAR StringIndex
Definition: wdfusb.h:1080
_Must_inspect_result_ _In_ WDFUSBDEVICE _In_opt_ WDFREQUEST _In_opt_ PWDF_REQUEST_SEND_OPTIONS _Out_writes_opt_ NumCharacters PUSHORT _Inout_ PUSHORT _In_ UCHAR _In_opt_ USHORT LangID
Definition: wdfusb.h:1083

◆ GetConfigDescriptor()

_Must_inspect_result_ NTSTATUS FxUsbDevice::GetConfigDescriptor ( __out PVOID  ConfigDescriptor,
__inout PUSHORT  ConfigDescriptorLength 
)

Definition at line 1281 of file fxusbdevice.cpp.

1285{
1287 USHORT copyLength;
1288
1289 if (ConfigDescriptor == NULL) {
1290 //
1291 // Caller wants length to allocate
1292 //
1295 }
1296
1297 if (*ConfigDescriptorLength < m_ConfigDescriptor->wTotalLength) {
1298 //
1299 // Valid ConfigDescriptor passed in, but its too small. Copy as many
1300 // bytes as we can.
1301 //
1302 copyLength = *ConfigDescriptorLength;
1304 }
1305 else {
1306 copyLength = m_ConfigDescriptor->wTotalLength;
1308 }
1309
1310 //
1311 // Always indicate to the caller the number of required bytes or the
1312 // number of bytes we copied.
1313 //
1316
1317 return status;
1318}
unsigned short USHORT
Definition: pedump.c:61
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:69
_Must_inspect_result_ _In_ WDFUSBDEVICE _Out_writes_bytes_to_opt_ ConfigDescriptorLength PVOID ConfigDescriptor
Definition: wdfusb.h:1036
_Must_inspect_result_ _In_ WDFUSBDEVICE _Out_writes_bytes_to_opt_ ConfigDescriptorLength PVOID _Inout_ PUSHORT ConfigDescriptorLength
Definition: wdfusb.h:1040

◆ GetConfigHandle()

__inline USBD_CONFIGURATION_HANDLE FxUsbDevice::GetConfigHandle ( VOID  )
inline

Definition at line 234 of file fxusbdevice.hpp.

237 {
238 return m_ConfigHandle;
239 }

◆ GetControlPipeHandle()

USBD_PIPE_HANDLE FxUsbDevice::GetControlPipeHandle ( VOID  )
inline

Definition at line 369 of file fxusbdevice.hpp.

372 {
373 return m_ControlPipe;
374 }

◆ GetCurrentFrameNumber()

_Must_inspect_result_ __inline NTSTATUS FxUsbDevice::GetCurrentFrameNumber ( __in PULONG  Current)
inline

Definition at line 244 of file fxusbdevice.hpp.

247 {
248 if (m_QueryBusTime != NULL) {
249 return m_QueryBusTime(m_BusInterfaceContext, Current);
250 }
251 else {
252 return STATUS_UNSUCCESSFUL;
253 }
254 }
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132

◆ GetDefaultMaxTransferSize()

ULONG FxUsbDevice::GetDefaultMaxTransferSize ( VOID  )
protected

Definition at line 498 of file fxusbdevice.cpp.

523{
524 //
525 // On a usbport serviced stack (which can be running on Win2k) or on a
526 // usbd stack on XP and later. In any case, always use the current max
527 // transfer size definition.
528 //
530}
#define USBD_DEFAULT_MAXIMUM_TRANSFER_SIZE
Definition: usb.h:236

Referenced by FxUsbInterface::FormatSelectSettingUrb(), SelectConfigDescriptor(), SelectConfigInterfaces(), SelectConfigMulti(), and SelectConfigSingle().

◆ GetFxUrbTypeForRequest()

FX_URB_TYPE FxUsbDevice::GetFxUrbTypeForRequest ( __in FxRequestBase Request)

Definition at line 2439 of file fxusbdevice.cpp.

2465{
2466 if (m_UrbType == FxUrbTypeLegacy) {
2467 return FxUrbTypeLegacy;
2468 }
2469
2470 if (Request->IsAllocatedFromIo()) {
2472 }
2473
2476 }
2477
2478 return FxUrbTypeLegacy;
2479}

Referenced by FxUsbPipe::FormatAbortRequest(), FormatControlRequest(), FxUsbPipe::FormatResetRequest(), FormatStringRequest(), and FxUsbPipe::FormatTransferRequest().

◆ GetInformation()

VOID FxUsbDevice::GetInformation ( __out PWDF_USB_DEVICE_INFORMATION  Information)

Definition at line 485 of file fxusbdevice.cpp.

488{
489 Information->Traits = m_Traits;
490 Information->HcdPortCapabilities = m_HcdPortCapabilities;
491
492 RtlCopyMemory(&Information->UsbdVersionInformation,
495}
_In_ WDFREQUEST _In_ NTSTATUS _In_ ULONG_PTR Information
Definition: wdfrequest.h:1049

◆ GetInterfaceFromIndex()

FxUsbInterface * FxUsbDevice::GetInterfaceFromIndex ( __in UCHAR  InterfaceIndex)

Definition at line 2010 of file fxusbdevice.cpp.

2013{
2016 }
2017
2018 return NULL;
2019}
_In_ WDFUSBDEVICE _In_ UCHAR InterfaceIndex
Definition: wdfusb.h:2462

◆ GetInterfaceFromNumber()

FxUsbInterface * FxUsbDevice::GetInterfaceFromNumber ( __in UCHAR  InterfaceNumber)
protected

Definition at line 2041 of file fxusbdevice.cpp.

2044{
2045 ULONG i;
2046
2047 for (i = 0; i < m_NumInterfaces; i++) {
2049 return m_Interfaces[i];
2050 }
2051 }
2052
2053 return NULL;
2054}
return pUsbInterface GetInterfaceNumber()
_In_ PVOID _In_ LONG InterfaceNumber
Definition: usbdlib.h:169

Referenced by SelectConfig().

◆ GetInterfaceNumberFromInterface()

_Must_inspect_result_ NTSTATUS FxUsbDevice::GetInterfaceNumberFromInterface ( __in WDFUSBINTERFACE  UsbInterface,
__out PUCHAR  InterfaceNumber 
)
protected

Definition at line 2023 of file fxusbdevice.cpp.

2027{
2029
2033 (PVOID*) &pUsbInterface);
2034
2036
2037 return STATUS_SUCCESS;
2038}
UCHAR GetInterfaceNumber(VOID)
FxObjectHandleGetPtr(GetFxDriverGlobals(DriverGlobals), Fdo, FX_TYPE_DEVICE,(PVOID *)&pFdo)
@ FX_TYPE_USB_INTERFACE
Definition: fxtypes.h:104

Referenced by SelectConfigMulti().

◆ GetInterfaceNumEndpoints()

UCHAR FxUsbDevice::GetInterfaceNumEndpoints ( __in UCHAR  InterfaceNumber)

◆ GetInterfacePipeReferenced()

WDFUSBPIPE FxUsbDevice::GetInterfacePipeReferenced ( __in UCHAR  InterfaceNumber,
__in UCHAR  EndpointNumber 
)

◆ GetNumInterfaces()

UCHAR FxUsbDevice::GetNumInterfaces ( VOID  )
inline

Definition at line 301 of file fxusbdevice.hpp.

304 {
305 return m_NumInterfaces;
306 }

◆ GetPortStatus()

_Must_inspect_result_ NTSTATUS FxUsbDevice::GetPortStatus ( __out PULONG  PortStatus)
protected

Definition at line 1136 of file fxusbdevice.cpp.

1139{
1141
1144 FxSyncRequest syncRequest(GetDriverGlobals(), &context);
1145
1146 //
1147 // FxSyncRequest always succeesds for KM.
1148 //
1149 status = syncRequest.Initialize();
1150 if (!NT_SUCCESS(status)) {
1152 "Failed to initialize FxSyncRequest");
1153 return status;
1154 }
1155
1156 *PortStatus = 0;
1157 args[0].SetBuffer(PortStatus, 0);
1158 args[1].SetBuffer(NULL, 0);
1159 args[2].SetBuffer(NULL, 0);
1160
1161 status = FormatInternalIoctlOthersRequest(syncRequest.m_TrueRequest,
1163 args);
1164
1165 if (NT_SUCCESS(status)) {
1167
1170
1171 status = SubmitSync(syncRequest.m_TrueRequest, &options);
1172 }
1173
1174 return status;
1175}
_Must_inspect_result_ NTSTATUS FormatInternalIoctlOthersRequest(__in FxRequestBase *Request, __in ULONG Ioctl, __in FxRequestBuffer *Buffers)
#define FX_REQUEST_NUM_OTHER_PARAMS
_Outptr_ PUSB_DEVICE_HANDLE _In_ PUSB_DEVICE_HANDLE _In_ USHORT PortStatus
Definition: hubbusif.h:42
Definition: match.c:390
#define IOCTL_INTERNAL_USB_GET_PORT_STATUS
Definition: usbioctl.h:44

Referenced by IsConnected(), and IsEnabled().

◆ GetString()

_Must_inspect_result_ NTSTATUS FxUsbDevice::GetString ( __in_ecount *NumCharacters PUSHORT  String,
__in PUSHORT  NumCharacters,
__in UCHAR  StringIndex,
__in_opt USHORT  LangID,
__in_opt WDFREQUEST  Request = NULL,
__in_opt PWDF_REQUEST_SEND_OPTIONS  Options = NULL 
)

Definition at line 368 of file fxusbdevicekm.cpp.

376{
377 PUSB_STRING_DESCRIPTOR pDescriptor;
384
385 FxSyncRequest request(GetDriverGlobals(), NULL, Request);
386
387 //
388 // FxSyncRequest always succeesds for KM.
389 //
390 status = request.Initialize();
391 if (!NT_SUCCESS(status)) {
393 "Failed to initialize FxSyncRequest");
394 return status;
395 }
396
397 buffer = NULL;
398
399 status = request.m_TrueRequest->ValidateTarget(this);
400 if (!NT_SUCCESS(status)) {
401 goto Done;
402 }
403
404 RtlZeroMemory(&urb, sizeof(urb));
405
406 if (String != NULL) {
407 length = sizeof(USB_STRING_DESCRIPTOR) + (*NumCharacters - 1) * sizeof(WCHAR);
408
409 buffer = FxPoolAllocate(GetDriverGlobals(),
411 length);
412
413 if (buffer == NULL) {
415 goto Done;
416 }
417
419 pDescriptor = (PUSB_STRING_DESCRIPTOR) buffer;
420 }
421 else {
422 RtlZeroMemory(&common, sizeof(common));
423
425 pDescriptor = (PUSB_STRING_DESCRIPTOR) &common;
426 }
427
432 LangID,
433 pDescriptor,
434 NULL,
435 length,
436 NULL);
437
438 if (Options != NULL) {
439 pOptions = Options;
440 }
441 else {
445
446 pOptions = &options;
447 }
448#pragma prefast(suppress: __WARNING_BUFFER_OVERFLOW, "this annotation change in usb.h is communicated to usb team")
449 FxFormatUsbRequest(request.m_TrueRequest, (PURB) &urb, FxUrbTypeLegacy, NULL);
450 status = SubmitSync(request.m_TrueRequest, pOptions);
451
452 if (NT_SUCCESS(status)) {
454
455 //
456 // Make sure we got an even number of bytes and that we got a header
457 //
458 if ((pDescriptor->bLength & 0x1) ||
459 pDescriptor->bLength < sizeof(USB_COMMON_DESCRIPTOR)) {
461 }
462 else {
463 //
464 // bLength is the length of the entire descriptor. Subtract off
465 // the descriptor header and then divide by the size of a WCHAR.
466 //
467 numChars =
468 (pDescriptor->bLength - sizeof(USB_COMMON_DESCRIPTOR)) / sizeof(WCHAR);
469
470 if (String != NULL) {
471 if (*NumCharacters >= numChars) {
472 length = numChars * sizeof(WCHAR);
473 }
474 else {
475 length = *NumCharacters * sizeof(WCHAR);
477 }
478
480 RtlCopyMemory(String, pDescriptor->bString, length);
481 }
482 else {
484 }
485 }
486 }
487
488 if (buffer != NULL) {
490 }
491
492Done:
493
494 return status;
495}
USHORT numChars
GLuint buffer
Definition: glext.h:5915
GLuint GLsizei GLsizei * length
Definition: glext.h:6040
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
#define STATUS_DEVICE_DATA_ERROR
Definition: udferr_usr.h:159
struct _USB_STRING_DESCRIPTOR * PUSB_STRING_DESCRIPTOR
#define USB_STRING_DESCRIPTOR_TYPE
Definition: usb100.h:51
struct _USB_STRING_DESCRIPTOR USB_STRING_DESCRIPTOR
struct _USB_COMMON_DESCRIPTOR USB_COMMON_DESCRIPTOR
#define UsbBuildGetDescriptorRequest(urb, length, descriptorType, descriptorIndex, languageId, transferBuffer, transferBufferMDL, transferBufferLength, link)
Definition: usbdlib.h:23
FORCEINLINE LONGLONG WDF_REL_TIMEOUT_IN_SEC(_In_ ULONGLONG Time)
Definition: wdfcore.h:62
_In_ PWDFDEVICE_INIT _In_ PWDF_REMOVE_LOCK_OPTIONS Options
Definition: wdfdevice.h:3540
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFSTRING String
Definition: wdfdevice.h:2439
FORCEINLINE VOID WDF_REQUEST_SEND_OPTIONS_SET_TIMEOUT(_Inout_ PWDF_REQUEST_SEND_OPTIONS Options, _In_ LONGLONG Timeout)
Definition: wdfrequest.h:421
_Must_inspect_result_ _In_ WDFUSBDEVICE _In_opt_ WDFREQUEST _In_opt_ PWDF_REQUEST_SEND_OPTIONS _Out_writes_opt_ NumCharacters PUSHORT _Inout_ PUSHORT NumCharacters
Definition: wdfusb.h:1078
__wchar_t WCHAR
Definition: xmlstorage.h:180

◆ GetUrbType()

FX_URB_TYPE FxUsbDevice::GetUrbType ( VOID  )
inline

Definition at line 478 of file fxusbdevice.hpp.

481 {
482 return m_UrbType;
483 }

Referenced by __in_xcount().

◆ GetUSBDHandle()

USBD_HANDLE FxUsbDevice::GetUSBDHandle ( VOID  )
inline

Definition at line 470 of file fxusbdevice.hpp.

473 {
474 return m_USBDHandle;
475 }

Referenced by __deref_opt_out_bcount(), __in_xcount(), and QueryUsbCapability().

◆ HasMismatchedInterfacesInConfigDescriptor()

BOOLEAN FxUsbDevice::HasMismatchedInterfacesInConfigDescriptor ( VOID  )
inline

Definition at line 409 of file fxusbdevice.hpp.

◆ InitDevice()

_Must_inspect_result_ NTSTATUS FxUsbDevice::InitDevice ( __in ULONG  USBDClientContractVersionForWdfClient)

Definition at line 45 of file fxusbdevicekm.cpp.

48{
49 URB urb;
50 FxSyncRequest request(GetDriverGlobals(), NULL);
53 ULONG size;
54 ULONG paddedSize;
55
56 RtlZeroMemory(&urb, sizeof(urb));
57
58 if (USBDClientContractVersionForWdfClient != USBD_CLIENT_CONTRACT_VERSION_INVALID) {
59
60 //
61 // Register with USBDEX.lib
62 //
65 USBDClientContractVersionForWdfClient,
68
69 if (!NT_SUCCESS(status)) {
72 "USBD_CreateHandle failed, %!STATUS!", status);
73 goto Done;
74 }
75
77 }
78
79 status = request.m_TrueRequest->ValidateTarget(this);
80 if (!NT_SUCCESS(status)) {
81 goto Done;
82 }
83
87 0,
88 0,
90 NULL,
91 sizeof(m_DeviceDescriptor),
92 NULL);
93
94 FxFormatUsbRequest(request.m_TrueRequest, &urb, FxUrbTypeLegacy, NULL);
95
98
99 status = SubmitSync(request.m_TrueRequest, &options);
100 if (!NT_SUCCESS(status)) {
103 "Could not retrieve device descriptor, %!STATUS!", status);
104 goto Done;
105 }
106
107 //
108 // After successfully completing any default control URB, USBD/usbport fills
109 // in the PipeHandle field of the URB (it is the same offset in every URB,
110 // which this CASSERT verifies. Since USBD_DEFAULT_PIPE_TRANSFER is not
111 // supported by USBD (it is by USBPORT), this is the prescribed way of getting
112 // the default control pipe so that you can set the PipeHandle field in
113 // _URB_CONTROL_TRANSFER.
114 //
117
119
121
122 RtlZeroMemory(&config, sizeof(config));
123 size = sizeof(config);
124
128 0,
129 0,
130 &config,
131 NULL,
132 size,
133 NULL);
134
135 request.m_TrueRequest->GetSubmitFxIrp()->Reuse(STATUS_SUCCESS);
136 request.m_TrueRequest->ClearFieldsForReuse();
137 FxFormatUsbRequest(request.m_TrueRequest, &urb, FxUrbTypeLegacy, NULL);
138
139 status = SubmitSync(request.m_TrueRequest, &options);
140 if (!NT_SUCCESS(status)) {
143 "Could not retrieve config descriptor size, %!STATUS!", status);
144 goto Done;
145 }
146 else if (urb.UrbControlDescriptorRequest.TransferBufferLength == 0) {
147 //
148 // Not enough info returned
149 //
151
154 "Could not retrieve config descriptor size, zero bytes transferred, "
155 " %!STATUS!", status);
156
157 goto Done;
158 }
159 else if (config.wTotalLength < size) {
160 //
161 // Not enough info returned
162 //
164
167 "Could not retrieve config descriptor size, config.wTotalLength %d < "
168 "sizeof(config descriptor) (%d), %!STATUS!",
169 config.wTotalLength, size, status);
170
171 goto Done;
172 }
173
174 //
175 // Allocate an additional memory at the end of the buffer so if we
176 // accidentily access fields beyond the end of the buffer we don't crash
177
178 //
179
180
181
182
183
184 size = config.wTotalLength;
185 paddedSize = size + sizeof(USB_DEVICE_DESCRIPTOR);
186
188 FxPoolAllocate(GetDriverGlobals(),
190 paddedSize);
191
192 if (m_ConfigDescriptor == NULL) {
194
197 "Could not allocate %d bytes for config descriptor, %!STATUS!",
198 paddedSize, status);
199
200 goto Done;
201 }
202
204
208 0,
209 0,
211 NULL,
212 size,
213 NULL);
214
215 request.m_TrueRequest->GetSubmitFxIrp()->Reuse(STATUS_SUCCESS);
216 request.m_TrueRequest->ClearFieldsForReuse();
217 FxFormatUsbRequest(request.m_TrueRequest, &urb, FxUrbTypeLegacy, NULL);
218
219 status = SubmitSync(request.m_TrueRequest, &options);
220 if (!NT_SUCCESS(status)) {
223 "Could not retrieve config descriptor, %!STATUS!", status);
224 goto Done;
225 } else if(m_ConfigDescriptor->wTotalLength != size) {
226 //
227 // Invalid wTotalLength
228 //
232 "Defective USB device reported two different config descriptor "
233 "wTotalLength values: %d and %d, %!STATUS!",
235 goto Done;
236 }
237
238 //
239 // Check to see if we are wait wake capable
240 //
243 }
244
245 //
246 // Check to see if we are self or bus powered
247 //
248 USHORT deviceStatus;
249
252 0,
253 &deviceStatus,
254 NULL,
255 NULL);
256
257 request.m_TrueRequest->GetSubmitFxIrp()->Reuse(STATUS_SUCCESS);
258 request.m_TrueRequest->ClearFieldsForReuse();
259 FxFormatUsbRequest(request.m_TrueRequest, &urb, FxUrbTypeLegacy, NULL);
260
261 status = SubmitSync(request.m_TrueRequest, &options);
262 if (NT_SUCCESS(status) && (deviceStatus & USB_GETSTATUS_SELF_POWERED)) {
264 }
265
266 //
267 // Revert back to success b/c we don't care if the usb device get status
268 // fails
269 //
271
273
274 RtlZeroMemory(&busIf, sizeof(busIf));
275
276 //
277 // All PNP irps must have this initial status
278 //
279 request.m_TrueRequest->GetSubmitFxIrp()->Reuse(STATUS_NOT_SUPPORTED);
280 request.m_TrueRequest->ClearFieldsForReuse();
281
283 request.m_TrueRequest->GetSubmitFxIrp()->GetIrp(),
284 &USB_BUS_INTERFACE_USBDI_GUID,
285 (PINTERFACE) &busIf,
286 sizeof(busIf),
288
289 request.m_TrueRequest->VerifierSetFormatted();
290
291 status = SubmitSync(request.m_TrueRequest);
292
293 if (!NT_SUCCESS(status)) {
294 //
295 // Retry with the older interface
296 //
297 RtlZeroMemory(&busIf, sizeof(busIf));
298
299 //
300 // All PNP irps must have this initial status
301 //
302
303 request.m_TrueRequest->GetSubmitFxIrp()->Reuse(STATUS_NOT_SUPPORTED);
304 request.m_TrueRequest->ClearFieldsForReuse();
305
307 request.m_TrueRequest->GetSubmitFxIrp()->GetIrp(),
308 &USB_BUS_INTERFACE_USBDI_GUID,
309 (PINTERFACE) &busIf,
312
313 request.m_TrueRequest->VerifierSetFormatted();
314
315 status = SubmitSync(request.m_TrueRequest);
316 }
317
318 if (NT_SUCCESS(status)) {
319 //
320 // Need to check for NULL b/c we may have only retrieved the V0 interface
321 //
322 if (busIf.IsDeviceHighSpeed != NULL &&
323 busIf.IsDeviceHighSpeed(busIf.BusContext)) {
325 }
326
327 //
328 // Stash these off for later
329 //
333
334 ASSERT(busIf.GetUSBDIVersion != NULL);
335 busIf.GetUSBDIVersion(busIf.BusContext,
338 }
339 else if (status == STATUS_NOT_SUPPORTED) {
340 //
341 // We will only use m_ControlPipe on stacks which do not support
342 // USBD_DEFAULT_PIPE_TRANSFER. If all the QIs failed, then we know
343 // definitively that we are running on USBD and we need m_ControlPipe
344 // to be != NULL for later control transfers
345 //
347
348 m_OnUSBD = TRUE;
349
350 //
351 // The QI failed with not supported, do not return error
352 //
354 }
355 else {
358 "Query Interface for bus returned error, %!STATUS!", status);
359 }
360
361Done:
362
363 return status;
364}
MdDeviceObject m_TargetDevice
Definition: fxiotarget.hpp:910
MdDeviceObject m_InStackDevice
Definition: fxiotarget.hpp:905
#define STATUS_NOT_SUPPORTED
Definition: d3dkmdt.h:48
struct config_s config
static VOID _FormatIrp(__in PIRP Irp, __in const GUID *InterfaceGuid, __out PINTERFACE Interface, __in USHORT InterfaceSize, __in USHORT InterfaceVersion, __in_opt PVOID InterfaceSpecificData=NULL)
struct _URB_CONTROL_DESCRIPTOR_REQUEST UrbControlDescriptorRequest
Definition: usb.h:545
PINTERFACE_DEREFERENCE InterfaceDereference
Definition: usbbusif.h:98
PUSB_BUSIFFN_GETUSBDI_VERSION GetUSBDIVersion
Definition: usbbusif.h:99
PUSB_BUSIFFN_IS_DEVICE_HIGH_SPEED IsDeviceHighSpeed
Definition: usbbusif.h:103
PUSB_BUSIFFN_QUERY_BUS_TIME QueryBusTime
Definition: usbbusif.h:100
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
#define USB_GETSTATUS_SELF_POWERED
Definition: usb100.h:45
struct _USB_CONFIGURATION_DESCRIPTOR * PUSB_CONFIGURATION_DESCRIPTOR
#define USB_CONFIGURATION_DESCRIPTOR_TYPE
Definition: usb100.h:50
#define USB_DEVICE_DESCRIPTOR_TYPE
Definition: usb100.h:49
#define USB_CONFIG_REMOTE_WAKEUP
Definition: usb100.h:71
struct _USB_DEVICE_DESCRIPTOR USB_DEVICE_DESCRIPTOR
#define URB_FUNCTION_GET_STATUS_FROM_DEVICE
Definition: usb.h:105
#define USB_BUSIF_USBDI_VERSION_1
Definition: usbbusif.h:74
#define USB_BUSIF_USBDI_VERSION_0
Definition: usbbusif.h:73
NTSTATUS USBD_CreateHandle(_In_ PDEVICE_OBJECT DeviceObject, _In_ PDEVICE_OBJECT TargetDeviceObject, _In_ ULONG USBDClientContractVersion, _In_ ULONG PoolTag, _Out_ USBD_HANDLE *USBDHandle)
Definition: usbdex.c:38
#define UsbBuildGetStatusRequest(urb, op, index, transferBuffer, transferBufferMDL, link)
Definition: usbdlib.h:35
#define USBD_CLIENT_CONTRACT_VERSION_INVALID
Definition: usbdlib.h:99
#define WDFCASSERT(c)
Definition: wdfassert.h:93
_Must_inspect_result_ _In_ WDFDEVICE _In_ BOOLEAN _In_opt_ PVOID Tag
Definition: wdfdevice.h:4071
@ WDF_USB_DEVICE_TRAIT_SELF_POWERED
Definition: wdfusb.h:142
@ WDF_USB_DEVICE_TRAIT_AT_HIGH_SPEED
Definition: wdfusb.h:144
@ WDF_USB_DEVICE_TRAIT_REMOTE_WAKE_CAPABLE
Definition: wdfusb.h:143
_Reserved_ PVOID Reserved
Definition: winddi.h:3974

◆ IsConnected()

_Must_inspect_result_ NTSTATUS FxUsbDevice::IsConnected ( VOID  )

Definition at line 1207 of file fxusbdevice.cpp.

1210{
1211#if (FX_CORE_MODE == FX_CORE_USER_MODE)
1212
1213
1214
1215
1216 return STATUS_UNSUCCESSFUL;
1217#elif (FX_CORE_MODE == FX_CORE_KERNEL_MODE)
1219 ULONG portStatus;
1220
1221 status = GetPortStatus(&portStatus);
1222 if (NT_SUCCESS(status) && (portStatus & USBD_PORT_CONNECTED) == 0) {
1224 }
1225
1226 return status;
1227#endif
1228}
_Must_inspect_result_ NTSTATUS GetPortStatus(__out PULONG PortStatus)
#define STATUS_DEVICE_DOES_NOT_EXIST
Definition: ntstatus.h:522
#define USBD_PORT_CONNECTED
Definition: usbioctl.h:42

◆ IsEnabled()

BOOLEAN FxUsbDevice::IsEnabled ( VOID  )

Definition at line 1180 of file fxusbdevice.cpp.

1183{
1185 ULONG portStatus;
1187
1188 enabled = TRUE;
1189 status = GetPortStatus(&portStatus);
1190
1191 //
1192 // Inability to get STATUS_SUCCESS from GetPortStatus is more likely a resource
1193 // issue rather than a device issue so return FALSE from this function only if
1194 // we were able to read the PortStatus and the port was disabled.
1195 // What you don't want is to continuosly reset the device (by returning FALSE)
1196 // instead of resetting pipe (by returning TRUE) under low memory conditions.
1197 //
1198 if (NT_SUCCESS(status) && (portStatus & USBD_PORT_ENABLED) == 0) {
1199 enabled = FALSE;
1200 }
1201
1202 return enabled;
1203}
GLenum GLenum GLsizei const GLuint GLboolean enabled
Definition: glext.h:7750
#define USBD_PORT_ENABLED
Definition: usbioctl.h:41

◆ IsObjectDisposedOnRemove()

BOOLEAN FxUsbDevice::IsObjectDisposedOnRemove ( __in FxObject Object)

Definition at line 2361 of file fxusbdevice.cpp.

2384{
2385 FxObject * obj;
2386 FxObject * parent;
2387 BOOLEAN isObjectDisposedOnRemove = FALSE;
2388
2389 obj = Object;
2390
2391 //
2392 // By adding a reference now, we simulate what GetParentObjectReferenced
2393 // does later, thus allowing simple logic on when/how to release the
2394 // reference on exit.
2395 //
2396 obj->ADDREF(Object);
2397
2398 while (obj != NULL) {
2399
2400 if (obj == (FxObject*) m_Device) {
2401
2402 isObjectDisposedOnRemove = TRUE;
2403 break;
2404 }
2405
2407
2409 if (request->IsAllocatedFromIo()) {
2410
2411 isObjectDisposedOnRemove = TRUE;
2412 break;
2413 }
2414 }
2415
2416 parent = obj->GetParentObjectReferenced(Object);
2417
2418 //
2419 // Release the reference previously taken by the top of the function
2420 // or GetParentObjectReferenced in a previous pass in the loop.
2421 //
2422 obj->RELEASE(Object);
2423 obj = parent;
2424 }
2425
2426 if (obj != NULL) {
2427
2428 //
2429 // Release the reference previously taken by the top of the function
2430 // or GetParentObjectReferenced in a last pass in the loop.
2431 //
2432 obj->RELEASE(Object);
2433 }
2434
2435 return isObjectDisposedOnRemove;
2436}
CfxDevice * m_Device
Definition: fxobject.hpp:329
r parent
Definition: btrfs.c:3010
__inline BOOLEAN FxObjectCheckType(__in FxObject *Object, __in WDFTYPE Type)
Definition: fxhandle.h:240
@ FX_TYPE_REQUEST
Definition: fxtypes.h:53
_Must_inspect_result_ _In_ WDFCOLLECTION _In_ WDFOBJECT Object

Referenced by CreateIsochUrb(), CreateUrb(), and GetFxUrbTypeForRequest().

◆ OnUSBD()

BOOLEAN FxUsbDevice::OnUSBD ( VOID  )
inline

Definition at line 361 of file fxusbdevice.hpp.

364 {
365 return m_OnUSBD;
366 }

◆ PipesGotoRemoveState()

VOID FxUsbDevice::PipesGotoRemoveState ( __in BOOLEAN  ForceRemovePipes)
protected

Definition at line 817 of file fxusbdevice.cpp.

820{
821 SINGLE_LIST_ENTRY sentHead;
822 LIST_ENTRY pendHead, interfaceHead;
824 ULONG iPipe, intfIndex;
825 KIRQL irql;
826
827 sentHead.Next = NULL;
828 InitializeListHead(&pendHead);
829 InitializeListHead(&interfaceHead);
830
831 AcquireInterfaceIterationLock();
832
833 Lock(&irql);
834 for (intfIndex = 0; intfIndex < m_NumInterfaces; intfIndex++ ) {
835 pUsbInterface = m_Interfaces[intfIndex];
836
838 for (iPipe = 0;
840 iPipe++) {
841 BOOLEAN wait;
842
843 wait = FALSE;
844
845 //
846 // Pipe can be NULL if the interface is half initialized
847 //
848 if (pUsbInterface->m_ConfiguredPipes[iPipe] != NULL) {
851 &pendHead,
852 &sentHead,
853 TRUE,
854 &wait);
855
856 }
857 }
858 }
859 }
860 Unlock(irql);
861
862 //
863 // We cleanup requests no matter what the new state is because we complete all
864 // pended requests in the surprise removed case.
865 //
866 _CleanupPipesRequests(&pendHead, &sentHead);
867
868 //
869 // Only destroy child pipe objects when the parent is going away or the
870 // caller indicates that this is the desired action.
871 //
872 if (m_State == WdfIoTargetDeleted || ForceRemovePipes) {
873 for (intfIndex = 0; intfIndex < m_NumInterfaces; intfIndex++) {
874 pUsbInterface = m_Interfaces[intfIndex];
875
877 //
878 // Iterate over the pipes and clean each one up
879 //
880 for (iPipe = 0;
882 iPipe++) {
883 //
884 // Same reason as above
885 //
886 if (pUsbInterface->m_ConfiguredPipes[iPipe] != NULL) {
889 }
890 }
891 }
892
894 }
895 }
896
897 ReleaseInterfaceIterationLock();
898}
WDF_IO_TARGET_STATE m_State
Definition: fxiotarget.hpp:928
virtual VOID WaitForSentIoToComplete(VOID)
Definition: fxiotarget.hpp:676
VOID CleanUpAndDelete(__in BOOLEAN ClearDestroyCallback)

Referenced by Deconfig().

◆ Purge()

VOID FxUsbDevice::Purge ( __in WDF_IO_TARGET_PURGE_IO_ACTION  Action)
protectedvirtual

Reimplemented from FxIoTarget.

Definition at line 698 of file fxusbdevice.cpp.

701{
703 SINGLE_LIST_ENTRY sentHead;
704 ULONG iPipe, iInterface;
705 KIRQL irql;
706
707 sentHead.Next = NULL;
708
709 //
710 // Purge all of our own I/O first
711 //
713
714 //
715 // if we are just canceling i/o, then we just acquire the spin lock b/c
716 // we can be called at dispatch level for this action code.
717 //
718 if (Action != WdfIoTargetPurgeIo) {
720
721 AcquireInterfaceIterationLock();
722 }
723
724 //
725 // Since we don't have to synchronize on the I/O already sent, just set
726 // each pipe's state to purged.
727 //
728 Lock(&irql);
729
730 for (iInterface = 0; iInterface < m_NumInterfaces; iInterface++) {
731 pUsbInterface = m_Interfaces[iInterface];
732
734 for (iPipe = 0;
736 iPipe++) {
737
738 if (pUsbInterface->m_ConfiguredPipes[iPipe] != NULL) {
739 BOOLEAN wait;
740 LIST_ENTRY pendedHead;
741
742 wait = FALSE;
743 InitializeListHead(&pendedHead);
744
746 Action,
747 &pendedHead,
748 &sentHead,
749 &wait,
750 TRUE
751 );
752
753 //
754 // Complete any requests pulled off from this pipe.
755 //
757 CompletePendedRequestList(&pendedHead);
758 }
759 }
760 }
761 }
762 Unlock(irql);
763
764 //
765 // Cancel all sent requests.
766 //
767 _CancelSentRequests(&sentHead);
768
769 for (iInterface = 0; iInterface < m_NumInterfaces; iInterface++) {
770 pUsbInterface = m_Interfaces[iInterface];
771
773 //
774 // Iterate over the pipes and clean each one up
775 //
776 for (iPipe = 0;
778 iPipe++) {
779 //
780 // Same reason as above
781 //
782 if (pUsbInterface->m_ConfiguredPipes[iPipe] != NULL) {
785 }
786 }
787 }
788 }
789
790 if (Action != WdfIoTargetPurgeIo) {
791 ReleaseInterfaceIterationLock();
792 }
793}
VOID CompletePendedRequestList(__in PLIST_ENTRY RequestListHead)
Definition: fxiotarget.cpp:520
virtual VOID Purge(__in WDF_IO_TARGET_PURGE_IO_ACTION Action)
Definition: fxiotarget.cpp:918
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: fxusbpipe.cpp:1296
static __inline KIRQL MxGetCurrentIrql()
Definition: mxgeneralkm.h:86
#define PASSIVE_LEVEL
Definition: env_spec_w32.h:693
_In_ WDFIOTARGET _In_ _Strict_type_match_ WDF_IO_TARGET_SENT_IO_ACTION Action
Definition: wdfiotarget.h:510
@ WdfIoTargetPurgeIo
Definition: wdfiotarget.h:79

◆ QueryUsbCapability()

Definition at line 758 of file fxusbdevicekm.cpp.

771{
773
774 if (ResultLength != NULL) {
775 *ResultLength = 0;
776 }
777
778 if (GetUSBDHandle() == NULL) {
780
783 "WDFUSBDEVICE must have been created using WdfUsbTargetDeviceCreateWithParameters, %!STATUS!",
784 status);
785
786 return status;
787 }
788
792 (PUCHAR) CapabilityBuffer,
794
795 if (!NT_SUCCESS(status)) {
798 "Could not retrieve capability %!GUID!, %!STATUS!",
800 goto exit;
801 }
802
803exit:
804 return status;
805}
USBD_HANDLE GetUSBDHandle(VOID)
#define exit(n)
Definition: config.h:202
unsigned char * PUCHAR
Definition: typedefs.h:53
#define STATUS_INVALID_DEVICE_STATE
Definition: udferr_usr.h:178
NTSTATUS USBD_QueryUsbCapability(_In_ USBD_HANDLE USBDHandle, _In_ const GUID *CapabilityType, _In_ ULONG OutputBufferLength, _When_(OutputBufferLength==0, _Pre_null_) _When_(OutputBufferLength !=0 &&ResultLength==NULL, _Out_writes_bytes_(OutputBufferLength)) _When_(OutputBufferLength !=0 &&ResultLength !=NULL, _Out_writes_bytes_to_opt_(OutputBufferLength, *ResultLength)) PUCHAR OutputBuffer, _Out_opt_ _When_(ResultLength !=NULL, _Deref_out_range_(<=, OutputBufferLength)) PULONG ResultLength)
Definition: usbdex.c:10
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ ULONG _Out_ PULONG ResultLength
Definition: wdfdevice.h:3782
_Must_inspect_result_ _In_ WDFUSBDEVICE _In_ CONST GUID _In_ ULONG CapabilityBufferLength
Definition: wdfusb.h:1615
_Must_inspect_result_ _In_ WDFUSBDEVICE _In_ CONST GUID * CapabilityType
Definition: wdfusb.h:1613

◆ RemoveDeletedInterface()

VOID FxUsbDevice::RemoveDeletedInterface ( __in FxUsbInterface Interface)
protected

Definition at line 466 of file fxusbdevice.cpp.

469{
470 UCHAR i;
471
472 if (m_Interfaces == NULL) {
473 return;
474 }
475
476 for (i = 0; i < m_NumInterfaces; i++) {
477 if (m_Interfaces[i] == Interface) {
479 return;
480 }
481 }
482}
_Must_inspect_result_ _In_ WDFDEVICE _In_ LPCGUID _Out_ PINTERFACE Interface
Definition: wdffdo.h:465

Referenced by FxUsbInterface::~FxUsbInterface().

◆ Reset()

_Must_inspect_result_ NTSTATUS FxUsbDevice::Reset ( VOID  )

Definition at line 1078 of file fxusbdevicekm.cpp.

1081{
1083 FxSyncRequest request(GetDriverGlobals(), &context);
1084 FxRequestBuffer emptyBuffer;
1086
1087 //
1088 // FxSyncRequest always succeesds for KM.
1089 //
1090 status = request.Initialize();
1091 if (!NT_SUCCESS(status)) {
1093 "Failed to initialize FxSyncRequest");
1094 return status;
1095 }
1096
1097 status = FormatIoctlRequest(request.m_TrueRequest,
1099 TRUE,
1100 &emptyBuffer,
1101 &emptyBuffer);
1102 if (NT_SUCCESS(status)) {
1103 CancelSentIo();
1105 }
1106
1107 return status;
1108}
#define IOCTL_INTERNAL_USB_RESET_PORT
Definition: usbioctl.h:35

◆ SelectConfig()

_Must_inspect_result_ NTSTATUS FxUsbDevice::SelectConfig ( __in PWDF_OBJECT_ATTRIBUTES  PipesAttributes,
__in PURB  Urb,
__in FX_URB_TYPE  FxUrbType,
__out_opt PUCHAR  NumConfiguredInterfaces 
)

Definition at line 1429 of file fxusbdevice.cpp.

1451{
1453 PUCHAR pCur, pEnd;
1455 FxUsbPipe* pPipe;
1456 PURB pSelectUrb;
1458 ULONG iPipe;
1459 USHORT maxNumPipes, size;
1460 UCHAR numPipes;
1461 FxInterfacePipeInformation* pPipeInfo;
1464 UCHAR intfIndex;
1465 FxIrp* irp;
1466
1468 FxSyncRequest request(GetDriverGlobals(), NULL);
1469
1470 pIface = NULL;
1471 maxNumPipes = 0;
1472 size = 0;
1473 pPipeInfo = NULL;
1474 pSelectUrb = NULL;
1475
1476 //
1477 // Callers to this function have guaranteed that there are interfaces
1478 // reported on this device.
1479 //
1480 ASSERT(m_NumInterfaces != 0);
1481
1482 if (NumConfiguredInterfaces != NULL) {
1483 *NumConfiguredInterfaces = 0;
1484 }
1485
1486 //
1487 // FxSyncRequest always succeesds for KM but can fail for UM.
1488 //
1489 status = request.Initialize();
1490 if (!NT_SUCCESS(status)) {
1492 "Failed to initialize FxSyncRequest");
1493 goto Done;
1494 }
1495
1496 //
1497 // Allocate a PIRP for the select config and possible select interface(s)
1498 //
1499 status = request.m_TrueRequest->ValidateTarget(this);
1500 if (!NT_SUCCESS(status)) {
1501 goto Done;
1502 }
1503
1504 //
1505 // Allocate a pool for storing the FxUsbPipe ** before we
1506 // assign them to the Interfaces just in case all doesn't go well.
1507 //
1508 if (m_NumInterfaces == 0) {
1509 //
1510 // Use one in the zero case to make the logic simpler
1511 //
1513 }
1514 else {
1516 }
1517
1518 pPipeInfo = (FxInterfacePipeInformation*) FxPoolAllocate(
1520 );
1521
1522 if (pPipeInfo == NULL) {
1526 "Could not internal allocate tracking info for selecting a config on "
1527 "WDFUSBDEVICE 0x%p, %!STATUS!", GetHandle(), status);
1528 goto Done;
1529 }
1530
1531 RtlZeroMemory(pPipeInfo, size);
1532
1533 //
1534 // The following code and the one in select setting have a lot in common
1535 // but can't leverage on that as that sends the select interface URB down
1536 // Our goal is allocate the resources -- the pipes and the select setting URB
1537 // before sending down the select config URB so that the tear down is simpler.
1538 //
1539
1540 //
1541 // Each FxUsbInterface will need a FxUsbPipe* for each pipe contained in
1542 // the interface.
1543 //
1544 pCur = (PUCHAR) &Urb->UrbSelectConfiguration.Interface;
1545 pEnd = ((PUCHAR) Urb) + Urb->UrbSelectConfiguration.Hdr.Length;
1546 intfIndex = 0;
1547
1548 for ( ; pCur < pEnd; pCur += pIface->Length, intfIndex++) {
1549 FxUsbPipe** ppPipes;
1550
1552 if (pIface->NumberOfPipes > UCHAR_MAX) {
1556 "WDFUSBDEVICE supports a maximum of %d pipes per interface, "
1557 "USBD_INTERFACE_INFORMATION %p specified %d, %!STATUS!",
1558 UCHAR_MAX, pIface, pIface->NumberOfPipes, status);
1559 goto Done;
1560 }
1561
1563 if (pUsbInterface == NULL) {
1567 "Could not find an instance of an interface descriptor with "
1568 "InterfaceNumber %d, %!STATUS!",
1569 pIface->InterfaceNumber, status);
1570 goto Done;
1571 }
1572
1573 numPipes = (UCHAR) pIface->NumberOfPipes;
1574
1575 //
1576 // Track the maximum number of pipes we have seen in an interface in
1577 // case we need to allocate a select interface URB.
1578 //
1579 if (numPipes > maxNumPipes) {
1580 maxNumPipes = (USHORT) numPipes;
1581 }
1582
1583 if (numPipes > 0) {
1584 size = numPipes * sizeof(FxUsbPipe *);
1585 }
1586 else {
1587 //
1588 // It is valid to have an interface with zero pipes in it. In that
1589 // case, we just allocate one entry so that we have a valid array
1590 // and keep the remaining code simple.
1591 //
1592 size = sizeof(FxUsbPipe*);
1593 }
1594
1595 ppPipes = (FxUsbPipe**) FxPoolAllocate(
1598 size
1599 );
1600
1601 if (ppPipes == NULL) {
1605 "Could not allocate memory for Pipes "
1606 "InterfaceNumber %d, %!STATUS!",
1607 pIface->InterfaceNumber, status);
1608 goto Done;
1609 }
1610
1611 RtlZeroMemory(ppPipes, size);
1612
1613 //
1614 // We store the pointer to the newly allocated arary in a temporary b/c
1615 // we can still fail and we don't want a half baked interface.
1616 //
1617
1618 pPipeInfo[intfIndex].Pipes = ppPipes;
1619 pPipeInfo[intfIndex].NumPipes = numPipes;
1620
1621 for (iPipe = 0; iPipe < numPipes; iPipe++) {
1622 ppPipes[iPipe] = new (GetDriverGlobals(), PipesAttributes)
1624
1625 if (ppPipes[iPipe] == NULL) {
1629 "Could not allocate a pipe object, %!STATUS!", status);
1630 goto Done;
1631 }
1632
1633 pPipe = ppPipes[iPipe];
1634 status = pPipe->Init(m_Device);
1635 if (!NT_SUCCESS(status)) {
1638 "Could not Init the pipe object, %!STATUS!", status);
1639 goto Done;
1640 }
1641
1643 if (!NT_SUCCESS(status)) {
1646 "Could not commit the pipe object, %!STATUS!", status);
1647 goto Done;
1648 }
1649 }
1650
1651
1652
1653
1654
1655
1656
1657
1658
1661 }
1662 }
1663
1664 //
1665 // If we are selecting more then one interface and at least one of them
1666 // has pipes in them, allocate a select interface URB that will be used
1667 // after the select config to select each interface. The select interface
1668 // URB will be big enough to select the largest interface in the group.
1669 //
1670 // The select interface URB is allocated before the select config so that
1671 // we know once the select config has completed successfully, we can be
1672 // guaranteed that we can select the interfaces we want and not have to
1673 // handle undoing the select config upon URB allocation failure.
1674 //
1675 if (m_NumInterfaces > 1 && maxNumPipes > 0) {
1677
1678 pSelectUrb = (PURB) FxPoolAllocate(GetDriverGlobals(),
1680 size
1681 );
1682
1683 if (pSelectUrb == NULL) {
1687 "Could not allocate a select interface URB, %!STATUS!", status);
1688 goto Done;
1689 }
1690
1691 RtlZeroMemory(pSelectUrb, size);
1692 }
1693
1694 //
1695 // Send the select config to the usb core
1696 //
1700
1701 FxFormatUsbRequest(request.m_TrueRequest, Urb, FxUrbType, m_USBDHandle);
1702 status = SubmitSync(request.m_TrueRequest, &options);
1703
1704 if (NT_SUCCESS(status)) {
1705 //
1706 // Save the config handle and store off all the pipes
1707 //
1708 m_ConfigHandle = Urb->UrbSelectConfiguration.ConfigurationHandle;
1709
1710 //
1711 // Initialize the first interface
1712 //
1713 pIface = &Urb->UrbSelectConfiguration.Interface;
1714
1717
1718 //
1719 // The interface now owns the array of pipes
1720 //
1721 pUsbInterface->SetConfiguredPipes(pPipeInfo[0].Pipes);
1722 pPipeInfo[0].Pipes = NULL;
1723 pPipeInfo[0].NumPipes = 0;
1724
1725 pUsbInterface->SetInfo(pIface);
1726
1727 //
1728 // Since this could be the only interface, set the index now, so if we
1729 // return the number of configured interfaces, it will be valid for the
1730 // single interface case.
1731 //
1732 intfIndex = 1;
1733
1734 //
1735 // If we have a more then one interface, we must select each of the addtional
1736 // interfaces after the select config because usbccgp (the generic parent
1737 // driver) didn't fill out all of the pipe info for IAD (interface
1738 // association descriptor) devices. The first interface is filled out
1739 // property, it is 2->N that are left blank.
1740 //
1741 // pSelectUrb can be equal to NULL and have more then one interface if
1742 // all interfaces have no pipes associated with them. In that case, we
1743 // still want to iterate over the remaining pipes so that we can
1744 // initialize our structures properly.
1745 //
1746 if (m_NumInterfaces > 1) {
1747 //
1748 // Loop over the interfaces again.
1749 //
1750 pCur = (PUCHAR) &Urb->UrbSelectConfiguration.Interface;
1752 pEnd = ((PUCHAR) Urb) + Urb->UrbSelectConfiguration.Hdr.Length;
1753
1754 //
1755 // Start at the 2nd one since the first is already selected
1756 //
1757 pCur += pIface->Length;
1758
1759 for ( ; pCur < pEnd; pCur += pIface->Length, intfIndex++) {
1760#pragma prefast(suppress: __WARNING_UNUSED_POINTER_ASSIGNMENT, "pIface is used in the for loop in many places. It looks like a false positive")
1762 ASSERT(pIface->NumberOfPipes <= maxNumPipes);
1763
1766
1767 //
1768 // Valid to have an interface with no pipes. If there are no
1769 // pipes, GET_SELECT_INTERFACE_REQUEST_SIZE will compute value
1770 // too small of a size to pass validation.
1771 //
1772 if (pIface->NumberOfPipes > 0) {
1773
1775 pSelectUrb,
1776 (USHORT) pIface->NumberOfPipes,
1777 pIface->AlternateSetting
1778 );
1779 irp = request.m_TrueRequest->GetSubmitFxIrp();
1781
1782 request.m_TrueRequest->ClearFieldsForReuse();
1783 FxFormatUsbRequest(request.m_TrueRequest,
1784 pSelectUrb,
1786 NULL);
1787
1788 status = SubmitSync(request.m_TrueRequest, &options);
1789 if (!NT_SUCCESS(status)) {
1792 "USB core failed Select Interface URB, %!STATUS!",
1793 status);
1794 goto Done;
1795 }
1796
1797 //
1798 // Copy the info back into the original select config URB
1799 //
1800
1801 RtlCopyMemory(pIface,
1802 &pSelectUrb->UrbSelectInterface.Interface,
1803 pSelectUrb->UrbSelectInterface.Interface.Length);
1804 }
1805
1806 //
1807 // Update the pointer to point to the new pipes with the pointer
1808 // to the pipes stored earlier.
1809 //
1810 ASSERT(pPipeInfo[intfIndex].NumPipes == pIface->NumberOfPipes);
1812
1813 //
1814 // The interface now owns the array of pipes
1815 //
1816 pUsbInterface->SetConfiguredPipes(pPipeInfo[intfIndex].Pipes);
1817 pPipeInfo[intfIndex].Pipes = NULL;
1818 pPipeInfo[intfIndex].NumPipes = 0;
1819
1820 //
1821 // SetInfo only after a successful select config so that we can
1822 // copy the USBD_PIPE_INFORMATION .
1823 //
1824 pUsbInterface->SetInfo(pIface);
1825 }
1826 }
1827
1828 if (NumConfiguredInterfaces != NULL) {
1829 *NumConfiguredInterfaces = intfIndex;
1830 }
1831 }
1832 else {
1835 "USB core failed Select Configuration, %!STATUS!", status);
1836 }
1837
1838Done:
1839 if (pSelectUrb != NULL) {
1840 FxPoolFree(pSelectUrb);
1841 pSelectUrb = NULL;
1842 }
1843
1844 if (pPipeInfo != NULL) {
1845 //
1846 // Free all arrays that may have been allocated
1847 //
1848 for (intfIndex = 0; intfIndex < m_NumInterfaces; intfIndex++) {
1849 //
1850 // We can have NumPipes == 0 and still have an allocated array, so
1851 // use the array != NULL as the check.
1852 //
1853 if (pPipeInfo[intfIndex].Pipes != NULL) {
1854 //
1855 // Delete any pipes that might have been created
1856 //
1857 for (iPipe = 0; iPipe < pPipeInfo[intfIndex].NumPipes; iPipe++) {
1858 if (pPipeInfo[intfIndex].Pipes[iPipe] != NULL) {
1859 pPipeInfo[intfIndex].Pipes[iPipe]->DeleteFromFailedCreate();
1860 pPipeInfo[intfIndex].Pipes[iPipe] = NULL;
1861 }
1862 }
1863
1864 //
1865 // Now free the array itself and clear out the count
1866 //
1867 FxPoolFree(pPipeInfo[intfIndex].Pipes);
1868 pPipeInfo[intfIndex].Pipes = NULL;
1869 pPipeInfo[intfIndex].NumPipes = 0;
1870 }
1871 }
1872
1873 FxPoolFree(pPipeInfo);
1874 pPipeInfo = NULL;
1875 }
1876
1877 return status;
1878}
_Must_inspect_result_ NTSTATUS Init(__in CfxDeviceBase *Device)
Definition: fxirp.hpp:28
VOID Reuse(__in NTSTATUS Status=STATUS_SUCCESS)
Definition: fxirpum.cpp:661
VOID CleanupInterfacePipesAndDelete(__in FxUsbInterface *UsbInterface)
friend FxUsbPipe
FxUsbInterface * GetInterfaceFromNumber(__in UCHAR InterfaceNumber)
VOID FormatSelectSettingUrb(__in_bcount(GET_SELECT_INTERFACE_REQUEST_SIZE(NumEndpoints)) PURB Urb, __in USHORT NumEndpoints, __in UCHAR SettingNumber)
VOID SetConfiguredPipes(__in FxUsbPipe **ppPipes)
BOOLEAN IsInterfaceConfigured(VOID)
VOID SetInfo(__in PUSBD_INTERFACE_INFORMATION Interface)
VOID SetNumConfiguredPipes(__in UCHAR NumberOfPipes)
SINGLE_LIST_ENTRY * pCur
FxIrp * irp
if(dx< 0)
Definition: linetemp.h:194
#define for
Definition: utility.h:88
PINTERFACE Interface
Definition: iotypes.h:3250
struct _URB_SELECT_INTERFACE UrbSelectInterface
Definition: usb.h:532
struct _USBD_INTERFACE_INFORMATION * PUSBD_INTERFACE_INFORMATION
#define GET_SELECT_INTERFACE_REQUEST_SIZE(totalPipes)
Definition: usbdlib.h:117
_Must_inspect_result_ _In_ WDFUSBINTERFACE _In_opt_ PWDF_OBJECT_ATTRIBUTES PipesAttributes
Definition: wdfusb.h:2390

Referenced by SelectConfigDescriptor(), SelectConfigInterfaces(), SelectConfigMulti(), and SelectConfigSingle().

◆ SelectConfigAuto()

_Must_inspect_result_ NTSTATUS FxUsbDevice::SelectConfigAuto ( __in PWDF_OBJECT_ATTRIBUTES  PipeAttributes)

◆ SelectConfigDescriptor()

_Must_inspect_result_ NTSTATUS FxUsbDevice::SelectConfigDescriptor ( __in PWDF_OBJECT_ATTRIBUTES  PipeAttributes,
__in PWDF_USB_DEVICE_SELECT_CONFIG_PARAMS  Params 
)

Definition at line 1322 of file fxusbdevice.cpp.

1326{
1327 PUSBD_INTERFACE_LIST_ENTRY pInterfaces;
1328 PURB urb;
1330 ULONG i, size;
1331 PUSB_CONFIGURATION_DESCRIPTOR configurationDescriptor;
1332 PUSB_INTERFACE_DESCRIPTOR* interfaceDescriptors;
1333 ULONG numInterfaces;
1335
1337
1338 configurationDescriptor = Params->Types.Descriptor.ConfigurationDescriptor;
1339 interfaceDescriptors = Params->Types.Descriptor.InterfaceDescriptors;
1340 numInterfaces = Params->Types.Descriptor.NumInterfaceDescriptors;
1341
1342 for (i = 0; i < numInterfaces; i++) {
1343 if (interfaceDescriptors[i] == NULL) {
1345 }
1346 }
1347
1348 //
1349 // eventually size = sizeof(USBD_INTERFACE_LIST_ENTRY) * (numInterfaces + 1)
1350 //
1351 status = RtlULongAdd(numInterfaces, 1, &size);
1352 if (!NT_SUCCESS(status)) {
1353 return status;
1354 }
1355
1356 status = RtlULongMult(size, sizeof(USBD_INTERFACE_LIST_ENTRY), &size);
1357 if (!NT_SUCCESS(status)) {
1358 return status;
1359 }
1360
1361 pInterfaces = (PUSBD_INTERFACE_LIST_ENTRY) FxPoolAllocate(
1363
1364 if (pInterfaces == NULL) {
1366
1369 "Could not allocate array of USBD_INTERFACE_LIST_ENTRY, %!STATUS!",
1370 status);
1371
1372 return status;
1373 }
1374
1375 RtlZeroMemory(pInterfaces, size);
1376
1377 for (i = 0; i < numInterfaces; i++) {
1378 pInterfaces[i].InterfaceDescriptor = interfaceDescriptors[i];
1379 }
1380
1381 if (configurationDescriptor == NULL) {
1382 configurationDescriptor = m_ConfigDescriptor;
1383 }
1384
1385 //
1386 // NOTE:
1387 //
1388 // Creating a config request using the caller's config descriptor does not
1389 // currently work if the provided config descriptor is not the same as the
1390 // descriptor reported by the device. It does not work because we try to
1391 // validate the interface number in the URB against an existing
1392 // FxUsbInterface (which is based on the config descriptor described by the
1393 // device, not the provided one), and if that validation fails, we return
1394 // !NT_SUCCESS from SelectConfig().
1395 //
1397 configurationDescriptor,
1398 pInterfaces,
1400 if (urb == NULL) {
1402 }
1403 else {
1405 FxPoolFree(urb);
1406 urb = NULL;
1407 }
1408
1409 FxPoolFree(pInterfaces);
1410 pInterfaces = NULL;
1411
1412 return status;
1413}
_Must_inspect_result_ NTSTATUS SelectConfig(__in PWDF_OBJECT_ATTRIBUTES PipesAttributes, __in PURB Urb, __in FX_URB_TYPE FxUrbType, __out_opt PUCHAR NumConfiguredInterfaces)
ULONG GetDefaultMaxTransferSize(VOID)
Definition: usbdlib.h:7
PUSB_INTERFACE_DESCRIPTOR InterfaceDescriptor
Definition: usbdlib.h:8
struct _USBD_INTERFACE_LIST_ENTRY * PUSBD_INTERFACE_LIST_ENTRY
PURB FxUsbCreateConfigRequest(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in PUSB_CONFIGURATION_DESCRIPTOR ConfigDesc, __in PUSBD_INTERFACE_LIST_ENTRY InterfaceList, __in ULONG DefaultMaxPacketSize)
Definition: usbutil.cpp:366
_In_ WDFIOTARGET _In_ PWDF_REQUEST_COMPLETION_PARAMS Params
Definition: wdfrequest.h:308

◆ SelectConfigInterfaces()

_Must_inspect_result_ NTSTATUS FxUsbDevice::SelectConfigInterfaces ( __in PWDF_OBJECT_ATTRIBUTES  PipesAttributes,
__in PUSB_CONFIGURATION_DESCRIPTOR  ConfigurationDescriptor,
__in_ecount(NumInterfaces) PUSB_INTERFACE_DESCRIPTOR InterfaceDescriptors,
__in ULONG  NumInterfaces 
)

Definition at line 1929 of file fxusbdevice.cpp.

1935{
1936 PUSBD_INTERFACE_LIST_ENTRY pInterfaces;
1937 PURB urb;
1939 ULONG i, size;
1941
1943
1944 //
1945 // eventually size = sizeof(USBD_INTERFACE_LIST_ENTRY) * (NumInterfaces + 1)
1946 //
1947 status = RtlULongAdd(NumInterfaces, 1, &size);
1948 if (!NT_SUCCESS(status)) {
1949 return status;
1950 }
1951
1952 status = RtlULongMult(size, sizeof(USBD_INTERFACE_LIST_ENTRY), &size);
1953 if (!NT_SUCCESS(status)) {
1954 return status;
1955 }
1956
1957 for (i = 0; i < NumInterfaces; i++) {
1958 if (InterfaceDescriptors[i] == NULL) {
1960 }
1961 }
1962
1963 pInterfaces = (PUSBD_INTERFACE_LIST_ENTRY) FxPoolAllocate(
1966 size
1967 );
1968
1969 if (pInterfaces == NULL) {
1971
1974 "Could not allocate array of USBD_INTERFACE_LIST_ENTRY, %!STATUS!",
1975 status);
1976
1977 return status;
1978 }
1979
1980 RtlZeroMemory(pInterfaces, size);
1981
1982 for (i = 0; i < NumInterfaces; i++) {
1983 pInterfaces[i].InterfaceDescriptor = InterfaceDescriptors[i];
1984 }
1985
1986 if (ConfigurationDescriptor == NULL) {
1987 ConfigurationDescriptor = m_ConfigDescriptor;
1988 }
1989
1991 ConfigurationDescriptor,
1992 pInterfaces,
1994 if (urb == NULL) {
1996 }
1997 else {
1999 FxPoolFree(urb);
2000 urb = NULL;
2001 }
2002
2003 FxPoolFree(pInterfaces);
2004 pInterfaces = NULL;
2005
2006 return status;
2007}

◆ SelectConfigMulti()

_Must_inspect_result_ NTSTATUS FxUsbDevice::SelectConfigMulti ( __in PWDF_OBJECT_ATTRIBUTES  PipeAttributes,
__in PWDF_USB_DEVICE_SELECT_CONFIG_PARAMS  Params 
)

Definition at line 901 of file fxusbdevicekm.cpp.

921{
923 PURB urb;
925 ULONG size;
926 UCHAR i;
928
930
931 Params->Types.MultiInterface.NumberOfConfiguredInterfaces = 0;
932
933 //
934 // The array needs an extra element which is zero'd out to mark the end
935 //
937 pList = (PUSBD_INTERFACE_LIST_ENTRY) FxPoolAllocate(
940 size
941 );
942
943 if (pList == NULL) {
945 }
946
948
950 for (i = 0; i < m_NumInterfaces; i++) {
951 pList[i].InterfaceDescriptor =
953
957 "WDFUSBDEVICE %p could not retrieve AlternateSetting 0 for "
958 "bInterfaceNumber %d", GetHandle(),
959 m_Interfaces[i]->m_InterfaceNumber);
960
962 goto Done;
963 }
964 }
965 }
966 else {
967 //
968 // Type is WdfUsbTargetDeviceSelectConfigTypeInterfacesPairs
969 //
970 UCHAR interfacePairsNum = 0;
971 UCHAR bitArray[UCHAR_MAX/sizeof(UCHAR)];
972
973 //
974 // initialize the bit array
975 //
976 RtlZeroMemory(bitArray, sizeof(bitArray));
977 //
978 // Build a list of descriptors from the Setting pairs
979 // passed in by the user. There could be interfaces not
980 // covered in the setting/interface pairs array passed.
981 // If that is the case return STATUS_INVALID_PARAMETER
982 //
983 for (i = 0; i < Params->Types.MultiInterface.NumberInterfaces ; i++) {
985 UCHAR interfaceNumber;
986 UCHAR altSettingIndex;
987
988 settingPair = &Params->Types.MultiInterface.Pairs[i];
989
991 settingPair->UsbInterface,
992 &interfaceNumber
993 );
994
995 //
996 //convert the interface handle to interface number
997 //
998 if (NT_SUCCESS(status)) {
999 altSettingIndex = settingPair->SettingIndex;
1000
1001 //
1002 // do the following only if the bit is not already set
1003 //
1004 if (FxBitArraySet(&bitArray[0], interfaceNumber) == FALSE) {
1005 pList[interfacePairsNum].InterfaceDescriptor =
1008 interfaceNumber,
1009 altSettingIndex
1010 );
1011
1012 if (pList[interfacePairsNum].InterfaceDescriptor == NULL) {
1017 "WDFUSBDEVICE %p could not retrieve "
1018 "AlternateSetting %d for "
1019 "bInterfaceNumber %d, returning %!STATUS!",
1020 GetHandle(),
1021 altSettingIndex, interfaceNumber, status);
1022 goto Done;
1023 }
1024
1025 interfacePairsNum++;
1026 }
1027 }
1028 else {
1029 goto Done;
1030 }
1031 }
1032
1033 //
1034 // Check if there are any interfaces not specified by the array. If
1035 // there are, then select setting 0 for them.
1036 //
1037 if (m_NumInterfaces > interfacePairsNum) {
1041 "WDFUSBDEVICE %p interface pairs set (%d) is not equal to actual "
1042 "# of interfaces (%d) reported by the device, %!STATUS!",
1043 GetObjectHandle(), interfacePairsNum, m_NumInterfaces, status);
1044 goto Done;
1045 }
1046 } //WdfUsbTargetDeviceSelectConfigTypeInterfacesPairs
1047
1051 pList,
1053 );
1054
1055 if (urb == NULL) {
1057 }
1058 else {
1061 urb,
1063 &Params->Types.MultiInterface.NumberOfConfiguredInterfaces);
1064
1065 FxPoolFree(urb);
1066 urb = NULL;
1067 }
1068
1069Done:
1071 pList = NULL;
1072
1073 return status;
1074}
_Must_inspect_result_ NTSTATUS GetInterfaceNumberFromInterface(__in WDFUSBINTERFACE UsbInterface, __out PUCHAR InterfaceNumber)
PUSB_INTERFACE_DESCRIPTOR GetSettingDescriptor(__in UCHAR Setting)
FxChildList * pList
return pObject GetObjectHandle()
WDFUSBINTERFACE UsbInterface
Definition: wdfusb.h:522
struct _USBD_INTERFACE_LIST_ENTRY USBD_INTERFACE_LIST_ENTRY
PUSB_INTERFACE_DESCRIPTOR FxUsbParseConfigurationDescriptor(__in PUSB_CONFIGURATION_DESCRIPTOR ConfigDesc, __in UCHAR InterfaceNumber, __in UCHAR AlternateSetting)
Definition: usbutil.cpp:309
_In_ WDFUSBINTERFACE _In_ UCHAR _Out_ PUSB_INTERFACE_DESCRIPTOR InterfaceDescriptor
Definition: wdfusb.h:2334
@ WdfUsbTargetDeviceSelectConfigTypeMultiInterface
Definition: wdfusb.h:129

◆ SelectConfigSingle()

_Must_inspect_result_ NTSTATUS FxUsbDevice::SelectConfigSingle ( __in PWDF_OBJECT_ATTRIBUTES  PipeAttributes,
__in PWDF_USB_DEVICE_SELECT_CONFIG_PARAMS  Params 
)

Definition at line 809 of file fxusbdevicekm.cpp.

833{
834 //
835 // The array needs an extra element which is zero'd out to mark the end
836 //
837 USBD_INTERFACE_LIST_ENTRY listEntry[2];
838 PURB urb;
840
841 RtlZeroMemory(&Params->Types.SingleInterface,
842 sizeof(Params->Types.SingleInterface));
843
844 if (m_NumInterfaces > 1) {
846
849 "WDFUSBDEVICE %p cannot be auto configured for a single interface "
850 "since there are %d interfaces on the device, %!STATUS!",
852
853 return status;
854 }
855
856 RtlZeroMemory(&listEntry[0], sizeof(listEntry));
857
858 //
859 // Use AlternateSetting 0 by default
860 //
862
863 if (listEntry[0].InterfaceDescriptor == NULL) {
866 "WDFUSBDEVICE %p could not retrieve AlternateSetting 0 for "
867 "bInterfaceNumber %d", GetHandle(),
868 m_Interfaces[0]->m_InterfaceNumber);
869
871 }
872
875 &listEntry[0],
877
878 if (urb == NULL) {
880 }
881 else {
883
884 if (NT_SUCCESS(status)) {
885 Params->Types.SingleInterface.NumberConfiguredPipes =
887
888 Params->Types.SingleInterface.ConfiguredUsbInterface =
890 }
891
892 FxPoolFree(urb);
893 urb = NULL;
894 }
895
896 return status;
897}
WDFUSBINTERFACE GetHandle(VOID)
UCHAR GetNumConfiguredPipes(VOID)
_Must_inspect_result_ _In_ WDFUSBDEVICE _In_opt_ PWDF_OBJECT_ATTRIBUTES PipeAttributes
Definition: wdfusb.h:1242

◆ SelectInterface()

_Must_inspect_result_ NTSTATUS FxUsbDevice::SelectInterface ( __in PWDF_OBJECT_ATTRIBUTES  PipesAttributes,
__in PURB  Urb 
)

◆ SelectInterfaceByInterface()

_Must_inspect_result_ NTSTATUS FxUsbDevice::SelectInterfaceByInterface ( __in PWDF_OBJECT_ATTRIBUTES  PipesAttributes,
__in PUSB_INTERFACE_DESCRIPTOR  InterfaceDescriptor 
)

◆ SendSyncRequest()

_Must_inspect_result_ NTSTATUS FxUsbDevice::SendSyncRequest ( __in FxSyncRequest *  Request,
__in ULONGLONG  Time 
)
protected

Definition at line 31 of file fxusbdeviceum.cpp.

35{
38
41
42 status = SubmitSync(Request->m_TrueRequest, &options);
43 if (!NT_SUCCESS(status)) {
45 "FxUsbDevice SubmitSync failed");
46 goto Done;
47 }
48
49Done:
50 return status;
51}
static PLARGE_INTEGER Time
Definition: time.c:105

◆ SendSyncUmUrb()

_Must_inspect_result_ NTSTATUS FxUsbDevice::SendSyncUmUrb ( __inout PUMURB  Urb,
__in ULONGLONG  Time,
__in_opt WDFREQUEST  Request = NULL,
__in_opt PWDF_REQUEST_SEND_OPTIONS  Options = NULL 
)
protected

Definition at line 55 of file fxusbdeviceum.cpp.

61{
64 FxSyncRequest request(GetDriverGlobals(), NULL, Request);
65
66 status = request.Initialize();
67 if (!NT_SUCCESS(status)) {
69 "Failed to initialize FxSyncRequest");
70 return status;
71 }
72
73 if (NULL == Options) {
75 }
76
79
80 status = request.m_TrueRequest->ValidateTarget(this);
81 if (NT_SUCCESS(status)) {
82 FxUsbUmFormatRequest(request.m_TrueRequest, &Urb->UmUrbHeader, m_pHostTargetFile);
83 status = SubmitSync(request.m_TrueRequest, Options);
84 if (!NT_SUCCESS(status)) {
86 "FxUsbDevice SubmitSync failed");
87 return status;
88 }
89 }
90
91 return status;
92}
VOID FxUsbUmFormatRequest(__in FxRequestBase *Request, __in_xcount(Urb->Length) PUMURB_HEADER Urb, __in IWudfFile *HostFile, __in BOOLEAN Reuse)
Definition: usbutil.cpp:488

Referenced by FxUsbInterface::MakeAndConfigurePipes(), FxUsbInterface::SelectSettingByIndex(), and FxUsbInterface::SetWinUsbHandle().

◆ Start()

_Must_inspect_result_ NTSTATUS FxUsbDevice::Start ( VOID  )
protectedvirtual

Reimplemented from FxIoTarget.

Definition at line 534 of file fxusbdevice.cpp.

537{
539
541
542 if (NT_SUCCESS(status)) {
545 ULONG i, iInterface;
547 KIRQL irql;
548
550
551 Lock(&irql);
552
553 //
554 // Iterate over all of the interfaces. For each pipe on each interface,
555 // grab all pended i/o for later submission.
556 //
557 for (iInterface = 0; iInterface < m_NumInterfaces; iInterface++){
558
559 pUsbInterface = m_Interfaces[iInterface];
560
561 for (i = 0; i < pUsbInterface->m_NumberOfConfiguredPipes; i++) {
563 }
564 }
565 Unlock(irql);
566
567 //
568 // Since we are going to reference the FxUsbPipe's outside of the
569 // lock and the interface can go away in the meantime, add a reference
570 // (multiple times perhaps) to each FxUsbPipe to make sure it sticks
571 // around.
572 //
573 for (ple = head.Flink; ple != &head; ple = ple->Flink) {
575 pRequest->GetTarget()->ADDREF(this);
576 }
577
578 //
579 // Drain the list of pended requests.
580 //
581 while (!IsListEmpty(&head)) {
583
585
587
589
591
592 //
593 // Release the reference taken above when accumulating pended i/o.
594 //
595 pTarget->RELEASE(this);
596 }
597 }
598
599 return status;
600}
struct outqueuenode * head
Definition: adnsresfilter.c:66
VOID SubmitPendedRequest(__in FxRequestBase *Request)
Definition: fxiotarget.cpp:206
virtual _Must_inspect_result_ NTSTATUS Start(VOID)
Definition: fxiotarget.cpp:282
virtual _Must_inspect_result_ NTSTATUS GotoStartState(__in PLIST_ENTRY RequestListHead, __in BOOLEAN Lock=TRUE)
Definition: fxusbpipe.cpp:1135
FxIoTarget * pTarget
Definition: fxdeviceapi.cpp:97

◆ Stop()

VOID FxUsbDevice::Stop ( __in WDF_IO_TARGET_SENT_IO_ACTION  Action)
protectedvirtual

Reimplemented from FxIoTarget.

Definition at line 605 of file fxusbdevice.cpp.

608{
611 ULONG iPipe, iInterface;
612 KIRQL irql;
613
614 head.Next = NULL;
615
616 //
617 // Stop all of our own I/O first
618 //
620
621 //
622 // if we are just canceling i/o, then we just acquire the spin lock b/c
623 // we can be called at dispatch level for this action code.
624 //
627
628 AcquireInterfaceIterationLock();
629 }
630
631 //
632 // Since we don't have to synchronize on the I/O already sent, just set
633 // each pipe's state to stop.
634 //
635 Lock(&irql);
636
637 for (iInterface = 0; iInterface < m_NumInterfaces; iInterface++) {
638 pUsbInterface = m_Interfaces[iInterface];
639
641 for (iPipe = 0;
643 iPipe++) {
644
645 if (pUsbInterface->m_ConfiguredPipes[iPipe] != NULL) {
646 BOOLEAN wait;
647
648 wait = FALSE;
649
651 Action,
652 &head,
653 &wait,
654 TRUE
655 );
656 }
657 }
658 }
659 }
660 Unlock(irql);
661
662 //
663 // If we are leaving sent IO pending, the io target will set the IO
664 // completion event during stop even if there is still outstanding IO.
665 //
666
667 if (head.Next != NULL) {
669 }
670
671 for (iInterface = 0; iInterface < m_NumInterfaces; iInterface++) {
672 pUsbInterface = m_Interfaces[iInterface];
673
675 //
676 // Iterate over the pipes and clean each one up
677 //
678 for (iPipe = 0;
680 iPipe++) {
681 //
682 // Same reason as above
683 //
684 if (pUsbInterface->m_ConfiguredPipes[iPipe] != NULL) {
687 }
688 }
689 }
690 }
691
693 ReleaseInterfaceIterationLock();
694 }
695}
virtual VOID Stop(__in WDF_IO_TARGET_SENT_IO_ACTION Action)
Definition: fxiotarget.cpp:748
virtual VOID GotoStopState(__in WDF_IO_TARGET_SENT_IO_ACTION Action, __in PSINGLE_LIST_ENTRY SentRequestListHead, __out PBOOLEAN Wait, __in BOOLEAN LockSelf)
Definition: fxusbpipe.cpp:1219
HRESULT Next([in] ULONG celt, [out, size_is(celt), length_is(*pceltFetched)] STATPROPSETSTG *rgelt, [out] ULONG *pceltFetched)
@ WdfIoTargetLeaveSentIoPending
Definition: wdfiotarget.h:73

Member Data Documentation

◆ FxUsbInterface

friend FxUsbDevice::FxUsbInterface

Definition at line 186 of file fxusbdevice.hpp.

Referenced by CreateInterfaces().

◆ FxUsbPipe

friend FxUsbDevice::FxUsbPipe

Definition at line 185 of file fxusbdevice.hpp.

Referenced by SelectConfig().

◆ m_BusInterfaceContext

PVOID FxUsbDevice::m_BusInterfaceContext
protected

Definition at line 635 of file fxusbdevice.hpp.

Referenced by FxUsbDevice(), GetCurrentFrameNumber(), InitDevice(), and ~FxUsbDevice().

◆ m_BusInterfaceDereference

PINTERFACE_DEREFERENCE FxUsbDevice::m_BusInterfaceDereference
protected

Definition at line 637 of file fxusbdevice.hpp.

Referenced by FxUsbDevice(), InitDevice(), and ~FxUsbDevice().

◆ m_ConfigDescriptor

◆ m_ConfigHandle

USBD_CONFIGURATION_HANDLE FxUsbDevice::m_ConfigHandle
protected

◆ m_ControlPipe

USBD_PIPE_HANDLE FxUsbDevice::m_ControlPipe
protected

Definition at line 621 of file fxusbdevice.hpp.

Referenced by FxUsbDevice(), GetControlPipeHandle(), and InitDevice().

◆ m_DeviceDescriptor

USB_DEVICE_DESCRIPTOR FxUsbDevice::m_DeviceDescriptor
protected

Definition at line 627 of file fxusbdevice.hpp.

Referenced by CopyDeviceDescriptor(), FxUsbDevice(), and InitDevice().

◆ m_HcdPortCapabilities

ULONG FxUsbDevice::m_HcdPortCapabilities
protected

Definition at line 641 of file fxusbdevice.hpp.

Referenced by FxUsbDevice(), GetInformation(), and InitDevice().

◆ m_InterfaceIterationLock

FxWaitLockInternal FxUsbDevice::m_InterfaceIterationLock
protected

Definition at line 639 of file fxusbdevice.hpp.

Referenced by _Acquires_lock_(), and _Releases_lock_().

◆ m_Interfaces

◆ m_MismatchedInterfacesInConfigDescriptor

BOOLEAN FxUsbDevice::m_MismatchedInterfacesInConfigDescriptor
protected

◆ m_NumInterfaces

◆ m_OnUSBD

BOOLEAN FxUsbDevice::m_OnUSBD
protected

Definition at line 645 of file fxusbdevice.hpp.

Referenced by FxUsbDevice(), InitDevice(), and OnUSBD().

◆ m_pHostTargetFile

IWudfFile* FxUsbDevice::m_pHostTargetFile
private

◆ m_QueryBusTime

PUSB_BUSIFFN_QUERY_BUS_TIME FxUsbDevice::m_QueryBusTime
protected

Definition at line 633 of file fxusbdevice.hpp.

Referenced by FxUsbDevice(), GetCurrentFrameNumber(), and InitDevice().

◆ m_Traits

ULONG FxUsbDevice::m_Traits
protected

◆ m_UrbType

FX_URB_TYPE FxUsbDevice::m_UrbType
protected

Definition at line 651 of file fxusbdevice.hpp.

Referenced by FxUsbDevice(), GetFxUrbTypeForRequest(), GetUrbType(), and InitDevice().

◆ m_USBDHandle

USBD_HANDLE FxUsbDevice::m_USBDHandle
protected

◆ m_UsbdVersionInformation

USBD_VERSION_INFORMATION FxUsbDevice::m_UsbdVersionInformation
protected

Definition at line 631 of file fxusbdevice.hpp.

Referenced by FxUsbDevice(), GetInformation(), and InitDevice().

◆ m_WinUsbHandle

WINUSB_INTERFACE_HANDLE FxUsbDevice::m_WinUsbHandle
private

Definition at line 663 of file fxusbdevice.hpp.

Referenced by FxUsbDevice(), and FxUsbInterface::SetWinUsbHandle().


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