Questions about VMProtect Demo

Issues related to VMProtect
ytttt
Posts: 5
Joined: Wed Apr 22, 2020 1:34 pm

Questions about VMProtect Demo

Postby ytttt » Wed Apr 22, 2020 2:10 pm

I try to protect a c++ executable by default setting but the vmprotect_con (same as vmprotect_gui) only outputs a smaller vmp executable, which being segmentation fault finally. Is there some steps I missing ?

Image

Admin
Site Admin
Posts: 1876
Joined: Mon Aug 21, 2006 8:19 pm
Location: Russia, E-burg
Contact:

Re: Questions about VMProtect Demo

Postby Admin » Wed Apr 22, 2020 2:27 pm

Could you send us a test example (original binary + VMP files) that shows this problem?

ytttt
Posts: 5
Joined: Wed Apr 22, 2020 1:34 pm

Re: Questions about VMProtect Demo

Postby ytttt » Thu Apr 23, 2020 2:11 am

Admin wrote:Could you send us a test example (original binary + VMP files) that shows this problem?


Of course. I run the test example and VMProtect on Ubuntu 18.04 x64. Attachments (https://github.com/goodmorning-coder/vmprotect-example) include the test example, its vmp format and some shared libraries the test example depends on. If You like you can run the test example by './test -help'.

On Ubuntu 18.04, the shared libraries follow the soft links by

Code: Select all

libLTO.so.8 => /usr/local/llvm8r/lib/libLTO.so.8
libOptRemarks.so.8 => /usr/local/llvm8r/lib/libOptRemarks.so.8
libedit.so.0 => /lib/x86_64-linux-gnu/libedit.so.0

Please let me know what else you need to locate this issue. Thank you.

Admin
Site Admin
Posts: 1876
Joined: Mon Aug 21, 2006 8:19 pm
Location: Russia, E-burg
Contact:

Re: Questions about VMProtect Demo

Postby Admin » Thu Apr 23, 2020 6:58 am

You have to switch off the option "Pack the Output File", because libstdc++.so calls some exported functions in your application while initialization.

ytttt
Posts: 5
Joined: Wed Apr 22, 2020 1:34 pm

Re: Questions about VMProtect Demo

Postby ytttt » Fri Apr 24, 2020 10:19 am

Admin wrote:You have to switch off the option "Pack the Output File", because libstdc++.so calls some exported functions in your application while initialization.


I have switched off that option in GUI version of VMProtect and got the executable vmp format successfully. Thank you for the solution but I still stuck in later steps. I try to follow the steps in "Stage 2: Real mode" from the document (http://vmpsoft.com/support/user-manual/licensing-system/integrating-to-application/) and protect the main function in the test example. After pasting the generated serial number to serial.txt in the same folder of test_vmp, the test_vmp still failed to recognize the serial number (Warning that "This code requires valid serial number to run", which is the same behavior as I run test_vmp without serial.txt). Was there something accidentally confused ?

Admin
Site Admin
Posts: 1876
Joined: Mon Aug 21, 2006 8:19 pm
Location: Russia, E-burg
Contact:

Re: Questions about VMProtect Demo

Postby Admin » Fri Apr 24, 2020 10:58 am

and protect the main function in the test example. After pasting the generated serial number to serial.txt

It seems you forgot to call VMProtectSetSerialNumber(serial) before calling a locked function:
http://vmpsoft.com/support/user-manual/ ... al-number/

ytttt
Posts: 5
Joined: Wed Apr 22, 2020 1:34 pm

Re: Questions about VMProtect Demo

Postby ytttt » Mon Apr 27, 2020 12:49 pm

Admin wrote:
and protect the main function in the test example. After pasting the generated serial number to serial.txt

It seems you forgot to call VMProtectSetSerialNumber(serial) before calling a locked function:
http://vmpsoft.com/support/user-manual/ ... al-number/


Oh I see ... by adding this function to the the main() function, the program now works well. I think VMProtect is powerful but still have two little questions about it:

1. Does VMProtect (assume in demo version) locks the main() function to a serial number by default if there are more than one functions in the protected application? I try to lock the main() function itself to the serial number in VMProtect GUI but the program is terminated by the serial number requisition.

2. Does every function I want to lock to the serial number need to invoke VMProtectSetSerialNumber() (assume in the normal version of VMProtect)? I hope the answer is no so I can easily lock them only in VMProtect GUI.

Admin
Site Admin
Posts: 1876
Joined: Mon Aug 21, 2006 8:19 pm
Location: Russia, E-burg
Contact:

Re: Questions about VMProtect Demo

Postby Admin » Mon Apr 27, 2020 7:01 pm

What part of our user manual is still not clear for you?

ytttt
Posts: 5
Joined: Wed Apr 22, 2020 1:34 pm

Re: Questions about VMProtect Demo

Postby ytttt » Tue Apr 28, 2020 1:43 am

Admin wrote:What part of our user manual is still not clear for you?


I'm not sure if I understood the contents in http://vmpsoft.com/support/user-manual/licensing-system/integrating-to-application/step-2-5-locking-the-code-to-a-serial-number/ correctly, so I hope my questions can be confirmed. By the way, is it possible to link VMProtectSDK statically instead of dynamically?

Admin
Site Admin
Posts: 1876
Joined: Mon Aug 21, 2006 8:19 pm
Location: Russia, E-burg
Contact:

Re: Questions about VMProtect Demo

Postby Admin » Tue Apr 28, 2020 5:32 am

Before calling a locked function you have to use our licensing system inside your application something like this:

Code: Select all

#include "VMProtectSDK.h"

int main()
{
  char *serial = read_serial("serial.txt");
  int status = VMProtectSetSerialNumber(serial);
  if (status != SERIAL_STATE_SUCCESS) {
    printf("Serial number error: %d", status);
    return 1;
  }
 
  return main_locked_by_serial();
}

int main_locked_by_serial()
{
  // your main code here
  ...
}


By the way, is it possible to link VMProtectSDK statically instead of dynamically?

For what? Just check dependences of a protected application.