Copyright: Copyright © 1997 TurboPower Software Co.
Citation: Copyright © 1997 TurboPower Software Co.


API Reference

ApplyModifierToKeyPrim

BufferToHex

BufferToHexBytes

CheckNetAccessFile

CreateNetAccessFile

CreateNetAccessFileEx

DecDaysCode

DecodeNAFCountCode

DecUsageCode

EncodeNAFCountCode

ExpandDate

GenerateDateModifierPrim

GenerateMachineModifierPrim

GenerateMD5KeyPrim

GenerateRandomKeyPrim

GenerateStringModifierPrim

GenerateTMDKeyPrim

GenerateUniqueModifierPrim

GetCodeType

GetDateCodeValue

GetDaysCodeValue

GetExpirationDate

GetNetAccessFileInfo

GetSerialNumberCodeValue

GetSpecialCodeValue

GetUsageCodeValue

HexStringIsZero

HexToBuffer

InitDateCode

InitDaysCode

InitRegCode

InitSerialNumberCode

InitSpecialCode

InitUsageCode

IsAppOnNetwork

IsDateCodeExpired

IsDateCodeValid

IsDaysCodeExpired

IsDaysCodeValid

IsRegCodeExpired

IsRegCodeValid

IsSerialNumberCodeExpired

IsSerialNumberCodeValid

IsSpecialCodeExpired

IsSpecialCodeValid

IsUsageCodeExpired

IsUsageCodeValid

LockNetAccessFile

ResetNetAccessFile

ShrinkDate

StringHashElf

UnlockNetAccessFile


ApplyModifierToKeyPrim

procedure ApplyModifierToKeyPrim (Modifier : LongInt; var Key; KeySize : Cardinal);

 ApplyModifierToKeyPrim Xor's the Modifier value with the Key returning the modified key as the Key parameter.

Use this routine to sign a key.

KeySize if the size of the key in bytes

This routine is defined in the OnGuard unit.


BufferToHex

function BufferToHex (const Buf; BufSize : Cardinal) : string;

 BufferToHex converts one or more bytes to hex.

Buf contains one or more bytes and BufSize if the number of bytes in Buf. The hexadecimal version of Buf is returned as the function result.

This routine is defined in the OgUtil unit.


BufferToHexBytes

function BufferToHexBytes (const Buf; BufSize : Cardinal) : string;

 BufferToHexBytes performs the same operation as the BufferToHex function except that the function result is formatted to represent an array of hexadecimal bytes separated by commas.

Example result: "$02, $67, $FF"

This routine is defined in the OgUtil unit.


CheckNetAccessFile

function CheckNetAccessFile (const NetAccess : TNetAccess) : Boolean;

TNetAccess = packed record
  Fh         : Integer;
  Key        : TKey;
  CheckValue : Word;
  Index      : Word;
end;

 CheckNetAccessFile verifies that the net access file referenced by NetAccess has at least one slot that is not in use.

If there is at least one open slot in the net access file, CheckNetAccessFile returns true, otherwise false.

This routine is defined in the OgNetWrk unit.


Contents

OnGuard is a library of components, classes, and routines that allow you to protect your applications after they are released to the public. Using OnGuard, you could release an application that is partially functional so that users can try it. When a user is ready to purchase the fully functional application, you supply a release code to unlock all of the features (or the subset that the user is purchasing). You can make your application readily available to a large number of potential users, but still protect your investment. Application protection is accomplished through the use of keys to lock or restrict one or more features of an application and several types of release codes (or access codes) to enable them.

Keys and Release Codes

TOgMakeKeys Component

TOgMakeCodes Component

Release Code Components

TOgCodeBase Class

TOgDateCode Component

TOgDaysCode Component

TOgNetCode Component

TOgRegistrationCode Component

TOgSerialNumberCode Component

TOgSpecialCode Component

TOgUsageCode Component

Detecting Changes to an EXE

TOgProtectExe Component

Single Instance Applications

OgFirst Unit

Low-Level Routines

API Reference


CreateNetAccessFile

function CreateNetAccessFile (const FileName : string; const Key : TKey; Count : Word) : Boolean;

 CreateNetAccessFile creates a net access for Count users file using FileName as the name of the file and Key to encode the file.

If a file with FileName as its name exists it is overwritten without warning.

This routine is defined in the OgNetWrk unit.


CreateNetAccessFileEx

function CreateNetAccessFileEx (const FileName : string; const Key : TKey; const Code : TCode) : Boolean;

 CreateNetAccessFileEx creates a net access file using the access count value from a previously encoded net access Code.

Key must be the same key that was used to create the code or the code is considered invalid.

This routine is defined in the OgNetWrk unit.


DecDaysCode

procedure DecDaysCode (const Key : TKey; var Code : TCode);

 DecDaysCode reduces the internal "days count" value by one and returns the modified code as the Code parameter.

Key must be the same key that was used to create the code or the code is considered invalid.

This routine is defined in the OnGuard unit.


DecUsageCode

procedure DecUsageCode (const Key : TKey; var Code : TCode);

 DecUsageCode reduces the internal "usage count" value by one and returns the modified code as the Code parameter.

Key must be the same key that was used to create the code or the code is considered invalid.

This routine is defined in the OnGuard unit.


DecodeNAFCountCode

function DecodeNAFCountCode (const Key : TKey; const Code : TCode) : LongInt;

 DecodeNAFCountCode uses Key to decode Code and returns the number of authorized users as the function result.

Key must be the same key that was used to create the code or the code is considered invalid. If the code is invalid, 0 is returned.

This routine is defined in the OgNetWrk unit.


EncodeNAFCountCode

procedure EncodeNAFCountCode (const Key : TKey; Count : Cardinal;  var Code : TCode);

 EncodeNAFCountCode uses Key to create and encode the usage Count value creating a network code.

The resulting code is returned as the Code parameter.

This routine is defined in the OgNetWrk unit.


ExpandDate

function ExpandDate (D : Word) : TDateTime;

 ExpandDate translates an OnGuard date offset to an actual date.

OnGuard uses a date offset to reduce the amount of space necessary to store a date. OnGuard creates a date offset by subtracting the TDateTime value for 1 January 1996 from the actual date.

Exceptions to the conversion rules are that a value of 0 expands to 1 January 9999 and date offsets larger than 65535 are represented as 0.

This routine is defined in the OnGuard unit.


GenerateDateModifierPrim

function GenerateDateModifierPrim (D : TDateTime) : LongInt;

 GenerateDateModifierPrim produces a key modifier based on the date D.

