AVLock Gold v4.0 (c) Alcides Valega, 2002, 2003

Table of contents

 

What is AVLock Gold?

AVLock Gold is a Delphi component which allow you to convert any application into a time limited trial in a very ease way. In adittion, with AVLock Gold you can:

To make a 30 days trial application you simply must locate an AVLock Gold control in your main form and to write the following line of code at the OnCreate event:

   AvLockGold1.execute;  

That's enough to convert the application in a 30 days trial version. However, you can to use AVLock Gold in several other more powerful ways, making your own interface or changing the default values of properties to adjust it to your needs. 

^

What are RegKeys and KeyFiles?

AvlockGold manage your applications through Registtration Keys (RegKeys). There are three kind of RegKeys: InstallCode based, UserName based and Generic Keys. The two first ones are called regular keys with the format XXXXXX-XXXXXX-XXXXXX-XXXXXX (four segments of six char each), instead Generic keys have the format XXXXX-XXXXX-XXXXX-XXXXX (four segments of five char each).

InstallCode based Keys: These Keys are intended to protect your application comparing the InstallCode calculated from your machine (see the InstallCode property) with the encrypted one into the RegKeys stored on the RegFile.

UserName based Keys: These Keys are intended to protect your application comparing the UserID code calculated from the UserName requested to your user with the encrypted one into the RegKeys stored on the RegFile. These keys are less secure than InstallCode based keys but have the advantage that these are not machine dependant. Some customers decline to buy machine dependant software.

Generic keys: These keys are intended to register apps for several users with only one RegKey avoiding the tedious task to generate a different Regkey for each one. These keys only compare the AppID stored on the app exe file with the extant one into the RegKey which the user try to register, and eventually this may check the VersionId number. More insecure than regular keys but much more efficient.

KeyFiles: ocasionally you may need to register several modules at the same time, to achieve it you may to generate a KeyFile with all RegKeys needed into and send it to your customer. The only requisite is that if you include a RegKey for the main module (module 0) this must be located at first place. If the trial period is expired yet then you must to include a RegKey to register the main app before all others RegKeys for extra modules. For more details see the description for the KeyWizard utility. 

^

What are RegFiles, ControlFiles and RegistryKeys?

AvlockGold automatically generate two files onto the user system called xxxxxxxx.avr (the RegFile)and xxxxxxxx.avc (the ControlFile), where xxxxxxxx is a string value calculated from the appID number.  The RegFile hold at encrypted way all registration data and some others values to ensure the legal use of your app. The ControlFile take track of the users logged to your app, so when these exceed the value by the maxusers property, the user get the "Too many active users" message.

The RegistryKey is a Windows Registry Key automatically created when the app run at first time with the only goal of determine in the future if the app is running by first time and avoid the trial period can be restarted ilegally erasing the RegFile and ControlFile files. It is only possible if you assign tmRelative to the TrialMode property. If the user try your program from an account without writing rights access to the Windows Registry then the TrialMode is automatically changed to tmAbsolute, this mean the trial period will start from the TrialStartDate property value. 

^

How to adapt AVLock Gold to any language?

All prompts and text messages used onto the registration form and anothers locations of the component reside into the avlockgold.res file. Together with the AVLock Gold component come these resource files:

avlockgold_en.rc : Plain text format file with the prompts and messages by english language.  

avlockgold_sp.rc : Plain text format file with the prompts and messages by spanish language.  

avlockgold_en.res : Compiled resource file by english language

avlockgold_sp.res : Compiled resource file by spanish language

You can edit the *.rc file with notepad or your favorite text editor then compile it with Brcc32.exe. as follows :

Execute this command line :  Brcc32.exe avlockgold_en.rc

This will generate the avlockgold_en.res file

Rename it as avlockgold.res and locate it into your component folder.

^

Hacking issues

With the Resource Hacker utility * it is quite ease to hack any normal exe file compiled with Delphi since all published properties from any component may be easily changed, any event manager deleted and any response to buttons changed. To avoid anyone utilize this chance to crack your application you can take care of the following:

1. Don't utilize the event manager by events like oncreate or onshow to set properties or call the execute procedure, instead put it into the project (dpr file).  See the Demo1 application.

2. Leave unchanged all properties from the AVLockGold component at design time, instead assign these programatically into the dpr file. Is very important to assign here an AppID value different than 12345 (the default value). See the Demo2 application.

3. Insert into some offten called routines the following lines:

        AVLockGold1.read;

        If AVLockGold1.expired then application.terminate;

 

4. Compress your final exe file with any exe compressor like UPX * or AsPack *.

