The first step is to create an application. This is a simple app without any user interface and with no real functionality. Our goal is to pass a serial number to the licensing system and receive its response.
#include <windows.h>
#include <stdio.h>
bool is_registered(const char *serial)
{
return serial && serial[0] == 'X';
}
int main(int argc, char **argv)
{
char *serial = "Xserialnumber"; // we set the serial number directly in the code for simplicity
if (!is_registered(serial))
{
printf("please register!\n");
return 0;
}
printf("We are registered.\n");
return 0;
}
The program uses a very simple method to check the serial number. The is_registered() function compares the first character of the serial number with ‘X’ and considers the number valid if they match. For an incorrect serial number, a registration message is displayed, while if a user enters the correct key, “We are registered.” is shown instead.