Properties

Top  Previous  Next

All properties in AVLock SIMPLE are PUBLIC (runtime properties). It has no design-time properties.

 

Items

Properties for Configuration

InstallCode Related Properties

User Data Properties

Status Properties

 

 

PROPERTIES FOR CONFIGURATION

 

property AppID : word read FAppID write FAppID;

property AppName : string read FAppName write FAppName;

property AppVersion : string read FAppVersion write FAppVersion;

property EncryptionKey: AnsiString read FEncryptionKey write FEncryptionKey;

property EncryptionKey2: AnsiString read FEncryptionKey2 write FEncryptionKey2;

property InstancesCtrl: Boolean read FInstancesCtrl write FInstancesCtrl;

property OlmPath: string read FOlmPath write FOlmPath; // '/olm'

property OlmAdvScript: string read FOlmAdvScript write FOlmAdvScript;

property OlmBasicScript: string read FOlmBasicScript write FOlmBasicScript;

property RegFilePath: string read FRegFilePath write FRegFilePath;

property RegFolder: string read FRegFolder write FRegFolder;

property RegPath: TRegPath read FRegPath write FRegPath;

property TimeHost: string read FTimeHost write FTimeHost;

property WebHost: string read FWebHost write FWebHost;

 

AppID: type word. Numeric value used to identify the application. The default is 12345 but you should change it, entering a different one for each application. If you have two applications using the same AppID, both will try to save the registration data in the same place causing the subsequent loss of this data. Based on this number is calculated the name of the files *.avr and *.avc, the first (*.avr) to save the registration data (the DataFile) and the *.avc file that handles the number of instances allowed for the application . AppName, AppId and InstallCode are used as key values to access to the registration data in the remote database into the OLM (Online License Manager). The security is based primarily on this issue so please keep it secret like a password.

AppName: type string. Name you assigned to the application, must be different for each application and is used with the AppID and the InstallCode to access the registration data in remote database Online License Manager (OLM).

AppVersion: type string. Version of the application.

EncryptionKey: type string. String value used by the encryption algorithm as key to encrypt the registration data. This must be kept in secret.

 

EncryptionKey2: type string. String value used as encryption key to encrypt the data transferred between the application and the OLM, allowing so a secure communication with your web site. This same key must be assigned also into the genkeys3lib.php script into the OLM, by default this value is 'xyz321' but you must change it by your own one. This must be kept in secret.

InstancesCtrl: type Boolean. Must be true if you want to limit the number of concurrent instances of the application. By creating a registration key or the KeyGen utility or from the OLM control panel, you establish the number of instances allowed.

OlmPath: type string  (Default '/olm3'). Allow to specify the path into your web server where you have installed the OLM scripts.

OlmAdvScript: type string  (Default 'advancedolm.php'). Allow to specify the name of the scripts into the OLM to manage the advanced features associated with the following methods: OnlineRegisterKey(), OnlineStartTrial(), OnlineExtendTrial(),  OnlineGetKeyA(), OnlineMovePrimary1(), OnlineMovePrimary2(), OnlineMoveSecondary1(), OnlineMoveSecondary2(), OnlineRestorePrimary(), OnlineRestoreSecondary(), OnlineSynch(), OnlineRenew(), OnLineStartSecondary(), OnlineRemoveReg(), OnlineGetRegData(), OnlineSaveUserData(), Synchronize(), OnlineRemoveReg().

OlmBasicScript: type string  (Default 'basicolm.php'). Allow to specify the name of the scripts into the OLM to manage the advanced features associated with the following methods: OnlineGetKeyB(), OnlineRemoveKey().

RegFilePath : type string: The default value is an empty string ''. With this default value the Registration File will be located into the same folder where is your application exe file. On Windows Vista the folders under ProgramFiles are not writables, so, for Windows Vista compliant applications you should enter here the path where your Registration File will be located. Windows has some special folders where the user can write data for his applications. You could use the SHGetSpecialFolderPath() function in order to get the location of these special folders on your current Windows version.

 

Below the GetSpecialFolder() function shows how to implement it.

 

function GetSpecialFolder(const CSIDL : integer) : string;

var RecPath : PAnsiChar;

