AV-SOFT.COM
AVLock SIMPLE
Introduction
What is AVLock Gold?
How to buy AVLock Gold?
How to Upgrade from previous versions?
What's new in version 5
Another AVlock components
License Agreement
Using AVLock Gold
How to install AVLock Gold?
How works AVLockGold?
Brief practice with demo's
Step by step samples
Basic sample
Working with modules
Creating your own registration form
Running on a network
"MoveReg" feature
Some configuration issues
Hacking cautions
How to translate AVLock Gold to any language?
Properties
Methods
Events
Useful concepts
Registration keys
KeyFiles
RegFiles and ControlFiles
RegistryKeys
MasterComputers and RegularComputers
Utilities
AVLockManager
RegMonitor
Configure
KeyGen
Php key generators
FAQs

Methods

Top  Previous  Next

icon2METHODS

 

CalcUserID  CalcUserID(Uname:string):dword;

 

Calculate a number (equivalent to the InstallCode value) in basis to the user name value passed as parameter. This number is used in the UserName based Lock strategy.

 

Check procedure Check;

 

Read the registration data. If the status is expired then come up the registration form and terminates the program.

 

Checkkey function Checkkey(m,v, rkey:string):boolean;

 

This method return true if the given RegKey rkey is ok and the module coincide with the given m value and the version coincide with the given v value. If you want don't check these values then set 9999 to m and 0 to v.

 

 

Decode function decode(m,v,a:word;ic,rkey:string;var dat,day,users,modul,ver,kind:word;var icode:string):integer;

 

This method decrypt the RegKey passed in the "rkey" parameter and return its internal values into several output parameters, then compare this fields with the given ones in the input parameters then return a error code if anyone does not match.

 

Input parameters:

 

rkey is the RegKey and the m,v,a and ic values are given to compare it with the existing ones into the RegKey.

 

rkey : the registration key.

m : input module.          Set this value to 9999 if you don't want to check the module. 

v : input version value.  Set this value to 0 if you don't want to check the version.

a : input application id.  Set this value to 0 if you don't want to check the AppID.

ic : input install code.    Set this value as a void string '' if you don't want to check the InstallCode.

 

output parameters:

 

These values are extracted from the registration key RegKey.passed into the "rkey" parameter.

 

dat : date from where start the autohorized period

day : days of the authorized period

users : max simultaneous users allowed

modul : module number (0..255)

ver : application version

kind : kind of the lock strategy 1=InstallCode based, 2=UserName based

icode : InstallCode

 

returned value:

 

This function cheks the values passed as parameters and retun the following integer values:

 

0 : No error. All checked values matches.

1: Key length mismath

2: Instal code mismatch

3: Validation error

4: AppID mismatch

5: Version mismatch

6: Module mismatch

 

DecodeIcode function decodeicode(icode:string; var cpu, bios, hd:byte):string;

 

This function decodes the InstallCode given in the icode parameter in extended format (13 digits) and return values of the machine from which it comes, into the cpu, bios and hd parameters:

 

DecodeMods procedure DecodeMods(var ModsMemo:Tmemo);

 

This procedure read values for all modules from the avconfig.ini file and the registration data in the local registry or RegFile then dump this information into the TMemo parameter. This procedure is used to fill the 'Modules' area in the registration form. For more details see the Demo3 sample.

 

DoExecute function DoExecute: boolean;

 

This method show the built-in registration form. You can call it to invoque the registration form in any location of your application. The Execute method call it to show the registration form. This function return true if the user press the Continue button or successfully register a Registration Key. For more details about how to use it see the Demo1 and Demo2 applications.

 

DoMasterReg function DoMasterReg(keylist:Tstrings;AName,ACompany:string):boolean;

 

Make the registration for the Master Computer with the values passed through of his parameters as follow:

KeyList: TStrings with the list of registration keys to be registered.

AName: String with the UserName.

ACompany: String with the Company.

 

For more details about how to use it see the Demo 3 program.

 

DoRegularReg  function DoRegularReg(AName,AKey:string):boolean;

 

Make the registration for a Regular Computer with the values passed through of his parameters as follow:

AName: String with the UserName.

AKey: RegKey to be registered.

 

For more details about how to use it see the Demo 3 program.

 

EraseReg function EraseReg(modul:byte):boolean;

 

This method erases the registration data into the local registry or the RegFile for the given modul module, if modul=0 (the main module) then all registration data is erased, therefore the next time that the application runs this will restart as trial.

 

Execute procedure Execute;

 

This method is intended to make all functions needed to convert your program into a trial time limited application. When this run by first time onto the user computer initialize the RegFile according to the TrialBeginDate and TrialDays properties. This procedure check the registration status; if the application is not registered yet then bring up the Registration Form allowing to the user the instance of register your application, if the status is expired then the [Continue>>] button is disabled so the user is forced to register or cancel the application. For more details about how to use it see the Demo1 and Demo2 applications.

 

Exticode function Exticode(icode:string):string;

 

This method convert a normal InstallCode (6 digit length) to the extended format of 13 digit length. The extra digits holds values from the machine (CPU ID, BIOS SN and HD SN), so when the user ask for a new registration key affirming that your machine was damaged, then you are able to determine if the new installCode received from the user come from the same computer or not and which part of the machine was changed.

 

GenRegularKey function GenRegularKey(AKind:word;AAppID:dword;AiCode:string; Adays:word;

                        Ausers:byte; Abegindate:tdate; Amodule:byte):string;

 

This method return a regular RegKey calculated from the values passed as parameters.

 

Input parameters:

 

