OnGuard Manual
User Manual: Pdf
Open the PDF directly: View PDF
Page Count: 125 [warning: Documents this large are best viewed by clicking the View PDF Link!]
- OnGuard
- Chapter 1: Introduction
- OnGuard is a library of components, classes, and routines that allow you to protect your applicat...
- By embedding a key in your application and making a few well placed calls to some of the routines...
- Through the use of a release code, you can do things such as unlock a demo version of your applic...
- A release code is a 16 hexadecimal character code that you provide to the end user. The user then...
- Some release codes contain additional information (such as the date that the release expires), wh...
- The OnGuard release codes provide many different protection methods:
- Start/end date check
- Number of days used
- Network metering
- Simple registration
- Serial number registration
- Special registration
- Usage count limit
- The application can be run only a limited number of times.
- You can combine most of OnGuard’s protection methods to achieve a greater level of protection. Fo...
- OnGuard also provides a component that allows you to detect changes to your EXE file. It does thi...
- OnGuard makes it easy for you to control use of your application by making it a single instance a...
- OnGuard is based on code written by Robert Salesas of Eschalon Development, Inc. and now licensed...
- Using OnGuard
- OnGuard provides an assortment of components that allow you to protect the applications you write...
- Since there are an almost infinite number of ways to incorporate OnGuard into your application, d...
- Codes, keys, and modifiers
- An OnGuard code is nothing more than a record consisting of two long integers (8 bytes). The firs...
- An OnGuard key is used to encode (or mask) the contents of the code. A key is much like a passwor...
- The key is what gives all of the OnGuard components the ability to decode the code to see if it i...
- Modifiers can be considered as part of a key. They are used to change a key based on some reprodu...
- Other modifiers can “tie” a code to a user name, a product serial number, or even a specific date...
- Anatomy of a “code” component
- A “code” component is any of the OnGuard components that requires a release (or unlocking) code. ...
- 1. The OnGetKey event is fired to obtain the key that was used to encode the release code. The ke...
- 2. The OnGetCode event is fired to obtain the release code. The release code is normally stored o...
- 3. The OnGetModifier event is fired to obtain the key modifier. A modifier should almost always b...
- 4. The modifier is applied to the key to generate the key that was used to encode the release code.
- 5. The release code is inspected to insure that it is a valid release code.
- 6. The component-specific portion of the code is tested. The specific test depends on the type of...
- 7. The OnChecked event is fired to report the results of the previous two steps.
- Release code components
- Other components and features
- Protection Strategies
- OnGuard provides many different protection methods so that you can select those necessary to crea...
- Demo version application with single machine authorization
- This protection strategy combines the advantages of the “Demo version application” and the “Singl...
- To prevent unauthorized copies of your application, design it so that it is initially a demo vers...
- Using this approach means that even fully functional “released” applications revert to their demo...
- Single machine authorization
- Single instance applications
- Demo version application
- System Requirements
- Installation
- Organization of this Manual
- Each chapter starts with an overview of the classes and components discussed in that chapter. The...
- Overview
- Hierarchy
- Properties
- Methods
- Events
- Reference Section
- Details the properties, methods, and events of the class or component. These descriptions are in ...
- Declaration of the property, method, or event.
- Default value for properties, if appropriate.
- A short, one-sentence purpose. The ƒsymbol is used to mark the purpose to make it easy to skim th...
- Description of the property, method, or event. Parameters are also described here.
- Examples are provided in many cases.
- The “See also” section lists other properties, methods, or events that are pertinent to this item.
- Throughout the manual, the Msymbol is used to mark a warning or caution. Please pay special atten...
- Details the properties, methods, and events of the class or component. These descriptions are in ...
- Naming Conventions
- On-Line Help
- Technical Support
- The best way to get an answer to your technical support question is to post it in the OnGuard new...
- To get the most from the newsgroups, we recommend you use dedicated newsreader software.
- Newsgroups are public, so please do not post your product serial number, product unlocking code, ...
- TurboPower’s KnowledgeBase is another excellent support option. It has hundreds of articles about...
- In addition to the newsgroups, TurboPower Software Company offers a variety of technical support ...
- Chapter 2: Tutorials
- This tutorial section provides three simple, step-by-step examples that illustrate some of the mo...
- Example 1: Adding a Program Expiration Date
- In this example, we limit the range of dates for program execution. Although this protection stra...
- 1. Create a new project.
- 2. From the OnGuard tab, add a TOgDateCode component to the project’s main form.
- 3. Click the right mouse button on the TOgDateCode component to invoke the local menu and then se...
- 4. Click the Add button to display the Description and Key dialog box as shown in Figure 2.2.
- 5. Enter the name of your application in the “Description” edit control. For this example, enter ...
- 6. Be sure that “Random” is selected as the key type and click “Generate Key”. Two hexadecimal re...
- 7. Select your application (MyTest) in the “Applications” list box and the generated key is displ...
- 8. Add the following to the implementation section of the unit:
- const
- CKey : TKey =
- ($18,$C1,$99,$64,$3F,$FC,$DA,$6C,$38,$BC,$DF,$CB,$B8,$BE,$DF,$21);
- (The underlined portion of this statement was copied from the clipboard)
- Caution: Don’t store the key in the registry or an INI file. Doing so drastically reduces the sec...
- 9. With the TOgDateCode component selected, double-click the OnGetKey event in the Events tab of ...
- 10. With the TOgDateCode component selected, double-click the Code property in the Properties tab...
- Figure 2.5: The Code Generation dialog box.
- Be sure that the Date tab is selected. The “Start date” is automatically set to today's date. Ent...
- For this example, the release code will be stored with the application, so set the Store Code pro...
- This completes the portion of this example that concerns the TOgDateCode directly. However, there...
- 11. With the TOgDateCode component selected, double-click the OnChecked event in the Events tab o...
- procedure TForm1.OgDateCode1Checked( Sender: TObject; Status:TCodeStatus);
- begin
- case Status of
- ogValidCode : ShowMessage('Valid code');
- ogPastEndDate : ShowMessage('Date has expired');
- ogInvalidCode : ShowMessage('Invalid release code');
- if Status <> ogValidCode then
- Application.Terminate;
- Example 2: Limiting Simultaneous Network Users
- In this example, we build a network application that limits the number of concurrent users to two...
- 1. Create a new project.
- 2. From the OnGuard tab, add a TOgNetCode component to the projects main form.
- 3. Right click on the TOgNetCode component and select “Generate Key” to display the Key Maintenan...
- 4. Click the Add button to display the Description and Key dialog box. In the Description field, ...
- 5. Click on the far right speed button (with the picture of a key) to generate the key for this a...
- 6. Be sure “Random” is selected in the “Key Type” and press the Generate Key button. Two hexadeci...
- 7. In the “Applications” list box, select NetPrj1. The generated key, in both forms, is displayed...
- 8. Click the Copy button immediately to the right of the lower of the two edit controls. This cop...
- 9. Click once on the TOgNetCode component. On the Events tab of the Object Inspector, double clic...
- procedure TForm1.OgNetCode1GetKey(
- Sender: TObject; var Key: TKey)
- const
- CKey : TKey = ($44,$OE,$E2,$DO,$O8,$F6,$5C,$F7,$92,$2B,$DC,$6C,$AC,$5B,$39,$4E);
- begin
- Key := CKey;
- end;
- The underlined code was pasted from the clipboard into the editor and is the string that was copi...
- 10. With the TOgNetCode component selected, double-click the Code property in the Properties tab ...
- 11. Click on the Net tab of the notebook. Note that the key for the program has been automaticall...
- 12. Click the Generate button. This creates a unique code based on the number of slots and, if an...
- 13. Click the OK button on the dialog box. The generated code is seen in the Code property of the...
- 14. Click on the StoreCode property. Click once on the down arrow and select True. This stores th...
- 15. Click on the FileName property. Enter “NETPRJ1.NAF”. This provides the name of the Network Ac...
- 16. Click on the Events tab of the Object Inspector. Double click on the OnChecked event. In the ...
- procedure TForm1.OgNetCode1Checked(
- Sender: TObject; Status: TCodeStatus);
- begin
- case Status of
- ogInvalidCode :
- begin
- ShowMessage('Invalid Code');
- Application.Terminate;
- end;
- ogNetCountUsed :
- begin
- ShowMessage('No more users allowed');
- Application.Terminate;
- end;
- end;
- end;
- 17. Select File|Save File As from the main menu. Enter “NETPRJ1U” in the File Save dialog box and...
- 18. Compile and run the application, and leave it running.
- 19. From either a DOS box or using Start|Run from the task bar, start another copy of the applica...
- 20. Try to run a third instance of the application. You should see the “No more users allowed” me...
- Example 3: Limiting Program Executions
- In this example, we show how to use OnGuard to limit the number of times a program can be run. As...
- 1. Create a New Project.
- 2. From the OnGuard tab, add a TOgUsageCode component to the form.
- 3. Right click the TOgUsageCode component. and select “Generate Key” to display the Key Maintenan...
- 4. Click the Add button to display the Description and Key dialog box as shown in Figure 2.12.
- 5. In the Description field, enter “UsgPrj1” as shown in Figure 2.12. Click on the far right spee...
- 6. Be sure “Random” is selected in the “Key Type” edit control and press the Generate Key button....
- 7. In the “Applications” list box, select UsgPrj1. The generated key, in both forms, is displayed...
- 8. Click the Copy button immediately to the right of the lower of the two edit controls. This cop...
- 9. Click once on the TOgUsageCode component. On the Events tab of the Object Inspector, double cl...
- procedure TForm1.OgUsageCode1GetKey(
- Sender: TObject; var Key: TKey);
- const
- CKey : TKey = ($BD,$42,$EF,$13,$E7,$40,$6E,$13,$77,$08,$B1,$6E,$21,$B5,$C7,$FE); begin
- Key := CKey;
- end;
- The OnGetKey event automatically retrieves the key every time the program starts. Without this ev...
- 10. Right click on the TOgUsageCode component and select “Generate Code” from the context menu. T...
- 11. Click on the Usage tab of the notebook. Note that the key for the program has been automatica...
- 12. In the Usage Count edit control, enter the number 1 to limit the program to only one run as s...
- 13. Click on the Expires edit control and enter an expiration date in the format you’ve set up fo...
- 14. The TOgUsageCode component provides a second level of protection by allowing you to enter an ...
- 15. Click the Generate button. This creates a unique code based on the number of allowed uses and...
- 16. Write down this code. You will need it later. Click the OK button on the dialog box.
- 17. Add OgUtil and IniFiles to the uses clause of the unit. OgUtil contains routines used to conv...
- unit unit1;
- interface
- uses
- WinTypes, WinProcs, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, OnGuard, Ini...
- Note that the uses clause was generated by Delphi 1, i.e., it has WinTypes and WinProcs. Had the ...
- 18. Click once on the TOgUsageCode component. Double click the OnGetCode event on the Events tab ...
- procedure TForm1.OgUsageCode1GetCode(
- Sender: TObject; var Code: TCode);
- var
- IniFile : TIniFile;
- S : string;
- begin
- IniFile := TIniFile.Create('usgprj1.ini');
- try
- S := IniFile.ReadString('Codes', 'UsageCode', '');
- HexToBuffer(S, Code, SizeOf(Code));
- finally
- IniFile.Free;
- end;
- procedure TForm1.OgUsageCode1Checked(
- Sender: TObject; Status: TCodeStatus);
- var
- Code : TCode;
- IniFile : TIniFile;
- S : string;
- begin
- case Status of
- ogInvalidCode :
- begin
- if InputQuery('Useage Test Program', 'Code', S) then begin
- if (HexToBuffer(S, Code, SizeOf(Code))) then begin
- IniFile.WriteString('Codes', 'UsageCode', S);
- OgUsageCode1.CheckCode(True);
- Exit;
- end;
- end;
- end;
- ogCodeExpired : ShowMessage('Code Expired');
- ogRunCountUsed : ShowMessage('Run Count exceeded');
- end;
- if Status <> ogValidCode then
- Application.Terminate;
- end;
- The OnChecked event of the TOgUsageCode component is fired as a result of the release code being ...
- If the code is invalid, the cutoff date has been exceeded, or the number of permitted uses has be...
- 20. Double click the OnChangeCode event in the Object Inspector. In the source editor, change the...
- procedure TForm1.OgUsageCode1ChangeCode(
- Sender: TObject; Code: TCode);
- var
- IniFile : TIniFile;
- S : string;
- begin
- IniFile := TIniFile.Create('usgprj1.ini');
- try
- S := BufferToHex(Code, SizeOf(Code));
- IniFile.WriteString('Codes', 'UsageCode', S);
- finally
- IniFile.Free;
- end;
- end;
- The OnChangeCode event is fired when the OgUsageCode component needs to update the information in...
- 21. Select File|Save File As from the main menu. Enter “USGPRJ1U” in the File Save dialog box and...
- 22. Compile and run the application. When the InputQuery box appears, enter the code you wrote do...
- 23. Close the application and try to run the program again. The “Run Count Exceeded” message appe...
- Chapter 3: Low-Level Routines
- If you need more control over how and when release codes are handled, you can move one level lowe...
- The ONGUARD.PAS unit not only implements all of the “Code” components, it provides access to the ...
- For example, the following four routines are used to create and manage usage codes.
- procedure InitUsageCode(const Key : TKey; Count : LongInt; Expires : TDateTime; var Code : TCode);
- function IsUsageCodeValid(const Key : TKey; const Code : TCode) :Boolean;
- procedure DecUsageCode(const Key : TKey; var Code : TCode);
- function GetUsageCodeValue(const Key : TKey; const Code : TCode) : LongInt;
- function IsUsageCodeExpired(const Key : TKey; const Code: TCode) : Boolean;
- The first parameter for each of these routines is the key. The key is used to encode and decode t...
- InitUsageCode takes an already initialized key value, a usage count, an expiration date (Expire),...
- The date, days, registration, serial number, and special codes all have similar, low-level, routi...
- Procedures/Functions
- Refernce Section
- ApplyModifierToKeyPrim procedure
- ApplyModifierToKeyPrim XOR’s the Modifier value with the Key returning the modified key as the Ke...
- BufferToHex function
- BufferToHex converts one or more bytes to a hexidecimal string.
- BufferToHexBytes function
- BufferToHexBytes performs the same operation as the BufferToHex function except that the function...
- CheckNetAccessFile function
- CheckNetAccessFile verifies that the net access file referenced by NetAccess has at least one slo...
- CreateMachineID function
- CreateMachineID produces a key modifier based on specific hardware information.
- CreateNetAccessFile function
- CreateNetAccessFile creates a net access for Count users file using FileName as the name of the f...
- CreateNetAccessFileEx function
- CreateNetAccessFileEx creates a net access file using the access count value from a previously en...
- DecDaysCode procedure
- DecDaysCode reduces the internal days count value by one and returns the modified code as the Cod...
- DecodeNAFCountCode function
- DecodeNAFCountCode uses Key to decode Code and returns the number of authorized users as the func...
- DecUsageCode procedure
- DecUsageCode reduces the internal usage count value by one and returns the modified code as the C...
- EncodeNAFCountCode procedure
- EncodeNAFCountCode uses Key to create and encode the usage Count value creating a network code.
- ExpandDate function
- ExpandDate translates an OnGuard date offset to an actual date.
- GenerateDateModifierPrim function
- GenerateDateModifierPrim produces a key modifier based on the date D.
- GenerateMachineModifierPrim function
- GenerateMachineModifierPrim produces a key modifier based on default hardware information.
- GenerateMD5KeyPrim procedure
- GenerateMD5KeyPrim produces a Key by applying the MD5 hash to the string passed as Str
- GenerateRandomKeyPrim procedure
- GenerateRandomKeyPrim produces a Key using a random numbers.
- GenerateStringModifierPrim function
- GenerateStringModifierPrim produces a key modifier by applying a hash algorithm to the string pas...
- GenerateTMDKeyPrim procedure
- GenerateTMDKeyPrim produces key by applying a hash algorithm to the string passed in Str.
- GenerateUniqueModifierPrim function
- GenerateUniqueModifierPrim produces a key modifier using random numbers.
- GetCodeType function
- GetCodeType returns the type of code passed as the Code parameter.
- GetDateCodeValue function
- GetDateCodeValue returns the expiration date stored in the Code.
- GetDaysCodeValue function
- GetDaysCodeValue returns the expiration date stored in the Code.
- GetExpirationDate function
- GetExpirationDate returns the date that the code passed as the Code parameter expires.
- GetNetAccessFileInfo function
- etNetAccessFileInfo obtains information about the specified network access file.
- GetSerialNumberCodeValue function
- GetSerialNumberCodeValue returns the serial number that was used to create the Code.
- GetSpecialCodeValue function
- GetSpecialCodeValue returns the value that was used to create the Code.
- GetUsageCodeValue function
- GetUsageCodeValue returns the current usage count value store in the Code.
- HexStringIsZero function
- HexStringIsZero returns True only if the hexadecimal string passed as Hex consists entirely of ze...
- HexToBuffer function
- HexToBuffer converts the hexadecimal string in Hex to bytes that are stored in Buf.
- InitDateCode procedure
- InitDateCode creates and initializes a date code using Key, StartDate, and EndDate.
- InitDaysCode procedure
- InitDaysCode creates and initializes a days code using Key, Days, and Expires.
- InitRegCode procedure
- InitRegCode creates and initializes a registration code using Key, RegStr, and Expires.
- InitSerialNumberCode procedure
- InitSerialNumberCode creates and initializes a serial number code using Key, Serial, and Expires.
- InitSpecialCode procedure
- InitSpecialCode creates and initializes a special code using Key, Value, and Expires.
- InitUsageCode procedure
- InitUsageCode creates and initializes a usage code using Key, Count, and Expires.
- IsAppOnNetwork function
- IsAppOnNetwork returns True if the drive specified in ExePath is a remote drive, otherwise False.
- IsDateCodeExpired function
- IsDateCodeExpired returns True if the Code has expired, otherwise False.
- IsDateCodeValid function
- IsDateCodeValid returns True if Code is a valid date code, otherwise False.
- IsDaysCodeExpired function
- IsDaysCodeExpired returns True if the Code has expired, otherwise False.
- IsDaysCodeValid function
- IsDaysCodeValid returns True if Code is a valid days code, otherwise False.
- IsRegCodeExpired function
- IsRegCodeExpired returns True if the Code has expired, otherwise False.
- IsRegCodeValid function
- IsRegCodeValid returns True if Code is a valid registration code, otherwise False.
- IsSerialNumberCodeExpired function
- IsSerialNumberCodeExpired returns True if the Code has expired, otherwise False.
- IsSerialNumberCodeValid function
- IsSerialNumberCodeValid returns True if Code is a valid serial number code, otherwise False.
- IsSpecialCodeExpired function
- IsSpecialCodeExpired returns True if the Code has expired, otherwise False.
- IsSpecialCodeValid function
- IsSpecialCodeValid returns True if Code is a valid special code, otherwise False.
- IsUsageCodeExpired function
- IsUsageCodeExpired returns True if the Code has expired, otherwise False.
- IsUsageCodeValid function
- IsUsageCodeValid returns True if Code is a valid usage code, otherwise False.
- LockNetAccessFile function
- LockNetAccessFile locks an access slot in the network access file specified by FileName and retur...
- ResetNetAccessFile function
- ResetNetAccessFile resets invalid access slots by clearing each slot’s “in-use” status.
- ShrinkDate function
- ShrinkDate translates a date to an OnGuard date offset.
- StringHashElf function
- StringHashElf produces a hash value based on the text passed in Str.
- UnlockNetAccessFile function
- UnlockNetAccessFile unlocks an access slot in the network access file specified by FileName and r...
- Chapter 4: Keys and Release Codes
- OnGuard provides two components that automate the tasks of making keys and generating release codes.
- The TOgMakeKeys component is used to create keys. Keys are used to encode and decode release code...
- To make the key more secure, a modifier can be applied to it to make it unique to the current dat...
- The TOgMakeCodes component is used to generate release codes. The release code is an 8 byte value...
- Release codes can be unique to a particular user name, machine specific ID, or almost any static ...
- TOgMakeKeys Component
- TOgMakeKeys provides methods and properties to create and maintain keys. Keys are used to encode ...
- Keys are normally embedded into your application as constants and then supplied to the OnGuard ro...
- TOgMakeKeys allows you to make three different types of keys: Random, Standard Text, and Case-Sen...
- Creating and Maintaining Keys
- TOgMakeKeys provides a series of dialogs with built-in methods for managing keys and their relate...
- “File name” is the name of the INI file where the key information is stored. Use the speed button...
- “Applications” contains a list of the applications for which keys are currently stored in the fil...
- The Add button displays the Description and Key dialog box (described below). The Edit button dis...
- The “Key” group contains two edit fields with hexadecimal representations of the key. The second ...
- The OK button closes the dialog box and makes the selected key information available via the appr...
- If you choose to add or edit an item in the “Applications” list, the Description and Key dialog b...
- “Description” is the name of (or some text describing) the application.
- If a key was already generated for this application, “Key” displays the hexadecimal representatio...
- The OK button closes the dialog box, saving any changes that were made. The Cancel button closes ...
- If you click on the speed button to generate a key, the Key Generation dialog box is displayed as...
- The “Key Type” combo box allows you to select the method used for key generation. The possible ch...
- The Generate key button creates the key based on the “Key Type” and the “Key Phrase”.
- The “Key Phrase” memo field allows you to enter a text phrase that is used to generate the key if...
- The “Key” group contains two edit fields with hexadecimal representations of the key. The second ...
- The OK button closes the dialog box and makes the selected key information available via the appr...
- Hierarchy
- Properties
- Methods
- Reference Section
- About property
- Shows the current version of OnGuard.
- ApplyModifierToKey method
- ApplyModifierToKey alters the specified key.
- Execute method
- Execute displays the Key Maintenance dialog box.
- GenerateDateModifier method
- GenerateDateModifier creates a key modifier based on the current date.
- GenerateMachineModifier method
- GenerateMachineModifier creates a key modifier based on the hardware information for the current ...
- GenerateMachineModifier uses hard disk volume sizes, volume serial numbers, registration name and...
- Use this modifier to sign the key used to encode and decode release codes if you want the release...
- Caution: If hardware is changed on the machine, the modifier changes, rendering the release code,...
- This routine is also available as a function (GenerateMachineModifierPrim) for use in application...
- GenerateMDKey method
- GenerateMDKey produces a key based on a supplied text string.
- GenerateRandomKey method
- GenerateRandomKey produces a key based on the VCL’s internal random number generator.
- GenerateStringModifier method
- GenerateStringModifier creates a key modifier based on the supplied string.
- GenerateUniqueModifier method
- GenerateUniqueModifier creates a unique key modifier.
- GetKey method
- GetKey returns the key generated when Execute was called.
- KeyFileName property
- KeyFileName is the name of the INI file used to store application names and their associated keys.
- KeyType property
- Default: ktMessageDigest
- KeyType determines the type of key to generate.
- ShowHints property
- Default: False
- ShowHints determines whether hints are shown for the TOgMakeKeys dialog boxes.
- TOgMakeCodes Component
- Generating Release Codes
- The Execute method displays the Code Generation dialog box as shown in Figure 4.4.
- The first item in the Code Generation dialog box is a notebook with a page for each possible type...
- Use the Date notebook page to generate a Start/End Date release code as shown in Figure 4.4. An a...
- See the “TOgDateCode Component” on page 88 for information about Start/End Date release codes.
- Use the Days notebook page to generate a Number of Days Used release code as shown in Figure 4.5....
- Enter the number of days in the “Day count” edit field. A value of 0 is interpreted as an expired...
- See the “TOgDaysCode Component” on page 90 for more information about Number of Days Used release...
- Use the Reg notebook page to generate a Simple Registration release code as shown in Figure 4.6. ...
- You should store the text in a file or in the registry. It can be displayed at run time as a dete...
- The Random Number button generates a random string of hexadecimal digits and puts them in the “St...
- Use the “Expires” edit field to specify a date that the release code will expire. The default val...
- See the “TOgRegistrationCode Component” on page 98 for more information about Simple Registration...
- Use the S/N notebook page to generate a Serial Number release code. The number entered in “Serial...
- You should store the serial number in a file or in the registry so that it can be read and displa...
- Use the “Expires” edit field to specify a date that the release code will expire. The default val...
- The Random Number button generates a random number to be used as the product serial number.
- See the “TOgSerialNumberCode Component” on page 101 for more information about Serial Number rele...
- Use the Usage notebook page to generate a Usage Count release code as shown in Figure 4.8. This r...
- Enter the number of uses in the “Usage count” edit field. Use the “Expires” edit field to specify...
- See the “TOgUsageCode Component” on page 105 for more information about Usage Count release codes.
- Use the Network notebook page to generate a Network Metering release code as shown in Figure 4.9....
- Enter the maximum number of network users in the “Access Slots” edit field.
- See the “TOgNetCode Component” on page 94 for more information about Network Metering release codes.
- Use the Special notebook page to generate a Special release code as shown in Figure 4.10. A Speci...
- Enter any value in the “Special data” edit field. Use the “Expires” edit field to specify a date ...
- See the “TOgSpecialCode Component” on page 103 for more information about Special release codes.
- The “Key used to encode” group in the Code Generation dialog box contains information about the k...
- The modifier check boxes, shown in Figure 4.11, determine whether a modifier is used to sign the ...
- If the “Machine modifier” box is checked, a modifier is created using machine-specific informatio...
- If the “Date modifier” box is checked, a modifier is created using a date. Use this type of modif...
- If the “Unique modifier” box is checked, a modifier is randomly generated. Use this type of modif...
- If the “String modifier” box is checked, a modifier is created using the text contained in the “S...
- If none of the boxes are checked, an arbitrary 32-bit value can be entered in the “Modifier” edit...
- The third group in the Code Generation dialog box contains the Generate button. After you have su...
- The OK button closes the dialog box and indicates that the entered data and the generated code ar...
- Hierarchy
- Properties
- Methods
- Reference Section
- About property
- Shows the current version of OnGuard.
- CodeType property
- Default: ctDate
- CodeType is the type of release code.
- Execute method
- Execute displays the Code Generation dialog box.
- GetCode method
- procedure GetCode(var Value : 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 specail codes}
- 6 : (NetIndex : LongInt); {for net codes}
- end;
- GetCode returns the release code generated by the Execute method.
- KeyFileName property
- KeyFileName is the name of the INI file used to store application names and their associated keys.
- ShowHints property
- Default: False
- ShowHints determines whether hints are shown for the TOgMakeCodes dialog boxes.
- Chapter 5: Release Code Components
- This chapter discusses the components that implement the different types of release codes. OnGuar...
- Start and End Date
- Number of Days Used
- Network Metering
- Simple Registration
- Serial Number Registration
- Special Registration
- Usage Count
- TOgCodeBase Class
- The TOgCodeBase class is the ancestor class for the other components described in this chapter. I...
- Hierarchy
- Properties
- Methods
- Events
- Reference Section
- About property
- Shows the current version of OnGuard.
- AutoCheck property
- Default: True
- AutoCheck determines whether CheckCode is called automatically.
- CheckCode virtual abstract method
- CheckCode checks for a valid release code.
- CheckCode is defined as virtual and abstract, which means that each descendant component override...
- CheckCode requires several pieces of information, which it obtains by triggering event handlers t...
- 1. Trigger the OnGetKey event to get the key used to encode and decode the release code. The key ...
- 2. Trigger the OnGetCode event to get the release code. The release code is normally stored in th...
- 3. Trigger the OnGetModifier event to get the key modifier. The modifier can be stored as a const...
- 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...
- Code property
- Code is the release code.
- IsCodeValid method
- IsCodeValid tests to see if the release code is valid.
- Modifier property
- Modifier is used to sign the key.
- OnChecked event
- OnChecked defines an event handler that is called after the release code is checked.
- OnGetCode event
- OnGetCode defines an event handler that is called to get the release code.
- OnGetKey event
- OnChecked defines an event handler that is called to get the key.
- OnGetModifier event
- OnGetModifier defines an event handler that is called to get the modifier.
- StoreCode property
- Default: False
- StoreCode determines whether the release code is stored in the resource file.
- StoreModifier property
- Default: False
- StoreModifier determines whether the modifier is stored in the resource file.
- TOgDateCode Component
- TOgDateCode implements a Start/End Date release code. Use this release code when you need to limi...
- OnGuard implements a date as the number of days past a base-line date (stored internally as a sma...
- The EXDTREG project is an example that uses the TOgDateCode component. The example project repres...
- A separate program, CODEGEN, is provided to generate the release code for this and other example ...
- Hierarchy
- Properties
- Methods
- Events
- Reference Section
- TOgDaysCode Component
- TOgDaysCode implements a Number of Days Used release code. This release code limits the number of...
- The days do not need to be consecutive. For example, if an application is limited to 2 days, it c...
- A Number of Days Used release code must be stored in a file or the registry because it must be up...
- TOgDaysCode allows you to specify an expiration date in addition to the number of days. If the re...
- See the EXDYREG project for an example application that uses a Number of Days Used release code. ...
- Hierarchy
- Properties
- Methods
- Events
- Reference Section
- AutoDecrease property
- Default: True
- AutoDecrease determines whether the day count value is automatically decreased each day the appli...
- Decrease method
- Decrease reduces the day count value stored in the release code.
- Performing this action requires several vital pieces of information, which are normally obtained ...
- 1. Trigger the OnGetKey event to get the key used to encode and decode the release code. The key ...
- 2. Trigger the OnGetCode event to get the release code. The release code is normally stored in th...
- 3. Trigger the OnGetModifier event to get the key modifier. The modifier can be stored as a const...
- 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.
- GetValue method
- GetValue returns the day count embedded in the release code.
- OnChangeCode event
- OnChangeCode defines an event handler that is called when a release code changes.
- TOgNetCode Component
- TOgNetCode implements a Network Metering release code. This release code limits the number of con...
- The Network Access File contains access slots for each authorized use of the application. Each ac...
- When you call the CheckCode method, the Network Access File is checked to ensure that there is ro...
- Your application can create or recreate the Network Access File automatically or require that it ...
- See the EXNET project for an example that uses a Network Metering release code. A separate progra...
- Hierarchy
- Properties
- Methods
- Events
- Reference Section
- ActiveUsers read-only property
- ActiveUsers is the current number of users running the application.
- FileName property
- FileName is the name of the Network Access File.
- InvalidUsers read-only property
- InvalidUsers is the number of invalid user access slots in the Network Access File.
- IsRemoteDrive method
- IsRemoteDrive determines whether ExePath resides on a remote disk drive.
- MaxUsers read-only property
- MaxUsers is the maximum number of concurrent users of the application.
- ResetAccessFile method
- ResetAccessFile resets the invalid slots in the Network Access File.
- TOgRegistrationCode Component
- TOgRegistrationCode implements a Simple Registration release code. This release code ties the use...
- TOgRegistrationCode doesn’t perform any special tests like most of the other release code compone...
- The textual data and the registration code can be stored in the registry or an INI file so that t...
- TOgRegistrationCode allows you to specify an expiration date in addition to the registration valu...
- See the EXRGREG project for an example application that uses a Simple Registration release code. ...
- Hierarchy
- Properties
- Methods
- Events
- Reference Section
- OnGetRegString event
- OnGetRegString defines an event handler that is called to get the registration string.
- RegString property
- RegString is the registration string used to create the release code.
- StoreRegString property
- Default: True
- StoreRegString determines whether the registration string value is stored as a resource at design...
- TOgSerialNumberCode Component
- TOgSerialNumberCode implements a Serial Number Registration release code. This release code ties ...
- TOgSerialNumberCode doesn’t perform any special tests like most of the other release code compone...
- TOgSerialNumberCode allows you to specify an expiration date in addition to the serial number. If...
- See the EXSNREG project for an example application that uses a Serial Number Registration release...
- Hierarchy
- Properties
- Methods
- Events
- Reference Section
- TOgSpecialCode Component
- TOgSpecialCode implements a Special Registration release code. This release code is based on a sp...
- TOgSpecialCode doesn’t perform any special tests like most of the other release code components. ...
- TOgSpecialCode allows you to specify an expiration date in addition to the special information. I...
- See the EXSPREG project for an example application that uses a Special Registration release code....
- Hierarchy
- Properties
- Methods
- Events
- Reference Section
- TOgUsageCode Component
- TOgUsageCode implements a Usage Count release code. This release code limits the number of times ...
- A Usage Count release code must be stored in the INI file or the registry because it must be upda...
- Unfortunately, it is easy for a user to reset a usage counter by simply reinstalling the applicat...
- TOgUsageCode allows you to specify an expiration date in addition to the usage count. If the rele...
- See the EXUSREG for an example application that uses a Usage Count release code. A separate progr...
- Hierarchy
- Properties
- Methods
- Events
- Reference Section
- AutoDecrease property
- Default: True
- AutoDecrease determines whether the usage count value is automatically decreased each time the ap...
- Decrease method
- Decrease reduces the usage count value stored in the release code.
- Performing this action requires several vital pieces of information, which are normally obtained ...
- 1. Trigger the OnGetKey event to get the key used to encode and decode the release code. The key ...
- 2. Trigger the OnGetCode event to get the release code. The code is normally stored in the regist...
- 3. Trigger the OnGetModifier event to get the key modifier. The key modifier can be stored as a c...
- 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.
- GetValue method
- GetValue returns the usage count embedded in the release code.
- OnChangeCode event
- OnChangeCode defines an event handler that is called when a release code changes.
- Chapter 6: Detecting Changes to an EXE
- Misuse of your application can occur not only when an unauthorized user attempts to run it, but a...
- The program file integrity envelope is a mechanism that allows your application to detect changes...
- TOgProtectExe Component
- The TOgProtectExe component allows you to detect changes to your EXE file. The size of the EXE fi...
- See the EXPROT and STAMPEXE projects for examples that use this technique.
- Hierarchy
- Properties
- Methods
- Events
- Reference Section
- About property
- Shows the current version of OnGuard.
- AutoCheck property
- Default: False
- AutoCheck determines whether CheckExe is called automatically.
- CheckExe method
- CheckExe tests to see if the executable file was altered.
- CheckSize property
- Default: True
- CheckSize determines whether the size of the executable is tested.
- OnChecked event
- OnChecked defines an event handler that is called after the executable is checked.
- StampExe method
- StampExe marks the executable program with its size and a CRC value.
- UnStampExe method
- UnStampExe reverses the effect of a call to StampExe.
- Chapter 7: Single Instance Applications
- A single instance application is one that refuses to allow a second or subsequent instance of its...
- OgFirst Unit
- The OgFirst unit provides routines that allow you to detect when a second instance of an applicat...
- IsFirstInstance determines if the application is being run the first time. If a previous instance...
- Use IsFirstInstance in the main body of the project file (prior to doing anything else), to detec...
- Here is an example from the EXINST project:
- begin
- if IsFirstInstance then begin
- Application.CreateForm(TMyForm, MyForm);
- Application.CreateForm(TForm2, Form2);
- Application.Run;
- end else begin
- {$IFDEF Win32}
- ActivateFirstInstance;
- {$ELSE}
- ActivateFirstInstance('Test', 'TMyForm');
- {$ENDIF}
- end;
- Procedures
- Reference Section
- Subject index