begin

 RecPath := StrAlloc(MAX_PATH);

 try

   FillChar(RecPath^,MAX_PATH,0);

   if SHGetSpecialFolderPath(0,RecPath,CSIDL,false) then begin

     result := RecPath;

   end else result := '';

 finally

   StrDispose(RecPath);

 end;

end;

 

As parameter use one of the following constants or its relating value.  

 

For example use:  

    str := GetSpecialFolder(35);

 

For Windows XP will get the following results:

 

ROAMING_APPDATA = 26   C:\Documents and Settings\<current user>\Application Data

LOCAL_APPDATA     = 28   C:\Documents and Settings\<current user>\Local Settings\Application Data

COMMON_APPDATA = 35   C:\Documents and Settings\All Users\Application Data

 

RegFolder: type string (default: 'avlocks3') Here you should enter the name for the folder where you want to save the Registration data files (*.avr and *.avc files). Thus, the RegFilePath2 property (the final and applied RegFilePath) will be assigned internally as follow:

  RegFilePath2 :=  RegFilePath + '\' + RegFolder;

RegPath: type TRegPath  (Default: CommonDocuments): Allow to select the appropriate Special Folder into a list of standard values (CommonDocuments, ProgramData, RoamingAppData, LocalAppData, ExeDir, Other), thus the RegFilePath property will be automatically assigned with the appropriate special folder according with the chosen value and the current Windows version:

CommonDocuments:

XP:     C:\Documents and Settings\All Users\Documents

Vista:  C:\Users\Public\Documents

 

ProgramData:

XP:     C:\Documents and Settings\All Users\Application Data

Vista:  C:\ProgramData

 

RoamingAppData:

XP:     C:\Documents and Settings\<username>\Application Data

Vista:  C:\Users\<username>\AppData\Roaming

 

LocalAppData

XP:     C:\Documents and Settings\<username>\Local Settings\Application Data

Vista:  C:\Users\<username>\AppData\Local

 

ExeDir: If you choose this option, the mapped folder will be the same where is located your application executable.

 

Other: If you chose this option then you must provide the value you want for the RegFilePath when you start your application and before to call anything from the component, for example into the .dpr file as follow:

 

function GetSpecialFolder(const CSIDL : integer) : string;

var RecPath : PAnsiChar;

begin

 RecPath := StrAlloc(MAX_PATH);

 try

   FillChar(RecPath^,MAX_PATH,0);

   if SHGetSpecialFolderPath(0,RecPath,CSIDL,false) then begin

     result := RecPath;

   end else result := '';

 finally

   StrDispose(RecPath);

 end;

end;

 

begin

 Application.Initialize;

 Application.CreateForm(TMainForm, MainForm);

 with MainForm do

 Begin

   avlocks31.EncryptionKey := 'abc123';

   avlocks31.EncryptionKey2 := 'xyz321';

   avlocks31.AppID := 12343;  

   avlocks31.RegFilePath := GetSpecialFolder(12); //CSIDL_MYDOCUMENTS = 12 = 0x000c

 end;

 . . .

end;

 

TimeHost: type AnsiString: url for the time server in order to get the actual time and date. Default value: 'time-a.nist.gov'

WebHost: type AnsiString: The web server host name used to access to the Online License Manager (OLM). For default this value is www.av-soft.com.

 

InternetPort : type word. Declared as variable (not property),  defined as follow:

 

   InternetPort: word = INTERNET_DEFAULT_HTTP_PORT;

 

Is used as parameter to call the InternetConnect() function. You must use one of the predefined constants into the Wininet.pas file. The default value is INTERNET_DEFAULT_HTTP_PORT used for not secure sites, for secure sites (HTTPS) use INTERNET_DEFAULT_HTTPS_PORT,  For example:

InternetPort := INTERNET_DEFAULT_HTTPS_PORT;

 

InternetFlag : type dword. Declared as variable (not property),  defined as follow:

 

 InternetFlag: dword = INTERNET_FLAG_RELOAD;

 

Is used as parameter to call the HttpOpenRequest() function. You must use one of the predefined constants into the Wininet.pas file. The default value is INTERNET_FLAG_RELOAD, the correct value for not secure sites. However, if you need to access to a secure site (HTTPS) use one of the two following options:

 

   //Option 1

   InternetFlag := INTERNET_FLAG_SECURE;

 

   //Option 2

   InternetFlag := INTERNET_FLAG_SECURE

                    or INTERNET_FLAG_IGNORE_CERT_CN_INVALID

                    or INTERNET_FLAG_IGNORE_CERT_DATE_INVALID;

 

 

