ReactOS 0.4.16-dev-1946-g52006dd
fxusbdeviceapi.cpp File Reference
#include "fxusbpch.hpp"
Include dependency graph for fxusbdeviceapi.cpp:

Go to the source code of this file.

Functions

_Must_inspect_result_ __drv_maxIRQL (PASSIVE_LEVEL) NTSTATUS WDFAPI FxUsbTargetDeviceCreate(__in PFX_DRIVER_GLOBALS FxDriverGlobals
 
 FxPointerNotNull (FxDriverGlobals, UsbDevice)
 
 if (!NT_SUCCESS(status))
 
 if (pUsbDevice==NULL)
 
 if (NT_SUCCESS(status))
 
 FxObjectHandleGetPtrAndGlobals (GetFxDriverGlobals(DriverGlobals), Device, FX_TYPE_DEVICE_BASE,(PVOID *)&pDevice, &pFxDriverGlobals)
 
return FxUsbTargetDeviceCreate (pFxDriverGlobals, pDevice, USBD_CLIENT_CONTRACT_VERSION_INVALID, Attributes, UsbDevice)
 
 FxPointerNotNull (pFxDriverGlobals, Config)
 
 if (Config->Size !=sizeof(WDF_USB_DEVICE_CREATE_CONFIG))
 
return FxUsbTargetDeviceCreate (pFxDriverGlobals, pDevice, Config->USBDClientContractVersion, Attributes, UsbDevice)
 
_Must_inspect_result_ __drv_maxIRQL (DISPATCH_LEVEL) NTSTATUS WDFAPI NTAPI WDFEXPORT(WdfUsbTargetDeviceRetrieveInformation)(__in PWDF_DRIVER_GLOBALS DriverGlobals
 
 FxObjectHandleGetPtrAndGlobals (GetFxDriverGlobals(DriverGlobals), UsbDevice, FX_TYPE_IO_TARGET_USB_DEVICE,(PVOID *) &pUsbDevice, &pFxDriverGlobals)
 
 FxPointerNotNull (pFxDriverGlobals, Information)
 
 if (Information->Size !=sizeof(WDF_USB_DEVICE_INFORMATION))
 
pUsbDevice GetInformation (Information)
 
 FxPointerNotNull (pFxDriverGlobals, UsbDeviceDescriptor)
 
pUsbDevice CopyDeviceDescriptor (UsbDeviceDescriptor)
 
 FxPointerNotNull (pFxDriverGlobals, ConfigDescriptorLength)
 
return pUsbDevice GetConfigDescriptor (ConfigDescriptor, ConfigDescriptorLength)
 
 FxPointerNotNull (pFxDriverGlobals, NumCharacters)
 
 FxPointerNotNull (pFxDriverGlobals, StringMemory)
 
 if (NumCharacters !=NULL)
 
 if (NT_SUCCESS(status) &&numChars > 0)
 
 DoTraceLevelMessage (pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGIOTARGET, "WDFUSBDEVICE %p, WDFREQUEST %p, WDFMEMORY %p, StringIndex %d, LandID 0x%x", UsbDevice, Request, Memory, StringIndex, LangID)
 
 FxObjectHandleGetPtr (pFxDriverGlobals, Memory, IFX_TYPE_MEMORY,(PVOID *) &pMemory)
 
 FxObjectHandleGetPtr (pFxDriverGlobals, Request, FX_TYPE_REQUEST,(PVOID *) &pRequest)
 
buf SetMemory (pMemory, Offset)
 
 if ((bufferSize % sizeof(WCHAR)) !=0)
 
 DoTraceLevelMessage (pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGIOTARGET, "WDFUSBDEVICE %p, WDFREQUEST %p, WDFMEMORY %p, %!STATUS!", UsbDevice, Request, Memory, status)
 
 FxPointerNotNull (pFxDriverGlobals, Params)
 
 if (Params->Size !=sizeof(WDF_USB_DEVICE_SELECT_CONFIG_PARAMS))
 
 if (Params->Type< WdfUsbTargetDeviceSelectConfigTypeDeconfig||Params->Type > WdfUsbTargetDeviceSelectConfigTypeUrb)
 
 if ((Params->Type==WdfUsbTargetDeviceSelectConfigTypeDeconfig)||(Params->Type==WdfUsbTargetDeviceSelectConfigTypeUrb)||(Params->Type==WdfUsbTargetDeviceSelectConfigTypeInterfacesDescriptor))
 
 if (pUsbDevice->HasMismatchedInterfacesInConfigDescriptor())
 
 switch (Params->Type)
 
 FxObjectHandleGetPtr (GetFxDriverGlobals(DriverGlobals), UsbDevice, FX_TYPE_IO_TARGET_USB_DEVICE,(PVOID *) &pUsbDevice)
 
return pUsbDevice GetNumInterfaces ()
 
return pUsbDevice GetConfigHandle ()
 
FxSyncRequest request (pFxDriverGlobals, &context, Request)
 
 DoTraceLevelMessage (pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGIOTARGET, "WDFUSBDEVICE %p control transfer sync", UsbDevice)
 
 FxPointerNotNull (pFxDriverGlobals, SetupPacket)
 
 DoTraceLevelMessage (pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGIOTARGET, "WDFUSBDEVICE %p, %!STATUS!", UsbDevice, status)
 
 DoTraceLevelMessage (pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGIOTARGET, "WDFUSBDEVICE %p, WDFREQUEST %p, WDFMEMORY %p", UsbDevice, Request, TransferMemory)
 
 if (TransferMemory !=NULL)
 
 DoTraceLevelMessage (pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGIOTARGET, "format control request WDFUSBDEVICE %p, WDFREQWUEST %p, WDFMEMORY %p, %!STATUS!", UsbDevice, Request, TransferMemory, status)
 
__checkReturn __in WDFUSBDEVICE __in_opt PWDF_OBJECT_ATTRIBUTES __in ULONG __out WDFMEMORY __deref_opt_out_bcount (GET_ISOCH_URB_SIZE(NumberOfIsochPackets)) PURB *Urb)
 
 if (pUsbInterface !=NULL)
 
_Must_inspect_result_ __in WDFUSBDEVICE __in CONST GUID __in ULONG __drv_when (CapabilityBufferLength==0, __out_opt) __drv_when(CapabilityBufferLength !=0 &&ResultLength
 
_Must_inspect_result_ __in WDFUSBDEVICE __in CONST GUID __in ULONG __out_bcount (CapabilityBufferLength)) __drv_when(CapabilityBufferLength !=0 &&ResultLength !
 
_Must_inspect_result_ __in WDFUSBDEVICE __in CONST GUID __in ULONG __out_bcount_part_opt (CapabilityBufferLength, *ResultLength)) PVOID CapabilityBuffer
 
_Must_inspect_result_ __in WDFUSBDEVICE __in CONST GUID __in ULONG __out_opt __drv_when (ResultLength !=NULL, __deref_out_range(<=, CapabilityBufferLength)) PULONG ResultLength)
 