This routine is defined in the OnGuard unit.

This routine is defined in the OnGuard unit.


GenerateMD5KeyPrim

procedure GenerateMD5KeyPrim (var Key: TKey; const Str : string);

 GenerateMD5KeyPrim produces a Key by applying the MD5 hash to the string passed as Str

The routine is case sensitive.

This routine is defined in the OnGuard unit.


GenerateMachineModifierPrim

function GenerateMachineModifierPrim: LongInt;

 GenerateMachineModifierPrim produces a key modifier based on specific hardware information.

Information about hard disk capacity, network card serial number, and other items specific to a particular computer are used to create this value.

This routine is defined in the OnGuard unit.


GenerateRandomKeyPrim

procedure GenerateRandomKeyPrim (var Key; KeySize : Cardinal);

 GenerateRandomKeyPrim produces a Key using a random numbers.

This routine is defined in the OnGuard unit.


GenerateStringModifierPrim

function GenerateStringModifierPrim (const S : string) : LongInt;

 GenerateStringModifierPrim produces a key modifier by applying a hash algorithm to the string passed in S.

This routine is case sensitive.

This routine is defined in the OnGuard unit.


GenerateTMDKeyPrim

procedure GenerateTMDKeyPrim (var Key; KeySize : Cardinal; const Str : string);

 GenerateTMDKeyPrim produces key by applying a hash algorithm to the string passed in Str.

This routine is defined in the OnGuard unit.


GenerateUniqueModifierPrim

function GenerateUniqueModifierPrim: LongInt;

 GenerateUniqueModifierPrim produces a key modifier using random numbers.

This routine is defined in the OnGuard unit.


GetCodeType

function GetCodeType (const Key : TKey; const Code : TCode) : TCodeType;

TCodeType = (ctDate, ctDays, ctRegistration, ctSerialNumber, ctUsage, ctNetwork, ctSpecial, ctUnknown);

GetCodeType returns the type of code passed as the Code parameter.

Key must be the same key that was used when the code was created or ctUnknown is returned.

This routine is defined in the OnGuard unit.


GetDateCodeValue

function GetDateCodeValue (const Key : TKey; const Code : TCode) : TDateTime;

 GetDateCodeValue returns the expiration date stored in the Code.

Key must be the same key that was used to create the code or the code is considered invalid. If the code is invalid, 1 January 9999 is returned.

This routine is defined in the OnGuard unit.


GetDaysCodeValue

function GetDaysCodeValue (const Key : TKey; const Code : TCode) : LongInt;

GetDaysCodeValue returns the expiration date stored in the Code.

Key must be the same key that was used to create the code or the code is considered invalid. If the code is invalid, 0 is returned.

This routine is defined in the OnGuard unit.


GetExpirationDate

function GetExpirationDate (const Key : TKey; const Code : TCode) : TDateTime;

 GetExpirationDate returns the date that the code passed as the Code parameter expires.

If the code has no expiration date or is invalid, 1 January 9999 is returned.Key must be the same key that was used to create the code or the code is considered invalid.

This routine is defined in the OnGuard unit.


GetNetAccessFileInfo

function GetNetAccessFileInfo (const FileName : string; const Key : TKey; var NetAccessInfo : TNetAccessInfo) : Boolean;

TNetAccessInfo = packed record
  Total   : Cardinal;
  Locked  : Cardinal;
  Invalid : Cardinal;
end;

 GetNetAccessFileInfo obtains information about the specified network access file.

FileName is the name of an existing network access file and Key is the key that was used to create it. The network access file information is returne as the NetAccessInfo parameter and consists of the total number of access slots, the number of locked slots, and the number of invalid access slots. (An access slot becomes invalid when the application using it is terminated in a non-standard way.)

GetNetAccessFileInfo returns false if there was an error, otherwise true.

This routine is defined in the OgNetWrk unit.


GetSerialNumberCodeValue

function GetSerialNumberCodeValue (const Key : TKey; const Code : TCode) : LongInt;

 GetSerialNumberCodeValue returns the serial number that was used to create the Code.

Key must be the same key that was used to create the code or the code is considered invalid. If the code is invalid, 0 is returned.

This routine is defined in the OnGuard unit.


GetSpecialCodeValue

function GetSpecialCodeValue (const Key : TKey; const Code : TCode) : LongInt;

 GetSpecialCodeValue returns the value that was used to create the Code.

Key must be the same key that was used to create the code or the code is considered invalid. If the code is invalid, 0 is returned.

This routine is defined in the OnGuard unit.


GetUsageCodeValue

function GetUsageCodeValue (const Key : TKey; const Code : TCode) : LongInt;

 GetUsageCodeValue returns the current usage count value store in the Code.

Key must be the same key that was used to create the code or the code is considered invalid. If the code is invalid, 0 is returned.

This routine is defined in the OnGuard unit.


HexStringIsZero

function HexStringIsZero (const Hex : string) : Boolean;

 HexStringIsZero returns true if the hexadecimal string passed as Hex consists entirely of 0's, otherwise false.

This routine is defined in the OgUtil unit.


HexToBuffer

function HexToBuffer (const Hex : string; var Buf; BufSize : Cardinal) : Boolean;

 HexToBuffer converts the hexadecimal string in Hex to bytes that are stored in Buf.

Punctuation ($, spaces, commas, parentheses, ...)  is ignored.

BufSize is the number of bytes to store in Buf and must be the number of hexadecimal bytes in Hex. If an error occurs, false is returned, otherwise true.

This routine is defined in the OgUtil unit.


InitDateCode

procedure InitDateCode (const Key : TKey; StartDate, EndDate : TDateTime; var Code : TCode);

 InitDateCode creates and initializes a date code using Key, StartDate, and EndDate.

The resulting code is valid for dates between StartDate and  EndDate inclusive.

This routine is defined in the OnGuard unit.


InitDaysCode

procedure InitDaysCode (const Key : TKey; Days : Word; Expires : TDateTime; var Code : TCode);

 InitDaysCode creates and initializes a days code using Key, Days, and Expires.

Days is stored as part of the Code.

The resulting code is valid for the number of days of use specified in the Days parameter and until the date stored in Expires is reached.

This routine is defined in the OnGuard unit.


InitRegCode

procedure InitRegCode (const Key : TKey; const RegStr : string; Expires : TDateTime; var Code : TCode);

 InitRegCode creates and initializes a registration code using Key, RegStr, and Expires.

The code stores a hash value that was derived from RegStr. RegStr cannot be extracted from the code.

