Search code examples
cmddriversetupapi

Programmatic driver install via .inf causing reboot


I'm trying to install a driver via an inf file using this command:

rundll32.exe setupapi,InstallHinfSection DefaultInstall 128 .\my_driver.inf

According to MSDN (http://msdn.microsoft.com/en-us/library/aa376957%28v=vs.85%29.aspx), by suplying 128 as the parameter, apart from "Set the default path of the installation to the location of the INF. This is the typical setting", the install should (+0) not ask the user for a reboot. However, in my case, it always does.

What am I doing wrong?


Solution

  • Use advpack.dll instead of setupapi.dll

    rundll32.exe advpack.dll,LaunchINFSection inf filename[,section name][,flags][,smart reboot]
    

    The reboot with setupapi.dll seems to be a common problem with the 128 value for SETUPAPI.DLL from what I saw on a web search.

    Example

    rundll32.exe setupapi.dll,InstallHinfSection DefaultInstall 128 .\my_driver.inf
    
    rundll32.exe advpack.dll,LaunchINFSection .\my_driver.inf,,3,N
    

    These commands should both operate in a similar fashion. They will both invoke DefaultInstall section of the .inf file.

    References