* ReSource Hacker is a freeware utility copyright © 1999-2002 Angus Jhonson. UPX is a freeware utility copyright © 1996-2001 Markus Oberhumer & Laszlo Molnar, and AsPack is a shareware utility copyright © 1998-1999 Alexey Solodovnikov.

^

Properties

AllowBackDate : Type: boolean. When this value is True then the user is able to backward the system date to reuse an expired period.

AppID : Type: word. Numeric value to identify the application. For default this value is 12345 but you must to assign different codes to each application.

AppName : Type: string. Name assigned to your application. This appear on the title bar of the registration windows. For default have the 'Myprogram' value.

AppVersionID : Type: byte. Numeric value to identify the application version. For default its value is 1 but you must to assign a different value to each different version of your application.

Authorized : Type: boolean. (runtime). If true, this mean the application is temporarily registered.

BeginDate : Type: boolean. (runtime) Date from which start the current authorized period.

ColorForm : Type: TColor. The background color of the Registration form. Default clBtnFace.

Company : Type: string.  (runtime) Company of the registered user.

Days : Type: word. (runtime) Number of days by the current authorized period.

DaysLeftToWarning : Type: byte. The number of days before expire as from to show the TextWarning message. default 15.

EndDate : Type: date. (runtime) Date where finish the authorized period.

EmailAddress : Type: string. Email address to send you the purchase information.

Expired : Type: boolean. (runtime) When it is True, this mean that trial/authorized period was expired.

FirstTime : Type: boolean.  (runtime) If true, this mean the application run at first time on the computer.

Font : Type: TFont Font by text on the registration form.

InstallCode :Type: string;  Length: 6. (runtime)  Hexadecimal Strig Value. When your application run on the user PCs, AVLock Gold calculate a  hexadecimal number called InstallCode, distinct one for each PC and calculated from several sources (see InstalCodeSources property). This code must be sent to you from the users so you can generate with KeyWizard.exe the appropriate Registration Keys for your users. These are used only for InstallCode based Keys. For more information see the "What is RegKeys and KeyFiles?" section above, and the description by KeyWizard.Exe utility below.  

InstalCodeSources :  Type: set. This property allow to determine from where come the value for the InstalCode property. These sources can be chosen (one or more) between these ones: Bios_SN (The serial Number from the Bios), CPU_ID (a code from the  CPU) and  HD_SN (The Hard Disk Serial Number), RandomNumber (a random number generated at first time your app run and stored on the RegFile), UserName (a code calculated in basis to the full user name and stored on the RegFile). If you chose UserName then your user must send to you his full user name instead of the install code.

IsLocal: Type: boolean. (runtime) If true then the app is running at local way, this mean the exe file reside on the same machine where it is running. If false then the app is running at remote mode from a network volume.

IsTrial: Type: boolean. (runtime) If true then the app is running at trial mode, otherwise at permanent or temporary authorized way.

Logo : Type: TBitmap. This property allow you to place your own logo on the registration form.

MaxUsers: Type: byte. (runtime) The max number of simultaneous instances allowed for your app.

OnlineLink: Type: string. URL to your seller website.

Protection Level : Type: (plNone, plMedium, plHigh). This property allow you to establish the protection functionality to the following levels:

plNone: Disable all protection functionality. Only allow the user to enter your Name and Company when it run the app by first time and hold it into the encrypted RegFile.

plMedium:  At first time request to the user his Name and Company and hold it into the encrypted RegFile. With InstallCode Based Keys every time check the machine installcode, if not match then get expired. 

plHigh: The default value: At first time request to the user his Name and Company and hold it into the encrypted RegFile. With InstallCode Based Keys every time check the machine installcode, if not match then get expired. With UserName based Keys, only when the RegFile exists and RegistryKey does not exists, request from the user to enter his Name and Company and verify it matches with the encrypted name into the RegFile, if not match then get expired. Every time holds the current system date to the RegFile. On remote mode every time compare the system date with the held one into the regfile, if the difference is more than one day then get expired, this force to the user to run the application on local mode at least one time each two days and ensure anybody doesn´t copy the regfile to another machine to run the application illegally on remote mode.

RegFilePath: Type:   (C_RootDir, Exe_Path). This property allow you to determine where to locate the RegFile and the ControlFile. If C_RootDir is chosen then both, REgFile and ControlFile will be generated on the C:\ root directory on the machine where the exe file reside. Instead, if Exe_Path  is chosen then these files will be generated on the same directory where the exe file is.

RegistrationWays : Type: set of (rwOnline, rwEmail, rwOther). This property allow you to expose at the registration form the selling method more suitable to your needs.  The options can be: a) rwOnline: to link with your seller website according with the value assigned to the OnlineLink property. b) rwEmail: to send an email to the email address assigned to the EmailAddress property, and  c) rwOther: to show text for another method to purchase your product. The default text said "Another way" but you can change it editing the *.rc resource file and recompile it with Brcc32.exe, rename the compiled *.res file to avlockgold.res and locate it on the component directory replacing the older one.

