Windows 7 32 位中的 WDF UMDF 驱动程序安装问题
我有一个简单的用户模式 USB 驱动程序,可以在 Windows XP 32 位和 Windows 7 64 位中正常安装和工作,但由于某种原因无法在 Windows 7 32 位中正确安装。 XP 32 位和 win7 32 位需要 2 个单独的驱动程序吗?我的印象是我没有。 我使用的inf文件列在下面:
2011年6月10日更新,我按如下方式重新设计了inf文件,现在似乎可以在windows7中工作,但是在xp上,当我给它一个路径时,它会问我/x86在哪里,它在开头添加一个 \ ,然后我将其删除,它工作正常。我使用以下方法向 Windows 注册 .inf 文件:
SetupCopyOEMInf(infFullPath, "", OemSourceMediaType.SPOST_PATH, 0, oemName, 255, ref temp, null))
infFullPath 是程序文件下复制驱动程序包的位置。 谁能明白为什么这行不通 我将文件存储如下:
AbcRadio.inf
\x86\AbcRadio.dll
\x86\WudfUpdate_01009.dll
\x86\WdfCoInstaller01009.dll
\x86\WinUsbCoinstaller2.dll
\x64\AbcRadio.dll
\x64\WudfUpdate_01009.dll
\x64\WdfCoInstaller01009.dll
\x64\WinUsbCoinstaller2.dll
;
; AbcRadio.inf - Install the AbcRadio USB user-mode driver
;
[Version]
Signature="$Windows NT$"
Class=Radio
ClassGuid={78A1C341-4539-11d3-B88D-00C04FAD5171}
Provider=%MSFTUMDF%
DriverVer=06/09/2011,6.1.7600.16385
CatalogFile=wudf.cat
; ================== Class section ==================
[ClassInstall32]
AddReg=SampleClass_RegistryAdd
[SampleClass_RegistryAdd]
HKR,,,,%ClassName%
HKR,,Icon,,"-10"
; ========== Manufacturer/Models sections ===========
[Manufacturer]
%MSFTUMDF%=Abc,NTX86,NTAMD64
[Abc.NTX86]
%AbcRadioUsbDeviceName%=AbcRadioUsb_Install, USB\VID_16D4&PID_1002
%AbcRadioUsbDeviceName%=AbcRadioUsb_Install, USB\VID_16D4&PID_1004
[Abc.NTAMD64]
%AbcRadioUsbDeviceName%=AbcRadioUsb_Install, USB\VID_16D4&PID_1002
%AbcRadioUsbDeviceName%=AbcRadioUsb_Install, USB\VID_16D4&PID_1004
; =================== Installation ===================
[AbcRadioUsb_Install]
CopyFiles=UMDriverCopy
Include=WINUSB.INF ; Import installation sections from WINUSB.INF
Needs=WINUSB.NT ; Run the CopyFiles & AddReg directives for WinUsb.INF
[AbcRadioUsb_Install.Services]
AddService=WUDFRd,0x000001fa,WUDFRD_ServiceInstall ; flag 0x2 sets this as the service for the device
AddService=WinUsb,0x000001f8,WinUsb_ServiceInstall ; this service is installed because its a filter.
[WinUsb_ServiceInstall]
DisplayName = %WinUsb_SvcDesc%
ServiceType = 1
StartType = 3
ErrorControl = 1
ServiceBinary = %12%\WinUSB.sys
LoadOrderGroup = Base
[WUDFRD_ServiceInstall]
DisplayName = %WudfRdDisplayName%
ServiceType = 1
StartType = 3
ErrorControl = 1
ServiceBinary = %12%\WUDFRd.sys
LoadOrderGroup = Base
[AbcRadioUsb_Install.Wdf]
UmdfDispatcher = WinUsb
UmdfService = AbcRadio, WUDFAbcRadioUsbDriver_Install
UmdfServiceOrder = AbcRadio
KmdfService = WINUSB, WinUsb_Install
[WinUsb_Install]
KmdfLibraryVersion = 1.9
[AbcRadioUsb_Install.CoInstallers]
AddReg=CoInstallers_AddReg
CopyFiles=CoInstallers_CopyFiles
[AbcRadioUsb_Install.hw]
AddReg=AbcRadioUsb_Device_AddReg
[AbcRadioUsb_Device_AddReg]
HKR,,"LowerFilters",0x00010008,"WinUsb" ; FLG_ADDREG_TYPE_MULTI_SZ | FLG_ADDREG_APPEND
[CoInstallers_AddReg]
HKR,,CoInstallers32,0x00010000,"WudfUpdate_01009.dll", "WinUsbCoinstaller2.dll", "WdfCoInstaller01009.dll,WdfCoInstaller"
[WUDFAbcRadioUsbDriver_Install]
UmdfLibraryVersion=1.9.0
DriverCLSID="{7bf5cb94-b686-4721-955e-878e48933a2c}"
ServiceBinary=%12%\UMDF\AbcRadio.dll
[CoInstallers_CopyFiles]
WudfUpdate_01009.dll
WdfCoInstaller01009.dll
WinUsbCoinstaller2.dll
[UMDriverCopy]
AbcRadio.dll
[DestinationDirs]
UMDriverCopy=12,UMDF ; copy to drivers\umdf
CoInstallers_CopyFiles=11 ; copy to system32
; ================= Source Media Section =====================
[SourceDisksNames]
1 = %MediaDescription%,,,
[SourceDisksFiles.x86]
AbcRadio.dll=1,x86
WudfUpdate_01009.dll=1,x86
WdfCoInstaller01009.dll=1,x86
WinUsbCoinstaller2.dll=1,x86
[SourceDisksFiles.amd64]
AbcRadio.dll=1,x64
WudfUpdate_01009.dll=1,x64
WdfCoInstaller01009.dll=1,x64
WinUsbCoinstaller2.dll=1,x64
; =================== Generic ==================================
[Strings]
MSFTUMDF="Abc (WDF:UMDF)"
MediaDescription="Abc Media"
ClassName="Radio"
WudfRdDisplayName="Abc WDF:UMDF Radio"
AbcRadioUsbDeviceName="Abc Radio Alpha 6/10/2011 8:53 AM"
WinUsb_SvcDesc="WinUSB Driver"
I have a simple user mode usb driver that is installing and working fine in Windows XP 32 bit and Windows 7 64 bit, but for some reason fails to install correctly in Windows 7 32 bit. Do I need 2 separate drivers for XP 32bit and win7 32bit? I was under the impression that i did not.
The inf file i use is listed below:
Update 6/10/2011, I've reworked the inf file as follows, seems to work in windows7 now, but on xp it asks me where /x86 is, when I give it a path, it prepends a \ to the begining, then i delete it and it works fine. I register the .inf file with windows using:
SetupCopyOEMInf(infFullPath, "", OemSourceMediaType.SPOST_PATH, 0, oemName, 255, ref temp, null))
infFullPath is the location under program files where I copy the driver package.
Can anyone see why this wouldn't work
I store the files as follows:
AbcRadio.inf
\x86\AbcRadio.dll
\x86\WudfUpdate_01009.dll
\x86\WdfCoInstaller01009.dll
\x86\WinUsbCoinstaller2.dll
\x64\AbcRadio.dll
\x64\WudfUpdate_01009.dll
\x64\WdfCoInstaller01009.dll
\x64\WinUsbCoinstaller2.dll
;
; AbcRadio.inf - Install the AbcRadio USB user-mode driver
;
[Version]
Signature="$Windows NT$"
Class=Radio
ClassGuid={78A1C341-4539-11d3-B88D-00C04FAD5171}
Provider=%MSFTUMDF%
DriverVer=06/09/2011,6.1.7600.16385
CatalogFile=wudf.cat
; ================== Class section ==================
[ClassInstall32]
AddReg=SampleClass_RegistryAdd
[SampleClass_RegistryAdd]
HKR,,,,%ClassName%
HKR,,Icon,,"-10"
; ========== Manufacturer/Models sections ===========
[Manufacturer]
%MSFTUMDF%=Abc,NTX86,NTAMD64
[Abc.NTX86]
%AbcRadioUsbDeviceName%=AbcRadioUsb_Install, USB\VID_16D4&PID_1002
%AbcRadioUsbDeviceName%=AbcRadioUsb_Install, USB\VID_16D4&PID_1004
[Abc.NTAMD64]
%AbcRadioUsbDeviceName%=AbcRadioUsb_Install, USB\VID_16D4&PID_1002
%AbcRadioUsbDeviceName%=AbcRadioUsb_Install, USB\VID_16D4&PID_1004
; =================== Installation ===================
[AbcRadioUsb_Install]
CopyFiles=UMDriverCopy
Include=WINUSB.INF ; Import installation sections from WINUSB.INF
Needs=WINUSB.NT ; Run the CopyFiles & AddReg directives for WinUsb.INF
[AbcRadioUsb_Install.Services]
AddService=WUDFRd,0x000001fa,WUDFRD_ServiceInstall ; flag 0x2 sets this as the service for the device
AddService=WinUsb,0x000001f8,WinUsb_ServiceInstall ; this service is installed because its a filter.
[WinUsb_ServiceInstall]
DisplayName = %WinUsb_SvcDesc%
ServiceType = 1
StartType = 3
ErrorControl = 1
ServiceBinary = %12%\WinUSB.sys
LoadOrderGroup = Base
[WUDFRD_ServiceInstall]
DisplayName = %WudfRdDisplayName%
ServiceType = 1
StartType = 3
ErrorControl = 1
ServiceBinary = %12%\WUDFRd.sys
LoadOrderGroup = Base
[AbcRadioUsb_Install.Wdf]
UmdfDispatcher = WinUsb
UmdfService = AbcRadio, WUDFAbcRadioUsbDriver_Install
UmdfServiceOrder = AbcRadio
KmdfService = WINUSB, WinUsb_Install
[WinUsb_Install]
KmdfLibraryVersion = 1.9
[AbcRadioUsb_Install.CoInstallers]
AddReg=CoInstallers_AddReg
CopyFiles=CoInstallers_CopyFiles
[AbcRadioUsb_Install.hw]
AddReg=AbcRadioUsb_Device_AddReg
[AbcRadioUsb_Device_AddReg]
HKR,,"LowerFilters",0x00010008,"WinUsb" ; FLG_ADDREG_TYPE_MULTI_SZ | FLG_ADDREG_APPEND
[CoInstallers_AddReg]
HKR,,CoInstallers32,0x00010000,"WudfUpdate_01009.dll", "WinUsbCoinstaller2.dll", "WdfCoInstaller01009.dll,WdfCoInstaller"
[WUDFAbcRadioUsbDriver_Install]
UmdfLibraryVersion=1.9.0
DriverCLSID="{7bf5cb94-b686-4721-955e-878e48933a2c}"
ServiceBinary=%12%\UMDF\AbcRadio.dll
[CoInstallers_CopyFiles]
WudfUpdate_01009.dll
WdfCoInstaller01009.dll
WinUsbCoinstaller2.dll
[UMDriverCopy]
AbcRadio.dll
[DestinationDirs]
UMDriverCopy=12,UMDF ; copy to drivers\umdf
CoInstallers_CopyFiles=11 ; copy to system32
; ================= Source Media Section =====================
[SourceDisksNames]
1 = %MediaDescription%,,,
[SourceDisksFiles.x86]
AbcRadio.dll=1,x86
WudfUpdate_01009.dll=1,x86
WdfCoInstaller01009.dll=1,x86
WinUsbCoinstaller2.dll=1,x86
[SourceDisksFiles.amd64]
AbcRadio.dll=1,x64
WudfUpdate_01009.dll=1,x64
WdfCoInstaller01009.dll=1,x64
WinUsbCoinstaller2.dll=1,x64
; =================== Generic ==================================
[Strings]
MSFTUMDF="Abc (WDF:UMDF)"
MediaDescription="Abc Media"
ClassName="Radio"
WudfRdDisplayName="Abc WDF:UMDF Radio"
AbcRadioUsbDeviceName="Abc Radio Alpha 6/10/2011 8:53 AM"
WinUsb_SvcDesc="WinUSB Driver"
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
发现我没有完全阅读SetupCopyOEMInf() 的文档。我的安装程序中的以下行解决了最后一个问题:
SetupCopyOEMInf(infFullPath, installPath, OemSourceMediaType.SPOST_PATH, 0, oemName, 255, ref temp, null)
如果您不指定 OEMSourceMediaLocation 参数,Windows 7 似乎会猜测您的源磁盘是 inf 文件所在的位置。 Windows XP 不执行此操作,因此如果您希望 Windows 知道在哪里查找驱动程序,则需要填充它。
Figured out that I didnt read the documentation for SetupCopyOEMInf() fully. The following line in my installer solved the final problem:
SetupCopyOEMInf(infFullPath, installPath, OemSourceMediaType.SPOST_PATH, 0, oemName, 255, ref temp, null)
It seems that windows 7 guesses that your source disk is the location where the inf file is, if you dont specify the OEMSourceMediaLocation parameter. Windows XP does not do this, so it needs to be populated if you want Windows to know where to look for your driver.