|
Items
Published Properties (design time)
Configuration Properties
User Data Properties
Other Properties
PUBLISHED PROPERTIES (design time)
property InstallCodeSources: TInstallCodeSources read FInstallCodeSources write FInstallCodeSources default [HD_SN,CPU_ID];

|
InstallCodeSources: type set, defined as TInstallCodeSources = set of (CPU_ID, HD_SN, RandomNumber, User_Name, Other_Source) Allows you to configure sources (from the computer, or other) used to calculate the property InstallCode. These sources may include:
CPU_ID: The CPU ID coming from the motherboard.
HD_SN: The manufacturer Hard disk Serial Number.
Random_Code: Random number generated and saved into the registration data.
User_Name: Use the User name in order to calculate a ID value to integrate the InstallCode.
Other_Source: Allow to set up a value at runtime in order to integrate into the InstallCode.
|
PUBLIC PROPERTIES (run time)
Las clasificamos en tres grupos:
1) Configuration properties
2) User data properties
3) Other properties
CONFIGURATION PROPERTIES
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 OlmPath: string read FOlmPath write FOlmPath; // '/olm'
property OlmAdvScript: string read FOlmAdvScript write FOlmAdvScript; //'advancedkeymanager.php'
property OlmBasicScript: string read FOlmBasicScript write FOlmBasicScript; //'basickeymanager.php'
property RegPath: TRegPath read FRegPath write FRegPath;
property RegFolder: string read FRegFolder write FRegFolder;
property RemovableDisk : boolean read FRemovableDisk write FRemovableDisk;
property V32Compat: boolean read FV32Compat write FV32Compat;
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 avr, 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.
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().
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;
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;
RemovableDisk: type boolean: Check this option if you want that your application could be used into a removable disk like an memory stick, pen drive or other similar media. Also if you select this option and you want use it at different computers then you must check only HD_SN for the InstallCodeSources property, so the Installcode will be calculated only from this removable device.
V32Compat: (default: False) Compatibility with previous version. When this property is true then the Installcode generated is the same as in the previous version 3.2.
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.
TimeHost: type AnsiString: url for the time server in order to get the actual time and date. Default value: 'time-a.nist.gov'
USER DATA PROPERTIES
property UserName :string read FUserName write FUserName;
property Company :string read FCompany write FCompany;
property Email :string read FEmail write FEmail;
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.
OTHER PROPERTIES
property DateBacked : boolean read FDateBacked write FDateBacked;
property DateWarning : boolean read FDateWarning write FDateWarning;
property FirstTime: boolean read FFirstTime write FFirstTime;
property InstancesCtrl: boolean read FInstancesCtrl write FInstancesCtrl;
property ICSources :string read FICSources write FICSources;
property ICode: string read FIcode write FICode;
property InstallCode: string read FInstallCode write FInstallCode;
property InternetPort : word read FInternetPort write FInternetPort;
property InternetFlag : dword read FInternetFlag write FInternetFlag;
property IsGuest : boolean read FIsGuest write FIsGuest;
property LastDate: Tdate read FLastDate write FLastDate;
property LastError : word read FLastError write FLastError;
property OtherCode : word read FOtherCode write FOtherCode;
property RegFilePath : string read FRegFilePath write FRegFilePath;
property RandomCode : word read FRandomCode write FRandomCode;
property Started: Boolean read FStarted write FStarted;
DateBacked: tipo 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.
DateWarning: tipo 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.
FirstTime: tipo boolean, is set to True when it is the first time the application is running on the computer.
InstancesCtrl: tipo 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.
ICSources: Tipo string. It is a string representation of the InstallCodeSources property, is composed by 5 characters that can be '0 'or '1' indicating whether the corresponding source is active or not. For example '11000 'indicate that the sources are active on HD_SN and CPU_ID.
ICode (Checksum): tipo string. 4-digit hexadecimal value calculated as a checksum from the 5 sources which conforms the InstallCode, and you get a code shorter but equally unique from each InstallCode which also is part of the same as the last of the segments 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.
InstallCode: tipo string. value calculated on the basis of established sources in the InstallCodeSources property. Should be unique for each computer. It consists of 6 sub-strings (segments), obtained from the machine or from other sources. Each segment is a 4-digit hexadecimal number. Depending on the values assigned to InstallCodeSources each one may be '3039 '(12345 decimal) when the source is not assigned, otherwise takes its corresponding source value.
Scheme for v3.x
(V32Compat=True)

|
Scheme for v4.x
(V32Compat=False)

|
The "Other Code" value corresponds to the "Other_Source" source. Finally as a last segment adds a checksum based on previous segments which later will validate the Installcode. This checksum is also saved into the Icode property. This string is then encrypted and made a string of 27 characters in length, 24 hexadecimal digits and 3 spacers to make it more readable, as the following example: DF8ACE-DC468A-4561A5-FD2D61
InternetPort : tipo word. 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 the following value:
INTERNET_DEFAULT_HTTPS_PORT (see the Demo1 source for the .dpr file). For example:
avlocks31.InternetPort := INTERNET_DEFAULT_HTTPS_PORT;
InternetFlag : type dword. 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
avlocks31.InternetFlag := INTERNET_FLAG_SECURE;
//Option 2
avlocks31.InternetFlag := INTERNET_FLAG_SECURE
or INTERNET_FLAG_IGNORE_CERT_CN_INVALID
or INTERNET_FLAG_IGNORE_CERT_DATE_INVALID;
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: tipo date (fecha). 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.
OtherCode : type word: The default value is 12345. If you check the Other_Source source into the InstallCodeSource property then you will need to set a value to this property at runtime when start your application. For more information see the InstallCode property.
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
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.
RandomCode : type word. Its default value is 12345, if activated Random_Code source this value is calculated the first time you run the application and stored with the registration data. It is one source of data for calculating the InstallCode.
I have tried make this help as clear and complete as possible, however they may have some issues not covered by this documentation. If seem you that I missed something or have found bugs or have any idea that might be useful to improve this help, please let me know.
|
Alcides Valega
Author of AVLock SIMPLE
|
|