驅動安裝包製作:使用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.)


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章