The resulting code is valid until the date stored in Expires is reached.

This routine is defined in the OnGuard unit.


InitSerialNumberCode

procedure InitSerialNumberCode (const Key : TKey;  Serial : LongInt; Expires : TDateTime; var Code : TCode);

 InitSerialNumberCode creates and initializes a serial number code using Key, Serial, and Expires.

Serial is stored as part of the Code.

The resulting code is valid until the date stored in Expires is reached.

This routine is defined in the OnGuard unit.


InitSpecialCode

procedure InitSpecialCode (const Key : TKey; Value : LongInt; Expires : TDateTime; var Code : TCode);

 InitSpecialCode creates and initializes a special code using Key, Value, and Expires.

Value is stored as part of the Code.

The resulting code is valid until the date stored in Expires is reached.

This routine is defined in the OnGuard unit.


InitUsageCode

procedure InitUsageCode (const Key : TKey; Count : LongInt; Expires : TDateTime; var Code : TCode);

 InitUsageCode creates and initializes a usage code using Key, Count, and Expires.

Count is stored as part of the Code.

The resulting code is valid until the internal Count is 0 or the date stored in Expires is reached.

This routine is defined in the OnGuard unit.


IsAppOnNetwork

function IsAppOnNetwork (const ExePath : string) : Boolean;

 IsAppOnNetwork returns true if the drive specified in ExePath is a remote drive, otherwise false.

This routine is defined in the OgNetWrk unit.


IsDateCodeExpired

function IsDateCodeExpired (const Key : TKey; const Code : TCode) : Boolean;

 IsDateCodeExpired returns true if the Code has expired, otherwise false.

Key must be the same key that was used to create the code or the code is considered invalid. If the code is invalid, this function returns true.

This routine is defined in the OnGuard unit.


IsDateCodeValid

function IsDateCodeValid (const Key : TKey; const Code : TCode) : Boolean;

 IsDateCodeValid returns true if Code is a valid date code, otherwise false.

Key must be the same key that was used to create the code or the code is considered invalid.

This routine is defined in the OnGuard unit.


IsDaysCodeExpired

function IsDaysCodeExpired (const Key : TKey; const Code : TCode) : Boolean;

 IsDaysCodeExpired returns true if the Code has expired, otherwise false.

Key must be the same key that was used to create the code or the code is considered invalid. If the code is invalid, this function returns true.

This routine is defined in the OnGuard unit.


IsDaysCodeValid

function IsDaysCodeValid (const Key : TKey; const Code : TCode) : Boolean;

 IsDaysCodeValid returns true if Code is a valid days code, otherwise false.

Key must be the same key that was used to create the code or the code is considered invalid.

This routine is defined in the OnGuard unit.


IsRegCodeExpired

function IsRegCodeExpired (const Key : TKey; const Code : TCode) : Boolean;

 IsRegCodeExpired returns true if the Code has expired, otherwise false.

Key must be the same key that was used to create the code or the code is considered invalid. If the code is invalid, this function returns true.

This routine is defined in the OnGuard unit.


IsRegCodeValid

function IsRegCodeValid (const Key : TKey; const Code : TCode) : Boolean;

 IsRegCodeValid returns true if Code is a valid registration code, otherwise false.

Key must be the same key that was used to create the code or the code is considered invalid.

This routine is defined in the OnGuard unit.


IsSerialNumberCodeExpired

function IsSerialNumberCodeExpired (const Key : TKey; const Code : TCode) : Boolean;

 IsSerialNumberCodeExpired returns true if the Code has expired, otherwise false.

Key must be the same key that was used to create the code or the code is considered invalid. If the code is invalid, this function returns true.

This routine is defined in the OnGuard unit.


IsSerialNumberCodeValid

function IsSerialNumberCodeValid (const Key : TKey; const Code : TCode) : Boolean;

 IsSerialNumberCodeValid returns true if Code is a valid serial number code, otherwise false.

Key must be the same key that was used to create the code or the code is considered invalid.

This routine is defined in the OnGuard unit.


IsSpecialCodeExpired

function IsSpecialCodeExpired (const Key : TKey; const Code : TCode) : Boolean;

 IsSpecialCodeExpired returns true if the Code has expired, otherwise false.

Key must be the same key that was used to create the code or the code is considered invalid. If the code is invalid, this function returns true.

This routine is defined in the OnGuard unit.


IsSpecialCodeValid

function IsSpecialCodeValid (const Key : TKey; const Code : TCode) : Boolean;

 IsSpecialCodeValid returns true if Code is a valid special code, otherwise false.

Key must be the same key that was used to create the code or the code is considered invalid.

This routine is defined in the OnGuard unit.


IsUsageCodeExpired

function IsUsageCodeExpired (const Key : TKey; const Code: TCode) : Boolean;

 IsUsageCodeExpired returns true if the Code has expired, otherwise false.

Key must be the same key that was used to create the code or the code is considered invalid. If the code is invalid, this function returns true.

This routine is defined in the OnGuard unit.


IsUsageCodeValid

function IsUsageCodeValid (const Key : TKey; const Code : TCode) : Boolean;

 IsUsageCodeValid returns true if Code is a valid usage code, otherwise false.

Key must be the same key that was used to create the code or the code is considered invalid.

This routine is defined in the OnGuard unit.


LockNetAccessFile

function LockNetAccessFile (const FileName : string; const Key : TKey; var NetAccess : TNetAccess) : Boolean;

TNetAccess = packed record
  Fh         : Integer;
  Key        : TKey;
  CheckValue : Word;
  Index      : Word;
end;

 LockNetAccessFile locks an access slot in the network access file specified by FileName and returns false if an error occurs.

This routine is defined in the OgNetWrk unit.


OgFirst Unit

The OgFirst unit provides routines that allow you to detect when a second instance of an application is being executed and to force the previous instance of the application to become the active application.

ActivateFirstInstance

IsFirstInstance


OgFirst.ActivateFirstInstance
ActivateFirstInstance

procedure OgFirst.ActivateFirstInstance;  {32-bit version}

procedure OgFirst.ActivateFirstInstance(const MainWindowCaption, MainWindowClass : string);  {16-bit version}

ActivateFirstInstance locates an application’s main window and then makes it the active window.

ActivateFirstInstance forces the window with the specified caption and class to the top of the z-Order and gives it the focus. This method is normally called after detecting that a second instance of the application was executed and subsequently halted. Calling ActivateFirstInstance gives the appearance that running the application a second time succeeded.

