Win dynamometer registration code implementation method

zhaozj2021-02-17  53

The so-called dynamic registration code is that the software will be different when the software is running at different machines. The advantage of this practice is that it is impossible to register software on different machines with the same registration code. This improves software security confidentiality. This method has been widely used, and the implementation principle is introduced in the following to a program written by C Builder. WIN dynamic registration code implementation: Author: virus software is the so-called dynamic registration code registration code will be different in different machines running. The advantage of this practice is that it is impossible to register software on different machines with the same registration code. This improves software security confidentiality. This method has been widely used, and the implementation principle is introduced in the following to a program written by C Builder. Gets the CPU information for registration, the information of the CPU of different vendors will also be different, and only one reviscation ID is used, and all the information in the structure can be considered. Get the CPU information with the getSystemInfo function of WINAPI. The function will populate the system_info structure after running. The following structure: VOID GetSystemInfo (LPSYSTEM_INFO lpSystemInfo // address of system information structure); ParameterslpSystemInfoPoints to a SYSTEM_INFO structure to be filled in by this function.typedef struct _SYSTEM_INFO {// sinf union {DWORD dwOemId; struct {WORD wProcessorArchitecture; WORD wReserved ;};}; DWORD dwPageSize; LPVOID lpMinimumApplicationAddress; LPVOID lpMaximumApplicationAddress; DWORD dwActiveProcessorMask; DWORD dwNumberOfProcessors; DWORD dwProcessorType; DWORD dwAllocationGranularity; WORD wProcessorLevel; WORD wProcessorRevision; // we used} SYSTEM_INFO; will fill in random logic when formatting the hard disk The serial number of the hard disk, because it is the possibility of randomly filling the same serial number. Plus the CPU information and the final operation of the two values, so that different registration numbers can be achieved in different machines. Logical serial numbers obtained by the GetVolumeInformation WINAPI function, which prototype is as follows: BOOL GetVolumeInformation (LPCTSTR lpRootPathName, // address of root directory of the file system LPTSTR lpVolumeNameBuffer, // address of name of the volumeDWORD nVolumeNameSize, // length of lpVolumeNameBuffer LPDWORD lpVolumeSerialNumber , // address of volume serial numberLPDWORD lpMaximumComponentLength, // address of system's maximum filename length LPDWORD lpFileSystemFlags, // address of file system flagsLPTSTR lpFileSystemNameBuffer, // address of name of file systemDWORD nFileSystemNameSize // length of lpFileSystemNameBuffer); from our point of view Only the fourth parameter returns the logical hard disk serial number.

We use the main function into the DLL form to call this in the application, which is convenient, and improves security. The specific procedures are as follows: .h file private: // user declarationsdword (WinAPI * getCurrentHostSerianumber) (void); // declared function pointer .CPP file Hinstance Dllinst = loadLibrary ("getseria"); // Dynamic call DLL file IF (DLLINST) {GetCurrentHostSeriaNumber = (DWORD (WINAPI *) (void)) GetProcAddress (DLLinst, "GetCurrentHostSeriaNumber"); // get the function if DLL in (GetCurrentHostSeriaNumber) {DWORD RegNumber = GetCurrentHostSeriaNumber (); // registration code to execute and return if ( String (regNumber) == edit1-> text) // Compare ShowMessage ("Registration Code"); Else ShowMessage ("DLL");} else ShowMessage ("DLL");} else ShowMessage ( "GetSeria.dll not in the current directory"); .DLL file extern "C" __declspec (dllexport) DWORD WINAPI GetCurrentHostSeriaNumber (void); a standard C function invoke method declarations int WINAPI DllEntryPoint (HINSTANCE, unsigned long, void * ) {return 1;} DWORD WINAPI GetCurrentHostSeriaNumber (void) {SYSTEM_INFO info; DWORD SeriaNumber = NULL; DWORD Register = NULL; GetSystemInfo (& info); // call the function to fill SYSTEM_INFO structure GetVolumeInformation ( "C: //", NULL, NULL , & Serianumber, NULL, NULL, NULL, NULL); // Get C Disc Serizes Register = SeriNumber Info.wProcessorRevision; Register = Regist ER ^ 7609926; // After adding the most different or operational return registen;} This procedure is a simple DEMO, but a slightly processing can be used for the product software. Besides, the hard disk serial number is divided into two 1 logical disk serial number, 2 physical hard disk serial numbers. The latter is a hard disk factory fixed unique code. If you can get it directly through the in, OUT read and write ports, but you must write VXD to implement this. The idea and implementation methods have been given. Let's do it yourself.

转载请注明原文地址:https://www.9cbs.com/read-30735.html

New Post(0)