Variables

_Must_inspect_result_ __in FxDeviceBaseDevice
 
_Must_inspect_result_ __in FxDeviceBase __in ULONG USBDClientContractVersion
 
_Must_inspect_result_ __in FxDeviceBase __in ULONG __in_opt PWDF_OBJECT_ATTRIBUTES Attributes
 
_Must_inspect_result_ __in FxDeviceBase __in ULONG __in_opt PWDF_OBJECT_ATTRIBUTES __out WDFUSBDEVICE * UsbDevice
 
NTSTATUS status = FxVerifierCheckIrqlLevel(FxDriverGlobals, PASSIVE_LEVEL)
 
 pUsbDevice = new(FxDriverGlobals, Attributes) FxUsbDevice(FxDriverGlobals)
 
PFX_DRIVER_GLOBALS pFxDriverGlobals
 
FxDeviceBasepDevice
 
__checkReturn __in WDFDEVICE __in PWDF_USB_DEVICE_CREATE_CONFIG Config
 
_Must_inspect_result_ __in WDFUSBDEVICE __out PWDF_USB_DEVICE_INFORMATION Information
 
return STATUS_SUCCESS
 
__in WDFUSBDEVICE __out PUSB_DEVICE_DESCRIPTOR UsbDeviceDescriptor
 
_Must_inspect_result_ __in WDFUSBDEVICE __out_bcount_part_opt ConfigDescriptorLength PVOID ConfigDescriptor
 
_Must_inspect_result_ __in WDFUSBDEVICE __out_bcount_part_opt ConfigDescriptorLength PVOID __inout PUSHORT ConfigDescriptorLength
 
_Must_inspect_result_ __in WDFUSBDEVICE __in_opt WDFREQUEST Request
 
_Must_inspect_result_ __in WDFUSBDEVICE __in_opt WDFREQUEST __in_opt PWDF_REQUEST_SEND_OPTIONS RequestOptions
 
_Must_inspect_result_ __in WDFUSBDEVICE __in_opt WDFREQUEST __in_opt PWDF_REQUEST_SEND_OPTIONS __out_ecount_opt NumCharacters PUSHORT String
 
_Must_inspect_result_ __in WDFUSBDEVICE __in_opt WDFREQUEST __in_opt PWDF_REQUEST_SEND_OPTIONS __out_ecount_opt NumCharacters PUSHORT __inout PUSHORT NumCharacters
 
_Must_inspect_result_ __in WDFUSBDEVICE __in_opt WDFREQUEST __in_opt PWDF_REQUEST_SEND_OPTIONS __out_ecount_opt NumCharacters PUSHORT __inout PUSHORT __in UCHAR StringIndex
 
_Must_inspect_result_ __in WDFUSBDEVICE __in_opt WDFREQUEST __in_opt PWDF_REQUEST_SEND_OPTIONS __out_ecount_opt NumCharacters PUSHORT __inout PUSHORT __in UCHAR __in_opt USHORT LangID
 
_Must_inspect_result_ __in WDFUSBDEVICE __in_opt PWDF_OBJECT_ATTRIBUTES StringMemoryAttributes
 
_Must_inspect_result_ __in WDFUSBDEVICE __in_opt PWDF_OBJECT_ATTRIBUTES __out WDFMEMORY * StringMemory = NULL
 
WDFMEMORY hMemory
 
