ReactOS 0.4.17-dev-1281-g065abb3
clientif.cpp
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS USB Host Controller Extension
3 * LICENSE: MIT (https://spdx.org/licenses/MIT)
4 * PURPOSE: USBD client handles, XRB allocation and the USBDI bus interface
5 * COPYRIGHT: Copyright 2026 Justin Miller <justin.miller@reactos.org>
6 */
7
8#include "ucx01000.h"
9
10#define NDEBUG
11#include <debug.h>
12
13#define UCX_MAX_SELECT_PIPES 32
14#define UCX_MAX_SELECT_INTERFACES 255
15
16/* Bandwidth reported when the HCD does not take the question itself */
17#define UCX_FAKE_TOTAL_BANDWIDTH 4000000
18
19/* Options USBPORT miniports reported; clients still look at them */
20#define UCX_UHCI_OPTION_FLAGS 0x000002C3
21#define UCX_EHCI_OPTION_FLAGS 0x00080A95
22
23static
28{
29 return Device->Speed() == UsbLowSpeed || Device->Speed() == UsbFullSpeed;
30}
31
32/* USBDI bus interface functions; the context is always a UCXUSBDEVICE */
33
34static
35VOID
39 _Out_opt_ PUSBD_VERSION_INFORMATION VersionInformation,
40 _Out_opt_ PULONG HcdCapabilities)
41{
42 BOOLEAN Slow = UcxIsLowOrFullSpeed(UcxUsbDevice::FromHandle((UCXUSBDEVICE)Context));
43
44 if (HcdCapabilities != NULL)
45 *HcdCapabilities = 0;
46
47 if (VersionInformation != NULL)
48 {
49 VersionInformation->USBDI_Version = UCX_USBDI_VERSION;
50 VersionInformation->Supported_USB_Version = Slow ? 0x0110 : 0x0200;
51 }
52}
53
54static
59 _Out_opt_ PULONG CurrentFrame)
60{
61 if (CurrentFrame == NULL)
62 {
63 DPRINT1("QueryBusTime called without a frame pointer\n");
65 }
66
67 return UcxUsbDevice::FromHandle((UCXUSBDEVICE)Context)->m_Controller->GetCurrentFrameNumber(CurrentFrame);
68}
69
70static
76{
78
79 DPRINT1("SubmitIsoOutUrb is not supported, URB %p\n", Urb);
82}
83
84static
93{
94 UcxController* Controller = UcxUsbDevice::FromHandle((UCXUSBDEVICE)Context)->m_Controller;
97 ULONG Needed;
98
99 /* An HCD that tracks bandwidth itself is not second guessed */
100 if (Controller->HcdGetBandwidthInformation() != NULL)
101 {
102 DPRINT1("Bus information query with HCD bandwidth tracking is not supported\n");
104 }
105
106 if (Level == 0)
107 {
108 if (ActualLength != NULL)
110
112 {
113 DPRINT("Bus information level 0 buffer too small, %lu bytes\n", *BufferLength);
115 }
116
119 ((PUSB_BUS_INFORMATION_LEVEL_0)Buffer)->ConsumedBandwidth = 0;
120 return STATUS_SUCCESS;
121 }
122
123 if (Level != 1)
124 {
125 DPRINT1("Bus information level %lu is not supported\n", Level);
127 }
128
129 WdfStringGetUnicodeString(Controller->m_HostControllerInterfaceName, &Name);
130
131 /* The WCHAR already inside the structure is not subtracted */
132 Needed = sizeof(USB_BUS_INFORMATION_LEVEL_1) + Name.Length;
133 if (ActualLength != NULL)
134 *ActualLength = Needed;
135
136 if (*BufferLength < Needed)
137 {
138 DPRINT("Bus information level 1 needs %lu bytes, got %lu\n", Needed, *BufferLength);
140 }
141
142 *BufferLength = Needed;
145 Level1->ConsumedBandwidth = 0;
146 Level1->ControllerNameLength = Name.Length;
147 RtlCopyMemory(Level1->ControllerNameUnicodeString, Name.Buffer, Name.Length);
148
149 return STATUS_SUCCESS;
150}
151
152/* SuperSpeed and the root hub count as high speed here */
153static
158{
159 if (Context == NULL)
160 return FALSE;
161
162 return !UcxIsLowOrFullSpeed(UcxUsbDevice::FromHandle((UCXUSBDEVICE)Context));
163}
164
165static
170 _In_ ULONG DriverTag,
171 _In_ ULONG EnumTag,
172 _In_ ULONG P1,
173 _In_ ULONG P2)
174{
176 UNREFERENCED_PARAMETER(DriverTag);
177 UNREFERENCED_PARAMETER(EnumTag);
180
181 return STATUS_SUCCESS;
182}
183
184/* USBPORT never counted microframes either */
185static
190 _Out_opt_ PULONG CurrentMicroFrame)
191{
192 if (CurrentMicroFrame == NULL)
193 {
194 DPRINT1("QueryBusTimeEx called without a microframe pointer\n");
196 }
197
198 if (UcxIsLowOrFullSpeed(UcxUsbDevice::FromHandle((UCXUSBDEVICE)Context)))
199 {
200 DPRINT("QueryBusTimeEx is not supported for low or full speed device %p\n", Context);
202 }
203
204 *CurrentMicroFrame = 0;
205 return STATUS_SUCCESS;
206}
207
209static
214 _Out_opt_ PULONG HcdiOptionFlags,
215 _Out_opt_ PUSHORT PciVendorId,
216 _Out_opt_ PUSHORT PciDeviceId,
217 _Out_opt_ PUCHAR PciClass,
218 _Out_opt_ PUCHAR PciSubClass,
219 _Out_opt_ PUCHAR PciRevisionId,
220 _Out_opt_ PUCHAR PciProgIf)
221{
222 UcxUsbDevice* Device = UcxUsbDevice::FromHandle((UCXUSBDEVICE)Context);
223 const UCX_CONTROLLER_PCI_INFORMATION* Pci = &Device->m_Controller->m_Config.PciDeviceInfo;
225
226 if (HcdiOptionFlags != NULL)
227 *HcdiOptionFlags = Slow ? UCX_UHCI_OPTION_FLAGS : UCX_EHCI_OPTION_FLAGS;
228 if (PciVendorId != NULL)
229 *PciVendorId = (USHORT)Pci->VendorId;
230 if (PciDeviceId != NULL)
231 *PciDeviceId = (USHORT)Pci->DeviceId;
232 if (PciClass != NULL)
233 *PciClass = PCI_CLASS_SERIAL_BUS_CTLR;
234 if (PciSubClass != NULL)
235 *PciSubClass = PCI_SUBCLASS_SB_USB;
236 if (PciRevisionId != NULL)
237 *PciRevisionId = (UCHAR)Pci->RevisionId;
238 if (PciProgIf != NULL)
239 *PciProgIf = Slow ? 0x00 : 0x20;
240
241 return STATUS_SUCCESS;
242}
243
246NTAPI
248 _In_ WDFDEVICE Device,
252{
254 USHORT RequestedSize = ExposedInterface->Size;
255 USHORT RequestedVersion = ExposedInterface->Version;
256 USHORT FilledSize = 0;
257 USHORT FilledVersion = 0;
259 UCXUSBDEVICE BusContext;
260
262
263 /* A query without one is for the root hub itself */
265 ? (UCXUSBDEVICE)ExposedInterfaceSpecificData
266 : (UCXUSBDEVICE)UcxGetRootHubPdoContext(Device)->RootHub->m_Handle;
267
268 if (RequestedSize < sizeof(USB_BUS_INTERFACE_USBDI_V0))
269 {
271 }
272 else
273 {
274 Bus->BusContext = BusContext;
281 FilledSize = sizeof(USB_BUS_INTERFACE_USBDI_V0);
282 FilledVersion = USB_BUSIF_USBDI_VERSION_0;
283
284 if (RequestedVersion >= USB_BUSIF_USBDI_VERSION_1)
285 {
286 if (RequestedSize < sizeof(USB_BUS_INTERFACE_USBDI_V1))
288 else
289 {
291 FilledSize = sizeof(USB_BUS_INTERFACE_USBDI_V1);
292 FilledVersion = USB_BUSIF_USBDI_VERSION_1;
293 }
294 }
295
296 if (NT_SUCCESS(Status) && RequestedVersion >= USB_BUSIF_USBDI_VERSION_2)
297 {
298 if (RequestedSize < sizeof(USB_BUS_INTERFACE_USBDI_V2))
300 else
301 {
303 FilledSize = sizeof(USB_BUS_INTERFACE_USBDI_V2);
304 FilledVersion = USB_BUSIF_USBDI_VERSION_2;
305 }
306 }
307
308 /* Anything newer is served as version 3 */
309 if (NT_SUCCESS(Status) && RequestedVersion >= USB_BUSIF_USBDI_VERSION_3)
310 {
311 if (RequestedSize < sizeof(USB_BUS_INTERFACE_USBDI_V3))
313 else
314 {
317 FilledSize = sizeof(USB_BUS_INTERFACE_USBDI_V3);
318 FilledVersion = USB_BUSIF_USBDI_VERSION_3;
319 }
320 }
321 }
322
323 if (!NT_SUCCESS(Status))
324 {
325 DPRINT1("USBDI interface query size %u version %u failed 0x%lx, served version %u\n",
326 RequestedSize, RequestedVersion, Status, FilledVersion);
327 }
328
329 ExposedInterface->Size = FilledSize;
330 ExposedInterface->Version = FilledVersion;
331 return Status;
332}
333
334/* USBD client interface */
335
336static
337VOID
338NTAPI
340 _In_ USBD_CLIENT_HANDLE ClientHandle);
341
342static
344NTAPI
346 _In_ USBD_CLIENT_HANDLE ClientHandle,
347 _Outptr_ PURB* Urb);
348
349static
351NTAPI
353 _In_ USBD_CLIENT_HANDLE ClientHandle,
355 _Outptr_ PURB* Urb);
356
357static
359NTAPI
361 _In_ USBD_CLIENT_HANDLE ClientHandle,
364 _Outptr_ PURB* UrbOut);
365
366static
368NTAPI
370 _In_ USBD_CLIENT_HANDLE ClientHandle,
372 _In_ PUSBD_INTERFACE_LIST_ENTRY InterfaceEntry,
373 _Outptr_ PURB* UrbOut);
374
375static
376VOID
377NTAPI
379 _In_ PURB Urb);
380
381static
383NTAPI
385 _In_ USBD_CLIENT_HANDLE ClientHandle,
387 _Inout_ PUSBD_INTERFACE_LIST_ENTRY InterfaceEntry,
388 _In_ ULONG OffloadedEndpoints,
390{
391 UNREFERENCED_PARAMETER(ClientHandle);
393 UNREFERENCED_PARAMETER(InterfaceEntry);
394 UNREFERENCED_PARAMETER(OffloadedEndpoints);
395
396 /* No controller here offers endpoint offload */
397 *Urb = NULL;
399}
400
401static
403NTAPI
405 _In_ USBD_CLIENT_HANDLE ClientHandle,
406 _In_ USBD_PIPE_HANDLE PipeHandle,
409{
410 UNREFERENCED_PARAMETER(ClientHandle);
411 UNREFERENCED_PARAMETER(PipeHandle);
413
414 *Urb = NULL;
416}
417
419static
420VOID
421NTAPI
425{
427 USHORT Size = sizeof(*Interface);
429
430 if (Interface->Header.Version >= USBD_CLIENT_INTERFACE_VERSION_603 &&
432 {
434 if (Handle->m_VerifierEnabled)
435 Handle->m_VerifierFailSecureTransfer = Extended->VerifierFailSecureTransferSupport;
436
439
440 if (Interface->Header.Size >= sizeof(*Extended))
441 {
444 if (Handle->m_VerifierEnabled)
445 Handle->m_VerifierFailEndpointOffload = Extended->VerifierFailEndpointOffload;
446
447 Size = sizeof(*Extended);
448 }
449 }
450
451 Interface->Header.Size = Size;
452 Interface->Header.Version = Version;
453}
454
456NTAPI
458 _In_ WDFDEVICE Device,
462{
463 UcxRootHub* RootHub = UcxGetRootHubPdoContext(Device)->RootHub;
465
467
469 ? UcxUsbDevice::FromHandle((UCXUSBDEVICE)ExposedInterfaceSpecificData)
470 : RootHub->Device();
471
472 return UcxUsbdHandle::CreateFromQuery(RootHub, UsbDevice, (PUSBD_CLIENT_INTERFACE)ExposedInterface);
473}
474
477UcxUsbdHandle::CreateFromQuery(
481{
484 WDFMEMORY Memory;
487
488 PAGED_CODE();
489
490 if (Interface->Header.Size < sizeof(*Interface))
491 {
492 DPRINT1("USBD client interface size %u, expected at least %u\n",
493 Interface->Header.Size, (ULONG)sizeof(*Interface));
495 }
496
497 if (Interface->Header.Version < USBD_CLIENT_INTERFACE_VERSION)
498 {
499 DPRINT1("USBD client interface version %u is not supported\n", Interface->Header.Version);
501 }
502
503 if (Interface->DeviceObject == NULL || Interface->PoolTag == 0)
504 {
505 DPRINT1("USBD client registration with device object %p, tag 0x%lx\n",
506 Interface->DeviceObject, Interface->PoolTag);
508 }
509
511 Attributes.ParentObject = Device->m_Handle;
512
513 Status = WdfMemoryCreate(&Attributes, NonPagedPool, Interface->PoolTag, sizeof(*Handle), &Memory, &Buffer);
514 if (!NT_SUCCESS(Status))
515 {
516 DPRINT1("USBD handle allocation for device %p failed 0x%lx\n", Device, Status);
517 return Status;
518 }
519
520 /* The handle has to outlive the USB device it was registered against */
522
523 RtlZeroMemory(Buffer, sizeof(*Handle));
524 Handle = new (Buffer) UcxUsbdHandle();
525 Handle->m_ClientDeviceObject = Interface->DeviceObject;
526 Handle->m_PoolTag = Interface->PoolTag;
527 Handle->m_ContractVersion = Interface->ClientContractVersion;
528 Handle->m_ClientContext = Interface->ClientContext;
529 Handle->m_Device = Device;
530 Handle->m_Controller = Device->m_Controller;
531 Handle->m_Memory = Memory;
532 Handle->m_RootHub = RootHub;
533 Handle->m_RootHubPdo = RootHub->Pdo();
534 KeInitializeSpinLock(&Handle->m_XrbLock);
535 InitializeListHead(&Handle->m_XrbList);
536
537 if (Interface->VerifierEnabled != 0)
538 {
539 Handle->m_VerifierEnabled = TRUE;
540 Handle->m_VerifierFailRegistration = Interface->VerifierFailRegistration;
541 Handle->m_VerifierFailChainedMdl = Interface->VerifierFailChainedMdlSupport;
542 Handle->m_VerifierFailStaticStreamSupport = Interface->VerifierFailStaticStreamSupport;
543 Handle->m_VerifierStaticStreamCountOverride = Interface->VerifierStaticStreamCountOverride;
544 Handle->m_VerifierFailEnableStaticStreams = Interface->VerifierFailEnableStaticStreams;
545 }
546
547 Handle->m_TrackXrbs = Handle->m_VerifierEnabled || Device->m_Controller->m_DriverVerifierEnabled;
548
549 /* Not undone when the registration then fails */
550 if (Handle->m_VerifierEnabled)
551 Device->TrackStaleHandles();
552
553 if (UcxVerifierWantsFailure(Handle->m_VerifierFailRegistration))
554 {
555 DPRINT1("Verifier failed USBD client registration for device %p\n", Device);
558 return UcxRandomErrorStatus();
559 }
560
561 Interface->Header.Context = NULL;
562 Interface->Header.InterfaceReference = UcxInterfaceNoOp;
563 Interface->Header.InterfaceDereference = UcxInterfaceNoOp;
564 Interface->Handle = (USBD_CLIENT_HANDLE)Handle;
565 Interface->Unregister = UcxClientUnregister;
566 Interface->AllocUrb = UcxClientAllocUrb;
567 Interface->AllocIsochUrb = UcxClientAllocIsochUrb;
568 Interface->AllocSelectConfigUrb = UcxClientSelectConfigXrbBuild;
569 Interface->AllocSelectInterfaceUrb = UcxClientSelectInterfaceXrbBuild;
570 Interface->ReleaseUrb = UcxClientReleaseUrb;
571
573
574 ObReferenceObject(Handle->m_ClientDeviceObject);
575
576 {
577 SpinLockGuard Guard(&Device->m_UsbdHandleLock);
578
579 InsertTailList(&Device->m_UsbdHandleList, &Handle->m_DeviceLink);
580 }
581
582 InterlockedIncrement(&Device->m_Controller->m_UsbdInterfaceCount);
583 DPRINT("USBD client %p registered handle %p on device %p\n", Interface->DeviceObject, Handle, Device);
584 return STATUS_SUCCESS;
585}
586
587/* A handle orphaned by its device only has its storage left to release */
588VOID
590{
591 WDFMEMORY Memory = m_Memory;
592
593 if (!m_Orphaned)
594 {
595 {
597
600 }
601
603 }
604
606
607 /* Deleting the storage deletes every XRB still allocated under it */
611}
612
613VOID
614NTAPI
617{
618 BOOLEAN Verifying = Device->m_Controller->m_DriverVerifierEnabled;
621
622 SpinLockGuard Guard(&Device->m_UsbdHandleLock);
623
624 for (Entry = Device->m_UsbdHandleList.Flink; Entry != &Device->m_UsbdHandleList; Entry = Entry->Flink)
625 {
627
628 DPRINT1("USBD handle %p of client %p leaked on device %p\n", Handle, Handle->m_ClientDeviceObject, Device);
629
630 if (Verifying || Handle->m_VerifierEnabled)
631 {
635 (ULONG_PTR)Handle->m_ClientDeviceObject,
636 0);
637 }
638
639 ObDereferenceObject(Handle->m_ClientDeviceObject);
640 Handle->m_Orphaned = TRUE;
641 }
642}
643
645NTAPI
648{
650
651 for (Entry = Device->m_UsbdHandleList.Flink; Entry != &Device->m_UsbdHandleList; Entry = Entry->Flink)
652 {
653 if (CONTAINING_RECORD(Entry, UcxUsbdHandle, m_DeviceLink)->m_VerifierEnabled)
654 return TRUE;
655 }
656
657 return FALSE;
658}
659
660/* XRB allocation */
661
666 _Outptr_ UcxXrbPreamble** XrbOut)
667{
669 UcxXrbPreamble* Xrb;
670 WDFMEMORY Memory;
673
674 *XrbOut = NULL;
675
677 Attributes.ParentObject = m_Memory;
678
679 Status = WdfMemoryCreate(&Attributes, NonPagedPool, m_PoolTag, Size, &Memory, &Buffer);
680 if (!NT_SUCCESS(Status))
681 {
682 DPRINT1("XRB allocation of %lu bytes for handle %p failed 0x%lx\n", Size, this, Status);
683 return Status;
684 }
685
686 /* Both released by the free call, which may come after unregister */
690
691 Xrb = (UcxXrbPreamble*)Buffer;
693 Xrb->TotalSize = Size;
695 Xrb->Handle = this;
696 Xrb->State = UCX_XRB_IDLE;
697 Xrb->Type = Type;
698 Xrb->Memory = Memory;
699
700 *XrbOut = Xrb;
701 return STATUS_SUCCESS;
702}
703
704static
705VOID
706NTAPI
708 _In_ UcxXrbPreamble* Xrb)
709{
710 WDFMEMORY Memory = Xrb->Memory;
711 UcxUsbdHandle* Handle = Xrb->Handle;
712 WDFMEMORY HandleMemory = Handle->m_Memory;
713
714 /* After unregister KMDF already deleted it along with the handle storage */
715 if (!Handle->m_Unregistered)
717
719 WdfObjectDereference(HandleMemory);
720}
721
722/* Done last, after every failure point */
723VOID
725 _In_ UcxXrbPreamble* Xrb)
726{
727 if (!m_TrackXrbs)
728 return;
729
730 SpinLockGuard Guard(&m_XrbLock);
731 InsertTailList(&m_XrbList, &Xrb->TrackingLink);
732}
733
734static
736NTAPI
738 _In_ USBD_CLIENT_HANDLE ClientHandle,
740{
743 UcxXrbPreamble* Xrb;
745
746 *Urb = NULL;
747
748 Status = Handle->AllocateXrb(sizeof(UcxXrbPreamble) + sizeof(URB), UCX_XRB_KIND_PLAIN, &Xrb);
749 if (!NT_SUCCESS(Status))
750 return Status;
751
752 /* Carries the HCD's request context like every other request it gets */
753 RequestAttributes = Handle->m_RootHub->m_Config.WdfRequestAttributes;
754 RequestAttributes.ParentObject = Handle->m_RootHubPdo;
755
756 Status = WdfRequestCreate(&RequestAttributes, NULL, &Xrb->Request);
757 if (!NT_SUCCESS(Status))
758 {
759 DPRINT1("XRB request creation for handle %p failed 0x%lx\n", Handle, Status);
761 return Status;
762 }
763
764 Handle->TrackXrb(Xrb);
765 *Urb = UcxUrbFromXrb(Xrb);
766 return STATUS_SUCCESS;
767}
768
769/* Always one spare packet descriptor; isoch XRBs never get a preallocated request */
770static
772NTAPI
774 _In_ USBD_CLIENT_HANDLE ClientHandle,
777{
779 UcxXrbPreamble* Xrb;
781
782 *Urb = NULL;
783
786 &Xrb);
787 if (!NT_SUCCESS(Status))
788 return Status;
789
790 Handle->TrackXrb(Xrb);
791 *Urb = UcxUrbFromXrb(Xrb);
792 return STATUS_SUCCESS;
793}
794
796static
797VOID
798NTAPI
802 _In_ ULONG Pipes)
803{
804 ULONG Index;
805
806 Info->InterfaceNumber = Descriptor->bInterfaceNumber;
807 Info->AlternateSetting = Descriptor->bAlternateSetting;
808 Info->NumberOfPipes = Pipes;
809 Info->Length = (USHORT)GET_USBD_INTERFACE_SIZE(Pipes);
810
811 for (Index = 0; Index < Pipes; Index++)
812 {
813 Info->Pipes[Index].MaximumTransferSize = MAXULONG;
814 Info->Pipes[Index].PipeFlags = 0;
815 }
816}
817
818static
820NTAPI
822 _In_ USBD_CLIENT_HANDLE ClientHandle,
825 _Outptr_ PURB* UrbOut)
826{
828 BOOLEAN Strict = Handle->m_ContractVersion >= USBD_CLIENT_CONTRACT_VERSION_602;
831 UcxXrbPreamble* Xrb;
832 PUCHAR End;
833 ULONG Interfaces = 0;
834 ULONG Pipes = 0;
835 USHORT Size;
836 PURB Urb;
838
839 *UrbOut = NULL;
840
841 /* Sizes add up in 16 bits, as the structure lengths are 16 bit */
842 Size = (USHORT)(sizeof(UcxXrbPreamble) + sizeof(struct _URB_SELECT_CONFIGURATION) -
844
845 for (Entry = InterfaceList; Entry->InterfaceDescriptor != NULL; Entry++)
846 {
847 Pipes += Entry->InterfaceDescriptor->bNumEndpoints;
848 if (Pipes > UCX_MAX_SELECT_PIPES)
849 {
850 DPRINT1("Select config for handle %p has too many pipes\n", Handle);
852 }
853
854 if (Strict && Entry->Interface != NULL)
855 {
856 DPRINT1("Select config entry %p for handle %p already has an interface\n", Entry, Handle);
858 }
859
860 Size += (USHORT)GET_USBD_INTERFACE_SIZE(Entry->InterfaceDescriptor->bNumEndpoints);
861
862 if (Interfaces++ > UCX_MAX_SELECT_INTERFACES)
863 {
864 DPRINT1("Select config for handle %p has too many interfaces\n", Handle);
866 }
867 }
868
869 if (Strict && Entry->Interface != NULL)
870 {
871 DPRINT1("Select config list end %p for handle %p has an interface\n", Entry, Handle);
873 }
874
875 Status = Handle->AllocateXrb(Size, UCX_XRB_KIND_CONFIG, &Xrb);
876 if (!NT_SUCCESS(Status))
877 return Status;
878
879 Urb = UcxUrbFromXrb(Xrb);
880 End = (PUCHAR)Xrb + Size;
881 Info = &Urb->UrbSelectConfiguration.Interface;
882
883 for (Entry = InterfaceList; Entry->InterfaceDescriptor != NULL; Entry++)
884 {
885 /* The descriptor may have changed since it was sized */
886 ULONG EntryPipes = Entry->InterfaceDescriptor->bNumEndpoints;
887
888 if ((PUCHAR)Info + GET_USBD_INTERFACE_SIZE(EntryPipes) > End)
889 {
890 DPRINT1("Interface descriptor %p grew while building select config\n", Entry->InterfaceDescriptor);
893 }
894
895 UcxFillInterfaceInformation(Info, Entry->InterfaceDescriptor, EntryPipes);
896 Entry->Interface = Info;
898 }
899
900 Urb->UrbHeader.Length = (USHORT)(Size - sizeof(UcxXrbPreamble));
901 Urb->UrbHeader.Function = URB_FUNCTION_SELECT_CONFIGURATION;
902 Urb->UrbSelectConfiguration.ConfigurationDescriptor = ConfigurationDescriptor;
903
904 Handle->TrackXrb(Xrb);
905 *UrbOut = Urb;
906 return STATUS_SUCCESS;
907}
908
909static
911NTAPI
913 _In_ USBD_CLIENT_HANDLE ClientHandle,
915 _In_ PUSBD_INTERFACE_LIST_ENTRY InterfaceEntry,
916 _Outptr_ PURB* UrbOut)
917{
920 UcxXrbPreamble* Xrb;
921 ULONG Pipes;
922 USHORT Size;
923 PURB Urb;
925
926 *UrbOut = NULL;
927
928 if (InterfaceEntry->InterfaceDescriptor == NULL || InterfaceEntry->Interface != NULL)
929 {
930 DPRINT1("Select interface entry %p for handle %p is malformed\n", InterfaceEntry, Handle);
932 }
933
934 Pipes = InterfaceEntry->InterfaceDescriptor->bNumEndpoints;
935 if (Pipes > UCX_MAX_SELECT_PIPES)
936 {
937 DPRINT1("Select interface for handle %p has %lu pipes\n", Handle, Pipes);
939 }
940
941 /* With no pipes this is shorter than the URB structure, like the public macro */
943
944 Status = Handle->AllocateXrb(Size, UCX_XRB_KIND_ALT_SETTING, &Xrb);
945 if (!NT_SUCCESS(Status))
946 return Status;
947
948 Urb = UcxUrbFromXrb(Xrb);
949 Info = &Urb->UrbSelectInterface.Interface;
950 UcxFillInterfaceInformation(Info, InterfaceEntry->InterfaceDescriptor, Pipes);
951 InterfaceEntry->Interface = Info;
952
953 Urb->UrbHeader.Length = (USHORT)(Size - sizeof(UcxXrbPreamble));
954 Urb->UrbHeader.Function = URB_FUNCTION_SELECT_INTERFACE;
955 Urb->UrbSelectInterface.ConfigurationHandle = ConfigurationHandle;
956
957 Handle->TrackXrb(Xrb);
958 *UrbOut = Urb;
959 return STATUS_SUCCESS;
960}
961
962static
963VOID
964NTAPI
966 _In_ PURB Urb)
967{
970
971 if (Xrb->Signature != UCX_XRB_SIGNATURE)
972 {
973 DPRINT1("Freeing corrupted XRB for URB %p\n", Urb);
976 0,
977 (ULONG_PTR)Urb,
978 (ULONG_PTR)Handle->m_ClientDeviceObject);
979 }
980
981 if (Xrb->State != UCX_XRB_IDLE)
982 {
983 DPRINT1("Freeing URB %p while it is still active\n", Urb);
986 0,
987 (ULONG_PTR)Urb,
988 (ULONG_PTR)Handle->m_ClientDeviceObject);
989 }
990
991 if (Handle->m_TrackXrbs)
992 {
993 SpinLockGuard Guard(&Handle->m_XrbLock);
994
997 }
998
999 if (Xrb->Request != NULL)
1000 {
1002 Xrb->Request = NULL;
1003 }
1004
1005 UcxDeleteXrbMemory(Xrb);
1006}
1007
1008static
1009VOID
1010NTAPI
1012 _In_ USBD_CLIENT_HANDLE ClientHandle)
1013{
1015}
#define PAGED_CODE()
Type
Definition: Type.h:7
unsigned char BOOLEAN
Definition: actypes.h:127
#define InterlockedIncrement
Definition: armddk.h:53
#define InterlockedDecrement
Definition: armddk.h:52
LONG NTSTATUS
Definition: precomp.h:26
#define DPRINT1
Definition: precomp.h:8
DECLSPEC_NORETURN VOID NTAPI KeBugCheckEx(IN ULONG BugCheckCode, IN ULONG_PTR BugCheckParameter1, IN ULONG_PTR BugCheckParameter2, IN ULONG_PTR BugCheckParameter3, IN ULONG_PTR BugCheckParameter4)
Definition: debug.c:485
Definition: bufpool.h:45
LONG m_UsbdInterfaceCount
Definition: hostctl.h:349
NTSTATUS GetCurrentFrameNumber(_Out_ PULONG FrameNumber)
Definition: hostctl.cpp:564
UcxController * m_Controller
Definition: devobj.h:216
KSPIN_LOCK m_UsbdHandleLock
Definition: devobj.h:274
NTSTATUS AllocateXrb(_In_ ULONG Size, _In_ ULONG Type, _Outptr_ UcxXrbPreamble **Xrb)
Definition: clientif.cpp:663
UcxController * m_Controller
Definition: clientif.h:56
KSPIN_LOCK m_XrbLock
Definition: clientif.h:86
ULONG m_PoolTag
Definition: clientif.h:51
UcxUsbDevice * m_Device
Definition: clientif.h:53
BOOLEAN m_TrackXrbs
Definition: clientif.h:85
BOOLEAN m_Orphaned
Definition: clientif.h:65
LIST_ENTRY m_XrbList
Definition: clientif.h:87
ULONG m_ContractVersion
Definition: clientif.h:49
LIST_ENTRY m_DeviceLink
Definition: clientif.h:62
static UcxUsbdHandle * FromClientHandle(_In_ USBD_CLIENT_HANDLE Handle)
Definition: clientif.h:30
PDEVICE_OBJECT m_ClientDeviceObject
Definition: clientif.h:50
BOOLEAN m_Unregistered
Definition: clientif.h:68
_In_ UcxUsbDevice * Device
Definition: clientif.h:22
VOID TrackXrb(_In_ UcxXrbPreamble *Xrb)
Definition: clientif.cpp:724
WDFMEMORY m_Memory
Definition: clientif.h:57
VOID Unregister()
Definition: clientif.cpp:589
static NTSTATUS USB_BUSIFFN UcxBusEnumLogEntry(_In_ PVOID Context, _In_ ULONG DriverTag, _In_ ULONG EnumTag, _In_ ULONG P1, _In_ ULONG P2)
Definition: clientif.cpp:168
static NTSTATUS USB_BUSIFFN UcxBusQueryBusInformation(_In_ PVOID Context, _In_ ULONG Level, _Inout_ PVOID Buffer, _Out_ PULONG BufferLength, _Out_opt_ PULONG ActualLength)
Definition: clientif.cpp:87
static NTSTATUS USB_BUSIFFN UcxBusQueryBusTimeEx(_In_opt_ PVOID Context, _Out_opt_ PULONG CurrentMicroFrame)
Definition: clientif.cpp:188
static NTSTATUS NTAPI UcxClientOffloadSelectXrbAllocate(_In_ USBD_CLIENT_HANDLE ClientHandle, _In_ USBD_CONFIGURATION_HANDLE ConfigurationHandle, _Inout_ PUSBD_INTERFACE_LIST_ENTRY InterfaceEntry, _In_ ULONG OffloadedEndpoints, _Outptr_ PURB *Urb)
Definition: clientif.cpp:384
static NTSTATUS NTAPI UcxClientOffloadNotifyXrbAllocate(_In_ USBD_CLIENT_HANDLE ClientHandle, _In_ USBD_PIPE_HANDLE PipeHandle, _In_ ULONG Flags, _Outptr_ PURB *Urb)
Definition: clientif.cpp:404
BOOLEAN NTAPI UcxAnyUsbdHandleHasVerifier(_In_ UcxUsbDevice *Device)
Definition: clientif.cpp:646
VOID NTAPI UcxDropLeakedUsbdHandles(_In_ UcxUsbDevice *Device)
Definition: clientif.cpp:615
static NTSTATUS NTAPI UcxClientSelectConfigXrbBuild(_In_ USBD_CLIENT_HANDLE ClientHandle, _In_ PUSB_CONFIGURATION_DESCRIPTOR ConfigurationDescriptor, _In_ PUSBD_INTERFACE_LIST_ENTRY InterfaceList, _Outptr_ PURB *UrbOut)
Definition: clientif.cpp:821
static VOID USB_BUSIFFN UcxBusGetUsbdiVersion(_In_ PVOID Context, _Out_opt_ PUSBD_VERSION_INFORMATION VersionInformation, _Out_opt_ PULONG HcdCapabilities)
Definition: clientif.cpp:37
#define UCX_MAX_SELECT_INTERFACES
Definition: clientif.cpp:14
#define UCX_UHCI_OPTION_FLAGS
Definition: clientif.cpp:20
static NTSTATUS USB_BUSIFFN UcxBusQueryControllerType(_In_opt_ PVOID Context, _Out_opt_ PULONG HcdiOptionFlags, _Out_opt_ PUSHORT PciVendorId, _Out_opt_ PUSHORT PciDeviceId, _Out_opt_ PUCHAR PciClass, _Out_opt_ PUCHAR PciSubClass, _Out_opt_ PUCHAR PciRevisionId, _Out_opt_ PUCHAR PciProgIf)
Definition: clientif.cpp:212
#define UCX_FAKE_TOTAL_BANDWIDTH
Definition: clientif.cpp:17
static NTSTATUS NTAPI UcxClientAllocUrb(_In_ USBD_CLIENT_HANDLE ClientHandle, _Outptr_ PURB *Urb)
Definition: clientif.cpp:737
static VOID NTAPI UcxClientReleaseUrb(_In_ PURB Urb)
Definition: clientif.cpp:965
static NTSTATUS NTAPI UcxClientAllocIsochUrb(_In_ USBD_CLIENT_HANDLE ClientHandle, _In_ ULONG NumberOfIsochPackets, _Outptr_ PURB *Urb)
Definition: clientif.cpp:773
static VOID NTAPI UcxClientUnregister(_In_ USBD_CLIENT_HANDLE ClientHandle)
Definition: clientif.cpp:1011
static NTSTATUS USB_BUSIFFN UcxBusSubmitIsoOutUrb(_In_ PVOID Context, _In_ PURB Urb)
Definition: clientif.cpp:73
static NTSTATUS NTAPI UcxClientSelectInterfaceXrbBuild(_In_ USBD_CLIENT_HANDLE ClientHandle, _In_ USBD_CONFIGURATION_HANDLE ConfigurationHandle, _In_ PUSBD_INTERFACE_LIST_ENTRY InterfaceEntry, _Outptr_ PURB *UrbOut)
Definition: clientif.cpp:912
static NTSTATUS USB_BUSIFFN UcxBusQueryBusTime(_In_ PVOID Context, _Out_opt_ PULONG CurrentFrame)
Definition: clientif.cpp:57
#define UCX_MAX_SELECT_PIPES
Definition: clientif.cpp:13
static VOID NTAPI UcxDeleteXrbMemory(_In_ UcxXrbPreamble *Xrb)
Definition: clientif.cpp:707
static BOOLEAN USB_BUSIFFN UcxBusIsDeviceHighSpeed(_In_opt_ PVOID Context)
Definition: clientif.cpp:156
static BOOLEAN NTAPI UcxIsLowOrFullSpeed(_In_ UcxUsbDevice *Device)
Definition: clientif.cpp:26
#define UCX_EHCI_OPTION_FLAGS
Definition: clientif.cpp:21
static VOID NTAPI UcxFillClientInterface603(_Inout_ UcxUsbdHandle *Handle, _Inout_ PUSBD_CLIENT_INTERFACE Interface)
Definition: clientif.cpp:422
static VOID NTAPI UcxFillInterfaceInformation(_Out_ PUSBD_INTERFACE_INFORMATION Info, _In_ PUSB_INTERFACE_DESCRIPTOR Descriptor, _In_ ULONG Pipes)
Definition: clientif.cpp:799
#define UCX_USBDI_VERSION
Definition: clientif.h:11
FORCEINLINE PURB NTAPI UcxUrbFromXrb(_In_ UcxXrbPreamble *Xrb)
Definition: clientxrb.h:69
#define UCX_XRB_SIGNATURE
Definition: clientxrb.h:11
#define UCX_XRB_KIND_PLAIN
Definition: clientxrb.h:13
FORCEINLINE UcxXrbPreamble *NTAPI UcxXrbFromUrb(_In_ PURB Urb)
Definition: clientxrb.h:60
#define UCX_XRB_KIND_ISO_PACKETS
Definition: clientxrb.h:16
#define UCX_USB3_ACTIVE_URB_REUSED
Definition: clientxrb.h:23
#define UCX_XRB_KIND_CONFIG
Definition: clientxrb.h:14
#define UCX_USB3_HANDLE_LEAKED
Definition: clientxrb.h:29
#define UCX_BUGCHECK_USB3
Definition: clientxrb.h:22
#define UCX_USB3_XRB_CORRUPTED
Definition: clientxrb.h:24
#define UCX_XRB_IDLE
Definition: clientxrb.h:18
#define UCX_XRB_KIND_ALT_SETTING
Definition: clientxrb.h:15
#define STATUS_NOT_SUPPORTED
Definition: d3dkmdt.h:48
PUCHAR End
Definition: desccheck.cpp:2229
LPWSTR Name
Definition: desk.c:124
_In_ PVOID BusContext
Definition: devhcd.cpp:1395
PLIST_ENTRY Entry
Definition: devhcd.cpp:1262
_In_ ULONG Attributes
Definition: dispmprt.h:1077
_In_ ULONG _In_ UCHAR Level
Definition: dispmprt.h:1329
_In_ D3DDDI_VIDEO_PRESENT_TARGET_ID _In_ ULONG _In_ ULONG Flags
Definition: dispmprt.h:245
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
#define _IRQL_requires_(irql)
Definition: driverspecs.h:229
#define RemoveEntryList(Entry)
Definition: env_spec_w32.h:986
#define InsertTailList(ListHead, Entry)
#define PASSIVE_LEVEL
Definition: env_spec_w32.h:693
#define NonPagedPool
Definition: env_spec_w32.h:307
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
#define KeInitializeSpinLock(sl)
Definition: env_spec_w32.h:604
ULONG Handle
Definition: gdb_input.c:15
Status
Definition: gdiplustypes.h:24
_In_ UCXUSBDEVICE UsbDevice
Definition: hostctl.h:31
#define USB_BUSIFFN
Definition: hubbusif.h:22
VOID NTAPI UcxInterfaceNoOp(_In_ PVOID Context)
_Must_inspect_result_ _In_ PUCXHUB_DEVICE_CREATE_INFO _Out_ UCXUSBDEVICE * Device
Definition: hubucx.h:258
_In_ PIRP _In_ PIO_COMPLETION_ROUTINE _In_ PVOID Context
Definition: kse.h:81
if(dx< 0)
Definition: linetemp.h:194
_Must_inspect_result_ _Out_ PNDIS_STATUS _Out_ PNDIS_HANDLE ConfigurationHandle
Definition: ndis.h:3945
#define _Out_opt_
Definition: no_sal2.h:214
#define _Inout_
Definition: no_sal2.h:162
#define _Outptr_
Definition: no_sal2.h:262
#define _Inout_opt_
Definition: no_sal2.h:216
#define _Out_
Definition: no_sal2.h:160
#define _In_
Definition: no_sal2.h:158
#define _In_opt_
Definition: no_sal2.h:212
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:329
unsigned short USHORT
Definition: pedump.c:61
EVT_WDF_DEVICE_PROCESS_QUERY_INTERFACE_REQUEST UcxEvtQueryUsbdClientInterface
Definition: rhub.h:193
EVT_WDF_DEVICE_PROCESS_QUERY_INTERFACE_REQUEST UcxEvtQueryUsbdiInterface
Definition: rhub.h:192
#define STATUS_SUCCESS
Definition: shellext.h:65
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:69
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
#define DPRINT
Definition: sndvol32.h:73
ULONG Signature
Definition: clientxrb.h:47
ULONG ContractVersion
Definition: clientxrb.h:35
WDFREQUEST Request
Definition: clientxrb.h:41
ULONG TotalSize
Definition: clientxrb.h:34
WDFMEMORY Memory
Definition: clientxrb.h:40
LIST_ENTRY TrackingLink
Definition: clientxrb.h:42
UcxUsbdHandle * Handle
Definition: clientxrb.h:39
Definition: typedefs.h:120
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
Definition: usb.h:565
PFN_USBD_CLIENT_OFFLOAD_SELECT_XRB_ALLOCATE OffloadSelectInterfaceXrbAllocate
Definition: usbdclient.h:130
PFN_USBD_CLIENT_OFFLOAD_NOTIFY_XRB_ALLOCATE OffloadNotificationXrbAllocate
Definition: usbdclient.h:132
PFN_USBD_CLIENT_ISOCH_XRB_ALLOCATE SecureIsochXrbAllocate
Definition: usbdclient.h:126
Definition: usbdlib.h:7
WCHAR ControllerNameUnicodeString[1]
Definition: usbbusif.h:54
PINTERFACE_REFERENCE InterfaceReference
Definition: usbbusif.h:148
PUSB_BUSIFFN_SUBMIT_ISO_OUT_URB SubmitIsoOutUrb
Definition: usbbusif.h:152
PUSB_BUSIFFN_QUERY_CONTROLLER_TYPE QueryControllerType
Definition: usbbusif.h:157
PUSB_BUSIFFN_QUERY_BUS_TIME QueryBusTime
Definition: usbbusif.h:151
PINTERFACE_DEREFERENCE InterfaceDereference
Definition: usbbusif.h:149
PUSB_BUSIFFN_GETUSBDI_VERSION GetUSBDIVersion
Definition: usbbusif.h:150
PUSB_BUSIFFN_IS_DEVICE_HIGH_SPEED IsDeviceHighSpeed
Definition: usbbusif.h:154
PUSB_BUSIFFN_QUERY_BUS_TIME_EX QueryBusTimeEx
Definition: usbbusif.h:156
PUSB_BUSIFFN_QUERY_BUS_INFORMATION QueryBusInformation
Definition: usbbusif.h:153
PUSB_BUSIFFN_ENUM_LOG_ENTRY EnumLogEntry
Definition: usbbusif.h:155
#define MAXULONG
Definition: typedefs.h:251
uint32_t * PULONG
Definition: typedefs.h:59
unsigned char UCHAR
Definition: typedefs.h:53
#define NTAPI
Definition: typedefs.h:36
uint16_t * PUSHORT
Definition: typedefs.h:56
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
unsigned char * PUCHAR
Definition: typedefs.h:53
uint32_t ULONG
Definition: typedefs.h:59
_Must_inspect_result_ _In_ WDFDEVICE _In_ PUCX_CONTROLLER_CONFIG _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ UCXCONTROLLER * Controller
_Must_inspect_result_ _In_ UCXCONTROLLER _In_ PUCX_ROOTHUB_CONFIG _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ UCXROOTHUB * RootHub
Definition: ucxroothub.h:299
_In_ UCXUSBDEVICE _In_ ULONG Interface
Definition: ucxusbdevice.h:428
BOOLEAN NTAPI UcxVerifierWantsFailure(_In_ ULONG Setting)
Definition: ucxutil.cpp:71
NTSTATUS NTAPI UcxRandomErrorStatus(VOID)
Definition: ucxutil.cpp:93
FORCEINLINE VOID NTAPI UcxClearListEntry(_Out_ PLIST_ENTRY Entry)
Definition: ucxutil.h:84
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
@ UsbLowSpeed
Definition: usb200.h:42
@ UsbFullSpeed
Definition: usb200.h:43
struct _USBD_INTERFACE_INFORMATION * PUSBD_INTERFACE_INFORMATION
#define URB_FUNCTION_SELECT_INTERFACE
Definition: usb.h:87
#define URB_FUNCTION_SELECT_CONFIGURATION
Definition: usb.h:86
struct _USB_BUS_INFORMATION_LEVEL_0 * PUSB_BUS_INFORMATION_LEVEL_0
struct _USB_BUS_INTERFACE_USBDI_V3 * PUSB_BUS_INTERFACE_USBDI_V3
#define USB_BUSIF_USBDI_VERSION_1
Definition: usbbusif.h:74
struct _USB_BUS_INTERFACE_USBDI_V3 USB_BUS_INTERFACE_USBDI_V3
struct _USB_BUS_INTERFACE_USBDI_V1 USB_BUS_INTERFACE_USBDI_V1
#define USB_BUSIF_USBDI_VERSION_0
Definition: usbbusif.h:73
struct _USB_BUS_INTERFACE_USBDI_V0 USB_BUS_INTERFACE_USBDI_V0
#define USB_BUSIF_USBDI_VERSION_2
Definition: usbbusif.h:75
struct _USB_BUS_INFORMATION_LEVEL_1 * PUSB_BUS_INFORMATION_LEVEL_1
#define USB_BUSIF_USBDI_VERSION_3
Definition: usbbusif.h:76
struct _USB_BUS_INFORMATION_LEVEL_0 USB_BUS_INFORMATION_LEVEL_0
struct _USB_BUS_INFORMATION_LEVEL_1 USB_BUS_INFORMATION_LEVEL_1
struct _USB_BUS_INTERFACE_USBDI_V2 USB_BUS_INTERFACE_USBDI_V2
#define USBD_CLIENT_INTERFACE_VERSION
Definition: usbdclient.h:18
#define USBD_CLIENT_INTERFACE_VERSION_603
Definition: usbdclient.h:100
struct _USBD_CLIENT_INTERFACE_603 * PUSBD_CLIENT_INTERFACE_603
#define USBD_CLIENT_INTERFACE_603_SIZE_SECURE
Definition: usbdclient.h:136
_In_opt_ PUSB_CONFIGURATION_DESCRIPTOR ConfigurationDescriptor
Definition: usbdlib.h:331
#define GET_USBD_INTERFACE_SIZE(numEndpoints)
Definition: usbdlib.h:148
#define GET_SELECT_INTERFACE_REQUEST_SIZE(totalPipes)
Definition: usbdlib.h:144
#define USBD_CLIENT_CONTRACT_VERSION_602
Definition: usbdlib.h:100
_In_ PUSBD_INTERFACE_LIST_ENTRY InterfaceList
Definition: usbdlib.h:208
#define GET_ISO_URB_SIZE(n)
Definition: usbdlib.h:152
_In_opt_ PUSB_CONFIGURATION_DESCRIPTOR _Inout_ PUSBD_INTERFACE_LIST_ENTRY _Outptr_ PURB * Urb
Definition: usbdlib.h:333
WdfObjectDelete(String)
ULONG ActualLength
Definition: userreq.cpp:702
WdfStringGetUnicodeString(Original, &Name)
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
Definition: wdfchildlist.h:690
_In_ WDFCOLLECTION _In_ ULONG Index
_In_ PWDFDEVICE_INIT _In_ PWDF_OBJECT_ATTRIBUTES RequestAttributes
Definition: wdfdevice.h:3437
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4539
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ ULONG BufferLength
Definition: wdfdevice.h:3777
_Must_inspect_result_ _In_ WDFDEVICE _In_ LPCGUID InterfaceType
Definition: wdffdo.h:463
_Must_inspect_result_ _In_ WDFDEVICE _In_ LPCGUID _Out_ PINTERFACE _In_ USHORT _In_ USHORT Version
Definition: wdffdo.h:469
_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
FORCEINLINE VOID WDF_OBJECT_ATTRIBUTES_INIT(_Out_ PWDF_OBJECT_ATTRIBUTES Attributes)
Definition: wdfobject.h:147
#define WdfObjectReference(Handle)
Definition: wdfobject.h:803
#define WdfObjectDereference(Handle)
Definition: wdfobject.h:826
WDF_EXTERN_C_START typedef _In_ LPGUID _Inout_ PINTERFACE ExposedInterface
WDF_EXTERN_C_START typedef _In_ LPGUID _Inout_ PINTERFACE _Inout_opt_ PVOID ExposedInterfaceSpecificData
_Must_inspect_result_ _In_ WDFIORESLIST _In_ PIO_RESOURCE_DESCRIPTOR Descriptor
Definition: wdfresource.h:342
_Must_inspect_result_ _In_ WDFUSBDEVICE _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ ULONG NumberOfIsochPackets
Definition: wdfusb.h:1703
ActualNumberDriverObjects * sizeof(PDRIVER_OBJECT)) PDRIVER_OBJECT *DriverObjectList
#define PCI_SUBCLASS_SB_USB
Definition: iotypes.h:4223
#define PCI_CLASS_SERIAL_BUS_CTLR
Definition: iotypes.h:4130
#define ObDereferenceObject
Definition: obfuncs.h:203
#define ObReferenceObject
Definition: obfuncs.h:204
#define NT_ASSERT
Definition: rtlfuncs.h:3334