開發 驅動程式 遇到的困難

一.無法安裝驅動程式

 1.用 Devcon 安裝驅動時,顯示怪怪的

C:\Windows\system32>"C:\Program Files (x86)\Windows Kits\10\Tools\x64\devcon" install D:\Code\VS_Project\C\KMDFHelloWorld\Release\KMDFHelloWorld\KMDFHelloWorld.inf Root\KMDFHelloWorld
Device node created. Install is complete when drivers are installed...
Updating drivers for Root\KMDFHelloWorld from D:\Code\VS_Project\C\KMDFHelloWorld\Release\KMDFHelloWorld\KMDFHelloWorld.inf.
devcon failed.

 

2.然後用 DriverView 檢查有沒有被載入到記憶體,結果沒有

以上是根據微軟2018年的官方文檔做的 : https://docs.microsoft.com/en-us/windows-hardware/drivers/gettingstarted/writing-a-very-small-kmdf--driver#feedback

上面寫說 devcon install <inf file> 後要接 hardware id , 而 hardware id 在 inf 檔 有寫 , 可是不管在 2019年以後 或 2019年以前 inf 檔 都沒有清楚的標明 hardware id 在哪 (2019年以前 跟 2019年以後 inf 檔 的格式不一樣) 。 所以我就依樣畫葫蘆的填 Root\KMDFHelloWorld。

後續:已經可以安裝驅動程式,只要在專案存放 .sys 檔 的目錄中對 .inf 檔 右鍵->安裝 就可以了。只不過我是在執行 >bcdedit /set loadoptions DDISABLE_INTEGRITY_CHECKS & bcdedit /set testsigning on 後安裝的。而且安裝完後並沒有被載入到記憶體中。


二. 昨天編譯好的檔案今天重新編譯一次就不行了。

把 專案 -> 屬性 -> Inf2Cat 中的 Run Inf2Cat 改成否就可以了


三. 把 專案 -> 屬性 -> Driver Install -> Deployment 的Target Device Name 全砍掉重新建置一次,發現用右鍵 .inf 檔 -> 安裝 會彈出錯誤 : The hash for the file is not present in the specified catalog file. The file is likely corrupt or  the victim of tampering. 
是 把 Run Inf2Cat 改成否 導致的錯誤。
 
四. 再次用右鍵安裝驅動程式,彈出錯誤 : A problem was encountered while attemping add the driver to the store.
然後想要把先前在 C:\Windows\System32\DriverStore\FileRepository的檔案刪掉 ,卻彈出訊息 : You'll need the permission to perform this action. 按確定之後 又彈出 : You require permission from SYSTEM to make this change.



留言

這個網誌中的熱門文章

C++ DirectX Draw Triangle