USHORT numChars = 0
 
_Must_inspect_result_ __in WDFUSBDEVICE __in WDFREQUEST __in WDFMEMORY Memory
 
_Must_inspect_result_ __in WDFUSBDEVICE __in WDFREQUEST __in WDFMEMORY __in_opt PWDFMEMORY_OFFSET Offset
 
IFxMemorypMemory
 
FxRequestBuffer buf
 
FxRequestpRequest
 
size_t bufferSize = buf.GetBufferLength()
 
_Must_inspect_result_ __in WDFUSBDEVICE __in_opt PWDF_OBJECT_ATTRIBUTES PipesAttributes
 
_Must_inspect_result_ __in WDFUSBDEVICE __in_opt PWDF_OBJECT_ATTRIBUTES __inout PWDF_USB_DEVICE_SELECT_CONFIG_PARAMS Params
 
_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 WDFUSBDEVICE __in_opt WDFREQUEST __in_opt PWDF_REQUEST_SEND_OPTIONS __in PWDF_USB_CONTROL_SETUP_PACKET __in_opt PWDF_MEMORY_DESCRIPTOR MemoryDescriptor
 
_Must_inspect_result_ __in WDFUSBDEVICE __in_opt WDFREQUEST __in_opt PWDF_REQUEST_SEND_OPTIONS __in PWDF_USB_CONTROL_SETUP_PACKET __in_opt PWDF_MEMORY_DESCRIPTOR __out_opt PULONG BytesTransferred
 
FxUsbDeviceControlContext context (FxUrbTypeLegacy)
 
_Must_inspect_result_ __in WDFUSBDEVICE __in WDFREQUEST __in PWDF_USB_CONTROL_SETUP_PACKET __in_opt WDFMEMORY TransferMemory
 
_Must_inspect_result_ __in WDFUSBDEVICE __in WDFREQUEST __in PWDF_USB_CONTROL_SETUP_PACKET __in_opt WDFMEMORY __in_opt PWDFMEMORY_OFFSET TransferOffset
 
 else
 
__checkReturn __in WDFUSBDEVICE __in_opt PWDF_OBJECT_ATTRIBUTES __in ULONG NumberOfIsochPackets
 
__checkReturn __in WDFUSBDEVICE __in_opt PWDF_OBJECT_ATTRIBUTES __in ULONG __out WDFMEMORY * UrbMemory
 
__in WDFUSBDEVICE __in UCHAR InterfaceIndex
 
FxUsbInterfacepUsbInterface = pUsbDevice->GetInterfaceFromIndex(InterfaceIndex)
 
return NULL
 
_Must_inspect_result_ __in WDFUSBDEVICE __in CONST GUIDCapabilityType
 
_Must_inspect_result_ __in WDFUSBDEVICE __in CONST GUID __in ULONG CapabilityBufferLength
 

Function Documentation

◆ __deref_opt_out_bcount()

__checkReturn __in WDFUSBDEVICE __in_opt PWDF_OBJECT_ATTRIBUTES __in ULONG __out WDFMEMORY __deref_opt_out_bcount ( GET_ISOCH_URB_SIZE(NumberOfIsochPackets )

Definition at line 1253 of file fxusbdeviceapi.cpp.

1284{
1285 DDI_ENTRY();
1286
1290
1292 UsbDevice,
1294 (PVOID*) &pUsbDevice,
1296
1297 //
1298 // Basic parameter validation
1299 //
1301
1302 if (pUsbDevice->GetUSBDHandle() == NULL) {
1304
1307 "USBDEVICE Must have been created with Client Contract Verion Info, %!STATUS!",
1308 status);
1309
1310 return status;
1311 }
1312
1313 status = pUsbDevice->CreateIsochUrb(Attributes,
1315 UrbMemory,
1316 Urb);
1317
1318 return status;
1319}
LONG NTSTATUS
Definition: precomp.h:26
#define TRACINGIOTARGET
Definition: dbgtrace.h:72
__inline PFX_DRIVER_GLOBALS GetFxDriverGlobals(__in PWDF_DRIVER_GLOBALS DriverGlobals)
Definition: fxglobals.h:597
#define DDI_ENTRY()
Definition: fxglobalskm.h:56
#define FxPointerNotNull(FxDriverGlobals, Ptr)
Definition: fxmacros.hpp:253
@ FX_TYPE_IO_TARGET_USB_DEVICE
Definition: fxtypes.h:102
return NULL
pUsbDevice
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGIOTARGET, "WDFUSBDEVICE %p, WDFREQUEST %p, WDFMEMORY %p, StringIndex %d, LandID 0x%x", UsbDevice, Request, Memory, StringIndex, LangID)
NTSTATUS status
FxObjectHandleGetPtrAndGlobals(GetFxDriverGlobals(DriverGlobals), Device, FX_TYPE_DEVICE_BASE,(PVOID *)&pDevice, &pFxDriverGlobals)
PFX_DRIVER_GLOBALS pFxDriverGlobals
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
Definition: ps.c:97
#define STATUS_INVALID_DEVICE_STATE
Definition: udferr_usr.h:178
_In_ PIO_STACK_LOCATION _In_ PURB Urb
Definition: usbdlib.h:267
_Must_inspect_result_ _In_ WDFDMAENABLER _In_ _In_opt_ PWDF_OBJECT_ATTRIBUTES Attributes
_Must_inspect_result_ _In_ WDFUSBDEVICE _In_ WDFREQUEST _In_ WDFMEMORY UrbMemory
Definition: wdfusb.h:1576
_Must_inspect_result_ _In_ WDFDEVICE _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFUSBDEVICE * UsbDevice
Definition: wdfusb.h:906
_Must_inspect_result_ _In_ WDFUSBDEVICE _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ ULONG NumberOfIsochPackets
Definition: wdfusb.h:1703

