我正在尝试从 Microsoft Windows 驱动程序示例中编译 XPSDrv 驱动程序和过滤器示例。
https://github.com/microsoft/Windows-driver-samples/tree/master/print/XPSDrvSmpl
我一步一步地按照说明进行操作。
解决方案构建失败:
Warning The driver package project C:\Users\ihebb\source\repos\Windows-driver-samples-master\print\XPSDrvSmpl\Driver Package\Driver Package.vcxproj doesn't have any references to other projects and no projects were packaged.
Driver Package C:\Program Files (x86)\Windows Kits\10\build\WindowsDriver.common.targets 1710
Warning 1324 [Version] section should specify PnpLockdown=1. package (Package\package) C:\Users\ihebb\source\repos\Windows-driver-samples-master\print\XPSDrvSmpl\install\xdsmpl.inf 19
Warning 2083 Section [printerpackageinstallation.x86] not referenced or used. package (Package\package) C:\Users\ihebb\source\repos\Windows-driver-samples-master\print\XPSDrvSmpl\install\xdsmpl.inf 70
Warning 2083 Section [printerpackageinstallation.ia64] not referenced or used. package (Package\package) C:\Users\ihebb\source\repos\Windows-driver-samples-master\print\XPSDrvSmpl\install\xdsmpl.inf 78
Warning 2083 Section [printerpackageinstallation.arm64] not referenced or used. package (Package\package) C:\Users\ihebb\source\repos\Windows-driver-samples-master\print\XPSDrvSmpl\install\xdsmpl.inf 82
Warning 2083 Section [printerpackageinstallation.amd64] not referenced or used. package (Package\package) C:\Users\ihebb\source\repos\Windows-driver-samples-master\print\XPSDrvSmpl\install\xdsmpl.inf 74
Error 1297 (NTarm64.6.0) Device driver does not install on any devices, use primitive driver if this is intended. package (Package\package) C:\Users\ihebb\source\repos\Windows-driver-samples-master\print\XPSDrvSmpl\install\xdsmpl.inf 1
我提到了这两个问题。但答案在我的情况下不起作用。
设备驱动程序未安装在任何设备上,如果在 Visual Studio 2019 中用于 hello world 驱动程序,请使用原始驱动程序?
创建驱动程序时出错。设备驱动程序未安装在任何设备上,如果提供,请使用原始驱动程序
解决方案建议删除 INF 文件或制造商部分。我正在尝试为虚拟打印机设置驱动程序(不能是原始驱动程序),因此必须生成安全证书(必须存在 INF)并且证书必须有制造商。
xdsmpl.inf:
;
; Copyright (c) 2005 Microsoft Corporation
;
; All rights reserved.
;
; THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
; ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
; THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
; PARTICULAR PURPOSE.
;
; File Name:
;
; xdsmpl.inf
;
; Abstract:
;
; XPSDrv sample driver install file
;
[Version]
Signature="$Windows NT$"
Provider=%ProviderString%
ClassGUID={4D36E979-E325-11CE-BFC1-08002BE10318}
Class=Printer
DriverVer=10/17/2008,6.1.6930.0
CatalogFile=XpsDrvSmpl.cat
[Manufacturer]
%ManufacturerName%=Standard,NTx86,NTia64,NTamd64,NTx86.6.0,NTia64.6.0,NTamd64.6.0,NTarm64.6.0
[Standard.NTx86]
"XPSDrv Sample Driver" = INSTALL_XDSMPL_FILTERS_PRE_VISTA
[Standard.NTia64]
"XPSDrv Sample Driver" = INSTALL_XDSMPL_FILTERS_PRE_VISTA
[Standard.NTamd64]
"XPSDrv Sample Driver" = INSTALL_XDSMPL_FILTERS_PRE_VISTA
[Standard.NTx86.6.0]
"XPSDrv Sample Driver" = INSTALL_XDSMPL_FILTERS_VISTA
[Standard.NTia64.6.0]
"XPSDrv Sample Driver" = INSTALL_XDSMPL_FILTERS_VISTA
[Standard.NTamd64.6.0]
"XPSDrv Sample Driver" = INSTALL_XDSMPL_FILTERS_VISTA
[Standard.NTarm64.6.0]
"XPSDrv Sample Driver" = INSTALL_XDSMPL_FILTERS_VISTA
[INSTALL_XDSMPL_FILTERS_PRE_VISTA]
CopyFiles=XPSDrvSample,ConfigPlugin,COLORPROFILES
DriverFile=mxdwdrv.dll
PrintProcessor="MS_XPS,filterpipelineprintproc.dll"
ConfigFile=UniDrvUI.dll
HelpFile=UniDrv.HLP
DataFile=XDSmpl.GPD
Include=NTPRINT.INF, MSXPSDRV.INF
Needs=UNIDRV.OEM, XPSGPD.OEM, XPSDRV.OEM
[INSTALL_XDSMPL_FILTERS_VISTA]
CopyFiles=XPSDrvSample,ConfigPlugin,COLORPROFILES
DriverFile=mxdwdrv.dll
ConfigFile=UniDrvUI.dll
HelpFile=UniDrv.HLP
DataFile=XDSmpl.GPD
ICMProfiles=xdwscRGB.icc
CoreDriverSections="{D20EA372-DD35-4950-9ED8-A6335AFE79F0},UNIDRV.OEM", "{D20EA372-DD35-4950-9ED8-A6335AFE79F5},XPSDRV.OEM,XPSGPD.OEM"
[PrinterPackageInstallation.x86]
PackageAware=TRUE
CoreDriverDependencies={D20EA372-DD35-4950-9ED8-A6335AFE79F0}, {D20EA372-DD35-4950-9ED8-A6335AFE79F5}
[PrinterPackageInstallation.amd64]
PackageAware=TRUE
CoreDriverDependencies={D20EA372-DD35-4950-9ED8-A6335AFE79F0}, {D20EA372-DD35-4950-9ED8-A6335AFE79F5}
[PrinterPackageInstallation.ia64]
PackageAware=TRUE
CoreDriverDependencies={D20EA372-DD35-4950-9ED8-A6335AFE79F0}, {D20EA372-DD35-4950-9ED8-A6335AFE79F5}
[PrinterPackageInstallation.arm64]
PackageAware=TRUE
CoreDriverDependencies={D20EA372-DD35-4950-9ED8-A6335AFE79F0}, {D20EA372-DD35-4950-9ED8-A6335AFE79F5}
[DestinationDirs]
DefaultDestDir=66000
COLORPROFILES=66003
[COLORPROFILES]
xdwscRGB.icc
xdCMYKPrinter.icc
[ConfigPlugin]
XDSmpl.ini
XDSmplUI.dll
[XPSDrvSample]
xdsmpl.gpd
xdnames.gpd
xdwmark.gpd
xdbook.gpd
xdcolman.gpd
xdnup.gpd
xdpgscl.gpd
xdwmark.dll
xdcolman.dll
xdbook.dll
xdnup.dll
xdscale.dll
xdsmpl-pipelineconfig.xml
[SourceDisksNames.x86]
1 = %Location%,,
2 = %Location%,,,x86
[SourceDisksNames.ia64]
1 = %Location%,,
2 = %Location%,,,ia64
[SourceDisksNames.amd64]
1 = %Location%,,
2 = %Location%,,,amd64
[SourceDisksNames.arm64]
1 = %Location%,,
2 = %Location%,,,arm64
[SourceDisksFiles]
xdsmpl.gpd = 1
xdnames.gpd = 1
xdwmark.gpd = 1
xdbook.gpd = 1
xdcolman.gpd = 1
xdnup.gpd = 1
xdpgscl.gpd = 1
xdsmpl-pipelineconfig.xml = 1
xdsmpl.ini = 1
xdwscRGB.icc = 1
xdCMYKPrinter.icc = 1
xdwmark.dll = 1
xdcolman.dll = 1
xdbook.dll = 1
xdnup.dll = 1
xdsmplui.dll = 1
xdscale.dll = 1
[Strings]
Location="XPSDrv Sample Driver Location"
ManufacturerName="VirtualPrinterABC"
ProviderString = "VirtualPrinterABC"
输出:
Build started...
1>------ Build started: Project: Driver Package, Configuration: Debug Win32 ------
1>Building 'Driver Package' with toolset 'WindowsKernelModeDriver10.0' and the 'Desktop' target platform.
1>C:\Program Files (x86)\Windows Kits\10\build\WindowsDriver.common.targets(1710,5): warning : The driver package project C:\Users\ihebb\source\repos\Windows-driver-samples-master\print\XPSDrvSmpl\Driver Package\Driver Package.vcxproj doesn't have any references to other projects and no projects were packaged.
1>C:\Program Files (x86)\Windows Kits\10\build\WindowsDriver.common.targets(1710,5): warning :
1>Inf2Cat task was skipped as there were no inf files to process
1>Done building project "Driver Package.vcxproj".
2>------ Build started: Project: package (Package\package), Configuration: Debug Win32 ------
2>Building 'package' with toolset 'WindowsKernelModeDriver10.0' and the 'Desktop' target platform.
2>Stamping Debug\xdsmpl.inf
2>Stamping [Version] section with DriverVer=11/06/2021,2.57.51.890
2>C:\Users\ihebb\source\repos\Windows-driver-samples-master\print\XPSDrvSmpl\install\xdsmpl.inf : error 1297: (NTarm64.6.0) Device driver does not install on any devices, use primitive driver if this is intended.
2>C:\Users\ihebb\source\repos\Windows-driver-samples-master\print\XPSDrvSmpl\install\xdsmpl.inf(19-19): warning 1324: [Version] section should specify PnpLockdown=1.
2>C:\Users\ihebb\source\repos\Windows-driver-samples-master\print\XPSDrvSmpl\install\xdsmpl.inf(70-70): warning 2083: Section [printerpackageinstallation.x86] not referenced or used.
2>C:\Users\ihebb\source\repos\Windows-driver-samples-master\print\XPSDrvSmpl\install\xdsmpl.inf(74-74): warning 2083: Section [printerpackageinstallation.amd64] not referenced or used.
2>C:\Users\ihebb\source\repos\Windows-driver-samples-master\print\XPSDrvSmpl\install\xdsmpl.inf(78-78): warning 2083: Section [printerpackageinstallation.ia64] not referenced or used.
2>C:\Users\ihebb\source\repos\Windows-driver-samples-master\print\XPSDrvSmpl\install\xdsmpl.inf(82-82): warning 2083: Section [printerpackageinstallation.arm64] not referenced or used.
2>Done building project "package.VcxProj" -- FAILED.
========== Build: 1 succeeded, 1 failed, 10 up-to-date, 0 skipped ==========
========== Deploy: 0 succeeded, 0 failed, 0 skipped ==========