Windows USB Tutorial

Windows USB Tutorial

本文关键字:Tutorial USB Windows      更新时间:2023-10-16

我一直在尝试遵循微软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:usershpdocumentsvisual studio 2013ProjectsUSB Application1x64Win7DebugUSBApplication1.exe
2>------ Build started: Project: USB Application1 Package, Configuration: Win7 Debug x64 ------
2>  Stamping x64Win7DebugUSBApplication1.inf [Version] section with DriverVer=03/22/2014,13.49.5.125
2>C:Program Files (x86)Windows Kits8.1buildWindowsDriver.common.targets(1300,5): warning : The driver package project c:Usershpdocumentsvisual studio 2013ProjectsUSB Application1USB Application1 PackageUSB Application1 Package.vcxproj doesn't have any references to other projects and no projects were packaged.
2>C:Program Files (x86)Windows Kits8.1buildWindowsDriver.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:usershpdocumentsvisual studio 2013ProjectsUSB Application1x64Win7DebugUSB Application1 Packageusbapplication1.cat
2>  Done Adding Additional Store
2>  Successfully signed: c:usershpdocumentsvisual studio 2013ProjectsUSB Application1x64Win7DebugUSB Application1 Packageusbapplication1.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, USBVID_04E8&PID_685E
; ========== Class definition ===========
[ClassInstall32]
AddReg = ClassInstall_AddReg
[ClassInstall_AddReg]
HKR,,,,%ClassName%
HKR,,NoInstallClass,,1
HKR,,IconPath,%REG_MULTI_SZ%,"%systemroot%system32setupapi.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:windowsinfsetupapi.dev,我认为有问题的部分是

     dvi:                     CoInstaller 1: Enter 20:25:55.535
     inf:                          Opened PNF: 'C:WindowsINFoem75.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:WindowsSystem32DriverStoreFileRepositoryusbapplication1.inf_amd64_neutral_bebc4e93bfc6a60ausbapplication1.inf
     sig:                Catalog  = C:WindowsSystem32DriverStoreFileRepositoryusbapplication1.inf_amd64_neutral_bebc4e93bfc6a60aUSBApplication1.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.

我在win8.1 WDK的WinUSB示例应用程序中遇到了同样的问题。他们的示例INF似乎缺少以下部分:

[USB_Install.Wdf]
KmdfService=WINUSB, WinUsb_Install
[WinUsb_Install]
KmdfLibraryVersion=1.11