21#ifndef _FXUSBDEVICE_H_
22#define _FXUSBDEVICE_H_
43 __in USBD_HANDLE USBDHandle
105 __in USBD_HANDLE USBDHandle
160 __in USBD_HANDLE USBDHandle,
181#define FX_USB_DEVICE_TAG 'sUfD'
195 __in ULONG USBDClientContractVersionForWdfClient
436 PVOID CapabilityBuffer,
454#pragma warning(disable:28285)
559 AcquireInterfaceIterationLock(
568 ReleaseInterfaceIterationLock(
600#if (FX_CORE_MODE == FX_CORE_USER_MODE)
653#if (FX_CORE_MODE == FX_CORE_USER_MODE)
__inline PFX_DRIVER_GLOBALS GetDriverGlobals(VOID)
_Must_inspect_result_ NTSTATUS CreateInterfaces(VOID)
_Must_inspect_result_ NTSTATUS SelectConfigAuto(__in PWDF_OBJECT_ATTRIBUTES PipeAttributes)
virtual VOID Purge(__in WDF_IO_TARGET_PURGE_IO_ACTION Action)
_Must_inspect_result_ NTSTATUS Reset(VOID)
WDFUSBPIPE GetInterfacePipeReferenced(__in UCHAR InterfaceNumber, __in UCHAR EndpointNumber)
virtual BOOLEAN Dispose(VOID)
__inline VOID CopyDeviceDescriptor(__out PUSB_DEVICE_DESCRIPTOR UsbDeviceDescriptor)
WINUSB_INTERFACE_HANDLE m_WinUsbHandle
VOID PipesGotoRemoveState(__in BOOLEAN ForceRemovePipes)
USBD_PIPE_HANDLE m_ControlPipe
_Must_inspect_result_ NTSTATUS SelectConfig(__in PWDF_OBJECT_ATTRIBUTES PipesAttributes, __in PURB Urb, __in FX_URB_TYPE FxUrbType, __out_opt PUCHAR NumConfiguredInterfaces)
VOID CleanupInterfacePipesAndDelete(__in FxUsbInterface *UsbInterface)
USB_DEVICE_DESCRIPTOR m_DeviceDescriptor
_Must_inspect_result_ NTSTATUS FormatCycleRequest(__in FxRequestBase *Request)
_Acquires_lock_(_Global_critical_region_) VOID AcquireInterfaceIterationLock(VOID)
_Must_inspect_result_ NTSTATUS IsConnected(VOID)
_Must_inspect_result_ __inline NTSTATUS GetCurrentFrameNumber(__in PULONG Current)
_Must_inspect_result_ NTSTATUS FormatStringRequest(__in FxRequestBase *Request, __in FxRequestBuffer *RequestBuffer, __in UCHAR StringIndex, __in USHORT LangID)
_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)
PINTERFACE_DEREFERENCE m_BusInterfaceDereference
__inline USBD_CONFIGURATION_HANDLE GetConfigHandle(VOID)
_Releases_lock_(_Global_critical_region_) VOID ReleaseInterfaceIterationLock(VOID)
_Must_inspect_result_ NTSTATUS SendSyncUmUrb(__inout PUMURB Urb, __in ULONGLONG Time, __in_opt WDFREQUEST Request=NULL, __in_opt PWDF_REQUEST_SEND_OPTIONS Options=NULL)
PUSB_BUSIFFN_QUERY_BUS_TIME m_QueryBusTime
USBD_VERSION_INFORMATION m_UsbdVersionInformation
_Must_inspect_result_ NTSTATUS GetPortStatus(__out PULONG PortStatus)
IWudfFile * m_pHostTargetFile
VOID RemoveDeletedInterface(__in FxUsbInterface *Interface)
USBD_PIPE_HANDLE GetControlPipeHandle(VOID)
ULONG GetDefaultMaxTransferSize(VOID)
UCHAR GetInterfaceNumEndpoints(__in UCHAR InterfaceNumber)
BOOLEAN IsObjectDisposedOnRemove(__in FxObject *Object)
static VOID _CleanupPipesRequests(__in PLIST_ENTRY PendHead, __in PSINGLE_LIST_ENTRY SentHead)
__checkReturn NTSTATUS CreateUrb(__in_opt PWDF_OBJECT_ATTRIBUTES Attributes, __out WDFMEMORY *UrbMemory, __deref_opt_out_bcount(sizeof(URB)) PURB *Urb)
_Must_inspect_result_ NTSTATUS SendSyncRequest(__in FxSyncRequest *Request, __in ULONGLONG Time)
_Must_inspect_result_ NTSTATUS CyclePort(VOID)
FxUsbInterface * GetInterfaceFromIndex(__in UCHAR InterfaceIndex)
_Must_inspect_result_ NTSTATUS GetConfigDescriptor(__out PVOID ConfigDescriptor, __inout PUSHORT ConfigDescriptorLength)
PUSB_CONFIGURATION_DESCRIPTOR m_ConfigDescriptor
BOOLEAN HasMismatchedInterfacesInConfigDescriptor(VOID)
_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)
UCHAR GetNumInterfaces(VOID)
FxWaitLockInternal m_InterfaceIterationLock
ULONG m_HcdPortCapabilities
_Must_inspect_result_ NTSTATUS SelectInterfaceByInterface(__in PWDF_OBJECT_ATTRIBUTES PipesAttributes, __in PUSB_INTERFACE_DESCRIPTOR InterfaceDescriptor)
__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)
_Must_inspect_result_ NTSTATUS FormatControlRequest(__in FxRequestBase *Request, __in PWDF_USB_CONTROL_SETUP_PACKET Packet, __in FxRequestBuffer *RequestBuffer)
_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)
PVOID m_BusInterfaceContext
_Must_inspect_result_ NTSTATUS GetInterfaceNumberFromInterface(__in WDFUSBINTERFACE UsbInterface, __out PUCHAR InterfaceNumber)
FX_URB_TYPE GetFxUrbTypeForRequest(__in FxRequestBase *Request)
_Must_inspect_result_ NTSTATUS SelectInterface(__in PWDF_OBJECT_ATTRIBUTES PipesAttributes, __in PURB Urb)
_Must_inspect_result_ NTSTATUS InitDevice(__in ULONG USBDClientContractVersionForWdfClient)
_Must_inspect_result_ NTSTATUS SelectConfigSingle(__in PWDF_OBJECT_ATTRIBUTES PipeAttributes, __in PWDF_USB_DEVICE_SELECT_CONFIG_PARAMS Params)
_Must_inspect_result_ NTSTATUS Deconfig(VOID)
FxUsbInterface ** m_Interfaces
FX_URB_TYPE GetUrbType(VOID)
VOID FormatInterfaceSelectSettingUrb(__in PURB Urb, __in USHORT NumEndpoints, __in UCHAR InterfaceNumber, __in UCHAR SettingNumber)
FxUsbInterface * GetInterfaceFromNumber(__in UCHAR InterfaceNumber)
_Must_inspect_result_ NTSTATUS SelectConfigMulti(__in PWDF_OBJECT_ATTRIBUTES PipeAttributes, __in PWDF_USB_DEVICE_SELECT_CONFIG_PARAMS Params)
USBD_HANDLE GetUSBDHandle(VOID)
_Must_inspect_result_ NTSTATUS SelectConfigDescriptor(__in PWDF_OBJECT_ATTRIBUTES PipeAttributes, __in PWDF_USB_DEVICE_SELECT_CONFIG_PARAMS Params)
USBD_CONFIGURATION_HANDLE m_ConfigHandle
BOOLEAN m_MismatchedInterfacesInConfigDescriptor
virtual BOOLEAN Dispose(VOID)
VOID(WINAPI * PINTERFACE_DEREFERENCE)(PVOID Context)
#define __drv_when(cond, annotes)
return pRequest GetInformation()
enum _FX_URB_TYPE FX_URB_TYPE
_Outptr_ PUSB_DEVICE_HANDLE _In_ PUSB_DEVICE_HANDLE _In_ USHORT PortStatus
_In_opt_ PVOID _Out_ BOOLEAN * Stop
static PLARGE_INTEGER Time
_In_ NDIS_HANDLE _In_ PNDIS_PACKET Packet
#define _Must_inspect_result_
#define __deref_out_range(x, y)
#define __out_bcount_part_opt(size, length)
#define __deref_opt_out_bcount(size)
_URB_CONTROL_TRANSFER * m_Urb
~FxUsbDeviceControlContext(VOID)
virtual VOID ReleaseAndRestore(__in FxRequestBase *Request)
USBD_STATUS GetUsbdStatus(VOID)
_URB_CONTROL_TRANSFER m_UrbLegacy
virtual VOID CopyParameters(__in FxRequestBase *Request)
__checkReturn NTSTATUS AllocateUrb(__in USBD_HANDLE USBDHandle)
VOID StoreAndReferenceMemory(__in FxUsbDevice *Device, __in FxRequestBuffer *Buffer, __in PWDF_USB_CONTROL_SETUP_PACKET SetupPacket)
virtual VOID Dispose(VOID)
virtual VOID Dispose(VOID)
VOID SetUrbInfo(__in UCHAR StringIndex, __in USHORT LangID)
PUSB_STRING_DESCRIPTOR m_StringDescriptor
ULONG m_StringDescriptorLength
virtual VOID CopyParameters(__in FxRequestBase *Request)
_Must_inspect_result_ NTSTATUS AllocateDescriptor(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in size_t BufferSize)
USBD_STATUS GetUsbdStatus(VOID)
~FxUsbDeviceStringContext(VOID)
__checkReturn NTSTATUS AllocateUrb(__in USBD_HANDLE USBDHandle)
_URB_CONTROL_DESCRIPTOR_REQUEST m_UrbLegacy
_URB_CONTROL_DESCRIPTOR_REQUEST * m_Urb
#define RtlCopyMemory(Destination, Source, Length)
#define STATUS_UNSUCCESSFUL
_Must_inspect_result_ NTSTATUS(USB_BUSIFFN * PUSB_BUSIFFN_QUERY_BUS_TIME)(_In_ PVOID, _Out_opt_ PULONG)
_In_ PVOID _In_ LONG InterfaceNumber
_Must_inspect_result_ _In_ WDFDEVICE Device
_Must_inspect_result_ _In_ WDFCOLLECTION _In_ WDFOBJECT Object
_Must_inspect_result_ _In_ WDFDMAENABLER _In_ _In_opt_ PWDF_OBJECT_ATTRIBUTES Attributes
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ ULONG _Out_ PULONG ResultLength
_In_ PWDFDEVICE_INIT _In_ PWDF_REMOVE_LOCK_OPTIONS Options
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFSTRING String
_Must_inspect_result_ _In_ WDFDEVICE _In_ LPCGUID _Out_ PINTERFACE Interface
enum _WDF_IO_TARGET_PURGE_IO_ACTION WDF_IO_TARGET_PURGE_IO_ACTION
enum _WDF_IO_TARGET_SENT_IO_ACTION WDF_IO_TARGET_SENT_IO_ACTION
_In_ WDFIOTARGET _In_ _Strict_type_match_ WDF_IO_TARGET_SENT_IO_ACTION Action
_In_ WDFMEMORY _Out_opt_ size_t * BufferSize
_In_ WDFIOTARGET _In_ PWDF_REQUEST_COMPLETION_PARAMS Params
_In_ WDFREQUEST _In_ NTSTATUS _In_ ULONG_PTR Information
_In_ WDFUSBINTERFACE UsbInterface
_Must_inspect_result_ _In_ WDFUSBDEVICE _In_opt_ PWDF_OBJECT_ATTRIBUTES PipeAttributes
_In_ WDFUSBINTERFACE _In_ UCHAR _Out_ PUSB_INTERFACE_DESCRIPTOR InterfaceDescriptor
_Must_inspect_result_ _In_ WDFUSBDEVICE _In_ CONST GUID _In_ ULONG CapabilityBufferLength
_In_ WDFUSBDEVICE _Out_ PUSB_DEVICE_DESCRIPTOR UsbDeviceDescriptor
_Must_inspect_result_ _In_ WDFUSBDEVICE _In_ WDFREQUEST _In_ WDFMEMORY UrbMemory
_Must_inspect_result_ _In_ WDFUSBDEVICE _Out_writes_bytes_to_opt_ ConfigDescriptorLength PVOID ConfigDescriptor
_Must_inspect_result_ _In_ WDFUSBDEVICE _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ ULONG NumberOfIsochPackets
_Must_inspect_result_ _In_ WDFUSBDEVICE _Out_writes_bytes_to_opt_ ConfigDescriptorLength PVOID _Inout_ PUSHORT ConfigDescriptorLength
_Must_inspect_result_ _In_ WDFUSBDEVICE _In_opt_ WDFREQUEST _In_opt_ PWDF_REQUEST_SEND_OPTIONS _Out_writes_opt_ NumCharacters PUSHORT _Inout_ PUSHORT NumCharacters
_Must_inspect_result_ _In_ WDFUSBDEVICE _In_ CONST GUID * CapabilityType
_Must_inspect_result_ _In_ WDFUSBDEVICE _In_opt_ WDFREQUEST _In_opt_ PWDF_REQUEST_SEND_OPTIONS _Out_writes_opt_ NumCharacters PUSHORT _Inout_ PUSHORT _In_ UCHAR StringIndex
_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
_In_ WDFUSBDEVICE _In_ UCHAR InterfaceIndex
_Must_inspect_result_ _In_ WDFUSBDEVICE _In_opt_ WDFREQUEST _In_opt_ PWDF_REQUEST_SEND_OPTIONS _In_ PWDF_USB_CONTROL_SETUP_PACKET SetupPacket
_Must_inspect_result_ _In_ WDFUSBINTERFACE _In_opt_ PWDF_OBJECT_ATTRIBUTES PipesAttributes