The 32-bit version of ActivateFirstInstance does not take any parameters and automatically locates the application’s main window. The 16-bit version of this routine requires that the class name and caption of the main form be passed as arguments.


OgFirst.IsFirstInstance
IsFirstInstance

function OgFirst.IsFirstInstance : Boolean;

 IsFirstInstance determines whether this is the first instance of a program.

This method should be called prior to creating any forms so that the application can be terminated if necessary. IsFirstInstance returns True if this is the first instance of the application.

If IsFirstInstance returns False, you can call ActivateFirstInstance to activate the prior instance of the application.


ResetNetAccessFile

function ResetNetAccessFile (const FileName : string; const Key : TKey) : Boolean;

 ResetNetAccessFile resets invalid access slots by clearing there "in-uses" status.

Access slots that are currently "in-use" are skipped.

This routine is defined in the OgNetWrk unit.


ShrinkDate

function ShrinkDate (D : TDateTime) : Word;

ShrinkDate translates a date to an OnGuard date offset.

OnGuard uses a date offset to reduce the amount of space necessary to store a date. OnGuard creates a date offset by subtracting the TDateTime value for 1 January 1996 from the actual date.

Exceptions to the conversion rules are that a value of 0 expands to 1 January 9999 and date offsets larger than 65535 are represented as 0.

This routine is defined in the OnGuard unit.


StringHashElf

function StringHashElf (const Str : string) : LongInt;

StringHashElf produces a hash value based on the text passed in Str.

This routine is defined in the OnGuard unit.


TOgCodeBase Class

See also: properties, events, methods

The TOgCodeBase class is the ancestor class for the other "release code" components. It implements several properties and methods that are common for all of its descendants.


TOgCodeBase Events

OnChecked

OnGetKey

OnGetCode

OnGetModifier


TOgCodeBase Methods

CheckCode

IsCodeValid


TOgCodeBase Properties

AutoCheck

Code

Modifier

StoreCode

StoreModifier


TOgCodeBase.AutoCheck
AutoCheck property

property TOgCodeBase.AutoCheck : Boolean

Default: False

AutoCheck determines whether CheckCode is called automatically.

If AutoCheck is True, CheckCode is automatically called after the form containing this component is loaded. If AutoCheck is False, you are responsible for calling CheckCode to determine the component status.

See also: CheckCode


TOgCodeBase.CheckCode
CheckCode method

function TOgCodeBase.CheckCode(Report : Boolean) : TCodeStatus; virtual; abstract;

TCodeStatus = (ogValidCode, ogInvalidCode, ogPastEndDate, ogDayCountUsed, ogRunCountUsed, ogNetCountUsed, ogCodeExpired);

CheckCode checks for a valid release code.

CheckCode is defined as virtual and abstract, which means that each descendant component overrides it to provide the necessary code to validate and test the release code obtained through the Code property. If Report is True, the result of the test is reported by triggering the OnChecked event. If Report is False, you must check the function result.

CheckCode requires several pieces of information, which it obtains by triggering event handlers that you define. The normal sequence of events performed by CheckCode is:

1.	Trigger the OnGetKey event to get the key used to encode and decode the release code. The key should always be embedded in the application as a constant.

2.	Trigger the OnGetCode event to get the release code. The release code is normally stored in the registry or an INI file.

3.	Trigger the OnGetModifier event to get the key modifier. The modifier can be stored as a constant in the application, stored in the registry or INI file, or generated when it is needed.

4.	Apply the modifier to the key.

5.	Test the release code to see if it is valid.

6.	Test the release code to see if it has expired. The details of this test depend on the type of release code.

The result of calling CheckCode is one of the following values:

ogValidCode	The release code is valid.
ogInvalidCode	The release code is invalid (the internal integrity check failed).
ogPastEndDate	The ending date has past.
ogDayCountUsed	The authorized days have been used.
ogRunCountUsed	The authorized runs have been used.
ogNetCountUsed	The number of authorized users has been exceeded.
ogCodeExpired	The expiration date has been reached.
See also: AutoCheck, OnChecked, OnGetCode, OnGetKey, OnGetModifier


TOgCodeBase.Code
Code property

property TOgCodeBase.Code : string

Code is the release code.

Code is normally generated by another program, encoded using the application’s key, and given to the user to enter into the application where it is decoded and validated. The behavior of the application when a code is entered is entirely up to you, the designer, and is also determined to some extent by the type of code being used.

Code is published as needed by descendent components.

See also: OnGetCode, StoreCode


TOgCodeBase.IsCodeValid
IsCodeValid method

function TOgCodeBase.IsCodeValid : Boolean;

IsCodeValid tests to see if the release code is valid.

IsCodeValid calls the CheckCode method and tests its result to see if the release code is valid. It returns True if the code is valid, otherwise False. Descendent components decode the release code and test to see if the signature value (the magic value as defined in the TCode record) is still valid.

You might need to perform additional tests to ensure that the data used to create the release code was not altered. For example, you could test whether the text string used to create a Simple Registration release code was altered. Since the string is not part of the release code (only a number derived from the string is embedded into the code), you cannot compare it to what is stored in the release code. You must create a temporary release code using the text string and the same expiration date and then compare the temporary release code to the stored one. If they don’t match, someone has altered the text string.

See also: CheckCode


TOgCodeBase.Modifier
Modifier property

property TOgCodeBase.Modifier : LongInt

Modifier is used to sign the key.

If Modifier is equal to 0, the key is not altered. If Modifier is not equal to 0, it is used to sign the key. Modifier is normally generated as needed, but can be stored on the stream with the form if the StoreModifier property is True.

See also: OnGetModifier, StoreModifier


TOgCodeBase.OnChecked
OnChecked event

property TOgCodeBase.OnChecked : TCheckedCodeEvent

TCheckedCodeEvent = procedure(Sender : TObject; Status : TCodeStatus) of object;

OnChecked defines an event handler that is called after the release code is checked.

Sender is the instance of the release code component. Status is the value returned by a call to CheckCode.

See also: CheckCode


TOgCodeBase.OnGetCode
OnGetCode event

property TOgCodeBase.OnGetCode : TGetCodeEvent

TGetCodeEvent = procedure(Sender : TObject; var Code : TCode) of object;

OnGetCode defines an event handler that is called to get the release code.

Sender is the instance of the release code component. Code is the TCode value associated with this component. Release codes are normally stored in a file or the registry. In some cases, the release code can be stored in the resource. To do this, set the StoreCode property to True.

See also: Code, StoreCode


TOgCodeBase.OnGetKey
OnGetKey event

