问题
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