Qt integration help

Post here any topics that related to Enigma Protector, its functionality, your misunderstanding, offers to improvements etc etc etc
Post Reply
catalin00
Posts: 12
Joined: Sat Nov 11, 2017 10:12 am

Qt integration help

Post by catalin00 » Mon Jan 29, 2018 8:29 pm

Hello, I am trying to use Enigma in a C++ Qt project. I am not very experienced in c++, and I get some weird errors which I don't know exactly how to deal with. I hoped you could help me figure it out. I am sure I am missing something, but I just can't find any info on the internet. Here is what I did:
  • I copied these three files into my project folder: enigma_ide.dll, enigma_ide.h and enigma_ide.lib.
  • I added these two lines in the header of my class:

    Code: Select all

    #include "enigma_ide.h"
    #pragma link "include/enigma_ide.lib"
    
  • Added these lines of code in my program:

    Code: Select all

    LPCTSTR s = EP_RegHardwareIDA();
    char* hwid = const_cast<char*>(s);
    QMessageBox msgbox;
    msgbox.setText(hwid);
    msgbox.exec();
    
This is the error I get: undefined reference to `_imp__EP_RegHardwareIDA@0'
I also get this warning: warning: ignoring #pragma link [-Wunknown-pragmas] #pragma link "include/enigma_ide.lib" ^

I have no clue what could be the cause, but I really need help to fix it as soon as possible. I've been googling for hours trying to figure it out. This is all I could find: https://forum.qt.io/topic/36175/ignoring-pragma

If I understand it correctly, I would have to compile my program with the same compiler enigma_ide was compiled. However, this doesn't sound very good to me. First of all, from what I know, that ide is actually only a set of empty methods, as the real enigma API will be inserted when the project gets protected, isn't that right? Then what should I do now to be able to compile and run my project?

Please help me, I'm just trying to get used to c++, coming from the comfort of C# NET. Everything is so confusing to me! :?
Thank you in advance for any help!

catalin00
Posts: 12
Joined: Sat Nov 11, 2017 10:12 am

Re: Qt integration help

Post by catalin00 » Tue Jan 30, 2018 7:44 pm

So, does anyone know how to fix my issue? I am pretty sure I am doing something wrong, as I don't think such errors should show up. However, I would really appreciate if anyone could point my mistake. Thanks in advance!

Enigma
Site Admin
Posts: 2388
Joined: Wed Aug 20, 2008 2:24 pm

Re: Qt integration help

Post by Enigma » Wed Jan 31, 2018 8:32 am

Hi, maybe you could send us this small project at support@enigmaprotector.com, so we can test it locally?

nightfly64
Posts: 3
Joined: Thu Mar 02, 2017 3:15 pm

Re: Qt integration help

Post by nightfly64 » Wed Jan 31, 2018 8:45 am

catalin00 wrote:

Code: Select all

#include "enigma_ide.h"
#pragma link "include/enigma_ide.lib"
I also get this warning: warning: ignoring #pragma link [-Wunknown-pragmas] #pragma link "include/enigma_ide.lib" ^
Your toolchain doesn't support that pragma, if you use Microsoft Visual Studio you could use the following:
#pragma comment(lib, "enigma_ide.lib")

If you use another compiler check its documentation, in any case the best way is to specify the enigma library as a linker option. In any case remember to add enigma library directory to linker search path.

Enigma
Site Admin
Posts: 2388
Joined: Wed Aug 20, 2008 2:24 pm

Re: Qt integration help

Post by Enigma » Wed Jan 31, 2018 8:52 am

Hi nightfly64, thank you for the comment!

As an another workaround (not recommended really) the dynamic loading of Enigma API functions can be used (through LoadLibrary-GetProcAddress).

But as correctly said, static linking is preferred.

catalin00
Posts: 12
Joined: Sat Nov 11, 2017 10:12 am

Re: Qt integration help

Post by catalin00 » Wed Jan 31, 2018 10:38 am

Thank you for the reply. I use Qt Creator and MinGW 5.3.0 32bit. I am not experienced with Qt and C++. I am kind of a noob. :| I would appreciate some specific instructions, as I am not familiarized with the terminology. Here is my project: https://we.tl/nhmwtRSUHk I can't upload it here as it is bigger than 500KB. It is basically a registration dialog. I am trying to use a separate program for registration, and the main program will be protected with the same enigma project, but with the option "Encrypt application with Encryption Constant", to prevent it from running unless registered. This registration dialog will also have a custom online activation feature I am working on, but that's not important right now. What I am trying right now is to get the hardware ID in a message box when I click the Offline Activation button.

Enigma
Site Admin
Posts: 2388
Joined: Wed Aug 20, 2008 2:24 pm

Re: Qt integration help

Post by Enigma » Wed Jan 31, 2018 1:53 pm

Btw, why not to use the C#? This is rather simpler than C++ for your needs.

catalin00
Posts: 12
Joined: Sat Nov 11, 2017 10:12 am

Re: Qt integration help

Post by catalin00 » Wed Jan 31, 2018 2:21 pm

Enigma wrote:Btw, why not to use the C#? This is rather simpler than C++ for your needs.
Yeah, it's true, but I have to start using c++ and familiarize with it, as c# is not a really good choice for Enigma protected programs. Fortunately, I've found the problem. It seems I had to right-click the project, and click Add Library instead of using #pragma. I also had to switch from MinGW to MSVC as I couldn't get it working with MinGW. Thank you very much for your time and for trying to help!

Enigma
Site Admin
Posts: 2388
Joined: Wed Aug 20, 2008 2:24 pm

Re: Qt integration help

Post by Enigma » Wed Jan 31, 2018 2:33 pm

catalin00 wrote:It seems I had to right-click the project, and click Add Library instead of using #pragma. I also had to switch from MinGW to MSVC as I couldn't get it working with MinGW.
Thank you for the useful note, I hope your experience will be very helpful for others!
catalin00 wrote:Yeah, it's true, but I have to start using c++ and familiarize with it, as c# is not a really good choice for Enigma protected programs.
I could agree, but since you need this small app to show a registration/activation dialog only, you do not need any protection to it. In this case, the usual envelope protection for .net would be enough. OK, that's your choice in any case.

Post Reply