◆ __drv_maxIRQL() [1/2]

◆ __drv_maxIRQL() [2/2]

_Must_inspect_result_ __drv_maxIRQL ( PASSIVE_LEVEL  )

◆ __drv_when() [1/2]

_Must_inspect_result_ __in WDFUSBDEVICE __in CONST GUID __in ULONG __drv_when ( CapabilityBufferLength  = = 0,
__out_opt   
) &&
pure virtual

◆ __drv_when() [2/2]

Definition at line 1393 of file fxusbdeviceapi.cpp.

1423{
1424 DDI_ENTRY();
1425
1429
1431 UsbDevice,
1433 (PVOID*) &pUsbDevice,
1435
1436 if (CapabilityBufferLength > 0) {
1437 FxPointerNotNull(pFxDriverGlobals, CapabilityBuffer);
1438 }
1439
1440 status = pUsbDevice->QueryUsbCapability(CapabilityType,
1442 CapabilityBuffer,
1443 ResultLength);
1444 return status;
1445}
_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

◆ __out_bcount()

_Must_inspect_result_ __in WDFUSBDEVICE __in CONST GUID __in ULONG __out_bcount ( CapabilityBufferLength  ) &&
pure virtual

◆ __out_bcount_part_opt()

_Must_inspect_result_ __in WDFUSBDEVICE __in CONST GUID __in ULONG __out_bcount_part_opt ( CapabilityBufferLength  ,
ResultLength 
)

◆ CopyDeviceDescriptor()

pUsbDevice CopyDeviceDescriptor ( UsbDeviceDescriptor  )

◆ DoTraceLevelMessage() [1/6]

DoTraceLevelMessage ( pFxDriverGlobals  ,
TRACE_LEVEL_VERBOSE  ,
TRACINGIOTARGET  ,
"format control request WDFUSBDEVICE %  p,
WDFREQWUEST %  p,
WDFMEMORY %  p,
%!STATUS!"  ,
UsbDevice  ,
Request  ,
TransferMemory  ,
status   
)

◆ DoTraceLevelMessage() [2/6]

DoTraceLevelMessage ( pFxDriverGlobals  ,
TRACE_LEVEL_VERBOSE  ,
TRACINGIOTARGET  ,
"WDFUSBDEVICE %p control transfer sync"  ,
UsbDevice   
)

◆ DoTraceLevelMessage() [3/6]

DoTraceLevelMessage ( pFxDriverGlobals  ,
TRACE_LEVEL_VERBOSE  ,
TRACINGIOTARGET  ,
"WDFUSBDEVICE %  p,
%!STATUS!"  ,
UsbDevice  ,
status   
)

◆ DoTraceLevelMessage() [4/6]

DoTraceLevelMessage ( pFxDriverGlobals  ,
TRACE_LEVEL_VERBOSE  ,
TRACINGIOTARGET  ,
"WDFUSBDEVICE %  p,
WDFREQUEST %  p,
WDFMEMORY %p"  ,
UsbDevice  ,
Request  ,
TransferMemory   
)

◆ DoTraceLevelMessage() [5/6]

DoTraceLevelMessage ( pFxDriverGlobals  ,
TRACE_LEVEL_VERBOSE  ,
TRACINGIOTARGET  ,
"WDFUSBDEVICE %  p,
WDFREQUEST %  p,
WDFMEMORY %  p,
%!STATUS!"  ,
UsbDevice  ,
Request  ,
Memory  ,
status   
)

◆ DoTraceLevelMessage() [6/6]

DoTraceLevelMessage ( pFxDriverGlobals  ,
TRACE_LEVEL_VERBOSE  ,
TRACINGIOTARGET  ,
"WDFUSBDEVICE %  p,
WDFREQUEST %  p,
WDFMEMORY %  p,
StringIndex d,
LandID 0x%x"  ,
UsbDevice  ,
Request  ,
Memory  ,
StringIndex  ,
LangID   
)

Referenced by __deref_opt_out_bcount(), if(), and switch().

◆ FxObjectHandleGetPtr() [1/3]

FxObjectHandleGetPtr ( GetFxDriverGlobals(DriverGlobals)  ,
UsbDevice  ,
FX_TYPE_IO_TARGET_USB_DEVICE  ,
(PVOID *) &  pUsbDevice 
)

◆ FxObjectHandleGetPtr() [2/3]

FxObjectHandleGetPtr ( pFxDriverGlobals  ,
Memory  ,
IFX_TYPE_MEMORY  ,
(PVOID *) &  pMemory 
)

