Programmatic driver install via .inf causing reboot

守給你的承諾、 提交于 2019-12-05 05:03:59

问题


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?


回答1:


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

  • Run32.dll - http://ss64.com/nt/rundll32.html
  • InstallHinfSection - http://msdn.microsoft.com/en-us/library/aa376957(v=vs.85).aspx
  • AdvPack.dll - http://www.mdgx.com/INF_web/advpack.htm
  • LaunchINFSection - http://www.mdgx.com/INF_web/launch.htm
  • LaunchINFSectionEx - http://www.mdgx.com/INF_web/launchex.htm
  • LaunchINFSection - http://msdn.microsoft.com/en-us/library/gg441316(v=vs.85).aspx
  • LaunchINFSectionEx - http://msdn.microsoft.com/en-us/library/aa768006(v=vs.85).aspx
  • Same Issue - http://www.911cd.net/forums/lofiversion/index.php/t15353.html
  • Similar Issue - http://www.msfn.org/board/topic/104891-how-can-i-install-a-inf-file-from-the-command-line/


来源:https://stackoverflow.com/questions/19359696/programmatic-driver-install-via-inf-causing-reboot

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!