Step 1.4: Retrieving the name and the e-mail of a user
Let’s start with simple things. We want to get the name and the e-mail of a user from a serial number to show them in the About window (or anywhere else). To do this, we have to add two more lines to our ini-file:
[TestLicense] AcceptedSerialNumber=Xserialnumber UserName=John Doe EMail=john@doe.com
And in the program, if the registration is successful, we obtain these data and output them 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 %ls specifiers instead of %s. The program should print the following text on the screen:
state = 0 We are registered. name = John Doe, e-mail = john@doe.com