1 | /**
|
---|
2 | * usbioctl.h
|
---|
3 | *
|
---|
4 | * USB IOCTL interface.#ifndef __USBIOCTL_H__
|
---|
5 | *
|
---|
6 | * This file is part of the mingw-w64 runtime package.
|
---|
7 | * No warranty is given; refer to the file DISCLAIMER within this package.
|
---|
8 | *
|
---|
9 | * This file is based on the ReactOS PSDK file usbdi.h header.
|
---|
10 | * Original contributed by Casper S. Hornstrup <chorns@users.sourceforge.net>
|
---|
11 | *
|
---|
12 | * Added winapi-family check, Windows 8 additions by Kai Tietz.
|
---|
13 | */
|
---|
14 |
|
---|
15 | #ifndef __USBIOCTL_H__
|
---|
16 | #define __USBIOCTL_H__
|
---|
17 |
|
---|
18 | #include <minwindef.h>
|
---|
19 | #include <winapifamily.h>
|
---|
20 |
|
---|
21 | #if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
|
---|
22 |
|
---|
23 | #ifndef FAR
|
---|
24 | #define FAR
|
---|
25 | #endif
|
---|
26 |
|
---|
27 | #include "usb200.h"
|
---|
28 | #include "usbiodef.h"
|
---|
29 |
|
---|
30 | #define IOCTL_INTERNAL_USB_SUBMIT_URB CTL_CODE (FILE_DEVICE_USB, USB_SUBMIT_URB, METHOD_NEITHER, FILE_ANY_ACCESS)
|
---|
31 | #define IOCTL_INTERNAL_USB_RESET_PORT CTL_CODE (FILE_DEVICE_USB, USB_RESET_PORT, METHOD_NEITHER, FILE_ANY_ACCESS)
|
---|
32 | #define IOCTL_INTERNAL_USB_GET_ROOTHUB_PDO CTL_CODE (FILE_DEVICE_USB, USB_GET_ROOTHUB_PDO, METHOD_NEITHER, FILE_ANY_ACCESS)
|
---|
33 |
|
---|
34 | #define USBD_PORT_ENABLED 0x00000001
|
---|
35 | #define USBD_PORT_CONNECTED 0x00000002
|
---|
36 |
|
---|
37 | #define IOCTL_INTERNAL_USB_GET_PORT_STATUS CTL_CODE (FILE_DEVICE_USB, USB_GET_PORT_STATUS, METHOD_NEITHER, FILE_ANY_ACCESS)
|
---|
38 | #define IOCTL_INTERNAL_USB_ENABLE_PORT CTL_CODE (FILE_DEVICE_USB, USB_ENABLE_PORT, METHOD_NEITHER, FILE_ANY_ACCESS)
|
---|
39 | #define IOCTL_INTERNAL_USB_GET_HUB_COUNT CTL_CODE (FILE_DEVICE_USB, USB_GET_HUB_COUNT, METHOD_NEITHER, FILE_ANY_ACCESS)
|
---|
40 | #define IOCTL_INTERNAL_USB_CYCLE_PORT CTL_CODE (FILE_DEVICE_USB, USB_CYCLE_PORT, METHOD_NEITHER, FILE_ANY_ACCESS)
|
---|
41 | #define IOCTL_INTERNAL_USB_GET_HUB_NAME CTL_CODE (FILE_DEVICE_USB, USB_GET_HUB_NAME, METHOD_BUFFERED, FILE_ANY_ACCESS)
|
---|
42 | #define IOCTL_INTERNAL_USB_GET_BUS_INFO CTL_CODE (FILE_DEVICE_USB, USB_GET_BUS_INFO, METHOD_BUFFERED, FILE_ANY_ACCESS)
|
---|
43 | #define IOCTL_INTERNAL_USB_GET_CONTROLLER_NAME CTL_CODE (FILE_DEVICE_USB, USB_GET_CONTROLLER_NAME, METHOD_BUFFERED, FILE_ANY_ACCESS)
|
---|
44 | #define IOCTL_INTERNAL_USB_GET_BUSGUID_INFO CTL_CODE (FILE_DEVICE_USB, USB_GET_BUSGUID_INFO, METHOD_BUFFERED, FILE_ANY_ACCESS)
|
---|
45 | #define IOCTL_INTERNAL_USB_GET_PARENT_HUB_INFO CTL_CODE (FILE_DEVICE_USB, USB_GET_PARENT_HUB_INFO, METHOD_BUFFERED, FILE_ANY_ACCESS)
|
---|
46 | #define IOCTL_INTERNAL_USB_SUBMIT_IDLE_NOTIFICATION CTL_CODE (FILE_DEVICE_USB, USB_IDLE_NOTIFICATION, METHOD_NEITHER, FILE_ANY_ACCESS)
|
---|
47 | #define IOCTL_INTERNAL_USB_GET_DEVICE_HANDLE CTL_CODE (FILE_DEVICE_USB, USB_GET_DEVICE_HANDLE, METHOD_NEITHER, FILE_ANY_ACCESS)
|
---|
48 |
|
---|
49 | #if _WIN32_WINNT >= 0x0600
|
---|
50 | #define IOCTL_INTERNAL_USB_NOTIFY_IDLE_READY CTL_CODE (FILE_DEVICE_USB, USB_IDLE_NOTIFICATION_EX, METHOD_NEITHER, FILE_ANY_ACCESS)
|
---|
51 | #define IOCTL_INTERNAL_USB_REQ_GLOBAL_SUSPEND CTL_CODE (FILE_DEVICE_USB, USB_REQ_GLOBAL_SUSPEND, METHOD_NEITHER, FILE_ANY_ACCESS)
|
---|
52 | #define IOCTL_INTERNAL_USB_REQ_GLOBAL_RESUME CTL_CODE (FILE_DEVICE_USB, USB_REQ_GLOBAL_RESUME, METHOD_NEITHER, FILE_ANY_ACCESS)
|
---|
53 |
|
---|
54 | #ifdef USB20_API
|
---|
55 | typedef struct _USB_START_FAILDATA {
|
---|
56 | ULONG LengthInBytes;
|
---|
57 | NTSTATUS NtStatus;
|
---|
58 | USBD_STATUS UsbdStatus;
|
---|
59 | ULONG ConnectStatus;
|
---|
60 | UCHAR DriverData[4];
|
---|
61 | } USB_START_FAILDATA,*PUSB_START_FAILDATA;
|
---|
62 | #endif
|
---|
63 |
|
---|
64 | #define IOCTL_INTERNAL_USB_RECORD_FAILURE CTL_CODE (FILE_DEVICE_USB, USB_RECORD_FAILURE, METHOD_NEITHER, FILE_ANY_ACCESS)
|
---|
65 | #define IOCTL_INTERNAL_USB_GET_DEVICE_HANDLE_EX CTL_CODE (FILE_DEVICE_USB, USB_GET_DEVICE_HANDLE_EX, METHOD_NEITHER, FILE_ANY_ACCESS)
|
---|
66 | #define IOCTL_INTERNAL_USB_GET_TT_DEVICE_HANDLE CTL_CODE (FILE_DEVICE_USB, USB_GET_TT_DEVICE_HANDLE, METHOD_NEITHER, FILE_ANY_ACCESS)
|
---|
67 |
|
---|
68 | typedef struct _USB_TOPOLOGY_ADDRESS {
|
---|
69 | ULONG PciBusNumber;
|
---|
70 | ULONG PciDeviceNumber;
|
---|
71 | ULONG PciFunctionNumber;
|
---|
72 | ULONG Reserved;
|
---|
73 | USHORT RootHubPortNumber;
|
---|
74 | USHORT HubPortNumber[5];
|
---|
75 | USHORT Reserved2;
|
---|
76 | } USB_TOPOLOGY_ADDRESS,*PUSB_TOPOLOGY_ADDRESS;
|
---|
77 |
|
---|
78 | #define IOCTL_INTERNAL_USB_GET_TOPOLOGY_ADDRESS CTL_CODE (FILE_DEVICE_USB, USB_GET_TOPOLOGY_ADDRESS, METHOD_NEITHER, FILE_ANY_ACCESS)
|
---|
79 | #define IOCTL_INTERNAL_USB_GET_DEVICE_CONFIG_INFO CTL_CODE (FILE_DEVICE_USB, USB_GET_HUB_CONFIG_INFO, METHOD_NEITHER, FILE_ANY_ACCESS)
|
---|
80 | #endif
|
---|
81 | #if NTDDI_VERSION >= 0x06020000
|
---|
82 | #define IOCTL_INTERNAL_USB_REGISTER_COMPOSITE_DEVICE CTL_CODE (FILE_DEVICE_USBEX, USB_REGISTER_COMPOSITE_DEVICE, METHOD_NEITHER, FILE_ANY_ACCESS)
|
---|
83 | #define IOCTL_INTERNAL_USB_UNREGISTER_COMPOSITE_DEVICE CTL_CODE (FILE_DEVICE_USBEX, USB_UNREGISTER_COMPOSITE_DEVICE, METHOD_NEITHER, FILE_ANY_ACCESS)
|
---|
84 | #define IOCTL_INTERNAL_USB_REQUEST_REMOTE_WAKE_NOTIFICATION CTL_CODE (FILE_DEVICE_USBEX, USB_REQUEST_REMOTE_WAKE_NOTIFICATION, METHOD_NEITHER, FILE_ANY_ACCESS)
|
---|
85 | #endif
|
---|
86 |
|
---|
87 | #ifndef USB_KERNEL_IOCTL
|
---|
88 | #define IOCTL_USB_HCD_GET_STATS_1 CTL_CODE (FILE_DEVICE_USB, HCD_GET_STATS_1, METHOD_BUFFERED, FILE_ANY_ACCESS)
|
---|
89 | #define IOCTL_USB_HCD_GET_STATS_2 CTL_CODE (FILE_DEVICE_USB, HCD_GET_STATS_2, METHOD_BUFFERED, FILE_ANY_ACCESS)
|
---|
90 | #define IOCTL_USB_HCD_DISABLE_PORT CTL_CODE (FILE_DEVICE_USB, HCD_DISABLE_PORT, METHOD_BUFFERED, FILE_ANY_ACCESS)
|
---|
91 | #define IOCTL_USB_HCD_ENABLE_PORT CTL_CODE (FILE_DEVICE_USB, HCD_ENABLE_PORT, METHOD_BUFFERED, FILE_ANY_ACCESS)
|
---|
92 | #ifndef IOCTL_USB_DIAGNOSTIC_MODE_ON
|
---|
93 | #define IOCTL_USB_DIAGNOSTIC_MODE_ON CTL_CODE (FILE_DEVICE_USB, HCD_DIAGNOSTIC_MODE_ON, METHOD_BUFFERED, FILE_ANY_ACCESS)
|
---|
94 | #endif
|
---|
95 | #ifndef IOCTL_USB_DIAGNOSTIC_MODE_OFF
|
---|
96 | #define IOCTL_USB_DIAGNOSTIC_MODE_OFF CTL_CODE (FILE_DEVICE_USB, HCD_DIAGNOSTIC_MODE_OFF, METHOD_BUFFERED, FILE_ANY_ACCESS)
|
---|
97 | #endif
|
---|
98 | #ifndef IOCTL_USB_GET_ROOT_HUB_NAME
|
---|
99 | #define IOCTL_USB_GET_ROOT_HUB_NAME CTL_CODE (FILE_DEVICE_USB, HCD_GET_ROOT_HUB_NAME, METHOD_BUFFERED, FILE_ANY_ACCESS)
|
---|
100 | #endif
|
---|
101 | #ifndef IOCTL_GET_HCD_DRIVERKEY_NAME
|
---|
102 | #define IOCTL_GET_HCD_DRIVERKEY_NAME CTL_CODE (FILE_DEVICE_USB, HCD_GET_DRIVERKEY_NAME, METHOD_BUFFERED, FILE_ANY_ACCESS)
|
---|
103 | #endif
|
---|
104 | #define IOCTL_USB_GET_NODE_INFORMATION CTL_CODE (FILE_DEVICE_USB, USB_GET_NODE_INFORMATION, METHOD_BUFFERED, FILE_ANY_ACCESS)
|
---|
105 | #define IOCTL_USB_GET_NODE_CONNECTION_INFORMATION CTL_CODE (FILE_DEVICE_USB, USB_GET_NODE_CONNECTION_INFORMATION, METHOD_BUFFERED, FILE_ANY_ACCESS)
|
---|
106 | #define IOCTL_USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION CTL_CODE (FILE_DEVICE_USB, USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION, METHOD_BUFFERED, FILE_ANY_ACCESS)
|
---|
107 | #define IOCTL_USB_GET_NODE_CONNECTION_NAME CTL_CODE (FILE_DEVICE_USB, USB_GET_NODE_CONNECTION_NAME, METHOD_BUFFERED, FILE_ANY_ACCESS)
|
---|
108 | #define IOCTL_USB_DIAG_IGNORE_HUBS_ON CTL_CODE (FILE_DEVICE_USB, USB_DIAG_IGNORE_HUBS_ON, METHOD_BUFFERED, FILE_ANY_ACCESS)
|
---|
109 | #define IOCTL_USB_DIAG_IGNORE_HUBS_OFF CTL_CODE (FILE_DEVICE_USB, USB_DIAG_IGNORE_HUBS_OFF, METHOD_BUFFERED, FILE_ANY_ACCESS)
|
---|
110 | #define IOCTL_USB_GET_NODE_CONNECTION_DRIVERKEY_NAME CTL_CODE (FILE_DEVICE_USB, USB_GET_NODE_CONNECTION_DRIVERKEY_NAME, METHOD_BUFFERED, FILE_ANY_ACCESS)
|
---|
111 | #define IOCTL_USB_GET_HUB_CAPABILITIES CTL_CODE (FILE_DEVICE_USB, USB_GET_HUB_CAPABILITIES, METHOD_BUFFERED, FILE_ANY_ACCESS)
|
---|
112 | #define IOCTL_USB_HUB_CYCLE_PORT CTL_CODE (FILE_DEVICE_USB, USB_HUB_CYCLE_PORT, METHOD_BUFFERED, FILE_ANY_ACCESS)
|
---|
113 | #define IOCTL_USB_GET_NODE_CONNECTION_ATTRIBUTES CTL_CODE (FILE_DEVICE_USB, USB_GET_NODE_CONNECTION_ATTRIBUTES, METHOD_BUFFERED, FILE_ANY_ACCESS)
|
---|
114 | #define IOCTL_USB_GET_NODE_CONNECTION_INFORMATION_EX CTL_CODE (FILE_DEVICE_USB, USB_GET_NODE_CONNECTION_INFORMATION_EX, METHOD_BUFFERED, FILE_ANY_ACCESS)
|
---|
115 | #if _WIN32_WINNT >= 0x0600
|
---|
116 | #define IOCTL_USB_RESET_HUB CTL_CODE (FILE_DEVICE_USB, USB_RESET_HUB, METHOD_BUFFERED, FILE_ANY_ACCESS)
|
---|
117 | #define IOCTL_USB_GET_HUB_CAPABILITIES_EX CTL_CODE (FILE_DEVICE_USB, USB_GET_HUB_CAPABILITIES_EX, METHOD_BUFFERED, FILE_ANY_ACCESS)
|
---|
118 | #endif
|
---|
119 | #if NTDDI_VERSION >= 0x06020000
|
---|
120 | #define IOCTL_USB_GET_HUB_INFORMATION_EX CTL_CODE (FILE_DEVICE_USB, USB_GET_HUB_INFORMATION_EX, METHOD_BUFFERED, FILE_ANY_ACCESS)
|
---|
121 | #define IOCTL_USB_GET_PORT_CONNECTOR_PROPERTIES CTL_CODE (FILE_DEVICE_USB, USB_GET_PORT_CONNECTOR_PROPERTIES, METHOD_BUFFERED, FILE_ANY_ACCESS)
|
---|
122 | #define IOCTL_USB_GET_NODE_CONNECTION_INFORMATION_EX_V2 CTL_CODE (FILE_DEVICE_USB, USB_GET_NODE_CONNECTION_INFORMATION_EX_V2, METHOD_BUFFERED, FILE_ANY_ACCESS)
|
---|
123 | #endif
|
---|
124 |
|
---|
125 | #include <pshpack1.h>
|
---|
126 |
|
---|
127 | typedef enum _USB_HUB_NODE {
|
---|
128 | UsbHub,
|
---|
129 | UsbMIParent
|
---|
130 | } USB_HUB_NODE;
|
---|
131 |
|
---|
132 | typedef struct _USB_HUB_INFORMATION {
|
---|
133 | USB_HUB_DESCRIPTOR HubDescriptor;
|
---|
134 | BOOLEAN HubIsBusPowered;
|
---|
135 | } USB_HUB_INFORMATION,*PUSB_HUB_INFORMATION;
|
---|
136 |
|
---|
137 | typedef struct _USB_MI_PARENT_INFORMATION {
|
---|
138 | ULONG NumberOfInterfaces;
|
---|
139 | } USB_MI_PARENT_INFORMATION,*PUSB_MI_PARENT_INFORMATION;
|
---|
140 |
|
---|
141 | typedef struct _USB_NODE_INFORMATION {
|
---|
142 | USB_HUB_NODE NodeType;
|
---|
143 | union {
|
---|
144 | USB_HUB_INFORMATION HubInformation;
|
---|
145 | USB_MI_PARENT_INFORMATION MiParentInformation;
|
---|
146 | } u;
|
---|
147 | } USB_NODE_INFORMATION,*PUSB_NODE_INFORMATION;
|
---|
148 |
|
---|
149 | typedef struct _USB_PIPE_INFO {
|
---|
150 | USB_ENDPOINT_DESCRIPTOR EndpointDescriptor;
|
---|
151 | ULONG ScheduleOffset;
|
---|
152 | } USB_PIPE_INFO,*PUSB_PIPE_INFO;
|
---|
153 |
|
---|
154 | #if _WIN32_WINNT >= 0x0600
|
---|
155 | typedef enum _USB_CONNECTION_STATUS {
|
---|
156 | NoDeviceConnected,
|
---|
157 | DeviceConnected,
|
---|
158 | DeviceFailedEnumeration,
|
---|
159 | DeviceGeneralFailure,
|
---|
160 | DeviceCausedOvercurrent,
|
---|
161 | DeviceNotEnoughPower,
|
---|
162 | DeviceNotEnoughBandwidth,
|
---|
163 | DeviceHubNestedTooDeeply,
|
---|
164 | DeviceInLegacyHub,
|
---|
165 | DeviceEnumerating,
|
---|
166 | DeviceReset
|
---|
167 | } USB_CONNECTION_STATUS,*PUSB_CONNECTION_STATUS;
|
---|
168 | #else
|
---|
169 | typedef enum _USB_CONNECTION_STATUS {
|
---|
170 | NoDeviceConnected,
|
---|
171 | DeviceConnected,
|
---|
172 |
|
---|
173 | DeviceFailedEnumeration,
|
---|
174 | DeviceGeneralFailure,
|
---|
175 | DeviceCausedOvercurrent,
|
---|
176 | DeviceNotEnoughPower,
|
---|
177 | DeviceNotEnoughBandwidth,
|
---|
178 | DeviceHubNestedTooDeeply,
|
---|
179 | DeviceInLegacyHub
|
---|
180 | } USB_CONNECTION_STATUS,*PUSB_CONNECTION_STATUS;
|
---|
181 | #endif
|
---|
182 |
|
---|
183 | typedef struct _USB_NODE_CONNECTION_INFORMATION {
|
---|
184 | ULONG ConnectionIndex;
|
---|
185 | USB_DEVICE_DESCRIPTOR DeviceDescriptor;
|
---|
186 | UCHAR CurrentConfigurationValue;
|
---|
187 | BOOLEAN LowSpeed;
|
---|
188 | BOOLEAN DeviceIsHub;
|
---|
189 | USHORT DeviceAddress;
|
---|
190 | ULONG NumberOfOpenPipes;
|
---|
191 | USB_CONNECTION_STATUS ConnectionStatus;
|
---|
192 | USB_PIPE_INFO PipeList[0];
|
---|
193 | } USB_NODE_CONNECTION_INFORMATION,*PUSB_NODE_CONNECTION_INFORMATION;
|
---|
194 |
|
---|
195 | typedef struct _USB_NODE_CONNECTION_DRIVERKEY_NAME {
|
---|
196 | ULONG ConnectionIndex;
|
---|
197 | ULONG ActualLength;
|
---|
198 | WCHAR DriverKeyName[1];
|
---|
199 | } USB_NODE_CONNECTION_DRIVERKEY_NAME,*PUSB_NODE_CONNECTION_DRIVERKEY_NAME;
|
---|
200 |
|
---|
201 | typedef struct _USB_NODE_CONNECTION_NAME {
|
---|
202 | ULONG ConnectionIndex;
|
---|
203 | ULONG ActualLength;
|
---|
204 | WCHAR NodeName[1];
|
---|
205 | } USB_NODE_CONNECTION_NAME,*PUSB_NODE_CONNECTION_NAME;
|
---|
206 |
|
---|
207 | typedef struct _USB_HUB_NAME {
|
---|
208 | ULONG ActualLength;
|
---|
209 | WCHAR HubName[1];
|
---|
210 | } USB_HUB_NAME,*PUSB_HUB_NAME;
|
---|
211 |
|
---|
212 | typedef struct _USB_ROOT_HUB_NAME {
|
---|
213 | ULONG ActualLength;
|
---|
214 | WCHAR RootHubName[1];
|
---|
215 | } USB_ROOT_HUB_NAME,*PUSB_ROOT_HUB_NAME;
|
---|
216 |
|
---|
217 | typedef struct _USB_HCD_DRIVERKEY_NAME {
|
---|
218 | ULONG ActualLength;
|
---|
219 | WCHAR DriverKeyName[1];
|
---|
220 | } USB_HCD_DRIVERKEY_NAME,*PUSB_HCD_DRIVERKEY_NAME;
|
---|
221 |
|
---|
222 | typedef struct _USB_DESCRIPTOR_REQUEST {
|
---|
223 | ULONG ConnectionIndex;
|
---|
224 | struct {
|
---|
225 | UCHAR bmRequest;
|
---|
226 | UCHAR bRequest;
|
---|
227 | USHORT wValue;
|
---|
228 | USHORT wIndex;
|
---|
229 | USHORT wLength;
|
---|
230 | } SetupPacket;
|
---|
231 | UCHAR Data[0];
|
---|
232 | } USB_DESCRIPTOR_REQUEST,*PUSB_DESCRIPTOR_REQUEST;
|
---|
233 |
|
---|
234 | typedef struct _USB_HUB_CAPABILITIES {
|
---|
235 | ULONG HubIs2xCapable:1;
|
---|
236 | } USB_HUB_CAPABILITIES,*PUSB_HUB_CAPABILITIES;
|
---|
237 |
|
---|
238 | typedef struct _USB_NODE_CONNECTION_ATTRIBUTES {
|
---|
239 | ULONG ConnectionIndex;
|
---|
240 | USB_CONNECTION_STATUS ConnectionStatus;
|
---|
241 | ULONG PortAttributes;
|
---|
242 | } USB_NODE_CONNECTION_ATTRIBUTES,*PUSB_NODE_CONNECTION_ATTRIBUTES;
|
---|
243 |
|
---|
244 | typedef struct _USB_NODE_CONNECTION_INFORMATION_EX {
|
---|
245 | ULONG ConnectionIndex;
|
---|
246 | USB_DEVICE_DESCRIPTOR DeviceDescriptor;
|
---|
247 | UCHAR CurrentConfigurationValue;
|
---|
248 | UCHAR Speed;
|
---|
249 | BOOLEAN DeviceIsHub;
|
---|
250 | USHORT DeviceAddress;
|
---|
251 | ULONG NumberOfOpenPipes;
|
---|
252 | USB_CONNECTION_STATUS ConnectionStatus;
|
---|
253 | USB_PIPE_INFO PipeList[0];
|
---|
254 | } USB_NODE_CONNECTION_INFORMATION_EX,*PUSB_NODE_CONNECTION_INFORMATION_EX;
|
---|
255 |
|
---|
256 | #if _WIN32_WINNT >= 0x0600
|
---|
257 | typedef union _USB_HUB_CAP_FLAGS {
|
---|
258 | ULONG ul;
|
---|
259 | __C89_NAMELESS struct {
|
---|
260 | ULONG HubIsHighSpeedCapable:1;
|
---|
261 | ULONG HubIsHighSpeed:1;
|
---|
262 | ULONG HubIsMultiTtCapable:1;
|
---|
263 | ULONG HubIsMultiTt:1;
|
---|
264 | ULONG HubIsRoot:1;
|
---|
265 | ULONG HubIsArmedWakeOnConnect:1;
|
---|
266 | ULONG HubIsBusPowered:1;
|
---|
267 | ULONG ReservedMBZ:25;
|
---|
268 | };
|
---|
269 | } USB_HUB_CAP_FLAGS,*PUSB_HUB_CAP_FLAGS;
|
---|
270 |
|
---|
271 | typedef struct _USB_HUB_CAPABILITIES_EX {
|
---|
272 | USB_HUB_CAP_FLAGS CapabilityFlags;
|
---|
273 | } USB_HUB_CAPABILITIES_EX,*PUSB_HUB_CAPABILITIES_EX;
|
---|
274 |
|
---|
275 | typedef struct _USB_CYCLE_PORT_PARAMS {
|
---|
276 | ULONG ConnectionIndex;
|
---|
277 | ULONG StatusReturned;
|
---|
278 | } USB_CYCLE_PORT_PARAMS,*PUSB_CYCLE_PORT_PARAMS;
|
---|
279 |
|
---|
280 | typedef struct _USB_ID_STRING {
|
---|
281 | USHORT LanguageId;
|
---|
282 | USHORT Pad;
|
---|
283 | ULONG LengthInBytes;
|
---|
284 | PWCHAR Buffer;
|
---|
285 | } USB_ID_STRING,*PUSB_ID_STRING;
|
---|
286 |
|
---|
287 | typedef struct _USB_HUB_DEVICE_UXD_SETTINGS {
|
---|
288 | ULONG Version;
|
---|
289 | GUID PnpGuid;
|
---|
290 | GUID OwnerGuid;
|
---|
291 | ULONG DeleteOnShutdown;
|
---|
292 | ULONG DeleteOnReload;
|
---|
293 | ULONG DeleteOnDisconnect;
|
---|
294 | ULONG Reserved[5];
|
---|
295 | } USB_HUB_DEVICE_UXD_SETTINGS,*PUSB_HUB_DEVICE_UXD_SETTINGS;
|
---|
296 |
|
---|
297 | typedef struct _HUB_DEVICE_CONFIG_INFO_V1 {
|
---|
298 | ULONG Version;
|
---|
299 | ULONG Length;
|
---|
300 | USB_HUB_CAP_FLAGS HubFlags;
|
---|
301 | USB_ID_STRING HardwareIds;
|
---|
302 | USB_ID_STRING CompatibleIds;
|
---|
303 | USB_ID_STRING DeviceDescription;
|
---|
304 | ULONG Reserved[19];
|
---|
305 | USB_HUB_DEVICE_UXD_SETTINGS UxdSettings;
|
---|
306 | } HUB_DEVICE_CONFIG_INFO,*PHUB_DEVICE_CONFIG_INFO;
|
---|
307 | #endif
|
---|
308 |
|
---|
309 | typedef struct _HCD_STAT_COUNTERS {
|
---|
310 | ULONG BytesTransferred;
|
---|
311 | USHORT IsoMissedCount;
|
---|
312 | USHORT DataOverrunErrorCount;
|
---|
313 | USHORT CrcErrorCount;
|
---|
314 | USHORT ScheduleOverrunCount;
|
---|
315 | USHORT TimeoutErrorCount;
|
---|
316 | USHORT InternalHcErrorCount;
|
---|
317 | USHORT BufferOverrunErrorCount;
|
---|
318 | USHORT SWErrorCount;
|
---|
319 | USHORT StallPidCount;
|
---|
320 | USHORT PortDisableCount;
|
---|
321 | } HCD_STAT_COUNTERS,*PHCD_STAT_COUNTERS;
|
---|
322 |
|
---|
323 | typedef struct _HCD_ISO_STAT_COUNTERS {
|
---|
324 | USHORT LateUrbs;
|
---|
325 | USHORT DoubleBufferedPackets;
|
---|
326 | USHORT TransfersCF_5ms;
|
---|
327 | USHORT TransfersCF_2ms;
|
---|
328 | USHORT TransfersCF_1ms;
|
---|
329 | USHORT MaxInterruptLatency;
|
---|
330 | USHORT BadStartFrame;
|
---|
331 | USHORT StaleUrbs;
|
---|
332 | USHORT IsoPacketNotAccesed;
|
---|
333 | USHORT IsoPacketHWError;
|
---|
334 | USHORT SmallestUrbPacketCount;
|
---|
335 | USHORT LargestUrbPacketCount;
|
---|
336 | USHORT IsoCRC_Error;
|
---|
337 | USHORT IsoOVERRUN_Error;
|
---|
338 | USHORT IsoINTERNAL_Error;
|
---|
339 | USHORT IsoUNKNOWN_Error;
|
---|
340 | ULONG IsoBytesTransferred;
|
---|
341 | USHORT LateMissedCount;
|
---|
342 | USHORT HWIsoMissedCount;
|
---|
343 | ULONG Reserved7[8];
|
---|
344 | } HCD_ISO_STAT_COUNTERS,*PHCD_ISO_STAT_COUNTERS;
|
---|
345 |
|
---|
346 | typedef struct _HCD_STAT_INFORMATION_1 {
|
---|
347 | ULONG Reserved1;
|
---|
348 | ULONG Reserved2;
|
---|
349 | ULONG ResetCounters;
|
---|
350 | LARGE_INTEGER TimeRead;
|
---|
351 | HCD_STAT_COUNTERS Counters;
|
---|
352 | } HCD_STAT_INFORMATION_1,*PHCD_STAT_INFORMATION_1;
|
---|
353 |
|
---|
354 | typedef struct _HCD_STAT_INFORMATION_2 {
|
---|
355 | ULONG Reserved1;
|
---|
356 | ULONG Reserved2;
|
---|
357 | ULONG ResetCounters;
|
---|
358 | LARGE_INTEGER TimeRead;
|
---|
359 | LONG LockedMemoryUsed;
|
---|
360 | HCD_STAT_COUNTERS Counters;
|
---|
361 | HCD_ISO_STAT_COUNTERS IsoCounters;
|
---|
362 | } HCD_STAT_INFORMATION_2,*PHCD_STAT_INFORMATION_2;
|
---|
363 |
|
---|
364 | #define WMI_USB_DRIVER_INFORMATION 0
|
---|
365 | #define WMI_USB_DRIVER_NOTIFICATION 1
|
---|
366 | #define WMI_USB_POWER_DEVICE_ENABLE 2
|
---|
367 | #define WMI_USB_HUB_NODE_INFORMATION 4
|
---|
368 |
|
---|
369 | #define WMI_USB_PERFORMANCE_INFORMATION 1
|
---|
370 | #define WMI_USB_DEVICE_NODE_INFORMATION 2
|
---|
371 |
|
---|
372 | typedef enum _USB_NOTIFICATION_TYPE {
|
---|
373 | EnumerationFailure = 0,
|
---|
374 | InsufficentBandwidth,
|
---|
375 | InsufficentPower,
|
---|
376 | OverCurrent,
|
---|
377 | ResetOvercurrent,
|
---|
378 | AcquireBusInfo,
|
---|
379 | AcquireHubName,
|
---|
380 | AcquireControllerName,
|
---|
381 | HubOvercurrent,
|
---|
382 | HubPowerChange,
|
---|
383 | HubNestedTooDeeply,
|
---|
384 | ModernDeviceInLegacyHub
|
---|
385 | } USB_NOTIFICATION_TYPE;
|
---|
386 |
|
---|
387 | typedef struct _USB_NOTIFICATION {
|
---|
388 | USB_NOTIFICATION_TYPE NotificationType;
|
---|
389 | } USB_NOTIFICATION,*PUSB_NOTIFICATION;
|
---|
390 |
|
---|
391 | typedef struct _USB_CONNECTION_NOTIFICATION {
|
---|
392 | USB_NOTIFICATION_TYPE NotificationType;
|
---|
393 | ULONG ConnectionNumber;
|
---|
394 | ULONG RequestedBandwidth;
|
---|
395 | ULONG EnumerationFailReason;
|
---|
396 | ULONG PowerRequested;
|
---|
397 | ULONG HubNameLength;
|
---|
398 | } USB_CONNECTION_NOTIFICATION,*PUSB_CONNECTION_NOTIFICATION;
|
---|
399 |
|
---|
400 | typedef struct _USB_BUS_NOTIFICATION {
|
---|
401 | USB_NOTIFICATION_TYPE NotificationType;
|
---|
402 | ULONG TotalBandwidth;
|
---|
403 | ULONG ConsumedBandwidth;
|
---|
404 | ULONG ControllerNameLength;
|
---|
405 | } USB_BUS_NOTIFICATION,*PUSB_BUS_NOTIFICATION;
|
---|
406 |
|
---|
407 | typedef struct _USB_ACQUIRE_INFO {
|
---|
408 | USB_NOTIFICATION_TYPE NotificationType;
|
---|
409 | ULONG TotalSize;
|
---|
410 | WCHAR Buffer[1];
|
---|
411 | } USB_ACQUIRE_INFO,*PUSB_ACQUIRE_INFO;
|
---|
412 |
|
---|
413 | #if _WIN32_WINNT >= 0x0600
|
---|
414 | #define USB_NODE_INFO_SIG 'USBN'
|
---|
415 |
|
---|
416 | typedef enum _USB_WMI_DEVICE_NODE_TYPE {
|
---|
417 | UsbDevice,
|
---|
418 | HubDevice,
|
---|
419 | CompositeDevice,
|
---|
420 | UsbController
|
---|
421 | } USB_WMI_DEVICE_NODE_TYPE,*PUSB_WMI_DEVICE_NODE_TYPE;
|
---|
422 |
|
---|
423 | typedef struct _USB_DEVICE_STATE {
|
---|
424 | ULONG DeviceConnected:1;
|
---|
425 | ULONG DeviceStarted:1;
|
---|
426 | } USB_DEVICE_STATE,*PUSB_DEVICE_STATE;
|
---|
427 |
|
---|
428 | typedef struct _USB_HUB_PORT_INFORMATION {
|
---|
429 | USB_DEVICE_STATE DeviceState;
|
---|
430 | USHORT PortNumber;
|
---|
431 | USHORT DeviceAddress;
|
---|
432 | ULONG ConnectionIndex;
|
---|
433 | USB_CONNECTION_STATUS ConnectionStatus;
|
---|
434 | } USB_HUB_PORT_INFORMATION,*PUSB_HUB_PORT_INFORMATION;
|
---|
435 |
|
---|
436 | typedef struct _USB_HUB_DEVICE_INFO {
|
---|
437 | USB_HUB_DESCRIPTOR HubDescriptor;
|
---|
438 | ULONG HubNumber;
|
---|
439 | USHORT DeviceAddress;
|
---|
440 | BOOLEAN HubIsSelfPowered;
|
---|
441 | BOOLEAN HubIsRootHub;
|
---|
442 | USB_HUB_CAPABILITIES HubCapabilities;
|
---|
443 | ULONG NumberOfHubPorts;
|
---|
444 | USB_HUB_PORT_INFORMATION PortInfo[1];
|
---|
445 | } USB_HUB_DEVICE_INFO,*PUSB_HUB_DEVICE_INFO;
|
---|
446 |
|
---|
447 | typedef struct _USB_COMPOSITE_FUNCTION_INFO {
|
---|
448 | UCHAR FunctionNumber;
|
---|
449 | UCHAR BaseInterfaceNumber;
|
---|
450 | UCHAR NumberOfInterfaces;
|
---|
451 | BOOLEAN FunctionIsIdle;
|
---|
452 | } USB_COMPOSITE_FUNCTION_INFO,*PUSB_COMPOSITE_FUNCTION_INFO;
|
---|
453 |
|
---|
454 | typedef struct _USB_COMPOSITE_DEVICE_INFO {
|
---|
455 | USB_DEVICE_DESCRIPTOR DeviceDescriptor;
|
---|
456 | USB_CONFIGURATION_DESCRIPTOR CurrentConfigDescriptor;
|
---|
457 | UCHAR CurrentConfigurationValue;
|
---|
458 | UCHAR NumberOfFunctions;
|
---|
459 | USB_COMPOSITE_FUNCTION_INFO FunctionInfo[1];
|
---|
460 | } USB_COMPOSITE_DEVICE_INFO,*PUSB_COMPOSITE_DEVICE_INFO;
|
---|
461 |
|
---|
462 | typedef struct _USB_CONTROLLER_DEVICE_INFO {
|
---|
463 | ULONG PciVendorId;
|
---|
464 | ULONG PciDeviceId;
|
---|
465 | ULONG PciRevision;
|
---|
466 | ULONG NumberOfRootPorts;
|
---|
467 | ULONG HcFeatureFlags;
|
---|
468 | } USB_CONTROLLER_DEVICE_INFO,*PUSB_CONTROLLER_DEVICE_INFO;
|
---|
469 |
|
---|
470 | typedef struct _USB_DEVICE_INFO {
|
---|
471 | USB_DEVICE_STATE DeviceState;
|
---|
472 | USHORT PortNumber;
|
---|
473 | USB_DEVICE_DESCRIPTOR DeviceDescriptor;
|
---|
474 | UCHAR CurrentConfigurationValue;
|
---|
475 | USB_DEVICE_SPEED Speed;
|
---|
476 | USHORT DeviceAddress;
|
---|
477 | ULONG ConnectionIndex;
|
---|
478 | USB_CONNECTION_STATUS ConnectionStatus;
|
---|
479 | WCHAR PnpHardwareId[128];
|
---|
480 | WCHAR PnpCompatibleId[128];
|
---|
481 | WCHAR SerialNumberId[128];
|
---|
482 | WCHAR PnpDeviceDescription[128];
|
---|
483 | ULONG NumberOfOpenPipes;
|
---|
484 | USB_PIPE_INFO PipeList[1];
|
---|
485 | } USB_DEVICE_INFO,*PUSB_DEVICE_INFO;
|
---|
486 |
|
---|
487 | typedef struct _USB_DEVICE_NODE_INFO {
|
---|
488 | ULONG Sig;
|
---|
489 | ULONG LengthInBytes;
|
---|
490 | WCHAR DeviceDescription[40];
|
---|
491 | USB_WMI_DEVICE_NODE_TYPE NodeType;
|
---|
492 | USB_TOPOLOGY_ADDRESS BusAddress;
|
---|
493 | __C89_NAMELESS union {
|
---|
494 | USB_DEVICE_INFO UsbDeviceInfo;
|
---|
495 | USB_HUB_DEVICE_INFO HubDeviceInfo;
|
---|
496 | USB_COMPOSITE_DEVICE_INFO CompositeDeviceInfo;
|
---|
497 | USB_CONTROLLER_DEVICE_INFO ControllerDeviceInfo;
|
---|
498 | UCHAR DeviceInformation[4];
|
---|
499 | };
|
---|
500 | } USB_DEVICE_NODE_INFO,*PUSB_DEVICE_NODE_INFO;
|
---|
501 |
|
---|
502 | typedef struct _USB_DEVICE_PERFORMANCE_INFO {
|
---|
503 | ULONG BulkBytes;
|
---|
504 | ULONG ControlDataBytes;
|
---|
505 | ULONG IsoBytes;
|
---|
506 | ULONG InterruptBytes;
|
---|
507 | ULONG BulkUrbCount;
|
---|
508 | ULONG ControlUrbCount;
|
---|
509 | ULONG IsoUrbCount;
|
---|
510 | ULONG InterruptUrbCount;
|
---|
511 | ULONG AllocedInterrupt[6];
|
---|
512 | ULONG AllocedIso;
|
---|
513 | ULONG Total32secBandwidth;
|
---|
514 | ULONG TotalTtBandwidth;
|
---|
515 | WCHAR DeviceDescription[60];
|
---|
516 | USB_DEVICE_SPEED DeviceSpeed;
|
---|
517 | ULONG TotalIsoLatency;
|
---|
518 | ULONG DroppedIsoPackets;
|
---|
519 | ULONG TransferErrors;
|
---|
520 | ULONG PciInterruptCount;
|
---|
521 | ULONG HcIdleState;
|
---|
522 | ULONG HcAsyncIdleState;
|
---|
523 | ULONG HcAsyncCacheFlushCount;
|
---|
524 | ULONG HcPeriodicIdleState;
|
---|
525 | ULONG HcPeriodicCacheFlushCount;
|
---|
526 | } USB_DEVICE_PERFORMANCE_INFO,*PUSB_DEVICE_PERFORMANCE_INFO;
|
---|
527 | #endif
|
---|
528 |
|
---|
529 | #if NTDDI_VERSION >= 0x06020000
|
---|
530 | typedef enum _USB_HUB_TYPE {
|
---|
531 | UsbRootHub = 1,
|
---|
532 | Usb20Hub = 2,
|
---|
533 | Usb30Hub = 3
|
---|
534 | } USB_HUB_TYPE;
|
---|
535 |
|
---|
536 | typedef struct _USB_HUB_INFORMATION_EX {
|
---|
537 | USB_HUB_TYPE HubType;
|
---|
538 | USHORT HighestPortNumber;
|
---|
539 | union {
|
---|
540 | USB_HUB_DESCRIPTOR UsbHubDescriptor;
|
---|
541 | USB_30_HUB_DESCRIPTOR Usb30HubDescriptor;
|
---|
542 | } u;
|
---|
543 | } USB_HUB_INFORMATION_EX,*PUSB_HUB_INFORMATION_EX;
|
---|
544 |
|
---|
545 | typedef union _USB_PORT_PROPERTIES {
|
---|
546 | ULONG ul;
|
---|
547 | __C89_NAMELESS struct {
|
---|
548 | ULONG PortIsUserConnectable :1;
|
---|
549 | ULONG PortIsDebugCapable :1;
|
---|
550 | ULONG ReservedMBZ :30;
|
---|
551 | };
|
---|
552 | } USB_PORT_PROPERTIES,*PUSB_PORT_PROPERTIES;
|
---|
553 |
|
---|
554 | typedef struct _USB_PORT_CONNECTOR_PROPERTIES {
|
---|
555 | ULONG ConnectionIndex;
|
---|
556 | ULONG ActualLength;
|
---|
557 | USB_PORT_PROPERTIES UsbPortProperties;
|
---|
558 | USHORT CompanionIndex;
|
---|
559 | USHORT CompanionPortNumber;
|
---|
560 | WCHAR CompanionHubSymbolicLinkName[1];
|
---|
561 | } USB_PORT_CONNECTOR_PROPERTIES,*PUSB_PORT_CONNECTOR_PROPERTIES;
|
---|
562 |
|
---|
563 | typedef union _USB_PROTOCOLS {
|
---|
564 | ULONG ul;
|
---|
565 | __C89_NAMELESS struct {
|
---|
566 | ULONG Usb110 :1;
|
---|
567 | ULONG Usb200 :1;
|
---|
568 | ULONG Usb300 :1;
|
---|
569 | ULONG ReservedMBZ :29;
|
---|
570 | };
|
---|
571 | } USB_PROTOCOLS,*PUSB_PROTOCOLS;
|
---|
572 |
|
---|
573 | typedef union _USB_NODE_CONNECTION_INFORMATION_EX_V2_FLAGS {
|
---|
574 | ULONG ul;
|
---|
575 | __C89_NAMELESS struct {
|
---|
576 | ULONG DeviceIsOperatingAtSuperSpeedOrHigher :1;
|
---|
577 | ULONG DeviceIsSuperSpeedCapableOrHigher :1;
|
---|
578 | ULONG DeviceIsOperatingAtSuperSpeedPlusOrHigher :1;
|
---|
579 | ULONG DeviceIsSuperSpeedPlusCapableOrHigher :1;
|
---|
580 | ULONG ReservedMBZ :28;
|
---|
581 | };
|
---|
582 | } USB_NODE_CONNECTION_INFORMATION_EX_V2_FLAGS,*PUSB_NODE_CONNECTION_INFORMATION_EX_V2_FLAGS;
|
---|
583 |
|
---|
584 | typedef struct _USB_NODE_CONNECTION_INFORMATION_EX_V2 {
|
---|
585 | ULONG ConnectionIndex;
|
---|
586 | ULONG Length;
|
---|
587 | USB_PROTOCOLS SupportedUsbProtocols;
|
---|
588 | USB_NODE_CONNECTION_INFORMATION_EX_V2_FLAGS Flags;
|
---|
589 | } USB_NODE_CONNECTION_INFORMATION_EX_V2,*PUSB_NODE_CONNECTION_INFORMATION_EX_V2;
|
---|
590 | #endif
|
---|
591 |
|
---|
592 | #include <poppack.h>
|
---|
593 |
|
---|
594 | #endif
|
---|
595 |
|
---|
596 | #endif
|
---|
597 | #endif
|
---|