During software registration, the hard disk number is usually used (the hash hard disk number is recommended) as the Local Computer pattern, and other information such as the user name and company name is used. Algorithm To obtain the software serial number. The benefits of doing so are obvious. It can prevent multiple users with a serial number of N. Currently, some software is a registration code published on the Internet and is used by people all over the world. But there are also corresponding defects. The customer can only use the software you write on one computer. The following method uses Windows API to obtain the hard disk number.
Using System. runtime. interopservices;
[Dllimport ( " Kernel32.dll " )]
Private Static Extern Int Getvolumeinformation (
String Lprootpathname,
String Lpvolumenamebuffer,
Int Nvolumenamesize,
Ref Int Lpvolumeserialnumber,
Int Lpmaximumcomponentlength,
Int Lpfilesystemflags,
String Lpfilesystemnamebuffer,
Int Nfilesystemnamesize
);
Private String Getvolof ( String Drvid) ... {
Const Int Max_filename_len = 256 ;
Int Retval = 0 ;
Int A = 0 ;
Int B = 0 ;
String Str1 = Null ;
String Str2 = Null ;
Int I = Getvolumeinformation (
Drvid + @" : " ,
Str1,
Max_filename_len,
Ref Retval,
A,
B,
Str2,
Max_filename_len
);
Return Retval. tostring ( " X " );
}
Call method: for example, drive C: getvolof ("C");
However, no matter how subtle your registration algorithm is, it will always be cracked. Because your algorithms are always on the software client, cracker always has the opportunity to find your registration algorithm and make a registration machine. Look at the various types of registration machines circulating on the Internet. I personally think thatProgramIt is best to write the Registration Algorithm in the Web service so that the cracker cannot crack the registration algorithm from the local machine, which greatly increases the security.