property TOgCodeBase.OnGetKey : TGetKeyEvent

TGetKeyEvent = procedure(Sender : TObject; var Key : TKey) of object;

OnGetKey defines an event handler that is called to get the key.

Sender is the instance of the release code component.

The key should always be stored as a constant in the application and never stored in the form, a file, or the registry. Putting the key anywhere except in the application increases the chances that someone will find and be able to use it to decode the release code.


TOgCodeBase.OnGetModifier
OnGetModifier event

property TOgCodeBase.OnGetModifier : TGetModifierEvent

TGetModifierEvent = procedure(Sender : TObject; var Value : LongInt) of object;

OnGetModifier defines an event handler that is called to get the modifier.

Sender is the instance of the release code component. Value is the modifier that is used to sign the key. Modifier is normally generated as needed, but can be stored on the stream with the form if the StoreModifier property is True.

See also: Modifier, StoreModifier


TOgCodeBase.StoreCode
StoreCode property

property TOgCodeBase.StoreCode : Boolean

Default: False

StoreCode determines whether the release code is stored in the resource file.

StoreCode is published as needed by descendants.

See also: Code, OnGetCode


TOgCodeBase.StoreModifier
StoreModifier property

property TOgCodeBase.StoreModifier : Boolean

Default: False

StoreModifier determines whether the modifier is stored in the resource file.

See also: Modifier, OnGetModifier


TOgDateCode Component

See also: properties, events, methods

TOgDateCode implements a Start/End Date release code. Use this release code when you need to limit the amount of time that an application (or specific features of an application) can be used. Both a start date and an end date are encoded into this release code. This allows you to detect a change to the computer’s clock that results in a date outside of the date range or an attempt to alter the registry or INI file entry.


TOgDateCode Events

OnChecked

OnGetKey

OnGetCode

OnGetModifier


TOgDateCode Methods

CheckCode

GetValue

IsCodeValid


TOgDateCode Properties

AutoCheck

Code

Modifier

StoreCode

StoreModifier


TOgDateCode.GetValue
GetValue method

function TOgDateCode.GetValue : TDateTime;

GetValue returns the end date embedded in the release code.

The returned value is a Delphi TDateTime value.


TOgDaysCode Component

See also: properties, events, methods

TOgDaysCode implements a Number of Days Used release code. This release code limits the number of days that an application (or specific features) can be used. The application can be run an unlimited number of times each day.


TOgDaysCode Events

OnChangeCode

OnChecked

OnGetKey

OnGetCode

OnGetModifier


TOgDaysCode Methods

CheckCode

Decrease

GetValue

IsCodeValid


TOgDaysCode Properties

AutoCheck

AutoDecrease

Code

StoreCode


TOgDaysCode.AutoDecrease
AutoDecrease property

property TOgDaysCode.AutoDecrease : Boolean

Default: True

AutoDecrease determines whether the day count value is automatically decreased each day the application is run.

If AutoDecrease is True, the day count embedded in the release code is automatically decreased by one each day the application is run. This is accomplished by calling the Decrease method. If AutoDecrease is False, you must call the Decrease method manually whenever necessary.

See also: Decrease


TOgDaysCode.Decrease
Decrease method

procedure TOgDaysCode.Decrease;

Decrease reduces the day count value stored in the release code.

Performing this action requires several vital pieces of information, which are normally obtained by triggering several event handlers that you define. The normal sequence of events performed by Decrease is:

1.	Trigger the OnGetKey event to get the key used to encode and decode the release code. The key should always be embedded in the application as a constant.

2.	Trigger the OnGetCode event to get the release code. The release code is normally stored in the registry or an INI file.

3.	Trigger the OnGetModifier event to get the key modifier. The modifier can be stored as a constant in the application, stored in the registry or INI file, or generated when it is needed.

4.	Apply the modifier to the key.

5.	Test the code to see if it is valid.

6.	Decrease the day count by one if it has not already been decreased today.

7.	Trigger the OnChangeCode event to store the changed release code.

See also: OnChangeCode, OnGetCode, OnGetKey, OnGetModifier


TOgDaysCode.GetValue
GetValue method

function TOgDaysCode.GetValue : LongInt;

GetValue returns the day count embedded in the release code.

The value returned is the number of days remaining.


TOgDaysCode.OnChangeCode
OnChangeCode event

property OnChangeCode : TChangeCodeEvent

TChangeCodeEvent = procedure(Sender : TObject; Code : TCode) of object;

OnChangeCode defines an event handler that is called when a release code changes.

This event is fired after the release code is changed via a call to Decrease, either directly or automatically (if the AutoDecrease property is True).

Sender is the instance of the release code component. Code is the new release code value.

The release code should be saved in an INI file or the registry.

See also: AutoDecrease, Decrease


TOgMakeCodes Component

See also: properties, methods

TOgMakeCodes is a non-visual component that displays a dialog when its Execute method is called. The dialog allows you to create several types of release codes. Each release code consists of 8 bytes and is viewed and entered as 16 hexadecimal digits.


TOgMakeCodes Methods

Execute


TOgMakeCodes Properties

Code

CodeType

Key

KeyFileName

KeyType

ShowHints


TOgMakeCodes.Code
Code property

property TOgMakeCodes.Code : TCode