Registered : Type: boolean. (runtime) If True, then the application is permanently registered.

RegUserName : Type: string. (runtime) Registered User Name for the application.

RequestNameOnStart : Type: boolean.(runtime) If true (default value) then when the app run by first time this will request the user to enter his name and company and hold it into the encrypted RegFile.

ShowProgress : Type: Boolean. If true then the Registration form show begin date, end date and a progress bar with the position of the current date into the authorized period.

TrialBeginDate : Type: TDate.  Date to start the trial period. Only applicable when the TrialMode property is tmAbsolute.

TrialDays : Type: word. (runtime) Number of days for the initial trial period. default 30.

TrialMode : Type: (tmAbsolute, tmRelative). This determine which type of trial to generate when the app run by first time.  If you chose tmAbsolute the trial will start at the date of the TrialBeginDate property value, otherwise if you chose tmRelative, then the trial will start at the current system date. tmRelative is more flexible and suitable but tmAbsolute is more secure to avoid crackers attack.

Warning : Type: boolean.  (runtime)  If True, this mean the Warning Text must be exposed.

^

Methods

Check : function Check(m,v, RKey:string):boolean; This method return true if the given Registration key RKey is ok and the module coincide with the given m value and the version coincide with the given v value. If you want these values be not checked then set 9999 to m and 0 to v.

EraseRegfunction EraseReg(modul:byte):boolean; This method erase the registration data into the RegFile for the given modul module, if modul=0 then all registration data is erased, therefore the next time that the application execute this  become 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.

 

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.

 

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.

 

ModulOk:   ModuleOk(n:byte):boolean;

This method read the registration data for the given n module from the RregFile 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 Demo1, Demo2 and Demo3 applications.

 

Read:   procedure Read;

This method read the registration data from the RregFile and put these values into the component properties.

RegisterKey : procedure RegisterKey((Key,UsrName,Org:String):boolean; This method can be used to register an app with a given Registration Key, username and organization (company).   For more details about how to use it see the Demo 3 program.

WriteLastDate : procedure WriteLastDate; This method write the last system date into the RegFile. This procedure is called for the Execute method, this take track of the last date the application has been executed for the user, so if the user backward 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.

^

Utilities

KeyWizard.exe

This utility allow you to generate registration keys needed for your users to register the main application and modules on his machines. Into these Keys come all data needed to establish the appropriate values for the AVLock Gold component into the target application, so you can enable/disable and change authorized periods for the main application or extra modules at distance sending these registration keys to your users.

To generate a Registration Key you must follow out three steps with one screen for each, namely:

1.  TYPE: Here is where you select the type of Key. This can be: 

a) Permanent : This kind of key is to register a application/module at definitive way, without time limit.

b) Temporary : This kind of key is to register a application/module at temoporary way. Here you should to enter three values to determine the authorized period of time: Begin date, Period of days and End date.

c) Unregister : If you chose this option, the generated Key will unregister the giving application/module. If you select Main Application at the MODULE screen, then all extra moodules will be unregistered together.

2. MODULE: Here you select the module that you want to register. These can be:

a)  for the main application (module 0): Here you are prompted to enter the max number of simultaneous users allowed on your application.

b) For an extra module (1..254): To register an additional module for your application.

3. GENERATE: On this screen you first select a kind of Key, then enter some values an press the generate button to add a new Key to the Registration Keys group.

a) InstallCode based Key: If you select this option, the generated key will be based on the InstallCode property, so you will be prompted to enter its value.

b) UserName based Key: If you select this option, the generated key will be based on the full user name, so you will be prompted to enter its value.

c) Generic Key. If you select this option, the generated key will be based on the VersionId of your app. This option let you to generate a single key to register all users having the same version of your app. regardless for what it is based, either InstallCode or UserName. If you enter 0 to VersionID this mean the VersionID will be not checked. See the "What are RegKeys and KeyFiles?" section.

Finally you will be prompted to ente the AppID number and click on the Generate button to add a new Key to the list.

Generate button: press this button to generate the registration key with all data entered above and add it to the registration keys group.

registration Key: There is a memo area to group all registration keys generated which later on you will send to your user.

Clear button: press this button to remove all registration keys into the key group box.

Load from file button: press this button to read keys from a selected KeyFile (*.avk) to the key group box.

Save to file button: press this button to save all key from the key group box to the given KeyFile (*.avk).

 

RegMonitor.exe

This utility is very useful to test how work AVLock Gold. The first thing that you have here is the current registration path.  Below is the following two main sections:

