驱动安装包制作:使用SetupCopyOEMInf函数 用installshield 即可完成安装

http://blog.csdn.net/emma_he/article/details/5858781 


http://cysbox7.blog.163.com/blog/static/11587863320105975159520/

 

引用不知道哪位大牛的原话:

对于即插即用简单地说要对付2种情况 
1。在你的设备未安装前,安装驱动程序这叫预先安装。 
最简单的方法就是使用SetupCopyOEMInf函数。 
具体做法是: 
将SetupCopyOEMInf封装在一个动态库里。 
用installshield将所有文件copy到一个临时目录。 
调用动态库使用SetupCopyOEMInf函数copy临时目录下的inf文件(路径)。 
installshield让计算机重启。 
插上设备,自动识别。 
 2.你的设备已安装,弹出安装向导。 
很简单,让用户搜索你的安装盘,即可完成安装。
 
懒得写dll了(其实是不会写- -),devcon dp_add调用SetupCopyOEMInf做了预安装




wdk文档中关于预安装的一段话
我刚开始以为预安装就是直接把驱动安上,白痴似的把驱动直接安上了,然后我机子上面之前的驱动没卸干净,添上设备后直接能用,偶就把安装程序当成一个版本交了,囧。。。

 

Preinstalling Driver Packages

To preinstall driver files, your device installation application should follow these steps:

1. On the target system, create a directory for the driver files. If your device installation application installs an application, the driver files should be stored in a subdirectory of the application directory.

2. Copy all files in the driver package from the distribution media to the directory created in step (1). The driver package includes the driver or drivers, the INF file, the catalog file, and other installation files.

3. Call  SetupCopyOEMInf specifying the INF file in the directory created in step (1). Specify SPOST_PATH for the OEMSourceMediaType parameter and specify NULL for the OEMSourceMediaLocation parameter.SetupCopyOEMInf copies the INF file for the driver package into the %windir%/Inf directory on the target system and directs Windows to store the source location of the INF file in its list of preprocessed INF files. SetupCopyOEMInf also processes the catalog file, so the PnP manager will install the driver the next time it recognizes a device listed in the INF file.

When the user plugs in the device, the PnP manager recognizes the device, finds the INF file copied bySetupCopyOEMInf, and installs the drivers copied in step (2). (For more information about copying INF files, see Copying INFs.)


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
DPInst.exe: installs and uninstalls driver packages. DPInst.exe: 安装及删除驱动程序包。 By default, the tools searches the current directory and tries to install all driver packages found. 默认情况下,此工具会搜索当前目录并尝试安装找到的驱动程序包。 Usage: DPInst.exe [/U INF-file][/S | /Q][/LM][/P][/F][/SH][/SA][/A][/PATH Path][/EL][/L LanguageID][/C][/D][/LogTitle Title][/SW][/? | /h | /help] 用法:DPInst.exe [/U INF-file][/S | /Q][/LM][/P][/F][/SH][/SA][/A][/PATH Path][/EL][/L LanguageID][/C][/D][/LogTitle Title][/SW][/? | /h | /help] /U path to INF file Uninstall a driver package (INF-file). /U 指定 INF 文件 删除一个驱动程序包(INF-文件)。 /S | /Q Silent (Quiet) mode. Suppresses the Device Installation Wizard and any dialogs popped-up by the operating system. /LM Legacy mode. Accepts unsigned driver packages and packages with missing files. These packages won't install on the latest version of Windows. /LM 传统模式。接受未签名的驱动包(缺少.cat文件)以及包中有文件丢失。 /P Prompt if the driver package to be installed is not better than the current one. /P 如果驱动包已经安装以及比当前使用的版本要旧就发出提示。 /F Force install inf the driver package is not better than the current one. /F 强制安装比当前使用的版本要旧的驱动包。 /SH Scans hardware for matching devices and only copies and installs those drivers for which a device is present. Only valid for Plug and Play drivers. /SH 仅仅对已插入的匹配的硬件设备进行扫描。 /SA Suppress the Add/Remove Programs entry normally created for each driver package. /SA 禁止“添加或删除程序”创建卸载项。 /A Install all or none. /PATH Path Search for driver packages under the given path. /PATH 路径 在指定的路径下搜索驱动程序包。 /EL Enables all languages not explicitly listed in the XML file. /L LanguageID Tries to use the given language in all UI. Useful for localization tests. /SE Suppress the EULA. /SE 禁止最终用户许可协议。 /C Dump logging output to attached Console (Windows XP and above). /C 转存日志文件输出到附加控

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值