TCode = packed record
  CheckValue : Word;               {magic value}
  Expiration : Word;               {expiration date or 0, if none}
  case Byte of
    0 : (FirstDate    : Word;      {for date code}
         EndDate      : Word);
    1 : (Days         : Word;      {for days code}
         LastAccess   : Word);
    2 : (RegString    : LongInt);  {for reg code}
    3 : (SerialNumber : LongInt);  {for serial number code}
    4 : (UsageCount   : Word;  {for usage count code}
         (LastChange   :Word);
    5 : (Value        : LongInt);  {for special codes}
    6 : (NetIndex     : LongInt);  {for net codes}
end;

 Code is the generated release code.

After a successful call to Execute, Code contains the generated release code.

Code can represent any one of several release code types. Use the CodeType property to determine which code type was generated.

See also: CodeType, Execute


TOgMakeCodes.CodeType
CodeType property

property TOgMakeCodes.CodeType : TCodeType

TCodeType = (ctDate, ctDays, ctRegistration, ctSerialNumber, ctUsage, ctNetwork, ctSpecial, ctUnknown);

Default: ctDate

CodeType is the type of release code.

If you assign a value to CodeType prior to calling Execute, the corresponding notebook page is displayed in the Code Generation dialog. After a successful call to Execute, CodeType contains the type of code that was generated. The ctUnknown code type is only used internally.

See also: Execute


TOgMakeCodes.Execute
Execute method

function TOgMakeCodes.Execute : Boolean;

Execute displays the Code Generation dialog.

Use this method to display the Code Generation dialog so that a release code can be generated.

If Execute returns True, the Code and CodeType properties contain valid values. Otherwise, the contents of these properties is unknown.

See also: Code, CodeType


TOgMakeCodes.Key
Key run-time property

property TOgMakeCodes.Key : TKey

TKey = array [0..15] of Byte;

Key is used to encode and decode the release code.

The key used to encode release codes should be protected from unauthorized use because a release code that was encoded without a modifier can easily be decoded using the key.

The key should be embedded into the application rather than stored in a file or resource.

If no value is assigned to this property, the Key Maintenance dialog is displayed so that a key can be selected or created.

See also: Code


TOgMakeCodes.KeyFileName
KeyFileName property

property TOgMakeCodes.KeyFileName : string

KeyFileName is the name of the INI file used to store application names and their associated keys.

If a valid file name is assigned to this property, its contents are displayed when the Key Maintenance dialog is displayed.


TOgMakeCodes.KeyType
KeyType run-time property

property TOgMakeCodes.KeyType : TKeyType

TKeyType = (ktRandom, ktMessageDigest, ktMessageDigestCS);

Default: ktMessageDigest

KeyType determines the type of key to generate.

The valid key types are:

ktRandom	The key is generated using Delphi’s random number generator.
ktMessageDigest (Standard Text)	The key is generated by using the supplied text. Text case is ignored.
KtMessageDigestCS (Case-Sensitive Text)	The key is generated by using the supplied text. Text case is considered.
If a value is assigned to this property, it is used to determine the type of key to generate when the Key Maintenance dialog is displayed.


TOgMakeCodes.ShowHints
ShowHints property

property TOgMakeCodes.ShowHints : Boolean

Default: False

ShowHints determines whether hints are shown for the TOgMakeCodes dialogs.


TOgMakeKeys Component

See also: properties, methods

TOgMakeKeys is a non-visual component that displays a dialog when its Execute method is called. The dialog allows you to create and maintain keys. Keys are used to encode and decode the release codes that the other OnGuard components use.


TOgMakeKeys Methods

ApplyModifierToKey

Execute

GenerateDateModifier

GenerateKey

GenerateMachineModifier

GenerateRandomKey

GenerateStringModifier

GenerateUniqueModifier


TOgMakeKeys Properties

Key

KeyFileName

KeyType

ShowHints


TOgMakeKeys.ApplyModifierToKey
ApplyModifierToKey method

procedure TOgMakeKeys.ApplyModifierToKey (Modifier : LongInt; var Key; KeySize : Cardinal);

ApplyModifierToKey alters the specified key.

If Modifier is not zero, this routine alters (signs) the key specified by Key. KeySize is the size, in bytes, of Key .

This routine is used automatically by the components that generate a release code when a non-zero value is specified for the Modifier property.

See also: GenerateDateModifier, GenerateMachineModifier, GenerateStringModifier, GenerateUniqueModifier, Key


TOgMakeKeys.Execute
Execute method

function TOgMakeKeys.Execute: Boolean;

Execute displays the Key Maintenance dialog.

Use this method to display the Key Maintenance dialog so that a key can be generated. The dialog is described in the "Creating and Maintaining Keys" section of the manual.

If Execute returns True, the Key, KeyFileName, and KeyType properties contain valid values. Otherwise, the contents of these properties is unknown.

See also: Key, KeyFileName, KeyType


TOgMakeKeys.GenerateDateModifier
GenerateDateModifier method

function TOgMakeKeys.GenerateDateModifier: LongInt;

GenerateDateModifier creates a key modifier based on the current date.

This routine is also available as a function (GenerateDateModifierPrim) for use in applications that need to generate modifiers dynamically.

See also: ApplyModifierToKey, GenerateMachineModifier, GenerateStringModifier, GenerateUniqueModifier


TOgMakeKeys.GenerateKey
GenerateKey method

procedure TOgMakeKeys.GenerateKey (var Key; KeySize : Cardinal; const Str : string);

GenerateKey produces a key based on a supplied text string.

To produce keys that are not case dependent, convert the text to upper case prior to calling GenerateKey.

See also: ApplyModifierToKey, GenerateRandomKey, Key


TOgMakeKeys.GenerateMachineModifier
GenerateMachineModifier method

function TOgMakeKeys.GenerateMachineModifier: LongInt;

GenerateMachineModifier creates a key modifier based on the hardware information for the current machine.

GenerateMachineModifier uses hard disk volume sizes, volume serial numbers, registration name/company as reported by Windows, and the network card ID (if available) to produce a modifier specific to a single machine.

Use this modifier to sign the key used to encode and decode release codes if you want the release code to restrict usage to a single machine.

M Caution: If hardware is changed on the machine, the modifier changes, rendering the release code, and consequently the application, unusable.

This routine is also available as a function (GenerateMachineModifierPrim) for use in applications that need to generate modifiers dynamically.

See also: ApplyModifierToKey, GenerateDateModifier, GenerateStringModifier, GenerateUniqueModifier


TOgMakeKeys.GenerateRandomKey
GenerateRandomKey method

procedure TOgMakeKeys.GenerateRandomKey(var Key; KeySize : Cardinal);

GenerateRandomKey produces a key based on Delphi’s internal random number generator.

See also: ApplyModifierToKey, GenerateKey, Key


TOgMakeKeys.GenerateStringModifier
GenerateStringModifier method

function TOgMakeKeys.GenerateStringModifier (const S : string) : LongInt;

GenerateStringModifier creates a key modifier based on the supplied string.

This routine is also available as a function (GenerateStringModifierPrim) for use in applications that need to generate modifiers dynamically.

See also: ApplyModifierToKey, GenerateDateModifier, GenerateMachineModifier, GenerateUniqueModifier


TOgMakeKeys.GenerateUniqueModifier
GenerateUniqueModifier method

function TOgMakeKeys.GenerateUniqueModifier: LongInt;

GenerateUniqueModifier creates a unique key modifier.

This routine is also available as a function (GenerateUniqueModifierPrim) for use in applications that need to generate modifiers dynamically.

See also: ApplyModifierToKey, GenerateDateModifier, GenerateMachineModifier, GenerateStringModifier


TOgMakeKeys.Key
Key run-time property

property TOgMakeKeys.Key : TKey

TKey = array [0..15] of Byte;

Key is used to encode and decode release codes.

After a successful call to Execute, Key contains the selected key value.

The key used to encode release codes should be protected from unauthorized use because a release code that was encoded without a modifier can easily be decoded using the key.

The key should be embedded into the application rather than stored in a file or resource.

See also: ApplyModifierToKey, Execute, GenerateKey, GenerateRandomKey


TOgMakeKeys.KeyFileName
KeyFileName property

property TOgMakeKeys.KeyFileName : string

KeyFileName is the name of the INI file used to store application names and their associated keys.

If a valid file name is assigned to this property, its contents are displayed when the Key Maintenance dialog is displayed.


TOgMakeKeys.KeyType
KeyType property

property TOgMakeKeys.KeyType : TKeyType

TKeyType = (ktRandom, ktMessageDigest, ktMessageDigestCS);

Default: ktMessageDigest

KeyType determines the type of key to generate.

After a successful call to Execute, KeyType contains one of these key types.

ktRandom	The key is generated using Delphi’s random number generator.
ktMessageDigest (Standard Text)	The key is generated by using the supplied text. Text case is ignored.
ktMessageDigestCS (Case-Sensitive Text)	The key is generated by using the supplied text. Text case is considered.
If a value is assigned to this property, it is used to determine the type of key to generate when the Key Maintenance dialog is displayed.

See also: Execute


TOgMakeKeys.ShowHints
ShowHints property

property TOgMakeKeys.ShowHints : Boolean

Default: False

ShowHints determines whether hints are shown for the TOgMakeKeys dialogs.


TOgNetCode Component

See also: properties, events, methods

TOgNetCode implements a Network Metering release code. This release code limits the number of concurrent instances of an application that are allowed to run on a network. It does this through the use of a network release code and a Network Access File. The use of a network release code is no different than other release codes, but there are additional maintenance issues related to the network file that your application must handle.


TOgNetCode Events

OnChecked

OnGetKey

OnGetCode

OnGetModifier


TOgNetCode Methods

CheckCode

IsCodeValid

IsRemoteDrive

ResetAccessFile


TOgNetCode Properties

ActiveUsers

AutoCheck

Code

FileName

InvalidUsers

MaxUsers

Modifier

StoreCode

StoreModifier


TOgNetCode.ActiveUsers
ActiveUsers read-only property

property TOgNetCode.ActiveUsers : LongInt

ActiveUsers is the current number of users running the application.


TOgNetCode.FileName
FileName property

property TOgNetCode.FileName : string

FileName is the name of the Network Access File.

The Network Access File is used to determine if another instance of the application is authorized. If the file specified in FileName does not exist, it is created and initialized during the call to CheckCode.


TOgNetCode.InvalidUsers
InvalidUsers read-only property

property TOgNetCode.InvalidUsers : LongInt

InvalidUsers is the number of invalid user access slots in the Network Access File.

Invalid slots are created when the user does not exit the application normally. Use ResetAccessFile to fix these invalid slots.

See also: ResetAccessFile


TOgNetCode.IsRemoteDrive
IsRemoteDrive method

function TOgNetCode.IsRemoteDrive(const ExePath : string) : Boolean;

IsRemoteDrive determines whether ExePath resides on a remote disk drive.

You can use IsRemoteDrive to determine if your application is being run from a remote disk drive. Only the drive information passed in ExePath is used.


TOgNetCode.MaxUsers
MaxUsers read-only property

property TOgNetCode.MaxUsers : LongInt

MaxUsers is the maximum number of concurrent users of the application.


TOgNetCode.ResetAccessFile
ResetAccessFile method

function TOgNetCode.ResetAccessFile : Boolean;

ResetAccessFile resets the invalid slots in the Network Access File.

If the operation is successful, the return value is True. If the file could not be opened for write access, the return value is False.

Calling ResetAccessFile does not effect active users. Since their access slots are in use, they are assumed to be valid and are not reset.


TOgProtectExe Component

See also: properties, events, methods

The TOgProtectExe component allows you to detect changes to your EXE file. The size of the EXE file and a 32-bit CRC (Cyclical Redundancy Check) value are recorded in the EXE file and checked each time the application is run.


TOgProtectExe Events

OnChecked


TOgProtectExe Methods

CheckExe

StampExe

UnStampExe


TOgProtectExe Properties

AutoCheck

CheckSize


TOgProtectExe.AutoCheck
AutoCheck property

property TOgProtectExe.AutoCheck : Boolean

Default: False

AutoCheck determines whether CheckExe is called automatically.

If AutoCheck is True, CheckExe is called after the form containing this component is loaded. If AutoCheck is False, you are responsible for calling CheckExe to determine the status of the executable file.

See also: CheckExe


TOgProtectExe.CheckExe
CheckExe method

function TOgProtectExe.CheckExe(Report : Boolean) : TExeStatus;

TExeStatus = (exeSuccess, exeSizeError, exeIntegrityError, exeNotStamped);

CheckExe tests to see if the executable file was altered.

If Report is True, the result of the test is reported by triggering the OnChecked event. If Report is False, you must check the function result.

The result of calling CheckExe is one of the following values:

exeSuccess	The executable file has not changed.
exeSizeError	The size of the executable file changed.
exeIntegrityError	One or more bytes in the executable changed.
exeNotStamped	The executable is not stamped with the CRC and size information.
See also: OnChecked


TOgProtectExe.CheckSize
CheckSize property

property TOgProtectExe.CheckSize : Boolean

Default: True

CheckSize determines whether the size of the executable is tested.

If CheckSize is True, the size and the CRC of the executable file are tested. If CheckSize is False, only the CRC of the executable file is tested.


TOgProtectExe.OnChecked
OnChecked event

property TOgProtectExe.OnChecked : TCheckedExeEvent

TCheckedExeEvent = procedure(Sender : TObject; Status : TExeStatus) of object;

OnChecked defines an event handler that is called after the executable is checked.

Sender is the instance of the release code component. Status is the value returned by a call to CheckExe.

See also: CheckExe


TOgProtectExe.StampExe
StampExe method

function TOgProtectExe.StampExe (const FileName : string ; EraseMarker : Boolean) : Boolean;

StampExe marks the executable program with its size and a CRC value.

StampExe searches for a special marker that is used to mark the record where the size and CRC value are stored, calculates the executable’s size and CRC, and writes that information back to the record. If EraseMarker is True, the special marker used to locate the record is erased.

This method is not used by the TOgProtectExe component. It is provided so that you can use it to stamp the application you want to protect. You can write a simple application that uses StampExe to stamp the application you want to protect. Or you can use the STAMPEXE example project (which uses the StampExe method) to stamp the application you want to protect.

See also: UnStampExe


TOgProtectExe.UnStampExe
UnStampExe method

function TOgProtectExe.UnStampExe (const FileName : string) : Boolean;

UnStampExe reverses the effect of a call to StampExe.

UnStampExe can only be used if the special marker used to locate the CRC record was not erased by StampExe.

This method is not used by the TOgProtectExe component. It is provided so that you can use it unstamp an application.

See also: StampExe


TOgRegistrationCode Component

See also: properties, events, methods

TOgRegistrationCode implements a Simple Registration release code. This release code ties the user’s name, company name, or some other textual data to the registration code.


TOgRegistrationCode Events

OnChecked

OnGetKey

OnGetCode

OnGetModifier

OnGetRegString


TOgRegistrationCode Methods

CheckCode

IsCodeValid


TOgRegistrationCode Properties

AutoCheck

Code

Modifier

RegString

StoreCode

StoreModifier

StoreRegString


TOgRegistrationCode.OnGetRegString
OnGetRegString event

property TOgRegistrationCode.OnGetRegString : TGetRegStringEvent

TGetRegStringEvent = procedure(Sender : TObject; var Value : string) of object;

OnGetRegString defines an event handler that is called to get the registration string.

Sender is the instance of the release code component. Value is the registration string used to create the release code.


TOgRegistrationCode.RegString
RegString property

property TOgRegistrationCode.RegString : string

RegString is the registration string used to create the release code.

See also: OnGetRegString


TOgRegistrationCode.StoreRegString
StoreRegString property

property TOgRegistrationCode.StoreRegString : Boolean

Default: True

StoreRegString determines whether the registration string value is stored as a resource at design time.

If StoreRegString is True, the value of RegString is stored in the resource file along with the form. If StoreRegString is False, RegString is not stored and you must supply an OnGetRegString event handler so that the registration string can be retrieved when required.

See also: OnGetRegString, RegString


TOgSerialNumberCode Component

See also: properties, events, methods

TOgSerialNumberCode implements a Serial Number Registration release code. This release code ties a serial number to the release code. This release code is very similar to the Simple Registration release code. The only difference is in the data that is used as part of the code generation process. The Serial Number Registration release code uses a number instead of a text string.


TOgSerialNumberCode Events

OnChecked

OnGetKey

OnGetCode

OnGetModifier


TOgSerialNumberCode Methods

CheckCode

GetValue

IsCodeValid


TOgSerialNumberCode Properties

AutoCheck

Code

Modifier

StoreCode

StoreModifier


TOgSerialNumberCode.GetValue
GetValue method

function TOgSerialNumberCode.GetValue : LongInt;

GetValue returns the serial number embedded in the release code.

The value returned is the serial number that was used when the release code was created.


TOgSpecialCode Component

See also: properties, events, methods

TOgSpecialCode implements a Special Registration release code. This release code is based on a special value (a long integer) that can be used to indicate anything you like.


TOgSpecialCode Events

OnChecked

OnGetKey

OnGetCode

OnGetModifier


TOgSpecialCode Methods

CheckCode

GetValue

IsCodeValid


TOgSpecialCode Properties

AutoCheck

Code

Modifier

StoreCode

StoreModifier


TOgSpecialCode.GetValue
GetValue method

function TOgSpecialCode.GetValue : LongInt;

GetValue returns the special information embedded in the release code.

The returned value is a LongInt. The interpretation of the returned value is determined entirely by you.


TOgUsageCode Component

See also: properties, events, methods

TOgUsageCode implements a Usage Count release code. This release code limits the number of times an application can be executed.


TOgUsageCode Events

OnChangeCode

OnChecked

OnGetKey

OnGetCode

OnGetModifier


TOgUsageCode Methods

CheckCode

Decrease

GetValue

IsCodeValid


TOgUsageCode Properties

AutoCheck

AutoDecrease

Modifier

StoreModifier


TOgUsageCode.AutoDecrease
AutoDecrease property

property TOgUsageCode.AutoDecrease : Boolean

Default: True

AutoDecrease determines whether the usage count value is automatically decreased each time the application is run.

If AutoDecrease is True, the usage count value embedded in the release code is automatically decreased by one each time the application is run. When the usage count is reduced to zero, the release code is expired. If AutoDecrease is False, you must call the Decrease method manually whenever necessary.

See also: Decrease


TOgUsageCode.Decrease
Decrease method

procedure TOgUsageCode.Decrease;

Decrease reduces the usage count value stored in the release code.

Performing this action requires several vital pieces of information, which are normally obtained by triggering several event handlers that you define. The normal sequence of events performed by Decrease is:

1.	Trigger the OnGetKey event to get the key used to encode and decode the release code. The key should always be embedded in the application as a constant.

2.	Trigger the OnGetCode event to get the release code. The code is normally stored in the registry or an INI file.

3.	Trigger the OnGetModifier event to get the key modifier. The key modifier can be stored as a constant in the application, stored in the registry or INI file, or generated when it is needed.

4.	Apply the modifier to the key.

5.	Test the release code to see if it is valid.

6.	Decrease the usage count by one.

7.	Trigger the OnChangeCode event to store the changed release code.

See also: OnChangeCode, OnGetCode, OnGetKey, OnGetModifier,


TOgUsageCode.GetValue
GetValue method

function TOgUsageCode.GetValue : LongInt;

GetValue returns the usage count embedded in the release code.

The value returned is the number of runs remaining.


TOgUsageCode.OnChangeCode
OnChangeCode event

property TOgUsageCode.OnChangeCode : TChangeCodeEvent

TChangeCodeEvent = procedure(Sender : TObject; Code : TCode) of object;

OnChangeCode defines an event handler that is called when a release code changes.

This event is fired after the release code is changed via a call to Decrease, either directly or automatically (if the AutoDecrease property is True).

Sender is the instance of the release code component. Code is the new release code value.

The release code should be saved in the INI file or the registry.

See also: AutoDecrease, Decrease


UnlockNetAccessFile

function UnlockNetAccessFile (var NetAccess : TNetAccess) : Boolean;

TNetAccess = packed record
  Fh         : Integer;
  Key        : TKey;
  CheckValue : Word;
  Index      : Word;
end;

 UnlockNetAccessFile unlocks an access slot in the network access file specified by FileName and returns false if an error occurs.

This routine is defined in the OgNetWrk unit.