Referenced by if(), and switch().

◆ FxObjectHandleGetPtr() [3/3]

FxObjectHandleGetPtr ( pFxDriverGlobals  ,
Request  ,
FX_TYPE_REQUEST  ,
(PVOID *) &  pRequest 
)

◆ FxObjectHandleGetPtrAndGlobals() [1/2]

FxObjectHandleGetPtrAndGlobals ( GetFxDriverGlobals(DriverGlobals)  ,
Device  ,
FX_TYPE_DEVICE_BASE  ,
(PVOID *)&  pDevice,
pFxDriverGlobals 
)

◆ FxObjectHandleGetPtrAndGlobals() [2/2]

FxObjectHandleGetPtrAndGlobals ( GetFxDriverGlobals(DriverGlobals)  ,
UsbDevice  ,
FX_TYPE_IO_TARGET_USB_DEVICE  ,
(PVOID *) &  pUsbDevice,
pFxDriverGlobals 
)

◆ FxPointerNotNull() [1/9]

FxPointerNotNull ( FxDriverGlobals  ,
UsbDevice   
)

◆ FxPointerNotNull() [2/9]

FxPointerNotNull ( pFxDriverGlobals  ,
Config   
)

◆ FxPointerNotNull() [3/9]

FxPointerNotNull ( pFxDriverGlobals  ,
ConfigDescriptorLength   
)

◆ FxPointerNotNull() [4/9]

FxPointerNotNull ( pFxDriverGlobals  ,
Information   
)

◆ FxPointerNotNull() [5/9]

FxPointerNotNull ( pFxDriverGlobals  ,
NumCharacters   
)

◆ FxPointerNotNull() [6/9]

FxPointerNotNull ( pFxDriverGlobals  ,
Params   
)

◆ FxPointerNotNull() [7/9]

FxPointerNotNull ( pFxDriverGlobals  ,
SetupPacket   
)

◆ FxPointerNotNull() [8/9]

FxPointerNotNull ( pFxDriverGlobals  ,
StringMemory   
)

◆ FxPointerNotNull() [9/9]

FxPointerNotNull ( pFxDriverGlobals  ,
UsbDeviceDescriptor   
)

◆ FxUsbTargetDeviceCreate() [1/2]

return FxUsbTargetDeviceCreate ( pFxDriverGlobals  ,
pDevice  ,
Config->  USBDClientContractVersion,
Attributes  ,
UsbDevice   
)

◆ FxUsbTargetDeviceCreate() [2/2]

return FxUsbTargetDeviceCreate ( pFxDriverGlobals  ,
pDevice  ,
USBD_CLIENT_CONTRACT_VERSION_INVALID  ,
Attributes  ,
UsbDevice   
)

◆ GetConfigDescriptor()

return pUsbDevice GetConfigDescriptor ( ConfigDescriptor  ,
ConfigDescriptorLength   
)

◆ GetConfigHandle()

return pUsbDevice GetConfigHandle ( )

◆ GetInformation()

pUsbDevice GetInformation ( Information  )

◆ GetNumInterfaces()

return pUsbDevice GetNumInterfaces ( )

Referenced by DECLARE_INTERFACE().

◆ if() [1/14]

if ( NT_SUCCESSstatus)

Definition at line 82 of file fxusbdeviceapi.cpp.

82 {
83 return status;
84 }

◆ if() [2/14]

if ( (bufferSize % sizeof(WCHAR)) !  = 0)

Definition at line 610 of file fxusbdeviceapi.cpp.

610 {
612
615 "WDFMEMORY %p length must be even number of WCHARs, but is %I64d in "
616 "length, %!STATUS!",
618
619 return status;
620 }
size_t bufferSize
#define TRACE_LEVEL_VERBOSE
Definition: storswtr.h:30
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ _Strict_type_match_ POOL_TYPE _In_opt_ ULONG _In_ _Out_ WDFMEMORY * Memory
Definition: wdfmemory.h:169

◆ if() [3/14]

Definition at line 711 of file fxusbdeviceapi.cpp.

713 {
715
717 "Params Type %d not supported for UMDF, %!STATUS!",
718 Params->Type, status);
719
720 return status;
721
722 }
#define STATUS_NOT_SUPPORTED
Definition: d3dkmdt.h:48
_In_ WDFIOTARGET _In_ PWDF_REQUEST_COMPLETION_PARAMS Params
Definition: wdfrequest.h:308

◆ if() [4/14]

Definition at line 236 of file fxusbdeviceapi.cpp.

236 {
238
241 "WDF_USB_DEVICE_CREATE_CONFIG Size 0x%x, expected 0x%x, %!STATUS!",
243
244 return status;
245 }
#define STATUS_INFO_LENGTH_MISMATCH
Definition: udferr_usr.h:133
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_CHILD_LIST_CONFIG Config
Definition: wdfchildlist.h:476

◆ if() [5/14]

Definition at line 282 of file fxusbdeviceapi.cpp.

282 {
285 "Information size %d, expected %d %!STATUS!",
287 status);
288 return status;
289 }
_In_ WDFREQUEST _In_ NTSTATUS _In_ ULONG_PTR Information
Definition: wdfrequest.h:1049

