License data collection

Source: Internet
Author: User
I want to achieve the same purpose as some software we download from the Internet. For example, I can give him a license code. Based on this license code, you can try it for one month, after expiration, you can purchase a new license. But I don't know how those people implement it, or do they have some general rules?
____________________________________________________________________________________________
The license is a copyright statement. It has nothing to do with anti-piracy.
For more information, see GPL. What is the README file ________________________________________________________________________________________
Obtain a unique identifier, such as a MAC address, and generate an identifier for your system ID.
If the user gives you this user ID, you will give it a serial number based on this ID, and the application will check whether the serial number is correct.
Bytes ---------------------------------------------------------------------------------------------
A simple example

Set an INI file with IP address restrictions. The time limit will be set as needed by you. Then, use MD5 to encrypt the entire INI file and add the encrypted 32 characters (Signature) to the end of the file, when running the program, first determine whether the signature matches the license file.
Then, read other options into the memory and make regular judgments (such as the running time limit)
Bytes ----------------------------------------------------------------------------------------------------
Solution:
1. Expiration problem: requires the program to go to your server for time. Of course, such interaction may be disabled by the customer.
2. to prevent customers from reinstalling the system: Write a virtual machine and read the serial number of the motherboard. In this case, let alone reinstall the system. Even if the hard disk is changed, do not count on using this machine for more than 30 days. To achieve this, you must interact with your server and send the serial number and registration time of the other party to your server for storage. Each time the program starts, then read the time information from your server.
However, it seems that there is a legal dispute to read the serial number of the motherboard and send a message.
Bytes ------------------------------------------------------------------------------------------------------
Read the hard disk serial number. It is a good program for serial number encoding. I have done it with Pb before. Now I forget that you have gone to the Skynet to collect and encrypt the data. There is a ready-made example.
Bytes -----------------------------------------------------------------------------------------------------
Encryption locks provide software trial restrictions, and make your users feel that your software is a real software product.
Bytes -----------------------------------------------------------------------------------------------------
The completion of each software is the result of the painstaking efforts of programmers. Therefore, when pirated black hands reach out to the fruits of your work, how can it be pitiful and hateful! We had to pick up our weapons to defend ourselves against the fruits of our work. The following two small programs can prevent others from using their own software illegally. (Let's fight against piracy together !)

Program 1: It is placed at the beginning of the main program and used to check whether the "cjgl. dat" file exists. If it does not exist, it exits and the program cannot continue to be executed. Note that the file "cjgl. dat" cannot be in the same directory as the main program. In the win.com directory, select win.com because win.com must exist. The program section is as follows:

Path1 = fullpath ("win.com", 1)

& Check the directory where the file win.com is located

Len = Len (path1)-7

FIL = left (path1, Len) + "cjgl. dat ″

If! File (FIL)

& If the file cjgl. dat does not exist, raise a warning

MEs = MessageBox ("use software. Please contact the author! ", 64," important information ″)

Quit

Endif

Program 2: used for software registration. The program running result copies the "cjgl. dat" file on the floppy disk to the directory where win.com is located. The content of the cjgl. dat file is arbitrary. The procedure is as follows:

Set talk off

Path1 = fullpath ("win.com", 1)

Len = Len (path1)-7

FIL = left (path1, Len) + "cjgl. dat ″

If file (FIL)

& Determine whether cjgl. dat exists in the specified directory first

= MessageBox ("Student Achievement Management System registered! ", 64," prompt ") & If yes, it indicates you have registered

Else & if it does not exist, copy the program

Copy file cjgl. dat to & fil

= MessageBox ("registration completed! ", 64," prompt ″)

Endif

Quit

If the time limit and memory variable are added, the program can be tried for a limited time.
Bytes -----------------------------------------------------------------------------------------------------
There are many methods to use, such as writing a mark in the registry or using a special file, which is related to the hardware information of the machine and records the user's usage information, the user is not allowed to overwrite (if the user overwrite the previously generated file, it can be determined)
Bytes -------------------------------------------------------------------------------------------------------
Each start records a time date [0]... date [N].
Date [n + 1] AT n + 1 startup.
If (date [n + 1] <= date [N])
Exit (-1 );
If (date [n + 1]-date [0])> 30 days)
Exit (-2 );
Write date [n + 1] to record

The storage time can be in the registry or in system32/. keep it confidential. The program can generate a key value or file at the first run.
The above method has the best effect when the time is accurate to the second.
Bytes ------------------------------------------------------------------------------------------------------
Answer 3:
MS-help: // Ms. VSCC/ms. msdnvs.2052/cpguide/html/cpconlicensingcomponentscontrols.htm
Enable authorization for your Components

Apply the licenseproviderattribute to the class.
Call licensemanager. validate or licensemanager. isvalid In the constructor.
Call dispose for any granted license in the class terminator or before the Terminator is called.
The following example shows how to authorize a Windows form control.

[C #]
Using system;
Using system. componentmodel;
Using system. Windows. forms;
Public class mycontrol: Control {
Private license = NULL;
Public mycontrol (){
License = licensemanager. Validate (typeof (mycontrol), this );
}
Protected override void dispose (bool disposing ){
If (disposing ){
If (license! = NULL ){
License. Dispose ();
License = NULL;
}
}
Base. Dispose (disposing );
}
~ Mycontrol (){
Dispose ();
}
}
 
[Visual Basic]
Imports system

Imports system. componentmodel

Imports system. Web. UI

<Licenseprovider (GetType (licfilelicenseprovider)> public class mycontrol

Inherits Control

Private license as license

Public sub new ()

License = licensemanager. Validate (GetType (mycontrol), me)

End sub

Public overloads overrides sub dispose ()

If not (license is nothing) then

License. Dispose ()

License = nothing

End if

End sub

End Class

The following example shows how to authorize an ASP. NET Server Control.

[C #]
Using system;
Using system. componentmodel;
Using system. Web. UI;

Public class mycontrol: Control {
Private license = NULL;
Public mycontrol (){
License = licensemanager. Validate (typeof (mycontrol), this );
}
Public override void dispose (){
If (license! = NULL ){
License. Dispose ();
License = NULL;
}
Base. Dispose ();
}
}
 
[Visual Basic]
Imports system

Imports system. componentmodel

Imports system. Web. UI

<Licenseprovider (GetType (licfilelicenseprovider)> public class mycontrol

Inherits Control

Private license as license

Public sub new ()

License = licensemanager. Validate (GetType (mycontrol), me)

End sub

Public overrides sub dispose ()

If not (license is nothing) then

License. Dispose ()

License = nothing

End if

End sub

End Class

The example here uses the built-in license provider class licfilelicenseprovider, which uses a text license file and imitates COM (ActiveX) authorization. More complex authorization situations (for example, calling XML Web Services to limit the number of component instances) require a variety of license providers.

In building applications (generating applications)-> creating controls (creating controls)-> licensing controls (authorizing controls) in Windows Forms Quick Start, an authorization example is provided.

See
Development components

______________________________________________________________________________________________

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.