【问题标题】:Windows USB TutorialWindows USB 教程
【发布时间】:2014-04-29 17:24:52
【问题描述】:

我一直在尝试遵循Microsoft MSDN 的 Windows USB 教程 我一直坚持到最后没有错误,这就是输出

1>------ Build started: Project: USB Application1, Configuration: Win7 Debug x64 ------
1>  device.cpp
1>  main.cpp
1>  Generating Code...
1>  USB Application1.vcxproj -> c:\users\hp\documents\visual studio 2013\Projects\USB Application1\x64\Win7Debug\USBApplication1.exe
2>------ Build started: Project: USB Application1 Package, Configuration: Win7 Debug x64 ------
2>  Stamping x64\Win7Debug\USBApplication1.inf [Version] section with DriverVer=03/22/2014,13.49.5.125
2>C:\Program Files (x86)\Windows Kits\8.1\build\WindowsDriver.common.targets(1300,5): warning : The driver package project c:\Users\hp\documents\visual studio 2013\Projects\USB Application1\USB Application1 Package\USB Application1 Package.vcxproj doesn't have any references to other projects and no projects were packaged.
2>C:\Program Files (x86)\Windows Kits\8.1\build\WindowsDriver.common.targets(1300,5): warning : 
2>  ........................
2>  Signability test complete.
2>  
2>  Errors:
2>  None
2>  
2>  Warnings:
2>  None
2>  
2>  Catalog generation complete.
2>  c:\users\hp\documents\visual studio 2013\Projects\USB Application1\x64\Win7Debug\USB Application1 Package\usbapplication1.cat
2>  Done Adding Additional Store
2>  Successfully signed: c:\users\hp\documents\visual studio 2013\Projects\USB Application1\x64\Win7Debug\USB Application1 Package\usbapplication1.cat
2>  
========== Build: 2 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========

当我尝试在设备管理器中手动更新 USB 驱动程序时,我不断得到

The required section was not found in the INF.

我尝试了两种设备,一个拇指驱动器和一部手机,但结果都相同(非)。请问有谁知道怎么回事?

这是 INF 文件之一

;
; USBApplication1.inf
;
; Installs WinUsb
;

[Version]
Signature = "$Windows NT$"
Class     = USBDevice
ClassGUID = {88BAE032-5A81-49f0-BC3D-A4FF138216D6}
Provider = %ManufacturerName%
CatalogFile=USBApplication1.cat
DriverVer=03/22/2014,13.49.5.125

; ========== Manufacturer/Models sections ===========

[Manufacturer]
%ManufacturerName% = Standard,NTamd64

[Standard.NTamd64]
%DeviceName% =USB_Install, USB\VID_04E8&PID_685E

; ========== Class definition ===========

[ClassInstall32]
AddReg = ClassInstall_AddReg

[ClassInstall_AddReg]
HKR,,,,%ClassName%
HKR,,NoInstallClass,,1
HKR,,IconPath,%REG_MULTI_SZ%,"%systemroot%\system32\setupapi.dll,-20"
HKR,,LowerLogoVersion,,5.2

; =================== Installation ===================

[USB_Install]
Include=winusb.inf
Needs=WINUSB.NT

[USB_Install.Services]
Include=winusb.inf
AddService=WinUsb,0x00000002,WinUsb_ServiceInstall

[WinUsb_ServiceInstall]
DisplayName     = %WinUsb_SvcDesc%
ServiceType     = 1
StartType       = 3
ErrorControl    = 1
ServiceBinary   = %12%\WinUSB.sys

[USB_Install.HW]
AddReg=Dev_AddReg

[Dev_AddReg]
; By default, USBDevice class uses iProduct descriptor to name the device in
; Device Manager on Windows 8 and higher.
; Uncomment for this device to use %DeviceName% on Windows 8 and higher:
;HKR,,FriendlyName,,%DeviceName%
HKR,,DeviceInterfaceGUIDs,0x10000,"{5aecf9ec-5a73-421b-841d-e9ab9b241a2b}"

[USB_Install.CoInstallers]
AddReg=CoInstallers_AddReg
CopyFiles=CoInstallers_CopyFiles

