1 use shared::basetsd::ULONG64;
2 use shared::guiddef::GUID;
3 use shared::minwindef::{DWORD, UCHAR, ULONG, USHORT};
4 use shared::ntdef::{BOOLEAN, HANDLE, LARGE_INTEGER, LONG, NTSTATUS, PWCHAR, WCHAR};
5 use shared::usb::USBD_STATUS;
6 use shared::usbiodef::{
7     FILE_DEVICE_USB, HCD_DIAGNOSTIC_MODE_OFF, HCD_DIAGNOSTIC_MODE_ON, HCD_DISABLE_PORT,
8     HCD_ENABLE_PORT, HCD_GET_DRIVERKEY_NAME, HCD_GET_ROOT_HUB_NAME, HCD_GET_STATS_1,
9     HCD_GET_STATS_2, USB_CYCLE_PORT, USB_DIAG_IGNORE_HUBS_OFF, USB_DIAG_IGNORE_HUBS_ON,
10     USB_ENABLE_PORT, USB_FAIL_GET_STATUS, USB_GET_BUSGUID_INFO, USB_GET_BUS_INFO,
11     USB_GET_CONTROLLER_NAME, USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION,
12     USB_GET_DEVICE_CHARACTERISTICS, USB_GET_DEVICE_HANDLE, USB_GET_DEVICE_HANDLE_EX,
13     USB_GET_FRAME_NUMBER_AND_QPC_FOR_TIME_SYNC, USB_GET_HUB_CAPABILITIES,
14     USB_GET_HUB_CAPABILITIES_EX, USB_GET_HUB_CONFIG_INFO, USB_GET_HUB_COUNT,
15     USB_GET_HUB_INFORMATION_EX, USB_GET_HUB_NAME, USB_GET_NODE_CONNECTION_ATTRIBUTES,
16     USB_GET_NODE_CONNECTION_DRIVERKEY_NAME, USB_GET_NODE_CONNECTION_INFORMATION,
17     USB_GET_NODE_CONNECTION_INFORMATION_EX, USB_GET_NODE_CONNECTION_INFORMATION_EX_V2,
18     USB_GET_NODE_CONNECTION_NAME, USB_GET_NODE_INFORMATION, USB_GET_PARENT_HUB_INFO,
19     USB_GET_PORT_CONNECTOR_PROPERTIES, USB_GET_PORT_STATUS, USB_GET_ROOTHUB_PDO,
20     USB_GET_TOPOLOGY_ADDRESS, USB_GET_TRANSPORT_CHARACTERISTICS, USB_GET_TT_DEVICE_HANDLE,
21     USB_HUB_CYCLE_PORT, USB_IDLE_NOTIFICATION, USB_IDLE_NOTIFICATION_EX,
22     USB_NOTIFY_ON_TRANSPORT_CHARACTERISTICS_CHANGE, USB_RECORD_FAILURE,
23     USB_REGISTER_COMPOSITE_DEVICE, USB_REGISTER_FOR_TRANSPORT_CHARACTERISTICS_CHANGE,
24     USB_REQUEST_REMOTE_WAKE_NOTIFICATION, USB_REQ_GLOBAL_RESUME, USB_REQ_GLOBAL_SUSPEND,
25     USB_RESET_HUB, USB_RESET_PORT, USB_START_TRACKING_FOR_TIME_SYNC,
26     USB_STOP_TRACKING_FOR_TIME_SYNC, USB_SUBMIT_URB, USB_UNREGISTER_COMPOSITE_DEVICE,
27     USB_UNREGISTER_FOR_TRANSPORT_CHARACTERISTICS_CHANGE,
28 };
29 use shared::usbspec::{
30     USB_30_HUB_DESCRIPTOR, USB_CONFIGURATION_DESCRIPTOR, USB_DEVICE_DESCRIPTOR, USB_DEVICE_SPEED,
31     USB_ENDPOINT_DESCRIPTOR, USB_HUB_DESCRIPTOR,
32 };
33 use um::winioctl::{FILE_ANY_ACCESS, FILE_DEVICE_USBEX, METHOD_BUFFERED, METHOD_NEITHER};
34 pub const IOCTL_INTERNAL_USB_SUBMIT_URB: DWORD
35     = CTL_CODE!(FILE_DEVICE_USB, USB_SUBMIT_URB, METHOD_NEITHER, FILE_ANY_ACCESS);
36 pub const IOCTL_INTERNAL_USB_RESET_PORT: DWORD
37     = CTL_CODE!(FILE_DEVICE_USB, USB_RESET_PORT, METHOD_NEITHER, FILE_ANY_ACCESS);
38 pub const IOCTL_INTERNAL_USB_GET_ROOTHUB_PDO: DWORD
39     = CTL_CODE!(FILE_DEVICE_USB, USB_GET_ROOTHUB_PDO, METHOD_NEITHER, FILE_ANY_ACCESS);
40 pub const USBD_PORT_ENABLED: DWORD = 0x00000001;
41 pub const USBD_PORT_CONNECTED: DWORD = 0x00000002;
42 pub const IOCTL_INTERNAL_USB_GET_PORT_STATUS: DWORD
43     = CTL_CODE!(FILE_DEVICE_USB, USB_GET_PORT_STATUS, METHOD_NEITHER, FILE_ANY_ACCESS);
44 pub const IOCTL_INTERNAL_USB_ENABLE_PORT: DWORD
45     = CTL_CODE!(FILE_DEVICE_USB, USB_ENABLE_PORT, METHOD_NEITHER, FILE_ANY_ACCESS);
46 pub const IOCTL_INTERNAL_USB_GET_HUB_COUNT: DWORD
47     = CTL_CODE!(FILE_DEVICE_USB, USB_GET_HUB_COUNT, METHOD_NEITHER, FILE_ANY_ACCESS);
48 pub const IOCTL_INTERNAL_USB_CYCLE_PORT: DWORD
49     = CTL_CODE!(FILE_DEVICE_USB, USB_CYCLE_PORT, METHOD_NEITHER, FILE_ANY_ACCESS);
50 pub const IOCTL_INTERNAL_USB_GET_HUB_NAME: DWORD
51     = CTL_CODE!(FILE_DEVICE_USB, USB_GET_HUB_NAME, METHOD_BUFFERED, FILE_ANY_ACCESS);
52 pub const IOCTL_INTERNAL_USB_GET_BUS_INFO: DWORD
53     = CTL_CODE!(FILE_DEVICE_USB, USB_GET_BUS_INFO, METHOD_BUFFERED, FILE_ANY_ACCESS);
54 pub const IOCTL_INTERNAL_USB_GET_CONTROLLER_NAME: DWORD
55     = CTL_CODE!(FILE_DEVICE_USB, USB_GET_CONTROLLER_NAME, METHOD_BUFFERED, FILE_ANY_ACCESS);
56 pub const IOCTL_INTERNAL_USB_GET_BUSGUID_INFO: DWORD
57     = CTL_CODE!(FILE_DEVICE_USB, USB_GET_BUSGUID_INFO, METHOD_BUFFERED, FILE_ANY_ACCESS);
58 pub const IOCTL_INTERNAL_USB_GET_PARENT_HUB_INFO: DWORD
59     = CTL_CODE!(FILE_DEVICE_USB, USB_GET_PARENT_HUB_INFO, METHOD_BUFFERED, FILE_ANY_ACCESS);
60 pub const IOCTL_INTERNAL_USB_SUBMIT_IDLE_NOTIFICATION: DWORD
61     = CTL_CODE!(FILE_DEVICE_USB, USB_IDLE_NOTIFICATION, METHOD_NEITHER, FILE_ANY_ACCESS);
62 pub const IOCTL_INTERNAL_USB_GET_DEVICE_HANDLE: DWORD
63     = CTL_CODE!(FILE_DEVICE_USB, USB_GET_DEVICE_HANDLE, METHOD_NEITHER, FILE_ANY_ACCESS);
64 pub const IOCTL_INTERNAL_USB_NOTIFY_IDLE_READY: DWORD
65     = CTL_CODE!(FILE_DEVICE_USB, USB_IDLE_NOTIFICATION_EX, METHOD_NEITHER, FILE_ANY_ACCESS);
66 pub const IOCTL_INTERNAL_USB_REQ_GLOBAL_SUSPEND: DWORD
67     = CTL_CODE!(FILE_DEVICE_USB, USB_REQ_GLOBAL_SUSPEND, METHOD_NEITHER, FILE_ANY_ACCESS);
68 pub const IOCTL_INTERNAL_USB_REQ_GLOBAL_RESUME: DWORD
69     = CTL_CODE!(FILE_DEVICE_USB, USB_REQ_GLOBAL_RESUME, METHOD_NEITHER, FILE_ANY_ACCESS);
70 STRUCT!{struct USB_START_FAILDATA {
71     LengthInBytes: ULONG,
72     NtStatus: NTSTATUS,
73     UsbdStatus: USBD_STATUS,
74     ConnectStatus: ULONG,
75     DriverData: [UCHAR; 4],
76 }}
77 pub type PUSB_START_FAILDATA = *mut USB_START_FAILDATA;
78 pub const IOCTL_INTERNAL_USB_RECORD_FAILURE: DWORD
79     = CTL_CODE!(FILE_DEVICE_USB, USB_RECORD_FAILURE, METHOD_NEITHER, FILE_ANY_ACCESS);
80 pub const IOCTL_INTERNAL_USB_GET_DEVICE_HANDLE_EX: DWORD
81     = CTL_CODE!(FILE_DEVICE_USB, USB_GET_DEVICE_HANDLE_EX, METHOD_NEITHER, FILE_ANY_ACCESS);
82 pub const IOCTL_INTERNAL_USB_GET_TT_DEVICE_HANDLE: DWORD
83     = CTL_CODE!(FILE_DEVICE_USB, USB_GET_TT_DEVICE_HANDLE, METHOD_NEITHER, FILE_ANY_ACCESS);
84 STRUCT!{struct USB_TOPOLOGY_ADDRESS {
85     PciBusNumber: ULONG,
86     PciDeviceNumber: ULONG,
87     PciFunctionNumber: ULONG,
88     Reserved: ULONG,
89     RootHubPortNumber: USHORT,
90     HubPortNumber: [USHORT; 5],
91     Reserved2: USHORT,
92 }}
93 pub type PUSB_TOPOLOGY_ADDRESS = *mut USB_TOPOLOGY_ADDRESS;
94 pub const IOCTL_INTERNAL_USB_GET_TOPOLOGY_ADDRESS: DWORD
95     = CTL_CODE!(FILE_DEVICE_USB, USB_GET_TOPOLOGY_ADDRESS, METHOD_NEITHER, FILE_ANY_ACCESS);
96 pub const IOCTL_INTERNAL_USB_GET_DEVICE_CONFIG_INFO: DWORD
97     = CTL_CODE!(FILE_DEVICE_USB, USB_GET_HUB_CONFIG_INFO, METHOD_NEITHER, FILE_ANY_ACCESS);
98 pub const IOCTL_INTERNAL_USB_REGISTER_COMPOSITE_DEVICE: DWORD
99     = CTL_CODE!(FILE_DEVICE_USBEX, USB_REGISTER_COMPOSITE_DEVICE, METHOD_NEITHER, FILE_ANY_ACCESS);
100 pub const IOCTL_INTERNAL_USB_UNREGISTER_COMPOSITE_DEVICE: DWORD
101     = CTL_CODE!(FILE_DEVICE_USBEX, USB_UNREGISTER_COMPOSITE_DEVICE, METHOD_NEITHER,
102         FILE_ANY_ACCESS);
103 pub const IOCTL_INTERNAL_USB_REQUEST_REMOTE_WAKE_NOTIFICATION: DWORD
104     = CTL_CODE!(FILE_DEVICE_USBEX, USB_REQUEST_REMOTE_WAKE_NOTIFICATION, METHOD_NEITHER,
105         FILE_ANY_ACCESS);
106 pub const IOCTL_INTERNAL_USB_FAIL_GET_STATUS_FROM_DEVICE: DWORD
107     = CTL_CODE!(FILE_DEVICE_USB, USB_FAIL_GET_STATUS, METHOD_NEITHER, FILE_ANY_ACCESS);
108 pub const IOCTL_USB_HCD_GET_STATS_1: DWORD
109     = CTL_CODE!(FILE_DEVICE_USB, HCD_GET_STATS_1, METHOD_BUFFERED, FILE_ANY_ACCESS);
110 pub const IOCTL_USB_HCD_GET_STATS_2: DWORD
111     = CTL_CODE!(FILE_DEVICE_USB, HCD_GET_STATS_2, METHOD_BUFFERED, FILE_ANY_ACCESS);
112 pub const IOCTL_USB_HCD_DISABLE_PORT: DWORD
113     = CTL_CODE!(FILE_DEVICE_USB, HCD_DISABLE_PORT, METHOD_BUFFERED, FILE_ANY_ACCESS);
114 pub const IOCTL_USB_HCD_ENABLE_PORT: DWORD
115     = CTL_CODE!(FILE_DEVICE_USB, HCD_ENABLE_PORT, METHOD_BUFFERED, FILE_ANY_ACCESS);
116 pub const IOCTL_USB_DIAGNOSTIC_MODE_ON: DWORD
117     = CTL_CODE!(FILE_DEVICE_USB, HCD_DIAGNOSTIC_MODE_ON, METHOD_BUFFERED, FILE_ANY_ACCESS);
118 pub const IOCTL_USB_DIAGNOSTIC_MODE_OFF: DWORD
119     = CTL_CODE!(FILE_DEVICE_USB, HCD_DIAGNOSTIC_MODE_OFF, METHOD_BUFFERED, FILE_ANY_ACCESS);
120 pub const IOCTL_USB_GET_ROOT_HUB_NAME: DWORD
121     = CTL_CODE!(FILE_DEVICE_USB, HCD_GET_ROOT_HUB_NAME, METHOD_BUFFERED, FILE_ANY_ACCESS);
122 pub const IOCTL_GET_HCD_DRIVERKEY_NAME: DWORD
123     = CTL_CODE!(FILE_DEVICE_USB, HCD_GET_DRIVERKEY_NAME, METHOD_BUFFERED, FILE_ANY_ACCESS);
124 pub const IOCTL_USB_GET_NODE_INFORMATION: DWORD
125     = CTL_CODE!(FILE_DEVICE_USB, USB_GET_NODE_INFORMATION, METHOD_BUFFERED, FILE_ANY_ACCESS);
126 pub const IOCTL_USB_GET_NODE_CONNECTION_INFORMATION: DWORD
127     = CTL_CODE!(FILE_DEVICE_USB, USB_GET_NODE_CONNECTION_INFORMATION, METHOD_BUFFERED,
128         FILE_ANY_ACCESS);
129 pub const IOCTL_USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION: DWORD
130     = CTL_CODE!(FILE_DEVICE_USB, USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION, METHOD_BUFFERED,
131         FILE_ANY_ACCESS);
132 pub const IOCTL_USB_GET_NODE_CONNECTION_NAME: DWORD
133     = CTL_CODE!(FILE_DEVICE_USB, USB_GET_NODE_CONNECTION_NAME, METHOD_BUFFERED, FILE_ANY_ACCESS);
134 pub const IOCTL_USB_DIAG_IGNORE_HUBS_ON: DWORD
135     = CTL_CODE!(FILE_DEVICE_USB, USB_DIAG_IGNORE_HUBS_ON, METHOD_BUFFERED, FILE_ANY_ACCESS);
136 pub const IOCTL_USB_DIAG_IGNORE_HUBS_OFF: DWORD
137     = CTL_CODE!(FILE_DEVICE_USB, USB_DIAG_IGNORE_HUBS_OFF, METHOD_BUFFERED, FILE_ANY_ACCESS);
138 pub const IOCTL_USB_GET_NODE_CONNECTION_DRIVERKEY_NAME: DWORD
139     = CTL_CODE!(FILE_DEVICE_USB, USB_GET_NODE_CONNECTION_DRIVERKEY_NAME, METHOD_BUFFERED,
140         FILE_ANY_ACCESS);
141 pub const IOCTL_USB_GET_HUB_CAPABILITIES: DWORD
142     = CTL_CODE!(FILE_DEVICE_USB, USB_GET_HUB_CAPABILITIES, METHOD_BUFFERED, FILE_ANY_ACCESS);
143 pub const IOCTL_USB_HUB_CYCLE_PORT: DWORD
144     = CTL_CODE!(FILE_DEVICE_USB, USB_HUB_CYCLE_PORT, METHOD_BUFFERED, FILE_ANY_ACCESS);
145 pub const IOCTL_USB_GET_NODE_CONNECTION_ATTRIBUTES: DWORD
146     = CTL_CODE!(FILE_DEVICE_USB, USB_GET_NODE_CONNECTION_ATTRIBUTES, METHOD_BUFFERED,
147         FILE_ANY_ACCESS);
148 pub const IOCTL_USB_GET_NODE_CONNECTION_INFORMATION_EX: DWORD
149     = CTL_CODE!(FILE_DEVICE_USB, USB_GET_NODE_CONNECTION_INFORMATION_EX, METHOD_BUFFERED,
150         FILE_ANY_ACCESS);
151 pub const IOCTL_USB_RESET_HUB: DWORD
152     = CTL_CODE!(FILE_DEVICE_USB, USB_RESET_HUB, METHOD_BUFFERED, FILE_ANY_ACCESS);
153 pub const IOCTL_USB_GET_HUB_CAPABILITIES_EX: DWORD
154     = CTL_CODE!(FILE_DEVICE_USB, USB_GET_HUB_CAPABILITIES_EX, METHOD_BUFFERED, FILE_ANY_ACCESS);
155 pub const IOCTL_USB_GET_HUB_INFORMATION_EX: DWORD
156     = CTL_CODE!(FILE_DEVICE_USB, USB_GET_HUB_INFORMATION_EX, METHOD_BUFFERED, FILE_ANY_ACCESS);
157 pub const IOCTL_USB_GET_PORT_CONNECTOR_PROPERTIES: DWORD
158     = CTL_CODE!(FILE_DEVICE_USB, USB_GET_PORT_CONNECTOR_PROPERTIES, METHOD_BUFFERED,
159         FILE_ANY_ACCESS);
160 pub const IOCTL_USB_GET_NODE_CONNECTION_INFORMATION_EX_V2: DWORD
161     = CTL_CODE!(FILE_DEVICE_USB, USB_GET_NODE_CONNECTION_INFORMATION_EX_V2, METHOD_BUFFERED,
162         FILE_ANY_ACCESS);
163 pub const IOCTL_USB_GET_TRANSPORT_CHARACTERISTICS: DWORD
164     = CTL_CODE!(FILE_DEVICE_USB, USB_GET_TRANSPORT_CHARACTERISTICS, METHOD_BUFFERED,
165         FILE_ANY_ACCESS);
166 pub const IOCTL_USB_REGISTER_FOR_TRANSPORT_CHARACTERISTICS_CHANGE: DWORD
167     = CTL_CODE!(FILE_DEVICE_USB, USB_REGISTER_FOR_TRANSPORT_CHARACTERISTICS_CHANGE,
168         METHOD_BUFFERED, FILE_ANY_ACCESS);
169 pub const IOCTL_USB_NOTIFY_ON_TRANSPORT_CHARACTERISTICS_CHANGE: DWORD
170     = CTL_CODE!(FILE_DEVICE_USB, USB_NOTIFY_ON_TRANSPORT_CHARACTERISTICS_CHANGE, METHOD_BUFFERED,
171         FILE_ANY_ACCESS);
172 pub const IOCTL_USB_UNREGISTER_FOR_TRANSPORT_CHARACTERISTICS_CHANGE: DWORD
173     = CTL_CODE!(FILE_DEVICE_USB, USB_UNREGISTER_FOR_TRANSPORT_CHARACTERISTICS_CHANGE,
174         METHOD_BUFFERED, FILE_ANY_ACCESS);
175 pub const IOCTL_USB_START_TRACKING_FOR_TIME_SYNC: DWORD
176     = CTL_CODE!(FILE_DEVICE_USB, USB_START_TRACKING_FOR_TIME_SYNC, METHOD_BUFFERED,
177         FILE_ANY_ACCESS);
178 pub const IOCTL_USB_GET_FRAME_NUMBER_AND_QPC_FOR_TIME_SYNC: DWORD
179     = CTL_CODE!(FILE_DEVICE_USB, USB_GET_FRAME_NUMBER_AND_QPC_FOR_TIME_SYNC, METHOD_BUFFERED,
180         FILE_ANY_ACCESS);
181 pub const IOCTL_USB_STOP_TRACKING_FOR_TIME_SYNC: DWORD
182     = CTL_CODE!(FILE_DEVICE_USB, USB_STOP_TRACKING_FOR_TIME_SYNC, METHOD_BUFFERED,
183         FILE_ANY_ACCESS);
184 pub const IOCTL_USB_GET_DEVICE_CHARACTERISTICS: DWORD
185     = CTL_CODE!(FILE_DEVICE_USB, USB_GET_DEVICE_CHARACTERISTICS, METHOD_BUFFERED, FILE_ANY_ACCESS);
186 ENUM!{enum USB_HUB_NODE {
187     UsbHub,
188     UsbMIParent,
189 }}
190 STRUCT!{#[repr(packed)] struct USB_HUB_INFORMATION {
191     HubDescriptor: USB_HUB_DESCRIPTOR,
192     HubIsBusPowered: BOOLEAN,
193 }}
194 pub type PUSB_HUB_INFORMATION = *mut USB_HUB_INFORMATION;
195 STRUCT!{#[repr(packed)] struct USB_MI_PARENT_INFORMATION {
196     NumberOfInterfaces: ULONG,
197 }}
198 pub type PUSB_MI_PARENT_INFORMATION = *mut USB_MI_PARENT_INFORMATION;
199 STRUCT!{#[repr(packed)] struct USB_NODE_INFORMATION {
200     NodeType: USB_HUB_NODE,
201     u: USB_NODE_INFORMATION_u,
202 }}
203 UNION!{union USB_NODE_INFORMATION_u {
204     [u8; 72],
205     HubInformation HubInformation_mut: USB_HUB_INFORMATION,
206     MiParentInformation MiParentInformation_mut: USB_MI_PARENT_INFORMATION,
207 }}
208 pub type PUSB_NODE_INFORMATION = *mut USB_NODE_INFORMATION;
209 STRUCT!{#[repr(packed)] struct USB_PIPE_INFO {
210     EndpointDescriptor: USB_ENDPOINT_DESCRIPTOR,
211     ScheduleOffset: ULONG,
212 }}
213 pub type PUSB_PIPE_INFO = *mut USB_PIPE_INFO;
214 ENUM!{enum USB_CONNECTION_STATUS {
215     NoDeviceConnected,
216     DeviceConnected,
217     DeviceFailedEnumeration,
218     DeviceGeneralFailure,
219     DeviceCausedOvercurrent,
220     DeviceNotEnoughPower,
221     DeviceNotEnoughBandwidth,
222     DeviceHubNestedTooDeeply,
223     DeviceInLegacyHub,
224     DeviceEnumerating,
225     DeviceReset,
226 }}
227 pub type PUSB_CONNECTION_STATUS = *mut USB_CONNECTION_STATUS;
228 STRUCT!{#[repr(packed)] struct USB_NODE_CONNECTION_INFORMATION {
229     ConnectionIndex: ULONG,
230     DeviceDescriptor: USB_DEVICE_DESCRIPTOR,
231     CurrentConfigurationValue: UCHAR,
232     LowSpeed: BOOLEAN,
233     DeviceIsHub: BOOLEAN,
234     DeviceAddress: USHORT,
235     NumberOfOpenPipes: ULONG,
236     ConnectionStatus: USB_CONNECTION_STATUS,
237     PipeList: [USB_PIPE_INFO; 0],
238 }}
239 pub type PUSB_NODE_CONNECTION_INFORMATION = *mut USB_NODE_CONNECTION_INFORMATION;
240 STRUCT!{#[repr(packed)] struct USB_NODE_CONNECTION_DRIVERKEY_NAME {
241     ConnectionIndex: ULONG,
242     ActualLength: ULONG,
243     DriverKeyName: [WCHAR; 1],
244 }}
245 pub type PUSB_NODE_CONNECTION_DRIVERKEY_NAME = *mut USB_NODE_CONNECTION_DRIVERKEY_NAME;
246 STRUCT!{#[repr(packed)] struct USB_NODE_CONNECTION_NAME {
247     ConnectionIndex: ULONG,
248     ActualLength: ULONG,
249     NodeName: [WCHAR; 1],
250 }}
251 pub type PUSB_NODE_CONNECTION_NAME = *mut USB_NODE_CONNECTION_NAME;
252 STRUCT!{#[repr(packed)] struct USB_HUB_NAME {
253     ActualLength: ULONG,
254     HubName: [WCHAR; 1],
255 }}
256 pub type PUSB_HUB_NAME = *mut USB_HUB_NAME;
257 STRUCT!{#[repr(packed)] struct USB_ROOT_HUB_NAME {
258     ActualLength: ULONG,
259     RootHubName: [WCHAR; 1],
260 }}
261 pub type PUSB_ROOT_HUB_NAME = *mut USB_ROOT_HUB_NAME;
262 STRUCT!{#[repr(packed)] struct USB_HCD_DRIVERKEY_NAME {
263     ActualLength: ULONG,
264     DriverKeyName: [WCHAR; 1],
265 }}
266 pub type PUSB_HCD_DRIVERKEY_NAME = *mut USB_HCD_DRIVERKEY_NAME;
267 STRUCT!{#[repr(packed)] struct USB_DESCRIPTOR_REQUEST {
268     ConnectionIndex: ULONG,
269     SetupPacket: USB_DESCRIPTOR_REQUEST_SetupPacket,
270     Data: [UCHAR; 0],
271 }}
272 STRUCT!{#[repr(packed)] struct USB_DESCRIPTOR_REQUEST_SetupPacket {
273     bmRequest: UCHAR,
274     bRequest: UCHAR,
275     wValue: USHORT,
276     wIndex: USHORT,
277     wLength: USHORT,
278 }}
279 pub type PUSB_DESCRIPTOR_REQUEST = *mut USB_DESCRIPTOR_REQUEST;
280 STRUCT!{#[repr(packed)] struct USB_HUB_CAPABILITIES {
281     bitfield: ULONG,
282 }}
283 BITFIELD!{USB_HUB_CAPABILITIES bitfield: ULONG [
284     HubIs2xCapable set_HubIs2xCapable[0..1],
285 ]}
286 pub type PUSB_HUB_CAPABILITIES = *mut USB_HUB_CAPABILITIES;
287 STRUCT!{#[repr(packed)] struct USB_NODE_CONNECTION_ATTRIBUTES {
288     ConnectionIndex: ULONG,
289     ConnectionStatus: USB_CONNECTION_STATUS,
290     PortAttributes: ULONG,
291 }}
292 pub type PUSB_NODE_CONNECTION_ATTRIBUTES = *mut USB_NODE_CONNECTION_ATTRIBUTES;
293 STRUCT!{#[repr(packed)] struct USB_NODE_CONNECTION_INFORMATION_EX {
294     ConnectionIndex: ULONG,
295     DeviceDescriptor: USB_DEVICE_DESCRIPTOR,
296     CurrentConfigurationValue: UCHAR,
297     Speed: UCHAR,
298     DeviceIsHub: BOOLEAN,
299     DeviceAddress: USHORT,
300     NumberOfOpenPipes: ULONG,
301     ConnectionStatus: USB_CONNECTION_STATUS,
302     PipeList: [USB_PIPE_INFO; 0],
303 }}
304 pub type PUSB_NODE_CONNECTION_INFORMATION_EX = *mut USB_NODE_CONNECTION_INFORMATION_EX;
305 STRUCT!{#[repr(packed)] struct USB_HUB_CAP_FLAGS {
306     ul: ULONG,
307 }}
308 BITFIELD!{USB_HUB_CAP_FLAGS ul: ULONG [
309     HubIsHighSpeedCapable set_HubIsHighSpeedCapable[0..1],
310     HubIsHighSpeed set_HubIsHighSpeed[1..2],
311     HubIsMultiTtCapable set_HubIsMultiTtCapable[2..3],
312     HubIsMultiTt set_HubIsMultiTt[3..4],
313     HubIsRoot set_HubIsRoot[4..5],
314     HubIsArmedWakeOnConnect set_HubIsArmedWakeOnConnect[5..6],
315     HubIsBusPowered set_HubIsBusPowered[6..7],
316     ReservedMBZ set_ReservedMBZ[7..32],
317 ]}
318 pub type PUSB_HUB_CAP_FLAGS = *mut USB_HUB_CAP_FLAGS;
319 STRUCT!{#[repr(packed)] struct USB_HUB_CAPABILITIES_EX {
320     CapabilityFlags: USB_HUB_CAP_FLAGS,
321 }}
322 pub type PUSB_HUB_CAPABILITIES_EX = *mut USB_HUB_CAPABILITIES_EX;
323 STRUCT!{#[repr(packed)] struct USB_CYCLE_PORT_PARAMS {
324     ConnectionIndex: ULONG,
325     StatusReturned: ULONG,
326 }}
327 pub type PUSB_CYCLE_PORT_PARAMS = *mut USB_CYCLE_PORT_PARAMS;
328 STRUCT!{#[repr(packed)] struct USB_ID_STRING {
329     LanguageId: USHORT,
330     Pad: USHORT,
331     LengthInBytes: ULONG,
332     Buffer: PWCHAR,
333 }}
334 pub type PUSB_ID_STRING = *mut USB_ID_STRING;
335 STRUCT!{#[repr(packed)] struct USB_HUB_DEVICE_UXD_SETTINGS {
336     Version: ULONG,
337     PnpGuid: GUID,
338     OwnerGuid: GUID,
339     DeleteOnShutdown: ULONG,
340     DeleteOnReload: ULONG,
341     DeleteOnDisconnect: ULONG,
342     Reserved: [ULONG; 5],
343 }}
344 pub type PUSB_HUB_DEVICE_UXD_SETTINGS = *mut USB_HUB_DEVICE_UXD_SETTINGS;
345 STRUCT!{#[repr(packed)] struct HUB_DEVICE_CONFIG_INFO {
346     Version: ULONG,
347     Length: ULONG,
348     HubFlags: USB_HUB_CAP_FLAGS,
349     HardwareIds: USB_ID_STRING,
350     CompatibleIds: USB_ID_STRING,
351     DeviceDescription: USB_ID_STRING,
352     Reserved: [ULONG; 19],
353     UxdSettings: USB_HUB_DEVICE_UXD_SETTINGS,
354 }}
355 pub type PHUB_DEVICE_CONFIG_INFO = *mut HUB_DEVICE_CONFIG_INFO;
356 STRUCT!{#[repr(packed)] struct HCD_STAT_COUNTERS {
357     BytesTransferred: ULONG,
358     IsoMissedCount: USHORT,
359     DataOverrunErrorCount: USHORT,
360     CrcErrorCount: USHORT,
361     ScheduleOverrunCount: USHORT,
362     TimeoutErrorCount: USHORT,
363     InternalHcErrorCount: USHORT,
364     BufferOverrunErrorCount: USHORT,
365     SWErrorCount: USHORT,
366     StallPidCount: USHORT,
367     PortDisableCount: USHORT,
368 }}
369 pub type PHCD_STAT_COUNTERS = *mut HCD_STAT_COUNTERS;
370 STRUCT!{#[repr(packed)] struct HCD_ISO_STAT_COUNTERS {
371     LateUrbs: USHORT,
372     DoubleBufferedPackets: USHORT,
373     TransfersCF_5ms: USHORT,
374     TransfersCF_2ms: USHORT,
375     TransfersCF_1ms: USHORT,
376     MaxInterruptLatency: USHORT,
377     BadStartFrame: USHORT,
378     StaleUrbs: USHORT,
379     IsoPacketNotAccesed: USHORT,
380     IsoPacketHWError: USHORT,
381     SmallestUrbPacketCount: USHORT,
382     LargestUrbPacketCount: USHORT,
383     IsoCRC_Error: USHORT,
384     IsoOVERRUN_Error: USHORT,
385     IsoINTERNAL_Error: USHORT,
386     IsoUNKNOWN_Error: USHORT,
387     IsoBytesTransferred: ULONG,
388     LateMissedCount: USHORT,
389     HWIsoMissedCount: USHORT,
390     Reserved7: [ULONG; 8],
391 }}
392 pub type PHCD_ISO_STAT_COUNTERS = *mut HCD_ISO_STAT_COUNTERS;
393 STRUCT!{#[repr(packed)] struct HCD_STAT_INFORMATION_1 {
394     Reserved1: ULONG,
395     Reserved2: ULONG,
396     ResetCounters: ULONG,
397     TimeRead: LARGE_INTEGER,
398     Counters: HCD_STAT_COUNTERS,
399 }}
400 pub type PHCD_STAT_INFORMATION_1 = *mut HCD_STAT_INFORMATION_1;
401 STRUCT!{#[repr(packed)] struct HCD_STAT_INFORMATION_2 {
402     Reserved1: ULONG,
403     Reserved2: ULONG,
404     ResetCounters: ULONG,
405     TimeRead: LARGE_INTEGER,
406     LockedMemoryUsed: LONG,
407     Counters: HCD_STAT_COUNTERS,
408     IsoCounters: HCD_ISO_STAT_COUNTERS,
409 }}
410 pub type PHCD_STAT_INFORMATION_2 = *mut HCD_STAT_INFORMATION_2;
411 pub const WMI_USB_DRIVER_INFORMATION: ULONG = 0;
412 pub const WMI_USB_DRIVER_NOTIFICATION: ULONG = 1;
413 pub const WMI_USB_POWER_DEVICE_ENABLE: ULONG = 2;
414 pub const WMI_USB_HUB_NODE_INFORMATION: ULONG = 4;
415 pub const WMI_USB_PERFORMANCE_INFORMATION: ULONG = 1;
416 pub const WMI_USB_DEVICE_NODE_INFORMATION: ULONG = 2;
417 ENUM!{enum USB_NOTIFICATION_TYPE {
418     EnumerationFailure = 0,
419     InsufficentBandwidth,
420     InsufficentPower,
421     OverCurrent,
422     ResetOvercurrent,
423     AcquireBusInfo,
424     AcquireHubName,
425     AcquireControllerName,
426     HubOvercurrent,
427     HubPowerChange,
428     HubNestedTooDeeply,
429     ModernDeviceInLegacyHub,
430 }}
431 STRUCT!{#[repr(packed)] struct USB_NOTIFICATION {
432     NotificationType: USB_NOTIFICATION_TYPE,
433 }}
434 pub type PUSB_NOTIFICATION = *mut USB_NOTIFICATION;
435 STRUCT!{#[repr(packed)] struct USB_CONNECTION_NOTIFICATION {
436     NotificationType: USB_NOTIFICATION_TYPE,
437     ConnectionNumber: ULONG,
438     RequestedBandwidth: ULONG,
439     EnumerationFailReason: ULONG,
440     PowerRequested: ULONG,
441     HubNameLength: ULONG,
442 }}
443 pub type PUSB_CONNECTION_NOTIFICATION = *mut USB_CONNECTION_NOTIFICATION;
444 STRUCT!{#[repr(packed)] struct USB_BUS_NOTIFICATION {
445     NotificationType: USB_NOTIFICATION_TYPE,
446     TotalBandwidth: ULONG,
447     ConsumedBandwidth: ULONG,
448     ControllerNameLength: ULONG,
449 }}
450 pub type PUSB_BUS_NOTIFICATION = *mut USB_BUS_NOTIFICATION;
451 STRUCT!{#[repr(packed)] struct USB_ACQUIRE_INFO {
452     NotificationType: USB_NOTIFICATION_TYPE,
453     TotalSize: ULONG,
454     Buffer: [WCHAR; 1],
455 }}
456 pub type PUSB_ACQUIRE_INFO = *mut USB_ACQUIRE_INFO;
457 ENUM!{enum USB_WMI_DEVICE_NODE_TYPE {
458     UsbDevice,
459     HubDevice,
460     CompositeDevice,
461     UsbController,
462 }}
463 pub type PUSB_WMI_DEVICE_NODE_TYPE = *mut USB_WMI_DEVICE_NODE_TYPE;
464 STRUCT!{#[repr(packed)] struct USB_DEVICE_STATE {
465     bitfield: ULONG,
466 }}
467 BITFIELD!{USB_DEVICE_STATE bitfield: ULONG [
468     DeviceConnected set_DeviceConnected[0..1],
469     DeviceStarted set_DeviceStarted[1..2],
470 ]}
471 pub type PUSB_DEVICE_STATE = *mut USB_DEVICE_STATE;
472 STRUCT!{#[repr(packed)] struct USB_HUB_PORT_INFORMATION {
473     DeviceState: USB_DEVICE_STATE,
474     PortNumber: USHORT,
475     DeviceAddress: USHORT,
476     ConnectionIndex: ULONG,
477     ConnectionStatus: USB_CONNECTION_STATUS,
478 }}
479 pub type PUSB_HUB_PORT_INFORMATION = *mut USB_HUB_PORT_INFORMATION;
480 STRUCT!{#[repr(packed)] struct USB_HUB_DEVICE_INFO {
481     HubDescriptor: USB_HUB_DESCRIPTOR,
482     HubNumber: ULONG,
483     DeviceAddress: USHORT,
484     HubIsSelfPowered: BOOLEAN,
485     HubIsRootHub: BOOLEAN,
486     HubCapabilities: USB_HUB_CAPABILITIES,
487     NumberOfHubPorts: ULONG,
488     PortInfo: [USB_HUB_PORT_INFORMATION; 1],
489 }}
490 pub type PUSB_HUB_DEVICE_INFO = *mut USB_HUB_DEVICE_INFO;
491 STRUCT!{#[repr(packed)] struct USB_COMPOSITE_FUNCTION_INFO {
492     FunctionNumber: UCHAR,
493     BaseInterfaceNumber: UCHAR,
494     NumberOfInterfaces: UCHAR,
495     FunctionIsIdle: BOOLEAN,
496 }}
497 pub type PUSB_COMPOSITE_FUNCTION_INFO = *mut USB_COMPOSITE_FUNCTION_INFO;
498 STRUCT!{#[repr(packed)] struct USB_COMPOSITE_DEVICE_INFO {
499     DeviceDescriptor: USB_DEVICE_DESCRIPTOR,
500     CurrentConfigDescriptor: USB_CONFIGURATION_DESCRIPTOR,
501     CurrentConfigurationValue: UCHAR,
502     NumberOfFunctions: UCHAR,
503     FunctionInfo: [USB_COMPOSITE_FUNCTION_INFO; 1],
504 }}
505 pub type PUSB_COMPOSITE_DEVICE_INFO = *mut USB_COMPOSITE_DEVICE_INFO;
506 STRUCT!{#[repr(packed)] struct USB_CONTROLLER_DEVICE_INFO {
507     PciVendorId: ULONG,
508     PciDeviceId: ULONG,
509     PciRevision: ULONG,
510     NumberOfRootPorts: ULONG,
511     HcFeatureFlags: ULONG,
512 }}
513 pub type PUSB_CONTROLLER_DEVICE_INFO = *mut USB_CONTROLLER_DEVICE_INFO;
514 STRUCT!{#[repr(packed)] struct USB_DEVICE_INFO {
515     DeviceState: USB_DEVICE_STATE,
516     PortNumber: USHORT,
517     DeviceDescriptor: USB_DEVICE_DESCRIPTOR,
518     CurrentConfigurationValue: UCHAR,
519     Speed: USB_DEVICE_SPEED,
520     DeviceAddress: USHORT,
521     ConnectionIndex: ULONG,
522     ConnectionStatus: USB_CONNECTION_STATUS,
523     PnpHardwareId: [WCHAR; 128],
524     PnpCompatibleId: [WCHAR; 128],
525     SerialNumberId: [WCHAR; 128],
526     PnpDeviceDescription: [WCHAR; 128],
527     NumberOfOpenPipes: ULONG,
528     PipeList: [USB_PIPE_INFO; 1],
529 }}
530 pub type PUSB_DEVICE_INFO = *mut USB_DEVICE_INFO;
531 STRUCT!{#[repr(packed)] struct USB_DEVICE_NODE_INFO {
532     Sig: ULONG,
533     LengthInBytes: ULONG,
534     DeviceDescription: [WCHAR; 40],
535     NodeType: USB_WMI_DEVICE_NODE_TYPE,
536     BusAddress: USB_TOPOLOGY_ADDRESS,
537     u: USB_DEVICE_NODE_INFO_u,
538 }}
539 UNION!{union USB_DEVICE_NODE_INFO_u {
540     [u8; 1078],
541     UsbDeviceInfo UsbDeviceInfo_mut: USB_DEVICE_INFO,
542     HubDeviceInfo HubDeviceInfo_mut: USB_HUB_DEVICE_INFO,
543     CompositeDeviceInfo CompositeDeviceInfo_mut: USB_COMPOSITE_DEVICE_INFO,
544     ControllerDeviceInfo ControllerDeviceInfo_mut: USB_CONTROLLER_DEVICE_INFO,
545     DeviceInformation DeviceInformation_mut: [UCHAR; 4],
546 }}
547 pub type PUSB_DEVICE_NODE_INFO = *mut USB_DEVICE_NODE_INFO;
548 STRUCT!{#[repr(packed)] struct USB_DEVICE_PERFORMANCE_INFO {
549     BulkBytes: ULONG,
550     ControlDataBytes: ULONG,
551     IsoBytes: ULONG,
552     InterruptBytes: ULONG,
553     BulkUrbCount: ULONG,
554     ControlUrbCount: ULONG,
555     IsoUrbCount: ULONG,
556     InterruptUrbCount: ULONG,
557     AllocedInterrupt: [ULONG; 6],
558     AllocedIso: ULONG,
559     Total32secBandwidth: ULONG,
560     TotalTtBandwidth: ULONG,
561     DeviceDescription: [WCHAR; 60],
562     DeviceSpeed: USB_DEVICE_SPEED,
563     TotalIsoLatency: ULONG,
564     DroppedIsoPackets: ULONG,
565     TransferErrors: ULONG,
566     PciInterruptCount: ULONG,
567     HcIdleState: ULONG,
568     HcAsyncIdleState: ULONG,
569     HcAsyncCacheFlushCount: ULONG,
570     HcPeriodicIdleState: ULONG,
571     HcPeriodicCacheFlushCount: ULONG,
572 }}
573 pub type PUSB_DEVICE_PERFORMANCE_INFO = *mut USB_DEVICE_PERFORMANCE_INFO;
574 ENUM!{enum USB_HUB_TYPE {
575     UsbRootHub = 1,
576     Usb20Hub = 2,
577     Usb30Hub = 3,
578 }}
579 STRUCT!{#[repr(packed)] struct USB_HUB_INFORMATION_EX {
580     HubType: USB_HUB_TYPE,
581     HighestPortNumber: USHORT,
582     u: USB_HUB_INFORMATION_EX_u,
583 }}
584 UNION!{union USB_HUB_INFORMATION_EX_u {
585     [u8; 71],
586     UsbHubDescriptor UsbHubDescriptor_mut: USB_HUB_DESCRIPTOR,
587     Usb30HubDescriptor Usb30HubDescriptor_mut: USB_30_HUB_DESCRIPTOR,
588 }}
589 pub type PUSB_HUB_INFORMATION_EX = *mut USB_HUB_INFORMATION_EX;
590 STRUCT!{#[repr(packed)] struct USB_PORT_PROPERTIES {
591     ul: ULONG,
592 }}
593 BITFIELD!{USB_PORT_PROPERTIES ul: ULONG [
594     PortIsUserConnectable set_PortIsUserConnectable[0..1],
595     PortIsDebugCapable set_PortIsDebugCapable[1..2],
596     PortHasMultipleCompanions set_PortHasMultipleCompanions[2..3],
597     PortConnectorIsTypeC set_PortConnectorIsTypeC[3..4],
598     ReservedMBZ set_ReservedMBZ[4..32],
599 ]}
600 pub type PUSB_PORT_PROPERTIES = *mut USB_PORT_PROPERTIES;
601 STRUCT!{#[repr(packed)] struct USB_PORT_CONNECTOR_PROPERTIES {
602     ConnectionIndex: ULONG,
603     ActualLength: ULONG,
604     UsbPortProperties: USB_PORT_PROPERTIES,
605     CompanionIndex: USHORT,
606     CompanionPortNumber: USHORT,
607     CompanionHubSymbolicLinkName: [WCHAR; 1],
608 }}
609 pub type PUSB_PORT_CONNECTOR_PROPERTIES = *mut USB_PORT_CONNECTOR_PROPERTIES;
610 STRUCT!{#[repr(packed)] struct USB_PROTOCOLS {
611     ul: ULONG,
612 }}
613 BITFIELD!{USB_PROTOCOLS ul: ULONG [
614     Usb110 set_Usb110[0..1],
615     Usb200 set_Usb200[1..2],
616     Usb300 set_Usb300[2..3],
617     ReservedMBZ set_ReservedMBZ[3..32],
618 ]}
619 pub type PUSB_PROTOCOLS = *mut USB_PROTOCOLS;
620 STRUCT!{#[repr(packed)] struct USB_NODE_CONNECTION_INFORMATION_EX_V2_FLAGS {
621     ul: ULONG,
622 }}
623 BITFIELD!{USB_NODE_CONNECTION_INFORMATION_EX_V2_FLAGS ul: ULONG [
624     DeviceIsOperatingAtSuperSpeedOrHigher set_DeviceIsOperatingAtSuperSpeedOrHigher[0..1],
625     DeviceIsSuperSpeedCapableOrHigher set_DeviceIsSuperSpeedCapableOrHigher[1..2],
626     DeviceIsOperatingAtSuperSpeedPlusOrHigher set_DeviceIsOperatingAtSuperSpeedPlusOrHigher[2..3],
627     DeviceIsSuperSpeedPlusCapableOrHigher set_DeviceIsSuperSpeedPlusCapableOrHigher[3..4],
628     ReservedMBZ set_ReservedMBZ[4..32],
629 ]}
630 pub type PUSB_NODE_CONNECTION_INFORMATION_EX_V2_FLAGS
631     = *mut USB_NODE_CONNECTION_INFORMATION_EX_V2_FLAGS;
632 STRUCT!{#[repr(packed)] struct USB_NODE_CONNECTION_INFORMATION_EX_V2 {
633     ConnectionIndex: ULONG,
634     Length: ULONG,
635     SupportedUsbProtocols: USB_PROTOCOLS,
636     Flags: USB_NODE_CONNECTION_INFORMATION_EX_V2_FLAGS,
637 }}
638 pub type PUSB_NODE_CONNECTION_INFORMATION_EX_V2 = *mut USB_NODE_CONNECTION_INFORMATION_EX_V2;
639 pub const USB_TRANSPORT_CHARACTERISTICS_VERSION_1: ULONG = 0x01;
640 pub const USB_TRANSPORT_CHARACTERISTICS_LATENCY_AVAILABLE: ULONG = 0x1;
641 pub const USB_TRANSPORT_CHARACTERISTICS_BANDWIDTH_AVAILABLE: ULONG = 0x2;
642 STRUCT!{#[repr(packed)] struct USB_TRANSPORT_CHARACTERISTICS {
643     Version: ULONG,
644     TransportCharacteristicsFlags: ULONG,
645     CurrentRoundtripLatencyInMilliSeconds: ULONG64,
646     MaxPotentialBandwidth: ULONG64,
647 }}
648 pub type PUSB_TRANSPORT_CHARACTERISTICS = *mut USB_TRANSPORT_CHARACTERISTICS;
649 pub const USB_REGISTER_FOR_TRANSPORT_LATENCY_CHANGE: ULONG = 0x1;
650 pub const USB_REGISTER_FOR_TRANSPORT_BANDWIDTH_CHANGE: ULONG = 0x2;
651 DECLARE_HANDLE!(USB_CHANGE_REGISTRATION_HANDLE, USB_CHANGE_REGISTRATION_HANDLE__);
652 STRUCT!{#[repr(packed)] struct USB_TRANSPORT_CHARACTERISTICS_CHANGE_REGISTRATION {
653     ChangeNotificationInputFlags: ULONG,
654     Handle: USB_CHANGE_REGISTRATION_HANDLE,
655     UsbTransportCharacteristics: USB_TRANSPORT_CHARACTERISTICS,
656 }}
657 pub type PUSB_TRANSPORT_CHARACTERISTICS_CHANGE_REGISTRATION
658     = *mut USB_TRANSPORT_CHARACTERISTICS_CHANGE_REGISTRATION;
659 STRUCT!{#[repr(packed)] struct USB_TRANSPORT_CHARACTERISTICS_CHANGE_NOTIFICATION {
660     Handle: USB_CHANGE_REGISTRATION_HANDLE,
661     UsbTransportCharacteristics: USB_TRANSPORT_CHARACTERISTICS,
662 }}
663 pub type PUSB_TRANSPORT_CHARACTERISTICS_CHANGE_NOTIFICATION
664     = *mut USB_TRANSPORT_CHARACTERISTICS_CHANGE_NOTIFICATION;
665 STRUCT!{#[repr(packed)] struct USB_TRANSPORT_CHARACTERISTICS_CHANGE_UNREGISTRATION {
666     Handle: USB_CHANGE_REGISTRATION_HANDLE,
667 }}
668 pub type PUSB_TRANSPORT_CHARACTERISTICS_CHANGE_UNREGISTRATION
669     = *mut USB_TRANSPORT_CHARACTERISTICS_CHANGE_UNREGISTRATION;
670 pub const USB_DEVICE_CHARACTERISTICS_VERSION_1: ULONG = 0x01;
671 pub const USB_DEVICE_CHARACTERISTICS_MAXIMUM_PATH_DELAYS_AVAILABLE: ULONG = 0x1;
672 STRUCT!{#[repr(packed)] struct USB_DEVICE_CHARACTERISTICS {
673     Version: ULONG,
674     Reserved: [ULONG; 2],
675     UsbDeviceCharacteristicsFlags: ULONG,
676     MaximumSendPathDelayInMilliSeconds: ULONG,
677     MaximumCompletionPathDelayInMilliSeconds: ULONG,
678 }}
679 pub type PUSB_DEVICE_CHARACTERISTICS = *mut USB_DEVICE_CHARACTERISTICS;
680 STRUCT!{#[repr(packed)] struct USB_START_TRACKING_FOR_TIME_SYNC_INFORMATION {
681     TimeTrackingHandle: HANDLE,
682     IsStartupDelayTolerable: BOOLEAN,
683 }}
684 pub type PUSB_START_TRACKING_FOR_TIME_SYNC_INFORMATION
685     = *mut USB_START_TRACKING_FOR_TIME_SYNC_INFORMATION;
686 STRUCT!{#[repr(packed)] struct USB_STOP_TRACKING_FOR_TIME_SYNC_INFORMATION {
687     TimeTrackingHandle: HANDLE,
688 }}
689 pub type PUSB_STOP_TRACKING_FOR_TIME_SYNC_INFORMATION
690     = *mut USB_STOP_TRACKING_FOR_TIME_SYNC_INFORMATION;
691 STRUCT!{#[repr(packed)] struct USB_FRAME_NUMBER_AND_QPC_FOR_TIME_SYNC_INFORMATION {
692     TimeTrackingHandle: HANDLE,
693     InputFrameNumber: ULONG,
694     InputMicroFrameNumber: ULONG,
695     QueryPerformanceCounterAtInputFrameOrMicroFrame: LARGE_INTEGER,
696     QueryPerformanceCounterFrequency: LARGE_INTEGER,
697     PredictedAccuracyInMicroSeconds: ULONG,
698     CurrentGenerationID: ULONG,
699     CurrentQueryPerformanceCounter: LARGE_INTEGER,
700     CurrentHardwareFrameNumber: ULONG,
701     CurrentHardwareMicroFrameNumber: ULONG,
702     CurrentUSBFrameNumber: ULONG,
703 }}
704 pub type PUSB_FRAME_NUMBER_AND_QPC_FOR_TIME_SYNC_INFORMATION
705     = *mut USB_FRAME_NUMBER_AND_QPC_FOR_TIME_SYNC_INFORMATION;
706