◆ if() [6/14]

if ( NT_SUCCESS(status) &&  numChars,
 
)

Definition at line 483 of file fxusbdeviceapi.cpp.

483 {
485
490 numChars * sizeof(WCHAR),
491 &pBuffer);
492
493 if (!NT_SUCCESS(status)) {
495 }
496
498 (WDFOBJECT*)&hMemory);
499
500 if (NT_SUCCESS(status)) {
501 status = pUsbDevice->GetString((PUSHORT) pBuffer->GetBuffer(),
502 &numChars,
504 LangID);
505
506 if (NT_SUCCESS(status)) {
507 if (NumCharacters != NULL) {
509 }
511 }
512 }
513
514 if (!NT_SUCCESS(status)) {
515 //
516 // There can only be one context on this object right now,
517 // so just clear out the one.
518 //
519 pBuffer->DeleteFromFailedCreate();
520 }
521 }
static _Must_inspect_result_ NTSTATUS _Create(__in PFX_DRIVER_GLOBALS DriverGlobals, __in_opt PWDF_OBJECT_ATTRIBUTES Attributes, __in POOL_TYPE PoolType, __in ULONG PoolTag, __in size_t BufferSize, __out FxMemoryObject **Object)
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
#define NonPagedPool
Definition: env_spec_w32.h:307
USHORT numChars
WDFMEMORY hMemory
PVOID pBuffer
uint16_t * PUSHORT
Definition: typedefs.h:56
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_Must_inspect_result_ _In_ WDFUSBDEVICE _In_opt_ PWDF_OBJECT_ATTRIBUTES StringMemoryAttributes
Definition: wdfusb.h:1123
_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
_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
_Must_inspect_result_ _In_ WDFUSBDEVICE _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFMEMORY * StringMemory
Definition: wdfusb.h:1125
__wchar_t WCHAR
Definition: xmlstorage.h:180

◆ if() [7/14]

if ( NT_SUCCESS(status )

Definition at line 104 of file fxusbdeviceapi.cpp.

104 {
106
107 device = NULL;
108
110
111 if (NT_SUCCESS(status)) {
112 status = pUsbDevice->CreateInterfaces();
113 }
114
115 if (NT_SUCCESS(status)) {
116 status = Device->AddIoTarget(pUsbDevice);
117 }
118
119 if (NT_SUCCESS(status)) {
121 }
122
123 if (NT_SUCCESS(status)) {
124 *UsbDevice = (WDFUSBDEVICE) device;
125 }
126 }
_Must_inspect_result_ __in FxDeviceBase __in ULONG USBDClientContractVersion
Definition: devices.h:37
_Must_inspect_result_ _In_ WDFDEVICE Device
Definition: wdfchildlist.h:474

◆ if() [8/14]

if ( NumCharacters = NULL)

Definition at line 467 of file fxusbdeviceapi.cpp.

467 {
468 *NumCharacters = 0;
469 }

◆ if() [9/14]

◆ if() [10/14]

Definition at line 697 of file fxusbdeviceapi.cpp.

699 {
700
702
704 "Params Type %d not a valid value, %!STATUS!",
705 Params->Size, status);
706
707 return status;
708 }

◆ if() [11/14]

else if ( pUsbDevice->  HasMismatchedInterfacesInConfigDescriptor() = = 0)

Definition at line 732 of file fxusbdeviceapi.cpp.

732 {
733 //
734 // Config descriptor reported zero interfaces, but we found an
735 // interface descriptor in it.
736 //
738
741 "WDFUSBDEVICE %p number of interfaces found in the config descriptor "
742 "does not match bNumInterfaces in config descriptor, failing config "
743 "operation %!WdfUsbTargetDeviceSelectConfigType!, %!STATUS!",
744 UsbDevice, Params->Type, status);
745
746 return status;
747 }
#define STATUS_INVALID_DEVICE_REQUEST
Definition: udferr_usr.h:138

◆ if() [12/14]

if ( pUsbDevice  = NULL)

Definition at line 94 of file fxusbdeviceapi.cpp.

94 {
96 }

◆ if() [13/14]

if ( pUsbInterface = NULL)

Definition at line 1360 of file fxusbdeviceapi.cpp.

1360 {
1361 return pUsbInterface->GetHandle();
1362 }
WDFUSBINTERFACE GetHandle(VOID)
FxUsbInterface * pUsbInterface

◆ if() [14/14]

if ( TransferMemory = NULL)

Definition at line 1154 of file fxusbdeviceapi.cpp.

1154 {
1158 (PVOID*) &pMemory);
1159
1161 if (!NT_SUCCESS(status)) {
1162 return status;
1163 }
1164
1165 buf.SetMemory(pMemory, TransferOffset);
1166 }
_Must_inspect_result_ NTSTATUS ValidateMemoryOffsets(__in_opt PWDFMEMORY_OFFSET Offsets)
Definition: ifxmemory.hpp:105
@ IFX_TYPE_MEMORY
Definition: fxtypes.h:55
FxObjectHandleGetPtr(pFxDriverGlobals, Memory, IFX_TYPE_MEMORY,(PVOID *) &pMemory)
IFxMemory * pMemory
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
_Must_inspect_result_ _In_ WDFUSBDEVICE _In_ WDFREQUEST _In_ PWDF_USB_CONTROL_SETUP_PACKET _In_opt_ WDFMEMORY _In_opt_ PWDFMEMORY_OFFSET TransferOffset
Definition: wdfusb.h:1387
_Must_inspect_result_ _In_ WDFUSBDEVICE _In_ WDFREQUEST _In_ PWDF_USB_CONTROL_SETUP_PACKET _In_opt_ WDFMEMORY TransferMemory
Definition: wdfusb.h:1384