[CoInstallers_AddReg]
HKR,,CoInstallers32,0x00010000,"WdfCoInstaller01011.dll,WdfCoInstaller"

[CoInstallers_CopyFiles]
WdfCoInstaller01011.dll

[DestinationDirs]
CoInstallers_CopyFiles=11

; ================= Source Media Section =====================

[SourceDisksNames]
1 = %DiskName%

[SourceDisksFiles]
WdfCoInstaller01011.dll=1

; =================== Strings ===================

[Strings]
ManufacturerName=""
ClassName="Universal Serial Bus devices"
DiskName="USBApplication1 Installation Disk"
WinUsb_SvcDesc="WinUSB Driver"
DeviceName="USBApplication1 Device"
REG_MULTI_SZ = 0x00010000

好的,我找到了 c:\windows\inf\setupapi.dev,我认为有问题的部分是

     dvi:                     CoInstaller 1: Enter 20:25:55.535
     inf:                          Opened PNF: 'C:\Windows\INF\oem75.inf' ([strings])
!!!  dvi:                     CoInstaller 1: failed(0xe0000101)!
!!!  dvi:                     Error 0xe0000101: The required section was not found in the INF.
     dvi:                {DIF_INSTALLDEVICE - exit(0xe0000101)} 20:25:55.703
!!!  ndv:                Error(e0000101) installing device!
     ndv:                Device install status=0xe0000101
     ndv:                Performing device install final cleanup...
!    ndv:                Queueing up error report since device installation failed...
     ndv:           {Core Device Install - exit(0xe0000101)} 20:25:55.708
     dvi:           {DIF_DESTROYPRIVATEDATA} 20:25:55.709
     dvi:                CoInstaller 1: Enter 20:25:55.709
     dvi:                CoInstaller 1: Exit
     dvi:                Default installer: Enter 20:25:55.710
     dvi:                Default installer: Exit
     dvi:           {DIF_DESTROYPRIVATEDATA - exit(0xe000020e)} 20:25:55.711
     ump:           Server install process exited with code 0xe0000101 20:25:55.718
     ump:      {Plug and Play Service: Device Install exit(e0000101)}
     ndv: {Update Driver Software Wizard exit(e0000101)}
<<<  Section end 2014/03/22 20:26:31.825
<<<  [Exit status: FAILURE(0xe0000101)]

也有一些出现

     sig:                Key      = usbapplication1.inf
     sig:                FilePath = C:\Windows\System32\DriverStore\FileRepository\usbapplication1.inf_amd64_neutral_bebc4e93bfc6a60a\usbapplication1.inf
     sig:                Catalog  = C:\Windows\System32\DriverStore\FileRepository\usbapplication1.inf_amd64_neutral_bebc4e93bfc6a60a\USBApplication1.cat
!    sig:                Verifying file against specific Authenticode(tm) catalog failed! (0x800b0109).
!    sig:                Error 0x800b0109: A certificate chain processed, but terminated in a root certificate which is not trusted by the trust provider.

上面的各种文件

【问题讨论】:

  • 这个错误究竟是在哪里产生的?您能否检查 c:\WindowsSetupapi.log 是否存在并包含有关错误的更多信息?
  • 通过设备管理器手动更新驱动时出现错误。不,c:\Windows\Setupapi.log 不存在。
  • 查看 .log 文件是必不可少的。检查this thread 以获取提示。
  • 我找到了 C:\Windows\inf\setupapi.dev,当我将它复制到别处时,不知何故它变成了 setupapi.dev.log。我已经用我找到的信息更新了我的原始帖子。有什么建议可以从这里去吗?

标签: c++ windows-7 usb visual-studio-2013


【解决方案1】:

我在使用 Win 8.1 WDK 的 WinUSB 示例应用程序时遇到了同样的问题。他们的示例 INF 似乎缺少以下部分:

[USB_Install.Wdf]
KmdfService=WINUSB, WinUsb_Install

[WinUsb_Install]
KmdfLibraryVersion=1.11

将它添加到我的 INF 后,它就可以安装了。

【讨论】:

  • 谢谢以后试试看。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-07-01
  • 2012-11-24
  • 1970-01-01
  • 2011-02-24
  • 1970-01-01
相关资源
最近更新 更多