1. Applications registered with AVLock at your PC: Here you can see the applications currently registered on your PC on the current registration path with the following values for each:

a) Application: The name of the application, matching with the value assigned to the AppName property.

b) Registered to: Full UserName entered for the user at the momment that he register your app.

c) Company: Company name entered for the user at the momment that he register your app.

d) Max users: Max users allowed at the same time for you app

2. Modules registered for the selected app on the 1 section: Here you can see all modules registered for the selected app with the following values for each:

a) Module: The module number, ´Main´ for the 0 module.

b) Registration key: The registration key entered for the user at the momment that he register the module.

c) Type: The type of registration. (Trial, Permanent or Temporary)

d) From: Date where start the authorized period, only for Trial and Temporary types.

e) To: Date where finish the auhorized period, only for Trial and Temporary types.

f) Days left: Days leftover to expire the authorized period, only for Trial and Temporary types.

Refresh button: this button refresh the information displayed. It is necessay only when you register or unregister an app/module on your PC.

Unregister button: this button unregister the selected app/module.

^

Demos

Demo1 : This show how to make a trial application InstallCode based. Here I did use the avlockgold.execute line on the OnCreate event (not recommended, see the hacking issues section).

Demo2 : This show how to make a trial application UserName based. Here is used the recommended way to invoke AVLockGold, all lines on the *.dpr file;  

Demo3 : This show how to make an trial application with a customizad registration form.

^

How to install AVLock Gold

1. Unzip the component zip file into a folder.

2. From your Delphi IDE open the AVLockGolD(x).dpk package.

3. If you get the message "This package appears to be in an older format. Would you like to convert it to the new format?" then reply No.

4. Press the install button. Wait for the Delphi message "The following new commponent(s) have been registered:. . ."

4. Review your Library Path into the Tools|Environment Options|Library tab. Here you should to have one entry (only one) pointing to te folder where you unziped the component. If you have not this entry then create it manually.

^

How to Purchase AVLock Gold.

There is two different versions of AvlockGold:

1. The Standard Version:  (without sources). This include pack's for D4, D5, D6 and D7 versions of Delphi. The KeyWizard and RegMonitor utilities and demo applications. This package is very similar to the freeware one with the only difference that the ad image on the registration form has been removed and. you have the rigth of use it on commercial applications.  Buy now

2. The Developer Version: (all souces included). This have all included on the standard version plus The sources for the AVLockGold component, the KeyWizard  and RegMonitor utilities and the AVLabelPack (pack of components needed to compile KeyWizard and RegMonitor utilities).  Buy now

 

How to Upgrade from the standard version to the developer version.

You only pay the difference, please email me to avalega@bigfoot.com

^

AVLock Gold Software License Agreement.

BEFORE PROCEEDING WITH THE INSTALLATION AND/OR USE OF THIS SOFTWARE, CAREFULLY READ THE FOLLOWING TERMS AND CONDITIONS OF THIS LICENSE AGREEMENT AND LIMITED WARRANTY (The "Agreement").

BY INSTALLING OR USING THIS SOFTWARE YOU INDICATE YOUR ACCEPTANCE OF THIS AGREEMENT. IF YOU DO NOT ACCEPT OR AGREE WITH THESE TERMS, YOU MAY NOT INSTALL OR USE THIS SOFTWARE ! 

^

LICENSE

AVLock Gold Software, including documentation, source code, object code and/or additional materials (the "Software") is owned by Alcides Valega (the "Author"). This Agreement does not provide you with title or ownership of Product, but only a right of limited use as outlined in this license agreement. Software author hereby grant you a non-exclusive, royalty free license to use the Software. 

^

REDISTRIBUTION RIGHTS

You are granted a non-exclusive, royalty-free right to reproduce and redistribute executable files created using the Software (the "Executable Code") in conjunction with software products that you develop and/or market (the "Applications").

^

LIMITED WARRANTY

THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PRODUCT IS WITH YOU. SHOULD THE PRODUCT PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING OR ERROR CORRECTION.

THE AUTHOR OF AVLock Gold DO NOT WARRANT THAT THE FUNCTIONS CONTAINED IN THE SOFTWARE WILL MEET YOUR REQUIREMENTS OR THAT THE OPERATION OF THE SOFTWARE WILL BE UNINTERRUPTED OR ERROR FREE.

--------------------------------------------------------------------------------------------

If you have any questions regarding this agreement, or you have any comments, suggestions or bug-reports, please forward it to: avalega@bigfoot.com

Author : Alcides Valega

Address : Santa Cruz 1468, 3400-Corrientes, Argentina

E-mail : avalega@bigfoot.com

URL : http://www.avsoft.sitio.net

^