66 Stack->Parameters.QueryInterface.InterfaceType = (
LPGUID)&USB_BUS_INTERFACE_USBC_CONFIGURATION_GUID;
67 Stack->Parameters.QueryInterface.Version = 2;
69 Stack->Parameters.QueryInterface.InterfaceSpecificData =
NULL;
101 ULONG FunctionDescriptorBufferLength = 0;
122 Status = FDODeviceExtension->
BusInterface.StartDeviceCallback(FDODeviceExtension->DeviceDescriptor,
123 FDODeviceExtension->ConfigurationDescriptor,
124 &FunctionDescriptorBuffer,
125 &FunctionDescriptorBufferLength,
127 FDODeviceExtension->PhysicalDeviceObject);
129 DPRINT(
"USBCCGP_CustomEnumWithInterface Status %lx\n",
Status);
138 DPRINT(
"FunctionDescriptorBufferLength %lu\n", FunctionDescriptorBufferLength);
139 DPRINT(
"FunctionDescriptorBuffer %p\n", FunctionDescriptorBuffer);
144 ASSERT(FunctionDescriptorBufferLength);
150 FDODeviceExtension->FunctionDescriptor = FunctionDescriptorBuffer;
170 Offset = (
PUCHAR)ConfigurationDescriptor + ConfigurationDescriptor->bLength;
171 End = (
PUCHAR)ConfigurationDescriptor + ConfigurationDescriptor->wTotalLength;
212 Offset = (
PUCHAR)ConfigurationDescriptor + ConfigurationDescriptor->bLength;
213 End = (
PUCHAR)ConfigurationDescriptor + ConfigurationDescriptor->wTotalLength;
263 Offset = (
PUCHAR)AssociationDescriptor + AssociationDescriptor->bLength;
264 End = (
PUCHAR)ConfigurationDescriptor + ConfigurationDescriptor->wTotalLength;
281 if (
Count == AssociationDescriptor->bInterfaceCount)
295 DPRINT1(
"Invalid association descriptor\n");
309 DPRINT1(
"Invalid association descriptor\n");
326 FunctionDescriptor->FunctionNumber = (
UCHAR)FunctionNumber;
333 FunctionDescriptor->NumberOfInterfaces =
Descriptor->bInterfaceCount;
337 if (!FunctionDescriptor->InterfaceDescriptorList)
367 (
PVOID*)&DescriptionBuffer);
382 DPRINT1(
"FunctionDescription %wZ\n", &FunctionDescriptor->FunctionDescription);
388 Index =
swprintf(
Buffer,
L"USB\\VID_%04x&PID_%04x&Rev_%04x&MI_%02x", FDODeviceExtension->DeviceDescriptor->idVendor,
389 FDODeviceExtension->DeviceDescriptor->idProduct,
390 FDODeviceExtension->DeviceDescriptor->bcdDevice,
393 FDODeviceExtension->DeviceDescriptor->idProduct,
398 if (!DescriptionBuffer)
408 FunctionDescriptor->HardwareId.Buffer = DescriptionBuffer;
409 FunctionDescriptor->HardwareId.Length =
Index *
sizeof(
WCHAR);
410 FunctionDescriptor->HardwareId.MaximumLength = (
Index + 1) *
sizeof(
WCHAR);
421 if (!DescriptionBuffer)
431 FunctionDescriptor->CompatibleId.Buffer = DescriptionBuffer;
432 FunctionDescriptor->CompatibleId.Length =
Index *
sizeof(
WCHAR);
433 FunctionDescriptor->CompatibleId.MaximumLength = (
Index + 1) *
sizeof(
WCHAR);
459 if (!DescriptorCount)
471 if (!FDODeviceExtension->FunctionDescriptor)
476 DPRINT1(
"USBCCGP_EnumWithAssociationDescriptor failed to allocate function descriptor count %x\n", DescriptorCount);
498 FDODeviceExtension->FunctionDescriptorCount = DescriptorCount;
530 (
PVOID*)&DescriptionBuffer);
545 DPRINT1(
"FunctionDescription %wZ\n", &FunctionDescriptor->FunctionDescription);
552 Index =
swprintf(
Buffer,
L"USB\\VID_%04x&PID_%04x&Rev_%04x&MI_%02x", FDODeviceExtension->DeviceDescriptor->idVendor,
553 FDODeviceExtension->DeviceDescriptor->idProduct,
554 FDODeviceExtension->DeviceDescriptor->bcdDevice,
557 FDODeviceExtension->DeviceDescriptor->idProduct,
562 if (!DescriptionBuffer)
572 FunctionDescriptor->HardwareId.Buffer = DescriptionBuffer;
573 FunctionDescriptor->HardwareId.Length =
Index *
sizeof(
WCHAR);
574 FunctionDescriptor->HardwareId.MaximumLength = (
Index + 1) *
sizeof(
WCHAR);
585 if (!DescriptionBuffer)
595 FunctionDescriptor->CompatibleId.Buffer = DescriptionBuffer;
596 FunctionDescriptor->CompatibleId.Length =
Index *
sizeof(
WCHAR);
597 FunctionDescriptor->CompatibleId.MaximumLength = (
Index + 1) *
sizeof(
WCHAR);
624 ASSERT(FDODeviceExtension->ConfigurationDescriptor->bNumInterfaces);
630 if (!FDODeviceExtension->FunctionDescriptor)
635 DPRINT1(
"USBCCGP_EnumWithAssociationDescriptor failed to allocate function descriptor %lu\n", FDODeviceExtension->ConfigurationDescriptor->bNumInterfaces);
642 FDODeviceExtension->FunctionDescriptorCount = 0;
643 for (
Index = 0;
Index < FDODeviceExtension->ConfigurationDescriptor->bNumInterfaces;
Index++)
652 DPRINT1(
"[USBCCGP] Failed to find interface descriptor index %lu\n",
Index);
660 FDODeviceExtension->FunctionDescriptor[
Index].FunctionNumber =
Index;
661 FDODeviceExtension->FunctionDescriptor[
Index].NumberOfInterfaces = 1;
663 if (!FDODeviceExtension->FunctionDescriptor[
Index].InterfaceDescriptorList)
692 FDODeviceExtension->FunctionDescriptorCount++;
728 for (
Index = 0;
Index < FDODeviceExtension->ConfigurationDescriptor->bNumInterfaces;
Index++)
745 if (FirstDescriptor ==
NULL)
766 DPRINT(
"[USBCCGP] Audio Composite Device detected\n");
772 if (!FDODeviceExtension->FunctionDescriptor)
777 DPRINT1(
"USBCCGP_EnumWithAssociationDescriptor failed to allocate function descriptor count\n");
784 FDODeviceExtension->FunctionDescriptor[0].FunctionNumber = 0;
795 DPRINT1(
"[USBCCGP] Failed to allocate descriptor array %lx\n",
Status);
815 FDODeviceExtension->FunctionDescriptor[0].NumberOfInterfaces = FDODeviceExtension->ConfigurationDescriptor->bNumInterfaces;
820 FDODeviceExtension->FunctionDescriptorCount = 1;
#define STATUS_NOT_SUPPORTED
#define STATUS_NOT_IMPLEMENTED
#define NT_SUCCESS(StatCode)
struct _FDO_DEVICE_EXTENSION * PFDO_DEVICE_EXTENSION
NTSTATUS NTAPI USBCCGP_GetStringDescriptor(IN PDEVICE_OBJECT DeviceObject, IN ULONG DescriptorLength, IN UCHAR DescriptorIndex, IN LANGID LanguageId, OUT PVOID *OutDescriptor)
NTSTATUS AllocateInterfaceDescriptorsArray(IN PUSB_CONFIGURATION_DESCRIPTOR ConfigurationDescriptor, OUT PUSB_INTERFACE_DESCRIPTOR **OutArray)
NTSTATUS USBCCGP_EnumerateFunctions(IN PDEVICE_OBJECT DeviceObject)
NTSTATUS USBCCGP_EnumWithAudioLegacy(IN PDEVICE_OBJECT DeviceObject)
NTSTATUS USBCCGP_EnumWithAssociationDescriptor(IN PDEVICE_OBJECT DeviceObject)
NTSTATUS USBCCG_InitIdsWithInterfaceDescriptor(IN PFDO_DEVICE_EXTENSION FDODeviceExtension, IN PUSB_INTERFACE_DESCRIPTOR Descriptor, IN ULONG FunctionIndex, OUT PUSBC_FUNCTION_DESCRIPTOR FunctionDescriptor)
NTSTATUS USBCCGP_InitInterfaceListOfFunctionDescriptor(IN PUSB_CONFIGURATION_DESCRIPTOR ConfigurationDescriptor, IN PUSB_INTERFACE_ASSOCIATION_DESCRIPTOR AssociationDescriptor, OUT PUSBC_FUNCTION_DESCRIPTOR FunctionDescriptor)
NTSTATUS USBCCGP_EnumWithUnionFunctionDescriptors(IN PDEVICE_OBJECT DeviceObject)
NTSTATUS USBCCGP_CustomEnumWithInterface(IN PDEVICE_OBJECT DeviceObject)
NTSTATUS USBCCGP_QueryInterface(IN PDEVICE_OBJECT DeviceObject, OUT PUSBC_DEVICE_CONFIGURATION_INTERFACE_V1 BusInterface)
ULONG USBCCGP_CountAssociationDescriptors(IN PUSB_CONFIGURATION_DESCRIPTOR ConfigurationDescriptor)
PUSB_INTERFACE_ASSOCIATION_DESCRIPTOR USBCCGP_GetAssociationDescriptorAtIndex(IN PUSB_CONFIGURATION_DESCRIPTOR ConfigurationDescriptor, IN ULONG Index)
NTSTATUS USBCCGP_InitFunctionDescriptor(IN PFDO_DEVICE_EXTENSION FDODeviceExtension, IN ULONG FunctionNumber, OUT PUSBC_FUNCTION_DESCRIPTOR FunctionDescriptor)
NTSTATUS USBCCGP_LegacyEnum(IN PDEVICE_OBJECT DeviceObject)
#define KeWaitForSingleObject(pEvt, foo, a, b, c)
#define KeInitializeEvent(pEvt, foo, foo2)
PVOID AllocateItem(IN POOL_TYPE PoolType, IN SIZE_T NumberOfBytes)
__in UCHAR __in POWER_STATE __in_opt PVOID __in PIO_STATUS_BLOCK IoStatus
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
_In_ ULONG _In_ ULONG Offset
PIRP NTAPI IoBuildSynchronousFsdRequest(IN ULONG MajorFunction, IN PDEVICE_OBJECT DeviceObject, IN PVOID Buffer, IN ULONG Length, IN PLARGE_INTEGER StartingOffset, IN PKEVENT Event, IN PIO_STATUS_BLOCK IoStatusBlock)
struct _INTERFACE * PINTERFACE
COMMON_DEVICE_EXTENSION Common
BUS_INTERFACE_STANDARD BusInterface
#define RtlCopyMemory(Destination, Source, Length)
#define RtlZeroMemory(Destination, Length)
#define STATUS_UNSUCCESSFUL
#define STATUS_INSUFFICIENT_RESOURCES
struct _USB_INTERFACE_DESCRIPTOR * PUSB_INTERFACE_DESCRIPTOR
#define USB_INTERFACE_DESCRIPTOR_TYPE
#define USB_INTERFACE_ASSOCIATION_DESCRIPTOR_TYPE
struct _USB_INTERFACE_ASSOCIATION_DESCRIPTOR * PUSB_INTERFACE_ASSOCIATION_DESCRIPTOR
struct _USBC_DEVICE_CONFIGURATION_INTERFACE_V1 USBC_DEVICE_CONFIGURATION_INTERFACE_V1
struct _USBC_FUNCTION_DESCRIPTOR USBC_FUNCTION_DESCRIPTOR
#define USBC_DEVICE_CONFIGURATION_INTERFACE_VERSION_1
PUSB_INTERFACE_DESCRIPTOR NTAPI USBD_ParseConfigurationDescriptorEx(PUSB_CONFIGURATION_DESCRIPTOR ConfigurationDescriptor, PVOID StartPosition, LONG InterfaceNumber, LONG AlternateSetting, LONG InterfaceClass, LONG InterfaceSubClass, LONG InterfaceProtocol)
_In_ WDFCOLLECTION _In_ ULONG Index
_In_ PDEVICE_OBJECT DeviceObject
_In_ WDFREQUEST _In_ PIO_STACK_LOCATION Stack
_Must_inspect_result_ _In_ WDFIORESLIST _In_ PIO_RESOURCE_DESCRIPTOR Descriptor
_In_ WDFUSBINTERFACE _In_ UCHAR _Out_ PUSB_INTERFACE_DESCRIPTOR InterfaceDescriptor
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetNextIrpStackLocation(_In_ PIRP Irp)
#define IRP_MN_QUERY_INTERFACE
struct _BUS_INTERFACE_STANDARD BUS_INTERFACE_STANDARD