Get Demo
  • Windows
  • MacOS
  • Linux

Step 1.4: Retrieving the name and the e-mail of a user

Let’s start with simple things. We want to retrieve the name and e-mail of a user from a serial number to display them in the About window (or elsewhere). To do this, we need to add two more lines to our INI file:

[TestLicense]
AcceptedSerialNumber=Xserialnumber
UserName=John Doe
EMail=john@doe.com

And in the program, if registration is successful, we retrieve this data and output it to the screen:

VMProtectSerialNumberData sd = {0};
VMProtectGetSerialNumberData(&sd, sizeof(sd));
printf("name = %ls,\ne-mail = %ls\n", sd.wUserName, sd.wEMail);

The structure contains UNICODE data, so printf() uses the %ls specifier instead of %s. The program should print the following text to the screen:

state = 0
We are registered.
name = John Doe,
e-mail = john@doe.com
Last updated 11 days ago