This file is indexed.

/usr/x86_64-w64-mingw32/include/usbuser.h is in mingw-w64-x86-64-dev 2.0.3-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
/*
 * usbuser.h
 *
 * USB user mode IOCTL interface
 *
 * This file is part of the ReactOS PSDK package.
 *
 * Contributors:
 *   Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
 *
 * THIS SOFTWARE IS NOT COPYRIGHTED
 *
 * This source code is offered for use in the public domain. You may
 * use, modify or distribute it freely.
 *
 * This code is distributed in the hope that it will be useful but
 * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
 * DISCLAIMED. This includes but is not limited to warranties of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 *
 */

#pragma once

#ifdef __cplusplus
extern "C" {
#endif

#if (_WIN32_WINNT >= 0x0501)

#include "usbiodef.h"

#include <pshpack1.h>

#define USBUSER_VERSION                   0x0004

#define IOCTL_USB_USER_REQUEST            USB_CTL(HCD_USER_REQUEST)

#ifndef IOCTL_USB_DIAGNOSTIC_MODE_ON
#define IOCTL_USB_DIAGNOSTIC_MODE_ON      USB_CTL(HCD_DIAGNOSTIC_MODE_ON)
#endif
#ifndef IOCTL_USB_DIAGNOSTIC_MODE_OFF
#define IOCTL_USB_DIAGNOSTIC_MODE_OFF     USB_CTL(HCD_DIAGNOSTIC_MODE_OFF)
#endif

#ifndef IOCTL_USB_GET_ROOT_HUB_NAME
#define IOCTL_USB_GET_ROOT_HUB_NAME       USB_CTL(HCD_GET_ROOT_HUB_NAME)
#endif
#ifndef IOCTL_GET_HCD_DRIVERKEY_NAME
#define IOCTL_GET_HCD_DRIVERKEY_NAME      USB_CTL(HCD_GET_DRIVERKEY_NAME)
#endif

typedef enum _USB_USER_ERROR_CODE {
  UsbUserSuccess = 0,
  UsbUserNotSupported,
  UsbUserInvalidRequestCode,
  UsbUserFeatureDisabled,
  UsbUserInvalidHeaderParameter,
  UsbUserInvalidParameter,
  UsbUserMiniportError,
  UsbUserBufferTooSmall,
  UsbUserErrorNotMapped,
  UsbUserDeviceNotStarted,
  UsbUserNoDeviceConnected
} USB_USER_ERROR_CODE;

#define USBUSER_GET_CONTROLLER_INFO_0     0x00000001
#define USBUSER_GET_CONTROLLER_DRIVER_KEY 0x00000002
#define USBUSER_PASS_THRU                 0x00000003
#define USBUSER_GET_POWER_STATE_MAP       0x00000004
#define USBUSER_GET_BANDWIDTH_INFORMATION 0x00000005
#define USBUSER_GET_BUS_STATISTICS_0      0x00000006
#define USBUSER_GET_ROOTHUB_SYMBOLIC_NAME 0x00000007
#define USBUSER_GET_USB_DRIVER_VERSION    0x00000008
#define USBUSER_GET_USB2_HW_VERSION       0x00000009
#define USBUSER_USB_REFRESH_HCT_REG       0x0000000a

#define USBUSER_OP_SEND_ONE_PACKET        0x10000001
#define USBUSER_OP_RAW_RESET_PORT         0x20000001
#define USBUSER_OP_OPEN_RAW_DEVICE        0x20000002
#define USBUSER_OP_CLOSE_RAW_DEVICE       0x20000003
#define USBUSER_OP_SEND_RAW_COMMAND       0x20000004
#define USBUSER_SET_ROOTPORT_FEATURE      0x20000005
#define USBUSER_CLEAR_ROOTPORT_FEATURE    0x20000006
#define USBUSER_GET_ROOTPORT_STATUS       0x20000007

#define USBUSER_INVALID_REQUEST           0xFFFFFFF0
#define USBUSER_OP_MASK_DEVONLY_API       0x10000000
#define USBUSER_OP_MASK_HCTEST_API        0x20000000

#define USB_PACKETFLAG_LOW_SPEED          0x00000001
#define USB_PACKETFLAG_FULL_SPEED         0x00000002
#define USB_PACKETFLAG_HIGH_SPEED         0x00000004
#define USB_PACKETFLAG_ASYNC_IN           0x00000008
#define USB_PACKETFLAG_ASYNC_OUT          0x00000010
#define USB_PACKETFLAG_ISO_IN             0x00000020
#define USB_PACKETFLAG_ISO_OUT            0x00000040
#define USB_PACKETFLAG_SETUP              0x00000080
#define USB_PACKETFLAG_TOGGLE0            0x00000100
#define USB_PACKETFLAG_TOGGLE1            0x00000200

/* USB_CONTROLLER_INFO_0.HcFeatureFlags constants */
#define USB_HC_FEATURE_FLAG_PORT_POWER_SWITCHING  0x00000001
#define USB_HC_FEATURE_FLAG_SEL_SUSPEND           0x00000002
#define USB_HC_FEATURE_LEGACY_BIOS                0x00000004

typedef struct _USBUSER_REQUEST_HEADER {
  ULONG UsbUserRequest;
  USB_USER_ERROR_CODE UsbUserStatusCode;
  ULONG RequestBufferLength;
  ULONG ActualBufferLength;
} USBUSER_REQUEST_HEADER, *PUSBUSER_REQUEST_HEADER;

typedef struct _PACKET_PARAMETERS {
  UCHAR DeviceAddress;
  UCHAR EndpointAddress;
  USHORT MaximumPacketSize;
  ULONG Timeout;
  ULONG Flags;
  ULONG DataLength;
  USHORT HubDeviceAddress;
  USHORT PortTTNumber;
  UCHAR ErrorCount;
  UCHAR Pad[3];
  USBD_STATUS UsbdStatusCode;
  UCHAR Data[4];
} PACKET_PARAMETERS, *PPACKET_PARAMETERS;

typedef struct _USBUSER_SEND_ONE_PACKET {
  USBUSER_REQUEST_HEADER Header;
  PACKET_PARAMETERS PacketParameters;
} USBUSER_SEND_ONE_PACKET, *PUSBUSER_SEND_ONE_PACKET;

typedef struct _RAW_RESET_PORT_PARAMETERS {
  USHORT PortNumber;
  USHORT PortStatus;
} RAW_RESET_PORT_PARAMETERS, *PRAW_RESET_PORT_PARAMETERS;

typedef struct _USBUSER_RAW_RESET_ROOT_PORT {
  USBUSER_REQUEST_HEADER Header;
  RAW_RESET_PORT_PARAMETERS Parameters;
} USBUSER_RAW_RESET_ROOT_PORT, *PUSBUSER_RAW_RESET_ROOT_PORT;

typedef struct _RAW_ROOTPORT_FEATURE {
  USHORT PortNumber;
  USHORT PortFeature;
  USHORT PortStatus;
} RAW_ROOTPORT_FEATURE, *PRAW_ROOTPORT_FEATURE;

typedef struct _USBUSER_ROOTPORT_FEATURE_REQUEST {
  USBUSER_REQUEST_HEADER Header;
  RAW_ROOTPORT_FEATURE Parameters;
} USBUSER_ROOTPORT_FEATURE_REQUEST, *PUSBUSER_ROOTPORT_FEATURE_REQUEST;

typedef struct _RAW_ROOTPORT_PARAMETERS {
  USHORT PortNumber;
  USHORT PortStatus;
} RAW_ROOTPORT_PARAMETERS, *PRAW_ROOTPORT_PARAMETERS;

typedef struct _USBUSER_ROOTPORT_PARAMETERS {
  USBUSER_REQUEST_HEADER Header;
  RAW_ROOTPORT_PARAMETERS Parameters;
} USBUSER_ROOTPORT_PARAMETERS, *PUSBUSER_ROOTPORT_PARAMETERS;

typedef struct _USB_CONTROLLER_INFO_0 {
  ULONG PciVendorId;
  ULONG PciDeviceId;
  ULONG PciRevision;
  ULONG NumberOfRootPorts;
  USB_CONTROLLER_FLAVOR ControllerFlavor;
  ULONG HcFeatureFlags;
} USB_CONTROLLER_INFO_0 , *PUSB_CONTROLLER_INFO_0;

typedef struct _USBUSER_CONTROLLER_INFO_0 {
  USBUSER_REQUEST_HEADER Header;
  USB_CONTROLLER_INFO_0 Info0;
} USBUSER_CONTROLLER_INFO_0, *PUSBUSER_CONTROLLER_INFO_0;

typedef struct _USB_UNICODE_NAME {
  ULONG Length;
  WCHAR String[1];
} USB_UNICODE_NAME, *PUSB_UNICODE_NAME;

typedef struct _USBUSER_CONTROLLER_UNICODE_NAME {
  USBUSER_REQUEST_HEADER Header;
  USB_UNICODE_NAME UnicodeName;
} USBUSER_CONTROLLER_UNICODE_NAME, *PUSBUSER_CONTROLLER_UNICODE_NAME;

typedef struct _USB_PASS_THRU_PARAMETERS {
  GUID FunctionGUID;
  ULONG ParameterLength;
  UCHAR Parameters[4];
} USB_PASS_THRU_PARAMETERS, *PUSB_PASS_THRU_PARAMETERS;

typedef struct _USBUSER_PASS_THRU_REQUEST {
  USBUSER_REQUEST_HEADER Header;
  USB_PASS_THRU_PARAMETERS PassThru;
} USBUSER_PASS_THRU_REQUEST, *PUSBUSER_PASS_THRU_REQUEST;

typedef enum _WDMUSB_POWER_STATE {
  WdmUsbPowerNotMapped = 0,
  WdmUsbPowerSystemUnspecified = 100,
  WdmUsbPowerSystemWorking,
  WdmUsbPowerSystemSleeping1,
  WdmUsbPowerSystemSleeping2,
  WdmUsbPowerSystemSleeping3,
  WdmUsbPowerSystemHibernate,
  WdmUsbPowerSystemShutdown,
  WdmUsbPowerDeviceUnspecified = 200,
  WdmUsbPowerDeviceD0,
  WdmUsbPowerDeviceD1,
  WdmUsbPowerDeviceD2,
  WdmUsbPowerDeviceD3
} WDMUSB_POWER_STATE;

typedef struct _USB_POWER_INFO {
  WDMUSB_POWER_STATE SystemState;
  WDMUSB_POWER_STATE HcDevicePowerState;
  WDMUSB_POWER_STATE HcDeviceWake;
  WDMUSB_POWER_STATE HcSystemWake;
  WDMUSB_POWER_STATE RhDevicePowerState;
  WDMUSB_POWER_STATE RhDeviceWake;
  WDMUSB_POWER_STATE RhSystemWake;
  WDMUSB_POWER_STATE LastSystemSleepState;
  BOOLEAN CanWakeup;
  BOOLEAN IsPowered;
} USB_POWER_INFO, *PUSB_POWER_INFO;

typedef struct _USBUSER_POWER_INFO_REQUEST {
  USBUSER_REQUEST_HEADER Header;
  USB_POWER_INFO PowerInformation;
} USBUSER_POWER_INFO_REQUEST, *PUSBUSER_POWER_INFO_REQUEST;

typedef struct _USB_OPEN_RAW_DEVICE_PARAMETERS {
  USHORT PortStatus;
  USHORT MaxPacketEp0;
} USB_OPEN_RAW_DEVICE_PARAMETERS , *PUSB_OPEN_RAW_DEVICE_PARAMETERS;

typedef struct _USBUSER_OPEN_RAW_DEVICE {
  USBUSER_REQUEST_HEADER Header;
  USB_OPEN_RAW_DEVICE_PARAMETERS Parameters;
} USBUSER_OPEN_RAW_DEVICE, *PUSBUSER_OPEN_RAW_DEVICE;

typedef struct _USB_CLOSE_RAW_DEVICE_PARAMETERS {
  ULONG xxx;
} USB_CLOSE_RAW_DEVICE_PARAMETERS , *PUSB_CLOSE_RAW_DEVICE_PARAMETERS;

typedef struct _USBUSER_CLOSE_RAW_DEVICE {
  USBUSER_REQUEST_HEADER Header;
  USB_CLOSE_RAW_DEVICE_PARAMETERS Parameters;
} USBUSER_CLOSE_RAW_DEVICE, *PUSBUSER_CLOSE_RAW_DEVICE;

typedef struct _USB_SEND_RAW_COMMAND_PARAMETERS {
  UCHAR Usb_bmRequest;
  UCHAR Usb_bRequest;
  USHORT Usb_wVlaue;
  USHORT Usb_wIndex;
  USHORT Usb_wLength;
  USHORT DeviceAddress;
  USHORT MaximumPacketSize;
  ULONG Timeout;
  ULONG DataLength;
  USBD_STATUS UsbdStatusCode;
  UCHAR Data[4];
} USB_SEND_RAW_COMMAND_PARAMETERS, *PUSB_SEND_RAW_COMMAND_PARAMETERS;

typedef struct _USBUSER_SEND_RAW_COMMAND {
  USBUSER_REQUEST_HEADER Header;
  USB_SEND_RAW_COMMAND_PARAMETERS Parameters;
} USBUSER_SEND_RAW_COMMAND, *PUSBUSER_SEND_RAW_COMMAND;

typedef struct _USB_BANDWIDTH_INFO {
  ULONG DeviceCount;
  ULONG TotalBusBandwidth;
  ULONG Total32secBandwidth;
  ULONG AllocedBulkAndControl;
  ULONG AllocedIso;
  ULONG AllocedInterrupt_1ms;
  ULONG AllocedInterrupt_2ms;
  ULONG AllocedInterrupt_4ms;
  ULONG AllocedInterrupt_8ms;
  ULONG AllocedInterrupt_16ms;
  ULONG AllocedInterrupt_32ms;
} USB_BANDWIDTH_INFO, *PUSB_BANDWIDTH_INFO;

typedef struct _USBUSER_BANDWIDTH_INFO_REQUEST {
  USBUSER_REQUEST_HEADER Header;
  USB_BANDWIDTH_INFO BandwidthInformation;
} USBUSER_BANDWIDTH_INFO_REQUEST, *PUSBUSER_BANDWIDTH_INFO_REQUEST;

typedef struct _USB_BUS_STATISTICS_0 {
  ULONG DeviceCount;
  LARGE_INTEGER CurrentSystemTime;
  ULONG CurrentUsbFrame;
  ULONG BulkBytes;
  ULONG IsoBytes;
  ULONG InterruptBytes;
  ULONG ControlDataBytes;
  ULONG PciInterruptCount;
  ULONG HardResetCount;
  ULONG WorkerSignalCount;
  ULONG CommonBufferBytes;
  ULONG WorkerIdleTimeMs;
  BOOLEAN RootHubEnabled;
  UCHAR RootHubDevicePowerState;
  UCHAR Unused;
  UCHAR NameIndex;
} USB_BUS_STATISTICS_0, *PUSB_BUS_STATISTICS_0;

typedef struct _USBUSER_BUS_STATISTICS_0_REQUEST {
  USBUSER_REQUEST_HEADER Header;
  USB_BUS_STATISTICS_0 BusStatistics0;
} USBUSER_BUS_STATISTICS_0_REQUEST, *PUSBUSER_BUS_STATISTICS_0_REQUEST;

typedef struct _USB_DRIVER_VERSION_PARAMETERS {
  ULONG DriverTrackingCode;
  ULONG USBDI_Version;
  ULONG USBUSER_Version;
  BOOLEAN CheckedPortDriver;
  BOOLEAN CheckedMiniportDriver;
  USHORT USB_Version;
} USB_DRIVER_VERSION_PARAMETERS , *PUSB_DRIVER_VERSION_PARAMETERS;

typedef struct _USBUSER_GET_DRIVER_VERSION {
  USBUSER_REQUEST_HEADER Header;
  USB_DRIVER_VERSION_PARAMETERS Parameters;
} USBUSER_GET_DRIVER_VERSION, *PUSBUSER_GET_DRIVER_VERSION;

typedef struct _USB_USB2HW_VERSION_PARAMETERS {
  UCHAR Usb2HwRevision;
} USB_USB2HW_VERSION_PARAMETERS, *PUSB_USB2HW_VERSION_PARAMETERS;

typedef struct _USBUSER_GET_USB2HW_VERSION {
  USBUSER_REQUEST_HEADER Header;
  USB_USB2HW_VERSION_PARAMETERS Parameters;
} USBUSER_GET_USB2HW_VERSION, *PUSBUSER_GET_USB2HW_VERSION;

typedef struct _USBUSER_REFRESH_HCT_REG {
  USBUSER_REQUEST_HEADER Header;
  ULONG Flags;
} USBUSER_REFRESH_HCT_REG, *PUSBUSER_REFRESH_HCT_REG;

#include <poppack.h>

#endif /* _WIN32_WINNT >= 0x0501 */

#ifdef __cplusplus
}
#endif