1

I have a problem with my one of my projects.
I use QtCreator with MinGW and 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 )

Gets me :

undefined reference to `_imp__CryptUnprotectData@28'

As said on the title, I included the Crypt32.Lib file in my .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 :

#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 :

  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 !

Community
  • 1
  • 1
Olbaid
  • 17
  • 6

1 Answers1

0

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

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

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

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

Community
  • 1
  • 1
demonplus
  • 5,613
  • 12
  • 49
  • 68