Questions about VMProtect Demo

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 ?

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 (GitHub - goodmorning-coder/vmprotect-example · GitHub) 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

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.

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 ?

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:

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.

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

I’m not sure if I understood the contents in VMProtect Software » VMProtect » Docs correctly, so I hope my questions can be confirmed. By the way, is it possible to link VMProtectSDK statically instead of dynamically?

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

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