◆ request()

FxSyncRequest request ( pFxDriverGlobals  ,
context,
Request   
)

◆ SetMemory()

buf SetMemory ( pMemory  ,
Offset   
)

◆ switch()

switch ( Params->  Type)

Definition at line 763 of file fxusbdeviceapi.cpp.

763 {
764
765#if (FX_CORE_MODE == FX_CORE_KERNEL_MODE)
766
768 status = pUsbDevice->Deconfig();
769 break;
770
772 if (Params->Types.Descriptor.InterfaceDescriptors == NULL ||
773 Params->Types.Descriptor.NumInterfaceDescriptors == 0) {
777 "Either InterfaceDescriptor is NULL or NumInterfaceDescriptors is zero "
778 "WDFUSBDEVICE %p InterfaceDescriptor %p NumInterfaceDescriptors 0x%x"
779 "%!WdfUsbTargetDeviceSelectConfigType! %!STATUS!", UsbDevice,
780 Params->Types.Descriptor.InterfaceDescriptors,
781 Params->Types.Descriptor.NumInterfaceDescriptors,
782 Params->Type,
783 status);
784
785 }
786 else {
787 status = pUsbDevice->SelectConfigDescriptor(
789 Params);
790 }
791 break;
792
794 //
795 // Since the USBD macro's dont include the USBD_PIPE_INFORMATION for 0 EP's,
796 // make the length check to use
797 // sizeof(struct _URB_SELECT_CONFIGURATION) - sizeof(USBD_PIPE_INFORMATION)
798 //
799 if (Params->Types.Urb.Urb == NULL ||
800 Params->Types.Urb.Urb->UrbHeader.Function != URB_FUNCTION_SELECT_CONFIGURATION ||
801 Params->Types.Urb.Urb->UrbHeader.Length <
802 (sizeof(struct _URB_SELECT_CONFIGURATION) - sizeof(USBD_PIPE_INFORMATION))) {
806 "Either URB passed in was NULL or the URB Function or Length was invalid "
807 " WDFUSBDEVICE %p Urb 0x%p "
808 "%!WdfUsbTargetDeviceSelectConfigType!"
809 " %!STATUS!", UsbDevice,
810 Params->Types.Urb.Urb,
811 Params->Type,
812 status);
813
814 }
815 else {
816 status = pUsbDevice->SelectConfig(
818 Params->Types.Urb.Urb,
820 NULL);
821 }
822 break;
823
824#endif
825
826
827
828
829
831 if (Params->Types.MultiInterface.Pairs == NULL) {
833
836 "WDFUSBDEVICE %p SettingPairs Array passed is NULL, %!STATUS!",
837 pUsbDevice->GetHandle(),status);
838
839 break;
840 }
841 else if (Params->Types.MultiInterface.NumberInterfaces !=
842 pUsbDevice->GetNumInterfaces()) {
844
847 "WDFUSBDEVICE %p MultiInterface.NumberInterfaces %d != %d "
848 "(reported num interfaces), %!STATUS!",
849 pUsbDevice->GetHandle(),
850 Params->Types.MultiInterface.NumberInterfaces,
851 pUsbDevice->GetNumInterfaces(), status);
852
853 break;
854 }
855
856 // || || Fall through || ||
857 // \/ \/ \/ \/
859
860 //
861 // Validate SettingIndexes passed-in
862 //
863 for (ULONG i = 0;
864 i < Params->Types.MultiInterface.NumberInterfaces;
865 i++) {
866
869 UCHAR numSettings;
870
871 pair = &(Params->Types.MultiInterface.Pairs[i]);
872
874 pair->UsbInterface,
876 (PVOID*) &pUsbInterface);
877
878 numSettings = pUsbInterface->GetNumSettings();
879
880 if (pair->SettingIndex >= numSettings) {
882
885 "WDFUSBDEVICE %p SettingPairs contains invalid SettingIndex"
886 " for WDFUSBINTERFACE %p. Setting index passed in: %d, "
887 "max index: %d, returning %!STATUS!",
888 pUsbDevice->GetHandle(),
889 pair->UsbInterface,
890 pair->SettingIndex,
892 status);
893
894 return status;
895 }
896 }
897
898 status = pUsbDevice->SelectConfigMulti(
900 Params);
901 break;
902
904 status = pUsbDevice->SelectConfigSingle( //vm changed name from SelectConfigAuto
906 Params);
907 break;
908
909 default:
911 }
UCHAR GetNumSettings(VOID)
@ FX_TYPE_USB_INTERFACE
Definition: fxtypes.h:104
@ FxUrbTypeLegacy
Definition: fxusbdevice.hpp:27
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
Definition: _pair.h:47
uint32_t ULONG
Definition: typedefs.h:59
#define URB_FUNCTION_SELECT_CONFIGURATION
Definition: usb.h:86
@ WdfUsbTargetDeviceSelectConfigTypeUrb
Definition: wdfusb.h:132
@ WdfUsbTargetDeviceSelectConfigTypeInterfacesPairs
Definition: wdfusb.h:130
@ WdfUsbTargetDeviceSelectConfigTypeSingleInterface
Definition: wdfusb.h:128
@ WdfUsbTargetDeviceSelectConfigTypeInterfacesDescriptor
Definition: wdfusb.h:131
@ WdfUsbTargetDeviceSelectConfigTypeDeconfig
Definition: wdfusb.h:127
@ WdfUsbTargetDeviceSelectConfigTypeMultiInterface
Definition: wdfusb.h:129
_Must_inspect_result_ _In_ WDFUSBINTERFACE _In_opt_ PWDF_OBJECT_ATTRIBUTES PipesAttributes
Definition: wdfusb.h:2390
unsigned char UCHAR
Definition: xmlstorage.h:181

