USB desktop application programming reference
The topics in this section describe the four types of routines exposed by the Microsoft-provided USB driver stack.
WinUSB Functions
This section describes the following functions, exposed by Winusb.dll, which user-mode client drivers and applications can use to communicate with USB devices.
Note WinUSB functions require Windows XP or later. You can use these functions in your C/C++ application to communicate with your USB device. Microsoft does not provide a managed API for WinUSB.
| Routine | Description |
|---|---|
| WinUsb_AbortPipe | Aborts all of the pending transfers for a pipe. |
| WinUsb_ControlTransfer | Transmits control data over a default control endpoint. |
| WinUsb_FlushPipe | Discards any data that is cached in a pipe. |
| WinUsb_Free | Releases all of the resources that WinUsb_Initialize allocated. |
| WinUsb_GetAdjustedFrameNumber | Computes what the current USB frame number should be based on the frame number value and timestamp. |
| WinUsb_GetAssociatedInterface | Retrieves a handle for an associated interface. |
| WinUsb_GetCurrentAlternateSetting | Gets the current alternate interface setting for an interface. |
| WinUsb_GetCurrentFrameNumber | Gets the current frame number for the bus. |
| WinUsb_GetDescriptor | Gets the requested descriptor. |
| WinUsb_GetOverlappedResult | Retrieves the results of an overlapped operation on the specified file. |
| WinUsb_GetPipePolicy | Gets the policy for a specific pipe (endpoint). |
| WinUsb_GetPowerPolicy | Gets the power policy for a device. |
| WinUsb_Initialize | Creates a WinUSB handle for the device specified by a file handle. |
| WinUsb_QueryDeviceInformation | Retrieves information about the physical device that is associated with a WinUSB handle. |
| WinUsb_QueryInterfaceSettings | Retrieves the interface descriptor for the specified alternate interface settings for a particular interface handle. |
| WinUsb_QueryPipe | Retrieves information about a pipe that is associated with an interface. |
| WinUsb_QueryPipeEx | Retrieves extended information about a pipe that is associated with an interface. This contains information about isochronous pipe intervals. |
| WinUsb_ReadIsochPipeAsap | Reads data from an isochronous OUT endpoint. |
| WinUsb_ReadPipe | Reads data from the specified pipe. |
| WinUsb_RegisterIsochBuffer | Registers a buffer to be used for isochronous transfers. |
| WinUsb_ResetPipe | Resets the data toggle and clears the stall condition on a pipe. |
| WinUsb_ReadIsochPipe | Reads data from an isochronous OUT endpoint. |
| WinUsb_SetCurrentAlternateSetting | Sets the alternate setting of an interface. |
| WinUsb_SetPipePolicy | Sets the policy for a specific pipe (endpoint). |
| WinUsb_SetPowerPolicy | Sets the power policy for a device. |
| WinUsb_UnregisterIsochBuffer | Releases all of the resources that previously allocated. This is a synchronous operation. |
| WinUsb_WriteIsochPipeAsap | Writes the contents of a buffer to an isochronous OUT endpoint. |
| WinUsb_WriteIsochPipe | Writes the contents of a caller-supplied buffer to an isochronous OUT endpoint, starting on a specified frame number. |
| WinUsb_WritePipe | Writes data to a pipe. |
User-Mode IOCTLs sent by applications and services
USB client drivers receive these user-mode I/O control requests at the kernel level:
| I/O Request | Description | Device interface GUID |
|---|---|---|
| IOCTL_GET_HCD_DRIVERKEY_NAME | Retrieves the driver key name in the registry for a USB host controller driver. | GUID_DEVINTERFACE_USB_HOST_CONTROLLER |
| IOCTL_USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION | Retrieves one or more descriptors for the device that is associated with the indicated port index. | GUID_DEVINTERFACE_USB_HUB |
| IOCTL_USB_GET_HUB_CAPABILITIES_EX | Retrieves the capabilities of a USB hub. | GUID_DEVINTERFACE_USB_HUB |
| IOCTL_USB_GET_HUB_INFORMATION_EX | Retrieves information about a particular USB hub type, its descriptor, and indicates the number of ports on the hub. | GUID_DEVINTERFACE_USB_HUB |
| IOCTL_USB_GET_NODE_CONNECTION_INFORMATION_EX_V2 | Retrieves speed information about a USB device attached to a particular port. | GUID_DEVINTERFACE_USB_HUB |
| IOCTL_USB_GET_NODE_CONNECTION_ATTRIBUTES | Retrieves the Microsoft-extended port attributes for a specific port. | GUID_DEVINTERFACE_USB_HUB |
| IOCTL_USB_GET_NODE_CONNECTION_DRIVERKEY_NAME | Retrieves the driver registry key name that is associated with the device that is connected to the indicated port. | GUID_DEVINTERFACE_USB_HUB |
| IOCTL_USB_GET_NODE_CONNECTION_INFORMATION | Retrieves information about the indicated USB port and the device that is attached to the port, if there is one. | GUID_DEVINTERFACE_USB_HUB |
| IOCTL_USB_GET_NODE_CONNECTION_INFORMATION_EX | Retrieves information about a USB port and the device that is attached to the port, if there is one. | GUID_DEVINTERFACE_USB_HUB |
| IOCTL_USB_GET_NODE_CONNECTION_NAME | Retrieves the symbolic link name of the hub that is attached to the downstream port. | GUID_DEVINTERFACE_USB_HUB |
| IOCTL_USB_GET_NODE_INFORMATION | Retrieves information about a parent device. | GUID_DEVINTERFACE_USB_HUB |
| IOCTL_USB_GET_NODE_CONNECTION_INFORMATION_EX | Retrieves information about a USB port and the device that is attached to the port if there is one. | GUID_DEVINTERFACE_USB_HUB |
| IOCTL_USB_GET_PORT_CONNECTOR_PROPERTIES | Retrieves information about a specific port on a USB hub. | GUID_DEVINTERFACE_USB_HUB |
| IOCTL_USB_GET_ROOT_HUB_NAME | Retrieves the symbolic link name of the root hub. | GUID_DEVINTERFACE_USB_HOST_CONTROLLER |
| IOCTL_USB_HUB_CYCLE_PORT | Power cycles the port that is associated with the PDO that receives the request. | GUID_DEVINTERFACE_USB_HUB |
| IOCTL_USB_USER_REQUEST | Available to both user-mode applications and kernel-mode drivers. | GUID_DEVINTERFACE_USB_HOST_CONTROLLER |
Deprecated and Reserved USB IOCTLs
The following I/O requests have been deprecated or reserved for internal use. USB client drivers must not use these I/O requests:
- IOCTL_USB_DIAG_IGNORE_HUBS_OFF
- IOCTL_USB_DIAG_IGNORE_HUBS_ON
- IOCTL_USB_DIAGNOSTIC_MODE_OFF
- IOCTL_USB_DIAGNOSTIC_MODE_ON
- IOCTL_USB_GET_HUB_CAPABILITIES
- IOCTL_USB_HCD_DISABLE_PORT
- IOCTL_USB_HCD_ENABLE_PORT
- IOCTL_USB_HCD_GET_STATS_1
- IOCTL_USB_HCD_GET_STATS_2
- IOCTL_USB_RESET_HUB
Related topics
Show: