链接到 tdh.lib 时出错

Errors linking to tdh.lib

我正在尝试使用 Visual Studio 2019 构建的 Microsoft TDH 库中的函数。该项目正在使用 WindowsApplicationForDrivers10.0 平台工具集 和程序很简单:

#include <windows.h>
#include <tdh.h>
#pragma comment(lib, "tdh.lib")
int __cdecl wmain(_In_ int argc, _In_ wchar_t* argv[]) {
    ::TdhCloseDecodingHandle(nullptr);
    return 0;
}

构建程序时出现以下错误:

Build started...

1>------ Build started: Project: main, Configuration: Debug x64 ------

1>Building 'main' with toolset 'WindowsApplicationForDrivers10.0' and the 'Universal' target platform.

1>main.cpp

1>main.vcxproj -> C:\Play\wpp\cpp\x64\Debug\main.exe

1>ApiValidation : error : main.exe has unsupported API call to "tdh.dll!TdhCloseDecodingHandle"

1>C:\Program Files (x86)\Windows Kits\build\WindowsDriver.common.targets(1794,5): error MSB3721: The command ""C:\Program Files (x86)\Windows Kits\bin.0.19041.0\x64\ApiValidator.exe" -DriverPackagePath:C:\Play\wpp\cpp\ctrl..\x64\Debug\main.exe -SupportedApiXmlFiles:"C:\Program Files (x86)\Windows Kits\build\universalDDIs\x64\UniversalDDIs.xml" -ModuleWhiteListXmlFiles:"C:\Program Files (x86)\Windows Kits\build\universalDDIs\x64\ModuleWhiteList.xml" -ApiExtractorExePath:"C:\Program Files (x86)\Windows Kits\bin.0.19041.0\x64"" exited with code -1.

1>Done building project "main.vcxproj" -- FAILED.

========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

有谁知道问题是什么或如何防止 ApiValidator.exe 形成 运行 作为构建的一部分?

提前致谢,

-Uri

终于找到 Visual Studio 设置: