none
Unable to Install driver on specific device using DiInstallDevice. RRS feed

  • Question

  • Requirement installing specific driver on specific device. Hence using DiInstallDevice API.

    Followed below steps to get SP_DEVINFO_DATA and SP_DRVINFO_DATA.

    1> Preinstalled the Driver with DriverPackagePreinstall API. verified driver is present in driverstore.

    2>Call SetupDiGetClassDevs to retrieve a device information set that contains the device and then call SetupDiEnumDeviceInfo to enumerate the devices in the device information set. On each call, SetupDiEnumDeviceInfo returns an SP_DEVINFO_DATA structure that represents the enumerated device in the device

    information set. To obtain specific information about the enumerated

    device, call SetupDiGetDeviceProperty and supply the SP_DEVINFO_DATA structure that is returned by SetupDiEnumDeviceInfo.

     3> To retrieve an SP_DRVINFO_DATA structure for a selected driver, call SetupDiBuildDriverInfoList to build a list of drivers for the device and then call SetupDiEnumDriverInfo to enumerate the elements of the driver list for the device. For each enumerated driver, SetupDiEnumDriverInfo retrieves an SP_DRVINFO_DATA structure that identifies the driver. SetupDiGetDriverInfoDetail can also be called to retrieve additional detail about an enumerated driver. verified Driver structure is correct. In DiInstallDevice,

    BOOL DiInstallDevice(

    HWND hwndParent,

    HDEVINFO DeviceInfoSet,

    PSP_DEVINFO_DATA DeviceInfoData,

    PSP_DRVINFO_DATA DriverInfoData,

    DWORD Flags,

    PBOOL NeedReboot );

     if PSP_DRVINFO_DATA as NULL and FLAG as DIIDFLAG_INSTALLNULLDRIVER, Null driver is installed on required device.

    and also if SP_DRVINFO_DATA as NULL and FLAG as DIIDFLAG_SHOWSEARCHUI , as my driver is latest, API is able to install it on the device.

    But issue is if I provide the correct PSP_DRVINFO_DATA along with FLAG as 0 or any other FLAG, API fails and getlasterror says as INVALID_PARAMETER.

    my concern is why is the specified driver not getting installed with this API.

    Thursday, July 12, 2018 11:00 AM

All replies

  • Post the code itself. Does setupapi.dev.log have any indication of what is wrong?

    d -- This posting is provided "AS IS" with no warranties, and confers no rights.

    Thursday, July 12, 2018 2:17 PM
  • Hi Doron,

    Following is the error I see in setupapi.dev.log

    ndv: Flags:0x00000000

    dvi: setting selected driver failed (0x00000057)

    dvi: Error 87: The parameter is incorrect.

     I have used SetupDiBuildDriverInfoList to build a list of drivers for the device and then call SetupDiEnumDriverInfo to enumerate the elements of the driver list for the device. For each enumerated driver, SetupDiEnumDriverInfo retrieves an SP_DRVINFO_DATA structure that identifies the driver, here I break out if the manufacture name is found. Then use this in DiINSTALLdevice function.

    Please let me know how to set selected driver for DiInstallDevice

    Tuesday, July 17, 2018 8:02 AM
  • Hi All,

    Has anybody faced issue with DiINstallDevice not installing a particular driver on a specific device.. Please post your comments here

    Monday, July 23, 2018 11:53 AM
  • Please post your code as requested (not a description).

    d -- This posting is provided "AS IS" with no warranties, and confers no rights.

    Monday, July 23, 2018 2:10 PM
  • Having same error code here, did you have a solution?
    Friday, February 1, 2019 10:30 PM
  • So, you have posted the code somewhere, right? Can we see?

    -- pa

    Sunday, February 3, 2019 7:50 PM