The rapid development of Internet network has opened up a wider world for the efficient communication of software. such as the domestic famous golden Spider software Download Center, is a typical release software distribution. The publishing and sharing software mainly includes two kinds of forms: date limit form and electronic registration form. The date limit form allows users downloading software to use the software for a period of time, such as one months, if the user approved the software, you can buy the software registered serial number to continue to use; The electronic registration form is based on the user's hardware information generated registration code, and in the software to some advanced or commonly used functions to limit, If the user wants to use all of its functions, the software must collect the relevant hardware information to the developer, and pay a certain registration fee to obtain the software in their own machine registration code, in order to normal use.
The former form is easy to create an opportunity for pirates, if the maker buys a registered serial number and publishes it to the world, all users can use the registration number for normal use; the latter is slightly more complicated for the user to register, but also needs some programming skills for developers, but it has "eight-point locking" function, the anti-theft nature is indisputable. Based on its own practice, this article introduces the implementation process of the latter to the readers who want to make the publishing and sharing software.
First, the registered source
In the Win98/95 protection mode, according to the hardware information to form the registration code is not an easy thing, in real mode can be through the hard disk port 1f6h and 1f7h directly read the serial number of the hard disk as a registered data source, but this method in the protection mode has been flashed a red card. Use the motherboard serial number, BIOS version serial number, or host date and logo in the BIOS to be the registered source of the registration code. such as Rombios in the F000h-ffffh area in the presence of hardware configuration information, you can also collect other one or several motherboards and other information as a production base for the registration code. For example, the application's registration code can be generated according to the host factory date and host flag value stored in the F000H:FFF5H-F000H:FFFFH. Because of the rapid replacement of computer products, and all users of the computer can not be configured exactly the same, so the source of the registration code will not be exactly the same. And these hardware information content is identical under any operating system, the compatibility is very good, will not cause the registration function invalidation because of the operating system's renewal.
After the registration source is identified, the key question is how the shareware installer collects the registered source information and lets the user return it to the developer. The simplest method is to collect the registered source information after the bit operation encryption and storage into a text, the formation of registration code data source information. This registration source data string can be slightly longer, but not too long, so that users can be through e-mail, telephone or letter smoothly to the developer appropriate. If the author of the installation program is in C language, if the above memory address as a registered source, data string text file name is Keyid.doc, length is 20 characters. The sample code is as follows:
FILE *fp2;
unsigned int keyrom[9];
unsigned char buff[0x410];
unsigned char pathstmp[80];
unsigned char path[80]={"C:\\WBCOOL"};
unsigned int far *pt=(unsigned int far*)0xf000fff6L;
......
outportb(0x21,0x2);
strcpy(pathstmp,path);
strcat(pathstmp,"\\");
strcat(pathstmp,"KEYID.DOC");
for(i=0;i<5;i++)
keyrom[i]=(*(pt+i)+0x1818)^0x5858;//第一级加密算法
sprintf(buff,"KEYID:%04x%04x%04x%04x%04x",
keyrom[0],keyrom[1],keyrom[2],keyrom[3],keyrom[4]);
buff[0x1a]=0;
if((fp2=fopen(pathstmp,"wb"))==NULL)
{
printf("FILE %s CREATE ERROR!",pathtmp);
} else {
fseek(fp2,0L,SEEK_SET);
fprintf(fp2,"%s\xd\xa",buff);
fclose(fp2);
}
outportb(0x21,0x0);