Platform SDK: Hardware |
The SetupDiOpenDeviceInterface function retrieves information about an existing device interface and adds it to the specified device information set. This function creates a device information instance for the underlying device if an instance is not already present in the device information set.
BOOL SetupDiOpenDeviceInterface( HDEVINFO DeviceInfoSet, PCTSTR DevicePath, DWORD OpenFlags, PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData );
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.
If a device interface instance for the interface already exists in the DeviceInfoSet parameter, SetupDiOpenDeviceInterface updates the flags. Therefore, this function can be used to refresh the flags for a device interface. For example, an interface might have been inactive when it was first opened, but has subsequently become active.
If the new device interface is successfully opened, but the DeviceInterfaceData buffer is invalid, this function returns FALSE and GetLastError returns ERROR_INVALID_USER_BUFFER. This error does not prevent the interface from being opened.
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, SP_DEVICE_INTERFACE_DATA