ReactOS 0.4.17-dev-1281-g065abb3
hubdescval.cpp
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS SuperSpeed USB Hub Driver
3 * LICENSE: MIT (https://spdx.org/licenses/MIT)
4 * PURPOSE: Descriptor validation of the hub's own descriptors
5 * COPYRIGHT: Copyright 2026 Justin Miller <justin.miller@reactos.org>
6 */
7
8#include "usbhub3.h"
9
10#define NDEBUG
11#include <debug.h>
12
14static
15VOID
21{
22 if (Context == NULL)
23 return;
24
25 if (Warning)
26 DPRINT("Hub %p descriptor check %s (%lu) ignored\n", Context, HubDescCodeName(Code), (ULONG)Code);
27 else
28 DPRINT1("Hub %p descriptor check %s (%lu) failed\n", Context, HubDescCodeName(Code), (ULONG)Code);
29}
30
31/* The global strictness flags never apply to a hub's own descriptors */
32static
33VOID
38{
41 Context->LogContext = Hub;
42}
43
50{
52
55}
56
63{
65
68}
69
76{
78
81}
82
83VOID
87{
89
92}
unsigned char BOOLEAN
Definition: actypes.h:127
#define DPRINT1
Definition: precomp.h:8
HubFdo * Hub
Definition: bootdev.cpp:261
Definition: fdo.h:132
HubParentInfo m_ParentInfo
Definition: fdo.h:360
UCXHUB_PARENT_INTERFACE m_Parent
Definition: fdo.h:355
@ Warning
VOID NTAPI HubDescInitHubContext(_Out_ HubDescContext *Context, _In_ USHORT BcdUsb, _In_ USB_DEVICE_SPEED Speed)
Definition: desccheck.cpp:112
BOOLEAN NTAPI HubDescCheck30Hub(_In_ const HubDescContext *Context, _In_reads_bytes_opt_(Length) PUSB_30_HUB_DESCRIPTOR Descriptor, _In_ ULONG Length)
Definition: desccheck.cpp:3272
BOOLEAN NTAPI HubDescCheckConfiguration(_In_ const HubDescContext *Context, _In_reads_bytes_opt_(Length) PUSB_CONFIGURATION_DESCRIPTOR Descriptor, _In_ ULONG Length, _Out_opt_ PBOOLEAN SupportsStreams)
Definition: desccheck.cpp:1237
VOID NTAPI HubDescLog(_In_ const HubDescContext *Context, _In_ HubDescCode Code, _In_ BOOLEAN Warning)
Definition: desccheck.cpp:383
BOOLEAN NTAPI HubDescCheck20Hub(_In_ const HubDescContext *Context, _In_reads_bytes_opt_(Length) PUSB_HUB_DESCRIPTOR Descriptor, _In_ ULONG Length)
Definition: desccheck.cpp:3198
PCSTR NTAPI HubDescCodeName(_In_ HubDescCode Code)
Definition: desccheck.cpp:128
HubDescCode
Definition: desccheck.h:15
@ ConfigTotalLengthTooLarge
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
BOOLEAN NTAPI HubValidateHubConfiguration(_In_ HubFdo *Hub, _In_reads_bytes_(Length) PUSB_CONFIGURATION_DESCRIPTOR Descriptor, _In_ ULONG Length)
Definition: hubdescval.cpp:46
BOOLEAN NTAPI HubCheckUsb2HubDescriptor(_In_ HubFdo *Hub, _In_reads_bytes_(Length) PUSB_HUB_DESCRIPTOR Descriptor, _In_ ULONG Length)
Definition: hubdescval.cpp:59
static VOID NTAPI HubBuildDescContext(_In_ HubFdo *Hub, _Out_ HubDescContext *Context)
Definition: hubdescval.cpp:35
VOID NTAPI HubLogConfigTotalLengthMismatch(_In_ HubFdo *Hub)
Definition: hubdescval.cpp:85
BOOLEAN NTAPI HubCheckUsb3HubDescriptor(_In_ HubFdo *Hub, _In_reads_bytes_(Length) PUSB_30_HUB_DESCRIPTOR Descriptor, _In_ ULONG Length)
Definition: hubdescval.cpp:72
static VOID NTAPI HubLogHubFinding(_In_opt_ PVOID Context, _In_ HubDescCode Code, _In_ BOOLEAN Warning)
Definition: hubdescval.cpp:17
_In_ PIRP _In_ PIO_COMPLETION_ROUTINE _In_ PVOID Context
Definition: kse.h:81
#define _In_reads_bytes_(s)
Definition: no_sal2.h:170
#define _Out_
Definition: no_sal2.h:160
#define _In_
Definition: no_sal2.h:158
#define _In_opt_
Definition: no_sal2.h:212
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
#define DPRINT
Definition: sndvol32.h:73
USB_DEVICE_DESCRIPTOR DeviceDescriptor
Definition: fdo.h:89
USB_DEVICE_SPEED HubSpeed
Definition: hubucx.h:504
#define NTAPI
Definition: typedefs.h:36
uint32_t ULONG
Definition: typedefs.h:59
_In_ UCHAR _In_ UCHAR _In_ ULONG Code
Definition: wdfdevice.h:1707
_Must_inspect_result_ _In_ WDFIORESLIST _In_ PIO_RESOURCE_DESCRIPTOR Descriptor
Definition: wdfresource.h:342