Variable Documentation

◆ Attributes

◆ buf

Definition at line 571 of file fxusbdeviceapi.cpp.

◆ bufferSize

◆ BytesTransferred

◆ CapabilityBufferLength

◆ CapabilityType

Definition at line 1385 of file fxusbdeviceapi.cpp.

◆ Config

◆ ConfigDescriptor

◆ ConfigDescriptorLength

◆ context

◆ Device

Definition at line 43 of file fxusbdeviceapi.cpp.

◆ else

else
Initial value:

Definition at line 1167 of file fxusbdeviceapi.cpp.

◆ hMemory

WDFMEMORY hMemory

Definition at line 453 of file fxusbdeviceapi.cpp.

Referenced by if().

◆ Information

Initial value:

Definition at line 265 of file fxusbdeviceapi.cpp.

◆ InterfaceIndex

__in WDFUSBDEVICE __in UCHAR InterfaceIndex
Initial value:

Definition at line 1331 of file fxusbdeviceapi.cpp.

◆ LangID

Initial value:

Definition at line 391 of file fxusbdeviceapi.cpp.

◆ Memory

_Must_inspect_result_ __in WDFUSBDEVICE __in WDFREQUEST __in WDFMEMORY Memory

Definition at line 538 of file fxusbdeviceapi.cpp.

◆ MemoryDescriptor

◆ NULL

return NULL

Definition at line 1370 of file fxusbdeviceapi.cpp.

Referenced by __deref_opt_out_bcount(), if(), and switch().

◆ NumberOfIsochPackets

◆ NumCharacters

◆ numChars

◆ Offset

Definition at line 540 of file fxusbdeviceapi.cpp.

◆ Params

◆ pDevice

FxDeviceBase* pDevice

Definition at line 173 of file fxusbdeviceapi.cpp.

◆ pFxDriverGlobals

PFX_DRIVER_GLOBALS pFxDriverGlobals

Definition at line 172 of file fxusbdeviceapi.cpp.

Referenced by __deref_opt_out_bcount(), __drv_when(), if(), and switch().

◆ PipesAttributes

◆ pMemory

IFxMemory* pMemory

Definition at line 569 of file fxusbdeviceapi.cpp.

Referenced by if().

◆ pRequest

FxRequest* pRequest

Definition at line 572 of file fxusbdeviceapi.cpp.

◆ pUsbDevice

FxUsbDevice * pUsbDevice = new(FxDriverGlobals, Attributes) FxUsbDevice(FxDriverGlobals)

Definition at line 93 of file fxusbdeviceapi.cpp.

Referenced by __deref_opt_out_bcount(), __drv_when(), if(), and switch().

◆ pUsbInterface

◆ Request

_Must_inspect_result_ __in WDFUSBDEVICE __in WDFREQUEST Request

Definition at line 381 of file fxusbdeviceapi.cpp.

◆ RequestOptions

◆ SetupPacket

◆ status

Definition at line 72 of file fxusbdeviceapi.cpp.

Referenced by __deref_opt_out_bcount(), __drv_when(), if(), and switch().

◆ STATUS_SUCCESS

return STATUS_SUCCESS

Definition at line 293 of file fxusbdeviceapi.cpp.

◆ String

◆ StringIndex

Definition at line 389 of file fxusbdeviceapi.cpp.

◆ StringMemory

Definition at line 441 of file fxusbdeviceapi.cpp.

◆ StringMemoryAttributes

◆ TransferMemory

Definition at line 1106 of file fxusbdeviceapi.cpp.

◆ TransferOffset

◆ UrbMemory

Definition at line 1252 of file fxusbdeviceapi.cpp.

◆ USBDClientContractVersion

_Must_inspect_result_ __in FxDeviceBase __in ULONG USBDClientContractVersion

Definition at line 45 of file fxusbdeviceapi.cpp.

Referenced by if().

◆ UsbDevice

Initial value:

Definition at line 49 of file fxusbdeviceapi.cpp.

◆ UsbDeviceDescriptor

Initial value:

Definition at line 306 of file fxusbdeviceapi.cpp.