INSTALLCODE RELATED PROPERTIES

 

   property InstallCode: string read FInstallCode write FInstallCode;

   property icode: string read FICode write FICode;

   property InstallCodeSources: TInstallCodesources read FInstallCodeSources write FInstallCodeSources;

   property MachineSources: TMachineSources read FMachineSources write FMachineSources;

   property UserSources: TUserSources read FUserSources write FUserSources;

 

 

InstallCode: (type string): The property InstallCode is used to store a code that identifies an installation of software on a given computer.

Each time the application starts, AVLock InstallCode estimated value based on the sources defined in InstallCodeSources property.

It has a simple format of 12 hexadecimal characters: XXXXXXXXXXXX

 

Example: BED1ABB4B189

 

Internally comprises three fields: DATA-CODE, IC-SRC and CHECKSUM. The checksum field is calculated as a sum of the previous two fields and is used to verify its integrity.

 

The value assigned to the DATA-CODE field is obtained from various sources that can be classified into three groups:

 

1) MACHINE DATA: These are values obtained from computer hardware.

2) USER DATA: It is the user data, Name, Company, Email, etc.

3) REMOVABLE DISK: Serial obtained from the removable drive where you installed the application.

 

You must choose one of these three groups as only you can use one of them. The group is defined using the property InstallCodeSources. Below you can see three possible configurations

 

1) InstallCodeSources: = Machine_Data;

2) InstallCodeSources: = user_data;

3) InstallCodeSources: = Removable_Disk;

 

As we see InstallCodeSources functions as a switch for selecting the group of sources used.

 

After defining the group to use with InstallCodeSources you should define the related sources to be used. For example:

 

For the group MACHINE DATA:

 

InstallCodeSources: = Machine_Data;

MachineSources: = [System_UUID, BaseBoard_SN]

 

For the group USER DATA:

 

InstallCodeSources: = User_Data;

UserSources: = [User_Name, Email_Address]

 

For  REMOVABLE DISK you do not need to define a group of sources as this is one, so just define the following:

 

InstallCodeSources: = Removable_Disk;

 

Below we can see an outline of what we were explaining:

 

installcod02

 

 

 

 

Note that IC_SRC is a 1 byte field that holds the configuration of the sources used to define it.

 

It is relevant to mention here the CodeCheck utility that lets you see the values of the fields within a given InstallCode.

 

codecheck

 

We see this Installcode was calculated with the following configuration:

 

InstallCodeSources := Machine_Data;

MachineSources := [System_UUID, BaseBoard_SN];

 

ICode (Checksum): type string. 4-digit hexadecimal value calculated as a checksum from all other segments  that conforms the InstallCode, and you get a code shorter but equally unique from each InstallCode which also is part of the same as the first segment and allows its validation. It is also used to integrate the registration key to be compared later with the obtained from the machine at run time.

 

InstallCodeSources: enumeration type defined as follows:

 

 TInstallCodesources = (Machine_Data, User_Data, Removable_Disk);

 

 the group of sources to define the InstallCode generation. See more details on the Property InstallCode.

 

MachineSources: type set defined as follow:

 

 TMachineSources = set of (System_UUID, BaseBoard_SN, Reg_File, HD_PNPDeviceID, HD_SN, HD_Signature);

 

Define the sources for the Machine_Data group. See more details on the Property InstallCode.

 

UserSources: type set defined as follow:

 

 TUserSources = set of (User_Name, User_Company, Email_Address, Other_Source);

 

Define the sources for the User_Data group. See more details on the Property InstallCode.

 

 

USER DATA PROPERTIES

 

property UserName :string read FUserName write FUserName;

property Company :string read FCompany write FCompany;

property Email :string read FEmail write FEmail;

property OtherCode: string read FOtherCode write FOtherCode;

 

UserName: type string. Hold the name of the user. This is saved also together with the other application data. (Company, Email, etc.).

 

Company: type string. Hold the company of the user. This is saved also together with the other application data.

 

