Platform SDK: Hardware |
The SetupDiGetDeviceInterfaceAlias function retrieves an alias for the specified device interface. Device interfaces are considered aliases if they are exposed by the same underlying device and have identical reference strings, but are of different interface classes.
BOOL SetupDiGetDeviceInterfaceAlias( HDEVINFO DeviceInfoSet, PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData, CONST LPGUID AliasInterfaceClassGuid, PSP_DEVICE_INTERFACE_DATA AliasDeviceInterfaceData );
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError. Possible errors returned by GetLastError include the following.
Error | Meaning |
---|---|
ERROR_INVALID_PARAMETER | Invalid DeviceInfoSet or DeviceInterfaceData parameter. |
ERROR_NO_SUCH_INTERFACE_DEVICE | There is no alias of class AliasInterfaceClassGuid for the specified device interface. |
ERROR_INVALID_USER_BUFFER | Invalid AliasDeviceInterfaceData buffer. |
The SetupDiGetDeviceInterfaceAlias function can be used to locate a device that exposes more than one interface. For example, consider a disk that can be part of a fault-tolerant volume and can contain encrypted data. The function driver for the disk device could register a fault-tolerant-volume interface and an encrypted-volume interface. These interfaces are device interface aliases if the function driver registers them with identical reference strings and they refer to the same device.
To locate a device with multiple interfaces, perform the following steps
If the requested alias exists but the AliasDeviceInterfaceData buffer is invalid, this function successfully adds the device interface to the device information set, but returns FALSE. In this case, GetLastError returns ERROR_INVALID_USER_BUFFER.
Windows NT/2000: Requires Windows 2000.
Windows 95/98: Requires Windows 98.
Header: Declared in Setupapi.h.
Library: Use Setupapi.lib.
Device Management Overview, Device Management Functions, SetupDiEnumDeviceInterfaces, SetupDiGetClassDevs, SetupDiGetClassDevsEx, SP_DEVICE_INTERFACE_DATA