AKind: 1 = InstallCode Based, 2 = UserName Based.

AAppID: The AppID number.

AiCode: For AKind=1, put here the InstallCode value.

For AKind=2, calculate it as follow:

usrid := CalcUserID(uppercase(EdName.Text));

AiCode := inttohex((usrid mod 16000000),6);

 

Adays: days for the authorized period or maxword for a permanent key.

Ausers: Number of authorized users or 0 for unregister key.

ABeginDate: the start date of the authorized period. (maxword for a permanent key)

AModule: The module number. 0 for the main module or 1 to 244 for extra modules.

This is a sample for a permanent key:

MyKey := GenRegularKey(1,25021,'027FDC',maxword,1,maxword,0);

 

GenGenericKey GenGenericKey(AAppID:dword; AAppVersionID:word; Adays:word;

Ausers:byte; Abegindate:tdate; Amodule:byte):string;

 

This method return a generic RegKey calculated from the values passed as parameters.

 

Input parameters:

 

AAppID: The AppID number.

AAppVersionID: The AppVersionID number.

Adays: days for the authorized period or maxword for a permanent key.

Ausers: Number of authorized users or 0 for unregister key.

ABeginDate: the start date of the trial period. (maxword for a permanent key)

AModule: The module number. 0 for the main module or 1 to 244 for extra modules.

This is a sample for a permanent key:

MyKey := GenRegularKey(25021,1,maxword,0);

 

GetICode function GetICode:string;

 

This function retrieve the InstallCode value, from the machine for MasterComputers and from the RegFile for RegularComputers.. 

 

GetText1 function GetText1:string;

 

This method get the apropriate text message for the expiration message in the registration form depending on the registration status, for default the following: 

Before expire: "Days left to expire : nn".

After expire: "Trial period expired". 

For more details about how to use it see the Demo 3 program.

 

GetText2 function GetText2:string;

 

This method get the appropriate text message for the top message area in the registration form depending on the registration status, for default the following: 

 

Before register when TrialMode is tmNone:  "ThankYou for trying + APPNAME +. To start with your free trial period please request your Registration Key.".

 

Before register when TrialMode is not tmNone and not expired:  "ThankYou for trying + APPNAME +. If you find this program useful please register.".

 

Before register when expired:  "Trial period expired!  If you want to continue using this program please register it.".

 

After register at temporal way:  APPNAME +. ". This copy is authorized until the day + EndDay

 

After register at temporal way and authorized period will shortly end:  "Warning!  You have modules that will be expiring shortly. If you want to continue using these modules please renew your registration."

 

After a permanent registration:  APPNAME +. This copy is registered to + UserName

 

For more details about how to use it see the Demo 3 program.

 

GetName function GetName(var AName,ACompany:string):boolean;

 

Get the UserName and Company values. Asking it to the user or retrieving it from Windows.

For more details about how to use it see the Demo 3 program.

 

LoadLangList procedure LoadLangList(langfile:string);

 

This method added in v5.1 add a very easy way to change all textual messages into the component.

See the "How to translate AVLock Gold to any language" topic.

 

MakeTrial procedure MakeTrial;

 

This method automatically generate and register a registration key which establish the trial period. MakeTrial must be invoked only when the firsttime property is true. For more details about how to use it see the Demo3 application.

 

ModuleOk ModuleOk(n:byte):boolean;

 

This method read the registration data for the given n module from the local registry or the RegFile and return true when the module is registered or authorized by a period of time otherwise this return false (module expired). For more details about how to use it see the Demo2 and Demo3 applications.

 

NormIcode function normicode(icode:string):string;

 

This method convert an Installcode from the extended 13 digit format to the normal 6 digit format.

 

NotShow  function NotShow:boolean;

 

Return True if the registration form doesn't need to be exposed.

For more details about how to use it see the Demo3 and Demo4 program.

 

Read function Read:boolean;

 

This method read the registration data from the RegFile or the local registry and put these values into the properties of the component and return true if the operation was successful.

If the AccessMode value is 2 (MasterComputer) or 1 (Registered RegularComputer) then Read get data from the RegFile into the executable directory, otherwise if the AccessMode value is 0 (Trial period in RegularComputer) then Read get data from the local registry.

 

These are the properties whose values are assigned for Read:

 

MasterUserName

MasterCompany

LocalUserName

LocalCompany

LastDate

InstallCode

MaxUsers

Days

Registered

Authorized

Expired

BeginDate

EndDate

 

RegisterKey function RegisterKey(

           modul:word;

           Key,UsrName,Org:String;

           ShowMessages:boolean):integer;

 

This method can be used to register an application with a given module, registration key, username and company.

If the ShowMessages parameter is true then if an error occurs into this function a messagebox is raised with the error message. For the Limited edition the "modul" parameter is limited to (0=MainModule) or (255=MainModule in trial mode)

 

Returned value: A integer value is returned in order to denote the process result as follow:

0 =  Registered

1 =  Key length mismatch

2 =  Inexistent module

3 =  Bad system date

4 = Name Mismatch

5 = Unregistered

6 = Tried to register a extra module before the MainModule.

7 = UserName too short

8 = Tried to register an extra module with a different username than the main module

9 = Invalid RegKey

 

WriteLastDate procedure WriteLastDate;

 

This method write the last system date into the RegFile or into the local registry. This procedure is called for the Execute method to keep track of the last date reached for the application, so when the user set back the system date and the AllowBackDate property is false then the application become expired. For more details about how to use it see the Demo3 application.

 

If you have any questions not answered by this help file, please don't hesitate to contact me at http://valega.com/contacto.php.