次の方法で共有


USBDeviceAttach (Compact 2013)

3/26/2014

This function is a universal serial bus (USB) device attach routine. It passes a table of functions to USB client drivers. USB host client drivers must implement this function.

Syntax

BOOL USBDeviceAttach(
  USB_HANDLE hDevice,
  LPCUSB_FUNCS lpUsbFuncs,
  LPCUSB_INTERFACE lpInterface,
  LPCWSTR szUniqueDriverId,
  LPBOOL fAcceptControl,
  LPCUSB_DRIVER_SETTINGS lpDriverSettings,
  DWORD dwUnused 
);

Parameters

  • hDevice
    [in] Handle to a USB device.
  • lpUsbFuncs
    [in] Pointer to a USB device interface function table.
  • lpInterface
    [in] Pointer to the USB_INTERFACE structure that contains interface information if a client is loaded as an interface driver. If a client is not loaded for a specific interface, this parameter is NULL, and the client can get interface information through the LPFIND_INTERFACE function.
  • szUniqueDriverId
    [in] Client driver identifier string.
  • fAcceptControl
    [out] Indicator if the driver accepts control of the device or if the driver should continue to try to load client drivers. Set to TRUE if the driver accepts control of the device or FALSE if the USB driver should continue to try to load client drivers.
  • lpDriverSettings
    [in] Pointer to the USB_DRIVER_SETTINGS structure that indicates how the driver is loaded.
  • dwUnused
    [in] Reserved.

Return Value

TRUE indicates success. FALSE indicates failure.

Remarks

The USB driver module calls this function when a device is attached and a matching registry key is found in the LoadClients registry key. The driver should determine whether it can control the device. It and must load drivers for any uncontrolled interfaces on the device.

Requirements

Header

usbdi.h

See Also

Reference

USB Driver Functions
LPFIND_INTERFACE
LPLOAD_GENERIC_INTERFACE_DRIVER
USB_DRIVER_SETTINGS
USB_INTERFACE