未定义的引用“_imp__CryptUnprotectData@28”与Crypt32。*& & wincrypt。h包括

时间:2023-02-09 02:11:03

I have a problem with my one of my projects.
I use QtCreator with MinGW and Qt 5.4.0

我的一个项目有个问题。我使用QtCreator与MinGW和Qt 5.4.0。

When I try to compile, this simple line gets me some errors :

当我尝试编译时,这条简单的代码会给我带来一些错误:

CryptUnprotectData(data.password, NULL, NULL, NULL, NULL, (DWORD) 0, data.uncryptedPassword);

( with DATA_BLOB* data.password and DATA_BLOB* data.uncryptedPassword )

(与DATA_BLOB *数据。密码和DATA_BLOB *数据。uncryptedPassword)

Gets me :

让我:

undefined reference to `_imp__CryptUnprotectData@28'

As said on the title, I included the Crypt32.Lib file in my .pro :

正如标题所说,我包括了Crypt32。Lib文件在我的。pro:

QT       += core gui
QT       += sql

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

TARGET = ChromePass

LIBS += -L$$PWD/ -lCrypt32

TEMPLATE = app


SOURCES += main.cpp\
        mainwindow.cpp \
    chromehandler.cpp \
    passdata.cpp

HEADERS  += mainwindow.h \
    chromehandler.h \
    passdata.h

FORMS    += mainwindow.ui

And as instructed in the MSDN api, included wincrypt.h :

并且按照MSDN api的指示,包括wincrypt。h:

#include <windows.h>
#include <wincrypt.h>
#include <cstdlib>
#include <fstream>

The error being still there, I checked wincrypt.h to make sure CryptUnprotectData is defined, and it is :

错误还在那里,我检查了wincrypt。为了确保定义了CryptUnprotectData,它是:

  WINIMPM WINBOOL WINAPI CryptUnprotectData(DATA_BLOB *pDataIn,LPWSTR *ppszDataDescr,DATA_BLOB *pOptionalEntropy,PVOID pvReserved,CRYPTPROTECT_PROMPTSTRUCT *pPromptStruct,DWORD dwFlags,DATA_BLOB *pDataOut);

I've been trying for the whole day ... does anyone have a clue ?
Thank you very much !

我已经试了一整天了……有人知道吗?非常感谢!

1 个解决方案

#1


0  

The clue is that crypt32 library is not built with mingw this is why you are getting linking errors.

线索是crypt32库不是用mingw构建的,这就是为什么会出现链接错误。

Bad news is that there is no simple way to resolve that. You can read about some ways to resolve here:

坏消息是没有简单的方法来解决这个问题。你可以在这里读到一些解决方法:

MingW missing some functions from the Win32 Crypto API

MingW从Win32 Crypto API中漏掉了一些函数。

Discussion on Qt forum about this question can be found here:

关于这个问题的Qt论坛的讨论可以在这里找到:

https://forum.qt.io/topic/25527/cannot-find-how-to-link-to-crypt32-dll

https://forum.qt.io/topic/25527/cannot-find-how-to-link-to-crypt32-dll

#1


0  

The clue is that crypt32 library is not built with mingw this is why you are getting linking errors.

线索是crypt32库不是用mingw构建的,这就是为什么会出现链接错误。

Bad news is that there is no simple way to resolve that. You can read about some ways to resolve here:

坏消息是没有简单的方法来解决这个问题。你可以在这里读到一些解决方法:

MingW missing some functions from the Win32 Crypto API

MingW从Win32 Crypto API中漏掉了一些函数。

Discussion on Qt forum about this question can be found here:

关于这个问题的Qt论坛的讨论可以在这里找到:

https://forum.qt.io/topic/25527/cannot-find-how-to-link-to-crypt32-dll

https://forum.qt.io/topic/25527/cannot-find-how-to-link-to-crypt32-dll