SetupDiGetDeviceInstanceId

BOOLEAN
    SetupDiGetDeviceInstanceId(
        IN HDEVINFO  DeviceInfoSet,
        IN PSP_DEVINFO_DATA  DeviceInfoData 
        OUT PTSTR  DeviceInstanceId,
        IN DWORD  DeviceInstanceIdSize, 
        OUT PDWORD  RequiredSize    /* optional */
        );

SetupDiGetDeviceInstanceId retrieves the device instance ID associated with a device information element.

Parameters
DeviceInfoSet
Supplies a handle to the device information set that contains the device information element to retrieve.
DeviceInfoData
Supplies a pointer to the SP_DEVINFO_DATA structure for the device information element whose ID is to be retrieved.
DeviceInstanceId
Supplies a pointer to the character buffer that will receive the ID for the specified device information element.
DeviceInstanceIdSize
Supplies the size, in characters, of the DeviceInstanceId buffer.
RequiredSize
Supplies a pointer to the variable that receives the number of characters required to store the device instance ID.
Return Value

The function returns TRUE if it is successful. Otherwise it returns FALSE and the logged error can be retrieved with a call to GetLastError.

See Also

SetupDiCreateDeviceInfo, SetupDiCreateDevRegKey, SetupDiOpenDeviceInfo, SetupDiOpenDevRegKey