Step #7: Limit period of free updates
How does it work?
While protecting application VMProtect stores current date – a date of build. You may put a maximal build date to the serial number. The licensing module will compate both dates and will not accept key with maximal build date that is less than date of application build. This allows to limit period of free updates. Customer should use older version or purchase a new serial number.
Let’s try it
Put the following line to INI-file:
MaxBuildDate=20000101
Date format is YYYYMMDD. In test mode date of build is always current date, so you have to use some date from the
past for MaxBuildDate parameter. Now change main() function, so it will look like below:
int main(int argc, char **argv)
{
char *serial = "Xserialnumber";
int res = VMProtectSetSerialNumber(serial);
print_state(res);
if (res)
{
VMProtectSerialNumberData sd = {0};
VMProtectGetSerialNumberData(&sd, sizeof(sd));
printf("max. build date: y = %d, m = %d, d = %d\n", sd.dtMaxBuild.wYear, sd.dtMaxBuild.bMonth, sd.dtMaxBuild.bDay);
printf("please register!\n");
return 0;
}
printf("I'm registered\n");
return 0;
}
After running application you will see the following:
state = SERIAL_STATE_FLAG_MAX_BUILD_EXPIRED max. build date: y = 2000, m = 1, d = 1 please register!
If you will change date in INI-file to some date from the future, you should see the following after running application:
state = 0 I'm registered
Do not forget ro remove MaxBuildDate=… line from INI-file before we’ll continue.