Why IntelPin tool build gets linker error when using wincrypt functions?

39 Views Asked by At

I am using:

  • Intel pin 3.27
  • Visual Studio 2022 to compile tool
  • OS Windows 10

wincrypt is defined like this:

namespace WINDOWS {
#include <windows.h>
#include <Wincrypt.h>
#include <iomanip>
#include <LM.h>
#include <shellapi.h>
}

When using wincrypt.h i can access data types WINDOWS::HCRYPTKEY hKey works completely fine. But when trying to call a function WINDOWS::CryptGetProvParam(...) or any other function i get these errors during the build:

Severity    Code    Description Project File    Line    Suppression State   Details
Error   LNK2019 unresolved external symbol __imp__CryptGetProvParam@20 referenced in function "void __cdecl argument_logger::CertOpenStore_args(class std::basic_string<char,class std::char_traits<char>,class std::allocator<char> >,class std::basic_string<char,class std::char_traits<char>,class std::allocator<char> >,class std::basic_string<char,class std::char_traits<char>,class std::allocator<char> >,char const *,unsigned long,unsigned long,unsigned long,void *,void *)" (?CertOpenStore_args@argument_logger@@YAXV?$basic_string@DV?$char_traits@D@std@@V?$allocator@D@2@@std@@00PBDKKKPAX2@Z)  MyPinTool   D:\pin\source\tools\MyPinTool\argument_logger.obj   1       
Severity    Code    Description Project File    Line    Suppression State   Details
Error   LNK1120 1 unresolved externals  MyPinTool   D:\pin\source\tools\MyPinTool\Release\MyPinTool.dll 1       

Build works only when trying to build in Debug x64 but fails for x86 and for any Release configuration. I need tool to be built in Release and both x64 and x86.

I tried using #pragma and linking against Advapi32.lib directly but those didn't help.

0

There are 0 best solutions below