阅读:21225回复:4
x64安装驱动提示“该操作需要交互式窗口工作站”
我的环境:
Win 7 x64 (Intel i7处理器) Visual Studio 2010 (ver.10.0.30319.1 RMRel) WDK 7600.16385.1 VisualAssistX 10.6.1819.0 build 2010.04.06 Visual DDK 1.5(将WDK集成进VS的工具,允许使用IDE进行驱动开发,充分发挥VS与VAX的上下文搜索功能) 目标项目: 所安装的驱动是一个无硬件设备的范例,源自电子工业出版社《Windows设备驱动程序WDF开发》第二章的CharSample例程。另有一个与之配套的用户模式可执行程序,这里不做任何操作。 驱动程序功能很简单,如果在命令行运行上述的配套程序,会看到字符提示“请输入数字(0-9)”。然后在键盘上输入0~9间的任何一个数字,程序便会返回一个对应的汉字,比如敲“4”,返回“四”。接着程序就执行结束了。范例项目源码在附件中,若有兴趣可下载研究。 调试过程: 我调整了项目的设置,并将原先不支持x64系统的INF文件修改成了兼容的格式,其实只是允许x64系统访问同一个sys文件而已。安装过程INF工作正常,*.sys文件被成功复制到了C:\Windows\System32\Drivers\目录下,相应注册表项也被添加,CoInstaller貌似也工作正常。但是遇到如下错误: 描述:错误提示 图片:Installation.jpg 我怀疑是sys文件所用代码不能直接移植到x64平台,于是用书中原来的WinXP x86 chk版范例sys文件复制过来取代了自己编译的Win 7 x64版文件,仍然搭配我修改的INF文件进行安装,但仍然出现这个报错。 用上述最后一种组合,在XP虚拟机(x86)中安装一切正常。设备可以成功出现在设备管理器中。 不知有没有高手以前见过类似情况。我想请教这个是INF文件的问题还是sys文件的问题?这种功能单一的驱动似乎与平台相关性不大,会不会是我的INF错或漏引用了一些x64平台的支持文件? 两个inf文件对比如下: 原书中的范例: [Version] Signature="$WINDOWS NT$" Class=WDFBOOK ClassGuid={EF1941A7-645B-4668-B05B-287D30169435} Provider=%ProviderName% DriverVer=01/08/2009,6.0.6001.18000 ; ================= Class section ===================== [ClassInstall32] Addreg=SampleClassReg [SampleClassReg] HKR,,,0,%DeviceClassName% HKR,,Icon,,-19 ;***************************************** ; CharSample Install Section ;***************************************** [Manufacturer] %MfgName%=Standard,NTx86 ; Following section is meant for Windows 2000 as it ; cannot parse decorated model sections [Standard] ; ; Hw Id is root\CharSample ; %CharSample.DeviceDesc%=CharSample_Device, root\CharSample ; Decorated model section take precedence over undecorated ; ones on XP and later. [Standard.NTx86] %CharSample.DeviceDesc%=CharSample_Device, root\CharSample [DestinationDirs] CharSample_Files_Driver = 12 [CharSample_Device.NT] CopyFiles=CharSample_Files_Driver [CharSample_Files_Driver] CharSample.sys ;-------------- Service installation [CharSample_Device.NT.Services] AddService = CharSample,0x00000002, CharSample_AddService ; -------------- CharSample driver install sections [CharSample_AddService] DisplayName = %CharSample.SVCDESC% ServiceType = 1 ; SERVICE_KERNEL_DRIVER StartType = 3 ; SERVICE_DEMAND_START ErrorControl = 1 ; SERVICE_ERROR_NORMAL ServiceBinary = %12%\CharSample.sys ; ;--- WDF Coinstaller installation ---- ; [DestinationDirs] CoInstaller_CopyFiles = 11 [CharSample_Device.NT.CoInstallers] CopyFiles=CoInstaller_CopyFiles AddReg=CoInstaller_AddReg [CoInstaller_CopyFiles] wdfcoinstaller01007.dll [CoInstaller_AddReg] HKR,,CoInstallers32,0x00010000, "wdfcoinstaller01007.dll,WdfCoInstaller" [CharSample_Device.NT.Wdf] KmdfService = CharSample, CharSample_wdfsect [CharSample_wdfsect] KmdfLibraryVersion = 1.7 [Strings] ProviderName="Windows最新WDF设备驱动程序开发" MfgName="武安河" DeviceClassName="WDF范例" CharSample.DeviceDesc = "CharSample" CharSample.SVCDESC = "WDF CharSample Service" 我修改的文件(不同之处用红色高亮): [Version] Signature="$WINDOWS NT$" Class=WDFBOOK ClassGuid={EF1941A7-645B-4668-B05B-287D30169435} Provider=%ProviderName% DriverVer=02/04/2011,6.1.7600.16385 ; ================= Class section ===================== ; This section, named as 32 though, also works with x64 platforms [ClassInstall32] Addreg=SampleClassReg ; By using reg-root "HKR", keys behind are relative to the key defined by "Addreg=". ; In this case wher Addreg=SampleClassReg, "HKR,,Icon,,-19" means "SampleClassReg,,Icon,,-19" [SampleClassReg] HKR,,,0,%DeviceClassName% HKR,,Icon,,-19 ;***************************************** ; CharSample Install Section ;***************************************** [Manufacturer] %MfgName%=Standard,NTx86,NTAMD64 ; Following section is meant for Windows 2000 as it ; cannot parse decorated model sections [Standard] ; ; Hw Id is root\CharSample ; %CharSample.DeviceDesc%=CharSample_Device, root\CharSample ; Decorated model section take precedence over undecorated ; ones on XP and later. ;----------------------------------------- ; x86-based systems: [Standard.NTx86] %CharSample.DeviceDesc%=CharSample_Device, root\CharSample ; DirID = 12 means the destination directory is in C:\Windows\System32\Drivers\ [DestinationDirs] CharSample_Files_Driver = 12 [CharSample_Device.NT] CopyFiles=CharSample_Files_Driver [CharSample_Files_Driver] CharSample.sys ;----------------------------------------- ; x64-based systems [Standard.NTAMD64] %CharSample.DeviceDesc%=CharSample_Device, root\CharSample [CharSample_Device.NTAMD64] CopyFiles=CharSample_Files_Driver ;========================================= ; Service installation ;----------------------------------------- ; x86-based systems [CharSample_Device.NT.Services] AddService = CharSample,0x00000002, CharSample_AddService ;----------------------------------------- ; x64-based systems [CharSample_Device.NTAMD64.Services] AddService = CharSample,0x00000002, CharSample_AddService ;========================================= ; CharSample driver install sections ;----------------------------------------- ; Common [CharSample_AddService] DisplayName = %CharSample.SVCDESC% ServiceType = 1 ; SERVICE_KERNEL_DRIVER StartType = 3 ; SERVICE_DEMAND_START ErrorControl = 1 ; SERVICE_ERROR_NORMAL ServiceBinary = %12%\CharSample.sys ;========================================= ; WDF Coinstaller installation ;----------------------------------------- ; x86-based systems [DestinationDirs] CoInstaller_CopyFiles = 11 [CharSample_Device.NT.CoInstallers] CopyFiles=CoInstaller_CopyFiles AddReg=CoInstaller_AddReg [CoInstaller_CopyFiles] wdfcoinstaller01007.dll [CoInstaller_AddReg] HKR,,CoInstallers32,0x00010000, "wdfcoinstaller01007.dll,WdfCoInstaller" [CharSample_Device.NT.Wdf] KmdfService = CharSample, CharSample_wdfsect [CharSample_wdfsect] KmdfLibraryVersion = 1.7 ;----------------------------------------- ; x64-based systems [CharSample_Device.NTAMD64.CoInstallers] CopyFiles=CoInstaller_CopyFiles AddReg=CoInstaller_AddReg [CharSample_Device.NTAMD64.Wdf] KmdfService = CharSample, CharSample_wdfsect ;========================================= ; Strings section [Strings] ProviderName="Windows最新WDF设备驱动程序开发" MfgName="武安河" DeviceClassName="WDF范例" CharSample.DeviceDesc = "CharSample" CharSample.SVCDESC = "WDF CharSample Service" 还望高手指点一二,小弟在此谢过。 |
|
|
沙发#
发布于:2011-02-04 16:48
帮顶,会不会是CUI和GUI的问题啊?我是外行,随便猜的
|
|
板凳#
发布于:2011-02-05 01:14
呃,内核的东西应该和GUI没什么关系,“窗口工作站”(window station)是允许Windows系统不同窗体之间进行通讯的内核安全对象。怀疑是不是x64和x86在这几个函数上的实现机制也不一样。
|
|
|
地板#
发布于:2011-02-21 10:15
应该是配置问题
|
|
地下室#
发布于:2011-08-03 12:07
|
|