1. 程式人生 > >檢視Windows系統安裝和解除安裝驅動的日誌資訊

檢視Windows系統安裝和解除安裝驅動的日誌資訊

最近在用InstallShield2010開發一個一鍵打包驅動的專案,需要支援安裝和解除安裝。除錯時需要知道驅動安裝和解除安裝功能是否正確執行,可以系統盤的Windows的inf目錄中檢視這兩個檔案的資訊setupapi.dev.log 檔案(安裝)

安裝驅動:C:\\Windows\\inf\\setupapi.dev.log 檔案
[Device Install Log]
     OS Version = 6.1.7601
     Service Pack = 1.0
     Suite = 0x0100
     ProductType = 1
     Architecture = x86

[BeginLog]

>>>  [SetupCopyOEMInf - C:\windows\System32\DriverStore\FileRepository\qcwwan.inf_x86_neutral_8496094248b35e28\qcwwan.inf]
>>>  Section start 2018/10/22 17:08:54.056
      cmd: "C:\Program Files\Quectel\LTE Windows USB Driver\DriverInstaller\install(32).exe" -uninstall
     inf: Opened PNF: 'C:\windows\System32\DriverStore\FileRepository\qcwwan.inf_x86_neutral_8496094248b35e28\qcwwan.inf' ([strings])
     inf: Installing catalog qcwwan.cat as: oem76.CAT
<<<  Section end 2018/10/22 17:08:54.179
<<<  [Exit status: SUCCESS]


解除安裝驅動:C:\\Windows\\inf\\setupapi.app.log 檔案

[Device Install Log]
     OS Version = 6.1.7601
     Service Pack = 1.0
     Suite = 0x0100
     ProductType = 1
     Architecture = x86

[BeginLog]

>>>  [SetupUninstallOEMInf - oem76.inf]
>>>  Section start 2018/10/22 17:13:47.016
      cmd: "C:\Program Files\Quectel\LTE Windows USB Driver\DriverInstaller\install(32).exe" -uninstall
     sto: {Delete Driver Package: C:\windows\System32\DriverStore\FileRepository\qcwwan.inf_x86_neutral_8496094248b35e28\qcwwan.inf} 17:13:47.092
     sto:      Deleting driver package from Driver Store:
     sto:           Driver Store   = C:\windows\System32\DriverStore (Online | 6.1.7601)
     sto:           Driver Package = C:\windows\System32\DriverStore\FileRepository\qcwwan.inf_x86_neutral_8496094248b35e28\qcwwan.inf
     sto:           Flags          = 0x00000000
     pol:      {Driver package policy check} 17:13:47.301
     pol:      {Driver package policy check - exit(0x00000000)} 17:13:47.303
     sto:      {Unstage Driver Package: C:\windows\System32\DriverStore\FileRepository\qcwwan.inf_x86_neutral_8496094248b35e28\qcwwan.inf} 17:13:47.305
     sto:           Published driver package INF 'oem76.inf' was deleted.
     sto:           {Delete Directory: C:\windows\System32\DriverStore\FileRepository\qcwwan.inf_x86_neutral_8496094248b35e28} 17:13:47.616
     sto:                {Delete Directory: C:\windows\System32\DriverStore\FileRepository\qcwwan.inf_x86_neutral_8496094248b35e28\ndis} 17:13:47.619
     sto:                     {Delete Directory: C:\windows\System32\DriverStore\FileRepository\qcwwan.inf_x86_neutral_8496094248b35e28\ndis\6.2} 17:13:47.630
     sto:                          {Delete Directory: C:\windows\System32\DriverStore\FileRepository\qcwwan.inf_x86_neutral_8496094248b35e28\ndis\6.2\i386} 17:13:47.633
     sto:                          {Delete Directory: exit(0x00000000)} 17:13:47.668
     sto:                     {Delete Directory: exit(0x00000000)} 17:13:47.674
     sto:                {Delete Directory: exit(0x00000000)} 17:13:47.680
     sto:           {Delete Directory: exit(0x00000000)} 17:13:47.692
     sto:      {Unstage Driver Package: exit(0x00000000)} 17:13:47.693
     sto:      Deleted driver package from Driver Store. Time = 593 ms
     sto: {Delete Driver Package: exit(0x00000000)} 17:13:47.698
<<<  Section end 2018/10/22 17:13:47.726
<<<  [Exit status: SUCCESS]

這個oem76.inf檔案是函式 SetupCopyOEMInf 執行驅動預安裝時生成的預安裝驅動資訊檔案,他們都為Windows的inf目錄中。