Email: type string. Hold the email address of the user. This is saved also together with the other application data.

 

OtherCode: type string. Additional field for the user data. You could use it for the User ID, Postal address, etc.

 

 

STATUS PROPERTIES

 

   property DateWarning: Boolean read FDateWarning write FDateWarning;

   property DateBacked: Boolean read FDateBacked write FDateBacked;

   property FirstTime: Boolean read FFirstTime write FFirstTime;

   property IsGuest: Boolean read FIsGuest write FIsGuest;

   property LastDate: TDate read FLastDate write FLastDate;

   property LastError: word read FLastError write FLastError;

   property Started: Boolean read FStarted write FStarted;

 

DateWarning: type Boolean. It takes the value True if the timing difference LastDate and the computer's date is greater than one. Also if DateBacked is True it is True too.

DateBacked: type Boolean. It takes the value True if the computer date have been turned back after the user ran the application with a date greater than the current one. It is calculated by comparing the current date of the computer with the value of the property LastDate which contains the largest date ever achieved by the application.

FirstTime: type boolean, is set to True when it is the first time the application is running on the computer.

 

IsGuest : type boolean. Set to True for Guest users. Used internally to bypass over some features for this kind of users. When the component detect a Guest user this operates at a different way than with normal users, the Installcode is retrieved from the saved registration data and OLM access and write operations are forbidden.

 

LastDate: type date. This property is assigned with the highest date value even reached by the computer. When the program calls the GetKeyData() method, the current system date is compared with the LastDate stored in the registration data, if the date is greater than LastDate, this is updated with the value of the current date, otherwise if the date is less than LastDate DateBacked properties and DateWarning are made equal to True. To reset this value to False you could use the OnlineCheckDate() method that verifies the date of the computer through the internet.

 

LastError : type word: Return the error code for the last operation and can take the following values:

0: No error

1: A Guest user is running a not initialized application

2: Operation not available for guest users

 

You do not need to take care about this value since the appropriate action is taken internally.

 

 

Started: type boolean, Takes its value to true when the Start() method has been executed in order to avoid to call Start()  more than one time.

 

 

Default values of properties

 

The component initialize its properties with the following values:

 

Properties

Default Values

Detail

InstallCodeSources

Machine_Data

Options are: MachineData, User_Data and Removable_Disk

MachineSources

[System_UUID, BaseBoard_SN]

Options are: [System_UUID, BaseBoard_SN, HD_Model, HD_PNPDeviceID, HD_SN, HD_Signature]

UserSources

[User_Name, User_Company, Email_Address];

Options are: [User_Name, User_Company, Email_Address, Other_Source]

EncryptionKey

'abc123'

Encryption key used for keys and other registration data.

EncryptionKey2

'xyz321'

Encryption key used to encrypt the data sent and received on the website.

AppID

12345

Application ID number.

RemovableDisk

False

Make True for portable applications.

AppName

'MyApp'

Application name.

AppVersion

'1.0.0'

Application version.

WebHost

'www.av-soft.com'

website url where you installed the OLM.

TimeHost

'time-a.nist.gov'

url for the time server in order to get the actual time and date.

InstancesCtrl

False

If True it enables to control the number of instances executed simultaneously.

RegPath

CommonDocuments

Location within the local disk where is saved the registration data. Set to "Other" if you want to especify your own location.

RegFolder

'example1'

Name of the folder where is saved the registration data. Set (RegPath=Other) and (RegFolder='') in order to especify the application folder to save the registration data. This is required to control instances into the network. See example 1.

OlmPath

'/olm5'

Location within the hosting where you installed the OLM.

OlmBasicScript

'basicolm.php'

Name of the main script for the basic OLM.

OlmAdvScript

'advancedolm.php'

Name of the main script for the advanced OLM.







 

Before to call some method, the component properties should be allocated according to their own settings. You only need to assign those who are different than the default values, you should at least assign different values for the following properties: EncryptionKey, EncryptionKey2 and AppID, and if you have installed the OLM into your own server also change the WebHost and OlmPath properties.

 

 

 

I tried to make this help as clear and complete as possible, however they may have some issues not covered by this documentation. If you think I have missed something, or found errors, or have any idea that might be useful to improve this help, please let me know.

 


  Alcides Valega

Author of AVLock SIMPLE