The Enigma Protector

The Enigma Protector is a powerful tool designed for complex protection of program modules. Program modules include the following types of objects:

  • Win32 and Win64 Portable Executable Files (*.exe);
  • Dynamic Link Libraries (*.dll);
  • .NET Executables (*.exe).
  • Windows Screen Saver Files (*.scr);
  • ActiveX Component Files (*.ocx);

In this context the term "protection" means realization of two major ideas. The first one is "try before you buy" concept support system (the mentioned concept is the main principle of the shareware marketing method). And the second one is protection of program module machine code from analysis and cracking. As it can be seen, the protection is realized in different, but nevertheless greatly interrelated aspects which are protection of the developer's economic interests and technical protection of a software product. Later we will consider these ideas in more detail.

The Enigma Protection and motivation for buying

"Try before you buy" conception support system

Almost every commercially distributed software product has a customer-key protection system. The software developers have to build various enciphering algorithms into their programs. In many cases these algorithms have low anti-cracking and anti-direct-enumeration protection rate. Suggested "try before you buy" concept support system provides functionality which is necessary to work with registration keys. It gives easy ways of interaction between the software developer and the user (customer). Functions of unique keys generation (within a certain project scope) have a high protection rate. The Enigma Protector uses enciphering algorithms which are congruous to RSA algorithm with the key of up to 4096 bit length. This makes it impossible for a cracker to create spurious registration keys. Functionality of the program module trial limitation is also provided. The user who works with the protected program has an ability to try its operational capability within some period of time. At the end of this period, the program module can no longer work normally. To restore this ability, it is necessary to perform the ordering procedure (which usually requires payment).

Protection of program module machine code

During the distribution of their own program product, every shareware developer faces the problem of cracking. Herewith serial numbers, spurious key generators and so on get a wide access. The effect of this "try before you buy" concept is invalidated and the shareware marketing method loses its efficiency. For the developer this reveals itself in reduction of amount of monthly sales and loss of profit. The suggested protection of machine code inckudes creation of series of considerable hardships on the way of persons (crackers) who try to perform an unauthorized code analysis and modifications for the purpose of illegal use. Machine code compression and enciphering are supported. It is possible to make a considerable reduction of the program module size without the loss of its working capacity.

To start working with The Enigma Protector read the following sections:

  • Getting Started
  • Tutorials

Managing of licenses

The Enigma Protector includes several unique tools for managing licenses:

  • License manager serves for storing licenses generated for the registered users. License manager allows to create customer records and generate licenses. It is a very useful, user-friendly and simple manager!
  • Mailer serves for automatic generation and sending of emails to the users stored in the database. For any software developer sending notification emails to the registered users is a common thing. For example, if the newest version of the software has been released or a new registration scheme has been implemented, the Mailer provides you with a very simple way of automatic email generation and sending.

What can The Enigma Protector do?

The Enigma Protector has a hard scheme of registration keys generation:

  • comfortable interface for creating and verifying registration keys. You do not need to look for any safe decisions on how to generate registration keys for customers. The Enigma Protector helps you to create keys with a very safe algorithm like RSA with up to 4096-bits key length!
  • special Enigma API. Enigma API is a set of special functions to communicate between the module and the Enigma loader. You are able to get full information about registration keys, current trial parameters, etc.
  • hardware locking of registration keys. This perfect feature helps you to generate registration keys for a particular computer only! The registration key generated with the hardware locking function enables work only on one PC you have chosen.
  • time limited registration keys. If you need to limit the time of usage of a registered version of the module, you will be able to do it, just create a time-limited registration key!

The Enigma Protector has a wide range of features to limit time of module usage:

  • executions, days, date, time limitations. The main idea of shareware modules is "try before you buy". The customer should see how the application works and what features it has, let's show these features but do not forget to limit usage time to increase motivation to buy application.
  • system clock control. This feature is used to control system clock reversing. It helps you to avoid dishonest customers.

The Enigma Protector has a lot of features to make your software resistant to cracking:

  • anti-debugger tricks. Debuggers are the special tools that allow you to reverse source machine codes of the executed module. All reverse engineers use these tools to understand how your module works or how the module protection works. Using this feature helps to avoid simultaneous execution of the protected module with debug tools.
  • control sum checking. Control sum is special data which helps to understand if the data region is modified or not. Every crack (removing of protection etc.) needs to modify some of machine code region. The Enigma Protector is able to check if the sources are modified and an alert is made. The Enigma Protector checks not only machine codes of the protected module, but also own sources!
  • set startup password. Sometimes you need to limit count of users who are using protected module to a particular group, startup password feature is the most safe decision.
  • any additional features to check number of simultaneously executed copies of the protected module, file name of the module, disk type where the module is executed.
  • checkup of external files. If your application package contains any other files except the main protected executable module you may use this feature to control these files against modifications.
  • checkup of executed processes. This feature is used for checking if some files/processes are executed. It is performed by checking of module file name, process windows text or class. This may help to avoid execution of protected module if any debuggers/screencaptures/monitores are executed.
  • checkup of installed services.
  • checkup of Windows version.
  • checkup of Virtual Machines. If the file is executed under Virtual Machine (VMWare, Virtual PC etc) the execution is terminated.
  • hard modifications of import table of the executable. Nobody will know what import libraries your module uses.

The Enigma Protector has features to help the programmer to add beautiful things into existing module without writing any additional sources strings:

  • splash screen. Add splash screen to the module startup. Choose your own picture to be shown when the module starts.


Order

To order a license for The Enigma Protector, please visit https://enigmaprotector.com/en/order.html.

This license provides you with free updates within 9 months. After the subscription is expired you may prolong it at any time, yearly or half-yearly.

Money transfer services

We accept different types of payments, please visit our order page for wide range of options, or contact us at support@enigmaprotector.com for other preferred options you may have.

License delivering

The license is being delivered by email, we send a license information to the email address that is specified in the order. Please note, to avoid the license email to be blocked or known as a spam, check your spam folder also. If the license had been bought, but no email came, post a message at our support forum https://forum.enigmaprotector.com/ or use another alternative email address to contact us.


Support

If you have any technical problems with The Enigma Protector or need a special feature to be included in the next release, please feel free to contact us at support@enigmaprotector.com.

In case of technical problems with The Enigma Protector, make sure that you are using the latest version available. You can download the latest version of The Enigma Protector from www.enigmaprotector.com.

Please, try to find the requested information in the FAQ section or at our support forum!


Program Overview

This section unites description of the main features of The Enigma Protector categorized into the following subsections :

  • Project details
  • Input
  • Advance Input
  • Registration Features
  • Check-Up
  • Protection Features
  • Virtual Box
  • Virtual Machine
  • Miscellaneous
  • Trial Control


Project details

Enter the name and description of the project. These fields are used only to provide some information to let you know what this project is about. You are able to change/modify these data at any time without losing module workability.


Input

This topic includes the most important fields which should be specified.

  • Select file to protect - the file which needs to be protected.
  • Enter output protected file name - the icon of the module you have selected.
  • Output file name is the same as input file - turn this check on to set output file name the same with the original one. The original file name is defined in the Input panel.
  • Do not create backup (.bak) files if output and input file are same - if this option is enabled, no backup file will be created if input and output files are the same. This option also affects the files from Advance Input panel.

Product Information

  • Name - the module product name. Warning: this information is used for generation of some protection parameters, don't change this field for the same module.
  • Version - module version information. It is used to work with Trial Control functions. Do change product version field for every module version.
  • Extract Automatically from file resources - reads the module product name and version from resources.
  • File information - special file information, contains the type and size of the file, main values from the header of 32/64-bits PE Windows executable.


Advance Input

Allows you to select additional files that will also be protected with the current project. Click "Add File(s)" button and select the necessary additional files. To delete a file from the list, click [image] button. To select another output file name, activate the necessary row and click on the "Output File" column.

Protect additional files after the main executable - if selected, then the main executable (the input file selected in Input panel) will be protected before the additional one selected in the list. Otherwise, the additional files will be protected first and the main executable will be at the end of protection.


Registration Features

The features described in this section include setting project parameters that are related to storing and using registration keys. To create registration keys, see Keys Generator. The examples of working with registration keys can be viewed in Enigma API Description.

Follow the links below to get more details.

  • Common
  • Key Properties
  • Registration Data Storing
  • Hardware Lock
  • Encrypt with Hardware ID
  • Registration Dialog
  • Key Expiration Reminder


Common

These features are related to different options for registration keys usage.

UNICODE Registration Scheme - enables UNICODE support for the registration system. It means that:

  • Keys Generator works with unicode support;
  • Keys Generator of License Manager works with unicode support;
  • Enigma API with unicode support (functions with the W prefix) should be used for custom checking/saving and loading of registration information;
  • CGI Keys Generators should be called with unicode support (functions with the W prefix);
  • custom keys generators that use keygen.dll have to call unicode support functions (functions with the W prefix).

Please note:

  • if you change this feature in the existing project, all previously generated registration keys will become invalid;
  • ANSI functions of checking/saving and loading registration information will fail.

Allow execution only if registered - allow execution of the protected module only if it is registered.

Encrypt application with Encryption Constant - it encrypts the application with the Encryption Constant. The Encryption Constant is a unique value that is stored in the registration key. It means that if the application is protected with this option, it is impossible to run/unpack the application without valid registration keys. This feature has one common restriction: the application should be unlocked with registration keys generated with at least one crypted section enabled. If the registration key does not have any sections unlocked, the application will fail to be executed. If you try to run the application protected with this option and registered with the key that does not have any crypted section enabled, the execution will depend on the options selected on Checkup-Control Sum panel. That is, if the control sum is enabled, a message will be shown or the execution will be terminated silently.

Registration keys mode safety/length

Select the mode of registration keys. Available modes: ~ RSA 512/768/1024/2048/3072/4096. Keys with a high count of bits are longer than the ones with a low count, but they are much stronger. Usually, a 512-bit protection is enough.

NOTE: if you change this option, all previously generated keys will be invalid.

Registration keys base

Select the output base of registration keys.

NOTE: if you change this option, all previously generated keys will be invalid.

See Creating Keys for more information.


Key Properties

The features from this page allow you to limit the usage of different types of registration keys. For example, if you have enabled the "Allow only hardware locked keys" option, the application will apply only the registration keys that have been generated with the hardware I., If the registration key was generated without a hardware ID, it will be deemed invalid by the application even if it is valid.

Such features are also important for avoiding illegal usage of the registration keys (that were probably stolen or illegaly generated) if you are planning to constantly use any of these limitations for all the registration keys.

Allow only hardware locked keys - allows only hardware locked registration keys.

Allow only time limited keys - allows only registration keys with the Expiration Key Date.

Allow only keys with Register After date - allows only registration keys with the Register After date

Allow only keys with Register Before date - allows only registration keys with the Register Before date

Allow only executions limited keys - allows only registration keys that are limited by the number of executions

Allow only days limited keys - allows only registration keys that are limited by the number of days

Allow only run-time limited keys - allows only registration keys that have a run-time limit

Allow only global time limited keys - allows only registration keys that have a Global Time limit

Allow only country locked keys - allows only registration keys that are limited to a particular country


Registration Data Storage

Registration Data Storing

This section describes possibilities to select the location where registration information will be stored on the user's computer. Registration information refers to the couple of strings - the registration name and registration key. Registration information is stored in the user's system without being encrypted. This means that it can be accessible for viewing. If you do not use the features of The Enigma Protector for the license creation (for registration keys generation), the data entered in those fields will be ignored by The Enigma Protector.

The Enigma Protector supports two types of the registration data storage - the Windows registry and an external file. You can use each type separately or both techniques simultaneously.

Encrypt Registration Information - allows you to encrypt registration information. If the option is disabled, registration information (the name and key) will be stored in a registry/file as they are.
For example, the file with the registration information, without the Encrypt Registration Information feature, will look in the following way:

License file without encryption

with the Encrypt Registration Information feature

License file with encryption

Disable copy of the registration information to another PC (the registration information will be encrypted with the user's Hardware ID) - this option allows you to encrypt registration information with the user's hardware ID as well. If the registration information is encrypted with the hardware ID, the registry item or file with registration information will work and will be valid only on the PC where it was created. If the user attempts to copy this registry item or file to another PC, registration will fail on this PC.
Please note:

  • This feature is incompatible with the "Allow Hardware Changes" from Hardware Lock panel. This means that if the hardware ID is changed on the user's PC, and even if the Allow Hardware Changes option is enabled, the registry item or file with registration information will become invalid and the application will require registration again;
  • Do not use this feature to lock registration information to a particular PC. To lock the license to a particular PC, use the Hardware Lock panel and generate the registration keys with user's hardware ID.

Storing data in the Windows registry

Use system registry - check this radio button to store registration data in the Windows registry. Attention: after the reinstallation of the operating system, the user will have to enter registration information once again.

Base place in registry - select the base branch of the registry which will hold the registration data. Possible values are:

  • HKEY_CURRENT_USER
  • HKEY_LOCAL_MACHINE

Relative path in registry - indicates the location where registration data will be stored. Use the following structure to fill out the field:\SOFTWARE\YourCompany\. The registration name will be stored at this address as the value of the "Name" parameter and the registration key will be stored at the same address as the value of "Key" parameter.

For example if you point out the base location in the registry as HKEY_CURRENT_USER аnd the relative path in the registry as \SOFTWARE\YourCompany\ , the registration information will be stored at the following paths:
Registration name - HKEY_CURRENT_USER\SOFTWARE\YourCompany\Name
Registration key - HKEY_CURRENT_USER\SOFTWARE\YourCompany\Key

Storing data in an external file

Use file system - check this radio button to store registration data in an external file .

Base folder in file system - select the base path where file with registration data will be placed:

  • %DEFAULT FOLDER% - the folder where the protected module is placed (the same value if kept empty);
  • %SYSTEM FOLDER% - System32 (WinNt) or System (Win9X) subfolder of the Windows installation folder;
  • %WINDOWS FOLDER% - the Windows installation folder;
  • %My Documents FOLDER% - My Documents folder. Attention: For operating systems of the Windows NT family there is an individual "My Documents" folder for each user. Registration may not affect all users;
  • %My Pictures FOLDER% - My Pictures folder. It has the same warning as for My Documents folder;
  • %Program Files FOLDER% - Program Files folder;
  • %Program Files\Common FOLDER% - Program Files\Common folder;
  • %AllUsers\Documents FOLDER% - All Users\Documents folder;
  • %History FOLDER% - History folder. It has the same warning as for My Documents folder;
  • %Cookies FOLDER% - Cookies folder. It has the same warning as for My Documents folder;
  • %InternetCache FOLDER% - InternetCache folder. It has the same warning as for My Documents folder;
  • %ApplicationData FOLDER% - ApplicationData folder. It has the same warning as for My Documents folder.

Relative path in file system - a relative path where the file with registration data will be placed. If that path does not exist, the Enigma Loader will create the entire folder structure automatically when saving the key. Use the following structure to fill out the field:\notepad\secret.dat, where notepad is an additional folder relative base path, secret.dat - the name of the file where registration data will be stored, dat - the extension of the file. The format of that file is just an .ini file format.

Set File Attributes - allows you to set additional attributes to the license file. If this option is not selected, normal attributes will be applied to the license file.

Use of both techniques

Use both techniques - check this radio button to store registration data in the Windows registry and an external file simultaneously.


Hardware Lock

This section provides possibilities for selecting the type of locking the registration key to system hardware or user data. The Enigma Protector has a set of features that provide possibilities to create registration keys locked to a specific computer. These keys will work on just one computer. You can find detailed information on using hardware-locked registration keys in the description of the EP_RegHardwareID function of the Enigma API description section. See also the Keys Generator section.

Types of locking:

  • Volume Serial Drive - the serial number of the system partition of the hard drive;
  • System Volume Name - the name of the system partition of the hard drive;
  • Computer Name - the computer name (name of the currently active system user);
  • CPU type - the type of CPU;
  • Motherboard - information from the motherboard BIOS;
  • Windows Serial Key - the serial key of the installed Windows;
  • Windows User Name - the name of the currently active Windows user account.
Locking type | Is the same in different operating systems | Is the same after the hard disk drive is formatted or modified | Can be modified by the user | Can be the same on different computers
Volume Serial Drive | yes(*1) | no | yes (*4) | seldom
System Volume Name | yes(*1) | defined by user (*2) | yes | seldom
Computer Name | defined by user | defined by user (*3) | yes | seldom
CPU type | yes | yes | no | often
Motherboard BIOS | yes | yes | no | seldom
Windows Serial Key (*6) | no | yes | no | seldom
Hard Disk Serial Number (*5) | yes | the same only after formatting | no | no
Windows User Name | defined by user | defined by user (*3) | yes | seldom

(*1) The condition is effective if operating systems are installed on the same partition of the hard disk drive and the system partition is not changed or formatted.

(*2) The condition is effective if the user enters the same partition name as it was before formatting.

(*3) Formatting or changing a system partition means reinstallation of the operating system. This condition can be accomplished if the user enters the same computer/user name that was in the previous operating system.

(*4) This change can be made only with the help of special software.

(*5) Hard Disk Serial hardware lock failed to get the serial number if the operation system is installed on a RAID hard disk drive. Usually, the number of RAID disks is no more than 2-5% of all users.

(*6) Windows Serial Key hardware lock may return the same values on the corporate/company version of Windows. If your software mainly belongs to company users, it is recommended to use it together with Windows User Name hardware lock.

Advice: since there are a lot of hardware/software things to generate the hardware ID, it may be difficult to select the best configuration. Our recommendation is to initially use Hard Disk Serial Number + CPU + Motherboard hardware lock. These parameters remain same after formatting and reinstalling the operation system, they can't be the same on multiple computers and have a small percentage of failures.

Allow Changes - specifies the number of selected hardware changes. This feature will keep the registration key valid, until the selected hardware is changed the selected number of times. Why can hardware ID be changed? This could happen due to execution permissions (for example, if a motherboard lock is enabled and the program runs under Windows XP as an administrator for the first time, and without administrator privileges for the second one, it causes hardware ID change) or due to hardware update (such as changes of the Hard Disk, motherboard, etc) or due to user changes (a computer name or system volume name). Not recommended to use until hardware id often changes for your users.


Encrypt with Hardware ID

Encrypt with Hardware ID

This feature allows you to encrypt the file with the particular hardware ID. The purpose of this feature is to limit the file usage to only one particular PC, moreover, it will be really impossible to run/unpack/crack the file if the hardware ID (which the file is encrypted with) is unknown. It will be possible to run the protected file ONLY on the PC that has the same hardware ID as the one it was encrypted with.

To apply this feature, it is very helpful to use some kind of an activator program. Run on the user's PC, this program will generate and show the Hardware ID. Then this ID should be sent to the developer who protects personal, hardware encrypted copy of your application.

If there is any attempt to run the file on the PC with a different Hardware ID, the execution will depend on the properties set in the CHECK-UP - Control Sum panel, i.e. if the control sum check-up is enabled, the Control Sum message will be shown. If it is disabled, the application will be terminated silently.


Registration Dialog

The current feature allows you to add a custom registration dialog to the executable even without modifying or recompiling the main module. Note that this Registration Dialog can also be called by means of the Enigma API function EP_RegShowDialog.

Use custom registration dialog - enables the registration dialog to be shown.

Show if the trial has expired - show the registration dialog only if the trial period of the protected module has expired.

Show if unregistered - show the registration dialog if the application is unregistered.

Show message if key is valid - show a message if the user has succeeded with the registration and entered the correct registration information. Use the "Design Message" button to specify message texts.

Show message if key is invalid - show a message if the user has not succeeded with the registration and entered incorrect registration information. Use the "Design Message" button to specify message texts.

Design - press this button to design a custom registration dialog. Follow the link to learn more about Registration Dialog Designer.


Align

Align Property

Determines how the control aligns within its container (parent control).

Description

Use Align to align a control to the top, bottom, left, or right of a form or panel and have it remain there even if the size of the form, panel, or component that contains the control changes. When the parent is resized, an aligned control also resizes so that it continues to span the top, bottom, left, or right edge of the parent.

For example, to use a panel component with various controls on it as a tool palette, change the panel’s Align value to alLeft. The value of alLeft for the Align property of the panel guarantees that the tool palette remains on the left side of the form and always equals the client height of the form.

The default value of Align is alNone, which means a control remains where it is positioned on a form or panel.

Tip: If Align is set to alClient, the control fills the entire client area so that it is impossible to select the parent form by clicking on it. In this case, select the parent by selecting the control on the form and pressing Esc, or by using the Object Inspector.

Any number of child components within a single parent can have the same Align value, in which case they stack up along the edge of the parent. To adjust the order in which the controls stack up, drag the controls into their desired positions.

Note: To cause a control to maintain a specified relationship with an edge of its parent, but not necessarily lie along one edge of the parent, use the Anchors property instead.

Value | Meaning
alNone | The control remains where it was placed. This is the default value
alTop | The control moves to the top of its parent and resizes to fill the width of its parent. The height of the control is not affected
alBottom | The control moves to the bottom of its parent and resizes to fill the width of its parent. The height of the control is not affected
alLeft | The control moves to the left side of its parent and resizes to fill the height of its parent. The width of the control is not affected
alRight | The control moves to the right side of its parent and resizes to fill the height of its parent. The width of the control is not affected
alClient | The control resizes to fill the client area of its parent. If another control already occupies part of the client area, the control resizes to fit within the remaining client area
alCustom | The control’s positioning is determined by calls to its parent's CustomAlignInsertBefore and CustomAlignPosition methods


Alignment

Alignment Property

Controls the horizontal placement of the text within the label.

Description

Set Alignment to specify how the text of the label is justified within the ClientRect of the label control.

The effect of the Alignment property is more obvious if the WordWrap property is true and the label includes more than one line of text.


AlphaBlend

AlphaBlend Property

Specifies whether the form is translucent.

Description

Set AlphaBlend to specify that the form represents a layered window that allows a translucent color. The AlphaBlendValue property specifies the degree of translucency.


AlphaBlendValue

AlphaBlendValue Property

Specifies the degree of translucency on a translucent form.

Description

Set AlphaBlendValue to a value between 0 and 255 to indicate the degree of translucency when the AlphaBlend property is true. A value of 0 indicates a completely transparent window. A value of 255 indicates complete opacity.

Note: AlphaBlendValue only has an effect when the AlphaBlend property is true.


Anchors

Anchors Property

Specifies how the control is anchored to its parent.

Description

Use Anchors to ensure that a control maintains its current position relative to an edge of its parent, even if the parent is resized. When its parent is resized, the control holds its position relative to the edges to which it is anchored.

If a control is anchored to opposite edges of its parent, the control stretches when its parent is resized. For example, if a control has its Anchors property set to [akLeft, akRight], the control stretches when the width of its parent changes.

Anchors is enforced only when the parent is resized. Thus, for example, if a control is anchored to opposite edges of a form at design time and the form is created in a maximized state, the control is not stretched because the form is not resized after the control is created.

Note: If a control should maintain contact with three edges of its parent (hugging one side of the parent and stretching the length of that side), use the Align property instead. Unlike Anchors, Align allows controls to adjust to changes in the size of other aligned sibling controls as well as changes to the parent’s size.

Value | Meaning
akTop | The control’s position is fixed with respect to the top edge of its parent
akLeft | The control’s position is fixed with respect to the left edge of its parent
akRight | The control’s position is fixed with respect to the right edge of its parent
akBottom | The control’s position is fixed with respect to the bottom edge of its parent


AutoSize

AutoSize Property

Specifies whether the control sizes itself automatically to accommodate its contents.

Description

Use AutoSize to specify whether the control sizes itself automatically. When AutoSize is true, the control resizes automatically when its contents change.


BevelEdges

BevelEdges Property

Specifies which edges of the control are beveled.

Description

The BevelInner, BevelOuter, and BevelKind properties determine the appearance of the specified edges.
Value | Meaning
beLeft | The left edge is beveled.
beTop | The top edge is beveled.
beRight | The right edge is beveled.
beBottom | The bottom edge is beveled.


BevelInner

BevelInner Property

Specifies the cut of the inner bevel.

Description

Use BevelInner to specify whether the inner bevel has a raised, lowered, or flat look.

The inner bevel appears immediately inside the outer bevel. If there is no outer bevel (BevelOuter is bvNone), the inner bevel appears immediately inside the border.

Value | Meaning
bvNone | The bevel does not exist.
bvLowered | The bevel appears lowered.
bvRaised | The bevel appears raised.
bvSpace | The bevel appears as a space if its kind is not bkTile. Otherwise, the bevel appears raised.


BevelKind

BevelKind Property

Specifies the control’s bevel style.

Description

Use BevelKind to modify the appearance of a bevel. BevelKind influences how sharply the bevel stands out.

BevelKind, in combination with BevelWidth and the cut of the bevel specified by BevelInner or BevelOuter, can create a variety of effects. Experiment with various combinations to get the look you want.

Value | Meaning
bkNone | No bevel is added.
bkTile | The bevel appears sharply defined.
bkSoft | The bevel uses softer contrasts than bkTile.
bkFlat | The bevel has a broad, flat appearance.


BevelOuter

BevelOuter Property

Specifies the cut of the outer bevel.

Description

Use BevelInner to specify whether the outer bevel has a raised, lowered, or flat look.

The outer bevel appears immediately inside the border and outside the inner bevel.

Value | Meaning
bvNone | The bevel does not exist.
bvLowered | The bevel appears lowered.
bvRaised | The bevel appears raised.
bvSpace | The bevel appears as a space if its kind is not bkTile. Otherwise, the bevel appears raised.


BevelWidth

BevelWidth Property

Determines the width, in pixels, of both the inner and outer bevels of a panel.

Description

Use BevelWidth to specify how wide the inner or outer bevel should be. Do not confuse BevelWidth, which is the width of the bevels, with BorderWidth, which is the space between the bevels.

If both the BevelInner and BevelOuter properties are bvNone, BevelWidth has no effect. To remove both bevels, set the BevelInner and BevelOuter properties to bvNone, rather than setting the BevelWidth to 0, as this involves less overhead when painting.


BiDiMode

BiDiMode Property

Specifies the bi-directional mode for the control.

Description

The bi-directional mode controls the reading order for the text, the placement of the vertical scroll bar, and whether the alignment is changed.
Value | Meaning
bdLeftToRight | Reading order is left to right. Alignment is not changed. The vertical scroll bar appears on the right edge of the control.
bdRightToLeft | Reading order is right to left. Alignment is changed. The vertical scroll bar appears on the left edge of the control.
bdRightToLeftNoAlign | Reading order is right to left. Alignment is not changed. The vertical scroll bar appears on the left edge of the control.
bdRightToLeftReadingOnly | Reading order is right to left. Alignment and scroll bar are not changed.


BorderIcons

BorderIcons Property

Specifies which icons appear on the title bar of the form.

Description

May contain the following values:
Value | Meaning
biSystemMenu | The form has a Control menu (also known as a System menu).
biMinimize | The form has a Minimize button
biMinimize | The form has a Maximize button
biHelp | If BorderStyle is bsDialog or biMinimize and biMaximize are excluded, a question mark appears in the form's title bar and when clicked, the cursor changes to crHelp; otherwise, no question mark appears.


BorderStyle

BorderStyle Property

Determines whether the edit control has a single line border around the client area.

Description

Use BorderStyle to affect the sharpness with which the client area of the edit control stands out. BorderStyle can have a value of either bsSingle or bsNone. If BorderStyle is bsSingle, the edit control has a single-line border around the client area. If BorderStyle is bsNone, there will be no border.
Value | Meaning
bsNone | No visible border.
bsSingle | Single-line border.


BorderWidth

BorderWidth Property

Specifies the distance, in pixels, between the outer and inner bevels.

Description

Use BorderWidth to specify how wide the border around the panel should be. A value of 0 (zero) means no border should appear.


Brush

Brush Property

Specifies the color and pattern used for filling the shape control.


Cancel

Cancel Property

Determines whether the button’s OnClick event handler executes when the Escape key is pressed.

Description

If Cancel is true, the button’s OnClick event handler executes when the user presses Esc. Although an application can have more than one Cancel button, the form calls the OnClick event handler only for the first visible button in the tab order.


Caption

Caption Property

Specifies a text string that identifies the control to the user.

Description

Use Caption to specify the text string that labels the control.

To underline a character in a Caption that labels a component, include an ampersand (&) before the character. This type of character is called an accelerator character. The user can then select the component by pressing Alt while typing the underlined character. To display an ampersand character in the caption, use two ampersands (&&).

Note: Controls that display text use either the Caption property or the Text property to specify the text value. Which property is used depends on the type of control. In general, Caption is used for text that appears as a window title or label, while Text is used for text that appears as the content of a control.


Center

Center Property

Indicates whether the image is centered in the image control.

Description

When the image does not fit perfectly within the image control, use Center to specify how the image is positioned. When Center is true, the image is centered in the control. When Center is false, the upper left corner of the image is positioned at the upper left corner of the control.


CharCase

CharCase Property

Determines the case of the text within the edit control.

Description
Value | Meaning
ecLowerCase | The text is converted to lowercase.
ecNormal | The text appears in mixed case. It is not forced into any case.
ecUpperCase | The text is converted to uppercase.


ClickAction

ClickAction Property

Determines the OnClick event handler.

Description

ClickAction may have following values.

Value | Action
caRegister | Perform register. This way the application reads name and key value from edit controls and tries to register.
caContinue | Continue execution
caExit | Exit application
caNone | Nothing to do


ClientHeight

ClientHeight Property

Specifies the height (in pixels) of the form’s client area.

Description

Use ClientHeight to determine the height (in pixels) of the form’s client area. The client area is the usable area inside the form's border, excluding the title bar, scroll bars, and so on.

Set ClientHeight to change the height of the form’s window based on the desired client area. To change the height of the form’s window based on the total size of the window (including the border, menu, status bar and so on), use the Height property instead.


ClientWidth

ClientWidth Property

Specifies the width (in pixels) of the form’s client area.

Description

Use ClientWidth to determine the width (in pixels) of the form’s client area. The client area is the usable area inside the form's border. Set ClientWidth to change the width of the form’s window based on the desired client area. To change the width of the form’s window based on the total size of the window (including the border, status bar and so on), use the Width property instead.


CloseAction

CloseAction Property

Determines the OnClose event handler.

Description

CloseAction may have following values.

Value | Action
caRegister | Perform register. This way the application reads name and key value from edit controls and tries to register.
caContinue | Continue execution
caExit | Exit application
caNone | Nothing to do


Color

Color Property

Specifies the background color of the control.

Description

Use Color to read or change the background color of the control.


Constraints

Constraints Property

Specifies the size constraints for the control.

Description

Use Constraints to specify the minimum and maximum width and height of the control. When Constraints contains maximum or minimum values, the control cannot be resized to violate those constraints.

Warning: Do not set up constraints that conflict with the value of the Align or Anchors property. When these properties conflict, the response of the control to resize attempts is not well-defined.


Content

Content Property

Determines the content of the edit control. This information is used when the registration information is verifying and the current hardware id should be shown.

Description

Content may have following values.

Value | Action
coRegistratioName | The edit will contain a registaration name. Users will have to enter registration name into this control.
coRegistratioKey | The edit will contain a registration key. Users will have to enter registration key into this control.
coHardwareID | This edit will be filled out with the Hardware ID.
coCustom | The edit contains custom text.


Ctl3D

Ctl3D Property

Determines whether a control has a three-dimensional (3-D) or two-dimensional look.


Cursor

Cursor Property

Specifies the image used to represent the mouse pointer when it passes into the region covered by the control.

Description

Change the value of Cursor to provide feedback to the user when the mouse pointer enters the control.
Cursor | Image
crDefault | Whatever cursor is the default for the window class (usually crArrow)
crNone |
crArrow |
crCross |
crIBeam |
crSizeNESW |
crSizeNS |
crSizeNWSE |
crSizeWE |
crUpArrow |
crHourGlass |
crDrag |
crNoDrop |
crHSplit |
crVSplit |
crMultiDrag |
crSQLWait |
crNo |
crAppStart |
crHelp |
crHandPoint |
crSize |
crSizeAll |


Default

Default Property

Determines whether the button’s OnClick event handler executes when the Enter key is pressed.

Description

If Default is true, the button’s OnClick event handler executes when the user presses Enter.

Although an application can have more than one Default button, the form calls the OnClick event handler only for the first visible button in the tab order. Moreover, any button that has focus becomes the Default button temporarily; hence, if the user selects another button before pressing Enter, the selected button’s OnClick event handler executes instead.


Enabled

Enabled Property

Controls whether the control responds to mouse and keyboard.

Description

Use Enabled to change the availability of the control to the user. To disable a control, set Enabled to false. Disabled controls appear dimmed. If Enabled is false, the control ignores mouse and keyboard.


Flat

Flat Property

Determines whether the button has a 3D border that provides a raised or lowered look.

Description

Set Flat to true to remove the raised border when the button is unselected and the lowered border when the button is clicked or selected. When Flat is true, use separate bitmaps for the different button states to provide visual feedback to the user about the button state.


Font

Font Property

Controls the attributes of text written on or in the control.


FontHovered

FontHovered Property

Controls the attributes of text of the TLink when the mouse pointer is moving over the control.


FormStyle

FormStyle Property

Determines the form’s style.

Description

FormStyle consists of the following values.
Value | Meaning
fsNormal | The form is neither an MDI parent window nor an MDI child window.
fsMDIChild | The form is an MDI child window.
fsMDIForm | The form is an MDI parent window.
fsStayOnTop | This form remains on top of the desktop and of other forms in the project, except any others that also have FormStyle set to fsStayOnTop. If one fsStayOnTop form launches another, neither form will consistently remain on top.


Glyph

Glyph Property

Specifies the bitmap that appears on the speed button.

Description

Set Glyph to a bitmap object that contains the image that should appear on the face of the button. Bring up the Open dialog box from the Object Inspector to choose a bitmap file (with a .BMP extension).

Glyph can provide up to four images within a single bitmap. All images must be the same size and next to each other in a horizontal row. TSpeedButton displays one of these images depending on the state of the button.

Image position | Button state | Description
First | Up | This image appears when the button is unselected. If no other images exist in the bitmap, this image is used for all states.
Second | Disabled | This image usually appears dimmed to indicate that the button can't be selected.
Third | Clicked | This image appears when the button is clicked. If GroupIndex is 0, the Up image reappears when the user releases the mouse button.
Fourth | Down | This image appears when the button stays down indicating that it remains selected.

If only one image is present, TSpeedButton attempts to represent the other states by altering the image slightly for each state, although the Down state is always the same as the Up state.

If the bitmap contains multiple images, specify the number of images in the bitmap with the NumGlyphs property.

Note: The lower left pixel of the bitmap is reserved for the “transparent” color. Any pixel in the bitmap that matches the lower left pixel will be transparent.


Height

Height Property

Specifies the vertical size of the control in pixels.


Hint

Hint Property

Contains the text string that can appear when the user moves the mouse over the control.

Description

Use the Hint property to provide a string of help text either as a Help Hint, or as help text on a particular location such as a status bar.

A Help Hint is a box containing help text that appears for a control when the user moves the mouse pointer over the control and pauses momentarily. To set up Help Hints:

- Specify the Hint property of each control for which a Help Hint should appear
- Set the ShowHint property of each appropriate control to true and set the ShowHint property of the form to true.

Note: If the application's ShowHint property is false, the Help Hint does not appear.


HorzScrollBar

HorzScrollBar Property

Represents the horizontal scroll bar for the scrolling windowed control.


Layout

Layout Property

Specifies the vertical placement of the text within the label.

Description

Set Layout to specify how the text of the label is placed within the ClientRect of the label control. Layout is the vertical analog to the Alignment property.


Left

Left Property

Specifies the horizontal coordinate of the left edge of a component relative to its parent.


Lines

Lines Property

Contains the individual lines of text in the memo control.

Description

Use Lines to manipulate text in an memo control on a line-by-line basis.


Margin

Margin Property

Specifies the number of pixels between the edge of the button and the image or caption drawn on its surface.

Description

Use Margin to specify the indentation of the image specified by the Glyph property or the text specified by the Caption property. The edges that Margin separates depends on the Layout property. If Layout is blGlyphLeft, the margin appears between the left edge of the image or caption and the left edge of the button. If Layout is blGlyphRight, the margin separates the right edges. If Layout is blGlyphTop, the margin separates the top edges, and if Layout is blGlyphBottom, the margin separates the bottom edges.

If Margin is –1, the image or text is centered on the button.


MaxLength

MaxLength Property

Specifies the maximum number of characters the user can enter into the edit control.

Description

Use MaxLength to limit the number of characters that can be entered into the edit control. A value of -1 indicates that there is no application-defined limit on the length.

Use MaxLength to limit the length of the text in an edit control if that text will be copied into a fixed-length buffer.

Note: Setting MaxLength to a value less than the number of characters currently in the edit control causes the edit control to truncate its text to MaxLength characters.


Name

Name Property

Specifies the name of the control.

Description

Use the Name property to assign a new name to the control or to find out what the name of the control is. Property is informative, it does not affect on workability.


NumGlyphs

NumGlyphs Property

Specifies the number of images included in the Glyph property.

Description

Set NumGlyphs to the number of images provided by the bitmap assigned to the Glyph property. All images must be the same size and next to each other in a row. The Glyph property can provide up to four images.


PasswordChar

PasswordChar Property

Indicates the character, if any, to display in place of the actual characters typed in the control.

Description

Use the PasswordChar property to create an edit control that displays a special character in place of any entered text. If PasswordChar is set to the null character (ANSI character zero), the edit control displays its text normally. If PasswordChar is any other character, the edit control displays PasswordChar in place of each character typed. PasswordChar affects the appearance of the edit control only. The value of the Text property reflects the actual characters that are typed.


Pen

Pen Property

Specifies the pen used to outline the shape control.


Picture

Picture Property

Specifies the image that appears on the image control.


Position

Position Property

Represents the size and placement of the form.


Proportional

Proportional Property

Indicates whether the image should be changed, without distortion, so that it fits the bounds of the image control.

Description

Set Proportional to true to ensure that the image can be fully displayed in the image control without any distortion such as occurs with the Stretch property. When Proportional is true, images that are too large to fit in the image control are scaled down (while maintaining the same aspect ratio) until they fit in the image control. Images that are too small are displayed normally. That is, Proportional can reduce the magnification of the image, but does not increase it.

When the image control resizes, the image resizes also.

To resize the image so that it fits exactly in the image control, even if that causes distortion, use the Stretch property instead.

To resize the control to the image rather than resizing the image to the control, use the AutoSize property instead.

The default value for Proportional is false.

Note: Proportional has no effect if the Picture property contains an icon.


ReadOnly

ReadOnly Property

Determines whether the user can change the text of the edit control.

Description

To restrict the edit control to display only, set the ReadOnly property to true. Set ReadOnly to false to allow the contents of the edit control to be edited.


ScrollBars

ScrollBars Property

Determines whether the control has scroll bars.

Description

ScrollBars can take one of the following values:
Value | Meaning
ssNone | The control has no scroll bars.
ssHorizontal | The control has a single scroll bar on the bottom edge.
ssVertical | The control has a single scroll bar on the right edge.
ssBoth | Horizontal scrollbar that appears as-needed.


Shape

Shape Property

Determines the shape of the bevel.

Description

Set Shape to specify whether the bevel appears as a line, box, frame, or space. For shapes that can appear either raised or lowered, the Style property indicates which effect is used.

The default value for Shape is bsBox.

Value | Meaning
bsBox | The entire client area appears raised or lowered.
bsFrame | The client area is outlined by a raised or lowered frame.
bsTopLine | The bevel displays a line at the top of the client area.
bsBottomLine | The bevel displays a line at the bottom of the client area.
bsLeftLine | The bevel displays a line at the left side of the client area.
bsRightLine | The bevel displays a line at the right side of the client area.
bsSpacer | The bevel is an empty space.


ShowCopyButton

ShowCopyButton Property

Allows to show a Copy to Clipboard button near with the edit control and associated with it.

Description

This property could be, for example, used to copy shown Hardware ID from control to clipboard.


ShowHint

ShowHint Property

Determines whether the control displays a Help Hint when the mouse pointer rests momentarily on the control.

Description

The Help Hint is the value of the Hint property, which is displayed in a box just beneath the control. Use ShowHint to determine whether a Help Hint appears for the control.

To enable Help Hint for a particular control, the application ShowHint property must be true.


ShowPasteButton

ShowPasteButton Property

Allows to show a Paste from Clipboard button near with the edit control and associated with it.

Description

This property could be, for example, used to paste registration name or key to the control from clipboard.


Spacing

Spacing Property

Determines where the image and text appear on a speed button.

Description

Set Spacing to the number of pixels that should appear between the image specified in the Glyph property and the text specified in the Caption property.

If Spacing is a positive number, its value is the number of pixels between the image and text. If Spacing is 0, the image and text appear flush with each other. If Spacing is -1, the text appears centered between the image and the button edge.


Stretch

Stretch Property

Indicates whether the image should be changed so that it exactly fits the bounds of the image control.

Description

Set Stretch to true to cause the image to assume the size and shape of the image control. When the image control resizes, the image resizes also. Stretch resizes the height and width of the image independently. Thus, unlike a simple change in magnification, Stretch can distort the image if the image control is not the same shape as the image.

To resize the control to the image rather than resizing the image to the control, use the AutoSize property instead.


Style

Style Property

Determines whether the bevel appears raised or lowered.

Description

Set Style to indicate whether the bevel should create a raised or a lowered effect. When the Shape property is bsBox, the entire client area appears raised or lowered. For all other values of Shape, the bevel displays a raised or lowered line along the edge or edges of the client area. The default value of Style is bsLowered.
Value | Meaning
bsLowered | The bevel is lowered.
bsRaised | The bevel is raised.


TabOrder

TabOrder Property

Indicates the position of the control in its parent's tab order.

Description

TabOrder is the order in which child windows are visited when the user presses the Tab key. The control with the TabOrder value of 0 is the control that has the focus when the form first appears.

Initially, the tab order is always the order in which the controls were added to the form. The first control added to the form has a TabOrder value of 0, the second is 1, the third is 2, and so on. Change this by changing the TabOrder property.

Each control has a unique tab-order value within its parent. If you change the TabOrder property value of one control to be the same as the value of a second control, the TabOrder value for all the other controls changes. For example, suppose a control is sixth in the tab order. If you change the control's TabOrder property value to 3 (making the control fourth in the tab order), the control that was originally fourth in the tab order now becomes fifth, and the control that was fifth becomes sixth.

Assigning TabOrder a value greater than the number of controls contained in the parent control moves the control to the end of the tab order. The control does not take on the assigned value of TabOrder, but instead is given the number that assures the control is the last in the tab order.

Note: TabOrder is meaningful only if the TabStop property is true and if the control has a parent. (The TabOrder property of a form is not used unless the form is the child of another form.) A control with a TabOrder of -1 has no parent, and therefore cannot be reached by pressing the Tab key. To remove a parented control from the Tab order, set its TabStop property to false.


TabStop

TabStop Property

Determines if the user can tab to a control.

Description

Use the TabStop to allow or disallow access to the control using the Tab key.

If TabStop is true, the control is in the tab order. If TabStop is false, the control is not in the tab order and the user can't press the Tab key to move to the control.

Note: TabStop is not meaningful for a form unless the form assigns another form to be its parent.


Top

Top Property

Specifies the Y coordinate of the top left corner of a control, relative to its parent or containing control in pixels.


Transparent

Transparent Property

Specifies whether the background of the control obscures objects below the control object.

Description

Set Transparent to true to allow objects behind the control object to show through the background of the control. Set Transparent to false to make the background of the control opaque.


TransparentColor

TransparentColor Property

Specifies whether a color on the form appears transparent.

Description

Use TransparentColor to indicate that one of the colors on the form should be treated as transparent, allowing windows behind the form to completely show through. The TransparentColorValue property indicates the color that appears completely transparent.

Note: To make the entire form transparent, or to make it translucent rather than transparent, use the AlphaBlend and AlphaBlendValue properties.


TransparentColorValue

TransparentColorValue Property

Indicates the color on the form that appears transparent when TransparentColor is true.

Description

Use TransparentColorValue to indicate the color that appears transparent when the TransparentColor property is true.


Url

Url Property

Specifies the Url that will be opened on OnClick action.

Description

Url property can open not only the browser window but also a default email client and some other files. For example:

url https://enigmaprotector.com/ opens a browser window with the current address,

url mailto:support@enigmaprotector.com opens a default email client with the offer to create email for support@enigmaprotector.com

url License.txt opens a Windows notepad with the License.txt file.


VertScrollBar

VertScrollBar Property

Represents the vertical scroll bar for the scrolling windowed control.


Visible

Visible Property

Determines whether the component appears onscreen.


WantReturns

WantReturns Property

Determines whether the user can insert return characters into the text.

Description

Set WantReturns to true to allow users to enter return characters into the text. Set WantReturns to false to allow the form to handle return characters instead.

For example, in a form with a default button (such as an OK button) and a memo control, if WantReturns is false, pressing Enter chooses the default button. If WantReturns is true, pressing Enter inserts a return character in the text.

Note: If WantReturns is false, users can still enter return characters into the text by pressing Ctrl+Enter.


Width

Width Property

Specifies the horizontal size of the control or form in pixels.


WindowState

WindowState Property

Represents how the form appears on the screen.

Description

WindowState describes the state of a form window. The following table lists the possible values:
Value | Meaning
wsNormal | The form is in its normal state (that is, neither minimized nor maximized).
wsMinimized | The form is minimized.
wsMaximized | The form is maximized.


WordWrap

WordWrap Property

Specifies whether the button text wraps to fit the width of the control.

Description

Set WordWrap to true to allow the label to display multiple line of text. When WordWrap is true, text that is too wide for the control wraps at the right margin.

Set WordWrap to false to limit the label to a single line. When WordWrap is false, text that is too wide for the label appears truncated.


TBevel

Use TBevel to create beveled boxes, frames, or lines. The bevel can be raised or lowered.

Properties

  • Align
  • Anchors
  • Constraints
  • Cursor
  • Height
  • Hint
  • Left
  • Name
  • Shape
  • ShowHint
  • Style
  • Top
  • Visible
  • Width


TButton

Use TButton to put a standard push button on the form. TButton may process such user actions like register, close application and continue execution.

Properties

  • Anchors
  • BiDiMode
  • Cancel
  • Caption
  • ClickAction
  • Constraints
  • Cursor
  • Default
  • Enabled
  • Font
  • Height
  • Hint
  • Left
  • Name
  • ShowHint
  • TabOrder
  • TabStop
  • Top
  • Visible
  • Width
  • WordWrap


TEdit

Use a TEdit object to put standard Windows edit control on the form. Edit controls are used to retrieve text that users type. The edit controls can also display the text to the user. TEdit may contain Hardware ID string or custom string, allows to enter registration name and key.

Properties

  • Align
  • Anchors
  • BevelEdges
  • BevelInner
  • BevelKind
  • BevelOuter
  • BevelWidth
  • BiDiMode
  • BorderStyle
  • CharCase
  • Color
  • Constraints
  • Content
  • Ctl3D
  • Cursor
  • Enabled
  • Font
  • Height
  • Hint
  • Left
  • MaxLength
  • Name
  • PasswordChar
  • ReadOnly
  • ShowCopyButton
  • ShowHint
  • ShowPasteButton
  • TabOrder
  • TabStop
  • Top
  • Visible
  • Width


TForm

TForm represents the main registration window.

Properties

  • AlphaBlend
  • AlphaBlendValue
  • BiDiMode
  • BorderIcons
  • BorderStyle
  • BorderWidth
  • Caption
  • ClickAction
  • ClientHeight
  • ClientWidth
  • CloseAction
  • Color
  • Constraints
  • Ctl3D
  • Cursor
  • Enabled
  • Font
  • FormStyle
  • Height
  • Hint
  • HorzScrollBar
  • Left
  • Name
  • Position
  • ShowHint
  • Top
  • TransparentColor
  • TransparentColorValue
  • VertScrollBar
  • Width
  • WindowState


TGroupBox

The TGroupBox component represents standard Windows group box, used to group related controls in the form.

Properties

  • Align
  • Anchors
  • BiDiMode
  • Caption
  • Color
  • Constraints
  • Ctl3D
  • Cursor
  • Enabled
  • Font
  • Height
  • Hint
  • Left
  • Name
  • ShowHint
  • TabOrder
  • TabStop
  • Top
  • Visible
  • Width


TImage

Use TImage to display a graphical image on the form.

Properties

  • Align
  • Anchors
  • AutoSize
  • Center
  • Constraints
  • Cursor
  • Enabled
  • Height
  • Hint
  • Left
  • Name
  • Picture
  • Proportional
  • ShowHint
  • Stretch
  • Top
  • Transparent
  • Visible
  • Width


TLabel

Use TLabel to add text that the user can’t edit in the form.

Properties

  • Align
  • Alignment
  • Anchors
  • AutoSize
  • BiDiMode
  • Caption
  • Color
  • Constraints
  • Cursor
  • Enabled
  • Font
  • Height
  • Hint
  • Layout
  • Left
  • Name
  • ShowHint
  • Top
  • Transparent
  • Visible
  • Width
  • WordWrap


TLink

Use TLink for a hyperlink to the form that will be able to open an url in the browser, open default email client, open some external file.

Properties

  • Align
  • Alignment
  • Anchors
  • AutoSize
  • BiDiMode
  • Caption
  • Color
  • Constraints
  • Cursor
  • Enabled
  • Font
  • FontHovered
  • Height
  • Hint
  • Layout
  • Left
  • Name
  • ShowHint
  • Top
  • Transparent
  • Url
  • Visible
  • Width
  • WordWrap


TMemo

Use TMemo to put a standard Windows multiline edit control on the form. Multiline edit boxes allow the user to enter more than one line of text. They are appropriate for representing lengthy information. Memo may contain Hardware ID string or custom string, allows to enter registration name and key.

Properties

  • Align
  • Alignment
  • Anchors
  • BevelEdges
  • BevelInner
  • BevelKind
  • BevelOuter
  • BiDiMode
  • BorderStyle
  • Color
  • Constraints
  • Content
  • Ctl3D
  • Cursor
  • Enabled
  • Font
  • Height
  • Hint
  • Left
  • Lines
  • MaxLength
  • Name
  • ReadOnly
  • ScrollBars
  • ShowCopyButton
  • ShowHint
  • ShowPasteButton
  • TabOrder
  • TabStop
  • Top
  • Visible
  • WantReturns
  • Width
  • WordWrap


TPanel

Use TPanel to put an empty panel on the form.

Properties

  • Align
  • Alignment
  • Anchors
  • BevelEdges
  • BevelInner
  • BevelKind
  • BevelOuter
  • BevelWidth
  • BiDiMode
  • BorderStyle
  • BorderWidth
  • Caption
  • Color
  • Constraints
  • Ctl3D
  • Cursor
  • Enabled
  • Font
  • Height
  • Hint
  • Left
  • Name
  • ShowHint
  • TabOrder
  • TabStop
  • Top
  • Visible
  • Width


TShape

Add a TShape object to the form to draw a simple geometric shape on the form.

Properties

  • Align
  • Anchors
  • Brush
  • Constraints
  • Cursor
  • Enabled
  • Height
  • Hint
  • Left
  • Name
  • Pen
  • Shape
  • ShowHint
  • Top
  • Visible
  • Width


TSpeedButton

TSpeedButton is almost same TButton control but allows to add an image onto the button.

Properties

  • Anchors
  • BiDiMode
  • Caption
  • ClickAction
  • Constraints
  • Cursor
  • Enabled
  • Flat
  • Font
  • Glyph
  • Height
  • Hint
  • Layout
  • Left
  • Margin
  • Name
  • NumGlyphs
  • ShowHint
  • Spacing
  • Top
  • Visible
  • Width


Registration Dialog

Registration Dialog Designer

The Registration Dialog Designer allows you to design a custom registration dialog, to apply your own styles and window controls configuration. Here you can put your own controls in the form and define registration events. The registration dialog designer contains 3 forms:

Components Palette

Contains a set of available components that you can put in the registration form. The main menu of the form allows you to show Object Inspector and Designed Form. The description of the components' properties can be seen below. To place a component on the registration form, click the necessary component on the Component Palette and then click on the Registration Form to put the component in the necessary position.

There are the following controls available:

  • TForm - the registration form itself;
  • TEdit control allows you to enter the registration name and key, shows the hardware ID or contains any user text;
  • TLabel control allows you to show any text;
  • TGroupBox control allows you to group several controls in the form and also may contain a header text;
  • TMemo control is very similar to TEdit control, but may have multiple lines of the text;
  • TButton is a push button control that allows managing user actions such as registering, closing the application or continuing the execution;
  • TSpeedButton control is very similar to TButton, but may also contain an image;
  • TLink control allows you to open a browser window, a default email client, some text file in the external window or open/execute any other file;
  • TImage control allows you to draw a simple geometric shape in the form;
  • TShape control allows you to place an image in the form;
  • TBevel control allows you to create beveled boxes, frames, or lines;
  • TPanel control allows you to put an empty panel in the form. Panels have features for providing a beveled border around the control, as well as methods to help manage the placement of child controls embedded in the panel;

File menu

  • Load from File - allows you to load the registration form from an external file;
  • Save to File - allows you to save the current registration form to an external file;
  • Exit - exit the designer;

Edit menu

  • Cut - cut selected control(s) from clipboard;
  • Copy - copy selected control(s) to clipboard;
  • Paste - paste copied/cut control(s) from clipboard to the form;
  • Delete - delete selected control(s) from the form;
  • Select All - select all control(s) on the form;
  • Bring to Front - bring selected control(s) to the front;
  • Send to Back - send selected control(s) to the back;
  • Align to Grid - align selected control(s) to the grid;

View menu

  • Object Inspector - shows Object Inspector;
  • Designed Form - shows the designed registration form;

Registration Form

It is a form that will be shown to the users for them to enter registration information. Click on the necessary component that is placed on this form and its properties will be shown in the Object Inspector. To delete the component from the form, right-click the component and select Delete item in the appeared pop-up menu, or press the Del key (Note: the registration form cannot be deleted).

Right-clicking shows the registration form pop-up menu.

  • Cut - cut selected control(s) from clipboard;
  • Copy - copy selected control(s) to clipboard;
  • Paste - paste copied/cut control(s) from clipboard to the form;
  • Delete - delete selected control(s) from the form;
  • Select All - select all control(s) on the form;
  • Bring to Front - bring selected control(s) to the front;
  • Send to Back - send selected control(s) to the back;
  • Align to Grid - align selected control(s) to the grid;

Object Inspector

Selected the component properties are shown here. Navigate to the necessary control description to learn more about its properties.

  • Click here to view TForm properties;
  • Click here to view TEdit properties;
  • Click here to view TLabel properties;
  • Click here to view TMemo properties;
  • Click here to view TGroupBox properties;
  • Click here to view TButton properties;
  • Click here to view TSpeedButton properties;
  • Click here to view TLink properties;
  • Click here to view TImage properties;
  • Click here to view TShape properties;
  • Click here to view TBevel properties;
  • Click here to view TPanel properties;


Key Expiration Reminder

Allows you to notify the user that the registration will soon expire. The feature works only if the registration key has an expiration date.

Show Registration Key Reminder - enables the key expiration reminder message to be shown.

Start to show reminder (days before expiration) - specify the number of days before the key expiration when the user should get a reminder message. Click the "Design Message" button to design a reminder message, see Message Designer for more information.


Check-Up

The functions of this topic allow adding a set of checkups like the checkup of file content changing, memory patching, etc.

Follow the links below to get more details.

  • Anti Debugger
  • Control Sum
  • Startup Password
  • File Name
  • Disk Drive
  • Executed Copies
  • User Language
  • External Files
  • Executed Processes
  • Loaded Drivers
  • Installed Services
  • Windows Version
  • Virtualization Tools
  • Privileges


Anti Debugger

Use anti-debugger check-up - checks the debugger presence. A debugger is any tool which provides reversing of sources during the application work. The examples of debuggers are SoftIce, OllyDbg, TWD, IDA, x96dbg etc. Feature checks for a debugger at application start only, as the time of file execution is most important to protect against reverse engineering.

Check debugger in runtime - searches for debugger all the time while application is running.

Show Message before termination - if this option is enabled a reminder message will be shown in case a debugger is found. To edit the content of the message, press "Design Message". In case the option is disabled, the execution of the module will be terminated without notification.


Control Sum

Use control sum check-up - serves for tracking module source codes changes. Module source codes changes refer to the changes of the file content, memory changes during the module start and work. The reasons of source codes changes can be cracks or viruses.

In case any modifications of the module file or the module memory are detected during the module start, the execution process will be terminated.

Run-time integrity checking - enables the technique of monitoring the memory source code modifications during the module work. Most executables have parts of the codes located in the memory with read only access characteristics, the current technique continuously watches the read-only memory parts and checks these control sums. In case any modification is detected, the process will be terminated immediately. The modifications of the memory parts with read-only characteristics can be caused only by the influence of crackers or viruses.

File integrity checking - allows to check any change of the protected file. This option is compatible with the digital signing and changing of control sum value in the PE file header.

Show Message before termination - enable it if you need to notify the user about the module change and module termination. To edit the message, press "Design Message" button. In case the option is disabled, the execution of the module will be terminated without notification.


Startup Password

Use password checkup - enables startup password checkup. If this feature is enabled, the user will get a dialog on the file start that asks to enter a password. If the user enters the valid password, the execution will continue, otherwise a message will be shown and termination will take place. To design the message, click Design Message button. You can set any number of passwords and commentaries to each pass. A commentary is any string, it is used only as a reminder and does not affect module workability.

Always ask for password - always ask for a password when the module is executed;

Ask for password only for the first time - ask for a password every execution until a valid password is typed. After you have typed a valid password for the first time, it won't be asked anymore.

Ask in days - once a valid password is typed, the dialog will be shown again after a defined number of days.

Hide password symbols - if option is enabled, the password symbols will be hidden/replaced with "*" symbol. Otherwise, the password will not be hidden;

Allow to change password - allows the user to change the startup password. Note that this feature works for one password per PC only. For example, if the user uses 2 passwords on one PC and decides to change the first one, it will be possible; if the user decides to change the second one, they will succeed as well, but the first password will return to the original one.

To add, edit, delete the password, press the following buttons.


File Name

Use file name check-up - checks changes of the module file name. Use it to prevent changes of the module file name.

During the module start, the loader checks the module file name (which is placed in the "Original file name" field), in case it differs from the original one the module execution will be terminated.

"Get Actual" button - read the file name from "Output-File name of resulting program module" and place in the "Original file name" field.

Show Message before termination - enable it, if you need to notify the user that there is an error in the module file name. To edit the message, press "Design Message" button. If this option is disabled, the execution will be terminated without notification.


Disk Drive

Use drive disk type check-up - serves for checking the drive type on which the module is executed. The function can be used in cases when you want to limit module execution depending on the drive type (hard disk, CD-Rom, etc).

While the module is starting, the loader is checking the drive type on which the module is placed. If the current module type is denied by the loader, the execution will be terminated.

Selection:

  • Floppy disk (removable).
  • Hard Disk drive.
  • Network drive.
  • CD-ROM drive.
  • RAM disk.

Show Message before termination - if it is enabled, the user will be notified in case the module isn't executed due to the drive deny. To edit the message, press "Design Message" button. If this option is disabled, the execution will be terminated without notification.


Executed Copies

Use limitation of count of executed copies - serves for limiting the number of simultaneously executed module copies.

Allow copies - choose the possible count of simultaneously executed copies of the module.

Terminate Execution - with this option enabled, the execution will be terminated if the number of simultaneously executed copies of the protected application exceeds the defined value. This option may be very helpful for checking the copies count manually through the EP_CheckupCopies Enigma API.

Show message if copies count is exceeded - if the count of simultaneously executed copies of the module exceeds the value defined in the "Allow copies" field, a warning message will be shown and execution of the module will be stopped. To edit the warning message, press "Design Message" button.

While the module is starting, the Enigma loader will be checking how many copies of the current module have already been executed, if the module count exceeds the defined value, then execution will be stopped.


User Language

Lock execution to user language - allows you to lock execution of the protected module to a user country. Select possible countries to execute the module. If the module is executed in a non-selected country, an alert message will be shown (if the "Show message before termination" option is enabled) or the module will be terminated silently;

Select all - select all items in the countries list;

Unselect all - deselect all items in the countries list;

Invert selection - invert selection of all items, i.e. deselect all selected items and vice versa.

Show Message before termination - with this option enabled, the user will be notified in case the module isn't executed due to the user language lock. To edit the message, press "Design Message" button. If this option is disabled, the execution will be terminated without notification.


External Files

Use checkup of external files - checking external files. During the software distribution, it is a good idea to check the content of distributive files against changing. After adding the file into the list, define the necessary parameters to checkup. If at least one checkup parameter differs from the defined one while the protected file is starting, it will be terminated. Click on the files list,

column "Action" - you will see the list of available checkups for files, the common ones are:

  • Delete file from the list
  • File checksum - checks the full content of the file
  • File Version - checks the version of the file (this option is for Win32 executable files only)
  • File Size - checks the size of the file
  • File Date - checks the date of the file
  • File Attributes - checks attributes of the file.

column "Base Relative Path" - define a base relative path of the checkup file relatively to the main protected module.

column "Relative Path" - define a relative path of the checkup file relatively to "Base Relative Path".

Example: you have the main protected module and you need a checkup of the file that is placed in the "Example" subfolder relatively to the main protected module, you need to add the file to the list, choose "Base Relative Path" to "%DEFAULT FOLDER%" then add the name of the subfolder "Example" in the "Relative Path".

Add File - press this button to add a file(s) into the list.

Show message before termination - if Enigma checks that the external file has been modified, it will show a message and will be terminated. To edit the warning message, press "Design Message" button.


Executed Processes

Use checkup of executed processes - checking executed processes. This feature allows you to make your own list of the "black" programs that can not be executed together with the protected module. There you may define a list of the software that should not be executed while the protected module is working. How does it work? While the protected file is working and starting, the Enigma loader is enumerating all the executed processes and checking if there is any software blocked by the function. If blocked software is found, the protected module is immediately terminated. For example, this feature allows you to get protection against OllyDbg (software debugger), SnagIt (screen capture tool), file and registry monitors. You can define checkup parameters (click on the columns to edit):

column "Action" - you will see the list of available checkups for the processes, the common ones are:

  • Delete process from the list
  • File Name - checkup of the file name of the executed process
  • Window Text - checkup of the name of the process window (Warning: the window text may be changed while the application is working)
  • Window Class - checkup of a window class.

column "File Name" - define a file name of the process to search.

column "Window Text" - the text of the window to search. If you want to search the window text by mask, you can enter the text quoted with an asterisk (*) symbol. For example, entered text *OllyDbg* will search any window which text (any part of text) contains OllyDbg word.

column "Window Class " - the class of the window to search.

Add Process - press this button to add a process(es) into the list. Note: you may add any process to the list and then edit it as you want. The appeared window shows you all the processes with their windows that are currently executed in your system.

Check Executed Processes every X second(s) - it enables runtime checkup of executed processes while the protected application is working. Set up the optimal number of seconds delay between the checkups (if you have many items, for example, greater than 50, to checkup in the list, we recommend setting number of seconds greater than 10 to avoid high CPU loading on slow PCs). If this feature is disabled, the Enigma will check executed processes only once upon the application startup.

Show message before termination - if the Enigma checks that there is an executed process that matches the criteria, it will show a message and will be terminated. To edit the warning message, press "Design Message" button.


Loaded Drivers

Use checkup of loaded drivers - it checks if the drivers with the defined names are installed in the system. A lot of reversing tools use drivers to perform some work, use this checkup to detect hack tools and avoid execution of the protected file. This checkup works not only at the file start, but also all the time during the work of the protected file.

To add a driver to the list, click the Add button and edit the Driver Name column. To edit the driver name, click on the necessary row at the Driver Name column and edit the text. To delete a driver from the list, click [image] image at the row to delete.

Show message before termination - if Enigma detects that the external file has been modified, Enigma will show a message and will be terminated. To edit the warning message, press "Design Message" button.


Installed Services

Use checkup of installed services - checks the installed services. Warning: the feature does NOT support Windows 95, 98 and ME and requires Administaror privileges. It allows you to make your own list of the "black" services that could not be installed together with the protected module. You can define checkup parameters (click on the columns to edit):

column "Action" - you will see the list of available checkups for the services, the common ones are:

  • Delete service from the list
  • Name - the service name
  • Display Name - an expanded service name.

column "Name" - define the name of the service to search.

column "Display Name " - an expanded service name.

Add Service - press this button to add a service(s) into the list. Note: you may add any service to the list and then edit it as you want. The appeared window shows you all the services that are currently installed in your system.

Show message before termination - if the Enigma detects that there is a service that matches the criteria installed, it will show a message and will be terminated. To edit the warning message, press "Design Message" button.


Windows Version

Use checkup of windows version - checks the Windows version. It allows you to DENY execution of the protected module for a particular Windows version. If the Enigma loader detects during the execution that the current Windows version is denied, then the protected module will be terminated.

If you need to add more Windows versions, please, contact our support team!

Show message before termination - if the Enigma detects that the current Windows version is denied, then a message will be shown and termination will take place. To edit the warning message, press "Design Message" button.


Virtualization Tools

Use checkup of Virtualization Tools - checks if the file is executed under Virtual Machines. If the file runs under the Virtual Machine, the execution is terminated.

If you need to add some more Virtual Machines to the list, please, contact our support team!

Terminate Execution - if this option is enabled, the Enigma Protector will terminate execution of the protected file in case virtualization tools have been found. It is recommended to uncheck this option if you plan to use Enigma API function EP_CheckupVirtualizationTools.

Show message before termination - if the Enigma detects that the file runs under a Virtual Machine, then a message will be shown and termination will take place. To edit the warning message, press "Design Message" button.


Privileges

Some applications (or some features in the application) require high user's privileges. Windows NT systems support (basically) two types of user accounts: administrator and limited.

Use checkup of administrator privileges - serves to check if the user's account under which the protected module is executed has administrator privileges or not. If the account is limited, then the protected application will not be started. Note: for Windows ME, Windows 98 and Windows 95 it always returns true (meaning that the user has already got high privileges).

Show message before termination - if you want to inform the user that they should increase their user privileges, enable this option. To edit the message, press "Design Message" button. If this option is disabled, the execution of the module will be terminated without notification.


Protection Features

The topic describes the possibilities for adding some functions to make the protected module more resistant to reversing of source codes.

Follow the links below to get more details.

  • File Analyzer Deception
  • Import Protection
  • Inline Patching
  • Protected Strings
  • Resources Protection


File Analyzer Deception

File Analyzer Deception

It provides hiding the protector signature from file analyzers, such as PEiD.

The Enigma Protector inserts some simple part of the code in the module entry point that allows you to deceive file analyzers.

Name of the protection code section - the name of the section where the loader code will be placed. The section name is a string of 8 characters length.

Hide protection code with - the type of deception. It defines the code that will be used for analyzer deception. Select the compiler type that will be determined in analyzers. If there is no need to use deception, set this option to "None".

Keep original file size - allows you to save the size of the protected module the same as the original one. This helps to hidethe protector presence from new-come crackers. Remark: if the protected module has a larger size than the original one, the options will be ignored. The Enigma Protector just rewrites the file protected with a set of bytes to make its size equal to the size of the original file.


Import Protection

Advanced force import protection - advanced protection of the import table. It allows you to delete the import table of the protected module in the memory. The Enigma Protector searches all entries in the import table in the source code, and changes the direct link to the imported functions.

Redirect WinAPI fucnctions - provides redirection of calls to system libraries. After the module start, the loader checks the content of system libraries and redirects calls from the import table of the module protected to WinAPI. Also, part of system WinAPI functions are emulated, i.e. a set of instructions from WinAPI functions is obfuscated without loss of workability.

Emulate WinAPI functions - redirects some kinds of system WinAPI functions to emulated internal Enigma functions. Internal Enigma functions fully emulate the work of system WinAPI functions, so it should not affect the workability of the module protected. Please note that if you use Enigma API inside your application, this function should be enabled.


Inline Patching

Protect application code - the feature blocks write access to application memory.

Protect loader code - applies Anti-Inline Patching technology that uses an advanced method to check the integrity of the protection code. If any changes of the protection code are detected, the file execution will be immediately terminated without any prompt.

How it works: when the protected file starts, the loader executes some threads (the number of threads may be defined manually) and each thread periodically checks the integrity of the protected code (the delay between the checkups of each thread is defined in "Inline checkup delay" field).

Number of protection threads - define the number of protection threads. The optimal value is 3-5 threads. We do not recommend using just one, but the maximum number is 15. Please note that the high number of threads may cause high CPU loading. You may select the necessary number of threads after the complete testing of the file protected.

Inline checkup delay - define the number of miliseconds between every checkup of each protected thread. We do not recommend setting this number to a high value, because it may not be useful and can be bypassed, but a too small value may cause high CPU loading, too. Test the protected file and select the optimal value.


Protected Strings

Extra Resource Protection

Protected Strings feature allows you to hide strings from reverse engineering. Basically, any applications use some strings for any purposes and such strings are the most dangerous place to be attacked by crackers. For example, a usual mistake of software developers is placing confirmation messages like "License is invalid!" after an unsuccessful registration. The cracker attempts to find the place in the code where this string appears to reverse the registration procedure. Using the protected string feature, you may hide such "dangerous" strings from the code, and extract them only when they are required. The Enigma Protector does not store all strings in the process memory while the application is working, it only extracts the necessary string when it is required. To extract the protected strings, you should use Enigma API EP_ProtectedStringByID or EP_ProtectedStringByKey.

To add or edit strings, select the necessary string in the list and click the Add or Edit button. To delete the string from the list, click Delete button.

Add/Edit dialog:

Extra Resource Protection

The Protected String might be defined by two types of values:

  • ID - a unique integer value;
  • Key - any unique string.

You may change the ID and Key, but remember that the ID and Key should be unique for each protected string in the list. The Enigma Protector generates its own unique ID and Key for each string that you add, you may keep self-generating values.

To get a protected string by its ID, use the EP_ProtectedStringByID Enigma API function or EP_ProtectedStringByKey to get it by its Key value.


Resources Protection

Resources Protection allows you to select the types of resources in the executable file that will be protected. All resources in the file are protected by default, but there you can enable/disable additional protection of ICON and VERSION resources.

  • Protect all resources - all resources in the file will be protected;
  • Protect all resources, except icon - do not protect ICON resources. Almost all executable files contain ICON resources, a default icon is displayed with the file shown in the file Explorer. Note that if the "Protect all resources" option is enabled, the default Windows icon [image] will be shown for this file in Explorer.
  • Protect all resources, except icon and version - disables protection of ICON and VERSION resources. Note that if any of the two above options are enabled, meaning that VERSION resources are protected, then the file version/information will not be shown in the properties dialog. The current option is recommended for most files.

Use the first two options only if you definitely need to protect ICON and VERSION resources.

Note that the following resources are not protected either: STRINGS, MANIFEST, 'TYPELIB', 'REGISTRY'.


Virtual Box

Virtual Box contains additional features that allow you to emulate the file system of the protected application. You can select the necessary files that will be embedded into the protected application and use it without having these files on the disk. Follow the link below to read more:

  • Files Virtualization
  • Registry Virtualization
  • External Packages
  • Storage
  • Options

Warnings!

  • Virtual Box feature is not compatible with the Windows 9x. The protected with Virtual Box feature file will be possible to run under Windows 9x, but virtual environment (virtual files and registry items) will not exist inside protected process.
  • If the file to protect entered on Input panel is Dynamic Link Library (DLL) then it is not recommended to use Virtual Box feature. Only the DLLs called once at the start of the main executable file and never freed while the application is working can be protected with Virtual Box. The DLL files called/freed multiple times per one execution should not use Virtual Box feature, otherwise it may cause application crash.
  • Virtual Box can execute virtual exe files and share virtual system to child processes only if they have the same architecture as a main protected file, eg: main file is 32 bit file and child process is 32 bit. If they have a different architecture, eg: main file is 32 bit, but child process is 64 bit, or vice versa, then these functions won't work.


Files

Virtual Box - Files

Enable Files virtual box - an enabled Virtual Box feature for files. The Files Virtual Box allow you to embed any kind of external files that your application uses for a single executable file. After the protection, you may delete all the files listed in Virtual Box, the application will work without them. Virtual Box supports any kind of embedded files, txt, dll (dll files will be correctly processed and initializated when the application requires them, ActiveX files will be registered at the file start), avi, mp3, bpl, ocx and many others.

Delete extracted files on exit - this works only with the files that have "Always Write to Disk" or "Write if not Present" actions. When the protected module is terminated, the Enigma loader will attempt to delete the extracted files from the disk.

Compress Files - enables compression of Virtual Box files. It is not recommended to use this option because it requires more memory to execute, increases execution time and decreases the protection of the Virtual Box files. The advantage is that it allows you to decrease the size of the file protected.

Click the Add button to add the files or folders into the list. There are the following adding functions available (all functions are also available through the right-click pop-up menu):

  • Add File (s) - allows you to add a file or several files to the list. The files will be added to the currectly selected folder in the list;
  • Add Files Recursive - allows you to add a folder with the files and sub folders. Each subfolder will be processed recursively;
  • New Folder - allows you to create a new folder in the list. Note that folders of the first root node can only be from a pre-defined list of folders or a root folder of the drive. It is not recommended to use absolute paths (the absolute path is defined through the drive letter in the root of the list), use them only in cases when the relative path could not be used. Read more about pre-defined folders below.

To delete a file or a folder, select it and click the Delete button or press the Del key.

File Properties

To Edit the file or folder properties, select it and click the Edit button, or double-click the necessary item.

Virtual Box - Files

File Path - points to the real file that will be embedded. This file must exist. Click the Browse button to change the file.

Virtual Path - specifies the position of the file in the virtual files list. Note that a virtual path can be started from a pre-defined folder (relative path) or from a drive letter (absolute path). There are the following pre-defined folder names that can be used for a start of the Virtual Path:

  • %DEFAULT FOLDER% - folder where the protected module is located;
  • %SYSTEM FOLDER% - System32 (WinNt) or System (Win9X) subfolder of the Windows installation folder;
  • %WINDOWS FOLDER% - Windows installation folder;
  • %My Documents FOLDER% - My Documents folder. Attention: For operating systems of Windows NT family there are individual "My Documents" folders for each user;
  • %My Pictures FOLDER% - My Pictures folder. It has same warning as for My Documents folder;
  • %Program Files FOLDER% - Program Files folder;
  • %Program Files, Common FOLDER% - Program Files\Common folder;
  • %AllUsers, Documents FOLDER% - AllUsers\Documents folder;
  • %History FOLDER% - History folder. It has same warning as for My Documents folder;
  • %Cookies FOLDER% - Cookies folder. It has same warning as for My Documents folder;
  • %InternetCache FOLDER% - InternetCache folder. It has same warning as for My Documents folder;
  • %ApplicationData FOLDER% - Application Data folder. It has same warning as for My Documents folder.
  • %Temp FOLDER% - Temporary folder;
  • %AllUsers, ApplicationData FOLDER% - AllUsers\Application Data folder;
  • %Local, ApplicationData FOLDER% - LocalSettings\Application Data folder.

Examples:

  • %DEFAULT FOLDER%\mydll.dll, means mydll.dll will be placed in the same folder with the protected file;
  • %DEFAULT FOLDER%\data\intro.avi, the file will be placed in the data folder that is located in the same folder with the protected file;
  • %SYSTEM FOLDER%\key.dat - the file will be placed in the system folder with name key.dat (for example, into folder c:\Windows\System32\)
  • C:\myfile.key, it is an absolute path where the file will be located.

Register as ActiveX (COM) component - if the option is enabled, Enigma Virtual Box will try to register this file as a ActiveX (COM) library at file start. Please note, if the file will be run without administrator privileges then the registry access may be limited, and attempt to register ActiveX component in real registry will fail. To avoid it, enable Registry Virtualization and make sure HKEY_CLASSES_ROOT key is virtual, so all registry changes (changes are being performed while ActiveX registration) are done in virtual registry only, without care of administrator privileges.

Virtualization Method - specifies how the file will be processed: it will be either extracted to the disk when the protected file starts, or fully emulated in the memory. There are the following options available :

  • Never Write to Disk- the embedded file will never be written to the disk. How it works: the Enigma loader hooks file access Windows API and checks if the API call points to the embedded file. You do not need to do any programming in order to use this function. If you have already got an application, just embed the necessary file and protect it. Moreover, if the embedded file is a dll, you may call any functions from this library without having it on the disk. The Enigma loader will initialize dll in the memory and successfully call the function required. If you use this feature, you do not need to place the embedded files with the protected module. Using this feature brings you a lot of benefits: your external library will not be stolen and used as a third party software, you protect embedded libraries from cracking and modifing, you may hide any types of files such as MP3, AVI, any image files, etc;
  • Always Write to Disk - the embedded file will always be overwritten to the disk when the protected file starts;
  • Write if not Present - the embedded file will be written to the disk if such a file does not exist;
  • Never Write to Disk, Use File from Disk (if Exists) - embedded file will never be written to disk, it will be emulated in process memory. However, if the file with the same name, will exist in the same folder on the disk, the file from the disk will be used.

Overwrite File Date/Time - enter the date and the time values that will be applied to embedded file. If option is not checked, the time settings of real file are used.

Overwrite File Attributes - specify attributes for virtual file. If option is not checked, attributes of real file are used.

Hide files and folders from File Open/Save dialogs - Available in Enigma Protector only.

Folder Properties

File Path - points to the real file that will be embedded. This file must exists. Click on Browse button to change the file.

Overwrite File Date/Time - enter the date and the time values that will be applied to this folder

Overwrite File Attributes - specify attributes for virtual folder

New Content in Folder - determines the behavior of virtualization system if application attempts to create new files and folders within virtual folder, it can be either:

  • New Folders and Files Become Real
    • - new files and folders will be written to disk;
  • New Folders Become Real but Files Virtual
    • - new folder will be written to disk, but files enumated in memory;
  • New Folders Become Virtual but Files Real
    • - new folders will be enumated in memory, but files written to disk;
  • New Folder and Files Become Virtual
    • - new files and folders will be emulated in memory;

Hide files and folders from File Open/Save dialogs - disables file enumeration for system functions. Enumeration, apart of File Open/Save dialogs is used by crackers to identify virtual files and possible extract them. To avoid that, it is recommended to use this option for as many files as possible, until the application keeps stable. Please note, this option has critical incompatibility with particular files, so it can't be used for them;

Apply same properties for all child folders and properties recursively - assigns same properties to all nested files and folders


Registry

Specify registry virtualization options.
Left panel contains a list of the registry keys and the right panel contains a list a values for the selected registry key.

Registry List

Right click on a key or value activate popup menu with additional options.

New - create new key or value with necessary type

Delete - delete the key (including sub-keys and values) or value

Rename - rename key or value

Virtualization - determines if the key or value is virtualized. If the key/value is marked as virtual, then it will be virtualied as well. If the key/value is marked as real, then Enigma Virtual Box will redirect request to a real registry instead of virtual. Please note, if the system will try to create a value or sub-keys for virtual key then all the changes will be virtual, otherwise, all the sub-keys/values will be written to the real registry. Also note that HKEY_CLASSES_ROOT uses for registering of ActiveX/COM components, and it is recommended to always mark this key as virtual.

Registry Options

Enable Registry Virtualization - enables virtualization of registry


Packaging

Allows to specify the list of allowed external packages and build the new packages. External Package is an external file, that may be copied to the user PC to overwrite or append default virtual package (virtual environment). Note, if the same files or registry item will exist in few packages, the file/registry from the newer package only will be used.

Where packaging can be used? Imagine, the default virtual environment has a size of few thousands megabytes (so output file size is also near this value) and you have already shared the boxed file to many of your customers. Next time you need to update just couple of virtual files in the default environment. Instead of creating of new huge boxed file, you may create a small external package with the two necessary files and send it to customer, so files from this package will overwrite existing files with the same name.

Add a list of allowed file names or file masks that will be accepted as a external package. For example, if you add a file name like "mypack.dat" then while execution of boxed file it will be looking for a file mypack.dat and if it is found - load it content to virtual environment.

Click Package Builder to open a dialog to create new external package.

Interface of Package Builder is similar with the main program's one. There you may also save and load template to/from external template file.

Click Save Package button to generate external package and save it to the file.


Storage

Storage feature allows to save changes to virtual content on the local file system. If storage is not used, virtualization allows to make changes to, for example, virtual files, but these changes will be discarded after file restart.

How does it work? If program makes changes to virtual content, let's imagine it is a file test.txt in virtual %default folder% (and storage folder is set to %My Documents FOLDER%), virtualization creates a folder %default folder% in the "My Documents" folder of the local computer and put test.txt file there which contains all the changes. When program is being restarted, virtualization loads test.txt from storage folder and program sees the changes.
Also, if any new files will be created in storage folder, packed program will automatically accept them and see like they are in the same virtual folder.

It is worth to use this feature to avoid program to make any changes to local computer, except the storage folder. For this purpose it is also recommended to change the properties of virtual folders and set the option "New Content" to "New files and folders become virtual", so all new files and folder will be written to storage folder.

Folder of content - storage folder on the local computer where the changes to virtual content will be stored

Encrypt content - allows to encrypt the content of the files saved to storage folder, so end user won't be able to view files content.
Available in Enigma Protector only.


Options

Map executable files using temporary file - this option is made for compatibility of particular dll and basically exe files to be virtualized. Using this option, if you have exe files in Virtual Box - Files, in most of the cases, is mandatory. For dll files in Virtual Box - Files, using this option is recommended (until there is no compatibility issues if the option is disabled);

Share virtual system to child processes - shares virtual system (files and registry) to all child processes which current process creates (even if these processes are not protected with Enigma Protector);

Allow running of virtual executable files - option allows to run virtual executable files. If option is disabled, any attempts to run virtual executable file will fail. If virtualized software does not run virtual files and does not need to share virtual system to child processes, then this option and option Share virtual system to child processes can be disabled, this allows to reduce size of the packed file;

Hide files and folders from File Open/Save dialogs - basically, this option means that enumeration will be disabled for virtual files. Enumeration, apart of File Open/Save dialogs is used by crackers to identify virtual files and possible extract them. To avoid that, it is recommended to use this option for as many files as possible, until the application keeps stable. Please note, this option has critical incompatibility with particular files, so it can't be used for them (this option can be set globally for all files, but also for any separate file and folder in the properties dialog).


Virtual Machine

Virtual Machine is a modern virtualization technology that allows you to protect parts of the assembler source code of your module. The main idea of virtualization is converting the original assembler code (which is well-known to reverse engineers) to the PCODE - a special programming language known only to the Enigma Protector. When a protected application requires to run a virtualized code, the PCODE will run on the internal Virtual Processor. Virtual Machine is a very useful feature that allows you to make reverse engineering and analysing of the protected module very complex, see below to find out more about Virtual Machines implemented in the Enigma Protector. Our recommendation is to use the virtualization technology as often as possible. Also, note that not all code parts/functions should be virtualized. If the part of the code or function is executed too many times, it is not recommended to virtualize it, otherwise it will slow down the work of your application and increase CPU loading. The best places for virtualization are parts of verifying registration code, trial control routines, cryptographic algorithms, in short, all weak places that should not be reversed/cracked/analysed.

There are several ways the virtualization technology could be used:

  • by the use of VM Markers. If you are a software developer, and you have the source code of your application and can compile it, then the best and most recommended way to apply virtualization is the VM Markers;
  • by using a MAP file (the MAP file contains a list of functions with their addresses, it has the same name as an input file choosen on Input Panel but has a .map extension. A MAP file allows accurate analysing of the input file), selecting the necessary functions. This is also a solution for software developers who can compile modules and generate MAP files. To learn more about the creation of MAP files for different development IDEs, see Making Of the Map File. Note that a MAP file should be placed in the same folder as an input file and it should have the same time span as the input file name. See Functions Selecting;
  • by using a PDB (program database or symbol) file, which automatically being compiled by Visual Studio;
  • if you are not a software developer and cannot use the above methods, you may simply click the Select Functions button and The Enigma Protector will try to analyse the input file and find all functions that are possible to be virtualized. Remember, this option is not so stable as the previous ones, so you have to make a double check of workability of the protected modules. See Functions Selecting.

The Enigma Protector implements two virtual machine architectures:

  • Classic, it's fast and lightweight, uses static instructions;
  • Modern RISC, highly secure Virtual Machine which runs on unique dynamicly generated instruction set, so each time you protect your executable completely unique instance of the Virtual Machine is being generated; due to the engine complexety this Virtual Machine is slow, you should use this in the most vulnerable places of your application;

Limitations:

  • Virtual Machine does not work with any kind of .NET files, either exe or dll files;
  • if the part of code/functions selected for virtualization contains any Markers inside, the workability of the marker will be lost, the code inside the marker will only be executed;
  • for Delphi developers, the MAP file compiled with Delphi may contain a set of functions with the same names but different addresses. The Enigma Protector stores the selected functions by the name in the project file. After loading the project file, only the function with necessary name that appeared first will be selected;

Follow the links below for more information:

  • Settings
  • File Entry Point
  • Functions Selecting


Settings

The Enigma Protector offers two Virtual Machine types: Classic and Modern RISC. You can read more about it here. Settings screen Virtual Machine type selection applies only to the File Entry Point and Functions Selecting, this does not affect any VM type specific markers. RISC Properties affect all of the code that is being covered by Modern RISC Virtual Machine.

Virtual Machine Settings

Modern RISC Virtual Machine can be tweaked using the following properties:

  • Trashgen, affects the level of junk instructions which will be inserted into the PCODE;
  • Obfuscation, controls the level of virtual instruction handlers complexity, affects the size of Virtual Machine a lot;
  • Duplicates, indicates the max amount of handler duplicates that can be generated for one virtual instruction, affects size;
  • Encryption, affects the level of encryption for internal data


File Entry Point

File Entry Point

File Entry Point is a special function that the execution of any executable file starts with. The file entry point function runs only once per execution before any other code is executed.

Enable virtualization of file entry point - enables virtualization of the file entry point. It is always recommended to use this feature.


Functions Selecting

There is a list of function names selected for virtualization. Column Virtualization is editable to change the virtual machine type assigned to function. To change the list, click the Add Function(s) button. The below windows with the possibility to select functions should appear. Note that if you have a MAP/PDB file for the Input file, the list of functions will be shown, otherwise, Enigma will try to analyse the file itself and the functions names will be represented with their addresses. Take a look at the Creating a map file to learn now to create map file for different compilers.

Selection of Functions and Disassembler View

Select the function from the left list for virtualization. Right panel shows a disassembler view of the selected function. It is possible to walk through calls and jimps in the disassembler by double click on necessary assembler instruction.

If required function is not automatically found by Enigma Protector, it is possible to enter the function address to add a custom function to virtualization. At the top tab Custom Selection enter an address and click Disassemble button, Enigma Protector will try to recognize the function and add it to the list with Custom_ prefix. Custom function address should be in following format: example, 0x12345678 for hexadecimal address and 12345678 for decimal.

The type of virtual machine could be assigned for the selected function(s) through top tab Options.

To filter list of functions to find specific names, use the top tab Filter.


Miscellaneous

The topic contains a set of miscellaneous possibilities for module protection.

Follow the links below to get more details.

  • Splash Screen
  • Watermark
  • Plugins
  • Custom VERSION Resource
  • Custom MANIFEST Resource
  • Command Line
  • Environment Variables
  • Protection Events
  • Other


Splash Screen

Allows adding a splash screen to the protected module. Splash screen may be just a picture that will be shown upon the startup of the protected file.

Select picture file for splash screen - the file name of the splash screen picture. The Enigma Protector supports 3 kinds of picture files: BMP, PNG, JPG (JPE, JPEG).

Show at Program Start - the splash screen will be shown at the program start, with this option checked. If you want to show this screen manually by means of Enigma API, then uncheck this option. See also Enigma API EP_SplashScreenShow and EP_SplashScreenHide.

Show on the top of all windows - moves the splash screen onto the top of all windows.

Stop execution when splash screen is shown - execution of the protected file will be stopped when the splash screen is shown. If this option is disabled, then the protected file will continue to execute when the splash screen is shown.

Close on mouse click - the splash screen will be closed only upon being clicked.

Splash screen time to show (milliseconds) - the time during which the splash screen will be displayed. The time is in milliseconds.


Watermark

Use Watermark - allows you to add watermarks to the protected file. A watermark is just some information that is placed into the protected file. The watermark cannot be edited or modified in the file. If the watermark information stored in the file is corrupted, the file will not start. The Enigma Protector allows to place text/files watermarks. This feature might help developers to limit each version of the application to a particular user and then monitor if the version is shared and who shares it. The watermark cannot be deleted/modified in the protected file. See also, Watermark Viewer.

To Add/Edit/Delete watermarks, use the following buttons.

Watermark Name - any string that defines a watermark name.

Watermark Type - the type of a watermark. If the watermark is private, then only the developer who has a valid project file is able to view it. If the type is public, then anyone can view this watermark.

Watermark Text - place any text here.

Watermark File - attach any file to the watermark. This file can be extracted with the watermarks viewer.

To view a watermark in the protected file, open the Watermark Viewer, main menu - Tools - Watermark Viewer. Click the Browse button to select the file.

To get the watermarks content at runtime, use EP_MiscGetWatermark Enigma API.


Plugins

the Enigma Protector supports plugin modules that will be embedded into the protected file and executed when the protected file starts. Plugins for the Enigma Protector are stored in the Plugin subfolder of the installation folder. If you want to add your own plugin, copy it into (for example) c:\program files\the enigma protector\plugins\ folder and open (re-open) the Enigma Protector. Using the plugins system, you may improve the protection, build your own protection systems, enlarge the functionality. It gives you complete control over the protected file together with the Enigma Protector! To embed a plugin into the protected file, check the necessary plugin in the list. To view the plugin description, double-click the plugin in the list.

Plugins SDK

Plugin is simply a DLL (Dynamic Link Library) that exports some functions. The plugin can be compiled with any compiler (MS C++, Borland C++, MASM, Delphi, etc) that supports unmanaged code (meaning it does not support DLLs that were compiled using the .NET technology).

Functions that may export plugin DLLs:

Enigma_Plugin_About - returns a wide char (UNICODE) string that determines the plugin name and author (this info will be shown in the list of plugins, the About column)
Enigma_Plugin_Description - returns a wide char (UNICODE) string that determines the description of a plugin, its functionality (this info will be shown once you double-click the plugin in the list)
Enigma_Plugin_OnInit - a procedure that will be called when the protected module is started. Note that this procedure is called before the protected file is prepared for the execution in the memory. It is the best way to place, for example, your own anti-debugger checkups here.

Enigma_Plugin_OnFinal - a procedure will be called after the final initialization of the protected module in the memory, but before it is executed.

Enigma_Plugin_OnSaveKey - a function is called when the protected file tries to save registration information. It can be used to skip the standard saving routine, to allow more flexibility upon saving registration information. The function has 4 parameters, ARegName and ARegKey contain pointers to registration name and key buffers and ARegNameLen and ARegKeyLen contain the number of bytes of name and key buffers. Note that to handle Wide Strings and UNICODE registrtation scheme you should divide ARegNameLen and ARegKeyLen values into 2 to get actual length of the string. This function should return FALSE if it does not save registration information (or it does not need to save it) and TRUE if the function succeeds. Note that standard saving routine will not be called if this function returns TRUE.

Enigma_Plugin_OnLoadKey - a function is called when the protected file tries to load registration information. It can be used to skip the standard loading routine, to allow more flexibility upon loading registration information. The function has 4 output parameters. After the successful loading, ARegName and ARegKey should contain pointers to the buffers of the registration name and key, and ARegNameLen and ARegKeyLen should contain the number of bytes of name and key buffers. Note that you have to allocate buffers for ARegName and ARegKey manually (somewhere in the global space). To handle the Wide Strings and UNICODE registration scheme, you should multiply the lengths of the strings by 2. This function should return FALSE if it does not load registration information (or it does not need to load it) and TRUE if the function succeeds. Note that a standard loading routine will not be called if this function returns TRUE.

Enigma_Plugin_OnShowActivationDialog - is a call back of Online Activation dialog. It is being called each time Enigma Protector tries to show Online Activation dialog. If this plugin function return TRUE, then standard Online Activation dialog will not be shown, and vice versa. Callback could be used with the Miscellaneous - Other - Supress Graphical Module feature.


Custom VERSION Resource

Allows you to add a custom VERSION resource to the protected file. This feature may be important for the existing files that do not have such resources or if a compiler does not support version adding. Edit the necessary version strings in the table for your own application.

To view version resources of the file, open ther folder with the protected file in Explorer and right-click it, select Properties, then, in the appeared window, go to the Version tab. The example is shown below:

Version Resource Test


Custom MANIFEST Resource

Custom MANIFEST Resource

It adds custom MANIFEST resources to the protected file.

It may help in the following cases:

  • Visual Styles Common Controls manifest allows you to enable graphical themes of Windows XP/Vista for the protected file,
  • MS Visual Studio 2005/2008 manifest allows you to check whether Visual Studio 2005/2008 runtime libraries are installed,
  • Each manifest can be edited manually and may contain information about the product developer, its description,
  • Manifest may help to define that the protected file should be run under administrative privileges and so on.
  • You may select your own .manifest file that should be embedded into the protected file.

The only limitation there is the developer's imagination!


Command Line

Command Line Parameters

Allows you to overwrite or append initial command line parameters. The command line parameters entered here will always be passed to the protected module.

Overwrite parameters - any initial command line parameters will be overwritten with the defined ones.

Append parameters - a defined parameters string will be appended to the initial parameters.


Environment Variables

Define the list of your own environment variables that will be set up before the main code of the protected application is executed. This feature allows you to set up the necessary environment variables if this cannot be done from the code. It is also a good way to hide strings data. Please note that a variable name and value are limited to 255 symbols.

To access the environment variables, use the definitions and examples below

Definitions and Examples

Delphi

uses
  Windows;

function GetEnvVar(Name : string) : String;
var
  buf : array[0..255] of char;
begin
  Result := '';
  if (GetEnvironmentVariable(pansichar(name), @buf, sizeof(buf)) <> 0) then
    Result := string(buf);
End;

// another way

uses
  SysUtils;

function GetEnvVar(Name : string) : string;
begin
  Result := GetEnvironmentVariable(Name);
end;

C++

#include <windows.h>

{
   char variable[256]="";
   if (!GetEnvironmentVariable("my variable", variable, sizeof(variable))) {
       MessageBox(0, "Variable found!", "Application", MB_OK);
   };
}

Visual Basic

Public Declare Function GetEnvironmentVariable Lib "kernel32.dll" Alias "GetEnvironmentVariableA" (ByVal Name) As String

C# (.NET)

public class Enigma_EnvironmentVariables
{
  [DllImport("kernel32")] public static extern int GetEnvironmentVariable(string lpName, string lpBuffer, int nSize);
}


Protection Events

Set up a set of events that will be triggered by protection before of after protection finishes. Basically, the feature allows to run specified process with specified parameters before or after protection. Usual use-cases are following:

  • Digitally sign protected executable with signtool.exe
  • Run protected file after protection finishes
  • Start other post-protection queued events (eg, installator builder)
  • Play notification sound when protection finishes

Edit Protection Event

Enable - enables the event. If event is disabled, it won't be fired, however it will stay in the events list. When Happens? - determines whenever the event will be fired:

  • Before Protection
  • After Protection, Always - event is run with no matter if protection succeeded or failed
  • After Protection, if Succeeded
  • After Protection, if Failed

Command Line - the command to run, with necessary parameters. Command line may contain special Path Variables to specify the path to the file to be executed, or running parameters. Path Variables that represent folders do not include ending path delimiter!

Examples:

Protection Event - Example

This example runs signtool.exe to digitally sign the protected file with the code signing certificate. The command expects the signtool.exe to be located at the same folder with the non protected input file (the folder %INOUT FILE PATH% is used for signtool.exe). Event happens only after successful protection.

Protection Event - Example

Simple example, it just runs the protected file after successful protection.


Other

Supress graphical module - this option eliminates graphical module from a loader which is being injected to protected file. Advantages of using this option - decreasing resulted protected file. It allows to reduce the site of the file up to 400 Kbytes in 32bit version about 1 MBytes in 64 bit version. If this option enabled, no graphical messages/dialogs will be shown like Registration Dialog, Startup Password, Splash Screen and all messages. To handle those messages/dialogs, special callbacks from Plugins can be used.

Do not check if the file is compressed - supress checking if the input file is already compressed. This option may be helpful if input file was already processed with some other kind of packer/protector and it has compatibility with Enigma Protector.

Do not search markers in protected file - supress markers checking in input file. Option allows to eliminate false markers detection or decrease time of protection if marker analysing takes much time.


Trial Control

This section describes such features as:

  • trial limitations (limitation of the "try" period by a certain criterion);
  • the reminder (it will show a window with a reminder message if the module is unregistered);
  • time control (it controls time reversing).

You can use special Enigma API functions to release your own embedded trial control. Use of Enigma API implies attaching additional modules to yours. These additional modules represent an interface to the Enigma API. Detailed information about the Enigma API can be found in API description section and in the program examples (the Examples folder in The Enigma Protector installation folder). To disable the trial limitation, one should perform registration of the program module. It can be done using the registration key. The Enigma Protector contains special resources for registration keys generation.

Follow the links below to get more details.

  • Common
  • Trial Data Storing
  • Lock trial to user language
  • Limitation Of Executions Count
  • Limitation Of Days Count
  • Limitation Of Expiration Date
  • Limitation From Date Till Date
  • Limitation Of Execution Time
  • Reminder
  • Time Control


Common

Reset trial in new version - resetting the trial in a new version means that the trial limitation will be reset in the new version. If you use limitation by the days count or limitation by the executions count, this function can reset these trial limitations in the new version of the program module. It means that the new version of the program module will count limitation values from the beginning.

Attention: To make this function work correctly, you should define the current version of the module in the Input section.

Open file if the trial has expired - allows you to open the file specified in the File Name field when any trial limitation has expired. The file will be opened only if you have chosen the Terminate Execution option for the Trial Expire action. If you have set to keep the file extecuted upon the trial expiration, the file will not open.

File name - the file name has a wide range of uses, it may be not just a file; hyper and email links can be used as well.

The following examples show you what the File Name field can contain:

The File Name field content | Description
http://www.mysite.com/ | hyper link, will open an Explorer window with the same link;
mailto:admin@mysite.com | email link, will open a default email client offering to send an email to the same address;
License.txt | open license.txt file. The file will be opened in a default application which supports .txt format. The file should be placed in the same folder with the protected module;
Relative\Register.exe | open the Register.exe file which is located in the Relative subfolder to the folder of the protected module;
..\Register.exe | open the Register.exe file which is located in the upper folder to the folder of the protected module;
C:\Windows\Register.exe | open the Register.exe file from the c:\Windows absolute folder.


Trial Data Storing

Trial Data Storing

This is a unique feature which allows entering your own paths where the trial information will be stored. What does trial information mean? Trial information is some data including the number of trial executions or days left, etc. For correct processing of the trial parameters the protector has to store the information regarding the expired items somewhere, usually it is a file system or registry. Protection systems do not allow changing trial path parameters - and often the path is well-known to crackers - and trial reset tools that allow resetting the expired trial. This feature will not help avoid trial reset by advanced users, but it is a useful solution to resist automatic tools.

This is not a necessary feature that should always be enabled, it is optional. If you do not use it, the Enigma Protector will work as well and use its own paths to store trial information.

Click the Add button to add a path to the list, double click the existing path to modify it, click [image] to delete an item from the list.

Add/Edit path dialog:

Trial Data Storing Dialog

Data Encryption - set the string that will be used for encrypting/decrypting the trial information, this may be any string;
Registry/File - specify the system where the registration info will be stored - in the registry or in a file;
Base Registry Path - a root registry item where the registration information will be stored. Please note:

  • we recommend using HKEY_CURRENT_USER as a base, because this branch of registry is specially designed for storing different information of the currently logged user;
  • trial information stored in HKEY_LOCAL_MACHINE will be valid for any user account - if the trial has expired in one user account, all other users will have it expired as well;
  • HKEY_CLASSES_ROOT, HKEY_LOCAL_MACHINE, HKEY_USERS, HKEY_CURRENT_CONFIG can be disabled for writing for non-admin user accounts and the protection may not work properly.

Relative Registry Path - a relative path in the registry to store registration information;
Value Name - a registry value name;
Value Type - the type of the registry value, can be String or Binary data;

Trial Data Storing Dialog

Base File Path - the base file path;

  • if using folders %My Documents FOLDER%, %Program Files FOLDER%, %Program Files\Common FOLDER%, %AllUsers\Documents FOLDER%, %AllUsers\ApplicationData FOLDER%, %My Pictures FOLDER%, %History FOLDER%, %Cookies FOLDER%, %InternetCache FOLDER% the application will require Internet Explorer for Windows 95, Windows 98, Windows NT 4.0. If older version of Internet Exlorer are installed, the folder will be changed to %DEFAULT FOLDER%
  • if using folders %My Documents FOLDER%, %My Pictures FOLDER%, %History FOLDER%, %Cookies FOLDER%, %InternetCache FOLDER% the trial information will be stored for the current user account, otherwise the trial will be applied to all Windows users.

Relative File Path - a relative file path, this feature is used for adding a Base File Path;
File Name - the name of the file where registration information will be stored;
File Attributes - attributes of the file, can be a combination of Read Only, Archive, System and Hidden attributes. If nothing is entered, normal attributes are applied to the file.


Limitation By Executions Count

Limitation Of Executions Count

Use limitation by executions count - check this box to enable the respective function. The main idea of this function is as follows: on the first execution of the protected module a special record is created in the Windows registry. This record contains the number of times the program module is executed. When the protected module starts up, The Enigma Protector loader checks the current count of executions. If it is greater than the maximum limit (defined in "Maximal count of executions" field before protection), the execution of the program module is stopped.

You can check the limitation parameters during program module execution with the help of Enigma API. Use the EP_TrialExecutions function to get the total and remaining number of executions. To reset the trial period you can use the functions of registration key verification. If The Enigma Protector loader detects a correct valid registration key in the system, the trial period will be reset.

Terminate execution after (seconds) - if the trial period is expired, the execution of the program module will be stopped after X seconds. If this parameter is set equal to zero, the execution of the module stops before the deciphering and executing of the main code of the module.

Show Message before termination - check this box if it is necessary to inform the user that the trial period is expired and the execution of the module will be stopped. You can edit the content of the message by clicking the "Design Message" button. If this function is disabled, the execution of the program module will be stopped without any notifications.


Limitation by Days Count

Limitation Of Days Count

Use limitation by days count - check this box to enable the respective function. The main idea of this function is to limit the trial period by count of days the protected application will work since the first execution. The maximum number of days must be defined in the respective field before protection of the program module.

On the first execution of the protected module a special record is created in the Windows registry. This record contains the number of days the protected module operates. When the protected module is started, The Enigma Protector loader checks this value. If it is greater then the maximum limit, the execution of the program module is stopped.

You can check limitation parameters during program module execution with the help of Enigma API. Use the EP_TrialDays function to get the total and remaining count of executions. To reset the trial period you can use the functions of registration key verification. If The Enigma Protector loader detects a valid registration key in the system, the trial period will be reset.

Note: To prevent setting the system clock backward use the TrialControl->TimeControl function.

Terminate execution after (seconds) - if the trial period is expired, the execution of the program module will be stopped after X seconds. If this parameter is set equal to zero, the execution of the module stops before the deciphering and executing of the main code of the module.

Show Message before termination - check this box if it is necessary to inform the user that the trial period is expired and the execution of the module will be stopped. You can edit the content of the message by clicking the "Design Message" button. If this fucntion is disabled, the execution of the program module will be stopped without any notifications.


Limitation By Expiration Date

Limitation Of Expiration Date

Use limitation by expiration date - check this box to enable the respective function. The main idea of this function is as follows: when the protected module starts up, The Enigma Protector loader checks the current date and compares it to the expiration date (date when the "try" period is expired). If the trial period is expired, the execution of the program module is stopped.

You can check the limitation parameters during program module execution with the help of Enigma API. Use the EP_TrialExecutionDate function to get the year, month and day of the expiration date. To reset the trial period you can use the functions of registration key verification. If The Enigma Protector loader detects a valid registration key in the system, the trial period will be reset.

Note: To prevent setting the system clock backward use the TrialControl->TimeControl function.

Terminate execution after (seconds) - if the trial period is expired, the execution of the program module will be stopped after X seconds. If this parameter is set equal to zero, the execution of the module stops before the deciphering and executing of the main code of the module.

Show Message before termination - check this box if it is necessary to inform the user that the trial period is expired and the execution of the module will be stopped. You can edit the content of the message by clicking the "Design Message" button. If this fucntion is disabled, the execution of the program module will be stopped without any notifications.


Limitation From Date Till Date

Limitation Of Executions Count

Use limitation from date till date - the function enables trial limitation from one date till another. Once a protected module is executed, Enigma loader reads the current date, and if the current date precedes the Start trial date or follows the End trial date, the trial period is deemed expired.

You can check the limitation parameters during program module execution with the help of Enigma API. Use the EP_TrialDateTillDate function to get the trial start and end dates. To reset the trial period you can use the functions of registration key verification. If The Enigma Protector loader detects a valid registration key in the system, the trial period will be reset.

Terminate execution after (seconds) - if trial period is expired, the execution of the program module will be stopped after X seconds. If this parameter is set equal to zero, the execution of the module stops before deciphering and executing the main code of the module.

Show Message before termination - check this box if it is necessary to inform the user that the trial period is expired and the execution of the module will be stopped. You can edit the content of the message by clicking the "Design Message" button. If this function is disabled, the execution of the program module will be stopped without any notifications.


Limitation Of Execution Time

Limitation Of Execution Time

Use limitation of execution time - use this function to limit the trial execution time. If this option is enabled, the Enigma loader counts the number of minutes since the module start and if this number exceeds the value defined in the "Number of minutes" field, the trial expiration action is triggered. When the minute count reaches the defined value, the trial will be deemed expired each time the protected module is executed. To remove the trial limitation, the module needs to be registered. Once the module is registered, the trial limitation will be lifted and the user will be able to work with the module for any time per execution. If you need to check the total and remaining number of minutes during module operation, you can use the Enigma API. The EP_TrialExecutionTime function returns the total number of trial minutes and the number of minutes remaining counted since the module start. To reset the trial period you can use functions of registration key checking. If The Enigma Protector loader detects a valid registration key in the system, the trial period will be reset.

Terminate on expiration - if the trial period is expired, the execution of the program module will be stopped. If this parameter is set equal to zero, the execution of the module stops before the deciphering and executing of the main code of the module.

Show Message before termination - check this box if it is necessary to inform the user that the trial period is expired and the execution of the module will be stopped. You can edit the content of the message by clicking the "Design Message" button. If this fucntion is disabled, the execution of the program module will be stopped without any notifications.


Lock Trial To User Language

Lock trial to user language - this function locks trial settings to the specified user country. Select the countries where the trial setting will be effective in the countries list. If the protected module is executed in a country which has not been selected, all trial limitations will be lifted, i.e. the execution of the module won't be limited. This option affects all trial limitations set in the TRIAL CONTROL panel;

Select all - select all items in the countries list;

Deselect all - deselect all items in the countries list;

Invert selection - invert selection of all items, i.e. deselect all selected items and vice versa.


Reminder

Use reminder - check this box to enable the reminder feature. If this feature is enabled, a reminder message window will be shown when the protected module starts up. The contents of the message (for example, a notification of necessary registration of the module) can be defined after clicking the "Design Message" button. To disable the reminder, the user must register the program module. If The Enigma Protector loader detects a valid registration key in the system, this message will not be shown.

Seconds between shows - this value defines the period of time after which the reminder message will be shown again. If this value is set to zero, the reminder message will be shown only once when the program module starts up.


Time Control

Check clock reversing - check this box to use the system clock reverse control function. It helps prevent setting the system clock backward by the user for evasion of trial limitations or limitations of date-dependent keys. When the protected module starts up, The Enigma Protector loader checks if system time has been changed. If it has, the loader will stop module execution.

Do not check clock reversing if registered - use this function to disable user time verification if the application is registered. Please note, it is not recommended to disable clock reversing check if registration keys with (eg) expiration date are being used.

Use protection date to check users clock - if the option is enabled, the Enigma Protector will also check if the current date on the user PC is not earlier than the protection date. If the user PC date is earlier than the date of protection, Enigma will deem the clock set backward. Please note, you have to be sure your system clock (and Time Zone information) is correct.

Attention: Presence of a valid registration key does not affect the function.

Show Message before termination - check this box if you want to inform the user that the system clock has been reversed, and to offer restoring the system clock for correct execution of the protected module. You can design the contents of the message by clicking the "Design Message" button. If this function is disabled, the execution of the program module will be stopped without any notifications.


Message Designer

Message designer is a dialog window for editing messages for different purposes.

Use hyperlink - check this box if you want to place a sentence with the hyperlink on the message window.

Text of the sentence with hyperlink - these words contain semantics of the link.

URL of hyperlink - this string will be forwarded to the user's web browser.

In the trial messages you can insert special strings which will be replaced by the corresponding values:

Variable string | Description | Related Link
%AppName% | Application Name variable from the project inputs | Input
%AppVers% | Application Version variable from the project inputs | Input
%CU_EXTFILES% | Name of the external file that has failed with the external files checkup | Checkup of External Files
%CU_EXECPR% | File name of the executed process that has failed with the executed processes checkup | Checkup of Executed Processes
%CU_INSTSERV% | Name of the service that has failed with the installed services checkup | Checkup of Installed Services
%CU_WINVER% | Full version of the current Windows | Checkup of Windows Version
%CU_VIRTTOOLS% | Name of the Virtual Machine | Checkup of Virtualization Tools
%HardwareID% | Current Hardware ID | Hardware Lock
%RegName% | Registration Name | Keys generator
%RegKey% | Registration Key
%KeyExpYear% | Year of key expiration date
%KeyExpMonth% | Month of key expiration date
%KeyExpDay% | Day of key expiration date
%TrialExecsTotal% | Total number of trial executions | Limitation of Executions Count
%TrialExecsLeft% | Remaining number of trial executions
%TrialDaysTotal% | Total number of trial days | Limitation of Days Count
%TrialDaysLeft% | Remaining number of trial days
%TrialExpYear% | Year of trial expiration date | Limitation of Expiration Date
%TrialExpMonth% | Month of trial expiration date
%TrialExpDay% | Day of trial expiration date
%TrialStartYear% | Year of start trial date | Limitation from Date till Date
%TrialStartMonth% | Month of start trial date
%TrialStartDay% | Day of start trial date
%TrialEndYear% | Year of end trial date
%TrialEndMonth% | Month of end trial date
%TrialEndDay% | Day of end trial date
%TrialExecMinsTotal% | Total number of trial execution minutes | Limitation of Execution Time
%TrialExecMinsLeft% | Remaining number of trial execution minutes

The variable strings are non case-sensitive.

Message Icon - select the icon that will appear on the message. There are few kinds of icons: Warn (warning), Info (information), Question, Error, File (associated icon of the protected file), None (without icon).

Automatically close this message after seconds - if the option is enabled then this message will be closed within a defined number of seconds after the message has been shown.

Disable OK button for seconds - it disables OK button for the defined number of seconds, within this time it will be impossible to close message window.

Select Message Font - select the font that will be assigned to the whole message window.

Preview - click this button to take a look at how the message window will look.


Basic operations

Creation of a new project

To create a new project file select the "New project" item. See Creation of a protection project.

Opening the existing project

To open the existing project file, select the "Open project... " item.

Closing the project

To close the project opened, select the "Close project" item.

Saving the project

To save the project, select the "Save project " item.

Saving the project with a new file name

To save the project with a new file name, select the "Save project As..." item.

Exiting The Enigma Protector

To close The Enigma Protector, select the "Exit" item.

Changing the currently installed GUI language

To chage GUI language select necessary language in the "Language" item. The language files should be placed into \lang subfolder with the installed Enigma Protector.

Calling the manual

"Help context" allows to open The Enigma Protector manual.

Unlocking/Registration

Allows you to perform unlocking/registration of The Enigma Protector. See Order page.

On-line registration

On-line registration provides you with necessary information about purchasing The Enigma Protector. You will be redirected to The Enigma Protector website. After the registration you will have a valid pair of the registration name and registration key by means of which you will be able to unlock registered features of The Enigma Protector.

Calling the registration keys generator

For additional information about using The Enigma Protector registration keys generator see Keys Generator

About information

The Enigma Protector about dialog.

Reset local trial information

This feature is used for debugging the opened project. In development, resetting local trial information is sometimes needed for playing with The Enigma Protector trial parameters, use this for clearing trial information on the local PC.

Reset local registration information

This feature is used for debugging the opened project. In development, resetting local trial information is sometimes needed for playing with The Enigma Protector registration features, use this for clearing registration information on the local PC.

Reset local special information

The feature allows to reset/delete local special information. It is used for debugging purposes on the developer's side only. The special local information means, for example, Startup Password information.

Choosing the project parameters:

Choosing the project parameters is performed by means of a graphic user interface. All the items are systematized in tree categories. For each category there is its own page where management elements are placed.


Creating a map file

This topic explains how map files can be created for applying in Virtual Machine. Current version of The Enigma Protector supports map files created in Delphi, Borland C++ Builder and MS Visual Studio.

Delphi up to version 7
Delphi 2007 and later (2009, 2010)
Borland C++ Builder up to version 7
Microsoft Visual C++ up to 6.0
Microsoft Visual Studio 2003 and later (2005, 2008)

Creating a map file in Delphi:

  • Open the project of your module in Delphi.
  • In the Main Manu select "Project" -> "Options", or just press Shift+Ctrl+F11. You will see the following window:

  • Select the "Linker" tab and select the "Detailed" radio button on the "Map File" panel:

  • Compile your project. In the output folder you should see the executable file of your module and the same file with the .map extension. This .map file can be used to enable "Virtual Machine" features.

Creating a map file in Delphi 2007 and later:

  • Open the project of your module in Delphi;
  • In the Main Manu select "Project" -> "Options", or just press Shift+Ctrl+F11. In the appeared window select the "Linker" item in the left navigation panel, then select "Map file - Detailed";

  • Compile your project. In the output folder you should see the executable file of your module and the same file with the .map extension. This .map file can be used to enable "Virtual Machine" features

Creating a map file in Borland C++ Builder:

  • Open the project of your module in C++ Builder
  • In the Main Manu select "Project" -> "Options", or just press Shift+Ctrl+F11. You will see the following window:

  • Select the "Linker" tab and select the "Detailed" radio button on the "Map File" panel:

  • Compile your project. In the output folder you should see the executable file of your module and the same file with the .map extension. This .map file can be used to enable "Virtual Machine" features.

Creating a map file in MS Visual C++:

  • Open the project of your module in MS Visual C++
  • In the Main Menu select "Project" - "Settings" or press Alt + F7

  • Select "Link" tab and "Category" - "Debug"

  • Enable the "Generate mapfile" option

  • Compile your project.

Creating a map file in MS Visual Studio 2003:

  • Open the project of your module in MS Visual C++;
  • In the Main Menu select Project - Properties;
  • In the appeared window select Configuration Properties - Linker - Debugging from the left navigation panel, set Generate Map File to Yes;

  • Compile your project.

Warning: the map file changes after every compilation, make sure you are using the correct pair of the module executable and map file.


Supported file formats

Enigma Protector supports any executable Windows 32/64 PE file, *.exe, *.dll, *.ocx, *.scr etc, files that are compiled with any kind of Win32/Win64 compiler, like C++, Delphi, MASM, Visual Basic, Free Pascal, FoxPro, Power Basic, TASM etc.


Work with the command line

Enigma Protector can be used to protect files through the command line. The command line of versions enigma32.exe or enigma64.exe is located in the installation folder.

  • To load the project file into Enigma Protector: for x86 version - Enigma32g.exe Project.enigma, for x64 version - Enigma64.exe Project.enigma64
  • To start the protection, use the console version:
    Version | Example
    Enigma Protector x86 (for protecting 32-bit files) | enigma32.exe [options] project.enigma
    Enigma Protector x64 (for protecting 64-bit files) | enigma64.exe [options] project.enigma64
    project.enigma/project.enigma64 is the Enigma Protector project file.
    The following options can be used:
    • -q enables quiet protection mode, all messages are supressed
    • -qe enables quiet protection mode, all messages are supressed except error messages
  • Build a Virtual Box package with console version using template file:
    Version | Example
    Enigma Protector x86 | enigma32.exe [options] project.enigma package.evb.template package.dat
    Enigma Protector x64 | enigma64.exe [options] project.enigma64 package.evb.template package.dat
    Project.enigma is the Enigma Protector project file.
    The following options can be used:
    • package.evb.template template file made by Virtual Box - Packaging - Package Builder
    • package.dat output package file


API Description

The Enigma API is a set of special functions that allow you to view the protection, trial and licensing parameters inside your application while the application is running. Please select the necessary API group:

  • Registration API - licensing and key validation functions;
  • Trial API - trial parameters and date/time monitoring functions;
  • Crypt API - hashing and encryption functions;
  • Miscellaneous API - protected strings, executed copies, watermarks, country, Enigma version, protection integrity and other miscellaneous functions;

See How to use Enigma API and Debugging with enigma_ide.dll pages to learn more about calling API from your application.

Warning: the Enigma API takes effect only after the module has been protected! Do not forget to protect the module before using it.


Registration API

Registration API is a set of functions that allow you to check, save, load and delete licensing information (registration name and key), extract additional information from the installed Registration key and get the current status of the Registration key and its expiration parameters.

  • EP_RegCheckKey
  • EP_RegCheckKeyA
  • EP_RegCheckKeyW
  • EP_RegLoadKey (deprecated)
  • EP_RegLoadKeyA (deprecated)
  • EP_RegLoadKeyW (deprecated)
  • EP_RegLoadKeyEx
  • EP_RegSaveKey
  • EP_RegSaveKeyA
  • EP_RegSaveKeyW
  • EP_RegDeleteKey
  • EP_RegLoadAndCheckKey
  • EP_RegCheckAndSaveKey
  • EP_RegCheckAndSaveKeyA
  • EP_RegCheckAndSaveKeyW
  • EP_RegHardwareID
  • EP_RegHardwareIDA
  • EP_RegHardwareIDW
  • EP_RegKeyExpirationDate
  • EP_RegKeyExpirationDateEx
  • EP_RegKeyCreationDate
  • EP_RegKeyCreationDateEx
  • EP_RegKeyExecutions
  • EP_RegKeyExecutionsLeft
  • EP_RegKeyExecutionsTotal
  • EP_RegKeyDays
  • EP_RegKeyDaysLeft
  • EP_RegKeyDaysTotal
  • EP_RegKeyRuntime
  • EP_RegKeyRuntimeLeft
  • EP_RegKeyRuntimeTotal
  • EP_RegKeyGlobalTime
  • EP_RegKeyGlobalTimeLeft
  • EP_RegKeyGlobalTimeTotal
  • EP_RegKeyRegisterAfterDate
  • EP_RegKeyRegisterAfterDateEx
  • EP_RegKeyRegisterBeforeDate
  • EP_RegKeyRegisterBeforeDateEx
  • EP_RegKeyStatus
  • EP_RegKeyInformation
  • EP_RegKeyInformationA
  • EP_RegKeyInformationW
  • EP_RegShowDialog

See How to use Enigma API page to learn more about calling API from your application.

Warning: the Enigma API takes effect only after the file has been protected! Do not forget to protect the file before using it.


EP_RegCheckKey

EP_RegCheckKey function serves for verifying registration information.

Parameters

  • Name - the registration name - a pointer to the null terminated ANSI string.
  • Key - the registration key - a pointer to the null terminated ANSI string.

Return Value

If the function succeeds, the return value is 1. If the function fails, the return value is 0.

Remark

UNICODE Registration Scheme should be disabled at REGISTRATION FEATURES - Common panel.
The function fails in the following cases:

  • the registration information is incorrect;
  • the application is not protected.

Definition

Show/Hide C++ function definition

extern "C" __declspec( dllimport ) __stdcall BOOL EP_RegCheckKey( char* Name, char* Key );

Show/Hide Delphi function definition

function EP_RegCheckKey ( Name : PAnsiChar; Key : PAnsiChar) : boolean; stdcall;

Show/Hide Visual Basic function definition

Public Declare Function EP_RegCheckKey Lib "enigma_ide.dll" (Name As String, Key As String) As Boolean

Show/Hide C# (.NET) function definition

public class Enigma_IDE
{
    [DllImport("enigma_ide.dll", CallingConvention = CallingConvention.StdCall)]
    public static extern bool EP_RegCheckKey(string Name, string Key);
}

Examples

Show/Hide Delphi function example

uses
  enigma_ide; // the module contains a definitions of Enigma API

function ProcessRegistration(Name, Key : AnsiString) : boolean;
begin
  Result := fasle;
  if EP_RegCheckKey(PAnsiChar(Name), PAnsiChar(Key)) then // check the registration information
  begin
    MessageBox(0, 'You have entered valid registration information'#10#13'You must call EP_RegSaveKey function to save it now!', 'Application', 0);
    Result := true; // return successful result
  end;
end;

Show/Hide C++ function example

#include "include/enigma_api.h" // the module contains a definitions of Enigma API
#pragma link "include/enigma_ide.lib"

BOOL ProcessRegistration(char* Name, char* Key)
{
  if (EP_RegCheckKey(Name, Key)) // check the registration information
  {
    MessageBox(0, "You have entered valid registration information\nYou must call EP_RegSaveKey function to save it now!", "Application", 0);
    return TRUE; // return successful result
  }
  return FALSE;
}

See function examples in the installation folder, Examples subfolder.


EP_RegCheckKeyA

EP_RegCheckKeyA function serves for verifying registration information. It is a duplicate and has the same functionality as the EP_RegCheckKey function.

Parameters

  • Name - the registration name - a pointer to the null terminated ANSI string.
  • Key - the registration key - a pointer to the null terminated ANSI string.

Return Value

If the function succeeds, the return value is 1. If the function fails, the return value is 0.

Remark

UNICODE Registration Scheme should be disabled at REGISTRATION FEATURES - Common panel.
The function fails in the following cases:

  • the registration information is incorrect;
  • the application is not protected.

Definition

Show/Hide C++ function definition

extern "C" __declspec( dllimport ) __stdcall BOOL EP_RegCheckKeyA( char* Name, char* Key );

Show/Hide Delphi function definition

function EP_RegCheckKeyA(  Name : PAnsiChar; Key : PAnsiChar) : boolean; stdcall;

Show/Hide C# (.NET) function definition

public class Enigma_IDE
{
    [DllImport("enigma_ide.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
    public static extern bool EP_RegCheckKeyA(string Name, string Key);
}

See function examples in the installation folder, Examples subfolder.


EP_RegCheckKeyW

EP_RegCheckKeyW function serves for verifying registration information. It has the same functionality as EP_RegCheckKey, but is used for processing unicode (wide) strings data. Please note, to use this function you have to enable UNICODE Registration Scheme at REGISTRATION FEATURES - Common panel.

Parameters

  • Name - the registration name - a pointer to the null terminated unicode (wide) string.
  • Key - the registration key - a pointer to the null terminated unicode (wide) string.

Return Value

If the function succeeds, the return value is 1. If the function fails, the return value is 0.

Remark

The function fails in the following cases:

  • the registration information is incorrect;
  • the application is not protected.

Definition

Show/Hide C++ function definition

extern "C" __declspec( dllimport ) __stdcall BOOL EP_RegCheckKeyW( wchar_t* Name, wchar_t* Key );

Show/Hide Delphi function definition

function EP_RegCheckKeyW(  Name : PWideChar; Key : PWideChar) : boolean; stdcall;

Show/Hide C# (.NET) function definition

public class Enigma_IDE
{
    [DllImport("enigma_ide.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.StdCall)]
    public static extern bool EP_RegCheckKeyW(string Name, string Key);
}

See function examples in the installation folder, Examples\RegistrationUnicode subfolder.


EP_RegCheckAndSaveKey

EP_RegCheckAndSaveKey function serves for verifying and saving the registration information. It combines couple functions EP_RegCheckKey and EP_RegSaveKey. If the registration information is valid for the current project, then it will be saved, otherwise the function fails.

Parameters

  • Name - the registration name - a pointer to the null terminated ANSI string.
  • Key - the registration key - a pointer to the null terminated ANSI string.

Return Value

If the function succeeds, the return value is 1. If the function fails, the return value is 0.

Remark

UNICODE Registration Scheme should be disabled at REGISTRATION FEATURES - Common panel.
The function fails in the following cases:

  • the registration information is incorrect;
  • an error ocurred while saving the registration information (it can occur due to the enabled protection from writing files to the drive or entries in the registry);
  • the application is not protected.

Definition

Show/Hide C++ function definition

extern "C" __declspec( dllimport ) __stdcall BOOL EP_RegCheckAndSaveKey( char* Name, char* Key );

Show/Hide Delphi function definition

function EP_RegCheckAndSaveKey(  Name : PAnsiChar; Key : PAnsiChar) : boolean; stdcall;

Show/Hide Visual Basic function definition

Public Declare Function EP_RegCheckAndSaveKey Lib "enigma_ide.dll" (ByVal Name As String, ByVal Key As String) As Boolean

Show/Hide C# (.NET) function definition

public class Enigma_IDE
{
    [DllImport("enigma_ide.dll", CallingConvention = CallingConvention.StdCall)]
    public static extern bool EP_RegCheckAndSaveKey(string Name, string Key);
}

Examples

Show/Hide Delphi function example

uses
  enigma_ide; // the module contains a definitions of Enigma API

function ProcessRegistration(Name, Key : AnsiString) : boolean;
begin
  Result := fasle;
  if EP_RegCheckAndSaveKey(PAnsiChar(Name), PAnsiChar(Key)) then // check and save registration information
  begin
    MessageBox(0, 'The Registration information had been saved successfully!', 'Application', 0);
    Result := true; // return successful result
  end;
end;

Show/Hide C++ function example

#include "include/enigma_api.h" // the module contains a definitions of Enigma API
#pragma link "include/enigma_ide.lib"

BOOL ProcessRegistration(char* Name, char* Key)
{
  if (EP_RegCheckAndSaveKey(Name, Key)) // check and save registration information
  {
    MessageBox(0, "The Registration information had been saved successfully!", "Application", 0);
    return TRUE; // return successful result
  }
  return FALSE;
}

Show/Hide C# (.NET) function example

private void btnRegister_Click(object sender, System.EventArgs e)
{
    if (Enigma_IDE.EP_RegCheckAndSaveKey(tbUserInfo.Text , tbKey.Text ))
    {
        OnRegistration(true);
        MessageBox.Show("Registration key is valid!\nThanks you for registration!!!", "Registration completed");
    }
    else
    {
        OnRegistration(false);
        MessageBox.Show("Registration key is invalid!\nPlease, try again!!!", "Registration incompleted");
    }
}

See function examples in the installation folder, Examples subfolder.


EP_RegCheckAndSaveKeyA

EP_RegCheckAndSaveKeyA function serves for verifying and saving the registration information. It is a duplicate and has the same functionality as the EP_RegCheckAndSaveKey function.

Parameters

  • Name - the registration name - a pointer to the null terminated ANSI string.
  • Key - the registration key - a pointer to the null terminated ANSI string.

Return Value

If the function succeeds, the return value is 1. If the function fails, the return value is 0.

Remark

UNICODE Registration Scheme should be disabled at REGISTRATION FEATURES - Common panel.
The function fails in the following cases:

  • the registration information is incorrect;
  • an error ocurred while saving the registration information (it can occur due to the enabled protection from writing files to the drive or entries in the registry);
  • the application is not protected.

Definition

Show/Hide C++ function definition

extern "C" __declspec( dllimport ) __stdcall BOOL EP_RegCheckAndSaveKeyA( char* Name, char* Key );

Show/Hide Delphi function definition

function EP_RegCheckAndSaveKeyA(  Name : PAnsiChar; Key : PAnsiChar) : boolean; stdcall;

Show/Hide C# (.NET) function definition

public class Enigma_IDE
{
    [DllImport("enigma_ide.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
    public static extern bool EP_RegCheckAndSaveKeyA(string Name, string Key);
}

See function examples in the installation folder, Examples subfolder.


EP_RegCheckAndSaveKeyW

EP_RegCheckAndSaveKeyW function serves for verifying and saving the registration information. It has the same functionality as EP_RegCheckAndSaveKey, but is used for processing unicode (wide) strings data. Please note, to use this function you should enable UNICODE Registration Scheme at REGISTRATION FEATURES - Common panel.

Parameters

  • Name - the registration name - a pointer to the null terminated unicode (wide) string.
  • Key - the registration key - a pointer to the null terminated unicode (wide) string.

Return Value

If the function succeeds, the return value is 1. If the function fails, the return value is 0.

Remark

The function fails in the following cases:

  • the registration information is incorrect;
  • an error(s) ocurred while saving the registration information (it can occur due to the enabled protection from writing files to the drive or entries in the registry);
  • the application is not protected.

Definition

Show/Hide C++ function definition

extern "C" __declspec( dllimport ) __stdcall BOOL EP_RegCheckAndSaveKeyW( wchar_t* Name, wchar_t* Key );

Show/Hide Delphi function definition

function EP_RegCheckAndSaveKeyW(  Name : PWideChar; Key : PWideChar) : boolean; stdcall;

Show/Hide C# (.NET) function definition

public class Enigma_IDE
{
    [DllImport("enigma_ide.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.StdCall)]
    public static extern bool EP_RegCheckAndSaveKeyW(string Name, string Key);
}

See function examples in the installation folder, Examples\RegistrationUnicode subfolder.


EP_RegDeleteKey

EP_RegDeleteKey function serves for deleting the existing registration information.

Parameters

The function does not have parameters.

Return Value

If the function succeeds, the return value is 1. If the function fails, the return value is 0.

Remark

The function fails in the following cases:

  • no registration information is present;
  • an error ocurred while deleting the registration information (it can occur due to the enabled protection from deleting files from the drive or entries in the registry);
  • the application is not protected.

Definition

Show/Hide C++ function definition

extern "C" __declspec( dllimport ) __stdcall BOOL EP_RegDeleteKey();

Show/Hide Delphi function definition

function EP_RegDeleteKey : boolean; stdcall;

Show/Hide Visual Basic function definition

Public Declare Function EP_RegDeleteKey Lib "enigma_ide.dll" () As Boolean

Show/Hide C# (.NET) function definition

public class Enigma_IDE
{
    [DllImport("enigma_ide.dll", CallingConvention = CallingConvention.StdCall)]
    public static extern bool EP_RegDeleteKey();
}

Examples

Show/Hide Delphi function example

uses
  enigma_ide; // the module contains a definitions of Enigma API

function DeleteRegistrationInformation : boolean;
begin
  Result := fasle;
  if EP_RegDeleteKey then // delete the registration information
  begin
    MessageBox(0, 'The registration had been deleted successfully!', 'Application', 0);
    Result := true; // return successful result
  end;
end;

Show/Hide C++ function example

#include "include/enigma_api.h" // the module contains a definitions of Enigma API
#pragma link "include/enigma_ide.lib"

BOOL DeleteRegistrationInformation()
{
  if (EP_RegDeleteKey()) // delete the registration information
  {
    MessageBox(0, "The registration had been deleted successfully!", "Application", 0);
    return TRUE; // return successful result
  }
  return FALSE;
}

See function examples in the installation folder, Examples subfolder.


EP_RegHardwareID

EP_RegHardware function serves for retrieving unique user PC information. See Registration Features - Hardware Lock panel for more detailed information.

Parameters

The function does not have parameters

Return Value

If the function succeeds, the return value is a pointer to the null terminated ANSI string. If the function fails, the return value is 0.

Remark

UNICODE Registration Scheme should be disabled at REGISTRATION FEATURES - Common panel.

Definition

Show/Hide C++ function definition

extern "C" __declspec( dllimport ) __stdcall PANSICHAR EP_RegHardwareID();

Show/Hide Delphi function definition

function EP_RegHardwareID : PAnsiChar; stdcall;

Show/Hide Visual Basic function definition

Public Declare Function EP_RegHardwareID Lib "enigma_ide.dll" As String

Show/Hide C# (.NET) function definition

public class Enigma_IDE
{
    [DllImport("enigma_ide.dll", CallingConvention = CallingConvention.StdCall)]
    public static extern string EP_RegHardwareID();
}

Examples

Show/Hide Delphi function example

uses
  enigma_ide; // the module contains a definitions of Enigma API

procedure ShowHardwareID;
var
  pcHardware : PAnsiChar;
begin
  pcHardware := EP_RegHardwareID;
  if pcHardware <> nil then
  begin
    MessageBox(0, format('The Hardware ID is: %s', [AnsiString(pcHardware)]), 'Application', 0);
  end else
  begin
    MessageBox(0, 'Application is not protected...?', 'Application', 0);
  end;
end;

Show/Hide C++ function example

#include "include/enigma_api.h" // the module contains a definitions of Enigma API
#pragma link "include/enigma_ide.lib"

void ShowHardwareID()
{
  char* cHardware = null;

  cHardware = EP_RegHardwareID();
  MainForm -> Text.c_str = cHardware;
}

See function examples in the installation folder, Examples subfolder.


EP_RegHardwareIDA

EP_RegHardwareIDA function serves for retrieving unique user PC information. See Registration Features - Hardware Lock panel for more details.

Parameters

The function does not have parameters

Return Value

If the function succeeds, the return value is a pointer to the null terminated ANSI string. If the function fails, the return value is 0.

Remark

UNICODE Registration Scheme should be disabled at REGISTRATION FEATURES - Common panel.

Definition

Show/Hide C++ function definition

extern "C" __declspec( dllimport ) __stdcall PANSICHAR EP_RegHardwareIDA();

Show/Hide Delphi function definition

function EP_RegHardwareIDA : PAnsiChar; stdcall;

Show/Hide C# (.NET) function definition

public class Enigma_IDE
{
    [DllImport("enigma_ide.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
    public static extern string EP_RegHardwareIDA();
}

See function examples in the installation folder, Examples subfolder.


EP_RegHardwareIDW

EP_RegHardwareIDW function serves for retrieving unique user PC information. See Registration Features - Hardware Lock panel for more details. Please note, to use this function you should enable UNICODE Registration Scheme at REGISTRATION FEATURES - Common panel.

Parameters

The function does not have parameters

Return Value

If the function succeeds, the return value is a pointer to the null terminated unicode (wide) string. If the function fails, the return value is 0.

Definition

Show/Hide C++ function definition

extern "C" __declspec( dllimport ) __stdcall PWCHAR EP_RegHardwareIDW();

Show/Hide Delphi function definition

function EP_RegHardwareIDW : PWideChar; stdcall;

Show/Hide C# (.NET) function definition

public class Enigma_IDE
{
    [DllImport("enigma_ide.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.StdCall)]
    public static extern string EP_RegHardwareIDW();
}

See function examples in the installation folder, Examples\RegistrationUnicode subfolder.


EP_RegLoadKey (deprecated)

EP_RegLoadKey (deprecated, please use EP_RegLoadKeyEx instead) function serves for reading the registration information. The place and path where the registration information will be stored should be defined in REGISTRATION FEATURES - Registration data storing panel.

Parameters

  • Name - the registration name - a pointer that will return a null terminated ANSI string.
  • Key - the registration key - a pointer that will return a null terminated ANSI string.

Return Value

If the function succeeds, the return value is 1. If the function fails, the return value is 0.

Remark

UNICODE Registration Scheme should be disabled at REGISTRATION FEATURES - Common panel.
The function just reads the registration information, it does not verify key validation. To make sure you have the correct pair of registration name/key, you must manually check the key validatation by means of EP_RegCheckKey, or use the combine function EP_RegLoadAndCheckKey.

Definition

Show/Hide C++ function definition

extern "C" __declspec( dllimport ) __stdcall BOOL EP_RegLoadKey( char** Name, char** Key );

Show/Hide Delphi function definition

function EP_RegLoadKey( var Name : PAnsiChar; var Key : PAnsiChar) : boolean; stdcall;

Show/Hide Visual Basic function definition

Public Declare Function EP_RegLoadKey Lib "enigma_ide.dll" (ByRef Name As String, ByRef Key As String) As Boolean

Show/Hide C# (.NET) function definition

public class Enigma_IDE
{
    [DllImport("enigma_ide.dll", CallingConvention = CallingConvention.StdCall)]
    public static extern bool EP_RegLoadKey(ref string Name, ref string Key);
}

See function examples in the installation folder, Examples subfolder.


EP_RegLoadKeyA (deprecated)

EP_RegLoadKeyA (deprecated, please use EP_RegLoadKeyEx instead) function serves for reading the registration information. It is a duplicate and has the same functionality as the EP_RegLoadKey function.

Parameters

  • Name - the registration name - the pointer that will return a null terminated ANSI string.
  • Key - the registration key - the pointer that will return a null terminated ANSI string.

Return Value

If the function succeeds, the return value is 1. If the function fails, the return value is 0.

Remark

UNICODE Registration Scheme should be disabled at REGISTRATION FEATURES - Common panel.
The function just reads the registration information, it does not verify key validation. To make sure you have the correct pair of registration name/key, you must manually check the key validation by means of EP_RegCheckKeyA, or use the combine function EP_RegLoadAndCheckKey.

Definition

Show/Hide C++ function definition

extern "C" __declspec( dllimport ) __stdcall BOOL EP_RegLoadKeyA( char** Name, char** Key );

Show/Hide Delphi function definition

function EP_RegLoadKeyA( var Name : PAnsiChar; var Key : PAnsiChar) : boolean; stdcall;

Show/Hide C# (.NET) function definition

public class Enigma_IDE
{
    [DllImport("enigma_ide.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
    public static extern bool EP_RegLoadKeyA(ref string Name, ref string Key);
}

See function examples in the installation folder, Examples subfolder.


EP_RegLoadKeyW (deprecated)

EP_RegLoadKeyW (deprecated, please use EP_RegLoadKeyEx instead) function serves for reading the registration information. It has the same functionality as EP_RegLoadKey but is used for processing of unicode (wide) strings data. Please note, to use this function you have to enable UNICODE Registration Scheme at REGISTRATION FEATURES - Common panel.

Parameters

  • Name - the registration name - the pointer that will return a null terminated unicode (wide) string.
  • Key - the registration key - the pointer that will return a null terminated unicode (wide) string.

Return Value

If the function succeeds, the return value is 1. If the function fails, the return value is 0.

Remark

The function just reads the registration information, it does not verify key validation. To make sure you have the correct pair of registration name/key, you must manually check the key validation by means of EP_RegCheckKeyW, or use the combine function EP_RegLoadAndCheckKey.

Definition

Show/Hide C++ function definition

extern "C" __declspec( dllimport ) __stdcall BOOL EP_RegLoadKeyW( wchar_t** Name, wchar_t** Key );

Show/Hide Delphi function definition

function EP_RegLoadKeyW( var Name : PWideChar; var Key : PWideChar) : boolean; stdcall;

Show/Hide C# (.NET) function definition

public class Enigma_IDE
{
    [DllImport("enigma_ide.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.StdCall)]
    public static extern bool EP_RegLoadKeyW(ref string Name, ref string Key);
}

See function examples in the installation folder, Examples\RegistrationUnicode subfolder.


EP_RegLoadKeyEx

EP_RegLoadKeyEx function serves for reading of the registration information (name and key). This function should be used instead of deprecated EP_RegLoadKey. The place and path where the registration information will be stored should be defined in REGISTRATION FEATURES - Registration data storing panel.

Parameters

  • Name - pointer to the buffer that receives registration name. If the UNICODE Registration Scheme is used in REGISTRATION FEATURES - Common panel then Name buffer contains unicode string otherwise ansi string (without null terminator)
  • NameLen - receives a size in bytes of the Name buffer. Returns the required or passed to Name buffer number of bytes
  • Key - pointer to the buffer that receives registration key. If the UNICODE Registration Scheme is used in REGISTRATION FEATURES - Common panel then Key buffer contains unicode string otherwise ansi string (without null terminator)
  • KeyLen - receives a size in bytes of the Key buffer. Returns the required or passed to Key buffer number of bytes

Return Value

The function returns one of the following values:
Value | Description
LOADKEY_SUCCEEDED = 0; | Registration information loaded successfully
LOADKEY_REGINFONOTFOUND = 1; | Registration information is not found
LOADKEY_NAMEBUFFERTOOSMALL = 2; | Buffer for registration name is too small
LOADKEY_KEYBUFFERTOOSMALL = 3; | Buffer for registration key is too small

Remark

The function just reads the registration information, it does not verify key validation. To make sure you have the correct pair of registration name/key, you must manually check the key validatation by means of EP_RegCheckKey, or use the combine function EP_RegLoadAndCheckKey.

Definition

Show/Hide Delphi function definition

function EP_RegLoadKeyEx(Name : pointer; var NameLen : Cardinal; Key : pointer; var KeyLen : Cardinal) : Cardinal; stdcall;

Show/Hide C# (.NET) function definition

public class Enigma_IDE
{
    [DllImport("enigma_ide.dll", CallingConvention = CallingConvention.StdCall)]
    public static extern int EP_RegLoadKeyEx(IntPtr Name, ref int NameLen, IntPtr Key, ref int KeyLen);
}

Show/Hide C++ function definition

extern "C" __declspec( dllimport ) __stdcall int EP_RegLoadKeyEx( char* Name, int* NameLen, char* Key, int* KeyLen);

Examples

Show/Hide Delphi function example

uses
  enigma_ide; // the module contains a definitions of Enigma API

function EP_RegistrationLoadKeyA(var Name, Key : AnsiString) : boolean;
var
  namelen, keylen : Cardinal;
  namebuf, keybuf : pointer;
begin
  Result := false;
  namelen := 0;
  keylen := 0;
  if EP_RegLoadKeyEx(nil, namelen, nil, keylen) <> LOADKEY_REGINFONOTFOUND then
  begin
    GetMem(namebuf, namelen);
    try
      GetMem(keybuf, keylen);
      try
        if EP_RegLoadKeyEx(namebuf, namelen, keybuf, keylen) = LOADKEY_SUCCEEDED then
        begin
          SetString(Name, PAnsiChar(namebuf), namelen);
          SetString(Key, PAnsiChar(keybuf), keylen);
          Result := true;
        end;
      finally
        FreeMem(keybuf);
      end;
    finally
      FreeMem(namebuf);
    end;
  end;
end;

function EP_RegistrationLoadKeyW(var Name, Key : WideString) : boolean;
var
  namelen, keylen : Cardinal;
  namebuf, keybuf : pointer;
begin
  Result := false;
  namelen := 0;
  keylen := 0;
  if EP_RegLoadKeyEx(nil, namelen, nil, keylen) <> LOADKEY_REGINFONOTFOUND then
  begin
    GetMem(namebuf, namelen);
    try
      GetMem(keybuf, keylen);
      try
        if EP_RegLoadKeyEx(namebuf, namelen, keybuf, keylen) = LOADKEY_SUCCEEDED then
        begin
          SetString(Name, PWideChar(namebuf), namelen shr 1);
          SetString(Key, PWideChar(keybuf), keylen shr 1);
          Result := true;
        end;
      finally
        FreeMem(keybuf);
      end;
    finally
      FreeMem(namebuf);
    end;
  end;
end;

Show/Hide C# function example

public class Enigma_IDE
{
    public static bool EP_RegistrationLoadKeyA(out string Name, out string Key)
    {
        Name = Key = string.Empty;
        int namelen = 0, keylen = 0;
        if (EP_RegLoadKeyEx(IntPtr.Zero, ref namelen, IntPtr.Zero, ref keylen) != LOADKEY_REGINFONOTFOUND)
        {
            byte[] namebuf = new byte[namelen];
            byte[] keybuf = new byte[keylen];
            if (EP_RegLoadKeyEx(Marshal.UnsafeAddrOfPinnedArrayElement(namebuf, 0), ref namelen, Marshal.UnsafeAddrOfPinnedArrayElement(keybuf, 0), ref keylen) == LOADKEY_SUCCEEDED)
            {
                Name = Encoding.ASCII.GetString(namebuf);
                Key = Encoding.ASCII.GetString(keybuf);
                return true;
            }
        }
        return false;
    }

    public static bool EP_RegistrationLoadKeyW(out string Name, out string Key)
    {
        Name = Key = string.Empty;
        int namelen = 0, keylen = 0;
        if (EP_RegLoadKeyEx(IntPtr.Zero, ref namelen, IntPtr.Zero, ref keylen) != LOADKEY_REGINFONOTFOUND)
        {
            byte[] namebuf = new byte[namelen];
            byte[] keybuf = new byte[keylen];
            if (EP_RegLoadKeyEx(Marshal.UnsafeAddrOfPinnedArrayElement(namebuf, 0), ref namelen, Marshal.UnsafeAddrOfPinnedArrayElement(keybuf, 0), ref keylen) == LOADKEY_SUCCEEDED)
            {
                Name = Encoding.Unicode.GetString(namebuf);
                Key = Encoding.Unicode.GetString(keybuf);
                return true;
            }
        }
        return false;
    }
}

See function examples in the installation folder, Examples subfolder.


EP_RegSaveKey

EP_RegSaveKey function serves for saving the registration information. The place and path where the registration information will be stored should be defined in REGISTRATION FEATURES - Registration data storing panel.

Parameters

  • Name - the registration name - a pointer to the null terminated ANSI string.
  • Key - the registration key - a pointer to the null terminated ANSI string.

Return Value

If the function succeeds, the return value is 1. If the function fails, the return value is 0.

Remark

The function only saves the registration information. To make sure you save the correct registration information, you should verify it by means of the EP_RegCheckKey function. Otherwise, use the combine function EP_RegCheckAndSaveKey.

Definition

Show/Hide C++ function definition

extern "C" __declspec( dllimport ) __stdcall BOOL EP_RegSaveKey( char* Name, char* Key );

Show/Hide Delphi function definition

function EP_RegSaveKey( Name : PAnsiChar; Key : PAnsiChar) : boolean; stdcall;

Show/Hide Visual Basic function definition

Public Declare Function EP_RegSaveKey Lib "enigma_ide.dll" (Name As String, Key As String) As Boolean

Show/Hide C# (.NET) function definition

public class Enigma_IDE
{
    [DllImport("enigma_ide.dll", CallingConvention = CallingConvention.StdCall)]
    public static extern bool EP_RegSaveKey(string Name, string Key);
}

Examples

Show/Hide Delphi function example

uses
  enigma_ide; // the module contains a definitions of Enigma API

function ProcessRegistration(Name, Key : AnsiString) : boolean;
begin
  Result := fasle;
  if EP_RegCheckKey(PAnsiChar(Name), PAnsiChar(Key)) then // check the registration information
  begin
    MessageBox(0, 'The Registration Information is valid for this project!', 'Application', 0);
    if EP_RegSaveKey(PAnsiChar(Name), PAnsiChar(Key)) then // save registration information
    begin
      MessageBox(0, 'The Registration Information had been saved successfully!', 'Application', 0);
      Result := true; // return succeessful result
    end else
      MessageBox(0, 'The Registration Information can''t be save... Unknown reasons', 'Application', 0);
  end else
    MessageBox(0, 'The Registration Information is NOT valid!'#10#13'Try to enter this again!', 'Application', 0);
end;

Show/Hide C++ function example

#include "include/enigma_api.h" // the module contains a definitions of Enigma API
#pragma link "include/enigma_ide.lib"

BOOL ProcessRegistration( char* Name, char* Key)
{
  if (EP_RegCheckKey(Name, Key)) // check the registration information
  {
    MessageBox(0, "The Registration Information is valid for this project!", "Application", 0);
    if (EP_RegSaveKey(Name, Key)) // save the registration information
    {
      MessageBox(0, "The Registration Information had been saved successfully!", "Application", 0);
      return TRUE;
    } else
    {
      MessageBox(0, "The Registration Information can''t be save... Unknown reasons", "Application", 0);
    }
  } else
  {
    MessageBox(0, "The Registration Information is NOT valid!\nTry to enter this again!", "Application", 0);
  }
  return FALSE;
}

See function examples in the installation folder, Examples subfolder.


EP_RegSaveKeyA

EP_RegSaveKeyA function serves for saving the registration information. It is a duplicate and has the same functionality as the EP_RegSaveKey function.

Parameters

  • Name - the registration name - a pointer to the null terminated ANSI string.
  • Key - the registration key - a pointer to the null terminated ANSI string.

Return Value

If the function succeeds, the return value is 1. If the function fails, the return value is 0.

Remark

The function only saves the registration information. To make sure you save the correct registration information, you should verify it by means of the EP_RegCheckKeyA function. Otherwise, use the combine function EP_RegCheckAndSaveKeyA.

Definition

Show/Hide C++ function definition

extern "C" __declspec( dllimport ) __stdcall BOOL EP_RegSaveKeyA( char* Name, char* Key );

Show/Hide Delphi function definition

function EP_RegSaveKeyA( Name : PAnsiChar; Key : PAnsiChar) : boolean; stdcall;

Show/Hide C# (.NET) function definition

public class Enigma_IDE
{
    [DllImport("enigma_ide.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
    public static extern bool EP_RegSaveKeyA(string Name, string Key);
}

See function examples in the installation folder, Examples subfolder.


EP_RegSaveKeyW

EP_RegSaveKeyW function serves for saving the registration information. It has the same functionality as EP_RegSaveKey, but is used for processing the unicode (wide) strings data. Please note, to use this function you must enable UNICODE Registration Scheme at REGISTRATION FEATURES - Common

Parameters

  • Name - the registration name - a pointer to the null terminated unicode (wide) string.
  • Key - the registration key - a pointer to the null terminated unicode (wide) string.

Return Value

If the function succeeds, the return value is 1. If the function fails, the return value is 0.

Remark

The function only saves the registration information. To make sure you save the correct registration information, you should verify it by means of the EP_RegCheckKeyW function. Otherwise, use the combine function EP_RegCheckAndSaveKeyW.

Definition

Show/Hide C++ function definition

extern "C" __declspec( dllimport ) __stdcall BOOL EP_RegSaveKeyW( wchar_t* Name, wchar_t* Key );

Show/Hide Delphi function definition

function EP_RegSaveKeyW( Name : PWideChar; Key : PWideChar) : boolean; stdcall;

Show/Hide C# (.NET) function definition

public class Enigma_IDE
{
    [DllImport("enigma_ide.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.StdCall)]
    public static extern bool EP_RegSaveKeyW(string Name, string Key);
}

See function examples in the installation folder, Examples\RegistrationUnicode subfolder.


EP_RegLoadAndCheckKey

EP_RegLoadAndCheckKey function serves for reading and verifying registration information. It combines couple functions EP_RegLoadKey and EP_RegCheckKey.

Parameters

The function does not have parameters.

Return Value

If the function succeeds, the return value is 1. If the function fails, the return value is 0.

Remark

The function fails in the following cases:

  • the registration information is not present;
  • the registration information is incorrect;
  • the application is not protected.

Definition

Show/Hide C++ function definition

extern "C" __declspec( dllimport ) __stdcall BOOL EP_RegLoadAndCheckKey();

Show/Hide Delphi function definition

function EP_RegLoadAndCheckKey : boolean; stdcall;

Show/Hide Visual Basic function definition

Public Declare Function EP_RegLoadAndCheckKey Lib "enigma_ide.dll" () As Boolean

Show/Hide C# (.NET) function definition

public class Enigma_IDE
{
    [DllImport("enigma_ide.dll", CallingConvention = CallingConvention.StdCall)]
    public static extern bool EP_RegLoadAndCheckKey();
}

Examples

Show/Hide Delphi function example

uses
  enigma_ide; // the module contains a definitions of Enigma API

function IsRegistered : boolean;
begin
  Result := fasle;
  if EP_RegLoadAndCheckKey then // read and check the registration information
  begin
    MessageBox(0, 'The Application is registered!', 'Application', 0);
    Result := true; // return successful result
  end else
    MessageBox(0, 'The Application is NOT registered!!!', 'Application', 0);
end;

Show/Hide C++ function example

#include "include/enigma_api.h" // the module contains a definitions of Enigma API
#pragma link "include/enigma_ide.lib"

BOOL IsRegistered()
{
  if (EP_RegLoadAndCheckKey) // read and check registration information
  {
    MessageBox(0, "The Application is registered!", "Application", 0);
    return TRUE; // return successful result
  } else
  {
    MessageBox(0, "The Application is NOT registered!!!", "Application", 0);
  }
  return FALSE;
}

See function examples in the installation folder, Examples subfolder.


EP_RegKeyCreationDate

EP_RegKeyCreationDate function serves for retrieving the Registration key creation date. See Creating Keys for more details. See also the extended function EP_RegKeyCreationDateEx.

Parameters

  • Year - the year of the key creation date.
  • Month - the month of the key creation date.
  • Day - the day of the key creation date.

Return Value

If the function succeeds, the return value is 1. If the function fails, the return value is 0.

Remark

The function fails in the following cases:

  • there is no valid registration key;
  • the application is not protected.

Definition

Show/Hide C++ function definition

extern "C" __declspec( dllimport ) __stdcall BOOL EP_RegKeyCreationDate( int* Year, int* Month, int* Day );

Show/Hide Delphi function definition

function EP_RegKeyCreationDate( var Year, Month, Day : integer) : boolean; stdcall;

Show/Hide Visual Basic function definition

Public Declare Function EP_RegKeyCreationDate Lib "enigma_ide.dll" (ByRef Year As Long, ByRef Month As Long, ByRef Day As Long) As Byte

Show/Hide C# (.NET) function definition

public class Enigma_IDE
{
    [DllImport("enigma_ide.dll", CallingConvention = CallingConvention.StdCall)]
    public static extern bool EP_RegKeyCreationDate(ref Int32 Year, ref Int32 Month, ref Int32 Day);
}

Examples

Show/Hide Delphi function example

uses
  enigma_ide; // the module contains a definitions of Enigma API

procedure TfrmMain.OnRegistration(Name, Key : string);
var
  wYear, wMonth, wDay : integer;
begin
  if EP_RegCheckKey(PAnsiChar(Name), PAnsiChar(Key)) then
  begin
    if EP_RegKeyCreationDate(wYear, wMonth, wDay) then
    begin
      eKeyCreation.Color := clLime;
      eKeyCreation.Text := format('%.2d/%.2d/%.2d', [wMonth, wDay, wYear]);
    end;
  end;
end;

See function examples in the installation folder.


EP_RegKeyCreationDateEx

EP_RegKeyCreationDateEx returns the registration key creation date. See Creating Keys for more details.

Parameters

The function does not have parameters.

Return Value

If the function succeeds, the return value is a 32-bit unsigned integer value that represents the Date value. The high byte of the high word contains a day value, the low byte of the high word contains a month value, the low word contains a year value. For example, the returned value 0x10012010 ($10012010) means the 10 January 2010 date. If the function fails, the return value is 0.

Remark

The function fails in the following cases:

  • there is no valid registration key;
  • the application is not protected.

Definition

Show/Hide C++ function definition

extern "C" __declspec( dllexport ) __stdcall int EP_RegKeyCreationDateEx();

Show/Hide Delphi function definition

function EP_RegKeyCreationDateEx : Cardinal;

Show/Hide Visual Basic function definition

Public Declare Function EP_RegKeyCreationDateEx Lib "enigma_ide.dll" () As Long

Show/Hide C# (.NET) function definition

public class Enigma_IDE
{
    [DllImport("enigma_ide.dll", CallingConvention = CallingConvention.StdCall)]
    public static extern int EP_RegKeyCreationDateEx();
}

See function examples in the installation folder.


EP_RegKeyExpirationDate

EP_RegKeyExpirationDate function serves for retrieving the registration key expiration date. The registration should be generated with the Key Expiration Date option enabled. See Creating Keys for more details. See also the extended function EP_RegKeyExpirationDateEx.

Parameters

  • Year - the year of the key expiration date.
  • Month - the month of the key expiration date.
  • Day - the day of the key expiration date.

Return Value

If the function succeeds, the return value is 1. If the function fails, the return value is 0.

Remark

The function fails in the following cases:

  • there is no valid registration key;
  • the registration key is not limited by time;
  • the application is not protected.

Definition

Show/Hide C++ function definition

extern "C" __declspec( dllimport ) __stdcall BOOL EP_RegKeyExpirationDate( int* Year, int* Month, int* Day );

Show/Hide Delphi function definition

function EP_RegKeyExpirationDate( var Year, Month, Day : integer) : boolean; stdcall;

Show/Hide Visual Basic function definition

Public Declare Function EP_RegKeyExpirationDate Lib "enigma_ide.dll" (ByRef Year As Long, ByRef Month As Long, ByRef Day As Long) As Byte

Show/Hide C# (.NET) function definition

public class Enigma_IDE
{
    [DllImport("enigma_ide.dll", CallingConvention = CallingConvention.StdCall)]
    public static extern bool EP_RegKeyExpirationDate(ref Int32 Year, ref Int32 Month, ref Int32 Day);
}

Examples

Show/Hide Delphi function example

uses
  enigma_ide; // the module contains a definitions of Enigma API

procedure TfrmMain.OnRegistration(Name, Key : string);
var
  wYear, wMonth, wDay : integer;
begin
  if EP_RegCheckKey(PAnsiChar(Name), PAnsiChar(Key)) then
  begin
    if EP_RegKeyExpirationDate(wYear, wMonth, wDay) then
    begin
      eKeyExpiration.Color := clLime;
      eKeyExpiration.Text := format('%.2d/%.2d/%.2d', [wMonth, wDay, wYear]);
    end else
    begin
      eKeyExpiration.Color := clAqua;
      eKeyExpiration.Text := 'KEY IS NOT TIME LIMITED';
    end;
  end;
end;

See function examples in the installation folder, Examples\KeyExpiration subfolder.

s


EP_RegKeyExpirationDateEx

EP_RegKeyExpirationDateEx returns the expiration date of the registration key. The registration key should be generated with the Expiration Date option enabled. See Creating Keys for more details.

Parameters

The function does not have parameters.

Return Value

If the function succeeds, the return value is a 32-bit unsigned integer value that represents the Date value. The high byte of the high word contains a day value, the low byte of the high word contains a month value, the low word contains a year value. For example, the returned value 0x10012010 ($10012010) means the 10 January 2010 date. If the function fails, the return value is 0.

Remark

The function fails in the following cases:

  • there is no valid registration key;
  • the registration key is not limited by time;
  • the application is not protected.

Definition

Show/Hide C++ function definition

extern "C" __declspec( dllexport ) __stdcall int EP_RegKeyExpirationDateEx();

Show/Hide Delphi function definition

function EP_RegKeyExpirationDateEx : Cardinal;

Show/Hide Visual Basic function definition

Public Declare Function EP_RegKeyExpirationDateEx Lib "enigma_ide.dll" () As Long

Show/Hide C# (.NET) function definition

public class Enigma_IDE
{
    [DllImport("enigma_ide.dll", CallingConvention = CallingConvention.StdCall)]
    public static extern int EP_RegKeyExpirationDateEx();
}

See function examples in the installation folder, Examples\KeyExpiration subfolder.


EP_RegKeyExecutions

EP_RegKeyExecutions function returns the Total number of executions and the number of executions Left that the registration key is limited to. See Creating Keys for more details. See also the extended functions EP_RegKeyExecutionsLeft and EP_RegKeyExecutionsTotal.

Parameters

  • Total - the total number of executions that the registration key is limited to.
  • Left - the number of executions left.

Return Value

If the function succeeds, the return value is 1. If the function fails, the return value is 0.

Remark

The function fails in the following cases:

  • the registration key is not limited by executions;
  • there is no valid registration key;
  • the application is not protected.

Definition

Show/Hide C++ function definition

extern "C" __declspec( dllimport ) __stdcall BOOL EP_RegKeyExecutions( int* Total, int* Left );

Show/Hide Delphi function definition

function EP_RegKeyExecutions( var Total, Left : Cardinal) : boolean; stdcall;

Show/Hide Visual Basic function definition

Public Declare Function EP_RegKeyExecutions Lib "enigma_ide.dll" (ByRef Total As Long, ByRef Left As Long) As Byte

Show/Hide C# (.NET) function definition

public class Enigma_IDE
{
    [DllImport("enigma_ide.dll", CallingConvention = CallingConvention.StdCall)]
    public static extern bool EP_RegKeyExecutions(ref Int32 Total, ref Int32 Left);
}

See function examples in the installation folder.


EP_RegKeyExecutionsLeft

EP_RegKeyExecutionsLeft function returns the number of executions Left that the registration key is limited to. EP_RegKeyExecutionsLeft extends EP_RegKeyExecutions. See Creating Keys for more details.

Parameters

The function does not have parameters.

Return Value

If the function succeeds, the return value is the number of executions Left. If the function fails, the return value is 0.

Remark

The function fails in the following cases:

  • the registration key is not limited by executions;
  • there is no valid registration key;
  • the executions limit has expired, there are no executions left;
  • the application is not protected.

Definition

Show/Hide C++ function definition

extern "C" __declspec( dllexport ) __stdcall int EP_RegKeyExecutionsLeft();

Show/Hide Delphi function definition

function EP_RegKeyExecutionsLeft : Cardinal;

Show/Hide Visual Basic function definition

Public Declare Function EP_RegKeyExecutionsLeft Lib "enigma_ide.dll" () As Long

Show/Hide C# (.NET) function definition

public class Enigma_IDE
{
    [DllImport("enigma_ide.dll", CallingConvention = CallingConvention.StdCall)]
    public static extern int EP_RegKeyExecutionsLeft();
}

See function examples in the installation folder.


EP_RegKeyExecutionsTotal

EP_RegKeyExecutionsTotal function returns the Total number of executions that the registration key is limited to. EP_RegKeyExecutionsTotal extends EP_RegKeyExecutions. See Creating Keys for more details.

Parameters

The function does not have parameters.

Return Value

If the function succeeds, the return value is the number of Total executions. If the function fails, the return value is 0.

Remark

The function fails in the following cases:

  • the registration key is not limited by executions;
  • there is no valid registration key;
  • the application is not protected.

Definition

Show/Hide C++ function definition

extern "C" __declspec( dllexport ) __stdcall int EP_RegKeyExecutionsTotal();

Show/Hide Delphi function definition

function EP_RegKeyExecutionsTotal : Cardinal;

Show/Hide Visual Basic function definition

Public Declare Function EP_RegKeyExecutionsTotal Lib "enigma_ide.dll" () As Long

Show/Hide C# (.NET) function definition

public class Enigma_IDE
{
    [DllImport("enigma_ide.dll", CallingConvention = CallingConvention.StdCall)]
    public static extern int EP_RegKeyExecutionsTotal();
}

See function examples in the installation folder.


EP_RegKeyDays

EP_RegKeyDays function returns the Total number of days and the number of days Left that the registration key is limited to. See Creating Keys for more details. See also the extended functions EP_RegKeyDaysLeft and EP_RegKeyDaysTotal.

Parameters

  • Total - the total number of days that the registration key is limited to.
  • Left - the number of days left.

Return Value

If the function succeeds, the return value is 1. If the function fails, the return value is 0.

Remark

The function fails in the following cases:

  • the registration key is not limited by days;
  • there is no valid registration key;
  • the application is not protected.

Definition

Show/Hide C++ function definition

extern "C" __declspec( dllimport ) __stdcall BOOL EP_RegKeyDays( int* Total, int* Left );

Show/Hide Delphi function definition

function EP_RegKeyDays( var Total, Left : Cardinal) : boolean; stdcall;

Show/Hide Visual Basic function definition

Public Declare Function EP_RegKeyDays Lib "enigma_ide.dll" (ByRef Total As Long, ByRef Left As Long) As Byte

Show/Hide C# (.NET) function definition

public class Enigma_IDE
{
    [DllImport("enigma_ide.dll", CallingConvention = CallingConvention.StdCall)]
    public static extern bool EP_RegKeyDays(ref Int32 Total, ref Int32 Left);
}

See function examples in the installation folder.


EP_RegKeyDaysLeft

EP_RegKeyDaysLeft function returns the number of days Left that the registration key is limited to. EP_RegKeyDaysLeft extends EP_RegKeyDays. See Creating Keys for more details.

Parameters

The function does not have parameters.

Return Value

If the function succeeds, the return value is the number of days Left. If the function fails, the return value is 0.

Remark

The function fails in the following cases:

  • the registration key is not limited by days;
  • there is no valid registration key;
  • the days limit has expired, there are no days left;
  • the application is not protected.

Definition

Show/Hide C++ function definition

extern "C" __declspec( dllexport ) __stdcall int EP_RegKeyDaysLeft();

Show/Hide Delphi function definition

function EP_RegKeyDaysLeft : Cardinal;

Show/Hide Visual Basic function definition

Public Declare Function EP_RegKeyDaysLeft Lib "enigma_ide.dll" () As Long

Show/Hide C# (.NET) function definition

public class Enigma_IDE
{
    [DllImport("enigma_ide.dll", CallingConvention = CallingConvention.StdCall)]
    public static extern int EP_RegKeyDaysLeft();
}

See function examples in the installation folder.


EP_RegKeyDaysTotal

EP_RegKeyDaysTotal function returns the Total number of days that the registration key is limited to. EP_RegKeyDaysTotal extends EP_RegKeyDays. See Creating Keys for more details.

Parameters

The function does not have parameters.

Return Value

If the function succeeds, the return value is the Total number of days. If the function fails, the return value is 0.

Remark

The function fails in the following cases:

  • the registration key is not limited by days;
  • there is no valid registration key;
  • the application is not protected.

Definition

Show/Hide C++ function definition

extern "C" __declspec( dllexport ) __stdcall int EP_RegKeyDaysTotal();

Show/Hide Delphi function definition

function EP_RegKeyDaysTotal : Cardinal;

Show/Hide Visual Basic function definition

Public Declare Function EP_RegKeyDaysTotal Lib "enigma_ide.dll" () As Long

Show/Hide C# (.NET) function definition

public class Enigma_IDE
{
    [DllImport("enigma_ide.dll", CallingConvention = CallingConvention.StdCall)]
    public static extern int EP_RegKeyDaysTotal();
}

See function examples in the installation folder.


EP_RegKeyRuntime

EP_RegKeyRuntime function returns the Total number of Run-time minutes and the number of Run-time minutes Left that the registration key is limited to. See Creating Keys for more details. See also the extended functions EP_RegKeyRuntimeLeft and EP_RegKeyRuntimeTotal.

Parameters

  • Total - the total number of run-time minutes that the registration key is limited to.
  • Left - the number of run-time minutes left.

Return Value

If the function succeeds, the return value is 1. If the function fails, the return value is 0.

Remark

The function fails in the following cases:

  • the registration key is not limited by run-time;
  • there is no valid registration key;
  • the application is not protected.

Definition

Show/Hide C++ function definition

extern "C" __declspec( dllimport ) __stdcall BOOL EP_RegKeyRuntime( int* Total, int* Left );

Show/Hide Delphi function definition

function EP_RegKeyRuntime( var Total, Left : Cardinal) : boolean; stdcall;

Show/Hide Visual Basic function definition

Public Declare Function EP_RegKeyRuntime Lib "enigma_ide.dll" (ByRef Total As Long, ByRef Left As Long) As Byte

Show/Hide C# (.NET) function definition

public class Enigma_IDE
{
    [DllImport("enigma_ide.dll", CallingConvention = CallingConvention.StdCall)]
    public static extern bool EP_RegKeyRuntime(ref Int32 Total, ref Int32 Left);
}

See function examples in the installation folder.


EP_RegKeyRuntimeLeft

EP_RegKeyRuntimeLeft function returns the number of run-time minutes Left that the registration key is limited to. EP_RegKeyRuntimeLeft extends EP_RegKeyRuntime. See Creating Keys for more detailed information.

Parameters

The function does not have parameters.

Return Value

If the function succeeds, the return value is the number of run-time minutes Left. If the function fails, the return value is 0.

Remark

The function fails in the following cases:

  • the registration key is not limited by the run-time;
  • there is no valid registration key;
  • the run-time limit has expired, there are no run-time minutes left;
  • the application is not protected.

Definition

Show/Hide C++ function definition

extern "C" __declspec( dllexport ) __stdcall int EP_RegKeyRuntimeLeft();

Show/Hide Delphi function definition

function EP_RegKeyRuntimeLeft : Cardinal;

Show/Hide Visual Basic function definition

Public Declare Function EP_RegKeyRuntimeLeft Lib "enigma_ide.dll" () As Long

Show/Hide C# (.NET) function definition

public class Enigma_IDE
{
    [DllImport("enigma_ide.dll", CallingConvention = CallingConvention.StdCall)]
    public static extern int EP_RegKeyRuntimeLeft();
}

See function examples in the installation folder.


EP_RegKeyRuntimeTotal

EP_RegKeyRuntimeTotal function returns the Total number of run-time minutes that the registration key is limited to. EP_RegKeyRuntimeTotal extends EP_RegKeyRuntime. See Creating Keys for extended information.

Parameters

The function does not have parameters.

Return Value

If the function succeeds, the return value is the number of Total run-time minutes. If the function fails, the return value is 0.

Remark

The function fails in the following cases:

  • the registration key is not limited by the run-time;
  • there is no valid registration key;
  • the application is not protected.

Definition

Show/Hide C++ function definition

extern "C" __declspec( dllexport ) __stdcall int EP_RegKeyRuntimeTotal();

Show/Hide Delphi function definition

function EP_RegKeyRuntimeTotal : Cardinal;

Show/Hide Visual Basic function definition

Public Declare Function EP_RegKeyRuntimeTotal Lib "enigma_ide.dll" () As Long

Show/Hide C# (.NET) function definition

public class Enigma_IDE
{
    [DllImport("enigma_ide.dll", CallingConvention = CallingConvention.StdCall)]
    public static extern int EP_RegKeyRuntimeTotal();
}

See function examples in the installation folder.


EP_RegKeyGlobalTime

EP_RegKeyGlobalTime function returns the Total number of Global Time minutes and the number of Global Time minutes Left that the registration key is limited to. See Creating Keys for more details. See also the extended functions EP_RegKeyGlobalTimeLeft and EP_RegKeyGlobalTimeTotal.

Parameters

  • Total - the total number of Global Time minutes that the registration key is limited to.
  • Left - the number of Global Time minutes left.

Return Value

If the function succeeds, the return value is 1. If the function fails, the return value is 0.

Remark

The function fails in the following cases:

  • the registration key is not limited by Global Time;
  • there is no valid registration key;
  • the application is not protected.

Definition

Show/Hide C++ function definition

extern "C" __declspec( dllimport ) __stdcall BOOL EP_RegKeyGlobalTime( int* Total, int* Left );

Show/Hide Delphi function definition

function EP_RegKeyGlobalTime( var Total, Left : Cardinal) : boolean; stdcall;

Show/Hide Visual Basic function definition

Public Declare Function EP_RegKeyGlobalTime Lib "enigma_ide.dll" (ByRef Total As Long, ByRef Left As Long) As Byte

Show/Hide C# (.NET) function definition

public class Enigma_IDE
{
    [DllImport("enigma_ide.dll", CallingConvention = CallingConvention.StdCall)]
    public static extern bool EP_RegKeyGlobalTime(ref Int32 Total, ref Int32 Left);
}

See function examples in the installation folder.


EP_RegKeyGlobalTimeLeft

EP_RegKeyGlobalTimeLeft function returns the number of Global Time minutes Left that the registration key is limited to. EP_RegKeyGlobalTimeLeft extends EP_RegKeyGlobalTime. See Creating Keys for more details.

Parameters

The function does not have parameters.

Return Value

If the function succeeds, the return value is the number of Global Time minutes Left. If the function fails, the return value is 0.

Remark

The function fails in the following cases:

  • the registration key is not limited by Global Time;
  • there is no valid registration key;
  • the Global Time limit has expired, there are no Global Time minutes left;
  • the application is not protected.

Definition

Show/Hide C++ function definition

extern "C" __declspec( dllexport ) __stdcall int EP_RegKeyGlobalTimeLeft();

Show/Hide Delphi function definition

function EP_RegKeyGlobalTimeLeft : Cardinal;

Show/Hide Visual Basic function definition

Public Declare Function EP_RegKeyGlobalTimeLeft Lib "enigma_ide.dll" () As Long

Show/Hide C# (.NET) function definition

public class Enigma_IDE
{
    [DllImport("enigma_ide.dll", CallingConvention = CallingConvention.StdCall)]
    public static extern int EP_RegKeyGlobalTimeLeft();
}

See function examples in the installation folder.


EP_RegKeyGlobalTimeTotal

EP_RegKeyGlobalTimeTotal function returns the Total number of Global Time minutes that the registration key is limited to. EP_RegKeyGlobalTimeTotal extends EP_RegKeyGlobalTime. See Creating Keys for more details.

Parameters

The function does not have parameters.

Return Value

If the function succeeds, the return value is the number of Total Global Time minutes. If the function fails, the return value is 0.

Remark

The function fails in the following cases:

  • the registration key is not limited by Global Time;
  • there is no valid registration key;
  • the application is not protected.

Definition

Show/Hide C++ function definition

extern "C" __declspec( dllexport ) __stdcall int EP_RegKeyGlobalTimeTotal();

Show/Hide Delphi function definition

function EP_RegKeyGlobalTimeTotal : Cardinal;

Show/Hide Visual Basic function definition

Public Declare Function EP_RegKeyGlobalTimeTotal Lib "enigma_ide.dll" () As Long

Show/Hide C# (.NET) function definition

public class Enigma_IDE
{
    [DllImport("enigma_ide.dll", CallingConvention = CallingConvention.StdCall)]
    public static extern int EP_RegKeyGlobalTimeTotal();
}

See function examples in the installation folder.


EP_RegKeyRegisterAfterDate

EP_RegKeyRegisterAfterDate returns the Register After date from the registration key. See Creating Keys for more details. See also the extended function EP_RegKeyRegisterAfterDateEx.

Parameters

  • Year - the year of the key Register After date.
  • Month - the month of the key Register After date.
  • Day - the day of the key Register After date.

Return Value

If the function succeeds, the return value is 1. If the function fails, the return value is 0.

Remark

The function fails in the following cases:

  • the registration key does not contain the Register After date;
  • there is no valid registration key;
  • the application is not protected.

Definition

Show/Hide C++ function definition

extern "C" __declspec( dllimport ) __stdcall BOOL EP_RegKeyRegisterAfterDate( int* Year, int* Month, int* Day );

Show/Hide Delphi function definition

function EP_RegKeyRegisterAfterDate( var Year, Month, Day : Cardinal) : boolean; stdcall;

Show/Hide Visual Basic function definition

Public Declare Function EP_RegKeyRegisterAfterDate Lib "enigma_ide.dll" (ByRef Year As Long, ByRef Month As Long, ByRef Day As Long) As Byte

Show/Hide C# (.NET) function definition

public class Enigma_IDE
{
    [DllImport("enigma_ide.dll", CallingConvention = CallingConvention.StdCall)]
    public static extern bool EP_RegKeyRegisterAfterDate(ref Int32 Year, ref Int32 Month, ref Int32 Day);
}

See function examples in the installation folder.


EP_RegKeyRegisterAfterDateEx

EP_RegKeyRegisterAfterDateEx returns the Register After date from the registration key. See Creating Keys for more details.

Parameters

The function does not have parameters.

Return Value

If the function succeeds, the return value is a 32-bit unsigned integer value that represents the Date value. The high byte of the high word contains a day value, the low byte of the high word contains a month value, the low word contains a year value. For example, the returned value 0x10012010 ($10012010) means the 10 January 2010 date. If the function fails, the return value is 0.

Remark

The function fails in the following cases:

  • the registration key does not contain the Register After date;
  • there is no valid registration key;
  • the application is not protected.

Definition

Show/Hide C++ function definition

extern "C" __declspec( dllexport ) __stdcall int EP_RegKeyRegisterAfterDateEx();

Show/Hide Delphi function definition

function EP_RegKeyRegisterAfterDateEx : Cardinal;

Show/Hide Visual Basic function definition

Public Declare Function EP_RegKeyRegisterAfterDateEx Lib "enigma_ide.dll" () As Long

Show/Hide C# (.NET) function definition

public class Enigma_IDE
{
    [DllImport("enigma_ide.dll", CallingConvention = CallingConvention.StdCall)]
    public static extern int EP_RegKeyRegisterAfterDateEx();
}

See function examples in the installation folder.


EP_RegKeyRegisterBeforeDate

EP_RegKeyRegisterBeforeDate returns the Register Before date from the registration key. See Creating Keys for more details. See also the extended function EP_RegKeyRegisterBeforeDateEx.

Parameters

  • Year - the year of the key Register After date.
  • Month - the month of the key Register After date.
  • Day - the day of the key Register After date.

Return Value

If the function succeeds, the return value is 1. If the function fails, the return value is 0.

Remark

The function fails in the following cases:

  • the registration key does not contain the Register Before date;
  • there is no valid registration key;
  • the application is not protected.

Definition

Show/Hide C++ function definition

extern "C" __declspec( dllimport ) __stdcall BOOL EP_RegKeyRegisterBeforeDate( int* Year, int* Month, int* Day );

Show/Hide Delphi function definition

function EP_RegKeyRegisterBeforeDate( var Year, Month, Day : Cardinal) : boolean; stdcall;

Show/Hide Visual Basic function definition

Public Declare Function EP_RegKeyRegisterBeforeDate Lib "enigma_ide.dll" (ByRef Year As Long, ByRef Month As Long, ByRef Day As Long) As Byte

Show/Hide C# (.NET) function definition

public class Enigma_IDE
{
    [DllImport("enigma_ide.dll", CallingConvention = CallingConvention.StdCall)]
    public static extern bool EP_RegKeyRegisterBeforeDate(ref Int32 Year, ref Int32 Month, ref Int32 Day);
}

See function examples in the installation folder.


EP_RegKeyRegisterBeforeDateEx

EP_RegKeyRegisterBeforeDateEx returns the Register Before date from the registration key. See Creating Keys for more details.

Parameters

The function does not have parameters.

Return Value

If the function succeeds, the return value is a 32-bit unsigned integer value that represents the Date value. The high byte of the high word contains a day value, the low byte of the high word contains a month value, the low word contains a year value. For example, the returned value 0x10012010 ($10012010) means the 10 January 2010 date. If the function fails, the return value is 0.

Remark

The function fails in the following cases:

  • the registration key does not contain the Register Before date;
  • there is no valid registration key;
  • the application is not protected.

Definition

Show/Hide C++ function definition

extern "C" __declspec( dllexport ) __stdcall int EP_RegKeyRegisterBeforeDateEx();

Show/Hide Delphi function definition

function EP_RegKeyRegisterBeforeDateEx : Cardinal;

Show/Hide Visual Basic function definition

Public Declare Function EP_RegKeyRegisterBeforeDateEx Lib "enigma_ide.dll" () As Long

Show/Hide C# (.NET) function definition

public class Enigma_IDE
{
    [DllImport("enigma_ide.dll", CallingConvention = CallingConvention.StdCall)]
    public static extern int EP_RegKeyRegisterBeforeDateEx();
}

See function examples in the installation folder.


EP_RegKeyStatus

EP_RegKeyStatus returns the error status of registration information after the key verification routine. It should be called after any function that verifies registration information, for example, after EP_RegCheckKey or EP_RegLoadAndCheckKey.

Parameters

The function does not have parameters.

Return Value

The function returns one of the following values:
Value | Description
KEY_STATUS_DOESNOTEXIST = 0; | Registration information was not found
KEY_STATUS_VALID = 1; | Registration information is valid
KEY_STATUS_INVALID = 2; | Registration information is invalid
KEY_STATUS_STOLEN = 3; | The registration key is marked as Stolen. See License Manager - Edit License
KEY_STATUS_DATEEXPIRED = 4; | The registration key contains the Expiration date that has expired
KEY_STATUS_WITHOUTHARDWARELOCK = 5; | The registration key is not locked to hardware ID, but the application requires only hardware locked registration keys. See Key Properties
KEY_STATUS_WITHOUTEXPIRATIONDATE = 6; | The registration key does not contain the expiration date, but the application requires only registration keys with the expiration date. See Key Properties
KEY_STATUS_WITHOUTREGISTERAFTERDATE = 7; | The registration key does not contain the register after date, but the application requires only registration keys with the register after date. See Key Properties
KEY_STATUS_WITHOUTREGISTERBEFOREDATE = 8; | The registration key does not contain the register before date, but the application requires only registration keys with the register before date. See Key Properties
KEY_STATUS_WITHOUTEXECUTIONSLIMIT = 9; | The registration key does not contain the executions limit, but the application requires only registration keys with the executions limit. See Key Properties
KEY_STATUS_WITHOUTDAYSLIMIT = 10; | The registration key does not contain the days limit, but the application requires only registration keys with the days limit. See Key Properties
KEY_STATUS_WITHOUTRUNTIMELIMIT = 11; | The registration key does not contain the run-time limit, but the application requires only registration keys with the run-time limit. See Key Properties
KEY_STATUS_WITHOUTGLOBALTIMELIMIT = 12; | The registration key does not contain the global time limit, but the application requires only registration keys with the global time limit. See Key Properties
KEY_STATUS_WITHOUTCOUNTRYLOCK = 13; | The registration key does not contain the country lock, but the application requires only registration keys with the country lock. See Key Properties
KEY_STATUS_COUNTRYINVALID = 14; | The registration key is locked to the country that does not match the user's country
KEY_STATUS_REGISTERAFTERFAILED = 15; | The registration key contains Register After date that has expired
KEY_STATUS_REGISTERBEFOREFAILED = 16; | The registration key contains Register Before date that has expired
KEY_STATUS_EXECUTIONSEXPIRED = 17; | The registration key contains Executions limit that has expired
KEY_STATUS_DAYSEXPIRED = 18; | The registration key contains Days limit that has expired
KEY_STATUS_RUNTIMEEXPIRED = 19; | The registration key contains Run-time limit that has expired
KEY_STATUS_GLOBALTIMEEXPIRED = 20; | The registration key contains Global Time limit that has expired
KEY_STATUS_HARDWARECHANGESEXCEEDED_VOLUMESERIAL = 21; | The registration key is locked to System Volume Serial hardware ID that was changed, but the program does not allow changes of this hardware ID. See Hardware Lock
KEY_STATUS_HARDWARECHANGESEXCEEDED_VOLUMENAME = 22; | The registration key is locked to System Volume Name hardware ID that was changed, but the program does not allow changes of this hardware ID. See Hardware Lock
KEY_STATUS_HARDWARECHANGESEXCEEDED_COMPUTERNAME = 23; | The registration key is locked to Computer Name hardware ID that was changed, but the program does not allow changes of this hardware ID. See Hardware Lock
KEY_STATUS_HARDWARECHANGESEXCEEDED_CPU = 24; | The registration key is locked to CPU Type hardware ID that was changed, but the program does not allow changes of this hardware ID. See Hardware Lock
KEY_STATUS_HARDWARECHANGESEXCEEDED_MOTHERBOARD = 25; | The registration key is locked to Motherboard hardware ID that was changed, but the program does not allow changes of this hardware ID. See Hardware Lock
KEY_STATUS_HARDWARECHANGESEXCEEDED_WINDOWSKEY = 26; | The registration key is locked to Windows Serial Key hardware ID that was changed, but the program does not allow changes of this hardware ID. See Hardware Lock
KEY_STATUS_HARDWARECHANGESEXCEEDED_HDDSERIAL = 27; | The registration key is locked to Hard Disk Serial Number hardware ID that was changed, but the program does not allow changes of this hardware ID. See Hardware Lock
KEY_STATUS_HARDWARECHANGESEXCEEDED_USERNAME = 28; | The registration key is locked to Windows User Name hardware ID that was changed, but the program does not allow changes of this hardware ID. See Hardware Lock

Remark

An unprotected application will always return KEY_STATUS_DOESNOTEXIST.

Definition

Show/Hide C++ function definition

extern "C" __declspec( dllexport ) __stdcall int EP_RegKeyStatus();

Show/Hide Delphi function definition

function EP_RegKeyStatus : Cardinal;

Show/Hide Visual Basic function definition

Public Declare Function EP_RegKeyStatus Lib "enigma_ide.dll" () As Long

Show/Hide C# (.NET) function definition

public class Enigma_IDE
{
    [DllImport("enigma_ide.dll", CallingConvention = CallingConvention.StdCall)]
    public static extern int EP_RegKeyStatus();
}

See function examples in the installation folder, Examples subfolder.


EP_RegKeyInformation

EP_RegKeyInformation extracts internal information from the registration key. Please note, this function cannot be used to verify registration, this function just extracts information from a particular pair of registration name and key. To verify the program registration, the functions like EP_RegCheckKey, EP_RegLoadAndCheckKey and EP_RegCheckAndSaveKey should be used.

Parameters

  • AName - the registration name - a pointer to the null terminated ANSI string;
  • AKey - the registration key - a pointer to the null terminated ANSI string;
  • AKeyInfo - TKeyInformation - a pointer to the TKeyInformation structure.

TKeyInformation contains the following members:

  • Stolen - indicates if the registration key is stolen. See License Manager - Edit License
  • CreationYear - the key creation year
  • CreationMonth - the key creation month
  • CreationDay - the key creation day
  • UseKeyExpiration - indicates if the registration key contains the expiration date
  • ExpirationYear - the key expiration year
  • ExpirationMonth - the key expiration month
  • ExpirationDay - the key expiration day
  • UseHardwareLocking - indicates if the registration key is hardware locked
  • UseExecutionsLimit - shows if the registration key contains the executions limit
  • ExecutionsCount - the number of executions
  • UseDaysLimit - shows if the registration key contains the days limit
  • DaysCount - the number of days
  • UseRunTimeLimit - shows if the registration key contains the run-time limit
  • RunTimeMinutes - the number of run-time minutes
  • UseGlobalTimeLimit - shows if the registration key contains the Global Time limit
  • GlobalTimeMinutes - the number of Global Time minutes
  • UseCountyLimit - shows if the registration key contains the country lock
  • CountryCode - the country code
  • UseRegisterAfter - shows if the registration key contains the register after date
  • RegisterAfterYear - the year of the register after date
  • RegisterAfterMonth - the month of the register after date
  • RegisterAfterDay - the day of the register after date
  • UseRegisterBefore - shows if the registration key contains the register before date
  • RegisterBeforeYear - the year of the register before date
  • RegisterBeforeMonth - the month of the register before date
  • RegisterBeforeDay - the month of the register before date
  • EncryptedSections - a 16-value array of encrypted sections that the registration key decrypts

Return Value

If the function fails, the return value is 0. If the function succeeds, the return value is not zero and the TKeyInformation structure contains the information extracted from the passed registration key.

Remark

The function fails in the following cases:

  • the registration information is incorrect;
  • the application is not protected.

Definition

Show/Hide C++ function definition

typedef struct TKeyInformation {
        BOOL Stolen;               // {out} is key stolen
        DWORD CreationYear;        // {out} key creation year
        DWORD CreationMonth;       // {out} key creation month
        DWORD CreationDay;         // {out} key creation day
        BOOL UseKeyExpiration;     // {out} has key expiration date?
        DWORD ExpirationYear;      // {out} key expiration year
        DWORD ExpirationMonth;     // {out} key expiration month
        DWORD ExpirationDay;       // {out} key expiration day
        BOOL UseHardwareLocking;   // {out} hardware locked key
        BOOL UseExecutionsLimit;   // {out} limit key by executions?
        DWORD ExecutionsCount;     // {out} number of executions
        BOOL UseDaysLimit;         // {out} limit key by days?
        DWORD DaysCount;           // {out} number of days
        BOOL UseRunTimeLimit;      // {out} limit key by run time?
        DWORD RunTimeMinutes;      // {out} run time minutes
        BOOL UseGlobalTimeLimit;   // {out} limit key by global time?
        DWORD GlobalTimeMinutes;   // {out} global time minutes
        BOOL UseCountyLimit;       // {out} limit key by country?
        DWORD CountryCode;         // {out} country code
        BOOL UseRegisterAfter;     // {out} register key after date?
        DWORD RegisterAfterYear;   // {out} register after year
        DWORD RegisterAfterMonth;  // {out} register after month
        DWORD RegisterAfterDay;    // {out} register after day
        BOOL UseRegisterBefore;    // {out} register key before date?
        DWORD RegisterBeforeYear;  // {out} register before year
        DWORD RegisterBeforeMonth; // {out} register before month
        DWORD RegisterBeforeDay;   // {out} register before day
        BOOL EncryptedSections[NUMBER_OF_CRYPTED_SECTIONS]; // {out} Crypted sections
} TKeyInformation, *PKeyInformation;

extern "C" __declspec( dllexport ) __stdcall BOOL EP_RegKeyInformation(char* AName, char* AKey, PKeyInformation AKeyInfo);

Show/Hide Delphi function definition

TKeyInformation = record
  Stolen              : LongBool; // {out} is key stolen?
  CreationYear        : integer;  // {out} key creation year
  CreationMonth       : integer;  // {out} key creation month
  CreationDay         : integer;  // {out} key creation day
  UseKeyExpiration    : LongBool; // {out} has key expiration date?
  ExpirationYear      : integer;  // {out} key expiration year
  ExpirationMonth     : integer;  // {out} key expiration month
  ExpirationDay       : integer;  // {out} key expiration day
  UseHardwareLocking  : LongBool; // {out} hardware locked key
  UseExecutionsLimit  : LongBool; // {out} limit key by executions?
  ExecutionsCount     : integer;  // {out} number of executions
  UseDaysLimit        : LongBool; // {out} limit key by days?
  DaysCount           : integer;  // {out} number of days
  UseRunTimeLimit     : LongBool; // {out} limit key by run time?
  RunTimeMinutes      : integer;  // {out} run time minutes
  UseGlobalTimeLimit  : LongBool; // {out} limit key by global time?
  GlobalTimeMinutes   : integer;  // {out} global time minutes
  UseCountyLimit      : LongBool; // {out} limit key by country?
  CountryCode         : integer;  // {out} country code
  UseRegisterAfter    : LongBool; // {out} register key after date?
  RegisterAfterYear   : integer;  // {out} register after year
  RegisterAfterMonth  : integer;  // {out} register after month
  RegisterAfterDay    : integer;  // {out} register after day
  UseRegisterBefore   : LongBool; // {out} register key before date?
  RegisterBeforeYear  : integer;  // {out} register before year
  RegisterBeforeMonth : integer;  // {out} register before month
  RegisterBeforeDay   : integer;  // {out} register before day
  EncryptedSections   : array [1..NUMBER_OF_CRYPTED_SECTIONS] of LongBool; // {out} Crypted sections
end;
PKeyInformation = ^TKeyInformation;

function EP_RegKeyInformation(AName, AKey : PAnsiChar; var AKeyInfo : TKeyInformation) : boolean; stdcall;

Show/Hide Visual Basic function definition

' LongBool is using for correct data alignment
Public Type TKeyInformation
    Stolen As Boolean ' {out} is key stolen?
    CreationYear As Long ' {out} key creation year
    CreationMonth As Long ' {out} key creation month
    CreationDay As Long ' {out} key creation day
    UseKeyExpiration As Boolean ' {out} has key expiration date?
    ExpirationYear As Long ' {out} key expiration year
    ExpirationMonth As Long ' {out} key expiration month
    ExpirationDay As Long ' {out} key expiration day
    UseHardwareLocking As Boolean ' {out} hardware locked key
    UseExecutionsLimit As Boolean ' {out} limit key by executions?
    ExecutionsCount As Long ' {out} number of executions
    UseDaysLimit As Boolean ' {out} limit key by days?
    DaysCount As Long ' {out} number of days
    UseRunTimeLimit As Boolean ' {out} limit key by run time?
    RunTimeMinutes As Long ' {out} run time minutes
    UseGlobalTimeLimit As Boolean ' {out} limit key by global time?
    GlobalTimeMinutes As Long ' {out} global time minutes
    UseCountyLimit As Boolean ' {out} limit key by country?
    CountryCode As Long ' {out} country code
    UseRegisterAfter As Boolean ' {out} register key after date?
    RegisterAfterYear As Long ' {out} register after year
    RegisterAfterMonth As Long ' {out} register after month
    RegisterAfterDay As Long ' {out} register after day
    UseRegisterBefore As Boolean ' {out} register key before date?
    RegisterBeforeYear As Long ' {out} register before year
    RegisterBeforeMonth As Long ' {out} register before month
    RegisterBeforeDay As Long ' {out} register before day
    EncryptedSections(NUMBER_OF_CRYPTED_SECTIONS - 1) As Boolean ' {out} Crypted sections
End Type

Public Declare Function EP_RegKeyInformation Lib "enigma_ide.dll" (ByRef AName As String, ByRef AKey As String, ByRef AKeyInfo As TKeyInformation) As Boolean

Show/Hide C# (.NET) function definition

public class Enigma_IDE
{
    public struct TKeyInformation
    {
        public bool Stolen;               // {out} is key stolen
        public Int32 CreationYear;        // {out} key creation year
        public Int32 CreationMonth;       // {out} key creation month
        public Int32 CreationDay;         // {out} key creation day
        public bool UseKeyExpiration;     // {out} has key expiration date?
        public Int32 ExpirationYear;      // {out} key expiration year
        public Int32 ExpirationMonth;     // {out} key expiration month
        public Int32 ExpirationDay;       // {out} key expiration day
        public bool UseHardwareLocking;   // {out} hardware locked key
        public bool UseExecutionsLimit;   // {out} limit key by executions?
        public Int32 ExecutionsCount;     // {out} number of executions
        public bool UseDaysLimit;         // {out} limit key by days?
        public Int32 DaysCount;           // {out} number of days
        public bool UseRunTimeLimit;      // {out} limit key by run time?
        public Int32 RunTimeMinutes;      // {out} run time minutes
        public bool UseGlobalTimeLimit;   // {out} limit key by global time?
        public Int32 GlobalTimeMinutes;   // {out} global time minutes
        public bool UseCountyLimit;       // {out} limit key by country?
        public Int32 CountryCode;         // {out} country code
        public bool UseRegisterAfter;     // {out} register key after date?
        public Int32 RegisterAfterYear;   // {out} register after year
        public Int32 RegisterAfterMonth;  // {out} register after month
        public Int32 RegisterAfterDay;    // {out} register after day
        public bool UseRegisterBefore;    // {out} register key before date?
        public Int32 RegisterBeforeYear;  // {out} register before year
        public Int32 RegisterBeforeMonth; // {out} register before month
        public Int32 RegisterBeforeDay;   // {out} register before day
        [MarshalAs(UnmanagedType.ByValArray, SizeConst = NUMBER_OF_CRYPTED_SECTIONS)]
        public bool[] EncryptedSections; // {out} Crypted sections
    }

    [DllImport("enigma_ide.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
    public static extern bool EP_RegKeyInformation(string AName, string AKey, ref TKeyInformation AKeyInfo);
}

Examples

Show/Hide Delphi function example

uses
  enigma_ide; // the module contains a definitions of Enigma API

procedure TForm1.Button2Click(Sender: TObject);
var
  ki : TKeyInformation;
  res : string;
  i : integer;
begin
  if EP_RegKeyInformation(PAnsiChar(eName.Text), PAnsiChar(mKey.Text), ki) then
  begin
    res := format(#13#10'Creation date: %s', [DateToStr(EncodeDate(ki.CreationYear, ki.CreationMonth, ki.CreationDay))]);
    if ki.UseKeyExpiration then
    begin
      res := res + format(#13#10'Expiration date: %s', [DateToStr(EncodeDate(ki.ExpirationYear, ki.ExpirationMonth, ki.ExpirationDay))]);
    end;
    if ki.UseHardwareLocking then
    begin
      res := res + #13#10'Key is Hardware Locked';
    end;
    if ki.UseExecutionsLimit then
    begin
      res := res + format(#13#10'Executions number: %d', [ki.ExecutionsCount]);
    end;
    if ki.UseDaysLimit then
    begin
      res := res + format(#13#10'Days number: %d', [ki.DaysCount]);
    end;
    if ki.UseRunTimeLimit then
    begin
      res := res + format(#13#10'Run-time minutes: %d', [ki.RunTimeMinutes]);
    end;
    if ki.UseGlobalTimeLimit then
    begin
      res := res + format(#13#10'Global time minutes: %d', [ki.GlobalTimeMinutes]);
    end;
    if ki.UseCountyLimit then
    begin
      for i := 0 to length(KEY_COUNTRIES) - 1 do
      begin
        if KEY_COUNTRIES[i].Code = ki.CountryCode then
        begin
          res := res + format(#13#10'Country lock: %s', [KEY_COUNTRIES[i].Name]);
          break;
        end;
      end;
    end;
    if ki.UseRegisterAfter then
    begin
      res := res + format(#13#10'Register After date: %s', [DateToStr(EncodeDate(ki.RegisterAfterYear, ki.RegisterAfterMonth, ki.RegisterAfterDay))]);
    end;
    if ki.UseRegisterBefore then
    begin
      res := res + format(#13#10'Register Before date: %s', [DateToStr(EncodeDate(ki.RegisterBeforeYear, ki.RegisterBeforeMonth, ki.RegisterBeforeDay))]);
    end;
    for i := 1 to length(ki.EncryptedSections) do
    begin
      if ki.EncryptedSections[i] then
      begin
        res := res + format(#13#10'Decrypts section #%d', [i]);
      end;
    end;
    MessageDlg('Registration Information is valid and contains the following information:' + res, mtInformation, [mbOK], 0);
  end else
    MessageDlg('Registration Information is invalid', mtError, [mbOK], 0);
end;

Show/Hide C++ function example

#include "include/enigma_api.h" // the module contains a definitions of Enigma API
#pragma link "include/enigma_ide.lib"

void __fastcall TForm1::Button2Click(TObject *Sender)
{
        TKeyInformation ki;
        memset(&ki, 0, sizeof(ki));

        if (EP_RegKeyInformation(eName->Text.c_str(), mKey->Text.c_str(), &ki))
        {
                AnsiString res = Format("\nCreation date: %d.%d.%d", ARRAYOFCONST(((int)ki.CreationYear, (int)ki.CreationMonth, (int)ki.CreationDay)));
                if (ki.UseKeyExpiration)
                {
                        res += Format("\nExpiration date: %d.%d.%d", ARRAYOFCONST(((int)ki.ExpirationYear, (int)ki.ExpirationMonth, (int)ki.ExpirationDay)));
                }
                if (ki.UseHardwareLocking)
                {
                        res += "\nKey is Hardware Locked";
                }
                if (ki.UseExecutionsLimit)
                {
                        res += Format("\nExecutions number: %d", ARRAYOFCONST(((int)ki.ExecutionsCount)));
                }
                if (ki.UseDaysLimit)
                {
                        res += Format("\nDays number: %d", ARRAYOFCONST(((int)ki.DaysCount)));
                }
                if (ki.UseRunTimeLimit)
                {
                        res += Format("\nRun-time minutes: %d", ARRAYOFCONST(((int)ki.RunTimeMinutes)));
                }
                if (ki.UseGlobalTimeLimit)
                {
                        res += Format("\nGlobal time minutes: %d", ARRAYOFCONST(((int)ki.GlobalTimeMinutes)));
                }
                if (ki.UseCountyLimit)
                {
                        for (int i = 0; i <= 112; i++)
                        {
                                if (ki.CountryCode == KEY_COUNTRIES[i].Code)
                                {
                                        res += Format("\nCountry Lock: %s", ARRAYOFCONST((KEY_COUNTRIES[i].Name)));
                                        break;
                                }
                        }
                }
                if (ki.UseRegisterAfter)
                {
                        res += Format("\nRegister After date: %d.%d.%d", ARRAYOFCONST(((int)ki.RegisterAfterYear, (int)ki.RegisterAfterMonth, (int)ki.RegisterAfterDay)));
                }
                if (ki.UseRegisterBefore)
                {
                        res += Format("\nRegister Before date: %d.%d.%d", ARRAYOFCONST(((int)ki.RegisterBeforeYear, (int)ki.RegisterBeforeMonth, (int)ki.RegisterBeforeDay)));
                }
                for (int i = 0; i < NUMBER_OF_CRYPTED_SECTIONS; i++)
                {
                        if (ki.EncryptedSections[i])
                        {
                                res += Format("\nlocked section #%d", ARRAYOFCONST((i + 1)));
                        }
                }
                MessageDlg("Registration Information is valid and contains the following information:" + res, mtInformation, TMsgDlgButtons() << mbOK, 0);
        } else
        {
                MessageDlg("Registration Information is invalid", mtError, TMsgDlgButtons() << mbOK, 0);
        }
}

Show/Hide C# (.NET) function example

        private void button2_Click(object sender, EventArgs e)
        {
            Enigma_IDE.TKeyInformation ki = new Enigma_IDE.TKeyInformation();
            if (Enigma_IDE.EP_RegKeyInformation(tbName.Text, tbKey.Text, ref ki))
            {
                string res = string.Format("\rCreation date: {0}", (new DateTime(ki.CreationYear, ki.CreationMonth, ki.CreationDay)).ToLongDateString());
                if (ki.UseKeyExpiration)
                {
                    res += string.Format("\rExpiration date: {0}", (new DateTime(ki.ExpirationYear, ki.ExpirationMonth, ki.ExpirationDay)).ToLongDateString());
                }
                if (ki.UseHardwareLocking)
                {
                    res += "\rKey is Hardware Locked";
                }
                if (ki.UseExecutionsLimit)
                {
                    res += string.Format("\rExecutions number: {0}", ki.ExecutionsCount);
                }
                if (ki.UseDaysLimit)
                {
                    res += string.Format("\rDays number: {0}", ki.DaysCount);
                }
                if (ki.UseRunTimeLimit)
                {
                    res += string.Format("\rRun-time minutes: {0}", ki.RunTimeMinutes);
                }
                if (ki.UseGlobalTimeLimit)
                {
                    res += string.Format("\rGlobal time minutes: {0}", ki.GlobalTimeMinutes);
                }
                if (ki.UseCountyLimit)
                {
                    foreach (Enigma_IDE.TKeyCountries kc in Enigma_IDE.KEY_COUNTRIES)
                    {
                        if (kc.Code == ki.CountryCode)
                        {
                            res += string.Format("\rCountry lock: {0}", kc.Name);
                            break;
                        }
                    }
                }

                if (ki.UseRegisterAfter)
                {
                    res += string.Format("\rRegister After date: {0}", (new DateTime(ki.RegisterAfterYear, ki.RegisterAfterMonth, ki.RegisterAfterDay)).ToLongDateString());
                }
                if (ki.UseRegisterBefore)
                {
                    res += string.Format("\rRegister Before date: {0}", (new DateTime(ki.RegisterBeforeYear, ki.RegisterBeforeMonth, ki.RegisterBeforeDay)).ToLongDateString());
                }
                for (int i = 0; i < ki.EncryptedSections.Length; i++)
                {
                    if (ki.EncryptedSections[i])
                    {
                        res += string.Format("\rDecrypts section #{0}", i + 1);
                    }
                }
                MessageBox.Show("Registration Information is valid and contains the following information:" + res);
            } else
            {
                MessageBox.Show("Registration Information is invalid");
            }
        }

See function examples in the installation folder, Examples\KeyInformation subfolder.


EP_RegKeyInformationA

EP_RegKeyInformationA extracts internal information from the registration key. Please note, this function cannot be used to verify registration, this function just extracts information from a particular pair of registration name and key. To verify the program registration, the functions like EP_RegCheckKey, EP_RegLoadAndCheckKey and EP_RegCheckAndSaveKey should be used.

Parameters

  • AName - the registration name - a pointer to the null terminated ANSI string;
  • AKey - the registration key - a pointer to the null terminated ANSI string;
  • AKeyInfo - TKeyInformation - a pointer to the TKeyInformation structure.

TKeyInformation contains the following members:

  • Stolen - indicates if the registration key is stolen. See License Manager - Edit License
  • CreationYear - the key creation year
  • CreationMonth - the key creation month
  • CreationDay - the key creation day
  • UseKeyExpiration - indicates if the registration key contains the expiration date
  • ExpirationYear - the key expiration year
  • ExpirationMonth - the key expiration month
  • ExpirationDay - the key expiration day
  • UseHardwareLocking - indicates if the registration key is hardware locked
  • UseExecutionsLimit - shows if the registration key contains the executions limit
  • ExecutionsCount - the number of executions
  • UseDaysLimit - shows if the registration key contains the days limit
  • DaysCount - the number of days
  • UseRunTimeLimit - shows if the registration key contains the run-time limit
  • RunTimeMinutes - the number of run-time minutes
  • UseGlobalTimeLimit - shows if the registration key contains the Global Time limit
  • GlobalTimeMinutes - the number of Global Time minutes
  • UseCountyLimit - shows if the registration key contains the country lock
  • CountryCode - the country code
  • UseRegisterAfter - shows if the registration key contains the register after date
  • RegisterAfterYear - the year of the register after date
  • RegisterAfterMonth - the month of the register after date
  • RegisterAfterDay - the day of the register after date
  • UseRegisterBefore - shows if the registration key contains the register before date
  • RegisterBeforeYear - the year of the register before date
  • RegisterBeforeMonth - the month of the register before date
  • RegisterBeforeDay - the month of the register before date
  • EncryptedSections - a 16-value array of encrypted sections that the registration key decrypts

Return Value

If the function fails, the return value is 0. If the function succeeds, the return value is not zero and the TKeyInformation structure contains information extracted from the passed registration key.

Remark

The function fails in the following cases:

  • the registration information is incorrect;
  • the application is not protected.

Definition

Show/Hide C++ function definition

typedef struct TKeyInformation {
        BOOL Stolen;               // {out} is key stolen
        DWORD CreationYear;        // {out} key creation year
        DWORD CreationMonth;       // {out} key creation month
        DWORD CreationDay;         // {out} key creation day
        BOOL UseKeyExpiration;     // {out} has key expiration date?
        DWORD ExpirationYear;      // {out} key expiration year
        DWORD ExpirationMonth;     // {out} key expiration month
        DWORD ExpirationDay;       // {out} key expiration day
        BOOL UseHardwareLocking;   // {out} hardware locked key
        BOOL UseExecutionsLimit;   // {out} limit key by executions?
        DWORD ExecutionsCount;     // {out} number of executions
        BOOL UseDaysLimit;         // {out} limit key by days?
        DWORD DaysCount;           // {out} number of days
        BOOL UseRunTimeLimit;      // {out} limit key by run time?
        DWORD RunTimeMinutes;      // {out} run time minutes
        BOOL UseGlobalTimeLimit;   // {out} limit key by global time?
        DWORD GlobalTimeMinutes;   // {out} global time minutes
        BOOL UseCountyLimit;       // {out} limit key by country?
        DWORD CountryCode;         // {out} country code
        BOOL UseRegisterAfter;     // {out} register key after date?
        DWORD RegisterAfterYear;   // {out} register after year
        DWORD RegisterAfterMonth;  // {out} register after month
        DWORD RegisterAfterDay;    // {out} register after day
        BOOL UseRegisterBefore;    // {out} register key before date?
        DWORD RegisterBeforeYear;  // {out} register before year
        DWORD RegisterBeforeMonth; // {out} register before month
        DWORD RegisterBeforeDay;   // {out} register before day
        BOOL EncryptedSections[NUMBER_OF_CRYPTED_SECTIONS]; // {out} Crypted sections
} TKeyInformation, *PKeyInformation;

extern "C" __declspec( dllexport ) __stdcall BOOL EP_RegKeyInformationA(char* AName, char* AKey, PKeyInformation AKeyInfo);

Show/Hide Delphi function definition

TKeyInformation = record
  Stolen              : LongBool; // {out} is key stolen?
  CreationYear        : integer;  // {out} key creation year
  CreationMonth       : integer;  // {out} key creation month
  CreationDay         : integer;  // {out} key creation day
  UseKeyExpiration    : LongBool; // {out} has key expiration date?
  ExpirationYear      : integer;  // {out} key expiration year
  ExpirationMonth     : integer;  // {out} key expiration month
  ExpirationDay       : integer;  // {out} key expiration day
  UseHardwareLocking  : LongBool; // {out} hardware locked key
  UseExecutionsLimit  : LongBool; // {out} limit key by executions?
  ExecutionsCount     : integer;  // {out} number of executions
  UseDaysLimit        : LongBool; // {out} limit key by days?
  DaysCount           : integer;  // {out} number of days
  UseRunTimeLimit     : LongBool; // {out} limit key by run time?
  RunTimeMinutes      : integer;  // {out} run time minutes
  UseGlobalTimeLimit  : LongBool; // {out} limit key by global time?
  GlobalTimeMinutes   : integer;  // {out} global time minutes
  UseCountyLimit      : LongBool; // {out} limit key by country?
  CountryCode         : integer;  // {out} country code
  UseRegisterAfter    : LongBool; // {out} register key after date?
  RegisterAfterYear   : integer;  // {out} register after year
  RegisterAfterMonth  : integer;  // {out} register after month
  RegisterAfterDay    : integer;  // {out} register after day
  UseRegisterBefore   : LongBool; // {out} register key before date?
  RegisterBeforeYear  : integer;  // {out} register before year
  RegisterBeforeMonth : integer;  // {out} register before month
  RegisterBeforeDay   : integer;  // {out} register before day
  EncryptedSections   : array [1..NUMBER_OF_CRYPTED_SECTIONS] of LongBool; // {out} Crypted sections
end;
PKeyInformation = ^TKeyInformation;

function EP_RegKeyInformationA(AName, AKey : PAnsiChar; var AKeyInfo : TKeyInformation) : boolean; stdcall;

Show/Hide C# (.NET) function definition

public class Enigma_IDE
{
    public struct TKeyInformation
    {
        public bool Stolen;               // {out} is key stolen
        public Int32 CreationYear;        // {out} key creation year
        public Int32 CreationMonth;       // {out} key creation month
        public Int32 CreationDay;         // {out} key creation day
        public bool UseKeyExpiration;     // {out} has key expiration date?
        public Int32 ExpirationYear;      // {out} key expiration year
        public Int32 ExpirationMonth;     // {out} key expiration month
        public Int32 ExpirationDay;       // {out} key expiration day
        public bool UseHardwareLocking;   // {out} hardware locked key
        public bool UseExecutionsLimit;   // {out} limit key by executions?
        public Int32 ExecutionsCount;     // {out} number of executions
        public bool UseDaysLimit;         // {out} limit key by days?
        public Int32 DaysCount;           // {out} number of days
        public bool UseRunTimeLimit;      // {out} limit key by run time?
        public Int32 RunTimeMinutes;      // {out} run time minutes
        public bool UseGlobalTimeLimit;   // {out} limit key by global time?
        public Int32 GlobalTimeMinutes;   // {out} global time minutes
        public bool UseCountyLimit;       // {out} limit key by country?
        public Int32 CountryCode;         // {out} country code
        public bool UseRegisterAfter;     // {out} register key after date?
        public Int32 RegisterAfterYear;   // {out} register after year
        public Int32 RegisterAfterMonth;  // {out} register after month
        public Int32 RegisterAfterDay;    // {out} register after day
        public bool UseRegisterBefore;    // {out} register key before date?
        public Int32 RegisterBeforeYear;  // {out} register before year
        public Int32 RegisterBeforeMonth; // {out} register before month
        public Int32 RegisterBeforeDay;   // {out} register before day
        [MarshalAs(UnmanagedType.ByValArray, SizeConst = NUMBER_OF_CRYPTED_SECTIONS)]
        public bool[] EncryptedSections; // {out} Crypted sections
    }

    [DllImport("enigma_ide.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
    public static extern bool EP_RegKeyInformationA(string AName, string AKey, ref TKeyInformation AKeyInfo);
}

See function examples in the installation folder, Examples\KeyInformation subfolder.


EP_RegKeyInformationW

EP_RegKeyInformationW extracts internal information from the registration key. Please note, this function cannot be used to verify registration, this function just extracts information from a particular pair of registration name and key. To verify the program registration, the functions like EP_RegCheckKey, EP_RegLoadAndCheckKey and EP_RegCheckAndSaveKey should be used.

Parameters

  • AName - the registration name - a pointer to the null terminated wide string;
  • AKey - the registration key - a pointer to the null terminated wide string;
  • AKeyInfo - TKeyInformation - a pointer to the TKeyInformation structure.

TKeyInformation contains the following members:

  • Stolen - indicates if the registration key is stolen. See License Manager - Edit License
  • CreationYear - the key creation year
  • CreationMonth - the key creation month
  • CreationDay - the key creation day
  • UseKeyExpiration - indicates of the registration key contains the expiration date
  • ExpirationYear - the key expiration year
  • ExpirationMonth - the key expiration month
  • ExpirationDay - the key expiration day
  • UseHardwareLocking - indicates if the registration key is hardware locked
  • UseExecutionsLimit - shows if the registration key contains the executions limit
  • ExecutionsCount - the number of executions
  • UseDaysLimit - shows if the registration key contains the days limit
  • DaysCount - the number of days
  • UseRunTimeLimit - shows if the registration key contains the run-time limit
  • RunTimeMinutes - the number of run-time minutes
  • UseGlobalTimeLimit - shows if the registration key contains the Global Time limit
  • GlobalTimeMinutes - the number of the Global Time minutes
  • UseCountyLimit - shows if the registration key contains the country lock
  • CountryCode - the country code
  • UseRegisterAfter - shows if the registration key contains the register after date
  • RegisterAfterYear - the year of the register after date
  • RegisterAfterMonth - the month of the register after date
  • RegisterAfterDay - the day of the register after date
  • UseRegisterBefore - shows if the registration key contains the register before date
  • RegisterBeforeYear - the year of the register before date
  • RegisterBeforeMonth - the month of the register before date
  • RegisterBeforeDay - the month of the register before date
  • EncryptedSections - a 16-value array of encrypted sections that the registration key decrypts

Return Value

If the function fails, the return value is 0. If the function succeeds, the return value is not zero and the TKeyInformation structure contains information extracted from the passed registration key.

Remark

The function fails in the following cases:

  • the registration information is incorrect;
  • the application is not protected.

Definition

Show/Hide C++ function definition

typedef struct TKeyInformation {
        BOOL Stolen;               // {out} is key stolen
        DWORD CreationYear;        // {out} key creation year
        DWORD CreationMonth;       // {out} key creation month
        DWORD CreationDay;         // {out} key creation day
        BOOL UseKeyExpiration;     // {out} has key expiration date?
        DWORD ExpirationYear;      // {out} key expiration year
        DWORD ExpirationMonth;     // {out} key expiration month
        DWORD ExpirationDay;       // {out} key expiration day
        BOOL UseHardwareLocking;   // {out} hardware locked key
        BOOL UseExecutionsLimit;   // {out} limit key by executions?
        DWORD ExecutionsCount;     // {out} number of executions
        BOOL UseDaysLimit;         // {out} limit key by days?
        DWORD DaysCount;           // {out} number of days
        BOOL UseRunTimeLimit;      // {out} limit key by run time?
        DWORD RunTimeMinutes;      // {out} run time minutes
        BOOL UseGlobalTimeLimit;   // {out} limit key by global time?
        DWORD GlobalTimeMinutes;   // {out} global time minutes
        BOOL UseCountyLimit;       // {out} limit key by country?
        DWORD CountryCode;         // {out} country code
        BOOL UseRegisterAfter;     // {out} register key after date?
        DWORD RegisterAfterYear;   // {out} register after year
        DWORD RegisterAfterMonth;  // {out} register after month
        DWORD RegisterAfterDay;    // {out} register after day
        BOOL UseRegisterBefore;    // {out} register key before date?
        DWORD RegisterBeforeYear;  // {out} register before year
        DWORD RegisterBeforeMonth; // {out} register before month
        DWORD RegisterBeforeDay;   // {out} register before day
        BOOL EncryptedSections[NUMBER_OF_CRYPTED_SECTIONS]; // {out} Crypted sections
} TKeyInformation, *PKeyInformation;

extern "C" __declspec( dllexport ) __stdcall BOOL EP_RegKeyInformationW(wchar_t* AName, wchar_t* AKey, PKeyInformation AKeyInfo);

Show/Hide Delphi function definition

TKeyInformation = record
  Stolen              : LongBool; // {out} is key stolen?
  CreationYear        : integer;  // {out} key creation year
  CreationMonth       : integer;  // {out} key creation month
  CreationDay         : integer;  // {out} key creation day
  UseKeyExpiration    : LongBool; // {out} has key expiration date?
  ExpirationYear      : integer;  // {out} key expiration year
  ExpirationMonth     : integer;  // {out} key expiration month
  ExpirationDay       : integer;  // {out} key expiration day
  UseHardwareLocking  : LongBool; // {out} hardware locked key
  UseExecutionsLimit  : LongBool; // {out} limit key by executions?
  ExecutionsCount     : integer;  // {out} number of executions
  UseDaysLimit        : LongBool; // {out} limit key by days?
  DaysCount           : integer;  // {out} number of days
  UseRunTimeLimit     : LongBool; // {out} limit key by run time?
  RunTimeMinutes      : integer;  // {out} run time minutes
  UseGlobalTimeLimit  : LongBool; // {out} limit key by global time?
  GlobalTimeMinutes   : integer;  // {out} global time minutes
  UseCountyLimit      : LongBool; // {out} limit key by country?
  CountryCode         : integer;  // {out} country code
  UseRegisterAfter    : LongBool; // {out} register key after date?
  RegisterAfterYear   : integer;  // {out} register after year
  RegisterAfterMonth  : integer;  // {out} register after month
  RegisterAfterDay    : integer;  // {out} register after day
  UseRegisterBefore   : LongBool; // {out} register key before date?
  RegisterBeforeYear  : integer;  // {out} register before year
  RegisterBeforeMonth : integer;  // {out} register before month
  RegisterBeforeDay   : integer;  // {out} register before day
  EncryptedSections   : array [1..NUMBER_OF_CRYPTED_SECTIONS] of LongBool; // {out} Crypted sections
end;
PKeyInformation = ^TKeyInformation;

function EP_RegKeyInformationW(AName, AKey : PWideChar; var AKeyInfo : TKeyInformation) : boolean; stdcall;

Show/Hide C# (.NET) function definition

public class Enigma_IDE
{
    public struct TKeyInformation
    {
        public bool Stolen;               // {out} is key stolen
        public Int32 CreationYear;        // {out} key creation year
        public Int32 CreationMonth;       // {out} key creation month
        public Int32 CreationDay;         // {out} key creation day
        public bool UseKeyExpiration;     // {out} has key expiration date?
        public Int32 ExpirationYear;      // {out} key expiration year
        public Int32 ExpirationMonth;     // {out} key expiration month
        public Int32 ExpirationDay;       // {out} key expiration day
        public bool UseHardwareLocking;   // {out} hardware locked key
        public bool UseExecutionsLimit;   // {out} limit key by executions?
        public Int32 ExecutionsCount;     // {out} number of executions
        public bool UseDaysLimit;         // {out} limit key by days?
        public Int32 DaysCount;           // {out} number of days
        public bool UseRunTimeLimit;      // {out} limit key by run time?
        public Int32 RunTimeMinutes;      // {out} run time minutes
        public bool UseGlobalTimeLimit;   // {out} limit key by global time?
        public Int32 GlobalTimeMinutes;   // {out} global time minutes
        public bool UseCountyLimit;       // {out} limit key by country?
        public Int32 CountryCode;         // {out} country code
        public bool UseRegisterAfter;     // {out} register key after date?
        public Int32 RegisterAfterYear;   // {out} register after year
        public Int32 RegisterAfterMonth;  // {out} register after month
        public Int32 RegisterAfterDay;    // {out} register after day
        public bool UseRegisterBefore;    // {out} register key before date?
        public Int32 RegisterBeforeYear;  // {out} register before year
        public Int32 RegisterBeforeMonth; // {out} register before month
        public Int32 RegisterBeforeDay;   // {out} register before day
        [MarshalAs(UnmanagedType.ByValArray, SizeConst = NUMBER_OF_CRYPTED_SECTIONS)]
        public bool[] EncryptedSections; // {out} Crypted sections
    }

    [DllImport("enigma_ide.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.StdCall)]
    public static extern bool EP_RegKeyInformationW(string AName, string AKey, ref TKeyInformation AKeyInfo);
}

See function examples in the installation folder, Examples\KeyInformation subfolder.


EP_RegShowDialog

EP_RegShowDialog shows a registration dialog that is designed and enabled on the REGISTRATION FEATURES - Registration Dialog panel. Note that the Registration Dialog feature should be enabled, otherwise the dialog will not be shown. Also, any Exit application actions in the Registration Dialog will not exit the application, but just close the dialog window.

Return Value

The function does not return any value.

Remark

The function fails in the following cases:

  • the application is not protected;
  • REGISTRATION FEATURES - Registration Dialog feature is not enabled.

Definition

Show/Hide C++ function definition

extern "C" __declspec( dllimport ) __stdcall void EP_RegShowDialog();

Show/Hide Delphi function definition

procedure EP_RegShowDialog;

Show/Hide Visual Basic function definition

Public Declare Function EP_RegShowDialog Lib "enigma_ide.dll" ()

Show/Hide C# (.NET) function definition

public class Enigma_IDE
{
    [DllImport("enigma_ide.dll", CallingConvention = CallingConvention.StdCall)]
    public static extern void EP_RegShowDialog();
}

Examples

Show/Hide Delphi function example

uses enigma_ide;

procedure TForm1.btnRegisterClick(Sender: TObject);
begin
  // Show registration dialog
  EP_RegShowDialog;
end;

See function examples in the installation folder, Examples\RegistrationShowDialog subfolder.


Trial API

Trial API is a set of functions that allow you to check trial period parameters and expiration.

  • EP_TrialExecutions
  • EP_TrialExecutionsLeft
  • EP_TrialExecutionsTotal
  • EP_TrialDays
  • EP_TrialDaysLeft
  • EP_TrialDaysTotal
  • EP_TrialExpirationDate
  • EP_TrialExpirationDateEx
  • EP_TrialDateTillDate
  • EP_TrialDateTillDateStartEx
  • EP_TrialDateTillDateEndEx
  • EP_TrialExecutionTime
  • EP_TrialExecutionTimeLeft
  • EP_TrialExecutionTimeTotal

See How to use Enigma API page to learn more about calling API from your application.

Warning: the Enigma API takes effect only after the file has been protected! Do not forget to protect the file before using it.


EP_TrialExecutions

EP_TrialExecutions function servers for retrieving the total trial period executions and the trial period executions left. The total executions count of the trial period should be defined in TRIAL CONTROL - Limitation of executions count panel. See also the extended functions EP_TrialExecutionsLeft and EP_TrialExecutionsTotal.

Parameters

  • Total - the total number of trial executions.
  • Left - the number of trial executions left.

Return Value

If the function succeeds, the return value is 1. If the function fails, the return value is 0.

Remark

The function fails in the following cases:

  • the limitation of the executions count was not enabled;
  • the application is not protected.

If the user's PC has several user accounts, the trial information will be different for each user.

Definition

Show/Hide C++ function definition

extern "C" __declspec( dllimport ) __stdcall BOOL EP_TrialExecutions( int* Total, int* Left );

Show/Hide Delphi function definition

function EP_TrialExecutions( var Total, Left : integer) : boolean; stdcall;

Show/Hide Visual Basic function definition

Public Declare Function EP_TrialExecutions Lib "enigma_ide.dll" (ByRef Total As Long, ByRef Left As Long) As Byte

Show/Hide C# (.NET) function definition

public class Enigma_IDE
{
    [DllImport("enigma_ide.dll", CallingConvention = CallingConvention.StdCall)]
    public static extern bool EP_TrialExecutions(ref Int32 Total, ref Int32 Left);
}

Examples

Show/Hide Delphi function example

uses
  enigma_ide; // the module contains a definitions of Enigma API

procedure CheckTrial;
var
  TotalExecs : integer;
  LeftExecs  : integer;
begin
  if EP_TrialExecutions(TotalExecs, LeftExecs) then
  begin
    if LeftExecs = 0 then
    begin
      MessageBox(0, 'Your trial period has expired! You must purchase application to take effect!', 'Application', 0);
      ExitProcess(0);
    end;
  end else
    MessageBox(0, 'I seem that you have forgotten to define executions trial limit in Enigma!', 'Application', 0);
end;

Show/Hide C++ function example

#include "include/enigma_api.h" // the module contains a definitions of Enigma API
#pragma link "include/enigma_ide.lib"

void CheckTrial()
{
  int TotalExecs;
  int LeftExecs;
  if (EP_TrialExecutions(&TotalExecs, &LeftExecs))
  {
    if (LeftExecs == 0)
    {
      MessageBox(0, "Your trial period has expired! You must purchase application to take effect!", "Application", 0);
      ExitProcess(0);
    }
  } else
  {
    MessageBox(0, "I seem that you have forgotten to define days trial limit in Enigma!", "Application", 0);
  }
}

See function examples in the installation folder, Examples\Trial subfolder.


EP_TrialExecutionsLeft

EP_TrialExecutionsLeft function returns the number of trial executions Left. EP_TrialExecutionsLeft extends EP_TrialExecutions.

Parameters

The function does not have parameters.

Return Value

If the function succeeds, the return value is the number of executions Left. If the function fails, the return value is 0.

Remark

The function fails in the following cases:

  • the limitation of the executions count was not enabled;
  • the application is not protected.

Definition

Show/Hide C++ function definition

extern "C" __declspec( dllexport ) __stdcall int EP_TrialExecutionsLeft();

Show/Hide Delphi function definition

function EP_TrialExecutionsLeft : Cardinal;

Show/Hide Visual Basic function definition

Public Declare Function EP_TrialExecutionsLeft Lib "enigma_ide.dll" () As Long

Show/Hide C# (.NET) function definition

public class Enigma_IDE
{
    [DllImport("enigma_ide.dll", CallingConvention = CallingConvention.StdCall)]
    public static extern int EP_TrialExecutionsLeft();
}

See function examples in the installation folder.

s


EP_TrialExecutionsTotal

EP_TrialExecutionsTotal function returns the Total number of trial executions. EP_TrialExecutionsTotal extends EP_TrialExecutions.

Parameters

The function does not have parameters.

Return Value

If the function succeeds, the return value is the number of Total executions. If the function fails, the return value is 0.

Remark

The function fails in the following cases:

  • the limitation of the executions count was not enabled;
  • the application is not protected.

Definition

Show/Hide C++ function definition

extern "C" __declspec( dllexport ) __stdcall int EP_TrialExecutionsTotal();

Show/Hide Delphi function definition

function EP_TrialExecutionsTotal : Cardinal;

Show/Hide Visual Basic function definition

Public Declare Function EP_TrialExecutionsTotal Lib "enigma_ide.dll" () As Long

Show/Hide C# (.NET) function definition

public class Enigma_IDE
{
    [DllImport("enigma_ide.dll", CallingConvention = CallingConvention.StdCall)]
    public static extern int EP_TrialExecutionsTotal();
}

See function examples in the installation folder.


EP_TrialDays

EP_TrialDays function servers for retrieving the total number of trial period days and thenumber of trial period days left. The total days count of the trial period should be defined in TRIAL CONTROL - Limitation of days count panel. See also the extended functions EP_TrialDaysLeft and EP_TrialDaysTotal.

Parameters

  • Total - the total number of trial days.
  • Left - the number of trial days left.

Return Value

If the function succeeds, the return value is 1. If the function fails, the return value is 0.

Remark

The function fails in the following cases:

  • the limitation of the days count was not enabled;
  • the application is not protected.

If the user's PC has several user accounts, the trial information will be different for each user.

Definition

Show/Hide C++ function definition

extern "C" __declspec( dllimport ) __stdcall BOOL EP_TrialDays( int* Total, int* Left );

Show/Hide Delphi function definition

function EP_TrialDays( var Total, Left : integer) : boolean; stdcall;

Show/Hide Visual Basic function definition

Public Declare Function EP_TrialDays Lib "enigma_ide.dll" (ByRef Total As Long, ByRef Left As Long) As Byte

Show/Hide C# (.NET) function definition

public class Enigma_IDE
{
    [DllImport("enigma_ide.dll", CallingConvention = CallingConvention.StdCall)]
    public static extern bool EP_TrialDays(ref Int32 Total, ref Int32 Left);
}

Examples

Show/Hide Delphi function example

uses
  enigma_ide; // the module contains a definitions of Enigma API

procedure CheckTrial;
var
  TotalDays : integer;
  LeftDays  : integer;
begin
  if EP_TrialDays(TotalDays, LeftDays) then
  begin
    if LeftDays = 0 then
    begin
      MessageBox(0, 'Your trial period has expired! You must purchase application to take effect!', 'Application', 0);
      ExitProcess(0);
    end;
  end else
    MessageBox(0, 'I seem that you have forgotten to define days trial limit in Enigma!', 'Application', 0);
end;

Show/Hide C++ function example

#include "include/enigma_api.h" // the module contains a definitions of Enigma API
#pragma link "include/enigma_ide.lib"

void CheckTrial()
{
  int TotalDays;
  int LeftDays;
  if (EP_TrialDays(&TotalDays, &LeftDays))
  {
    if (LeftDays == 0)
    {
      MessageBox(0, "Your trial period has expired! You must purchase application to take effect!", "Application", 0);
      ExitProcess(0);
    }
  } else
  {
    MessageBox(0, "I seem that you have forgotten to define days trial limit in Enigma!", "Application", 0);
  }
}

See function examples in the installation folder, Examples\Trial subfolder.


EP_TrialDaysLeft

EP_TrialDaysLeft function returns the number of trial days Left. EP_TrialDaysLeft extends EP_TrialDays function.

Parameters

The function does not have parameters.

Return Value

If the function succeeds, the return value is the number of days Left. If the function fails, the return value is 0.

Remark

The function fails in the following cases:

  • the limitation of the days count was not enabled;
  • the application is not protected.

Definition

Show/Hide C++ function definition

extern "C" __declspec( dllexport ) __stdcall int EP_TrialDaysLeft();

Show/Hide Delphi function definition

function EP_TrialDaysLeft : Cardinal;

Show/Hide Visual Basic function definition

Public Declare Function EP_TrialDaysLeft Lib "enigma_ide.dll" () As Long

Show/Hide C# (.NET) function definition

public class Enigma_IDE
{
    [DllImport("enigma_ide.dll", CallingConvention = CallingConvention.StdCall)]
    public static extern int EP_TrialDaysLeft();
}

See function examples in the installation folder.


EP_TrialDaysTotal

EP_TrialDaysTotal function returns the Total number of trial days. EP_TrialDaysTotal extends EP_TrialDays function.

Parameters

The function does not have parameters.

Return Value

If the function succeeds, the return value is the number of Total days. If the function fails, the return value is 0.

Remark

The function fails in the following cases:

  • the limitation of the days count was not enabled;
  • the application is not protected.

Definition

Show/Hide C++ function definition

extern "C" __declspec( dllexport ) __stdcall int EP_TrialDaysTotal();

Show/Hide Delphi function definition

function EP_TrialDaysTotal : Cardinal;

Show/Hide Visual Basic function definition

Public Declare Function EP_TrialDaysTotal Lib "enigma_ide.dll" () As Long

Show/Hide C# (.NET) function definition

public class Enigma_IDE
{
    [DllImport("enigma_ide.dll", CallingConvention = CallingConvention.StdCall)]
    public static extern int EP_TrialDaysTotal();
}

See function examples in the installation folder.


EP_TrialExpirationDate

EP_TrialExpirationDate function returns the trial expiration date. The trial expiration date should be defined on the TRIAL CONTROL - Limitation of expiration date panel. See also the extended function EP_TrialExpirationDateEx.

Parameters

  • Year - the year of the trial expiration date.
  • Month - the month of the trial expiration date.
  • Day - the day of the trial expiration date.

Return Value

If the function succeeds, the return value is 1. If the function fails, the return value is 0.

Remark

The function fails in the following cases:

  • the limitation of the expiration date was not enabled;
  • the application is not protected.

If the user's PC has several user accounts, the trial information will be different for each user.

Definition

Show/Hide C++ function definition

extern "C" __declspec( dllimport ) __stdcall BOOL EP_TrialExpirationDate( int* Year, int* Month, int* Day );

Show/Hide Delphi function definition

function EP_TrialExpirationDate( var Year, Month, Day : integer) : boolean; stdcall;

Show/Hide Visual Basic function definition

Public Declare Function EP_TrialExpirationDate Lib "enigma_ide.dll" (ByRef Year As Long, ByRef Month As Long, ByRef Day As Long) As Byte

Show/Hide C# (.NET) function definition

public class Enigma_IDE
{
    [DllImport("enigma_ide.dll", CallingConvention = CallingConvention.StdCall)]
    public static extern bool EP_TrialExpirationDate(ref Int32 Year, ref Int32 Month, ref Int32 Day);
}

Examples

Show/Hide Delphi function example

uses
  DateUtils,
  Math,
  enigma_ide; // the module contains a definitions of Enigma API

procedure CheckTrial;
var
  wYear  : integer;
  wMonth : integer;
  wDay   : integer;
begin
  if EP_TrialExpirationDate(wYear, wMonth, wDay) then
  begin
    if not CompareDate(EncodeDate(wYear, wMonth, wDay), Now) = LessThanValue then
    begin
      MessageBox(0, 'Your trial period has expired! You must purchase application to take effect!', 'Application', 0);
      ExitProcess(0);
    end;
  end else
    MessageBox(0, 'I seem that you have forgotten to define date trial limit in Enigma!', 'Application', 0);
end;

See function examples in the installation folder, Examples\Trial subfolder.


EP_TrialExpirationDateEx

EP_TrialExpirationDateEx function returns the trial expiration date. It extends EP_TrialExpirationDate function.

Parameters

The function does not have parameters.

Return Value

If the function succeeds, the return value is a 32-bit unsigned integer value that represents the Date value. The high byte of the high word contains a day value, the low byte of the high word contains a month value, the low word contains a year value. For example, the returned value 0x10012010 ($10012010) means the 10 January 2010 date. If the function fails, the return value is 0.

Remark

The function fails in the following cases:

  • the limitation of the expiration date was not enabled;
  • the application is not protected.

Definition

Show/Hide C++ function definition

extern "C" __declspec( dllexport ) __stdcall int EP_TrialExpirationDateEx();

Show/Hide Delphi function definition

function EP_TrialExpirationDateEx : Cardinal;

Show/Hide Visual Basic function definition

Public Declare Function EP_TrialExpirationDateEx Lib "enigma_ide.dll" () As Long

Show/Hide C# (.NET) function definition

public class Enigma_IDE
{
    [DllImport("enigma_ide.dll", CallingConvention = CallingConvention.StdCall)]
    public static extern int EP_TrialExpirationDateEx();
}

See function examples in the installation folder.


EP_TrialDateTillDate

EP_TrialDateTillDate function serves for retrieving start and end trial dates. Trial dates should be defined on the TRIAL CONTROL - Limitation from date till date panel. See also the extended functions EP_TrialDateTillDateStartEx and EP_TrialDateTillDateEndEx.

Parameters

  • StartYear - the year of the start trial date.
  • StartMonth - the month of the start trial date.
  • StartDay - the day of the start trial date.
  • EndYear - the year of the end trial date.
  • EndMonth - the month of the end trial date.
  • EndDay - the day of the end trial date.

Return Value

If the function succeeds, the return value is 1. If the function fails, the return value is 0.

Remark

The function fails in the following cases:

  • the limitation of the expiration date was not enabled;
  • the application is not protected.

If the user's PC has several user accounts, the trial information will different for each user.

Definition

Show/Hide C++ function definition

extern "C" __declspec( dllimport ) __stdcall BOOL EP_TrialDateTillDate( int* StartYear, int* StartMonth, int* StartDay, int* EndYear, int* EndMonth, int* EndDay );

Show/Hide Delphi function definition

function EP_TrialDateTillDate( var StartYear, StartMonth, StartDay, EndYear, EndMonth, EndDay : integer) : boolean; stdcall;

Show/Hide Visual Basic function definition

Public Declare Function EP_TrialDateTillDate Lib "enigma_ide.dll" (ByRef StartYear As Long, ByRef StartMonth As Long, ByRef StartDay As Long, ByRef EndYear As Long, ByRef EndMonth As Long, ByRef EndDay As Long) As Byte

Show/Hide C# (.NET) function definition

public class Enigma_IDE
{
    [DllImport("enigma_ide.dll", CallingConvention = CallingConvention.StdCall)]
    public static extern bool EP_TrialDateTillDate(ref Int32 StartYear, ref Int32 StartMonth, ref Int32 StartDay, ref Int32 EndYear, ref Int32 EndMonth, ref Int32 EndDay);
}

See function examples in the installation folder, Examples\Trial subfolder.


EP_TrialDateTillDateStartEx

EP_TrialDateTillDateStartEx function returns the Start Date of the trial Limitation Date till Date. It extends EP_TrialDateTillDate function.

Parameters

The function does not have parameters.

Return Value

If the function succeeds, the return value is a 32-bit unsigned integer value that represents the Date value. The high byte of the high word contains a day value, the low byte of the high word contains a month value, the low word contains a year value. For example, the returned value 0x10012010 ($10012010) means the 10 January 2010 date. If the function fails, the return value is 0.

Remark

The function fails in the following cases:

  • the limitation of the expiration date was not enabled;
  • the application is not protected.

Definition

Show/Hide C++ function definition

extern "C" __declspec( dllexport ) __stdcall int EP_TrialDateTillDateStartEx();

Show/Hide Delphi function definition

function EP_TrialDateTillDateStartEx : Cardinal;

Show/Hide Visual Basic function definition

Public Declare Function EP_TrialDateTillDateStartEx Lib "enigma_ide.dll" () As Long

Show/Hide C# (.NET) function definition

public class Enigma_IDE
{
    [DllImport("enigma_ide.dll", CallingConvention = CallingConvention.StdCall)]
    public static extern int EP_TrialDateTillDateStartEx();
}

See function examples in the installation folder.


EP_TrialDateTillDateEndEx

EP_TrialDateTillDateEndEx function returns the End Date of trial Limitation Date till Date. It extends EP_TrialDateTillDate function.

Parameters

The function does not have parameters.

Return Value

If the function succeeds, the return value is a 32-bit unsigned integer value that represents the Date value. The high byte of the high word contains a day value, the low byte of the high word contains a month value, the low word contains a year value. For example, the returned value 0x10012010 ($10012010) means the 10 January 2010 date. If the function fails, the return value is 0.

Remark

The function fails in the following cases:

  • the limitation of the expiration date was not enabled;
  • the application is not protected.

Definition

Show/Hide C++ function definition

extern "C" __declspec( dllexport ) __stdcall int EP_TrialDateTillDateEndEx();

Show/Hide Delphi function definition

function EP_TrialDateTillDateEndEx : Cardinal;

Show/Hide Visual Basic function definition

Public Declare Function EP_TrialDateTillDateEndEx Lib "enigma_ide.dll" () As Long

Show/Hide C# (.NET) function definition

public class Enigma_IDE
{
    [DllImport("enigma_ide.dll", CallingConvention = CallingConvention.StdCall)]
    public static extern int EP_TrialDateTillDateEndEx();
}

See function examples in the installation folder.


EP_TrialExecutionTime

EP_TrialExecutionTime function servers for retrieving the total trial period minutes and the trial period minutes left since the module start. The total number of trial minutes should be defined in TRIAL CONTROL - Limitation of execution time panel. See also the extended functions EP_TrialExecutionTimeLeft and EP_TrialExecutionTimeTotal.

Parameters

  • Total - the total number of trial minutes.
  • Left - the number of trial minutes left.

Return Value

If the function succeeds, the return value is 1. If the function fails, the return value is 0.

Remark

The function fails in the following cases:

  • the limitation of the execution time was not enabled;
  • the application is not protected.

Definition

Show/Hide C++ function definition

extern "C" __declspec( dllimport ) __stdcall BOOL EP_TrialExecutionTime( int* Total, int* Left );

Show/Hide Delphi function definition

function EP_TrialExecutionTime( var Total, Left : Cardinal) : boolean; stdcall;

Show/Hide Visual Basic function definition

Public Declare Function EP_TrialExecutionTime Lib "enigma_ide.dll" (ByRef Total As Long, ByRef Left As Long) As Byte

Show/Hide C# (.NET) function definition

public class Enigma_IDE
{
    [DllImport("enigma_ide.dll", CallingConvention = CallingConvention.StdCall)]
    public static extern bool EP_TrialExecutionTime(ref Int32 Total, ref Int32 Left);
}

Examples

Show/Hide Delphi function example

uses
  enigma_ide; // the module contains a definitions of Enigma API

procedure TfrmMain.tmTimerTimer(Sender: TObject);
var
  lpSystemTime : _SYSTEMTIME;
  dwMinutesTotal : Cardinal;
  dwMinutesLeft : Cardinal;
begin
  // Here we set current time to edit
  GetSystemTime(lpSystemTime);
  eGlobalTime.Text := format('%.2d:%.2d:%.2d', [lpSystemTime.wHour, lpSystemTime.wMinute, lpSystemTime.wSecond]);
  // Set the execution time
  inc(dwExecutionTime, tmTimer.Interval);
  eExecutionTime.Text := format('%.2d:%.2d:%.2d', [(dwExecutionTime div (60*60*1000)) mod 24, (dwExecutionTime div (60*1000)) mod 60, (dwExecutionTime div (1000)) mod 60]);
  // Get total and left minutes of execution
  if EP_TrialExecutionTime(dwMinutesTotal, dwMinutesLeft) then
  begin
    eStatus.Color := clGreen;
    eStatus.Text := 'OK';
    eTotalExecutionTime.Text := IntToStr(dwMinutesTotal);
    eLeftExecutionTime.Text := IntToStr(dwMinutesLeft);
  end else
  begin
    // The trial parameters were not set
    // Shows the red color of trial status
    eStatus.Color := clRed;
    eStatus.Text := 'UNUSED';
  end;
end;

Show/Hide C++ function example

#include "include/enigma_api.h" // the module contains a definitions of Enigma API
#pragma link "include/enigma_ide.lib"

void __fastcall TfrmMain::tmTimerTimer(TObject *Sender)
{
  _SYSTEMTIME lpSystemTime;
  unsigned long dwTotal;
  unsigned long dwLeft;
  // Show global time
  GetSystemTime(&lpSystemTime);
  eGlobalTime->Text = Format("%.2d:%.2d:%.2d", ARRAYOFCONST((lpSystemTime.wHour, lpSystemTime.wMinute, lpSystemTime.wSecond)));
  // Show execution time
  dwCounter += tmTimer->Interval;
  eExecutionTime->Text = Format("%.2d:%.2d:%.2d",
                                ARRAYOFCONST((
                                        dwCounter / (60 * 60 * 1000) % 24,
                                        dwCounter / (60 * 1000) % 60,
                                        dwCounter / 1000 % 60
                                )));

  // Get trial status
  if (EP_TrialExecutionTime(&dwTotal, &dwLeft))
  {
    // Set total and left minutes values to labels
    Label2->Caption = Format("%d", ARRAYOFCONST(((int)dwTotal)));
    Label3->Caption = Format("%d", ARRAYOFCONST(((int)dwLeft)));
    // Set maximal value to ProgressBar
    pbTrial->Max = (int)dwTotal;
    pbTrial->Position = (int)dwLeft;
    // Set trial status
    eStatus->Text = "OK";
    eStatus->Color = clGreen;
  } else
  {
    eStatus->Text = "UNUSED";
    eStatus->Color = clRed;
  }
}

See function examples in the installation folder, Examples\TrialExecutionTime subfolder.


EP_TrialExecutionTimeLeft

EP_TrialExecutionTimeLeft function returns the number of trial execution minutes Left. EP_TrialExecutionTimeLeft extends EP_TrialExecutionTime.

Parameters

The function does not have parameters.

Return Value

If the function succeeds, the return value is the number of trial execution minutes Left. If the function fails, the return value is 0.

Remark

The function fails in the following cases:

  • the limitation of the execution time was not enabled;
  • the application is not protected.

Definition

Show/Hide C++ function definition

extern "C" __declspec( dllexport ) __stdcall int EP_TrialExecutionTimeLeft();

Show/Hide Delphi function definition

function EP_TrialExecutionTimeLeft : Cardinal;

Show/Hide Visual Basic function definition

Public Declare Function EP_TrialExecutionTimeLeft Lib "enigma_ide.dll" () As Long

Show/Hide C# (.NET) function definition

public class Enigma_IDE
{
    [DllImport("enigma_ide.dll", CallingConvention = CallingConvention.StdCall)]
    public static extern int EP_TrialExecutionTimeLeft();
}

See function examples in the installation folder.


EP_TrialExecutionTimeTotal

EP_TrialExecutionTimeTotal function returns the Total number of trial execution minutes. EP_TrialExecutionTimeTotal extends EP_TrialExecutionTime.

Parameters

The function does not have parameters.

Return Value

If the function succeeds, the return value is the number of Total trial execution minutes. If the function fails, the return value is 0.

Remark

The function fails in the following cases:

  • the limitation of the execution time was not enabled;
  • the application is not protected.

Definition

Show/Hide C++ function definition

extern "C" __declspec( dllexport ) __stdcall int EP_TrialExecutionTimeTotal();

Show/Hide Delphi function definition

function EP_TrialExecutionTimeTotal : Cardinal;

Show/Hide Visual Basic function definition

Public Declare Function EP_TrialExecutionTimeTotal Lib "enigma_ide.dll" () As Long

Show/Hide C# (.NET) function definition

public class Enigma_IDE
{
    [DllImport("enigma_ide.dll", CallingConvention = CallingConvention.StdCall)]
    public static extern int EP_TrialExecutionTimeTotal();
}

See function examples in the installation folder.


Crypt API

Crypt API is a set of functions that allow you to generate a hash (checksum) of the strings, files or custom buffer and perform buffer encryption/decryption.

  • EP_CryptHashBuffer
  • EP_CryptHashFileA
  • EP_CryptHashFileW
  • EP_CryptHashStringA
  • EP_CryptHashStringW
  • EP_CryptDecryptBuffer
  • EP_CryptDecryptBufferEx
  • EP_CryptEncryptBuffer
  • EP_CryptEncryptBufferEx

See How to use Enigma API page to learn more about calling API from your application.

Warning: the Enigma API takes effect only after the file has been protected! Do not forget to protect the file before using it.


EP_CryptDecryptBuffer

EP_CryptDecryptBuffer decrypts a buffer with the defined key.

Parameters

  • Buffer - a pointer to the memory buffer for decrypting.
  • Size - the size of the memory buffer.
  • Key - a pointer to ANSI, a null terminated string that will be used as a key for decryption.

Return Value

The function does not return value.

Definition

Show/Hide C++ function definition

extern "C" __declspec( dllimport ) __stdcall void EP_CryptDecryptBuffer( byte* Buffer, int Size, char* Key);

Show/Hide Delphi function definition

procedure EP_CryptDecryptBuffer(Buffer : pointer; Size : Cardinal; Key : PAnsiChar); stdcall;

Show/Hide C# (.NET) function definition

public class Enigma_IDE
{
    [DllImport("enigma_ide.dll", CallingConvention = CallingConvention.StdCall)]
    public static extern void EP_CryptDecryptBuffer(IntPtr Buffer, int Size, string Key);
}

See function examples in the installation folder, Examples\CryptBuffer subfolder.


EP_CryptDecryptBufferEx

EP_CryptDecryptBufferEx decrypts a buffer with the defined key.

Parameters

  • InBuffer - a pointer to the input memory buffer for decrypting.
  • OutBuffer - a pointer to the output memory buffer for decrypting.
  • Size - the size of the memory buffer.
  • Key - a pointer to the buffer that will be used as a key for decryption.
  • KeySize - the size of the key memory buffer.

Return Value

The function does not return value.

Definition

Show/Hide C++ function definition

extern "C" __declspec( dllimport ) __stdcall void EP_CryptDecryptBufferEx( byte* InBuffer, byte* OutBuffer, int Size, byte* Key, int KeySize);

Show/Hide Delphi function definition

procedure EP_CryptDecryptBufferEx(InBuffer, OutBuffer : pointer; Size : Cardinal; Key : pointer; KeySize : Cardinal); stdcall;

Show/Hide C# (.NET) function definition

public class Enigma_IDE
{
    [DllImport("enigma_ide.dll", CallingConvention = CallingConvention.StdCall)]
    public static extern void EP_CryptDecryptBufferEx(IntPtr InBuffer, IntPtr OutBuffer, int Size, IntPtr Key, int KeySize);
}

See function examples in the installation folder, Examples\CryptBuffer subfolder.


EP_CryptEncryptBuffer

EP_CryptEncryptBuffer encrypts a buffer with the defined key.

Parameters

  • Buffer - a pointer to the memory buffer for encrypting.
  • Size - the size of the memory buffer.
  • Key - a pointer to ANSI, a null terminated string that will be used as a key for encryption.

Return Value

The function does not return value.

Definition

Show/Hide C++ function definition

extern "C" __declspec( dllimport ) __stdcall void EP_CryptEncryptBuffer( byte* Buffer, int Size, char* Key);

Show/Hide Delphi function definition

procedure EP_CryptEncryptBuffer(Buffer : pointer; Size : Cardinal; Key : PAnsiChar); stdcall;

Show/Hide C# (.NET) function definition

public class Enigma_IDE
{
    [DllImport("enigma_ide.dll", CallingConvention = CallingConvention.StdCall)]
    public static extern void EP_CryptEncryptBuffer(IntPtr Buffer, int Size, string Key);
}

See function examples in the installation folder, Examples\CryptBuffer subfolder.


EP_CryptEncryptBufferEx

EP_CryptEncryptBufferEx encrypts a buffer with the defined key.

Parameters

  • InBuffer - a pointer to the input memory buffer for encrypting.
  • OutBuffer - a pointer to the output memory buffer for encrypting.
  • Size - the size of the memory buffer.
  • Key - a pointer to the buffer that will be used as a key for encryption.
  • KeySize - the size of the key memory buffer.

Return Value

The function does not return value.

Definition

Show/Hide C++ function definition

extern "C" __declspec( dllimport ) __stdcall void EP_CryptEncryptBufferEx( byte* InBuffer, byte* OutBuffer, int Size, byte* Key, int KeySize);

Show/Hide Delphi function definition

procedure EP_CryptEncryptBufferEx(InBuffer, OutBuffer : pointer; Size : Cardinal; Key : pointer; KeySize : Cardinal); stdcall;

Show/Hide C# (.NET) function definition

public class Enigma_IDE
{
    [DllImport("enigma_ide.dll", CallingConvention = CallingConvention.StdCall)]
    public static extern void EP_CryptEncryptBufferEx(IntPtr InBuffer, IntPtr OutBuffer, int Size, IntPtr Key, int KeySize);
}

See function examples in the installation folder, Examples\CryptBuffer subfolder.


EP_CryptHashBuffer

EP_CryptHashBuffer calculates hash of the user defined buffer.

Parameters

  • Hash - the type of the hash for calculation.
    Hash Type | Parameter = Value
    XOR32 | HASH_XOR32 = 0
    MD2 | HASH_MD2 = 1
    MD5 | HASH_MD5 = 2
    RipeMD160 | HASH_RipeMD160 = 3
    SH1 | HASH_SH1 = 4
    SHA224 | HASH_SHA224 = 5
    SHA256 | HASH_SHA256 = 6
    SHA384 | HASH_SHA384 = 7
    SHA512 | HASH_SHA512 = 8
  • Buffer - a pointer to the memory buffer for hash calculating.
  • Size - the size of the memory buffer.
  • Digest - a pointer to the buffer for storing the hash value.

Return Value

If the function succeeds, the return value is the size of hash (that is stored in Digest buffer) in bytes. If the function fails, the return value is 0.

Hash Type | Hash Size (bytes)
XOR32 | 4
MD2 | 16
MD5 | 16
RipeMD160 | 20
SH1 | 20
SHA224 | 28
SHA256 | 32
SHA384 | 48
SHA512 | 64

Remark

The function fails in the following cases:

  • the input buffer is not allocated;
  • the input buffer is not readable;
  • Digest buffer is not allocated;
  • Digest buffer is write protected;
  • the application is not protected.

Definition

Show/Hide C++ function definition

extern "C" __declspec( dllimport ) __stdcall int EP_CryptHashBuffer( int Hash, byte* Buffer, int Size, byte* Digest);

Show/Hide Delphi function definition

function EP_CryptHashBuffer(Hash : Cardinal; Buffer : pointer; Size : Cardinal; Digest : pointer) : Cardinal; stdcall;

Show/Hide C# (.NET) function definition

public class Enigma_IDE
{
    [DllImport("enigma_ide.dll", CallingConvention = CallingConvention.StdCall)]
    public static extern int EP_CryptHashBuffer(int Hash, IntPtr Buffer, int Size, IntPtr Digest);
}

See function examples in the installation folder, Examples\Hashes subfolder.


EP_CryptHashFileA

EP_CryptHashFileA calculates hash of the user defined file.

Parameters

  • Hash - the type of the hash for calculation.
    Hash Type | Parameter = Value
    XOR32 | HASH_XOR32 = 0
    MD2 | HASH_MD2 = 1
    MD5 | HASH_MD5 = 2
    RipeMD160 | HASH_RipeMD160 = 3
    SH1 | HASH_SH1 = 4
    SHA224 | HASH_SHA224 = 5
    SHA256 | HASH_SHA256 = 6
    SHA384 | HASH_SHA384 = 7
    SHA512 | HASH_SHA512 = 8
  • FileName- the name of the file, a pointer to the null terminated ANSI string.
  • Digest - a pointer to the buffer for storing the hash value.

Return Value

If the function succeeds, the return value is the size of hash (that is stored in Digest buffer) in bytes. If the function fails, the return value is 0.

Hash Type | Hash Size (bytes)
XOR32 | 4
MD2 | 16
MD5 | 16
RipeMD160 | 20
SH1 | 20
SHA224 | 28
SHA256 | 32
SHA384 | 48
SHA512 | 64

Remark

The function fails in the following cases:

  • FileName is not set;
  • FileName is not readable;
  • Digest buffer is not allocated;
  • Digest buffer is write protected;
  • the application is not protected.

Definition

Show/Hide C++ function definition

extern "C" __declspec( dllimport ) __stdcall int EP_CryptHashFileA( int Hash, char* FileName, byte* Digest);

Show/Hide Delphi function definition

function EP_CryptHashFileA(Hash : Cardinal; FileName : PAnsiChar; Digest : pointer) : Cardinal; stdcall;

Show/Hide C# (.NET) function definition

public class Enigma_IDE
{
    [DllImport("enigma_ide.dll", CallingConvention = CallingConvention.StdCall)]
    public static extern int EP_CryptHashFileA(int Hash, string FileName, IntPtr Digest);
}

See function examples in the installation folder, Examples\Hashes subfolder.


EP_CryptHashFileW

EP_CryptHashFileA calculates hash of the user defined file.

Parameters

  • Hash - the type of the hash for calculation.
    Hash Type | Parameter = Value
    XOR32 | HASH_XOR32 = 0
    MD2 | HASH_MD2 = 1
    MD5 | HASH_MD5 = 2
    RipeMD160 | HASH_RipeMD160 = 3
    SH1 | HASH_SH1 = 4
    SHA224 | HASH_SHA224 = 5
    SHA256 | HASH_SHA256 = 6
    SHA384 | HASH_SHA384 = 7
    SHA512 | HASH_SHA512 = 8
  • FileName- ther name of the file, a pointer to the null terminated UNICODE string.
  • Digest - a pointer to the buffer for storing the hash value.

Return Value

If the function succeeds, the return value is the size of hash (that is stored in Digest buffer) in bytes. If the function fails, the return value is 0.

Hash Type | Hash Size (bytes)
XOR32 | 4
MD2 | 16
MD5 | 16
RipeMD160 | 20
SH1 | 20
SHA224 | 28
SHA256 | 32
SHA384 | 48
SHA512 | 64

Remark

The function fails in the following cases:

  • FileName is not set;
  • FileName is not readable;
  • Digest buffer is not allocated;
  • Digest buffer is write protected;
  • the application is not protected.

Definition

Show/Hide C++ function definition

extern "C" __declspec( dllimport ) __stdcall int EP_CryptHashFileW( int Hash, wchar_t* FileName, byte* Digest);

Show/Hide Delphi function definition

function EP_CryptHashFileW(Hash : Cardinal; FileName : PWideChar; Digest : pointer) : Cardinal; stdcall;

Show/Hide C# (.NET) function definition

public class Enigma_IDE
{
    [DllImport("enigma_ide.dll", CallingConvention = CallingConvention.StdCall)]
    public static extern int EP_CryptHashFileW(int Hash, string FileName, IntPtr Digest);
}

See function examples in the installation folder, Examples\Hashes subfolder.


EP_CryptHashStringA

EP_CryptHashStringA calculates hash of the user defined ANSI string.

Parameters

  • Hash - the type of the hash for calculation.
    Hash Type | Parameter = Value
    XOR32 | HASH_XOR32 = 0
    MD2 | HASH_MD2 = 1
    MD5 | HASH_MD5 = 2
    RipeMD160 | HASH_RipeMD160 = 3
    SH1 | HASH_SH1 = 4
    SHA224 | HASH_SHA224 = 5
    SHA256 | HASH_SHA256 = 6
    SHA384 | HASH_SHA384 = 7
    SHA512 | HASH_SHA512 = 8
  • Str - a pointer to the null terminated ANSI string.
  • Digest - a pointer to the buffer for storing the hash value.

Return Value

If the function succeeds, the return value is the size of hash (that is stored in Digest buffer) in bytes. If the function fails, the return value is 0.

Hash Type | Hash Size (bytes)
XOR32 | 4
MD2 | 16
MD5 | 16
RipeMD160 | 20
SH1 | 20
SHA224 | 28
SHA256 | 32
SHA384 | 48
SHA512 | 64

Remark

The function fails in the following cases:

  • Str is not set;
  • Digest buffer is not allocated;
  • Digest buffer is write protected;
  • the application is not protected.

Definition

Show/Hide C++ function definition

extern "C" __declspec( dllimport ) __stdcall int EP_CryptHashStringA( int Hash, char* Str, byte* Digest);

Show/Hide Delphi function definition

function EP_CryptHashStringA(Hash : Cardinal; Str : PAnsiChar; Digest : pointer) : Cardinal; stdcall;

Show/Hide C# (.NET) function definition

public class Enigma_IDE
{
    [DllImport("enigma_ide.dll", CallingConvention = CallingConvention.StdCall)]
    public static extern int EP_CryptHashStringA(int Hash, string Str, IntPtr Digest);
}

See function examples in the installation folder, Examples\Hashes subfolder.


EP_CryptHashStringW

EP_CryptHashFileW calculates hash of a user defined UNICODE string.

Parameters

  • Hash - the type of the hash for calculation.
    Hash Type | Parameter = Value
    XOR32 | HASH_XOR32 = 0
    MD2 | HASH_MD2 = 1
    MD5 | HASH_MD5 = 2
    RipeMD160 | HASH_RipeMD160 = 3
    SH1 | HASH_SH1 = 4
    SHA224 | HASH_SHA224 = 5
    SHA256 | HASH_SHA256 = 6
    SHA384 | HASH_SHA384 = 7
    SHA512 | HASH_SHA512 = 8
  • Str - a pointer to the null terminated UNICODE string.
  • Digest - a pointer to the buffer for storing the hash value.

Return Value

If the function succeeds, the return value is the size of hash (that is stored in Digest buffer) in bytes. If the function fails, the return value is 0.

Hash Type | Hash Size (bytes)
XOR32 | 4
MD2 | 16
MD5 | 16
RipeMD160 | 20
SH1 | 20
SHA224 | 28
SHA256 | 32
SHA384 | 48
SHA512 | 64

Remark

The function fails in the following cases:

  • Str is not set;
  • Digest buffer is not allocated;
  • Digest buffer is write protected;
  • the application is not protected.

Definition

Show/Hide C++ function definition

extern "C" __declspec( dllimport ) __stdcall int EP_CryptHashStringW( int Hash, wchar_t* Str, byte* Digest);

Show/Hide Delphi function definition

function EP_CryptHashStringA(Hash : Cardinal; Str : PAnsiChar; Digest : pointer) : Cardinal; stdcall;

Show/Hide C# (.NET) function definition

public class Enigma_IDE
{
    [DllImport("enigma_ide.dll", CallingConvention = CallingConvention.StdCall)]
    public static extern int EP_CryptHashStringW(int Hash, string Str, IntPtr Digest);
}

See function examples in the installation folder, Examples\Hashes subfolder.


Miscellaneous API

Miscellaneous API is a set of functions that provide additional functionality such as getting protected strings, checking the number of executed copies, extracting watermarks, detecting the country code, getting the Enigma version, checking protection integrity and other miscellaneous functions

  • EP_CheckupCopies
  • EP_CheckupCopiesCurrent
  • EP_CheckupCopiesTotal
  • EP_CheckupIsEnigmaOk
  • EP_CheckupIsProtected
  • EP_EnigmaVersion
  • EP_MiscCountryCode
  • EP_MiscGetWatermark
  • EP_ProtectedStringByID
  • EP_ProtectedStringByKey
  • EP_SplashScreenShow
  • EP_SplashScreenHide
  • EP_CheckupVirtualizationTools
  • EP_LoadConfiguration

See How to use Enigma API page to learn more about calling API from your application.

Warning: the Enigma API takes effect only after the file has been protected! Do not forget to protect the file before using it.


EP_CheckupCopies

EP_CheckupCopies function returns the total and current number of executed copies of the protected file. The initial settings should be entered in the CHECK-UP - Executed Copies panel. Also, see the extended functions EP_CheckupCopiesCurrent and EP_CheckupCopiesTotal.

Parameters

  • Total - the total number of executed copies allowed.
  • Current - the current number of executed copies.

Return Value

If the function succeeds, the return value is 1. If the function fails, the return value is 0.

Remark

The function fails in the following cases:

  • checkup of executed copies is not enabled;
  • the application is not protected.

Definition

Show/Hide C++ function definition

extern "C" __declspec( dllimport ) __stdcall BOOL EP_CheckupCopies( int* Total, int* Current);

Show/Hide Delphi function definition

function EP_CheckupCopies( var Total, Current : Cardinal) : boolean; stdcall;

Show/Hide Visual Basic function definition

Public Declare Function EP_CheckupCopies Lib "enigma_ide.dll" (ByRef Total As Long, ByRef Current As Long) As Byte

Show/Hide C# (.NET) function definition

public class Enigma_IDE
{
    [DllImport("enigma_ide.dll", CallingConvention = CallingConvention.StdCall)]
    public static extern bool EP_CheckupCopies(ref Int32 Total, ref Int32 Current);
}

Examples

Show/Hide Delphi function example

uses
  enigma_ide; // the module contains a definitions of Enigma API

procedure CheckCopies;
var
  Total, Current : Cardinal;
begin
  // Get total number of executed copies and current one
  if EP_CheckupCopies(Total, Current) then
  begin
    MessageBox(0, PAnsiChar(format('There is set up %d of total executed copies,'#10#13'This is the %d-th runing copy!', [Total, Current])), 'Application', MB_OK or MB_ICONINFORMATION);
  end else
  begin
    // If the function returns false, it means that checkup
    // of executed copies is not set on the project
    MessageBox(0, 'Unable to get executed copies count. To solve the problem, be sure:'#10#13'1. Application is protected,'#10#13'2. Checkup of executed copies is enabled.', 'Application', MB_OK or MB_ICONERROR);
  end;
end;

See function examples in the installation folder, Examples\ExecutedCopies subfolder.


EP_CheckupCopiesCurrent

EP_CheckupCopiesCurrent function returns the current number of executed copies of the protected application. EP_CheckupCopiesCurrent extends the EP_CheckupCopies function.

Parameters

The function does not have parameters.

Return Value

If the function succeeds, the return value is the number of executed copies of the current application. If the function fails, the return value is 0.

Remark

The function fails in the following cases:

  • checkup of executed copies is not enabled;
  • the application is not protected.

Definition

Show/Hide C++ function definition

extern "C" __declspec( dllimport ) __stdcall int EP_CheckupCopiesCurrent();

Show/Hide Delphi function definition

function EP_CheckupCopiesCurrent : Cardinal;

Show/Hide Visual Basic function definition

Public Declare Function EP_CheckupCopiesCurrent Lib "enigma_ide.dll" () As Long

Show/Hide C# (.NET) function definition

public class Enigma_IDE
{
    [DllImport("enigma_ide.dll", CallingConvention = CallingConvention.StdCall)]
    public static extern int EP_CheckupCopiesCurrent();
}

See function examples in the installation folder.


EP_CheckupCopiesTotal

EP_CheckupCopiesTotal function returns the total number of allowed simultaneously executed copies of the protected application. EP_CheckupCopiesTotal extends the EP_CheckupCopies function.

Parameters

The function does not have parameters.

Return Value

If the function succeeds, the return value is the total number of allowed executed copies. If the function fails, the return value is 0.

Remark

The function fails in the following cases:

  • checkup of executed copies is not enabled;
  • the application is not protected.

Definition

Show/Hide C++ function definition

extern "C" __declspec( dllimport ) __stdcall int EP_CheckupCopiesTotal();

Show/Hide Delphi function definition

function EP_CheckupCopiesTotal : Cardinal;

Show/Hide Visual Basic function definition

Public Declare Function EP_CheckupCopiesTotal Lib "enigma_ide.dll" () As Long

Show/Hide C# (.NET) function definition

public class Enigma_IDE
{
    [DllImport("enigma_ide.dll", CallingConvention = CallingConvention.StdCall)]
    public static extern int EP_CheckupCopiesTotal();
}

See function examples in the installation folder.


EP_CheckupIsEnigmaOk

EP_CheckupIsEnigmaOk function checks the integrity of the protection code. It is a useful function that can check the control sum of Enigma loader and protection itself, and if there are any errors, i.e. if the protection sum of the loader is invalid, this function returns 0. The protection code should not have any modifications, but if a cracker attempts to remove the protection or just to analyse it, this function fails and returns a zero value.

Return Value

If the protection is OK and has not been modified, the function returns 1, otherwise - if protection is corrupted - the return value is 0.

Definition

Show/Hide C++ function definition

extern "C" __declspec( dllimport ) __stdcall BOOL EP_CheckupIsEnigmaOk();

Show/Hide Delphi function definition

function EP_CheckupIsEnigmaOk : boolean;

Show/Hide Visual Basic function definition

Public Declare Function EP_CheckupIsEnigmaOk Lib "enigma_ide.dll" () As Byte

Show/Hide C# (.NET) function definition

public class Enigma_IDE
{
    [DllImport("enigma_ide.dll", CallingConvention = CallingConvention.StdCall)]
    public static extern bool EP_CheckupIsEnigmaOk();
}

Examples

Show/Hide Delphi function example

uses
  enigma_ide; // the module contains a definitions of Enigma API

// Check, if crc of Enigma protection is ok or no
if EP_CheckupIsEnigmaOk then
begin
  MessageBox(0, 'Protection CRC is good!'#10#13'Everything is well, we can complete the job!', 'Application', MB_OK or MB_ICONINFORMATION);
end else
begin
  MessageBox(0, 'Protection is changed/cracked...', 'Application', MB_OK or MB_ICONERROR);
end;

See function examples in the installation folder, Examples\CheckEnigma subfolder.


EP_CheckupIsProtected

The EP_CheckupIsProtected function has a very simple purpose, it is used to check if the file is protected or not.

Return Value

The function returns 0 if the file is not protected and 1 if the file is protected.

Definition

Show/Hide C++ function definition

extern "C" __declspec( dllimport ) __stdcall BOOL EP_CheckupIsProtected();

Show/Hide Delphi function definition

function EP_CheckupIsProtected : boolean;

Show/Hide Visual Basic function definition

Public Declare Function EP_CheckupIsProtected Lib "enigma_ide.dll" () As Byte

Show/Hide C# (.NET) function definition

public class Enigma_IDE
{
    [DllImport("enigma_ide.dll", CallingConvention = CallingConvention.StdCall)]
    public static extern bool EP_CheckupIsProtected();
}

Examples

Show/Hide Delphi function example

uses
  enigma_ide; // the module contains a definitions of Enigma API

// Check, if the file is protected
if EP_CheckupIsProtected then
begin
  MessageBox(0, 'We are under protection!', 'Application', MB_OK or MB_ICONINFORMATION);
end else
begin
  MessageBox(0, 'Please protect this file before usage!', 'Application', MB_OK or MB_ICONERROR);
end;

See function examples in the installation folder, Examples\CheckEnigma subfolder.


EP_EnigmaVersion

EP_EnigmaVersion returns the version of Enigma Protector the file is protected with.

Return Value

The return value contains the major version number in the high-order byte of the word and minor version number in the low-order byte. For example, return value 0x014E (334) means version 1.78.

Definition

Show/Hide C++ function definition

extern "C" __declspec( dllimport ) __stdcall int EP_EnigmaVersion();

Show/Hide Delphi function definition

function EP_EnigmaVersion : Cardinal;

Show/Hide Visual Basic function definition

Public Declare Function EP_EnigmaVersion Lib "enigma_ide.dll" () As Long

Show/Hide C# (.NET) function definition

public class Enigma_IDE
{
    [DllImport("enigma_ide.dll", CallingConvention = CallingConvention.StdCall)]
    public static extern int EP_EnigmaVersion();
}

See function examples in the installation folder, Examples\CheckEnigma subfolder.


EP_MiscCountryCode

The EP_MiscCountryCode function returns the code of the current user's country. This value could be used for generating registration keys, see Creating Keys.
Name | Code | Value
Afghanistan | CN_AFGHANISTAN | 114
Albania | CN_ALBANIA | 1
Algeria | CN_ALGERIA | 2
Argentina | CN_ARGENTINA | 3
Armenia | CN_ARMENIA | 4
Australia | CN_AUSTRALIA | 5
Austria | CN_AUSTRIA | 6
Azerbaijan | CN_AZERBAIJAN | 7
Bahrain | CN_BAHRAIN | 8
Bangladesh | CN_BANGLADESH | 115
Belarus | CN_BELARUS | 9
Belgium | CN_BELGIUM | 10
Belize | CN_BELIZE | 11
Bolivia | CN_BOLIVIA | 116
Bosnia and Herzegovina | CN_BOSNIA | 117
Brazil | CN_BRAZIL | 13
Brunei Darussalam | CN_BRUNEI | 14
Bulgaria | CN_BULGARIA | 15
Cambodia | CN_CAMBODIA | 16
Canada | CN_CANADA | 17
Caribbean | CN_CARRIBEAN | 118
Chile | CN_CHILE | 20
China | CN_CHINA | 21
Colombia | CN_COLOMBIA | 22
Costa Rica | CN_COSTARICA | 23
Croatia | CN_CROATIA | 24
Czech Republic | CN_CZECH | 25
Denmark | CN_DENMARK | 26
Dominican Republic | CN_DOMINICAN | 27
Ecuador | CN_ECUADOR | 28
Egypt | CN_EGYPT | 29
El Salvador | CN_ELSALVADOR | 30
Estonia | CN_ESTONIA | 31
Ethiopia | CN_ETHIOPIA | 119
Faroe Islands | CN_FAROE | 32
Finland | CN_FINLAND | 33
France | CN_FRANCE | 34
Georgia | CN_GEORGIA | 35
Germany | CN_GERMANY | 36
Greece | CN_GREECE | 37
Greenland | CN_GREENLAND | 120
Guatemala | CN_GUATEMALA | 38
Honduras | CN_HONDURAS | 39
Hong Kong | CN_HONGKONG | 40
Hungary | CN_HUNGARU | 41
Iceland | CN_ICELAND | 42
India | CN_INDIA | 43
Indonesia | CN_INDONESIA | 44
Iran | CN_IRAN | 45
Iraq | CN_IRAQ | 46
Ireland | CN_IRELAND | 47
Israel | CN_ISRAEL | 48
Italy | CN_ITALY | 49
Jamaica | CN_JAMAICA | 50
Japan | CN_JAPAN | 51
Jordan | CN_JORDAN | 52
Kazakhstan | CN_KAZAKHSTAN | 53
Kenya | CN_KENYA | 54
Korea | CN_KOREA | 56
Kuwait | CN_KUWAIT | 57
Kyrgyzstan | CN_KYRGYZSTAN | 58
Laos | CN_LAOS | 121
Latvia | CN_LATVIA | 59
Lebanon | CN_LEBANON | 60
Libyan | CN_LIBYAN | 122
Liechtenstein | CN_LIECHTENSTEIN | 62
Lithuania | CN_LITHUANIA | 63
Luxembourg | CN_LUXEMBOURG | 64
Macao | CN_MACAO | 65
Macedonia | CN_MACEDONIA | 66
Malaysia | CN_MALAYSIA | 67
Maldives | CN_MALDIVES | 123
Malta | CN_MALTA | 124
Mexico | CN_MEXOCI | 68
Monaco | CN_MONACO | 70
Mongolia | CN_MONGOLIA | 71
Montenegro | CN_MONTENEGRO | 125
Morocco | CN_MOROCCO | 72
Nepal | CN_NEPAL | 126
Netherlands | CN_NETHERLANDS | 73
New Zealand | CN_NEWZEALAND | 74
Nicaragua | CN_NICARAGUA | 75
Nigeria | CN_NIGERIA | 127
Norway | CN_NORWAY | 76
Oman | CN_OMAN | 77
Pakistan | CN_PAKISTAN | 78
Panama | CN_PANAMA | 79
Paraguay | CN_PARAGUAY | 80
Peru | CN_PERY | 81
Philippines | CN_PHILIPPINES | 82
Poland | CN_POLAND | 83
Portugal | CN_PORTUGAL | 84
Puerto Rico | CN_PUERTORICO | 85
Qatar | CN_QATAR | 86
Romania | CN_ROMANIA | 87
Russia | CN_RUSSIA | 88
Rwanda | CN_RWANDA | 128
Saudi Arabia | CN_SAUDIARABIA | 89
Senegal | CN_SENEGAL | 129
Serbia | CN_SERBIA | 130
Serbia and Montenegro | CN_SERBIAMONTENEGRO | 90
Singapore | CN_SINGAROPE | 91
Slovakia | CN_SLOVAKIA | 92
Slovenia | CN_SLOVENIA | 93
South Africa | CN_SOUTHAFRICA | 94
Spain | CN_SPAIN | 95
Sri Lanka | CN_SRILANKA | 131
Sweden | CN_SWEDEN | 96
Switzerland | CN_SWITZERLAND | 97
Syrian | CN_SYRIAN | 132
Taiwan | CN_TAIWAN | 98
Tajikistan | CN_TAJIKISTAN | 99
Thailand | CN_THAILAND | 100
Trinidad and Tobago | CN_TRINIDADTOBAGO | 101
Tunisia | CN_TUNISIA | 102
Turkey | CN_TURKEY | 103
Turkmenistan | CN_TURKMENISTAN | 133
Ukraine | CN_UKRAINE | 104
United Arab Emirates | CN_UAE | 105
United Kingdom | CN_UNITEDKINGDOM | 106
United States | CN_USA | 107
Uruguay | CN_URUGUAY | 108
Uzbekistan | CN_UZBEKISTAN | 109
Venezuela | CN_VENEZUELA | 110
Viet Nam | CN_VIETNAM | 111
Yemen | CN_YEMEN | 112
Zimbabwe | CN_ZIMBABWE | 113

Parameters

The function does not have parameters.

Return Value

If the function succeeds, the return value is the code of the user's country, otherwise it returns 0.

Remark

The function fails in the following cases:

  • the application is not protected.

Definition

Show/Hide C++ function definition

extern "C" __declspec( dllexport ) __stdcall int EP_MiscCountryCode();

Show/Hide Delphi function definition

function EP_MiscCountryCode : integer;

Show/Hide Visual Basic function definition

Public Declare Function EP_MiscCountryCode Lib "enigma_ide.dll" () As Long

Show/Hide C# (.NET) function definition

public class Enigma_IDE
{
    [DllImport("enigma_ide.dll", CallingConvention = CallingConvention.StdCall)]
    public static extern int EP_MiscCountryCode();
}

See function examples in the installation folder, Examples subfolder.


EP_MiscGetWatermark

The EP_MiscGetWatermark function returns watermarks contents. To learn more about watermarks, refer to Miscellaneous - Watermark.

Parameters

  • ID - the number of the watermark to return;
  • WM - a pointer to TWMContent struct. If this parameter is NULL, the function returns the count of watermarks;
  • WM.WMType - returns the watermark type;
  • WM.Name - a pointer to the buffer to return Name of the watermark to. If it is NULL, NameLen returns the required buffer length;
  • WM.NameLen - the size of the buffer for the watermark Name;
  • WM.Text - a pointer to the buffer to return Text of the watermark to. If it is NULL, TextLen returns the required buffer length;
  • WM.TextLen - the size of the buffer for the watermark Text;
  • WM.FileName - a pointer to the buffer to return FileName of the watermark to. If it is NULL, FileNameLen returns the required buffer length;
  • WM.FileNameLen - the size of the buffer for the watermark FileName;
  • WM.AFile - a pointer to the buffer to return File of the watermark to. If it is NULL, AFileLen returns the required buffer length;
  • WM.AFileLen - the size of the buffer for the watermark File;

Return Value

If the function succeeds, the return value is the count of watermarks.

If Name parameter of TWMContent is NULL or the length of the buffer that is placed into NameLen variable is less than required, the function returns the necessary buffer length in the NameLen variable.

If Text parameter of TWMContent is NULL or the length of the buffer that is placed into TextLen variable is less than required, the function returns the necessary buffer length in the TextLen variable.

If FileName parameter of TWMContent is NULL or the length of the buffer that is placed into FileNameLen variable is less than required, the function returns the necessary buffer length in the FileNameLen variable.

If AFile parameter of TWMContent is NULL or the length of the buffer that is placed into AFileLen variable is less than required, the function returns the necessary buffer length in the AFileLen variable.

If the function fails, the return value is 0.

Remark

The function fails in the following cases:

  • no watermarks in the protected file;
  • the application is not protected.

Definition

Show/Hide C++ function definition

extern "C" __declspec( dllexport ) __stdcall int EP_MiscGetWatermark( int ID, PWMContent WM );

Show/Hide Delphi function definition

function EP_MiscGetWatermark(ID : integer; WM : PWMContent) : integer; stdcall;

Show/Hide Visual Basic function definition

Public Declare Function EP_MiscGetWatermark Lib "enigma_ide.dll" (ByVal ID As Long, ByVal WM As TWMContent) As Long

Show/Hide C# (.NET) function definition

public class Enigma_IDE
{
    [DllImport("enigma_ide.dll", CallingConvention = CallingConvention.StdCall)]
    public static extern Int32 EP_MiscGetWatermark(Int32 ID, TWMContent WM);
}

Examples

Show/Hide Delphi function example

uses
  enigma_ide; // the module contains a definitions of Enigma API

procedure TForm1.FormShow(Sender: TObject);
var
  i : integer;
  wmc : TWMContent;
begin
  // Reading watermarks
  // function EP_MiscGetWatermark(0, nil) with null parameters
  // returns count of watermarks
  for i := 0 to EP_MiscGetWatermark(0, nil) - 1 do
  begin
    ZeroMemory(@wmc, sizeof(wmc));

    // Get lengths of params
    // when Name and/or Text and/or AFile params are null then EP_MiscGetWatermark
    // returns needed length buffers for these.
    EP_MiscGetWatermark(i, @wmc);

    GetMem(wmc.Name, wmc.NameLen + 1); // get memory +1 byte for null string terminating
    ZeroMemory(wmc.Name, wmc.NameLen + 1);
    GetMem(wmc.Text, wmc.TextLen + 1);
    ZeroMemory(wmc.Text, wmc.TextLen + 1);
    GetMem(wmc.FileName, wmc.FileNameLen + 1);
    ZeroMemory(wmc.FileName, wmc.FileNameLen + 1);
    // File length should be zero due to we do not get file content right now
    wmc.AFileLen := 0;

    // Get watermarks
    EP_MiscGetWatermark(i, @wmc);

    // Add watermarks to the list
    with ListView1.Items.Add do
    begin
      Indent := i;
      Caption := IntToStr(i);
      if wmc.WMType = WM_PUBLIC then
        SubItems.Add('PUBLIC')
      else
        SubItems.Add('PRIVATE');
      if strlen(wmc.Name) > 0 then
        SubItems.Add(wmc.Name)
      else
        SubItems.Add('');
      if strlen(wmc.Text) > 0 then
        SubItems.Add(wmc.Text)
      else
        SubItems.Add('');
      if strlen(wmc.FileName) > 0 then
        SubItems.Add(wmc.FileName)
      else
        SubItems.Add('');
    end;
    FreeMem(wmc.FileName);
    FreeMem(wmc.Text);
    FreeMem(wmc.Name);
  end;
end;

procedure TForm1.Button1Click(Sender: TObject);
var
  fs : TFileStream;
  wmc : TWMContent;
begin
  if ListView1.Selected = nil then Exit;
  if ListView1.Selected.Indent >= EP_MiscGetWatermark(0, nil) then Exit;

  ZeroMemory(@wmc, sizeof(wmc));

  // Get length of file name string and file
  EP_MiscGetWatermark(ListView1.Selected.Indent, @wmc);

  wmc.NameLen := 0;
  wmc.Text := 0;
  GetMem(wmc.FileName, wmc.FileNameLen + 1);
  ZeroMemory(wmc.FileName, wmc.FileNameLen + 1);
  GetMem(wmc.AFile, wmc.AFileLen);

  // Get file name and it's content
  EP_MiscGetWatermark(ListView1.Selected.Indent, @wmc);

  SaveDialog1.FileName := wmc.FileName;
  SaveDialog1.DefaultExt := ExtractFileExt(wmc.FileName);
  if SaveDialog1.Execute then
  begin
    try
      fs := TFileStream.Create(SaveDialog1.FileName, fmCreate);
      fs.Write(wmc.AFile^, wmc.AFileLen);
    finally
      fs.Free;
    end;
  end;
  FreeMem(wmc.AFile);
  FreeMem(wmc.FileName);
end;

See function examples in the installation folder, Examples\Watermarks subfolder.


EP_ProtectedStringByID

The EP_ProtectedStringByID function returns protected strings. See also Protection Features - Protected Strings.

Parameters

  • ID - the ID of the protected string - an integer value.
  • Buffer - a pointer to the buffer for the protected string. If this parameter is NULL, the function returns the necessary size of buffer.
  • Len - the size of the Buffer for the protected string.

Return Value

The function returns the size of the buffer for a protected string or 0 if the function fails.

Remark

The function fails in the following cases:

  • there is no protected string with the specified ID;
  • the application is not protected.

Definition

Show/Hide C++ function definition

extern "C" __declspec( dllimport ) __stdcall int EP_ProtectedStringByID( int Total, char* Buffer, int Len);

Show/Hide Delphi function definition

function EP_ProtectedStringByID(ID : integer; Buffer : pointer; Len : integer) : integer; stdcall;

Show/Hide Visual Basic function definition

Public Declare Function EP_ProtectedStringByID Lib "enigma_ide.dll" (ByVal ID As Long, ByVal Str As String, ByVal Length As Byte) As Byte

Show/Hide C# (.NET) function definition

public class Enigma_IDE
{
    [DllImport("enigma_ide.dll", CallingConvention = CallingConvention.StdCall)]
    public static extern Int32 EP_ProtectedStringByID(Int32 ID, IntPtr Buffer, Int32 Len);
}

Examples

Show/Hide Delphi function example

uses
  enigma_ide; // the module contains a definitions of Enigma API

procedure TForm1.FormShow(Sender: TObject);
var
  str : shortstring;
  len : byte;
  arr : array [0..MAX_STRING_SIZE - 1] of char;
  buflen : integer;
  buf : pointer;
begin
  // This method shows how to get protected string with using shortstring type
  len := EP_ProtectedStringByKey('fyi6z02Y', @str[1], sizeof(str));
  if len > 0 then
  begin
    str[0] := char(len);
    Edit1.Text := str;
  end;
  // This method show how to get string with char array
  ZeroMemory(@arr, sizeof(arr));
  if EP_ProtectedStringByID(1, @arr, sizeof(arr)) > 0 then
  begin
    Edit2.Text := arr;
  end;
  // This method gets string length and allocs buffer for the string
  buflen := EP_ProtectedStringByKey('26Lu66Er', nil, 0);
  if buflen > 0 then
  begin
    GetMem(buf, buflen + 1); // one byte is reserved for #0 symbol (like string terminator)
    ZeroMemory(buf, buflen + 1);
    if EP_ProtectedStringByKey('26Lu66Er', buf, buflen) > 0 then
    begin
      Edit3.Text := PAnsiChar(buf);
    end;
    FreeMem(buf);
  end;
end;

Show/Hide C# (.NET) function example

public class Enigma_IDE
{
    public static string EP_ProtectedStringByIDAsAnsiString(int ID)
    {
        Int32 len = EP_ProtectedStringByID(ID, IntPtr.Zero, 0);
        if (len > 0)
        {
            byte[] buffer = new byte[len];
            if (EP_ProtectedStringByID(ID, Marshal.UnsafeAddrOfPinnedArrayElement(buffer, 0), len) > 0)
            {
                return Encoding.ASCII.GetString(buffer);
            }
        }
        return string.Empty;
    }

    public static string EP_ProtectedStringByIDAsWideString(int ID)
    {
        Int32 len = EP_ProtectedStringByID(ID, IntPtr.Zero, 0);
        if (len > 0)
        {
            byte[] buffer = new byte[len];
            if (EP_ProtectedStringByID(ID, Marshal.UnsafeAddrOfPinnedArrayElement(buffer, 0), len) > 0)
            {
                return Encoding.Unicode.GetString(buffer);
            }
        }
        return string.Empty;
    }
}

private void Form1_Shown(object sender, EventArgs e)
{
    textBox1.Text = Enigma_IDE.EP_ProtectedStringByIDAsAnsiString(1);
    textBox2.Text = Enigma_IDE.EP_ProtectedStringByIDAsWideString(2);
}

Show/Hide Visual Basic function example

Private Sub Form_Load()
Dim Lenght As Byte
Dim Str As String

Length = EP_ProtectedStringByKey("fyi6z02Y", vbNullString, 0)
Str = String$(Length, 0)
If EP_ProtectedStringByKey("fyi6z02Y", Str, Length) > 0 Then
  Text1.Text = Str
End If

Length = EP_ProtectedStringByID(1, vbNullString, 0)
Str = String$(Length, 0)
If EP_ProtectedStringByID(1, Str, Length) > 0 Then
  Text2.Text = Str
End If

Length = EP_ProtectedStringByKey("26Lu66Er", vbNullString, 0)
Str = String$(Length, 0)
If EP_ProtectedStringByKey("26Lu66Er", Str, Length) > 0 Then
  Text3.Text = Str
End If

See function examples in the installation folder, Examples\ProtectedStrings subfolder.


EP_ProtectedStringByKey

The EP_ProtectedStringByKey function returns protected strings. See also Protection Features - Protected Strings.

Parameters

  • Key - a pointer to the null terminated string that contains a key of the protected string.
  • Buffer - a pointer to the buffer for the protected string. If this parameter is NULL, the function returns the necessary size of the buffer.
  • Len - the size of the buffer for the protected string.

Return Value

The function returns the size of the buffer for a protected string or 0 if the function fails.

Remark

The function fails in the following cases:

  • there is no protected string with the specified Key;
  • the application is not protected.

Definition

Show/Hide C++ function definition

extern "C" __declspec( dllimport ) __stdcall int EP_ProtectedStringByKey( char* Key, char* Buffer, int Len);

Show/Hide Delphi function definition

function EP_ProtectedStringByKey(Key : PAnsiChar; Buffer : pointer; Len : integer) : integer; stdcall;

Show/Hide Visual Basic function definition

Public Declare Function EP_ProtectedStringByKey Lib "enigma_ide.dll" (ByVal Key As String, ByVal Str As String, ByVal Length As Byte) As Byte

Show/Hide C# (.NET) function definition

public class Enigma_IDE
{
    [DllImport("enigma_ide.dll", CallingConvention = CallingConvention.StdCall)]
    public static extern Int32 EP_ProtectedStringByKey(string Key, IntPtr Buffer, Int32 Len);
}

Examples

Show/Hide Delphi function example

uses
  enigma_ide; // the module contains a definitions of Enigma API

procedure TForm1.FormShow(Sender: TObject);
var
  str : shortstring;
  len : byte;
  arr : array [0..MAX_STRING_SIZE - 1] of char;
  buflen : integer;
  buf : pointer;
begin
  // This method shows how to get protected string with using shortstring type
  len := EP_ProtectedStringByKey('fyi6z02Y', @str[1], sizeof(str));
  if len > 0 then
  begin
    str[0] := char(len);
    Edit1.Text := str;
  end;
  // This method show how to get string with char array
  ZeroMemory(@arr, sizeof(arr));
  if EP_ProtectedStringByID(1, @arr, sizeof(arr)) > 0 then
  begin
    Edit2.Text := arr;
  end;
  // This method gets string length and allocs buffer for the string
  buflen := EP_ProtectedStringByKey('26Lu66Er', nil, 0);
  if buflen > 0 then
  begin
    GetMem(buf, buflen + 1); // one byte is reserved for #0 symbol (like string terminator)
    ZeroMemory(buf, buflen + 1);
    if EP_ProtectedStringByKey('26Lu66Er', buf, buflen) > 0 then
    begin
      Edit3.Text := PAnsiChar(buf);
    end;
    FreeMem(buf);
  end;
end;

Show/Hide C# (.NET) function example

public class Enigma_IDE
{
    public static string EP_ProtectedStringByKeyAsAnsiString(string Key)
    {
        Int32 len = EP_ProtectedStringByKey(Key, IntPtr.Zero, 0);
        if (len > 0)
        {
            byte[] buffer = new byte[len];
            if (EP_ProtectedStringByKey(Key, Marshal.UnsafeAddrOfPinnedArrayElement(buffer, 0), len) > 0)
            {
                return Encoding.ASCII.GetString(buffer);
            }
        }
        return string.Empty;
    }
    public static string EP_ProtectedStringByKeyAsWideString(string Key)
    {
        Int32 len = EP_ProtectedStringByKey(Key, IntPtr.Zero, 0);
        if (len > 0)
        {
            byte[] buffer = new byte[len];
            if (EP_ProtectedStringByKey(Key, Marshal.UnsafeAddrOfPinnedArrayElement(buffer, 0), len) > 0)
            {
                return Encoding.Unicode.GetString(buffer);
            }
        }
        return string.Empty;
    }
}

private void Form1_Shown(object sender, EventArgs e)
{
    textBox1.Text = Enigma_IDE.EP_ProtectedStringByKeyAsAnsiString("fyi6z02Y");
    textBox2.Text = Enigma_IDE.EP_ProtectedStringByKeyAsWideString("26Lu66Er");
}

Show/Hide Visual Basic function example

Private Sub Form_Load()
Dim Lenght As Byte
Dim Str As String

Length = EP_ProtectedStringByKey("fyi6z02Y", vbNullString, 0)
Str = String$(Length, 0)
If EP_ProtectedStringByKey("fyi6z02Y", Str, Length) > 0 Then
  Text1.Text = Str
End If

Length = EP_ProtectedStringByID(1, vbNullString, 0)
Str = String$(Length, 0)
If EP_ProtectedStringByID(1, Str, Length) > 0 Then
  Text2.Text = Str
End If

Length = EP_ProtectedStringByKey("26Lu66Er", vbNullString, 0)
Str = String$(Length, 0)
If EP_ProtectedStringByKey("26Lu66Er", Str, Length) > 0 Then
  Text3.Text = Str
End If

See function examples in the installation folder, Examples\ProtectedStrings subfolder.


EP_SplashScreenShow

The EP_SplashScreenShow function forces showing of a splash screen. If the Splash Screen is already shown, the function does nothing. It returns a handle of the Splash Screen window, you may place your own controls onto this window. Splash Screen feature should be enabled, otherwise the function will fail, see MISCELLANEOUS - Splash Screen.

Return Value

The function returns the handle of the splash screen window, or zero if it fails.

Definition

Show/Hide C++ function definition

extern "C" __declspec( dllimport ) __stdcall int EP_SplashScreenShow();

Show/Hide Delphi function definition

function EP_SplashScreenShow : Cardinal;

Show/Hide Visual Basic function definition

Public Declare Function EP_SplashScreenShow Lib "enigma_ide.dll" () As Long

Show/Hide C# (.NET) function definition

public class Enigma_IDE
{
    [DllImport("enigma_ide.dll", CallingConvention = CallingConvention.StdCall)]
    public static extern int EP_SplashScreenShow();
}

Examples

Show/Hide Delphi function example

unit test_unit;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, CommCtrl, ExtCtrls;

type
  TForm1 = class(TForm)
    Label1: TLabel;
    lbTime: TLabel;
    btnClose: TButton;
    tTimer: TTimer;
    procedure btnCloseClick(Sender: TObject);
    procedure FormShow(Sender: TObject);
    procedure tTimerTimer(Sender: TObject);
  private
    { Private declarations }
    FProgressHandle : dword;
    FPercent : integer;
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

uses enigma_ide;

{$R *.dfm}

procedure TForm1.btnCloseClick(Sender: TObject);
begin
  Close;
end;

procedure TForm1.FormShow(Sender: TObject);
var
  wnd : dword;
begin
  lbTime.Caption := TimeToStr(Now);
  // Show nag
  wnd := EP_SplashScreenShow;
  if wnd <> 0 then
  begin
    // Create progress bar
    FPercent := 0;
    FProgressHandle := CreateWindowEx(0, PROGRESS_CLASS, nil, WS_CHILD or WS_VISIBLE, 20, 350, 490, 30, wnd, 0, 0, nil);
    SendMessage(FProgressHandle, PBM_SETRANGE, 0, MAKELPARAM(0, 100));
    SendMessage(FProgressHandle, PBM_SETSTEP, 1, 0);
    tTimer.Enabled := true;
  end;
end;

procedure TForm1.tTimerTimer(Sender: TObject);
begin
  if FPercent >= 100 then
  begin
    tTimer.Enabled := false;
    DestroyWindow(FProgressHandle);
    EP_SplashScreenHide;
    SetForegroundWindow(Self.Handle);
  end;
  SendMessage(FProgressHandle, PBM_STEPIT, 0, 0);
  inc(FPercent);
end;

end.

See examples in the Examples\SplashScreen folder.


EP_SplashScreenHide

The EP_SplashScreenHide function hides the Splash Screen (if it is shown). See MISCELLANEOUS - Splash Screen.

Definition

Show/Hide C++ function definition

extern "C" __declspec( dllimport ) __stdcall void EP_SplashScreenHide();

Show/Hide Delphi function definition

procedure EP_SplashScreenHide;

Show/Hide Visual Basic function definition

Public Declare Function EP_SplashScreenHide Lib "enigma_ide.dll" ()

Show/Hide C# (.NET) function definition

public class Enigma_IDE
{
    [DllImport("enigma_ide.dll", CallingConvention = CallingConvention.StdCall)]
    public static extern void EP_SplashScreenHide();
}

Examples

Show/Hide Delphi function example

unit test_unit;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, CommCtrl, ExtCtrls;

type
  TForm1 = class(TForm)
    Label1: TLabel;
    lbTime: TLabel;
    btnClose: TButton;
    tTimer: TTimer;
    procedure btnCloseClick(Sender: TObject);
    procedure FormShow(Sender: TObject);
    procedure tTimerTimer(Sender: TObject);
  private
    { Private declarations }
    FProgressHandle : dword;
    FPercent : integer;
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

uses enigma_ide;

{$R *.dfm}

procedure TForm1.btnCloseClick(Sender: TObject);
begin
  Close;
end;

procedure TForm1.FormShow(Sender: TObject);
var
  wnd : dword;
begin
  lbTime.Caption := TimeToStr(Now);
  // Show nag
  wnd := EP_SplashScreenShow;
  if wnd <> 0 then
  begin
    // Create progress bar
    FPercent := 0;
    FProgressHandle := CreateWindowEx(0, PROGRESS_CLASS, nil, WS_CHILD or WS_VISIBLE, 20, 350, 490, 30, wnd, 0, 0, nil);
    SendMessage(FProgressHandle, PBM_SETRANGE, 0, MAKELPARAM(0, 100));
    SendMessage(FProgressHandle, PBM_SETSTEP, 1, 0);
    tTimer.Enabled := true;
  end;
end;

procedure TForm1.tTimerTimer(Sender: TObject);
begin
  if FPercent >= 100 then
  begin
    tTimer.Enabled := false;
    DestroyWindow(FProgressHandle);
    EP_SplashScreenHide;
    SetForegroundWindow(Self.Handle);
  end;
  SendMessage(FProgressHandle, PBM_STEPIT, 0, 0);
  inc(FPercent);
end;

end.

See examples in the Examples\SplashScreen folder.


EP_CheckupVirtualizationTools

The EP_CheckupVirtualizationTools function allows checking if the file is started under any of the known Virtualization Tools like VMWare/VirtualBox/VirtualPC. Note that you have to enable the CHECK-UP - Virtualization Tools feature, select the necessary virtualization tools you would like to check and disable the Terminate Execution option.

Return Value

The function returns 1 (true) if the file is started under any virtualization tool or 0 (false) if the function fails. See the Remark section below for the cases of function failure.

Remark

The function fails in the following cases:

  • the application is not protected;
  • the CHECK-UP - Virtualization Tools feature is not enabled;
  • necessary Virtualization Tools for checking have not been selected in the CHECK-UP - Virtualization Tools panel.

Definition

Show/Hide C++ function definition

extern "C" __declspec( dllimport ) __stdcall BOOL EP_CheckupVirtualizationTools();

Show/Hide Delphi function definition

function EP_CheckupVirtualizationTools : boolean;

Show/Hide Visual Basic function definition

Public Declare Function EP_CheckupVirtualizationTools Lib "enigma_ide.dll" () As Boolean

Show/Hide C# (.NET) function definition

public class Enigma_IDE
{
    [DllImport("enigma_ide.dll", CallingConvention = CallingConvention.StdCall)]
    public static extern bool EP_CheckupVirtualizationTools();
}

Examples

Show/Hide Delphi function example

uses
  Windows,
  SysUtils,
  enigma_ide in '..\..\..\EnigmaSDK\Delphi\enigma_ide.pas';

begin
  if not EP_CheckupIsProtected then
  begin
    MessageBox(0, 'Please protect application before start!', 'Test', MB_OK or MB_ICONERROR);
    Exit;
  end;
  if EP_CheckupVirtualizationTools then
  begin
    MessageBox(0, 'Virtualization Tools like VMWare/VirtualBox/VirtualPC had been found!', 'Test', MB_OK or MB_ICONWARNING);
  end else
  begin
    MessageBox(0, 'No Virtualization Tools had been found...'#13#10'Program is probably started under real Windows system or'#13#10'Virtualization Tools check up is not enabled in Enigma Protector.', 'Test', MB_OK or MB_ICONINFORMATION);
  end;
end.

See function examples in the installation folder, Examples\CheckVirtualizationTools subfolder.


EP_LoadConfiguration

EP_LoadConfiguration allows to load configuration settings for enigma_ide.dll/enigma_ide64.dll from .ini file, for debugging purposes of non protected application. See more: Debugging with enigma_ide.dll

Return Value

Returns true (1) if succeeded or false (0) if failed

Definition

Show/Hide Delphi function definition

function EP_LoadConfiguration(AFileName : PAnsiChar) : boolean; {$IFDEF WIN32}stdcall;{$ENDIF}
function EP_LoadConfigurationA(AFileName : PAnsiChar) : boolean; {$IFDEF WIN32}stdcall;{$ENDIF}
function EP_LoadConfigurationW(AFileName : PWideChar) : boolean; {$IFDEF WIN32}stdcall;{$ENDIF}

Show/Hide Visual Basic function definition

Public Declare Function EP_LoadConfiguration Lib "enigma_ide.dll" (ByVal FileName As String) As Boolean
Public Declare Function EP_LoadConfigurationA Lib "enigma_ide.dll" (ByVal FileName As String) As Boolean

Show/Hide C# (.NET) function definition

public class Enigma_IDE
{
    [DllImport("enigma_ide.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
    public static extern bool EP_LoadConfiguration(string FileName);
    [DllImport("enigma_ide.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
    public static extern bool EP_LoadConfigurationA(string FileName);
    [DllImport("enigma_ide.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.StdCall)]
    public static extern bool EP_LoadConfigurationW(string FileName);
}


How to Use Enigma API

Enigma Protector allows using Enigma API through the call of enigma_ide.dll (for 32 bit files, or enigma_ide64.dll for 64 bit) functions from import table or through the pair of functions GetModuleHandle/LoadLibrary and GetProcAddress. Note, that Enigma API uses stdcall calling conversion for 32 bit files. The common method of Enigma API usage (through importing Enigma API) can be found in the Enigma Protector installation folder, Examples subfolder.

While application, that is used Enigma API functions, is not protected, it requires the file enigma_ide.dll/enigma_ide64.dll to run. Please check the description how this works, features of enigma_ide.dll and common usage way: Debugging with enigma_ide.dll

Here are examples demonstrating one more way to call Enigma API:

Delphi

var
  pEP_RegHardwareID : function : PAnsiChar;
  pEP_RegCheckKey : function(pcName, pcKey : PAnsiChar) : boolean;
  pcName : PAnsiChar;
  pcKey : PAnsiChar;

begin
  // Show message box with a Hardware ID
  pEP_RegHardwareID := GetProcAddress(GetModuleHandle('enigma_ide.dll'), 'EP_RegHardwareID');
  MessageBox(0, pEP_RegHardwareID, 'Application' , MB_OK);
  // Check registration infomation
  pcName := 'Registration Info';
  pcKey := 'Registration Key';
  pEP_RegCheckKey := GetProcAddress(GetModuleHandle('enigma_ide.dll'), 'EP_RegCheckKey');
  if pEP_RegCheckKey(pcName, pcKey) then
    MessageBox(0, 'Valid Registration Key', 'Application', MB_OK)
  else
    MessageBox(0, 'Invalid Registration Key', 'Application', MB_OK)
end;


How to Use Enigma API

Debugging with enigma_ide.dll

If you are developing the application that uses Enigma API funtions, such application will require the file enigma_ide.dll (for 32 bit application) or enigma_ide64.dll (for 64 bit application) to run. Note, these files are required to run application until it is not protected! After protection these files are not required anymore and should not be distributed with your application to end customers.

However, it is often required to debug the application while development. In this case, enigma_ide.dll/enigma_ide64.dll should be kept in the same folder with the compiled application. By default, any Enigma API function called inside unprotected application will fail (return empt results), because they are being called from enigma_ide.dll that exports Enigma API functions but returns no real results. Enigma API functions start to work and return real information only after protection.

If developer needs to emulate the work of Enigma API functions in unprotected application, like it is protected, the .ini file with the necessary configuration can be used together with enigma_ide.dll. Examples of enigma_ide.ini/enigma_ide64.ini files you can find in Examples folder of installed Enigma Protector. Configuration file enigma_ide.ini should be placed in the same folder with enigma_ide.dll, that reads it at startup. enigma_ide.ini file contains settings that allow to overwrite the default values returned by enigma_ide.dll to any custom, to emulate work of Enigma API functions until the main file is not protected.

enigma_ide.ini has the following structure and may contains the following parameters:

# This is a sample file with parameters for Enigma API functions worked under enigma_ide.dll/enigma_ide64.dll when the file is NOT protected, used to emulate Enigma API functions result, while development and debugging of NON protected application.
# Until the file that uses Enigma API is protected, it uses dummy Enigma API functions provided by empty libraries enigma_ide.dll/enigma_ide64.dll
# When file is not protected, all Enigma API functions fail/return empty results.
# To simulate working of Enigma API functions (like they will work after protection), this enigma_ide.ini/enigma_ide64.ini file can be used.
# Here you can overwrite the results that Enigma API functions returns until file is protected, for debuginning purpose.
# NOTE: same as enigma_ide.dll/enigma_ide64.dll, enigma_ide.ini/enigma_ide64.ini are not required by protected file! These files should not be distributed with protected software!
# Put this file in the folder of your appliaction (in the same folder with enigma_ide.dll/enigma_ide64.dll)

[Global]
# Parameters:
# ShowDialogs - set to 1 to show simple MessageBox when the dialog functions are called (like EP_RegistrationShowDialog, EP_ActivationShowDialog, EP_SplashScreenShow)
ShowDialogs=0

[Activation]
# Parameters:
# ActivationSucceeded - set to 0 or 1 if activation failed or succeeded
# DeactivationSucceeded - set to 0 or 1 if deactivation failed or succeeded
ActivationSucceeded=0
DeativationSucceeded=0

[Registration]
# Parameters:
# Unicode - set to 1 if registration scheme is Unicode in the Registration Features - Common settings
# SaveKey - set to 0 or 1 if save key functions fail or succeed
# LoadKey - set to 0 or 1 if load key functions fail or succeed
# CheckKey - set to 0 or 1 if check key functions fail or succeed
# DeleteKey - set to 0 or 1 if delete key functions fail or succeed
# HardwareID - HardwareID string
# RegistrationName - registration name string
# RegistrationKey - registration key string
# KeyStatus - return value for function EP_RegKeyStatus
# KeyInformation - set to 0 or 1 if key information functions fail or succeed
# KeyInformationStolen - determines the Stolen parameter from TKeyInformation structure, set to 0 or 1
# KeyInformationEncryptedSections - EncryptedSections array from TKeyInformation structure, set 0 or 1 for section to disable/enable it, must be a string of 16 characters
# KeyInformationCountryCode - determines the CountryCode parameter from TKeyInformation structure
# EncryptRegistrationInformation - return value for functions EP_RegEncryptRegistrationInformation, EP_RegDecryptRegistrationInformation
# CreationDateYear
# CreationDateMonth
# CreationDateDay - registration key creation date
# ExpirationDateYear
# ExpirationDateMonth
# ExpirationDateDay - registration key expiration date. Set Year, Month and Day values to enable key expiration date
# ExecutionsTotal
# ExecutionsLeft - total and left number of executions limited by registration key. To enable executions limit in registration key, the ExecutionsTotal parameter should be set to any other value than zero
# DaysTotal
# DaysLeft - total and left number of days limited by registration key. To enable days limit in registration key, the DaysTotal parameter should be set to any other value than zero
# RuntimeTotal
# RuntimeLeft - total and left number of runtime minutes limited by registration key. To enable runtime limit in registration key, the RuntimeTotal parameter should be set to any other value than zero
# GlobalTimeTotal
# GlobalTimeLeft - total and left number of global time minutes limited by registration key. To enable global time limit in registration key, the GlobalTimeTotal parameter should be set to any other value than zero
# RegisterAfterDateYear
# RegisterAfterDateMonth
# RegisterAfterDateDay - registration key register after date. Set Year, Month and Day values to enable key register after date
# RegisterBeforeDateYear
# RegisterBeforeDateMonth
# RegisterBeforeDateDay - registration key register before date. Set Year, Month and Day values to enable key register before date
Unicode=0
SaveKey=0
LoadKey=0
CheckKey=0
DeleteKey=0
HardwareID=
RegistrationName=
RegistrationKey=
KeyStatus=0
KeyInformation=0
KeyInformationStolen=0
KeyInformationEncryptedSections=0000000000000000
KeyInformationCountryCode=0
EncryptRegistrationInformation=0
CreationDateYear=0
CreationDateMonth=0
CreationDateDay=0
ExpirationDateYear=0
ExpirationDateMonth=0
ExpirationDateDay=0
ExecutionsTotal=0
ExecutionsLeft=0
DaysTotal=0
DaysLeft=0
RuntimeTotal=0
RuntimeLeft=0
GlobalTimeTotal=0
GlobalTimeLeft=0
RegisterAfterDateYear=0
RegisterAfterDateMonth=0
RegisterAfterDateDay=0
RegisterBeforeDateYear=0
RegisterBeforeDateMonth=0
RegisterBeforeDateDay=0

[Trial]
# Parameters:
# ExecutionsTotal
# ExecutionsLeft - total and left number of trial executions. To enable trial limit by executions number, the ExecutionsTotal parameter should be set to any other value than zero
# ExecutionTimeTotal
# ExecutionTimeLeft - total and left number of minutes for trial execution time limit. To enable trial limit by execution time, the ExecutionTimeTotal parameter should be set to any other value than zero
# DaysTotal
# DaysLeft - total and left number of trial days. To enable trial limit by days, the DaysTotal parameter should be set to any other value than zero
# ExpirationDateYear
# ExpirationDateMonth
# ExpirationDateDay - trial limitation by expiration date. Set Year, Month and Day values to enable trial expiration date
# DateTillDateStartYear
# DateTillDateStartMonth
# DateTillDateStartDay
# DateTillDateEndYear
# DateTillDateEndMonth
# DateTillDateEndDay - trial limitation from date till date. Set all 6 parameters to enable trial limitaion from date till date
# ClockReversedDays - number of days for clock reversing function EP_TrialClockReversedDays
ExecutionsTotal=0
ExecutionsLeft=0
ExecutionTimeTotal=0
ExecutionTimeLeft=0
DaysTotal=0
DaysLeft=0
ExpirationDateYear=0
ExpirationDateMonth=0
ExpirationDateDay=0
DateTillDateStartYear=0
DateTillDateStartMonth=0
DateTillDateStartDay=0
DateTillDateEndYear=0
DateTillDateEndMonth=0
DateTillDateEndDay=0
ClockReversedDays=0

[ProtectedStrings]
# Enumerate Protected Strings that are returned by EP_ProtectedStringByID/EP_ProtectedStringByKey functions
# Parameter name is ID or Key, parameter value is a protected string
# Example:
# 1=Protected String by ID
# hidden=Protected String by Key

[Other]
# CountryCode - return value for EP_MiscCountryCode function
# CryptHash - return value for functions that calculate hash
# CryptEncrypt - return value for encryption functions
# CryptDecrypt - return value for decryption functions
# CopiesTotal
# CopiesLeft - total and left number of copies of running application
# Protected - set to 0 or 1 as a return value of function EP_CheckupIsProtected
# OK - set to 0 or 1 as a return value of function EP_CheckupIsEnigmaOk
# Version - set to 0 or 1 as a return value of function EP_EnigmaVersion
# FindProcess - return value for find process functions
# VirtualizationTools - set to 0 or 1 as a return value of function EP_CheckupVirtualizationTools
# ProtectionDateYear
# ProtectionDateMonth
# ProtectionDateDay - date of file protection
CountryCode=0
CryptHash=0
CopiesTotal=0
CopiesCurrent=0
Protected=0
OK=0
Version=0
FindProcess=0
VirtualizationTools=0
ProtectionDateYear=0
ProtectionDateMonth=0
ProtectionDateDay=0

By settings different configuration parameters to .ini file, Enigma API functions will return non default/empty results while debugging.

If it is needed to load different configuration parameters while debugging of application, the Enigma API function LoadConfiguration/LoadConfigurationW can be called. Function has one parameter - file name for the new configuration .ini file (Ansi string for LoadConfiguration and Wide string for LoadConfigurationW).


FAQ

In these sections you will find the answers to the most frequently asked questions.

  • API FAQ - questions about using The Enigma API.
  • Keys Generator FAQ - questions about using the built-in and customized generators of registration keys.
  • Protector FAQ - questions about the work of the protector features.
  • Other FAQ - all questions not related to the other topics.
  • Registration Manager FAQ - questions regarding Enigma Protector Registration Manager.
  • Mailer FAQ - questions regarding Enigma Protector Mailer.


API FAQ

Q: I'm a Visual Basic developer and I can't figure out why Enigma API failed after execution? Here is the part of my sources:

If EP_RegLoadAndCheckKey = TRUE Then
  ' ****************
End If
The codes between If - End If have never been executed.

A: You have a mistake in the first line of the above source, the expression EP_RegLoadAndCheckKey = TRUE will never be executed in Visual Basic. It occurs due to the peculiarities of the Visual Basic language, where a TRUE value means $FFFF, a FALSE value means 0, but Enigma API's return 0 if a function fails or 1 if it succeeds. Use the following scheme to solve your problem:

If EP_RegLoadAndCheckKey Then
  ' ****************
End If

Q: Do I need to distribute enigma_api.dll with the protected module?

A: No, you don't, enigma_api.dll is just am empty library which exports empty Enigma API's. This library is used for debugging of a non-protected module in development, so this library is not needed after the module is protected.

Q: Is it possible to use Enigma API with Visual Basic .NET applications?

A: Yes, it is possible! Enigma API definitions for Visual Basic .NET are similar to the Visual Basic ones. See Example\ folder for examples of API usage and EnigmaSDK\VB\ for API definitions.


Keys Generator FAQ

Q: I have two softwares protected with Enigma Protector, both are installed on the same computer. When I run the first software and register, it works fine. Then run second application, register and it also works good. But then start the first one again and it again asks for registration. Why it keeps asking for registration every time I run it?

A: There are two common ways why this happens:

  • Make sure the registration information is being saved to the system after successful registration. To test that, run one of programs multiple times, if it asks for registration just at the first launch, then see the second advice. If it asks for registration every start, then probably, Enigma Protector is unable to save license key to the local system. This often happens when selected path for storing of license keys is write protected (like the registry path of HKEY_LOCAL_MACHINE is the file run without administrator privileges). Check settings at Registration Features - Common - Registration Data Storing panel
  • You have the same settings for Registration Features - Common - Registration Data Storing panel for both projects, so license key of one application overwrites license key of another. Set the different locations for storing of license keys for these applications.

Q: I'm using a unicode registration scheme, how can I generate registration keys with unicode support?

A: After you have selected the unicode registration scheme check box in the Registration Features - Common panel, the Keys Generator (which is accessed through the Main Menu) and keys generator of License Manager automatically begin generating unicode registration keys. To generate registration keys with unicode support with CGI keys generator or keygen.dll, you have to use actions (for CGI keys generator) and functions (for keygen.dll) with a W prefix.

Q: I have a few applications protected with Enigma. All applications require a registration key to run. If I register one of the program with a registration key, other programs become registered too, but I want to register each application with its own registration key... What am I doing wrong?

A: If all applications accept one registration key, this means that all of them are protected with the same project file. To have a unique registration scheme for each application, you need to create a new project in Enigma for each protected program. Each new project has unique secure registration parameters that are used for generating registration keys, so after you create a new project, each program will be registered with its own registration key.

Q: I have several users who are able to generate registration keys for our software. I need some service to provide simultaneous access to the keys database and to the keys generator by several users. How can I place a custom registration keys generator into a share folder?

A: We have a great idea about how to grant access to the keys base and keys generator by means of MS Access service. See the Custom Keys Generator help topic, KeyGen subtopic on the shared folder.


Other FAQ

Q: I need a special build of The Enigma Protector with extended options. Can you make it?

A: Yes, it is possible. But your offer should contain legality and safety rights! Please, contact our support team by email at support@enigmaprotector.com.


Protector FAQ

Q: I have lost The Enigma Protector project file and I can't protect my module again and can't generate registration keys for current module, how can I fix it?

A: Sorry, but this is impossible. The Enigma Protector project file contains several unique constants that are used for key generation. These constants are generated when a project is created and have random contents, and therefore we can't restore them! Please, make backup copies of your project files!

Q: I have several versions of my software, one is protected with The Enigma Protector, the other is not. How can I check whether the current version is protected?

A: Check if the Enigma API functions exist, and if EP_CheckupIsProtected returns TRUE (means the file is protected). See the following Delphi example:

function IsEnigmaPresent : boolean;
var
  pEP_CheckupIsProtected : function : boolean;
begin
  Result := false;
  pEP_CheckupIsProtected := GetProcAddress(GetModuleHandle('enigma_ide.dll'), 'EP_CheckupIsProtected');
  if @pEP_CheckupIsProtected <> nil then
  begin
    Result := pEP_CheckupIsProtected;
  end;
end;

A (OLD, not recommended): This can be solved by using a Reg_Crypt macros. See the following Delphi example:

function IsEnigmaPresent : boolean;
begin
  Result := true;
  // this code returns TRUE at any ways,
  // but we should use it to fighting
  // with the Delphi code optimization
  if GetModuleHandle(nil) <> 0 then
  begin
    {$I reg_crypt_begin1.inc}
    Result := false;
    {$I reg_crypt_end1.inc}
  end;
end;


Registration Manager FAQ

Q: Where does Enigma Protector store the registrations database?

A: Enigma Protector stores the database (registrations & customers information) in a file with the same name as the project file but with a .enigmadb extension.


Mailer FAQ

Q: Where does Enigma Protector store Mailer settings/database?

A: Enigma Protector stores Mailer settings and emails database in a file with the same name as the project file but with .enigmamail extension.

Q: I can't send emails with my gmail account, Mailer reports error...?

A: Gmail does not allow insecure connection (which is used by default), to solve the problem just enable the SSL option in mailer properties.


Getting Started

The most important thing in module protection is the correctness of protection scheme building. Even the most sophisticated protection options can be easily eliminated by crackers in case you made an error while applying the protection. There are several pieces of advice one has to follow to make module protection really difficult for cracking:

  • if you are using registration keys features, it is strongly recommended to use crypt macros to limit the functionality of a module. The crypt macros are the highest protection feature, the code between the macros is deciphered only when the module is registered. The unique key data for deciphering are placed only in the registration key, so it is impossible to crack the module without a registration key.
  • the common mistake of software developers is using trial features without any trial limitations. Do not make a trial application fully functional. There are no hundred-per-cent methods to make trial limitations uncrackable, the trial can only provide much more time to make your application stable against cracker attacks.
  • only demonstration versions can fully secure you against crackers. A demonstration version contains only basic functions and has no any special features. These versions can't be cracked because these just don't contain necessary sources.

Let's go!

To create a protection scheme for the module, follow these steps:

  1. Create a unique Enigma project.
  2. Select necessary input parameters.
  3. Select protection parameters.
  4. (Optional) Select trial parameters.
  5. (Optional) Select registration key parameters.
  6. (Optional) Modification of the module source code.
  7. Module protection.


Choosing input parameters

Input parameters are the most important thing needed to start the protection, here are the basic parameters:

  1. the file name to protect, make sure that the file is supported by Enigma Protector
  2. the name and version of the product (module), this information must be unique for every project since it is used to create some unique protection parameters
  3. the file name of the protected module.


Choosing protection parameters

Choose the necessary protection parameters.

  • Check-Up
  • Protection Features
  • Obfuscation
  • Miscellaneous


Creating a protection project

Creating a protection project is the most important part in building the protection security for the protected module. A project file has a set of protection parameters and several unique constants which are used for generation and verification of registration keys. Unique constants are generated randomly every time a project is created and their coincidence for several projects is impossible.

Warnings:

  • Do not use project files distributed with the example programs of the Enigma Protector! These files can be used by anyone, so anyone will be able to generate registration keys for your project.
  • Make a backup copy of the existing project file! In case the project file is lost, you will not be able to restore the unique data and generate registration keys for the existing project!


Registration keys features

Choosing parameters used for registration keys features. The Enigma Protector supports options to generate registration keys for protected modules that will allow you to easily convert software to shareware and distribute registration keys to customers. The registration keys create dependencies on user information, user's hardware (optional), key creation date, key expiration date (optional), names of crypted sections (optional). These features provide a flexible system to create protection of the existing modules with limited usage. A dissymmetric algorithm of enciphering identical to RSA algorithm with a 512-bit length is used to create registration keys. It provides an exceptionally high level of security for the protected module, preventing the reconstruction or reversing of a registration key. It is necessary to define the parameters of registration information storage and type of hardware locking before module protection (See Program Overview)

The registration of the protected module can be carried out in the following ways:

  1. Use of files with the registration information. Subject to the selected registration info storage option, it can be sent to user as a reg file (the user will need to add data from the reg file to the Windows registry by running the file) or as a key file (the file with the registration information will have to be copied into the folder specified in the Registration data storing panel).
  2. Use of internal Enigma API functions for checking, reading, saving, deleting the registration information. In this case you should make respective alterations in the source code of the module, provide dialog windows for entering the registration information, provide the registration information for checking and saving.


Trial limitations

Choosing trial period parameters. This feature serves for limiting the usage period of an unregistered version of the protected module on the user's PC. The Enigma Protector supports the following types of trial limitations: by count of module executions, by count of usage days, by expiration date. All trial limitations can be controlled manually by using Enigma API, in this case you can fully control the trial counter and make a handler for any changes (for example, you can warn a user to register the protected module several days/executions before the trial expiration). In case you don't use Enigma API, you can define the type of a trial expiration event manually in the TRIAL CONTROL panel. Also, The Enigma Protector supports reminder messages (nag-screens) for the protected module, the reminder message is intermittently displayed during the work of the module with a predefined time interval. Is not a secret that some users may set the system clock backward to restore the functionality of the protected module - to prevent this, Enigma has a feature to detect system clock reversing. Rest assured, the system clock checkup is not related to the trial limitation so it will not be disabled after the module registration

Warning: all the above trial limitations will be lifted after the protected module is registered. Refer to Program Overview for a detailed description of trial features.


Keys generator

This section explains how to use the key generator. Use the following links to get detailed information:

  • Creating Keys
  • Key Verification
  • Custom Key Generator
  • Export Key Generator
  • License Manager
  • CGI Key Generator (Web based)


Creating Keys

To create a registration key for the existing project you can use special Enigma Protector service - registration key generator. The generator of registration keys can be built into the Enigma Protector or user shell.

Using the built-in registration key generator.

Follow these steps to use the built-in keys generator:

  • choose the output registration key type in the Registration Features - Common panel.
  • open The Enigma Protector and choose Main menu-Tools-Keys Generator menu.

  • Registration name - specific information that will define the user that the registration key is generated for. The registration name should be distributed together with the registration key. This field can't be empty. Please note, the registration information can be used by the key generator in the ANSI or unicode format, select the type of registration scheme in the Registration Features - Common panel. The current type of registration scheme (ANSI or UNICODE) is shown in the window header;
  • Add hyphens - the key will contain hyphens;
  • Expiration date - the date after which the registration key will become invalid. To view the expiration date of the current registration key inside your application, use the Enigma API function EP_RegKeyExpirationDate;
  • Register After - set this date to limit the start date of the allowed registration period. If the registration is performed before this day, the key will be deemed invalid, otherwise the key will be valid. To return the Register After date inside your application use the Enigma API EP_RegKeyRegisterAfterDate;
  • Register Before - set this date to limit the end date of the allowed registration period. If the registration is performed before this day, then the key will be deemed valid, otherwise the key will be invalid. To return the Register Before date inside your application use the Enigma API EP_RegKeyRegisterBeforeDate;
  • Country - select the country the generated key will be locked to. This feature means that the registration will only be valid on a PC located in the specified country. To get the country of the user PC use the Enigma API EP_MiscCountryCode;
  • Executions - enter the number of executions to limit the registration key to. The registration key will only be valid for the specified number of executions of the unregistered protected application. To get information about the total and remaining number executions inside your application use the Enigma API EP_RegKeyExecutions;
  • Days - enter the number of days to limit the registration key to. The registration key will only be valid for the specified number of day since the first execution of the protected application. To get the total and remaining number of days use the Enigma API EP_RegKeyDays;
  • Run Time - enter the number of minutes the registration key will be valid for since the protected application is run. The registration key will become valid at each execution and expire after the specified number of minutes. To get the number of remaining and total Run-time minutes inside your application use the Enigma API EP_RegKeyRuntime;
  • Global Time - enter the number of minutes of Global Time to limit the registration key to. The Global Time means the sum of the minutes of all executions of the registered protected application. To get the number of remaining and total Global Time minutes while the application is working use the Enigma API EP_RegKeyGlobalTime;
  • Hardware ID - the unique computer identificator. This feature allows locking the registration key to a particular computer, i.e. the registration key will only be valid on the computer having the hardware ID used for key generation. Use the Enigma API function EP_RegHardwareID to get the hardware ID string from the user's PC. See the Hardware Lock panel for the options available for hardware locking.
  • Section - select the encrypted section that will be decrypted with the generated registration key. See Markers Reg_Crypt to learn more about encrypted sections.

Built-in registration keys generator supports simple interface for logging of generated keys. There is also an ability to mark keys as stolen to make them invalid after protection. Enigma Protector stores log database in the file with the same name as name of project file but only with .keys.log extension. Once the file size of log database exceeds 1 MBytes, file will be backed-up with the 001.keys.log (002.keys.log and so on) extension. While protection Enigma Protector is looking for a log database and it's backup files to find all registration keys marked as stolen to block them.

Enable capturing of generated licenses - enables logging of all registration keys that are being generated in the keys generator.
License log allows only simple storing of generated registration keys, for the better handling of customers and their licenses the License Manager can be used.

Using custom registration key generators.

Enigma Protector supports a service for creating custom shells of registration key generators (See Custom Keys Generator).


Key Verification

The verification of registration keys is performed in the same window as registration key creation (See Creating Keys). Fill out the "Registration name" and "Registration key" fields (if the key is hardware locked then "Hardware ID" has to be entered too) and click the "Verify" button to validate the key. In the "Result of the verification" field you will see the results. Also, take a look at the Custom Keys Generator with keygen libraries - there are a few functions that allow verifying registration info in your own key generator.

Example:

Registration name :

Vladimir

Registration key :

W3UH9K-L5EUT2-XUPUYJ-P8YYHR

Verification results :

Valid registration key.
Key information:
Created: 17 April 2007
Expiration date: 1 January 2008
Unlock crypted section #1
Unlock crypted section #7
Unlock crypted section #16

It means the key is valid for the current project and contains the following information:

  • key creation date: 17 April 2007;
  • key expiration date: 1 January 2008;
  • key deciphers the following crypted sections #1, #7, #16.


CGI Keygen

CGI Key Generator

CGI Key Generator can be used for generating registration keys for certain projects through the remote server call, web page, web request. CGI key generator should be placed on the server (there are 2 kinds of CGI key generators, for Windows and for Linux servers, you can find it in EnigmaSDK\CGI Keygen folder) into the cgi-bin folder, and the execution attributes (permissions) for the key generator file should be enabled. Calling the CGI generator with the necessary parameters will generate a registraton key. The key generator parameters could be passed to the CGI key generator by GET or POST method. Remote CGI key generator is the best way to integrate a key generator with automatic registrators like ShareIt, RegNow, Plimus etc.

How to use the CGI key generator:
1. Place the keygen to the cgi-bin folder of your web site (make sure that your server supports execution of CGI applications)
2. Enable execution permissions for the keygen file ("keygen" for Linux and "keygen.exe" for Windows servers)
3. Create a link for key generator execution:

There are the following actions that could be used with CGI key generator:

  • GenerateKey - generates ANSI* registration keys;
  • GenerateKeyA - the duplicate of GenerateKey;
  • GenerateKeyW - generates unicode* (wide string) registration keys;
  • GenerateKeyFromProject - generates registration keys based on a settings in the project file, generator parameters** will be extracted from the project file;

* please note that you should only use ANSI or unicode scheme of licensing for a particular project. If the UNICODE Registration Scheme option is enabled in the REGISTRATION FEATURE - Common panel, the key generator should be called with a unicode support action (actions with W prefix), otherwise ANSI actions should be used.
** generator parameters - is registration scheme unicode or no, KeyMode, KeyBase, EncryptedConstant, PublicKey, PrivateKey.

CGI Key Generator accepts the following parameters:
Action - defines the action to be performed, allows the following values:

  • GenerateKey
  • GenerateKeyA
  • GenerateKeyW
  • GenerateKeyFromProject

FileName - the name of the project file. This parameter is used only for actions that use the project file (like GenerateKeyFromProject). String should be UTF-8 encoded;
RegName - enter a registration name for the registration key. Please note that this string should be http encoded to avoid appearing of untranslated symbols (for example, the space symbol should be translated into %20 but not " ") and the source string should be in UFT-8 encoding;
KeyMode - defines what type of registration key should be generated. To get this value, open your project file in Enigma and go to REGISTRATION FEATURES-Common panel, take a look at the Registration key safety/length field, for example, if this field is RSA 1024, you should use KeyMode=1024 (possible values for KeyMode are 512/768/1024/2048/3072/4096);
KeyBase - defines the output format of a registration key. To get this value, open your project file in Enigma and go to REGISTRATION FEATURES-Common panel, take a look at the Registration key output base field, for example, if this field is Base 32, then you should use KeyBase=32 (possible values for KeyBase are 2/8/16/32/64);
Hyphens - indicates if the registration key should be divided my hyphens or not. If yes, enter Hyphens=1, otherwise skip this parameter;
Hardware - the hardware ID the registration key should be locked to;
Expiration - the registration key expiration date, define this parameter with the expiration date value*;
RegAfter - Register After date*;
RegBefore - Register Before date*;
Executions - the number of executions to limit the registration key to;
Days - the number of days to limit the registration key to;
Runtime - the number of run-time minutes to limit the registration key to;
Globaltime - the overall number of minutes to limit the registration key to;
Country - the code of the county to lock the registration key to;
Sections - if the registration key should unlock crypted sections, generate a 16-digit string indicating the section that should be unlocked with the generated key. If digit = 1, the key will unlock a section, or 0 if no section should be unlocked. The section string 1010001001001001 shows that sections #1, #3, #7, #10, #13, #16 should be unlocked
EncryptedConstant - get this constant from the project file, open project file in notepad and find there EnigmaProject-RegistrationFeatures-Constants-EncryptedConstant branch and get its value
PrivateKey and PublicKey - values should be looked up in the project file. To get these values, open your project file in Enigma and go to the REGISTRATION FEATURES - Common panel, the Public and Private Keys are shown in the "Information for Custom Keys Generator" box.

* the date value should be represented in a string. The date has the following format: 2 digits (day) + 2 digits (month) + 4 digits (year). For example, 1 Dec 2010 date is string 01122010

Examples

Show/Hide HTML (GET method) example

<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<body>
<a href="http://yoursite.com/cgi-bin/keygen?Action=GenerateKey&RegName=Vladimir%20Sukhov&KeyMode=512&KeyBase=32&Hyphens=1&Hardware=C69A93-08A25D-D58B73-43CEBD&Expiration=01012030&Sections=1010001001001001&EncryptedConstant=2113444489&PrivateKey=00C98B2SF9UBJA605AJX53GJFXJV8UH4A6PY2L6CV4MAMV7V3ERRVY99Y72V2P77Z2J3KBPGWR3WXKG5GF9Z6CKXJHY5VUMBTQ66H2MRZPCU00DLFJ675JTTTNEK00DLFJ675JTTTNEK&PublicKey=0201B810DA4A1ADD4351378790A98138533067CP4S86R7D8THS45GBCVUM635EPRQRMYRP3DAA5DUPZ6ABDSFP7F5ACP7ERGH4A7Y6B6NW6NMMBZF83WVER9Y4MMBNLBQDKR7KFVLGLV067CFDQCWCHGQVVRN24DECEPBL96YJQJTVDCRTNQG3E4WW4GK4GQ5X5L5H88D3XYHCBRBNASPD3P5CNYFKFHBCSDHHD6WPTCC4XVSM5S88067C2JSTCMVT48C8HC7SHKGTFJBM28P6XTBCNWHMV6J6KN6W5Q9TQLVR285U6GVCAAUTZLRTPSRGDQ742B4742XF4MACRR747YDP5FZZ9D">Click here to generate registration key</a>
</body></html>

Show/Hide HTML (GET method) getting parameters from project file example

<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<body>
<a href="http://yoursite.com/cgi-bin/keygen?Action=GenerateKeyFromProject&FileName=default.enigma&RegName=Vladimir%20Sukhov&Hyphens=1&Expiration=01012030&Sections=1010001001001001">Click here to generate registration key from project file</a>
</body></html>

Show/Hide HTML (POST method) example

<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<body>
<h1>Registration Keys Generator! POST method </h1>
<form name="frmKeygen" method="POST" action="http://yoursite.com/cgi-bin/keygen">
<input type="hidden" value="GenerateKey" name="Action">
<input type="hidden" value="512" name="KeyMode">
<input type="hidden" value="32" name="KeyBase">
<input type="hidden" value="1" name="Hyphens">
<input type="hidden" value="2113444489" name="EncryptedConstant">
<input type="hidden" value="00C98B2SF9UBJA605AJX53GJFXJV8UH4A6PY2L6CV4MAMV7V3ERRVY99Y72V2P77Z2J3KBPGWR3WXKG5GF9Z6CKXJHY5VUMBTQ66H2MRZPCU00DLFJ675JTTTNEK00DLFJ675JTTTNEK" name="PrivateKey">
<input type="hidden" value="0201B810DA4A1ADD4351378790A98138533067CP4S86R7D8THS45GBCVUM635EPRQRMYRP3DAA5DUPZ6ABDSFP7F5ACP7ERGH4A7Y6B6NW6NMMBZF83WVER9Y4MMBNLBQDKR7KFVLGLV067CFDQCWCHGQVVRN24DECEPBL96YJQJTVDCRTNQG3E4WW4GK4GQ5X5L5H88D3XYHCBRBNASPD3P5CNYFKFHBCSDHHD6WPTCC4XVSM5S88067C2JSTCMVT48C8HC7SHKGTFJBM28P6XTBCNWHMV6J6KN6W5Q9TQLVR285U6GVCAAUTZLRTPSRGDQ742B4742XF4MACRR747YDP5FZZ9D" name="PublicKey">
<table>
    <tr>
        <td>Enter the Registration Name
        </td>
        <td>
            <input class="textbox" type="text" value="Vladimir Sukhov" name="RegName" />
        </td>
    </tr>
    <tr>
        <td>Enter Hardware ID
        </td>
        <td>
            <input class="textbox" type="text" value="C69A93-08A25D-D58B73-43CEBD" name="Hardware" />
        </td>
    </tr>
    <tr>
        <td>Enter Expiration Date
        </td>
        <td>
            <input class="textbox" type="text" value="01012030" name="Expiration" />
        </td>
    </tr>
    <tr>
        <td>Enter Unlock Section
        </td>
        <td>
            <input class="textbox" type="text" value="1010001001001001" name="Sections" />
        </td>
    </tr>
</table>
<input type="submit" value="Generate" name="Generate">
</form>
</body></html>

Show/Hide HTML (POST method) getting parameters from project file example

<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<body>
<h1>Registration Keys Generator! POST method </h1>
<form name="frmKeygen" method="POST" action="http://yoursite.com/cgi-bin/keygen">
<input type="hidden" value="GenerateKey" name="Action">
<input type="hidden" value="project.enigma" name="FileName">
<input type="hidden" value="1" name="Hyphens">
<table>
    <tr>
        <td>Enter the Registration Name
        </td>
        <td>
            <input class="textbox" type="text" value="Vladimir Sukhov" name="RegName" />
        </td>
    </tr>
    <tr>
        <td>Enter Hardware ID
        </td>
        <td>
            <input class="textbox" type="text" value="C69A93-08A25D-D58B73-43CEBD" name="Hardware" />
        </td>
    </tr>
    <tr>
        <td>Enter Expiration Date
        </td>
        <td>
            <input class="textbox" type="text" value="01012030" name="Expiration" />
        </td>
    </tr>
    <tr>
        <td>Enter Unlock Section
        </td>
        <td>
            <input class="textbox" type="text" value="1010001001001001" name="Sections" />
        </td>
    </tr>
</table>
<input type="submit" value="Generate" name="Generate">
</form>
</body></html>

Show/Hide PHP (POST method) example

<?php

  if (!function_exists('http_build_query')) {
      function http_build_query($data, $prefix='', $sep='', $key='') {
          $ret = array();
          foreach ((array)$data as $k => $v) {
              if (is_int($k) && $prefix != null) {
                  $k = urlencode($prefix . $k);
              }
              if ((!empty($key)) || ($key === 0))  $k = $key.'['.urlencode($k).']';
              if (is_array($v) || is_object($v)) {
                  array_push($ret, http_build_query($v, '', $sep, $k));
              } else {
                  array_push($ret, $k.'='.urlencode($v));
              }
          }
          if (empty($sep)) $sep = ini_get('arg_separator.output');
          return implode($sep, $ret);
      }// http_build_query
  }//if

  function do_post_request($url, $data, $optional_headers = null)
  {
   $params = array('http' => array(
                'method' => 'POST',
                'content' => $data
             ));
   if ($optional_headers !== null) {
      $params['http']['header'] = $optional_headers;
   }
   $ctx = stream_context_create($params);
   $fp = @fopen($url, 'rb', false, $ctx);
   if (!$fp) {
      throw new Exception("Problem with $url, $php_errormsg");
   }
   $response = @stream_get_contents($fp);
   if ($response === false) {
      throw new Exception("Problem reading data from $url, $php_errormsg");
   }
   return $response;
  }

  function generate_key_post($url, $data) {
    return do_post_request($url, http_build_query($data));
  }

  $data['Action'] = 'GenerateKey';
  $data['KeyMode'] = 512;
  $data['KeyBase'] = 32;
  $data['Hyphens'] = 1;
  $data['EncryptedConstant'] = 2113444489;
  $data['PrivateKey'] = '00C98B2SF9UBJA605AJX53GJFXJV8UH4A6PY2L6CV4MAMV7V3ERRVY99Y72V2P77Z2J3KBPGWR3WXKG5GF9Z6CKXJHY5VUMBTQ66H2MRZPCU00DLFJ675JTTTNEK00DLFJ675JTTTNEK';
  $data['PublicKey'] = '0201B810DA4A1ADD4351378790A98138533067CP4S86R7D8THS45GBCVUM635EPRQRMYRP3DAA5DUPZ6ABDSFP7F5ACP7ERGH4A7Y6B6NW6NMMBZF83WVER9Y4MMBNLBQDKR7KFVLGLV067CFDQCWCHGQVVRN24DECEPBL96YJQJTVDCRTNQG3E4WW4GK4GQ5X5L5H88D3XYHCBRBNASPD3P5CNYFKFHBCSDHHD6WPTCC4XVSM5S88067C2JSTCMVT48C8HC7SHKGTFJBM28P6XTBCNWHMV6J6KN6W5Q9TQLVR285U6GVCAAUTZLRTPSRGDQ742B4742XF4MACRR747YDP5FZZ9D';
  $data['RegName'] = 'Vladimir Sukhov';

  $regkey = generate_key_post('http://yoursite.com/cgi-bin/keygen', $data);
  echo('Registration name: Vladimir Sukhov<br/>Registration Key: '.$regkey);

?>

Show/Hide PHP (GET method) example

<?php

  function generate_key_get($url) {
    $file = fopen ($url, "rb");
    if (!$file) {
      echo('Unable to open remote file.');
      exit;
    }
    while (!feof ($file)) {
      $regkey .= fgets ($file, 2048);
    }
    fclose($file);
    return $regkey;
  }

  $regkey = generate_key_get('http://yoursite.com/cgi-bin/keygen?Action=GenerateKey&RegName=Vladimir%20Sukhov&KeyMode=512&KeyBase=32&Hyphens=1&Hardware=C69A93-08A25D-D58B73-43CEBD&Expiration=01012030&Sections=1010001001001001&EncryptedConstant=2113444489&PrivateKey=00C98B2SF9UBJA605AJX53GJFXJV8UH4A6PY2L6CV4MAMV7V3ERRVY99Y72V2P77Z2J3KBPGWR3WXKG5GF9Z6CKXJHY5VUMBTQ66H2MRZPCU00DLFJ675JTTTNEK00DLFJ675JTTTNEK&PublicKey=0201B810DA4A1ADD4351378790A98138533067CP4S86R7D8THS45GBCVUM635EPRQRMYRP3DAA5DUPZ6ABDSFP7F5ACP7ERGH4A7Y6B6NW6NMMBZF83WVER9Y4MMBNLBQDKR7KFVLGLV067CFDQCWCHGQVVRN24DECEPBL96YJQJTVDCRTNQG3E4WW4GK4GQ5X5L5H88D3XYHCBRBNASPD3P5CNYFKFHBCSDHHD6WPTCC4XVSM5S88067C2JSTCMVT48C8HC7SHKGTFJBM28P6XTBCNWHMV6J6KN6W5Q9TQLVR285U6GVCAAUTZLRTPSRGDQ742B4742XF4MACRR747YDP5FZZ9D');
  echo('Registration name: Vladimir Sukhov<br/>Registration Key: '.$regkey);

?>

We recommend using the POST method to pass data to the key generator, because the GET method has a data size limit that can be passed through the url string.


Export Key Generator

Enigma Protector allows exporting the key generator for the existing project into a single execution file. This option may be useful if you do not want to run/use Enigma itself and the project file to generate licenses. Simple exported key generator has a user-friendly interface, it does not require any external files (like the project file) and all project data are already embedded into the exe file. To export the key generator click Main Menu - Export Key Generator. Once you have clicked that, follow a few steps:

Step 1. Default value for generated keys. Should a registration key be hyphenated? If you do not want to allow users of this key generator to change the hyphens value, enable the "Do not allow changing hyphens value" option.

Export Key Generator - Hyphens

Step 2. Default value for unlocked sections. If you do not want to allow users of this key generator to change the sections value, enable the "Do not allow changing sections value" option.

Export Key Generator - Sections

Step 3. Default value for expiration date of generated keys. If you do not want to allow users of this key generator to change the expiration date value, enable the "Do not allow changing expiration date value" option.

Export Key Generator - Expiration Date

Step 4. Default value for Register After date. If you do not want to allow users of this key generator to change the Register After date value, enable the "Do not allow changing Register After date" option.

Export Key Generator - Expiration Date

Step 5. Default value for Register Before date. If you do not want to allow users of this key generator to change the Register Before date value, enable the "Do not allow changing Register Before date" option.

Export Key Generator - Expiration Date

Step 6. Default value for executions limit. If you do not want to allow users of this key generator to change the executions value, enable the "Do not allow changing Executions " option.

Export Key Generator - Expiration Date

Step 7. Default value for days limit. If you do not want to allow users of this keys generator to change the days value, enable the "Do not allow changing " option.

Export Key Generator - Expiration Date

Step 8. Default value for run-time limit. If you do not want to allow users of this key generator to change the run-time value, enable the "Do not allow changing Run-time " option.

Export Key Generator - Expiration Date

Step 9. Default value for global time limit. If you do not want to allow users of this keys generator to change the global time value, enable the "Do not allow changing Global Time " option.

Export Key Generator - Expiration Date

Step 10. Default value for country lock. If you do not want to allow users of this keys generator to change the country lock value, enable the "Do not allow changing Country Lock " option.

Export Key Generator - Expiration Date

Step 11. Click the Finish button and enter the file name to export the keygen. Try it!


Custom Key Generator

Enigma Protector provides services for custom generation of registration keys for your own projects. There are special libraries (written in Windows and Linux versions) keygen.dll (for Windows) and libkeygen.so (For Linux) that allow generating and verifying registration keys. Enigma Protector provides freedom in development of the custom shells for key generators, examples of such custom key generators written for different compilers can be found in Examples\Keygen folder and Examples\KeygenUnicode for projects using a unicode registration scheme. The libraries export the following functions:

For ANSI-based registration information:

  • KG_GenerateRegistrationKey
  • KG_GenerateRegistrationKeyFromProject
  • KG_GenerateRegistrationKeyA
  • KG_GenerateRegistrationKeyFromProjectA
  • KG_VerifyRegistrationInfo
  • KG_VerifyRegistrationInfoFromProject
  • KG_VerifyRegistrationInfoA
  • KG_VerifyRegistrationInfoFromProjectA

For unicode-based registration information:

  • KG_GenerateRegistrationKeyW
  • KG_GenerateRegistrationKeyFromProjectW
  • KG_VerifyRegistrationInfoW
  • KG_VerifyRegistrationInfoFromProjectW


TKeyGenParams type

TKeyGenParams structure is used by KG_GenerateRegistrationKey and KG_GenerateRegistrationKeyFromProject to generate registration keys.

Structure description

KeyMode

(input parameter) mode of registration key (RSA 512/768/1024/2048/3072/4096). It may have the following values (see Registration Features - Common Registration key safety/length value):

RM_512 = 0;
RM_768 = 1;
RM_1024 = 2;
RM_2048 = 3;
RM_3072 = 4;
RM_4096 = 5;
KeyBase

(input parameter) base of registration key (Base 2/8/16/32/64). It may have the following values (see Registration Features - Common Registration key output base value):

RB_2 = 0;
RB_8 = 1;
RB_16 = 2;
RB_32 = 3;
RB_64 = 4;
KeyWithHyphens

(input parameter) add hyphens to the key, set to 1 if true or 0 if false (see Creating Keys);
Key

(input parameter) pointer to the memory where the registration key will be placed. The registration key will be represented as ANSI, null terminated string. Please be sure that the buffer allocated for the registration key has sufficient size, we recommend allocating a buffer at least 2048 bytes long;

KeyLen | (input parameter) size of the registration key buffer;
RegInfo

(input parameter) pointer to the memory where the registration name info is placed ;

RegInfoLen | (input parameter) size of registration info;
UseKeyExpiration | (input parameter) if the value is 0, then the key does not have expiration, if the value is 1 then the key is time-limited. The key will expire on the date specified in the ExpirationYear, ExpirationMonth, ExpirationDay parameters (see Creating Keys);
ExpirationYear | (input parameter) year of key expiration date;
ExpirationMonth | (input parameter) month of key expiration date;
ExpirationDay | (input parameter) day of key expiration date;
UseHardwareLocking

(input parameter) if the key is hardware-locked, set this parameter to 1, otherwise it should be 0 (see Creating Keys);
HardwareIDType | (input parameter) pointer to ANSI, null terminated hardware id string;
UseExecutionsLimit

(input parameter) to enable executions limit, set this parameter to 1, otherwise it should be 0 (see Creating Keys);
ExecutionsCount | (input parameter) number of executions to limit the registration key to;
UseDaysLimit

(input parameter) to enable days limit, set this parameter to 1, otherwise it should be 0 (see Creating Keys);
DaysCount | (input parameter) number of days to limit the registration key to;
UseRunTimeLimit

(input parameter) to enable run-time limit, set this parameter to 1, otherwise it should be 0 (see Creating Keys);
RunTimeMinutes | (input parameter) number of run-time minutes to limit the registration key to;
UseGlobalTimeLimit

(input parameter) to enable global time limit, set this parameter to 1, otherwise it should be 0 (see Creating Keys);
GlobalTimeMinutes | (input parameter) number of global time minutes to limit the registration key to;
UseCountyLimit

(input parameter) to enable country limit, set this parameter to 1, otherwise it should be 0 (see Creating Keys);
CountryCode | (input parameter) the country code to lock the registration key to (see Enigma API EP_MiscCountryCode to get the code of a particular country);
UseRegisterAfter | (input parameter) to enable the Register After limit for the registration key, set this value to 1, otherwise it should be 0. The Register After date is specified in the RegisterAfterYear, RegisterAfterMonth, RegisterAfterDay parameters (see Creating Keys);
RegisterAfterYear | (input parameter) year of Register After date;
RegisterAfterMonth | (input parameter) month of Register After date;
RegisterAfterDay | (input parameter) day of Register After date;
UseRegisterBefore | (input parameter) to enable the Register Before limit for the registration key, set this value to 1, otherwise it should be 0. The Register Before date is specified in the RegisterBeforeYear, RegisterBeforeMonth, RegisterBeforeDay parameters (see Creating Keys);
RegisterBeforeYear | (input parameter) year of Register Before date;
RegisterBeforeMonth | (input parameter) month of Register Before date;
RegisterBeforeDay | (input parameter) day of Register Before date;
EncryptedConstant | (input parameter) integer constant, obtain it from the project file (see Registration Features - Common Registration, Information for Custom Keys Generator box, Encryption Constant value);
EncryptedSections | (input parameter) array of 16-byte length, which points to the encrypted sections that will be decrypted by this key (see Creating Keys);
PublicKey | (input parameter) pointer to ANSI, null terminated string, which is a unique constant, should be obtained from the project (see Registration Features - Common Registration, Information for Custom Keys Generator box, Public Key value);
PrivateKey | (input parameter) pointer to ANSI, null terminated string, which is a unique constant, should be obtained from the project (see Registration Features - Common Registration, Information for Custom Keys Generator box, Private Key value).

Definition

Show/Hide Delphi structure definition

  TKeyGenParams = record
    KeyMode             : dword;    // {in} key generation mode (~RSA ???)
    KeyBase             : dword;    // {in} key output base (Base ???)
    KeyWithHyphens      : boolean;  // {in} add hyphens to the key?
    Key                 : pointer;  // {in} buffer for registration key
    KeyLen              : dword;    // {in} registration key size
    RegInfo             : pointer;  // {in} registration info/name
    RegInfoLen          : dword;    // {in} registration info/name size
    UseKeyExpiration    : boolean;  // {in} use key expiration?
    ExpirationYear      : dword;    // {in} key expiration year
    ExpirationMonth     : dword;    // {in} key expiration month
    ExpirationDay       : dword;    // {in} key expiration day
    UseHardwareLocking  : boolean;  // {in} is key hardware locked?
    HardwareID          : PAnsiChar;// {in} pointer to null terminated hardware string
    UseExecutionsLimit  : boolean;  // {in} limit key by executions?
    ExecutionsCount     : dword;    // {in} number of executions
    UseDaysLimit        : boolean;  // {in} limit key by days?
    DaysCount           : dword;    // {in} number of days
    UseRunTimeLimit     : boolean;  // {in} limit key by run time?
    RunTimeMinutes      : dword;    // {in} run time minutes
    UseGlobalTimeLimit  : boolean;  // {in} limit key by global time?
    GlobalTimeMinutes   : dword;    // {in} global time minutes
    UseCountyLimit      : boolean;  // {in} limit key by country?
    CountryCode         : dword;    // {in} country code
    UseRegisterAfter    : boolean;  // {in} register key after date?
    RegisterAfterYear   : dword;    // {in} register after year
    RegisterAfterMonth  : dword;    // {in} register after month
    RegisterAfterDay    : dword;    // {in} register after day
    UseRegisterBefore   : boolean;  // {in} register key before date?
    RegisterBeforeYear  : dword;    // {in} register before year
    RegisterBeforeMonth : dword;    // {in} register before month
    RegisterBeforeDay   : dword;    // {in} register before day
    EncryptedConstant   : dword;    // {in} Encryption Constant - should be extracted from project file
    EncryptedSections   : array [1..NUMBER_OF_CRYPTED_SECTIONS] of boolean; // {in} Crypted sections
    PrivateKey          : PAnsiChar;   // {in} Private Key - should be extracted from project file
    PublicKey           : PAnsiChar;   // {in} Public Key - should be extracted from project file
  end;
  PKeyGenParams = ^TKeyGenParams;

Show/Hide C++ structure definition

typedef struct _TKeyGenParams
{
    DWORD KeyMode;             // {in} key generation mode (~RSA ???)
    DWORD KeyBase;             // {in} key output base (Base ???)
    bool KeyWithHyphens;       // {in} add hyphens to the key?
    char* Key;                 // {in} buffer for registration key
    DWORD KeyLen;              // {in} registration key size
    char* RegInfo;             // {in} registration info/name
    DWORD RegInfoLen;          // {in} registration info/name size
    bool UseKeyExpiration;     // {in} use key expiration?
    DWORD ExpirationYear;      // {in} key expiration year
    DWORD ExpirationMonth;     // {in} key expiration month
    DWORD ExpirationDay;       // {in} key expiration day
    bool UseHardwareLocking;   // {in} is key hardware locked?
    char* HardwareID;          // {in} pointer to null terminated hardware string
    bool UseExecutionsLimit;   // {in} limit key by executions?
    DWORD ExecutionsCount;     // {in} number of executions
    bool UseDaysLimit;         // {in} limit key by days?
    DWORD DaysCount;           // {in} number of days
    bool UseRunTimeLimit;      // {in} limit key by run time?
    DWORD RunTimeMinutes;      // {in} run time minutes
    bool UseGlobalTimeLimit;   // {in} limit key by global time?
    DWORD GlobalTimeMinutes;   // {in} global time minutes
    bool UseCountyLimit;       // {in} limit key by country?
    DWORD CountryCode;         // {in} country code
    bool UseRegisterAfter;     // {in} register key after date?
    DWORD RegisterAfterYear;   // {in} register after year
    DWORD RegisterAfterMonth;  // {in} register after month
    DWORD RegisterAfterDay;    // {in} register after day
    bool UseRegisterBefore;    // {in} register key before date?
    DWORD RegisterBeforeYear;  // {in} register before year
    DWORD RegisterBeforeMonth; // {in} register before month
    DWORD RegisterBeforeDay;   // {in} register before day
    DWORD EncryptedConstant;   // {in} Encryption Constant - should be extracted from project file
    bool  EncryptedSections[NUMBER_OF_CRYPTED_SECTIONS]; // {in} Crypted sections
    char* PrivateKey;          // {in} Private Key - should be extracted from project file
    char* PublicKey;           // {in} Public Key - should be extracted from project file
} TKeyGenParams, *PKeyGenParams;

Show/Hide C# (.NET) structure definition

    public struct TKeyGenParams
    {
        public Int32 KeyMode;            // {in} key generation mode (~RSA ???)
        public Int32 KeyBase;            // {in} key output base (Base ???)
        public bool KeyWithHyphens;      // {in} add hyphens to the key?
        public string Key;               // {in} buffer for registration key
        public Int32 KeyLen;             // {in} registration key buffer size
        public string RegInfo;           // {in} registration info/name
        public Int32 RegInfoLen;         // {in} registration info/name size
        public bool UseKeyExpiration;    // {in} use key expiration?
        public Int32 ExpirationYear;     // {in} key expiration year
        public Int32 ExpirationMonth;    // {in} key expiration month
        public Int32 ExpirationDay;      // {in} key expiration day
        public bool UseHardwareLocking;  // {in} is key hardware locked?
        public string HardwareID;        // {in} pointer to null terminated hardware string
        public bool UseExecutionsLimit;  // {in} limit key by executions?
        public Int32 ExecutionsCount;    // {in} number of executions
        public bool UseDaysLimit;        // {in} limit key by days?
        public Int32 DaysCount;          // {in} number of days
        public bool UseRunTimeLimit;     // {in} limit key by run time?
        public Int32 RunTimeMinutes;     // {in} run time minutes
        public bool UseGlobalTimeLimit;  // {in} limit key by global time?
        public Int32 GlobalTimeMinutes;  // {in} global time minutes
        public bool UseCountyLimit;      // {in} limit key by country?
        public Int32 CountryCode;        // {in} country code
        public bool UseRegisterAfter;    // {in} register key after date?
        public Int32 RegisterAfterYear;  // {in} register after year
        public Int32 RegisterAfterMonth; // {in} register after month
        public Int32 RegisterAfterDay;   // {in} register after day
        public bool UseRegisterBefore;   // {in} register key before date?
        public Int32 RegisterBeforeYear; // {in} register before year
        public Int32 RegisterBeforeMonth;// {in} register before month
        public Int32 RegisterBeforeDay;  // {in} register before day
        public Int32 EncryptedConstant;  // {in} Encryption Constant - should be extracted from project file
        [MarshalAs(UnmanagedType.ByValArray, SizeConst = NUMBER_OF_CRYPTED_SECTIONS)]
        public byte[] EncryptedSections; // {in} Crypted sections
        public string PrivateKey;        // {in} Private Key - should be extracted from project file
        public string PublicKey;         // {in} Public Key - should be extracted from project file
    }

Show/Hide Visual Basic structure definition

Public Type TKeyGenParams
    KeyMode As Long ' {in} key generation mode (~RSA ???)
    KeyBase As Long ' {in} key output base (Base ???)
    KeyWithHyphens As Boolean ' {in} add hyphens to the key?
    Key As String ' {in} buffer for registration key
    KeyLen As Long ' {in} registration key size
    RegInfo As String ' {in} registration info/name
    RegInfoLen As Long ' {in} registration info/name size
    UseKeyExpiration As Boolean ' {in} use key expiration?
    ExpirationYear As Long ' {in} key expiration year
    ExpirationMonth As Long ' {in} key expiration month
    ExpirationDay As Long ' {in} key expiration day
    UseHardwareLocking As Boolean ' {in} is key hardware locked?
    HardwareID As String ' {in} pointer to null terminated hardware string
    UseExecutionsLimit As Boolean ' {in} limit key by executions?
    ExecutionsCount As Long ' {in} number of executions
    UseDaysLimit As Boolean ' {in} limit key by days?
    DaysCount As Long ' {in} number of days
    UseRunTimeLimit As Boolean ' {in} limit key by run time?
    RunTimeMinutes As Long ' {in} run time minutes
    UseGlobalTimeLimit As Boolean ' {in} limit key by global time?
    GlobalTimeMinutes As Long ' {in} global time minutes
    UseCountyLimit As Boolean ' {in} limit key by country?
    CountryCode As Long ' {in} country code
    UseRegisterAfter As Boolean ' {in} register key after date?
    RegisterAfterYear As Long ' {in} register after year
    RegisterAfterMonth As Long ' {in} register after month
    RegisterAfterDay As Long ' {in} register after day
    UseRegisterBefore As Boolean ' {in} register key before date?
    RegisterBeforeYear As Long ' {in} register before year
    RegisterBeforeMonth As Long ' {in} register before month
    RegisterBeforeDay As Long ' {in} register before day
    EncryptedConstant As Long ' {in} Encryption Constant - should be extracted from project file
    EncryptedSections(NUMBER_OF_CRYPTED_SECTIONS - 1) As Byte ' {in} Crypted sections
    PrivateKey As String ' {in} Private Key - should be extracted from project file
    PublicKey As String ' {in} Public Key - should be extracted from project file
End Type


Function KG_GenerateRegistrationKey

The function is used to generate ANSI registration keys. Note: to enable the application to accept ANSI registration keys, the UNICODE Registration Scheme parameter from the Registration Features - Common panel should be disabled. The function has one parameter - PKeyGenParams, which is a pointer to the TGenKeyParams structure. This function requires the following necessary input parameters: PublicKey, PrivateKey, KeyMode, KeyBase and EncryptedConstant (other parameters are optional) that should be obtained from the project (see the Registration Features - Common panel, Information for Custom Generator box).

Return Values

EP_NO_ERROR=0 | the function succeeds. In this case, Key parameter of TKeyGenParams structure should contain a pointer to the null terminated string - registration key.
EP_ERROR_UNKNOWN=1 | unknown error
EP_ERROR_KEYBUFFEREMPTY=2 | memory buffer for registration key is not allocated
EP_ERROR_KEYBUFFERISLESS=3 | size of allocated memory for registration key is less than required
EP_ERROR_REGINFOEMPTY=4 | registration information is not specified
EP_ERROR_REGINFOTOOLARGE=5 | registration information is empty (has a null size)
EP_ERROR_PRIVATEKEYISNOTSET=6 | private key is not set
EP_ERROR_PUBLICKEYISNOTSET=7 | public key is not set
EP_ERROR_PRIVATEKEYISINVALID=8 | private key is invalid
EP_ERROR_PUBLICKEYISINVALID=9 | public key is invalid
EP_ERROR_KEYMODEISINVALID=10 | key mode is invalid
EP_ERROR_KEYBASEISINVALID=11 | key base is invalid
EP_ERROR_CURRENTDATEISINVALID=12 | current date is invalid
EP_ERROR_EXPIRATIONDATEISINVALID=13 | expiration date is invalid
EP_ERROR_KEYISINVALID=14 | key is invalid
EP_ERROR_HARDWAREID=15 | hardware id is invalid
EP_ERROR_HARDWAREBUFFEREMPTY=16 | hardware id buffer is empty
EP_ERROR_HARDWAREIDINVALIDFORKEY=17 | hardware id is invalid for the key
EP_ERROR_PROJECTFILENOTFOUND=18 | project file is not found
EP_ERROR_INVALIDPROJECTFILE=19 | project file is invalid
EP_ERROR_EXECUTIONSNUMBERINVALID=20 | executions number is invalid
EP_ERROR_DAYSNUMBERINVALID=21 | days number is invalid
EP_ERROR_COUNTRYCODEINVALID=22 | country code is invalid
EP_ERROR_RUNTIMEINVALID=23 | run-time value is invalid
EP_ERROR_GLOBALTIMEINVALID=24 | global time is invalid
EP_ERROR_INSTALLBEFOREINVALID=25 | register before date is invalid
EP_ERROR_INSTALLAFTERINVALID=26 | register after date is invalid

Definition

Show/Hide Delphi function definition

function KG_GenerateRegistrationKey(kg : PKeyGenParams) : dword; external 'keygen.dll' name 'KG_GenerateRegistrationKey';

Show/Hide C++ function definition

 extern  "C" __declspec( dllimport ) __stdcall int KG_GenerateRegistrationKey(PKeyGenParams kg);

Show/Hide C# (.NET) function definition

public class Enigma_KeyGen_IDE
{
    [DllImport("keygen.dll", CallingConvention = CallingConvention.StdCall)]
    public static extern uint KG_GenerateRegistrationKey(ref TKeyGenParams kg);
}

Show/Hide Visual Basic function definition

Public Declare Function KG_GenerateRegistrationKey Lib "keygen.dll" (ByRef kg As TKeyGenParams) As Long

Examples

Show/Hide Delphi function example

procedure TfrmMain.bGenClick(Sender: TObject);
var
  kg : TKeyGenParams;
  KeyBuffer : array [0..2047] of char;
  dwResult : dword;
begin
  mKey.Clear;

  if eUserInfo.Text = '' then
  begin
    ShowMessage('User info field is empty!');
    Exit;
  end;

  ZeroMemory(@kg, SizeOf(kg));
  // Key mode
  kg.KeyMode := cbKeyMode.ItemIndex;
  // Key base
  kg.KeyBase := cbKeyBase.ItemIndex;
  // Hyphens
  kg.KeyWithHyphens := cbHyphens.Checked;
  case kg.KeyMode of
    RM_512:
    begin
      kg.PublicKey  := '0201B810DA4A1ADD4351378790A98138533067CP4S86R7D8THS45GBCVUM635EPRQRMYRP3DAA5DUPZ6ABDSFP7F5AC' +
                       'P7ERGH4A7Y6B6NW6NMMBZF83WVER9Y4MMBNLBQDKR7KFVLGLV067CFDQC' +
                       'WCHGQVVRN24DECEPBL96YJQJTVDCRTNQG3E4WW4GK4GQ5X5L5H88D3XYH' +
                       'CBRBNASPD3P5CNYFKFHBCSDHHD6WPTCC4XVSM5S88067C2JSTCMVT48C8' +
                       'HC7SHKGTFJBM28P6XTBCNWHMV6J6KN6W5Q9TQLVR285U6GVCAAUTZLRTP' +
                       'SRGDQ742B4742XF4MACRR747YDP5FZZ9D';
      kg.PrivateKey := '00C98B2SF9UBJA605AJX53GJFXJV8UH4A6PY2L6CV4MAMV7V3ERRVY99Y' +
                       '72V2P77Z2J3KBPGWR3WXKG5GF9Z6CKXJHY5VUMBTQ66H2MRZPCU00DLFJ' +
                       '675JTTTNEK00DLFJ675JTTTNEK';
    end;
    RM_768:
    begin
      kg.PublicKey  := '0201B810DA4A1ADD4351378790A9813853309AEHRR66KMK99UEPX8C54WQFDZQ5Y96WUCVZYMXBC32SJV7T5SBPR54E' +
                       '2DBH8UD9RNHTJ9BLJV6NHX52W7PZDDTTJDDGF3YFVL7PJFL8RS8THTFDF' +
                       '4RY7K3QXLTMXMC8DDSRVRWBVMMP3UYKCDDC7KGL9PG509ACPTRQ4MMUKG' +
                       'DAUJFFFGSCBFLYK9X9E74M58PW5FG9B9RTLXJQ4STPVCHJTEH8BP557VZ' +
                       'PQYDBUZJXXJNGVZELFL4UL3LHHE8A645CK593DVWCQBSX4ZCCQ3ST8GCZ' +
                       'LW2729XK3NT7GST3LMQGXSHLDWCXE09AENVX2QTX3VLT6FWB4JND875XZ' +
                       'WQ26GW76TV3KVVHK7U489LLPBQ39HUWKMA65U3HKWBDHKBZEB525PHEH2' +
                       'YQHRZGNJAAYZXMWN8RNZ9T7VMZAJMP2V3S9NXZ9RHL96F7AT3NTMN36V4' +
                       'ACSFEN4DR6TJR95';
      kg.PrivateKey := '019VRB95TKY456YC48LBS9FK34YN080VVPDJPPKU6XA9EPLX7HTVN3VST' +
                       'TNJZFPH4HQAFY58R593KFKSNZ7WEZBA9AZ6PGN735EWEFUAEM3G8XVUFN' +
                       'L2ZFRPXA4V8KVXE4M8GACUJAT7H3TTWZT9ZDE43ZF46HC01AHFR85MVR2' +
                       'UP7K3N53M8MTNWBUP01AHFR85MVR2UP7K3N53M8MTNWBUP';
    end;
    RM_1024:
    begin
      kg.PublicKey  := '0201B810DA4A1ADD4351378790A981385330CDG9YQSEUK2HT546KWW46NHSCHMD2TNCSPVNSKGQC6CHDUSU9CC4LDPL' +
                       'TD3NLRVD3TFV9BU2SYBUBU9TXKLQ3CTKZE5GN9VFG37R9YNK2FE58K7ZY' +
                       'WTUJYFSJTBMDLLGA9GJ2LJXGHSS9CESGC2K69H65YQGAC7CRGF5T3CPLA' +
                       '5BDJZKVCUWPZRNA2DN7L956LZVZBQUDPX6PF30CDBH26Z82VE4QQ8N85L' +
                       'QHYJYYCJ6WQ89H9K9VVQX925SG5FJ79AGVZB6M8TTFKCJ56FAREP8GSTC' +
                       'NKWCXEALDP9Y2ZLS9QKZV8JRNDHG9D8BRDSCTMDQK9NLAPZ9TGYFS9G7U' +
                       'LXHYJF7F9A89HPXGTU2N4FQQJL98WZ5QND2KTEMMUUZFAX953HCGNSWUW' +
                       'U2M7LBEWZSH9GW5SC0CDJDY2HC4HJYUSVTAVXZ7MYVJWF3CU9WC3SVPSL' +
                       '29WF46DVS2SYKSSAMATPPYGJDE3PBFMGS34CXWQSXKCEAE63L2EXTS9NE' +
                       '2G597XASY3S34XMYST5YZF4THUTYT5DY9UKKXU6PH8MLXRPZMPMMR83JU' +
                       'X2WGNEW8ZGL4SKUCUB8CEAB6UZ4FB66WTP3B64VMX7XG75T4Y35479';
      kg.PrivateKey := '020MLJ7XTRVLBDNUVMKGUFHCU8XBGMHHVRA0ADSHPBC7NVSZ82AM867XC' +
                       'BELNKMR7CZ56C4SW8KKRD9WZLE5X992GZVSZXS5J6JG9SLDW3Y696TU4D' +
                       'QZP778LVFKVRKANQD6FUGN2ACWUJM9ZK6ME7WXWDZ88LTWHME52RKUDKX' +
                       'STT7RGWP7HFUJDGWEUG4ZHQ25DCQJ644CLEXRR3G020SAAREJB4WXZ4H2' +
                       'JEH4AB4U8FGFTA4CAF020SAAREJB4WXZ4H2JEH4AB4U8FGFTA4CAF';
    end;
    RM_2048:
    begin
      kg.PublicKey  := '0201B810DA4A1ADD4351378790A98138533199H9KZC4CQ5ZKPEGYDW2EHN5AKZA5G5KP4HU8USWJR8XWW7MCH7244RV' +
                       'PSXFHVU6YQRK4LPUHM497XJYPLLA3DHUZWXK3CB5SUYF75NPYLTNPRUAP' +
                       'CTVDHAKYWTRQ97HES2E59WDN2LJKFYA2K8BGFSBHP4A6BF5FSDTS8NWLL' +
                       'C5NEQ76NJ9BAMWXG55UPFFMRQZTU5KV2G6LSPQUJJWA9U4LJ5SCJ9M9ZQ' +
                       'Z6K7LZA9UAMJ533UQ5J3JPNQAUWJGZFRFCTGAGSBWPWRRF9HRGF9MCX55' +
                       'QRYGPYMRE6DBJ65SJDX34FVPYWWKWQ48MCKXYXPHQ23BJ42U8ZMDD8CG5' +
                       'DPHZQ5XTXUKA277XK6PKSTLJ88ZZ9EBXH62REMRZZRGNPKHYM34RW722S' +
                       'SZHMPFKY7X8UZ19ADGX3UQ7X444XH7MZXEZYW2YLFHR8YL3PTCXVSYX89' +
                       'ZXN7KW2XNBE8XS3TQRGZVF6KA5USH56NEZYH5RNWBBPVE9LD6H42RQWR5' +
                       'YVQMT5EQYQTK6YM9V8DA5BJCLGGZ2UGD6NPA2X3SNUS47F7HJBNBCWHRA' +
                       'YPPCQ5HWCJNPDHUDQMRN2P6PWJFWJ6CLVNK8HXEFLE4ENPXAFN89CRS43' +
                       'RUMVGDJQCSRB535XYCS6BZYLA9Q6HJV425F26XXHRGA7C8R8BVMELAPEH' +
                       '5DSA9KXTCV4H2RNVDFHG3YJSERZVFPWHYA823LUBENBL5U3J4LJX2KQLW' +
                       'L5XGGESPSE2FQWKSQ4NUCDLBEJPQAT2A2477DYS2XEXKLYEAKUN22622C' +
                       'RLBCAHPFNEV2FJ2H8N3JQGXJRGP19AFHGRW6SS2ZSFYK8EZAPVYL4MCP4' +
                       '6UMR64Y9T89FHWEPXBRHKWJCSNNNGPU984J5XW4BWTU6PDWPN24W8RU55' +
                       'A9C3U9H7VHS5PFURASHBT4JAEE5ZKJBSYMCMDVBLU973R72RVPA6U96A2' +
                       'LX8HMASVST9RVJ7W66V4DYWRDZZQ3673W7C7LVF68TWPLNMYEUQ8FDZRN' +
                       'P38D9BX5YA3VENETDUUUMR9U7FFP4NZM7G4Y6J6EASK5SAXXTRMZ8F3AH' +
                       '5FC54E543N739BY5KVZQM7JZWD2P2HPE7BDRMM9JFCGPBWWASTZ7UDNRV' +
                       '6AFHVMBR9AGAERE9M6W6S2ZT8PBTABPDCKBPPPV6QW9DRXZUGAHDDRRSY' +
                       'XM4YXQ2QJX6CL33N7RV8846LK8A3DFLDXWZ2NKF8V';
      kg.PrivateKey := '02DB825DUDFYHA88AG49NMM742HCQEJDKQQGDR6G3GL7MCED16DU9KTVE' +
                       '47XQ3M92FFKX8FU9ZXT7AK7VTGGJSYQERCZBR8J2DE2CFE3VUU4W7JEQJ' +
                       'L49HDUXBW7SNPCV8MHXM7EQHYPQK3GSPQYV5VWESQE4AYWFZHXN2UX7Z3' +
                       'T3CV52XURB3YFKLUCY6CJTRACRVVDD568F6F28U74ABWCZ2ZMC32E83V3' +
                       '4JZZPDBF3KEYQWREETGKQT6NANCMAD4XDEXW5LCYBJ3GMDJBM3E7FNK98' +
                       '7JEUYEV7QNKGKNTDVMRG3G5L8NC9CNHQS8AVDMDBEGCG3DHGJUGPG2244' +
                       '2C9LCD8FJ2LSDMQXLHCGCLP7ZSYQT2UJ4QFGU2CH3BTT3UADZMQSBAV33' +
                       'B3Z2Y8Y8RRD9J754G02DJ372LR8APP7HXKB2GNPHP6T65C3RR48Q8BHGP' +
                       'KEZ6PX2D02DJ372LR8APP7HXKB2GNPHP6T65C3RR48Q8BHGPKEZ6PX2D';
    end;
    RM_3072:
    begin
      kg.PublicKey  := '0201B810DA4A1ADD4351378790A98138533267BJBN6W8SY33Y47RWJHWS385XWRV9TSVSB5EM7ECZYNSJ44ZKSD8KV4' +
                       '6Y9T6TNC6QMDW4V6DBMADU3YUKLP88TCLEUD9FTEUHGXM6T57AQ2EMB59' +
                       'UPQVNSUT7Z4EHAMDQ6N77VK2A6P847MMWJH9E7C5XX6FNF6MHGWERPWQV' +
                       '9ZLVR9Z7X5D5Z2XQL6MBM7BDCT2DEDVRBFNDDBLG6LHZ9APM48LS5TKTJ' +
                       'AGDYFDRVHEGTDH47PCLL8YJ4ZAWCB59F8BN5PZL3NQACP32G3YNBX5E3J' +
                       '7S28XLRGAX55ZML5XE6Q68EUAL38VUBJ2MZ2UGCCHM7CE6S99N44X9RMV' +
                       '7B55HULJ4KHPFYSBDUSPQTCWGS76BEQST2QCZDZ2T4FBA4YUJFF47AACE' +
                       'A4EEFESEYWN48UZCSDZAMGSU5VB9UJKR2XQUSDFS3TNG9QKURQWS7N5Q3' +
                       'VPYT4QAGGQ5GW2MMXHDJYW55FQPHSS255GVJ7WLLP85JHS8K6DVTJWB4W' +
                       '4Y8ZEFF7KP6W74PAA8FVPZVDW4RKGMQ8V56Q6R4V34XFE5HR4FZS8GZ6R' +
                       '36RKW6WN34S2AHR9LCGF8LULB7ZN6NC2AA5RPDZYGWSPPME6267CGLZCP' +
                       'GG98W557RXCDWAETJHDCRPUXX7AD3E8SL9WMGBV9QFHMSV9UFV7H9NTX3' +
                       'QYV95CN9P9DSYQWL35R2BWB4GKW6CTWVB2X6WH3P2WFBE6X55KBLAMDB3' +
                       'SRDSDVY37GKH78MUHY7KDJDC8SJU5FUQRYZ49ULX3YSZL7E284GFVZSGD' +
                       'FTTQNR6VMBM3LLR78SUSVMJW88XT2K4UHEATRU3V9MMR2VGNGCY9S6R7M' +
                       '4ELNPEBBMQP2HVPLY5M5VPA92V7NU8ZZ58YYTW5QK9USZ5LV59UZGB2CF' +
                       'DPZ6HFYU5WB7UU3UYWVNSNKM3W7GBYKJP8TMFW2YN6GNSSE4ZKFVZRLUT' +
                       '8QPZBBEQT5H9H5Z53D7QV4AJTKTX4EMW62TDWXQVK24JZPSG2VXKCMYZL' +
                       'BUASE25R3EEK9KBLJ8VX83ZXGTBL5CCDBY33HJ6FKX8AW3WPRX3XTCS9G' +
                       '2B9SVK2XFFKNSPGFG6FZNS8P2HERFGFL79DKUZZFWHFH4H9UZ7F7F6W3Z' +
                       'WN84JRRA7SU8T89EQMRBEPVYMMGLGSUMFWWMEDLJM5EGP5WEX9LDUAQXS' +
                       '55LKDQVRKX4R8NNBHSYBHSNMFYA2C6KGQQFK3TN267DPSZT3PTKHTLNMU' +
                       'V2YYZZRX3953LPWAKYF8LJUVMEQT3ZC4F9SWMYGUHG6XX66PJFQWSRUW2' +
                       'C79YLGZ6ZAFS7HLXBTH55UD3EGFBZQ5CLNJDZTEJACDVBCM5FQBTX4DKK' +
                       'UDGNSMWWLC5UMQRHW89CTU5636WYDXVZZDAUZ529458LDN2DAR9QADWRZ' +
                       'UTU8MCKN8ACH3R36YKE52DDF67SM5UDUH7PTATHXE65UCGFRCV49UTF29' +
                       'BGDSUWGRMC839HUZYQVAG985YUF5KJCAVGKRD8E4YMPJ38KR6HD2KHDGY' +
                       'PJDMJMN4Y3DTJW5MYX3VUPF32637LMAWFM4QCU7BMP74SCF4N5QXZZVBE' +
                       'LAQMPYMJC2ZWJ9XFV33YXTTPH3SG9KMUABLL83P7L3UBVM763XJPR5UEH' +
                       'DZ73XJUGR9QP6299K5PU46XGVWKWFAKWYMRXUSLCFJ3WQTEC6QJH6E5V8' +
                       'X2RMA5TXGSBEWLGSMNQ2SH6G9MLKK4S486DN4M4QVDTYTM4JQETAJQGP7' +
                       '6NUR4UNDXR4W4JQSNWDTUGX69SEDC3AL8ZF4TJBQQRXSX2A86UUWCDCFH' +
                       'JE94A8EP3Q6A2QTYKEE62MV4VJB2AB';
      kg.PrivateKey := '04DMQBFL5GKK4RXWEZYPEY8QB5GHBBGW3EY766DFF2Q6PLFLR4SSRWXBN' +
                       'W5CFGFC84UJ8PKRDQQYWN9921AH8AGZAQRWJYZ7C3QUJJCJAAGGT5P5GG' +
                       'LY6K5W4JZJDW7Y8EWS6SSYCS2MCR93MY9DG6VXLBRYVZWDX6XNFU286HM' +
                       'AM9E82KJVZNYGC8RXRW43SFFWDLR8C96R58A42F3TGLXPVWLGMNPPAWS4' +
                       'S2SSMNQLUPBAQMP7AUKAGV5CKL342W6UKQY3TUPXKGFXFES725PEX93UX' +
                       'X4K8JRY3MPQ5S94VNPBXQ5N6LDBLWB67LBLDCGNQS3JEKW667UF8LA8Q6' +
                       'B3AF4XGZKYB7BVVHF49DJUHSFJZRD63S4GMMAPQ8Q87HKN9G3J3575JEL' +
                       '5C29NZLWQW6MSYWJ7S3NKLKPWGU75ZJXKEL6Z9V97HAMDYHM6ARCH58EP' +
                       'WRPZUXN8RRWGCDFM6BH6XUTRTFE3VMAAZAUUKHKL6AFC2PCPXFRDWLVYP' +
                       'ZKUGY8QDEZNECK9K5Y5MET9SRWQ36JF77XJ6NUKSMZ6DKUPEH4W43YQAE' +
                       'CV7XVFWJ7ZTRVFQJZFU5BS8AL77YLCXDCR5VPFFZ9NP7EBBQ2AA04DP3S' +
                       '86B3YD8AFXQ3KPPNTPHBTQSM8PUHJHG87RUM4EV63GKPBRGSN3VX63FCS' +
                       '646DLWSH86B542U3F04DP3S86B3YD8AFXQ3KPPNTPHBTQSM8PUHJHG87R' +
                       'UM4EV63GKPBRGSN3VX63FCS646DLWSH86B542U3F';
    end;
    RM_4096:
    begin
      kg.PublicKey  := '0201B810DA4A1ADD4351378790A98138533334BN75EUD4LFWYFVNFGBRCEMKKXG62QRBXL8GMHQ975B68FJVEMNXQQ7' +
                       'RKR7RCZMWDVP86QPB3LR49G9BM7EUUZXNCRZBXRF4PEY3RX6UXT4X286K' +
                       'WMR7AMEE6QNP9AEHGWJT9AVU3F62F37B5GVX2BQF73QWHRFQSQ6XMRP6M' +
                       'ZDRQ8JT89UF3YRK5UL34MM3L8HLDTWAJF5YY7MRWJUFDQRK9JNCJ6C9KJ' +
                       'WRE5ACQSNS24NEAHDYKS3AK75HBCTKP9NR2CSL7Q9PPXM4TF7L37USP77' +
                       'Z7WER6JY67F7YGKTP6MFRMKK9H8XFPZ9XWKK97XCFXK7AW4TB96WGEH4B' +
                       'YPF9QRF2DGC3LCHW8VTD2EMHVRDR6EEBUG8R4XYKJPLBPRCJP445DU2BW' +
                       'JWELKAY45GKDU5HLTTDTWRH2JFKJ7AVAKLPEELN29YHX5JR773P9ERW7N' +
                       'UFMWDKD4UL4YPU5QW2L4A7ZN3E8ZDQVEZUR6ZRDQXRLQRLUNHVB4XGBWD' +
                       'HM79NGJARHDBQJCD8NWZCWPBY26QARP7A5S48DCV29F7MUTHU3YAHYVS7' +
                       'ZPGXJZZA5HBBY4K5BQPUG6MVCBG8H3C7VL8KH9EH58NUVCE6F2CGMSM94' +
                       '4CQDKNVGWWWRNK4DG26UT88Y9ULUPJ25G9KLTQPK3TBXZEK43X8KPMJT8' +
                       'DF6MTQ5RB94XR2BT9H9NYYTXL29GF8KZY9QNHAW4LTT2RDQTD2ELWPSV4' +
                       '4AND9K8G5VKLQ287UBEVHA82CMSMGQQBMNQZVAZ9G8T5TD6G9F7XQHMJT' +
                       'HCL6PFEDUW5MN9JASF2EKPT2H33325A3SFGGM5C3RYKZSYSSQC5FLHNX9' +
                       'VHN4HQVWD66YECY4R97JZHQALRTCHXUWH85LSJCCTQZT8JF52FHG6FV9J' +
                       'UJWEU24K9Z7SKYTYA9NH7GW29FSNKUK3DMFXY48VEYZVDRTTMLFYSJH8B' +
                       'RQXV72REYGSM6SLX89EVQ52CN9N8YDLWHAWCDDNM89YN2FCRTLE8688XN' +
                       'F4MZMFE6GP9JK2JTFJVUKBLES2ZVWSBCJE9N3D7DG9LL9Z3U42QFJJPE2' +
                       'HE5XCRY25UND96R9D7655ZBSCPF796FJZ4GPLY7AMZLGLR77GRP467ELK' +
                       'PXSZ9ZF8MUYFDHV4EFACPZ79CDFTYW56NE9JDWDVUMNLY9EXDSF8ZNABE' +
                       'MDQU6T9RVLTNRMZJJ8EJSUM9TV8YA6MNWF2Y66MD3VQ9L662F5X6VE9ZC' +
                       'PPRTNMEV2DG9BUMFMSL7PUR9H5QG6VVBDBMEU3PLABL57HMSQ5C83E9X8' +
                       'RTPY4QSEH2H7R2QDJHT5LQSFNQJL2NZ24GLNTFXG468WC5UUTDD68G8HM' +
                       '477Z8P4F9ZZHUGZ6VPFF32A2MPWY8LPXNECCKM9EEVLDDPUJ8LXN2AE6K' +
                       'Y2Q42FVBCJM9GQTXNRHBED735KCFD4YGV4U5U3LJD6NJ886W6XQLWH3G7' +
                       '3VZ6T5YDUQP6DA5ZHLKQSGATDJHUWC2ELTE7QJFXH8H9EAQYZPPMW76JG' +
                       'Z48UBND9VXFXZMSGBNWQPNQG7E4TCBDMVKUSA9TTVSNLN3DXEZNXH787R' +
                       'N7XHFBJNZ5W74DUMNBYVHEQDYMZBQCFMS8LGSDUAU6QE9DD5Q334BX62T' +
                       'JP5WQQDS2ZEWW76XW7VMLX3L7V9UVD7RL297VDBVRFPQ5MYA3YFVBVNVA' +
                       'R5TJXMQ4X2U2PW6UWSKBXT58HG3QPZM2RVEX2PDMCVJDFTJMXR9NPLW4C' +
                       '6AE4Q9A8TTAQ68BSN9WWTFFTSX68ECVARFPDBBH5DMP4KYFARTFVCSWNF' +
                       'FGAPBYYGFJA4MGHEDWTNE54MPGER7EPCZEV2ESJRMM6XDMFGABG97HECN' +
                       '3SZFUBRKCNDZ2TE9F6EERULRCDAV5EMY6KVY9NY9MYNPP2FQ5WFWLMRYD' +
                       '4TNYYHE6EDMQ6KK79HH5Q5KBW6DDQYYNUR365W2454CHEZWZAPU82SX4H' +
                       'KHNZXBRVWAT7G9CJBKHNBPSVEL67X8UJHBFHZH8ZD4NSEVFZM4Y768TJ6' +
                       'QP3BGEKLTY4UZUWHG63QMKVWAQW9E7WRFNJCH4XRD97JHNKMFUTRFVH68' +
                       'G5CKSMGC725AZ9CBSL2JX43P4EY44CMF56AJ6BEXVCJP2ZDWCT9G55K4D' +
                       'F24J7TTJMFXTQH95CBNX67CBPNWEKHCWQV6VD73Y9KCZHNBFUFS8TCYNN' +
                       'WXRGFKNVRDFUKWHDWDDTSPEW8YCKLPMX2GUV3N4JFJMUE6TSJR6Z53C9F' +
                       'SKZAY3EN7G66JPBF5E9S6Y7RQHPWZHSRDQ7XH87PHUJFLJFGD7WNE3Q9P' +
                       'EXMW33LVJBFEUXKNUB6SU7ZYCEX96XT8G27FLUV7XPV4JK64DWDJCX9WV' +
                       '4VL8CK23FQJ28UG9JUZTQJ3DRL32BTJVRD4LVQ6MK9LCE7ZZP925JK7ZD' +
                       '92SCV4DDJJ5EXMVBF';
      kg.PrivateKey := '067DN6F8YFBTWF5QH8MHJB39Z7VNN2P56HS8RPBURAWB8KPL8FQWX4HSP' +
                       'RTY4HWFMFXAVX2YUY99G2U2KKK56CBE4BCPZWS3KJ98XRW4PY2CDQ3ALF' +
                       'Y3HGJG42NRY9ZVGZZB59TE29KGC825BYBX3FRFMYBVN2VTHM8YM2KULXM' +
                       'H24XSHNVK4HEQ9L5264844DMBFUUXSBA9PT9LEXT6449TMAMF7RL6KU6C' +
                       'GP6FU9DNMJCNTUREF2U9WUMJBMXMMHWKWDG4VU5JQNFFNNWCP2YE2DGFD' +
                       'N3H27NTNR58GBNTTZBRK66BKWNVMF8H59KALB6K93Y8UWDUWV5HJZGV8X' +
                       '3AS5EG982DYV4W9CQ3GRRFRR8NABQC98FTAG465SXQ3JPN7X7VULQZX4X' +
                       'UK68URBFPGCW2UPBYH6CRG6C7YBRAURM2KMGN5L8XH4AUQN8WM4P454WN' +
                       'NWRE5SQEC78FK3LHHQU5VLXLYYN8F2NXGG7CCQ92EEC63ZE6S7CC7RTML' +
                       'UMM3PAXPL5CJZFL26JNNYPVLAHM75NDL8AS8JR48PFXK49D4A6TY2ZU9Y' +
                       'XX2Y2TLA3J8T56EPY236FEDGZEHTQR73NE2Y7LKL7423FFKGGPWYL8PB5' +
                       'VWD54PG328ACE6V8VLSGVP9VJMMWS2VDVU459C8K5XK869Z5KM4JWHAVE' +
                       'G56ZESC6HHJ423N6SAH2DW2UQZDQHSMKWUCHPUKZZPJXCQXF55Q3BJW6Z' +
                       'QYK4HM4Q8XWU8NT844E8YM96EGHSYEUKAJ3QDXANN2DELSGARH7LR2XH9' +
                       'UQBQNXGPZGB6JTEQP8HAQK5ZZYJE067DWX6C2JJ7L2HE4NGVXZV5XH9RD' +
                       'P9SNG4WZTC9KEMGXDX7JTQX8RPJJRT4YTA83L8GXDNDDHB7C79CN8UWGL' +
                       'U5EMNMBREQN5MYTYHGYK067DWX6C2JJ7L2HE4NGVXZV5XH9RDP9SNG4WZ' +
                       'TC9KEMGXDX7JTQX8RPJJRT4YTA83L8GXDNDDHB7C79CN8UWGLU5EMNMBR' +
                       'EQN5MYTYHGYK';
    end;
  end;

  // Fill key buffer
  ZeroMemory(@KeyBuffer, SizeOf(KeyBuffer));
  kg.Key := @KeyBuffer;
  kg.KeyLen := SizeOf(KeyBuffer);
  // Fill User Info
  kg.RegInfo := PAnsiChar(AnsiString(eUserInfo.Text));
  kg.RegInfoLen := strlen(PAnsiChar(kg.RegInfo));
  // Key expiration info
  kg.UseKeyExpiration := cbExpirationDate.Checked;
  kg.ExpirationYear := YearOf(DateTimePicker1.DateTime);
  kg.ExpirationMonth := MonthOf(DateTimePicker1.DateTime);
  kg.ExpirationDay := DayOf(DateTimePicker1.DateTime);
  // Register After date
  kg.UseRegisterAfter := cbRegisterAfter.Checked;
  if kg.UseRegisterAfter then
  begin
    kg.RegisterAfterYear := YearOf(dtpRegisterAfter.DateTime);
    kg.RegisterAfterMonth := MonthOf(dtpRegisterAfter.DateTime);
    kg.RegisterAfterDay := DayOf(dtpRegisterAfter.DateTime);
  end;
  // Register Before date
  kg.UseRegisterBefore := cbRegisterBefore.Checked;
  if kg.UseRegisterBefore then
  begin
    kg.RegisterBeforeYear := YearOf(dtpRegisterBefore.DateTime);
    kg.RegisterBeforeMonth := MonthOf(dtpRegisterBefore.DateTime);
    kg.RegisterBeforeDay := DayOf(dtpRegisterBefore.DateTime);
  end;
  // Country
  kg.UseCountyLimit := cbCountry.Checked;
  if kg.UseCountyLimit then
  begin
    kg.CountryCode := KEY_COUNTRIES[comCountries.ItemIndex].Code;
  end;
  // Executions
  kg.UseExecutionsLimit := cbExecutions.Checked;
  if kg.UseExecutionsLimit then
  begin
    kg.ExecutionsCount := StrToInt(eExecutions.Text);
  end;
  // Days
  kg.UseDaysLimit := cbDays.Checked;
  if kg.UseDaysLimit then
  begin
    kg.DaysCount := StrToInt(eDays.Text);
  end;
  // Runtime
  kg.UseRunTimeLimit := cbRuntime.Checked;
  if kg.UseRunTimeLimit then
  begin
    kg.RunTimeMinutes := StrToInt(eRuntime.Text);
  end;
  // Global time
  kg.UseGlobalTimeLimit := cbGlobalTime.Checked;
  if kg.UseGlobalTimeLimit then
  begin
    kg.GlobalTimeMinutes := StrToInt(eGlobalTime.Text);
  end;
  // Hardware ID
  kg.UseHardwareLocking := cbHardwareID.Checked;
  kg.HardwareID := PAnsiChar(AnsiString(eHardware.Text));
  // Crypt Sections
  kg.EncryptedSections[1] := cbSection1.Checked;
  kg.EncryptedSections[2] := cbSection2.Checked;
  kg.EncryptedSections[3] := cbSection3.Checked;
  kg.EncryptedSections[4] := cbSection4.Checked;
  kg.EncryptedSections[5] := cbSection5.Checked;
  kg.EncryptedSections[6] := cbSection6.Checked;
  kg.EncryptedSections[7] := cbSection7.Checked;
  kg.EncryptedSections[8] := cbSection8.Checked;
  kg.EncryptedSections[9] := cbSection9.Checked;
  kg.EncryptedSections[10] := cbSection10.Checked;
  kg.EncryptedSections[11] := cbSection11.Checked;
  kg.EncryptedSections[12] := cbSection12.Checked;
  kg.EncryptedSections[13] := cbSection13.Checked;
  kg.EncryptedSections[14] := cbSection14.Checked;
  kg.EncryptedSections[15] := cbSection15.Checked;
  kg.EncryptedSections[16] := cbSection16.Checked;

  // Secure constant (get it from project file)!
  kg.EncryptedConstant := 2113444489;

  // Generate reg. key
  dwResult := KG_GenerateRegistrationKey(@kg);
  if dwResult = EP_NO_ERROR then
  begin
    mKey.Text := String(PAnsiChar(kg.Key));
  end else
  begin
    case dwResult of
      EP_ERROR_UNKNOWN                 : mKey.Text := 'EP_ERROR_UNKNOWN                ';
      EP_ERROR_KEYBUFFEREMPTY          : mKey.Text := 'EP_ERROR_KEYBUFFEREMPTY         ';
      EP_ERROR_KEYBUFFERISLESS         : mKey.Text := 'EP_ERROR_KEYBUFFERISLESS        ';
      EP_ERROR_REGINFOEMPTY            : mKey.Text := 'EP_ERROR_REGINFOEMPTY           ';
      EP_ERROR_REGINFOTOOLARGE         : mKey.Text := 'EP_ERROR_REGINFOTOOLARGE        ';
      EP_ERROR_PRIVATEKEYISNOTSET      : mKey.Text := 'EP_ERROR_PRIVATEKEYISNOTSET     ';
      EP_ERROR_PUBLICKEYISNOTSET       : mKey.Text := 'EP_ERROR_PUBLICKEYISNOTSET      ';
      EP_ERROR_PRIVATEKEYISINVALID     : mKey.Text := 'EP_ERROR_PRIVATEKEYISINVALID    ';
      EP_ERROR_PUBLICKEYISINVALID      : mKey.Text := 'EP_ERROR_PUBLICKEYISINVALID     ';
      EP_ERROR_KEYMODEISINVALID        : mKey.Text := 'EP_ERROR_KEYMODEISINVALID       ';
      EP_ERROR_KEYBASEISINVALID        : mKey.Text := 'EP_ERROR_KEYBASEISINVALID       ';
      EP_ERROR_CURRENTDATEISINVALID    : mKey.Text := 'EP_ERROR_CURRENTDATEISINVALID   ';
      EP_ERROR_EXPIRATIONDATEISINVALID : mKey.Text := 'EP_ERROR_EXPIRATIONDATEISINVALID';
      EP_ERROR_KEYISINVALID            : mKey.Text := 'EP_ERROR_KEYISINVALID           ';
      EP_ERROR_HARDWAREID              : mKey.Text := 'EP_ERROR_HARDWAREID             ';
      EP_ERROR_HARDWAREBUFFEREMPTY     : mKey.Text := 'EP_ERROR_HARDWAREBUFFEREMPTY    ';
      EP_ERROR_HARDWAREIDINVALIDFORKEY : mKey.Text := 'EP_ERROR_HARDWAREIDINVALIDFORKEY';
      EP_ERROR_PROJECTFILENOTFOUND     : mKey.Text := 'EP_ERROR_PROJECTFILENOTFOUND    ';
      EP_ERROR_INVALIDPROJECTFILE      : mKey.Text := 'EP_ERROR_INVALIDPROJECTFILE     ';
      EP_ERROR_EXECUTIONSNUMBERINVALID : mKey.Text := 'EP_ERROR_EXECUTIONSNUMBERINVALID';
      EP_ERROR_DAYSNUMBERINVALID       : mKey.Text := 'EP_ERROR_DAYSNUMBERINVALID      ';
      EP_ERROR_COUNTRYCODEINVALID      : mKey.Text := 'EP_ERROR_COUNTRYCODEINVALID     ';
      EP_ERROR_RUNTIMEINVALID          : mKey.Text := 'EP_ERROR_RUNTIMEINVALID         ';
      EP_ERROR_GLOBALTIMEINVALID       : mKey.Text := 'EP_ERROR_GLOBALTIMEINVALID      ';
      EP_ERROR_INSTALLBEFOREINVALID    : mKey.Text := 'EP_ERROR_INSTALLBEFOREINVALID   ';
      EP_ERROR_INSTALLAFTERINVALID     : mKey.Text := 'EP_ERROR_INSTALLAFTERINVALID    ';
      else mKey.Text := 'Unknown error';
    end;
  end;
end;

Show/Hide Borland C++ Builder function example

void __fastcall TfrmMain::bGenClick(TObject *Sender)
{
  TKeyGenParams kg;
  char keybuffer[2048];
  WORD wYear;
  WORD wDay;
  WORD wMonth;
  DWORD dwResult;

  mKey->Clear();

  if (eUserInfo->Text == "")
  {
    ShowMessage("Registration info is empty!");
    return;
  }

  // Clear params buffer
  memset(&kg, 0, sizeof(kg));
  // Key mode
  kg.KeyMode = cbKeyMode->ItemIndex;
  // Key base
  kg.KeyBase = cbKeyBase->ItemIndex;
  // Hyphens
  kg.KeyWithHyphens = cbHyphens->Checked;

  AnsiString asPrivateKey;
  AnsiString asPublicKey;
  switch (kg.KeyMode)
  {
    case RM_512:
    {
      asPublicKey  =  "0201B810DA4A1ADD4351378790A98138533067CP4S86R7D8THS45GBCVUM635EPRQRMYRP3DAA5DUPZ6ABDSFP7F5AC";
      asPublicKey +=  "P7ERGH4A7Y6B6NW6NMMBZF83WVER9Y4MMBNLBQDKR7KFVLGLV067CFDQC";
      asPublicKey +=  "WCHGQVVRN24DECEPBL96YJQJTVDCRTNQG3E4WW4GK4GQ5X5L5H88D3XYH";
      asPublicKey +=  "CBRBNASPD3P5CNYFKFHBCSDHHD6WPTCC4XVSM5S88067C2JSTCMVT48C8";
      asPublicKey +=  "HC7SHKGTFJBM28P6XTBCNWHMV6J6KN6W5Q9TQLVR285U6GVCAAUTZLRTP";
      asPublicKey +=  "SRGDQ742B4742XF4MACRR747YDP5FZZ9D";
      asPrivateKey =  "00C98B2SF9UBJA605AJX53GJFXJV8UH4A6PY2L6CV4MAMV7V3ERRVY99Y";
      asPrivateKey += "72V2P77Z2J3KBPGWR3WXKG5GF9Z6CKXJHY5VUMBTQ66H2MRZPCU00DLFJ";
      asPrivateKey += "675JTTTNEK00DLFJ675JTTTNEK";
      break;
    }
    case RM_768:
    {
      asPublicKey  =   "0201B810DA4A1ADD4351378790A9813853309AEHRR66KMK99UEPX8C54WQFDZQ5Y96WUCVZYMXBC32SJV7T5SBPR54E";
      asPublicKey  +=  "2DBH8UD9RNHTJ9BLJV6NHX52W7PZDDTTJDDGF3YFVL7PJFL8RS8THTFDF";
      asPublicKey  +=  "4RY7K3QXLTMXMC8DDSRVRWBVMMP3UYKCDDC7KGL9PG509ACPTRQ4MMUKG";
      asPublicKey  +=  "DAUJFFFGSCBFLYK9X9E74M58PW5FG9B9RTLXJQ4STPVCHJTEH8BP557VZ";
      asPublicKey  +=  "PQYDBUZJXXJNGVZELFL4UL3LHHE8A645CK593DVWCQBSX4ZCCQ3ST8GCZ";
      asPublicKey  +=  "LW2729XK3NT7GST3LMQGXSHLDWCXE09AENVX2QTX3VLT6FWB4JND875XZ";
      asPublicKey  +=  "WQ26GW76TV3KVVHK7U489LLPBQ39HUWKMA65U3HKWBDHKBZEB525PHEH2";
      asPublicKey  +=  "YQHRZGNJAAYZXMWN8RNZ9T7VMZAJMP2V3S9NXZ9RHL96F7AT3NTMN36V4";
      asPublicKey  +=  "ACSFEN4DR6TJR95";
      asPrivateKey =  "019VRB95TKY456YC48LBS9FK34YN080VVPDJPPKU6XA9EPLX7HTVN3VST";
      asPrivateKey += "TNJZFPH4HQAFY58R593KFKSNZ7WEZBA9AZ6PGN735EWEFUAEM3G8XVUFN";
      asPrivateKey += "L2ZFRPXA4V8KVXE4M8GACUJAT7H3TTWZT9ZDE43ZF46HC01AHFR85MVR2";
      asPrivateKey += "UP7K3N53M8MTNWBUP01AHFR85MVR2UP7K3N53M8MTNWBUP";
      break;
    }
    case RM_1024:
    {
      asPublicKey  =   "0201B810DA4A1ADD4351378790A981385330CDG9YQSEUK2HT546KWW46NHSCHMD2TNCSPVNSKGQC6CHDUSU9CC4LDPL";
      asPublicKey  +=  "TD3NLRVD3TFV9BU2SYBUBU9TXKLQ3CTKZE5GN9VFG37R9YNK2FE58K7ZY";
      asPublicKey  +=  "WTUJYFSJTBMDLLGA9GJ2LJXGHSS9CESGC2K69H65YQGAC7CRGF5T3CPLA";
      asPublicKey  +=  "5BDJZKVCUWPZRNA2DN7L956LZVZBQUDPX6PF30CDBH26Z82VE4QQ8N85L";
      asPublicKey  +=  "QHYJYYCJ6WQ89H9K9VVQX925SG5FJ79AGVZB6M8TTFKCJ56FAREP8GSTC";
      asPublicKey  +=  "NKWCXEALDP9Y2ZLS9QKZV8JRNDHG9D8BRDSCTMDQK9NLAPZ9TGYFS9G7U";
      asPublicKey  +=  "LXHYJF7F9A89HPXGTU2N4FQQJL98WZ5QND2KTEMMUUZFAX953HCGNSWUW";
      asPublicKey  +=  "U2M7LBEWZSH9GW5SC0CDJDY2HC4HJYUSVTAVXZ7MYVJWF3CU9WC3SVPSL";
      asPublicKey  +=  "29WF46DVS2SYKSSAMATPPYGJDE3PBFMGS34CXWQSXKCEAE63L2EXTS9NE";
      asPublicKey  +=  "2G597XASY3S34XMYST5YZF4THUTYT5DY9UKKXU6PH8MLXRPZMPMMR83JU";
      asPublicKey  +=  "X2WGNEW8ZGL4SKUCUB8CEAB6UZ4FB66WTP3B64VMX7XG75T4Y35479";
      asPrivateKey =  "020MLJ7XTRVLBDNUVMKGUFHCU8XBGMHHVRA0ADSHPBC7NVSZ82AM867XC";
      asPrivateKey += "BELNKMR7CZ56C4SW8KKRD9WZLE5X992GZVSZXS5J6JG9SLDW3Y696TU4D";
      asPrivateKey += "QZP778LVFKVRKANQD6FUGN2ACWUJM9ZK6ME7WXWDZ88LTWHME52RKUDKX";
      asPrivateKey += "STT7RGWP7HFUJDGWEUG4ZHQ25DCQJ644CLEXRR3G020SAAREJB4WXZ4H2";
      asPrivateKey += "JEH4AB4U8FGFTA4CAF020SAAREJB4WXZ4H2JEH4AB4U8FGFTA4CAF";
      break;
    }
    case RM_2048:
    {
      asPublicKey  =   "0201B810DA4A1ADD4351378790A98138533199H9KZC4CQ5ZKPEGYDW2EHN5AKZA5G5KP4HU8USWJR8XWW7MCH7244RV";
      asPublicKey  +=  "PSXFHVU6YQRK4LPUHM497XJYPLLA3DHUZWXK3CB5SUYF75NPYLTNPRUAP";
      asPublicKey  +=  "CTVDHAKYWTRQ97HES2E59WDN2LJKFYA2K8BGFSBHP4A6BF5FSDTS8NWLL";
      asPublicKey  +=  "C5NEQ76NJ9BAMWXG55UPFFMRQZTU5KV2G6LSPQUJJWA9U4LJ5SCJ9M9ZQ";
      asPublicKey  +=  "Z6K7LZA9UAMJ533UQ5J3JPNQAUWJGZFRFCTGAGSBWPWRRF9HRGF9MCX55";
      asPublicKey  +=  "QRYGPYMRE6DBJ65SJDX34FVPYWWKWQ48MCKXYXPHQ23BJ42U8ZMDD8CG5";
      asPublicKey  +=  "DPHZQ5XTXUKA277XK6PKSTLJ88ZZ9EBXH62REMRZZRGNPKHYM34RW722S";
      asPublicKey  +=  "SZHMPFKY7X8UZ19ADGX3UQ7X444XH7MZXEZYW2YLFHR8YL3PTCXVSYX89";
      asPublicKey  +=  "ZXN7KW2XNBE8XS3TQRGZVF6KA5USH56NEZYH5RNWBBPVE9LD6H42RQWR5";
      asPublicKey  +=  "YVQMT5EQYQTK6YM9V8DA5BJCLGGZ2UGD6NPA2X3SNUS47F7HJBNBCWHRA";
      asPublicKey  +=  "YPPCQ5HWCJNPDHUDQMRN2P6PWJFWJ6CLVNK8HXEFLE4ENPXAFN89CRS43";
      asPublicKey  +=  "RUMVGDJQCSRB535XYCS6BZYLA9Q6HJV425F26XXHRGA7C8R8BVMELAPEH";
      asPublicKey  +=  "5DSA9KXTCV4H2RNVDFHG3YJSERZVFPWHYA823LUBENBL5U3J4LJX2KQLW";
      asPublicKey  +=  "L5XGGESPSE2FQWKSQ4NUCDLBEJPQAT2A2477DYS2XEXKLYEAKUN22622C";
      asPublicKey  +=  "RLBCAHPFNEV2FJ2H8N3JQGXJRGP19AFHGRW6SS2ZSFYK8EZAPVYL4MCP4";
      asPublicKey  +=  "6UMR64Y9T89FHWEPXBRHKWJCSNNNGPU984J5XW4BWTU6PDWPN24W8RU55";
      asPublicKey  +=  "A9C3U9H7VHS5PFURASHBT4JAEE5ZKJBSYMCMDVBLU973R72RVPA6U96A2";
      asPublicKey  +=  "LX8HMASVST9RVJ7W66V4DYWRDZZQ3673W7C7LVF68TWPLNMYEUQ8FDZRN";
      asPublicKey  +=  "P38D9BX5YA3VENETDUUUMR9U7FFP4NZM7G4Y6J6EASK5SAXXTRMZ8F3AH";
      asPublicKey  +=  "5FC54E543N739BY5KVZQM7JZWD2P2HPE7BDRMM9JFCGPBWWASTZ7UDNRV";
      asPublicKey  +=  "6AFHVMBR9AGAERE9M6W6S2ZT8PBTABPDCKBPPPV6QW9DRXZUGAHDDRRSY";
      asPublicKey  +=  "XM4YXQ2QJX6CL33N7RV8846LK8A3DFLDXWZ2NKF8V";
      asPrivateKey =  "02DB825DUDFYHA88AG49NMM742HCQEJDKQQGDR6G3GL7MCED16DU9KTVE";
      asPrivateKey += "47XQ3M92FFKX8FU9ZXT7AK7VTGGJSYQERCZBR8J2DE2CFE3VUU4W7JEQJ";
      asPrivateKey += "L49HDUXBW7SNPCV8MHXM7EQHYPQK3GSPQYV5VWESQE4AYWFZHXN2UX7Z3";
      asPrivateKey += "T3CV52XURB3YFKLUCY6CJTRACRVVDD568F6F28U74ABWCZ2ZMC32E83V3";
      asPrivateKey += "4JZZPDBF3KEYQWREETGKQT6NANCMAD4XDEXW5LCYBJ3GMDJBM3E7FNK98";
      asPrivateKey += "7JEUYEV7QNKGKNTDVMRG3G5L8NC9CNHQS8AVDMDBEGCG3DHGJUGPG2244";
      asPrivateKey += "2C9LCD8FJ2LSDMQXLHCGCLP7ZSYQT2UJ4QFGU2CH3BTT3UADZMQSBAV33";
      asPrivateKey += "B3Z2Y8Y8RRD9J754G02DJ372LR8APP7HXKB2GNPHP6T65C3RR48Q8BHGP";
      asPrivateKey += "KEZ6PX2D02DJ372LR8APP7HXKB2GNPHP6T65C3RR48Q8BHGPKEZ6PX2D";
      break;
    }
    case RM_3072:
    {
      asPublicKey  =   "0201B810DA4A1ADD4351378790A98138533267BJBN6W8SY33Y47RWJHWS385XWRV9TSVSB5EM7ECZYNSJ44ZKSD8KV4";
      asPublicKey  +=  "6Y9T6TNC6QMDW4V6DBMADU3YUKLP88TCLEUD9FTEUHGXM6T57AQ2EMB59";
      asPublicKey  +=  "UPQVNSUT7Z4EHAMDQ6N77VK2A6P847MMWJH9E7C5XX6FNF6MHGWERPWQV";
      asPublicKey  +=  "9ZLVR9Z7X5D5Z2XQL6MBM7BDCT2DEDVRBFNDDBLG6LHZ9APM48LS5TKTJ";
      asPublicKey  +=  "AGDYFDRVHEGTDH47PCLL8YJ4ZAWCB59F8BN5PZL3NQACP32G3YNBX5E3J";
      asPublicKey  +=  "7S28XLRGAX55ZML5XE6Q68EUAL38VUBJ2MZ2UGCCHM7CE6S99N44X9RMV";
      asPublicKey  +=  "7B55HULJ4KHPFYSBDUSPQTCWGS76BEQST2QCZDZ2T4FBA4YUJFF47AACE";
      asPublicKey  +=  "A4EEFESEYWN48UZCSDZAMGSU5VB9UJKR2XQUSDFS3TNG9QKURQWS7N5Q3";
      asPublicKey  +=  "VPYT4QAGGQ5GW2MMXHDJYW55FQPHSS255GVJ7WLLP85JHS8K6DVTJWB4W";
      asPublicKey  +=  "4Y8ZEFF7KP6W74PAA8FVPZVDW4RKGMQ8V56Q6R4V34XFE5HR4FZS8GZ6R";
      asPublicKey  +=  "36RKW6WN34S2AHR9LCGF8LULB7ZN6NC2AA5RPDZYGWSPPME6267CGLZCP";
      asPublicKey  +=  "GG98W557RXCDWAETJHDCRPUXX7AD3E8SL9WMGBV9QFHMSV9UFV7H9NTX3";
      asPublicKey  +=  "QYV95CN9P9DSYQWL35R2BWB4GKW6CTWVB2X6WH3P2WFBE6X55KBLAMDB3";
      asPublicKey  +=  "SRDSDVY37GKH78MUHY7KDJDC8SJU5FUQRYZ49ULX3YSZL7E284GFVZSGD";
      asPublicKey  +=  "FTTQNR6VMBM3LLR78SUSVMJW88XT2K4UHEATRU3V9MMR2VGNGCY9S6R7M";
      asPublicKey  +=  "4ELNPEBBMQP2HVPLY5M5VPA92V7NU8ZZ58YYTW5QK9USZ5LV59UZGB2CF";
      asPublicKey  +=  "DPZ6HFYU5WB7UU3UYWVNSNKM3W7GBYKJP8TMFW2YN6GNSSE4ZKFVZRLUT";
      asPublicKey  +=  "8QPZBBEQT5H9H5Z53D7QV4AJTKTX4EMW62TDWXQVK24JZPSG2VXKCMYZL";
      asPublicKey  +=  "BUASE25R3EEK9KBLJ8VX83ZXGTBL5CCDBY33HJ6FKX8AW3WPRX3XTCS9G";
      asPublicKey  +=  "2B9SVK2XFFKNSPGFG6FZNS8P2HERFGFL79DKUZZFWHFH4H9UZ7F7F6W3Z";
      asPublicKey  +=  "WN84JRRA7SU8T89EQMRBEPVYMMGLGSUMFWWMEDLJM5EGP5WEX9LDUAQXS";
      asPublicKey  +=  "55LKDQVRKX4R8NNBHSYBHSNMFYA2C6KGQQFK3TN267DPSZT3PTKHTLNMU";
      asPublicKey  +=  "V2YYZZRX3953LPWAKYF8LJUVMEQT3ZC4F9SWMYGUHG6XX66PJFQWSRUW2";
      asPublicKey  +=  "C79YLGZ6ZAFS7HLXBTH55UD3EGFBZQ5CLNJDZTEJACDVBCM5FQBTX4DKK";
      asPublicKey  +=  "UDGNSMWWLC5UMQRHW89CTU5636WYDXVZZDAUZ529458LDN2DAR9QADWRZ";
      asPublicKey  +=  "UTU8MCKN8ACH3R36YKE52DDF67SM5UDUH7PTATHXE65UCGFRCV49UTF29";
      asPublicKey  +=  "BGDSUWGRMC839HUZYQVAG985YUF5KJCAVGKRD8E4YMPJ38KR6HD2KHDGY";
      asPublicKey  +=  "PJDMJMN4Y3DTJW5MYX3VUPF32637LMAWFM4QCU7BMP74SCF4N5QXZZVBE";
      asPublicKey  +=  "LAQMPYMJC2ZWJ9XFV33YXTTPH3SG9KMUABLL83P7L3UBVM763XJPR5UEH";
      asPublicKey  +=  "DZ73XJUGR9QP6299K5PU46XGVWKWFAKWYMRXUSLCFJ3WQTEC6QJH6E5V8";
      asPublicKey  +=  "X2RMA5TXGSBEWLGSMNQ2SH6G9MLKK4S486DN4M4QVDTYTM4JQETAJQGP7";
      asPublicKey  +=  "6NUR4UNDXR4W4JQSNWDTUGX69SEDC3AL8ZF4TJBQQRXSX2A86UUWCDCFH";
      asPublicKey  +=  "JE94A8EP3Q6A2QTYKEE62MV4VJB2AB";
      asPrivateKey =  "04DMQBFL5GKK4RXWEZYPEY8QB5GHBBGW3EY766DFF2Q6PLFLR4SSRWXBN";
      asPrivateKey += "W5CFGFC84UJ8PKRDQQYWN9921AH8AGZAQRWJYZ7C3QUJJCJAAGGT5P5GG";
      asPrivateKey += "LY6K5W4JZJDW7Y8EWS6SSYCS2MCR93MY9DG6VXLBRYVZWDX6XNFU286HM";
      asPrivateKey += "AM9E82KJVZNYGC8RXRW43SFFWDLR8C96R58A42F3TGLXPVWLGMNPPAWS4";
      asPrivateKey += "S2SSMNQLUPBAQMP7AUKAGV5CKL342W6UKQY3TUPXKGFXFES725PEX93UX";
      asPrivateKey += "X4K8JRY3MPQ5S94VNPBXQ5N6LDBLWB67LBLDCGNQS3JEKW667UF8LA8Q6";
      asPrivateKey += "B3AF4XGZKYB7BVVHF49DJUHSFJZRD63S4GMMAPQ8Q87HKN9G3J3575JEL";
      asPrivateKey += "5C29NZLWQW6MSYWJ7S3NKLKPWGU75ZJXKEL6Z9V97HAMDYHM6ARCH58EP";
      asPrivateKey += "WRPZUXN8RRWGCDFM6BH6XUTRTFE3VMAAZAUUKHKL6AFC2PCPXFRDWLVYP";
      asPrivateKey += "ZKUGY8QDEZNECK9K5Y5MET9SRWQ36JF77XJ6NUKSMZ6DKUPEH4W43YQAE";
      asPrivateKey += "CV7XVFWJ7ZTRVFQJZFU5BS8AL77YLCXDCR5VPFFZ9NP7EBBQ2AA04DP3S";
      asPrivateKey += "86B3YD8AFXQ3KPPNTPHBTQSM8PUHJHG87RUM4EV63GKPBRGSN3VX63FCS";
      asPrivateKey += "646DLWSH86B542U3F04DP3S86B3YD8AFXQ3KPPNTPHBTQSM8PUHJHG87R";
      asPrivateKey += "UM4EV63GKPBRGSN3VX63FCS646DLWSH86B542U3F";
      break;
    }
    case RM_4096:
    {
      asPublicKey  =   "0201B810DA4A1ADD4351378790A98138533334BN75EUD4LFWYFVNFGBRCEMKKXG62QRBXL8GMHQ975B68FJVEMNXQQ7";
      asPublicKey  +=  "RKR7RCZMWDVP86QPB3LR49G9BM7EUUZXNCRZBXRF4PEY3RX6UXT4X286K";
      asPublicKey  +=  "WMR7AMEE6QNP9AEHGWJT9AVU3F62F37B5GVX2BQF73QWHRFQSQ6XMRP6M";
      asPublicKey  +=  "ZDRQ8JT89UF3YRK5UL34MM3L8HLDTWAJF5YY7MRWJUFDQRK9JNCJ6C9KJ";
      asPublicKey  +=  "WRE5ACQSNS24NEAHDYKS3AK75HBCTKP9NR2CSL7Q9PPXM4TF7L37USP77";
      asPublicKey  +=  "Z7WER6JY67F7YGKTP6MFRMKK9H8XFPZ9XWKK97XCFXK7AW4TB96WGEH4B";
      asPublicKey  +=  "YPF9QRF2DGC3LCHW8VTD2EMHVRDR6EEBUG8R4XYKJPLBPRCJP445DU2BW";
      asPublicKey  +=  "JWELKAY45GKDU5HLTTDTWRH2JFKJ7AVAKLPEELN29YHX5JR773P9ERW7N";
      asPublicKey  +=  "UFMWDKD4UL4YPU5QW2L4A7ZN3E8ZDQVEZUR6ZRDQXRLQRLUNHVB4XGBWD";
      asPublicKey  +=  "HM79NGJARHDBQJCD8NWZCWPBY26QARP7A5S48DCV29F7MUTHU3YAHYVS7";
      asPublicKey  +=  "ZPGXJZZA5HBBY4K5BQPUG6MVCBG8H3C7VL8KH9EH58NUVCE6F2CGMSM94";
      asPublicKey  +=  "4CQDKNVGWWWRNK4DG26UT88Y9ULUPJ25G9KLTQPK3TBXZEK43X8KPMJT8";
      asPublicKey  +=  "DF6MTQ5RB94XR2BT9H9NYYTXL29GF8KZY9QNHAW4LTT2RDQTD2ELWPSV4";
      asPublicKey  +=  "4AND9K8G5VKLQ287UBEVHA82CMSMGQQBMNQZVAZ9G8T5TD6G9F7XQHMJT";
      asPublicKey  +=  "HCL6PFEDUW5MN9JASF2EKPT2H33325A3SFGGM5C3RYKZSYSSQC5FLHNX9";
      asPublicKey  +=  "VHN4HQVWD66YECY4R97JZHQALRTCHXUWH85LSJCCTQZT8JF52FHG6FV9J";
      asPublicKey  +=  "UJWEU24K9Z7SKYTYA9NH7GW29FSNKUK3DMFXY48VEYZVDRTTMLFYSJH8B";
      asPublicKey  +=  "RQXV72REYGSM6SLX89EVQ52CN9N8YDLWHAWCDDNM89YN2FCRTLE8688XN";
      asPublicKey  +=  "F4MZMFE6GP9JK2JTFJVUKBLES2ZVWSBCJE9N3D7DG9LL9Z3U42QFJJPE2";
      asPublicKey  +=  "HE5XCRY25UND96R9D7655ZBSCPF796FJZ4GPLY7AMZLGLR77GRP467ELK";
      asPublicKey  +=  "PXSZ9ZF8MUYFDHV4EFACPZ79CDFTYW56NE9JDWDVUMNLY9EXDSF8ZNABE";
      asPublicKey  +=  "MDQU6T9RVLTNRMZJJ8EJSUM9TV8YA6MNWF2Y66MD3VQ9L662F5X6VE9ZC";
      asPublicKey  +=  "PPRTNMEV2DG9BUMFMSL7PUR9H5QG6VVBDBMEU3PLABL57HMSQ5C83E9X8";
      asPublicKey  +=  "RTPY4QSEH2H7R2QDJHT5LQSFNQJL2NZ24GLNTFXG468WC5UUTDD68G8HM";
      asPublicKey  +=  "477Z8P4F9ZZHUGZ6VPFF32A2MPWY8LPXNECCKM9EEVLDDPUJ8LXN2AE6K";
      asPublicKey  +=  "Y2Q42FVBCJM9GQTXNRHBED735KCFD4YGV4U5U3LJD6NJ886W6XQLWH3G7";
      asPublicKey  +=  "3VZ6T5YDUQP6DA5ZHLKQSGATDJHUWC2ELTE7QJFXH8H9EAQYZPPMW76JG";
      asPublicKey  +=  "Z48UBND9VXFXZMSGBNWQPNQG7E4TCBDMVKUSA9TTVSNLN3DXEZNXH787R";
      asPublicKey  +=  "N7XHFBJNZ5W74DUMNBYVHEQDYMZBQCFMS8LGSDUAU6QE9DD5Q334BX62T";
      asPublicKey  +=  "JP5WQQDS2ZEWW76XW7VMLX3L7V9UVD7RL297VDBVRFPQ5MYA3YFVBVNVA";
      asPublicKey  +=  "R5TJXMQ4X2U2PW6UWSKBXT58HG3QPZM2RVEX2PDMCVJDFTJMXR9NPLW4C";
      asPublicKey  +=  "6AE4Q9A8TTAQ68BSN9WWTFFTSX68ECVARFPDBBH5DMP4KYFARTFVCSWNF";
      asPublicKey  +=  "FGAPBYYGFJA4MGHEDWTNE54MPGER7EPCZEV2ESJRMM6XDMFGABG97HECN";
      asPublicKey  +=  "3SZFUBRKCNDZ2TE9F6EERULRCDAV5EMY6KVY9NY9MYNPP2FQ5WFWLMRYD";
      asPublicKey  +=  "4TNYYHE6EDMQ6KK79HH5Q5KBW6DDQYYNUR365W2454CHEZWZAPU82SX4H";
      asPublicKey  +=  "KHNZXBRVWAT7G9CJBKHNBPSVEL67X8UJHBFHZH8ZD4NSEVFZM4Y768TJ6";
      asPublicKey  +=  "QP3BGEKLTY4UZUWHG63QMKVWAQW9E7WRFNJCH4XRD97JHNKMFUTRFVH68";
      asPublicKey  +=  "G5CKSMGC725AZ9CBSL2JX43P4EY44CMF56AJ6BEXVCJP2ZDWCT9G55K4D";
      asPublicKey  +=  "F24J7TTJMFXTQH95CBNX67CBPNWEKHCWQV6VD73Y9KCZHNBFUFS8TCYNN";
      asPublicKey  +=  "WXRGFKNVRDFUKWHDWDDTSPEW8YCKLPMX2GUV3N4JFJMUE6TSJR6Z53C9F";
      asPublicKey  +=  "SKZAY3EN7G66JPBF5E9S6Y7RQHPWZHSRDQ7XH87PHUJFLJFGD7WNE3Q9P";
      asPublicKey  +=  "EXMW33LVJBFEUXKNUB6SU7ZYCEX96XT8G27FLUV7XPV4JK64DWDJCX9WV";
      asPublicKey  +=  "4VL8CK23FQJ28UG9JUZTQJ3DRL32BTJVRD4LVQ6MK9LCE7ZZP925JK7ZD";
      asPublicKey  +=  "92SCV4DDJJ5EXMVBF";
      asPrivateKey =  "067DN6F8YFBTWF5QH8MHJB39Z7VNN2P56HS8RPBURAWB8KPL8FQWX4HSP";
      asPrivateKey += "RTY4HWFMFXAVX2YUY99G2U2KKK56CBE4BCPZWS3KJ98XRW4PY2CDQ3ALF";
      asPrivateKey += "Y3HGJG42NRY9ZVGZZB59TE29KGC825BYBX3FRFMYBVN2VTHM8YM2KULXM";
      asPrivateKey += "H24XSHNVK4HEQ9L5264844DMBFUUXSBA9PT9LEXT6449TMAMF7RL6KU6C";
      asPrivateKey += "GP6FU9DNMJCNTUREF2U9WUMJBMXMMHWKWDG4VU5JQNFFNNWCP2YE2DGFD";
      asPrivateKey += "N3H27NTNR58GBNTTZBRK66BKWNVMF8H59KALB6K93Y8UWDUWV5HJZGV8X";
      asPrivateKey += "3AS5EG982DYV4W9CQ3GRRFRR8NABQC98FTAG465SXQ3JPN7X7VULQZX4X";
      asPrivateKey += "UK68URBFPGCW2UPBYH6CRG6C7YBRAURM2KMGN5L8XH4AUQN8WM4P454WN";
      asPrivateKey += "NWRE5SQEC78FK3LHHQU5VLXLYYN8F2NXGG7CCQ92EEC63ZE6S7CC7RTML";
      asPrivateKey += "UMM3PAXPL5CJZFL26JNNYPVLAHM75NDL8AS8JR48PFXK49D4A6TY2ZU9Y";
      asPrivateKey += "XX2Y2TLA3J8T56EPY236FEDGZEHTQR73NE2Y7LKL7423FFKGGPWYL8PB5";
      asPrivateKey += "VWD54PG328ACE6V8VLSGVP9VJMMWS2VDVU459C8K5XK869Z5KM4JWHAVE";
      asPrivateKey += "G56ZESC6HHJ423N6SAH2DW2UQZDQHSMKWUCHPUKZZPJXCQXF55Q3BJW6Z";
      asPrivateKey += "QYK4HM4Q8XWU8NT844E8YM96EGHSYEUKAJ3QDXANN2DELSGARH7LR2XH9";
      asPrivateKey += "UQBQNXGPZGB6JTEQP8HAQK5ZZYJE067DWX6C2JJ7L2HE4NGVXZV5XH9RD";
      asPrivateKey += "P9SNG4WZTC9KEMGXDX7JTQX8RPJJRT4YTA83L8GXDNDDHB7C79CN8UWGL";
      asPrivateKey += "U5EMNMBREQN5MYTYHGYK067DWX6C2JJ7L2HE4NGVXZV5XH9RDP9SNG4WZ";
      asPrivateKey += "TC9KEMGXDX7JTQX8RPJJRT4YTA83L8GXDNDDHB7C79CN8UWGLU5EMNMBR";
      asPrivateKey += "EQN5MYTYHGYK";
      break;
    }
  }
  kg.PrivateKey = asPrivateKey.c_str();
  kg.PublicKey = asPublicKey.c_str();

  // Fill key buffer
  memset(&keybuffer, 0, sizeof(keybuffer));
  kg.Key = (char*) keybuffer;
  kg.KeyLen = sizeof(keybuffer);

  // Fill User Info
  char namebuf[255];
  memset(&namebuf, 0, sizeof(namebuf));
  memcpy(&namebuf, eUserInfo->Text.c_str(), eUserInfo->Text.Length());
  kg.RegInfo = namebuf;
  kg.RegInfoLen = eUserInfo->Text.Length();

  // Hardware ID
  kg.UseHardwareLocking = cbHardware->Checked;
  if (kg.UseHardwareLocking)
  {
    char hdbuf[255];
    memset(&hdbuf, 0, sizeof(hdbuf));
    memcpy(&hdbuf, eHardware->Text.c_str(), eHardware->Text.Length());
    kg.HardwareID = hdbuf;
  }

  // Key expiration info
  kg.UseKeyExpiration = cbExpiration->Checked;
  if (kg.UseKeyExpiration)
  {
    DecodeDate(dtpExpiration->DateTime, wYear, wMonth, wDay);
    kg.ExpirationYear = wYear;
    kg.ExpirationMonth = wMonth;
    kg.ExpirationDay = wDay;
  }

  // Register After
  kg.UseRegisterAfter = cbRegisterAfter->Checked;
  if (kg.UseRegisterAfter)
  {
    DecodeDate(dtpRegisterAfter->DateTime, wYear, wMonth, wDay);
    kg.RegisterAfterYear = wYear;
    kg.RegisterAfterMonth = wMonth;
    kg.RegisterAfterDay = wDay;
  }

  // Register Before
  kg.UseRegisterBefore = cbRegisterBefore->Checked;
  if (kg.UseRegisterBefore)
  {
    DecodeDate(dtpRegisterBefore->DateTime, wYear, wMonth, wDay);
    kg.RegisterBeforeYear = wYear;
    kg.RegisterBeforeMonth = wMonth;
    kg.RegisterBeforeDay = wDay;
  }

  // Executions
  kg.UseExecutionsLimit = cbExecutions->Checked;
  if (kg.UseExecutionsLimit)
  {
    kg.ExecutionsCount = seExecutions->Value;
  }

  // Days
  kg.UseDaysLimit = cbDays->Checked;
  if (kg.UseDaysLimit)
  {
    kg.DaysCount = seDays->Value;
  }

  // Runtime
  kg.UseRunTimeLimit = cbRuntime->Checked;
  if (kg.UseRunTimeLimit)
  {
    kg.RunTimeMinutes = seRuntime->Value;
  }

  // Global Time
  kg.UseGlobalTimeLimit = cbGlobalTime->Checked;
  if (kg.UseGlobalTimeLimit)
  {
    kg.GlobalTimeMinutes = seGlobalTime->Value;
  }

  // Country
  kg.UseCountyLimit = cbCountry->Checked;
  if (kg.UseCountyLimit)
  {
    kg.CountryCode = KEY_COUNTRIES[comCountry->ItemIndex].Code;
  }

  // Crypt Sections
  kg.EncryptedSections[0] = cbSection1->Checked;
  kg.EncryptedSections[1] = cbSection2->Checked;
  kg.EncryptedSections[2] = cbSection3->Checked;
  kg.EncryptedSections[3] = cbSection4->Checked;
  kg.EncryptedSections[4] = cbSection5->Checked;
  kg.EncryptedSections[5] = cbSection6->Checked;
  kg.EncryptedSections[6] = cbSection7->Checked;
  kg.EncryptedSections[7] = cbSection8->Checked;
  kg.EncryptedSections[8] = cbSection9->Checked;
  kg.EncryptedSections[9] = cbSection10->Checked;
  kg.EncryptedSections[10] = cbSection11->Checked;
  kg.EncryptedSections[11] = cbSection12->Checked;
  kg.EncryptedSections[12] = cbSection13->Checked;
  kg.EncryptedSections[13] = cbSection14->Checked;
  kg.EncryptedSections[14] = cbSection15->Checked;
  kg.EncryptedSections[15] = cbSection16->Checked;

  // Secure constant (get it from project file)!
  kg.EncryptedConstant = 2113444489;

  dwResult = KG_GenerateRegistrationKey(&kg);

  if (dwResult == EP_NO_ERROR)
  {
    mKey->Text = (AnsiString)kg.Key;
  } else
  {
    switch (dwResult)
    {
      case EP_ERROR_UNKNOWN:
        mKey->Text = "EP_ERROR_UNKNOWN";
        break;
      case EP_ERROR_KEYBUFFEREMPTY:
        mKey->Text = "EP_ERROR_KEYBUFFEREMPTY";
        break;
      case EP_ERROR_KEYBUFFERISLESS:
        mKey->Text = "EP_ERROR_KEYBUFFERISLESS";
        break;
      case EP_ERROR_REGINFOEMPTY:
        mKey->Text = "EP_ERROR_REGINFOEMPTY";
        break;
      case EP_ERROR_REGINFOTOOLARGE:
        mKey->Text = "EP_ERROR_REGINFOTOOLARGE";
        break;
      case EP_ERROR_PRIVATEKEYISNOTSET:
        mKey->Text = "EP_ERROR_PRIVATEKEYISNOTSET";
        break;
      case EP_ERROR_PUBLICKEYISNOTSET:
        mKey->Text = "EP_ERROR_PUBLICKEYISNOTSET";
        break;
      case EP_ERROR_PRIVATEKEYISINVALID:
        mKey->Text = "EP_ERROR_PRIVATEKEYISINVALID";
        break;
      case EP_ERROR_PUBLICKEYISINVALID:
        mKey->Text = "EP_ERROR_PUBLICKEYISINVALID";
        break;
      case EP_ERROR_KEYMODEISINVALID:
        mKey->Text = "EP_ERROR_KEYMODEISINVALID";
        break;
      case EP_ERROR_KEYBASEISINVALID:
        mKey->Text = "EP_ERROR_KEYBASEISINVALID";
        break;
      case EP_ERROR_CURRENTDATEISINVALID:
        mKey->Text = "EP_ERROR_CURRENTDATEISINVALID";
        break;
      case EP_ERROR_EXPIRATIONDATEISINVALID:
        mKey->Text = "EP_ERROR_EXPIRATIONDATEISINVALID";
        break;
      case EP_ERROR_KEYISINVALID:
        mKey->Text = "EP_ERROR_KEYISINVALID";
        break;
      case EP_ERROR_HARDWAREID:
        mKey->Text = "EP_ERROR_HARDWAREID";
        break;
      case EP_ERROR_HARDWAREBUFFEREMPTY:
        mKey->Text = "EP_ERROR_HARDWAREBUFFEREMPTY";
        break;
      case EP_ERROR_HARDWAREIDINVALIDFORKEY:
        mKey->Text = "EP_ERROR_HARDWAREIDINVALIDFORKEY";
        break;
      case EP_ERROR_PROJECTFILENOTFOUND:
        mKey->Text = "EP_ERROR_PROJECTFILENOTFOUND";
        break;
      case EP_ERROR_INVALIDPROJECTFILE:
        mKey->Text = "EP_ERROR_INVALIDPROJECTFILE";
        break;
      case EP_ERROR_EXECUTIONSNUMBERINVALID:
        mKey->Text = "EP_ERROR_EXECUTIONSNUMBERINVALID";
        break;
      case EP_ERROR_DAYSNUMBERINVALID:
        mKey->Text = "EP_ERROR_DAYSNUMBERINVALID";
        break;
      case EP_ERROR_COUNTRYCODEINVALID:
        mKey->Text = "EP_ERROR_COUNTRYCODEINVALID";
        break;
      case EP_ERROR_RUNTIMEINVALID:
        mKey->Text = "EP_ERROR_RUNTIMEINVALID";
        break;
      case EP_ERROR_GLOBALTIMEINVALID:
        mKey->Text = "EP_ERROR_GLOBALTIMEINVALID";
        break;
      case EP_ERROR_INSTALLBEFOREINVALID:
        mKey->Text = "EP_ERROR_INSTALLBEFOREINVALID";
        break;
      case EP_ERROR_INSTALLAFTERINVALID:
        mKey->Text = "EP_ERROR_INSTALLAFTERINVALID";
        break;
      default:
        mKey->Text = "Unknown error";
        break;
    }
  }
}

Show/Hide Visual C++ function example

void CKeygenDlg::OnBnClickedButtongen()
{
    // TODO: Add your control notification handler code here
  TKeyGenParams kp;
  char keybuffer[2048];
  char tmp[255];
  char username[255];
  char hardwareid[255];
  SYSTEMTIME lpDate;
  DWORD dwResult;

  // Clear params buffer
  memset(&kp, 0, sizeof(kp));
  // Clear key buffer
  memset(&keybuffer, 0, sizeof(keybuffer));

  kp.Key = (char*) keybuffer;
  kp.KeyLen = sizeof(keybuffer);

  // Fill User Info
  memset(&username, 0, sizeof(username));
  GetDlgItemText(IDC_EDITNAME, (char*)&username, sizeof(username));
  kp.RegInfo = (char*)&username;
  kp.RegInfoLen = strlen(kp.RegInfo);

  // Key expiration info
  if (IsDlgButtonChecked(IDC_CHECKEXPIRATION) != 0)
  {
      kp.UseKeyExpiration = true;
      SendDlgItemMessage(IDC_DTPEXPIRATION, DTM_GETSYSTEMTIME, GDT_VALID, (LPARAM)&lpDate);
      kp.ExpirationYear = lpDate.wYear;
      kp.ExpirationMonth = lpDate.wMonth;
      kp.ExpirationDay = lpDate.wDay;
  }

  // Register After
  if (IsDlgButtonChecked(IDC_CHECKREGAFTER) != 0)
  {
      kp.UseRegisterAfter = true;
      SendDlgItemMessage(IDC_DTPREGAFTER, DTM_GETSYSTEMTIME, GDT_VALID, (LPARAM)&lpDate);
      kp.RegisterAfterYear = lpDate.wYear;
      kp.RegisterAfterMonth = lpDate.wMonth;
      kp.RegisterAfterDay = lpDate.wDay;
  }

  // Register Before
  if (IsDlgButtonChecked(IDC_CHECKREGBEFORE) != 0)
  {
      kp.UseRegisterBefore = true;
      SendDlgItemMessage(IDC_DTPREGBEFORE, DTM_GETSYSTEMTIME, GDT_VALID, (LPARAM)&lpDate);
      kp.RegisterBeforeYear = lpDate.wYear;
      kp.RegisterBeforeMonth = lpDate.wMonth;
      kp.RegisterBeforeDay = lpDate.wDay;
  }

  // Executions
  if (IsDlgButtonChecked(IDC_CHECKEXECS) != 0)
  {
      kp.UseExecutionsLimit = true;
      memset(&tmp, 0, sizeof(tmp));
      GetDlgItemText(IDC_EDITEXECS, (char*)&tmp, sizeof(tmp));
      kp.ExecutionsCount = atoi((char*)&tmp);
  }

  // Days
  if (IsDlgButtonChecked(IDC_CHECKDAYS) != 0)
  {
      kp.UseDaysLimit = true;
      memset(&tmp, 0, sizeof(tmp));
      GetDlgItemText(IDC_EDITDAYS, (char*)&tmp, sizeof(tmp));
      kp.DaysCount = atoi((char*)&tmp);
  }

  // Run-time
  if (IsDlgButtonChecked(IDC_CHECKRTIME) != 0)
  {
      kp.UseRunTimeLimit = true;
      memset(&tmp, 0, sizeof(tmp));
      GetDlgItemText(IDC_EDITRTIME, (char*)&tmp, sizeof(tmp));
      kp.RunTimeMinutes = atoi((char*)&tmp);
  }

  // Global time
  if (IsDlgButtonChecked(IDC_CHECKGTIME) != 0)
  {
      kp.UseGlobalTimeLimit = true;
      memset(&tmp, 0, sizeof(tmp));
      GetDlgItemText(IDC_EDITGTIME, (char*)&tmp, sizeof(tmp));
      kp.GlobalTimeMinutes = atoi((char*)&tmp);
  }

  // Country Lock
  if (IsDlgButtonChecked(IDC_CHECKCOUNTRY) != 0)
  {
      kp.UseCountyLimit = true;
      kp.CountryCode = KEY_COUNTRIES[com_counties.GetCurSel()].Code;
  }

  // Hardware ID
  if (IsDlgButtonChecked(IDC_CHECKHD) != 0)
  {
      kp.UseHardwareLocking = true;
      memset(&hardwareid, 0, sizeof(hardwareid));
      GetDlgItemText(IDC_EDITHD, (char*)&hardwareid, sizeof(hardwareid));
      kp.HardwareID = (char*)&hardwareid;
  }

  // Crypt Sections
  if (IsDlgButtonChecked(IDC_CHECKS1) != 0) { kp.EncryptedSections[0] = true; }
  if (IsDlgButtonChecked(IDC_CHECKS2) != 0) { kp.EncryptedSections[1] = true; }
  if (IsDlgButtonChecked(IDC_CHECKS3) != 0) { kp.EncryptedSections[2] = true; }
  if (IsDlgButtonChecked(IDC_CHECKS4) != 0) { kp.EncryptedSections[3] = true; }
  if (IsDlgButtonChecked(IDC_CHECKS5) != 0) { kp.EncryptedSections[4] = true; }
  if (IsDlgButtonChecked(IDC_CHECKS6) != 0) { kp.EncryptedSections[5] = true; }
  if (IsDlgButtonChecked(IDC_CHECKS7) != 0) { kp.EncryptedSections[6] = true; }
  if (IsDlgButtonChecked(IDC_CHECKS8) != 0) { kp.EncryptedSections[7] = true; }
  if (IsDlgButtonChecked(IDC_CHECKS9) != 0) { kp.EncryptedSections[8] = true; }
  if (IsDlgButtonChecked(IDC_CHECKS10) != 0) { kp.EncryptedSections[9] = true; }
  if (IsDlgButtonChecked(IDC_CHECKS11) != 0) { kp.EncryptedSections[10] = true; }
  if (IsDlgButtonChecked(IDC_CHECKS12) != 0) { kp.EncryptedSections[11] = true; }
  if (IsDlgButtonChecked(IDC_CHECKS13) != 0) { kp.EncryptedSections[12] = true; }
  if (IsDlgButtonChecked(IDC_CHECKS14) != 0) { kp.EncryptedSections[13] = true; }
  if (IsDlgButtonChecked(IDC_CHECKS15) != 0) { kp.EncryptedSections[14] = true; }
  if (IsDlgButtonChecked(IDC_CHECKS16) != 0) { kp.EncryptedSections[15] = true; }

  kp.KeyMode = com_key_mode.GetCurSel();
  kp.KeyBase = com_key_base.GetCurSel();

  kp.KeyWithHyphens = IsDlgButtonChecked(IDC_CHECKHYPHENS) != 0;

  kp.EncryptedConstant = 2113444489;

  switch (kp.KeyMode)
  {
    case RM_512:
    {
        char pl[] = "0201B810DA4A1ADD4351378790A98138533067CP4S86R7D8THS45GBCVUM635EPRQRMYRP3DAA5DUPZ6ABDSFP7F5AC" \
            "P7ERGH4A7Y6B6NW6NMMBZF83WVER9Y4MMBNLBQDKR7KFVLGLV067CFDQC" \
            "WCHGQVVRN24DECEPBL96YJQJTVDCRTNQG3E4WW4GK4GQ5X5L5H88D3XYH" \
            "CBRBNASPD3P5CNYFKFHBCSDHHD6WPTCC4XVSM5S88067C2JSTCMVT48C8" \
            "HC7SHKGTFJBM28P6XTBCNWHMV6J6KN6W5Q9TQLVR285U6GVCAAUTZLRTP" \
            "SRGDQ742B4742XF4MACRR747YDP5FZZ9D";
        char pr[] = "00C98B2SF9UBJA605AJX53GJFXJV8UH4A6PY2L6CV4MAMV7V3ERRVY99Y" \
            "72V2P77Z2J3KBPGWR3WXKG5GF9Z6CKXJHY5VUMBTQ66H2MRZPCU00DLFJ" \
            "675JTTTNEK00DLFJ675JTTTNEK";
        kp.PublicKey = pl;
        kp.PrivateKey = pr;
      break;
    }
    case RM_768:
    {
        char pl[] = "0201B810DA4A1ADD4351378790A9813853309AEHRR66KMK99UEPX8C54WQFDZQ5Y96WUCVZYMXBC32SJV7T5SBPR54E" \
            "2DBH8UD9RNHTJ9BLJV6NHX52W7PZDDTTJDDGF3YFVL7PJFL8RS8THTFDF" \
            "4RY7K3QXLTMXMC8DDSRVRWBVMMP3UYKCDDC7KGL9PG509ACPTRQ4MMUKG" \
            "DAUJFFFGSCBFLYK9X9E74M58PW5FG9B9RTLXJQ4STPVCHJTEH8BP557VZ" \
            "PQYDBUZJXXJNGVZELFL4UL3LHHE8A645CK593DVWCQBSX4ZCCQ3ST8GCZ" \
            "LW2729XK3NT7GST3LMQGXSHLDWCXE09AENVX2QTX3VLT6FWB4JND875XZ" \
            "WQ26GW76TV3KVVHK7U489LLPBQ39HUWKMA65U3HKWBDHKBZEB525PHEH2" \
            "YQHRZGNJAAYZXMWN8RNZ9T7VMZAJMP2V3S9NXZ9RHL96F7AT3NTMN36V4" \
            "ACSFEN4DR6TJR95";
        char pr[] = "019VRB95TKY456YC48LBS9FK34YN080VVPDJPPKU6XA9EPLX7HTVN3VST" \
            "TNJZFPH4HQAFY58R593KFKSNZ7WEZBA9AZ6PGN735EWEFUAEM3G8XVUFN" \
            "L2ZFRPXA4V8KVXE4M8GACUJAT7H3TTWZT9ZDE43ZF46HC01AHFR85MVR2" \
            "UP7K3N53M8MTNWBUP01AHFR85MVR2UP7K3N53M8MTNWBUP";
        kp.PublicKey = pl;
        kp.PrivateKey = pr;
      break;
    }
    case RM_1024:
    {
        char pl[] = "0201B810DA4A1ADD4351378790A981385330CDG9YQSEUK2HT546KWW46NHSCHMD2TNCSPVNSKGQC6CHDUSU9CC4LDPL" \
            "TD3NLRVD3TFV9BU2SYBUBU9TXKLQ3CTKZE5GN9VFG37R9YNK2FE58K7ZY" \
            "WTUJYFSJTBMDLLGA9GJ2LJXGHSS9CESGC2K69H65YQGAC7CRGF5T3CPLA" \
            "5BDJZKVCUWPZRNA2DN7L956LZVZBQUDPX6PF30CDBH26Z82VE4QQ8N85L" \
            "QHYJYYCJ6WQ89H9K9VVQX925SG5FJ79AGVZB6M8TTFKCJ56FAREP8GSTC" \
            "NKWCXEALDP9Y2ZLS9QKZV8JRNDHG9D8BRDSCTMDQK9NLAPZ9TGYFS9G7U" \
            "LXHYJF7F9A89HPXGTU2N4FQQJL98WZ5QND2KTEMMUUZFAX953HCGNSWUW" \
            "U2M7LBEWZSH9GW5SC0CDJDY2HC4HJYUSVTAVXZ7MYVJWF3CU9WC3SVPSL" \
            "29WF46DVS2SYKSSAMATPPYGJDE3PBFMGS34CXWQSXKCEAE63L2EXTS9NE" \
            "2G597XASY3S34XMYST5YZF4THUTYT5DY9UKKXU6PH8MLXRPZMPMMR83JU" \
            "X2WGNEW8ZGL4SKUCUB8CEAB6UZ4FB66WTP3B64VMX7XG75T4Y35479";
        char pr[] = "020MLJ7XTRVLBDNUVMKGUFHCU8XBGMHHVRA0ADSHPBC7NVSZ82AM867XC" \
            "BELNKMR7CZ56C4SW8KKRD9WZLE5X992GZVSZXS5J6JG9SLDW3Y696TU4D" \
            "QZP778LVFKVRKANQD6FUGN2ACWUJM9ZK6ME7WXWDZ88LTWHME52RKUDKX" \
            "STT7RGWP7HFUJDGWEUG4ZHQ25DCQJ644CLEXRR3G020SAAREJB4WXZ4H2" \
            "JEH4AB4U8FGFTA4CAF020SAAREJB4WXZ4H2JEH4AB4U8FGFTA4CAF";
        kp.PublicKey = pl;
        kp.PrivateKey = pr;
      break;
    }
    case RM_2048:
    {
        char pl[] = "0201B810DA4A1ADD4351378790A98138533199H9KZC4CQ5ZKPEGYDW2EHN5AKZA5G5KP4HU8USWJR8XWW7MCH7244RV" \
            "PSXFHVU6YQRK4LPUHM497XJYPLLA3DHUZWXK3CB5SUYF75NPYLTNPRUAP" \
            "CTVDHAKYWTRQ97HES2E59WDN2LJKFYA2K8BGFSBHP4A6BF5FSDTS8NWLL" \
            "C5NEQ76NJ9BAMWXG55UPFFMRQZTU5KV2G6LSPQUJJWA9U4LJ5SCJ9M9ZQ" \
            "Z6K7LZA9UAMJ533UQ5J3JPNQAUWJGZFRFCTGAGSBWPWRRF9HRGF9MCX55" \
            "QRYGPYMRE6DBJ65SJDX34FVPYWWKWQ48MCKXYXPHQ23BJ42U8ZMDD8CG5" \
            "DPHZQ5XTXUKA277XK6PKSTLJ88ZZ9EBXH62REMRZZRGNPKHYM34RW722S" \
            "SZHMPFKY7X8UZ19ADGX3UQ7X444XH7MZXEZYW2YLFHR8YL3PTCXVSYX89" \
            "ZXN7KW2XNBE8XS3TQRGZVF6KA5USH56NEZYH5RNWBBPVE9LD6H42RQWR5" \
            "YVQMT5EQYQTK6YM9V8DA5BJCLGGZ2UGD6NPA2X3SNUS47F7HJBNBCWHRA" \
            "YPPCQ5HWCJNPDHUDQMRN2P6PWJFWJ6CLVNK8HXEFLE4ENPXAFN89CRS43" \
            "RUMVGDJQCSRB535XYCS6BZYLA9Q6HJV425F26XXHRGA7C8R8BVMELAPEH" \
            "5DSA9KXTCV4H2RNVDFHG3YJSERZVFPWHYA823LUBENBL5U3J4LJX2KQLW" \
            "L5XGGESPSE2FQWKSQ4NUCDLBEJPQAT2A2477DYS2XEXKLYEAKUN22622C" \
            "RLBCAHPFNEV2FJ2H8N3JQGXJRGP19AFHGRW6SS2ZSFYK8EZAPVYL4MCP4" \
            "6UMR64Y9T89FHWEPXBRHKWJCSNNNGPU984J5XW4BWTU6PDWPN24W8RU55" \
            "A9C3U9H7VHS5PFURASHBT4JAEE5ZKJBSYMCMDVBLU973R72RVPA6U96A2" \
            "LX8HMASVST9RVJ7W66V4DYWRDZZQ3673W7C7LVF68TWPLNMYEUQ8FDZRN" \
            "P38D9BX5YA3VENETDUUUMR9U7FFP4NZM7G4Y6J6EASK5SAXXTRMZ8F3AH" \
            "5FC54E543N739BY5KVZQM7JZWD2P2HPE7BDRMM9JFCGPBWWASTZ7UDNRV" \
            "6AFHVMBR9AGAERE9M6W6S2ZT8PBTABPDCKBPPPV6QW9DRXZUGAHDDRRSY" \
            "XM4YXQ2QJX6CL33N7RV8846LK8A3DFLDXWZ2NKF8V";
        char pr[] = "02DB825DUDFYHA88AG49NMM742HCQEJDKQQGDR6G3GL7MCED16DU9KTVE" \
            "47XQ3M92FFKX8FU9ZXT7AK7VTGGJSYQERCZBR8J2DE2CFE3VUU4W7JEQJ" \
            "L49HDUXBW7SNPCV8MHXM7EQHYPQK3GSPQYV5VWESQE4AYWFZHXN2UX7Z3" \
            "T3CV52XURB3YFKLUCY6CJTRACRVVDD568F6F28U74ABWCZ2ZMC32E83V3" \
            "4JZZPDBF3KEYQWREETGKQT6NANCMAD4XDEXW5LCYBJ3GMDJBM3E7FNK98" \
            "7JEUYEV7QNKGKNTDVMRG3G5L8NC9CNHQS8AVDMDBEGCG3DHGJUGPG2244" \
            "2C9LCD8FJ2LSDMQXLHCGCLP7ZSYQT2UJ4QFGU2CH3BTT3UADZMQSBAV33" \
            "B3Z2Y8Y8RRD9J754G02DJ372LR8APP7HXKB2GNPHP6T65C3RR48Q8BHGP" \
            "KEZ6PX2D02DJ372LR8APP7HXKB2GNPHP6T65C3RR48Q8BHGPKEZ6PX2D";
        kp.PublicKey = pl;
        kp.PrivateKey = pr;
      break;
    }
    case RM_3072:
    {
        char pl[] = "0201B810DA4A1ADD4351378790A98138533267BJBN6W8SY33Y47RWJHWS385XWRV9TSVSB5EM7ECZYNSJ44ZKSD8KV4" \
            "6Y9T6TNC6QMDW4V6DBMADU3YUKLP88TCLEUD9FTEUHGXM6T57AQ2EMB59" \
            "UPQVNSUT7Z4EHAMDQ6N77VK2A6P847MMWJH9E7C5XX6FNF6MHGWERPWQV" \
            "9ZLVR9Z7X5D5Z2XQL6MBM7BDCT2DEDVRBFNDDBLG6LHZ9APM48LS5TKTJ" \
            "AGDYFDRVHEGTDH47PCLL8YJ4ZAWCB59F8BN5PZL3NQACP32G3YNBX5E3J" \
            "7S28XLRGAX55ZML5XE6Q68EUAL38VUBJ2MZ2UGCCHM7CE6S99N44X9RMV" \
            "7B55HULJ4KHPFYSBDUSPQTCWGS76BEQST2QCZDZ2T4FBA4YUJFF47AACE" \
            "A4EEFESEYWN48UZCSDZAMGSU5VB9UJKR2XQUSDFS3TNG9QKURQWS7N5Q3" \
            "VPYT4QAGGQ5GW2MMXHDJYW55FQPHSS255GVJ7WLLP85JHS8K6DVTJWB4W" \
            "4Y8ZEFF7KP6W74PAA8FVPZVDW4RKGMQ8V56Q6R4V34XFE5HR4FZS8GZ6R" \
            "36RKW6WN34S2AHR9LCGF8LULB7ZN6NC2AA5RPDZYGWSPPME6267CGLZCP" \
            "GG98W557RXCDWAETJHDCRPUXX7AD3E8SL9WMGBV9QFHMSV9UFV7H9NTX3" \
            "QYV95CN9P9DSYQWL35R2BWB4GKW6CTWVB2X6WH3P2WFBE6X55KBLAMDB3" \
            "SRDSDVY37GKH78MUHY7KDJDC8SJU5FUQRYZ49ULX3YSZL7E284GFVZSGD" \
            "FTTQNR6VMBM3LLR78SUSVMJW88XT2K4UHEATRU3V9MMR2VGNGCY9S6R7M" \
            "4ELNPEBBMQP2HVPLY5M5VPA92V7NU8ZZ58YYTW5QK9USZ5LV59UZGB2CF" \
            "DPZ6HFYU5WB7UU3UYWVNSNKM3W7GBYKJP8TMFW2YN6GNSSE4ZKFVZRLUT" \
            "8QPZBBEQT5H9H5Z53D7QV4AJTKTX4EMW62TDWXQVK24JZPSG2VXKCMYZL" \
            "BUASE25R3EEK9KBLJ8VX83ZXGTBL5CCDBY33HJ6FKX8AW3WPRX3XTCS9G" \
            "2B9SVK2XFFKNSPGFG6FZNS8P2HERFGFL79DKUZZFWHFH4H9UZ7F7F6W3Z" \
            "WN84JRRA7SU8T89EQMRBEPVYMMGLGSUMFWWMEDLJM5EGP5WEX9LDUAQXS" \
            "55LKDQVRKX4R8NNBHSYBHSNMFYA2C6KGQQFK3TN267DPSZT3PTKHTLNMU" \
            "V2YYZZRX3953LPWAKYF8LJUVMEQT3ZC4F9SWMYGUHG6XX66PJFQWSRUW2" \
            "C79YLGZ6ZAFS7HLXBTH55UD3EGFBZQ5CLNJDZTEJACDVBCM5FQBTX4DKK" \
            "UDGNSMWWLC5UMQRHW89CTU5636WYDXVZZDAUZ529458LDN2DAR9QADWRZ" \
            "UTU8MCKN8ACH3R36YKE52DDF67SM5UDUH7PTATHXE65UCGFRCV49UTF29" \
            "BGDSUWGRMC839HUZYQVAG985YUF5KJCAVGKRD8E4YMPJ38KR6HD2KHDGY" \
            "PJDMJMN4Y3DTJW5MYX3VUPF32637LMAWFM4QCU7BMP74SCF4N5QXZZVBE" \
            "LAQMPYMJC2ZWJ9XFV33YXTTPH3SG9KMUABLL83P7L3UBVM763XJPR5UEH" \
            "DZ73XJUGR9QP6299K5PU46XGVWKWFAKWYMRXUSLCFJ3WQTEC6QJH6E5V8" \
            "X2RMA5TXGSBEWLGSMNQ2SH6G9MLKK4S486DN4M4QVDTYTM4JQETAJQGP7" \
            "6NUR4UNDXR4W4JQSNWDTUGX69SEDC3AL8ZF4TJBQQRXSX2A86UUWCDCFH" \
            "JE94A8EP3Q6A2QTYKEE62MV4VJB2AB";
        char pr[] = "04DMQBFL5GKK4RXWEZYPEY8QB5GHBBGW3EY766DFF2Q6PLFLR4SSRWXBN" \
            "W5CFGFC84UJ8PKRDQQYWN9921AH8AGZAQRWJYZ7C3QUJJCJAAGGT5P5GG" \
            "LY6K5W4JZJDW7Y8EWS6SSYCS2MCR93MY9DG6VXLBRYVZWDX6XNFU286HM" \
            "AM9E82KJVZNYGC8RXRW43SFFWDLR8C96R58A42F3TGLXPVWLGMNPPAWS4" \
            "S2SSMNQLUPBAQMP7AUKAGV5CKL342W6UKQY3TUPXKGFXFES725PEX93UX" \
            "X4K8JRY3MPQ5S94VNPBXQ5N6LDBLWB67LBLDCGNQS3JEKW667UF8LA8Q6" \
            "B3AF4XGZKYB7BVVHF49DJUHSFJZRD63S4GMMAPQ8Q87HKN9G3J3575JEL" \
            "5C29NZLWQW6MSYWJ7S3NKLKPWGU75ZJXKEL6Z9V97HAMDYHM6ARCH58EP" \
            "WRPZUXN8RRWGCDFM6BH6XUTRTFE3VMAAZAUUKHKL6AFC2PCPXFRDWLVYP" \
            "ZKUGY8QDEZNECK9K5Y5MET9SRWQ36JF77XJ6NUKSMZ6DKUPEH4W43YQAE" \
            "CV7XVFWJ7ZTRVFQJZFU5BS8AL77YLCXDCR5VPFFZ9NP7EBBQ2AA04DP3S" \
            "86B3YD8AFXQ3KPPNTPHBTQSM8PUHJHG87RUM4EV63GKPBRGSN3VX63FCS" \
            "646DLWSH86B542U3F04DP3S86B3YD8AFXQ3KPPNTPHBTQSM8PUHJHG87R" \
            "UM4EV63GKPBRGSN3VX63FCS646DLWSH86B542U3F";
        kp.PublicKey = pl;
        kp.PrivateKey = pr;
      break;
    }
    case RM_4096:
    {
        char pl[] = "0201B810DA4A1ADD4351378790A98138533334BN75EUD4LFWYFVNFGBRCEMKKXG62QRBXL8GMHQ975B68FJVEMNXQQ7" \
            "RKR7RCZMWDVP86QPB3LR49G9BM7EUUZXNCRZBXRF4PEY3RX6UXT4X286K" \
            "WMR7AMEE6QNP9AEHGWJT9AVU3F62F37B5GVX2BQF73QWHRFQSQ6XMRP6M" \
            "ZDRQ8JT89UF3YRK5UL34MM3L8HLDTWAJF5YY7MRWJUFDQRK9JNCJ6C9KJ" \
            "WRE5ACQSNS24NEAHDYKS3AK75HBCTKP9NR2CSL7Q9PPXM4TF7L37USP77" \
            "Z7WER6JY67F7YGKTP6MFRMKK9H8XFPZ9XWKK97XCFXK7AW4TB96WGEH4B" \
            "YPF9QRF2DGC3LCHW8VTD2EMHVRDR6EEBUG8R4XYKJPLBPRCJP445DU2BW" \
            "JWELKAY45GKDU5HLTTDTWRH2JFKJ7AVAKLPEELN29YHX5JR773P9ERW7N" \
            "UFMWDKD4UL4YPU5QW2L4A7ZN3E8ZDQVEZUR6ZRDQXRLQRLUNHVB4XGBWD" \
            "HM79NGJARHDBQJCD8NWZCWPBY26QARP7A5S48DCV29F7MUTHU3YAHYVS7" \
            "ZPGXJZZA5HBBY4K5BQPUG6MVCBG8H3C7VL8KH9EH58NUVCE6F2CGMSM94" \
            "4CQDKNVGWWWRNK4DG26UT88Y9ULUPJ25G9KLTQPK3TBXZEK43X8KPMJT8" \
            "DF6MTQ5RB94XR2BT9H9NYYTXL29GF8KZY9QNHAW4LTT2RDQTD2ELWPSV4" \
            "4AND9K8G5VKLQ287UBEVHA82CMSMGQQBMNQZVAZ9G8T5TD6G9F7XQHMJT" \
            "HCL6PFEDUW5MN9JASF2EKPT2H33325A3SFGGM5C3RYKZSYSSQC5FLHNX9" \
            "VHN4HQVWD66YECY4R97JZHQALRTCHXUWH85LSJCCTQZT8JF52FHG6FV9J" \
            "UJWEU24K9Z7SKYTYA9NH7GW29FSNKUK3DMFXY48VEYZVDRTTMLFYSJH8B" \
            "RQXV72REYGSM6SLX89EVQ52CN9N8YDLWHAWCDDNM89YN2FCRTLE8688XN" \
            "F4MZMFE6GP9JK2JTFJVUKBLES2ZVWSBCJE9N3D7DG9LL9Z3U42QFJJPE2" \
            "HE5XCRY25UND96R9D7655ZBSCPF796FJZ4GPLY7AMZLGLR77GRP467ELK" \
            "PXSZ9ZF8MUYFDHV4EFACPZ79CDFTYW56NE9JDWDVUMNLY9EXDSF8ZNABE" \
            "MDQU6T9RVLTNRMZJJ8EJSUM9TV8YA6MNWF2Y66MD3VQ9L662F5X6VE9ZC" \
            "PPRTNMEV2DG9BUMFMSL7PUR9H5QG6VVBDBMEU3PLABL57HMSQ5C83E9X8" \
            "RTPY4QSEH2H7R2QDJHT5LQSFNQJL2NZ24GLNTFXG468WC5UUTDD68G8HM" \
            "477Z8P4F9ZZHUGZ6VPFF32A2MPWY8LPXNECCKM9EEVLDDPUJ8LXN2AE6K" \
            "Y2Q42FVBCJM9GQTXNRHBED735KCFD4YGV4U5U3LJD6NJ886W6XQLWH3G7" \
            "3VZ6T5YDUQP6DA5ZHLKQSGATDJHUWC2ELTE7QJFXH8H9EAQYZPPMW76JG" \
            "Z48UBND9VXFXZMSGBNWQPNQG7E4TCBDMVKUSA9TTVSNLN3DXEZNXH787R" \
            "N7XHFBJNZ5W74DUMNBYVHEQDYMZBQCFMS8LGSDUAU6QE9DD5Q334BX62T" \
            "JP5WQQDS2ZEWW76XW7VMLX3L7V9UVD7RL297VDBVRFPQ5MYA3YFVBVNVA" \
            "R5TJXMQ4X2U2PW6UWSKBXT58HG3QPZM2RVEX2PDMCVJDFTJMXR9NPLW4C" \
            "6AE4Q9A8TTAQ68BSN9WWTFFTSX68ECVARFPDBBH5DMP4KYFARTFVCSWNF" \
            "FGAPBYYGFJA4MGHEDWTNE54MPGER7EPCZEV2ESJRMM6XDMFGABG97HECN" \
            "3SZFUBRKCNDZ2TE9F6EERULRCDAV5EMY6KVY9NY9MYNPP2FQ5WFWLMRYD" \
            "4TNYYHE6EDMQ6KK79HH5Q5KBW6DDQYYNUR365W2454CHEZWZAPU82SX4H" \
            "KHNZXBRVWAT7G9CJBKHNBPSVEL67X8UJHBFHZH8ZD4NSEVFZM4Y768TJ6" \
            "QP3BGEKLTY4UZUWHG63QMKVWAQW9E7WRFNJCH4XRD97JHNKMFUTRFVH68" \
            "G5CKSMGC725AZ9CBSL2JX43P4EY44CMF56AJ6BEXVCJP2ZDWCT9G55K4D" \
            "F24J7TTJMFXTQH95CBNX67CBPNWEKHCWQV6VD73Y9KCZHNBFUFS8TCYNN" \
            "WXRGFKNVRDFUKWHDWDDTSPEW8YCKLPMX2GUV3N4JFJMUE6TSJR6Z53C9F" \
            "SKZAY3EN7G66JPBF5E9S6Y7RQHPWZHSRDQ7XH87PHUJFLJFGD7WNE3Q9P" \
            "EXMW33LVJBFEUXKNUB6SU7ZYCEX96XT8G27FLUV7XPV4JK64DWDJCX9WV" \
            "4VL8CK23FQJ28UG9JUZTQJ3DRL32BTJVRD4LVQ6MK9LCE7ZZP925JK7ZD" \
            "92SCV4DDJJ5EXMVBF";
        char pr[] = "067DN6F8YFBTWF5QH8MHJB39Z7VNN2P56HS8RPBURAWB8KPL8FQWX4HSP" \
            "RTY4HWFMFXAVX2YUY99G2U2KKK56CBE4BCPZWS3KJ98XRW4PY2CDQ3ALF" \
            "Y3HGJG42NRY9ZVGZZB59TE29KGC825BYBX3FRFMYBVN2VTHM8YM2KULXM" \
            "H24XSHNVK4HEQ9L5264844DMBFUUXSBA9PT9LEXT6449TMAMF7RL6KU6C" \
            "GP6FU9DNMJCNTUREF2U9WUMJBMXMMHWKWDG4VU5JQNFFNNWCP2YE2DGFD" \
            "N3H27NTNR58GBNTTZBRK66BKWNVMF8H59KALB6K93Y8UWDUWV5HJZGV8X" \
            "3AS5EG982DYV4W9CQ3GRRFRR8NABQC98FTAG465SXQ3JPN7X7VULQZX4X" \
            "UK68URBFPGCW2UPBYH6CRG6C7YBRAURM2KMGN5L8XH4AUQN8WM4P454WN" \
            "NWRE5SQEC78FK3LHHQU5VLXLYYN8F2NXGG7CCQ92EEC63ZE6S7CC7RTML" \
            "UMM3PAXPL5CJZFL26JNNYPVLAHM75NDL8AS8JR48PFXK49D4A6TY2ZU9Y" \
            "XX2Y2TLA3J8T56EPY236FEDGZEHTQR73NE2Y7LKL7423FFKGGPWYL8PB5" \
            "VWD54PG328ACE6V8VLSGVP9VJMMWS2VDVU459C8K5XK869Z5KM4JWHAVE" \
            "G56ZESC6HHJ423N6SAH2DW2UQZDQHSMKWUCHPUKZZPJXCQXF55Q3BJW6Z" \
            "QYK4HM4Q8XWU8NT844E8YM96EGHSYEUKAJ3QDXANN2DELSGARH7LR2XH9" \
            "UQBQNXGPZGB6JTEQP8HAQK5ZZYJE067DWX6C2JJ7L2HE4NGVXZV5XH9RD" \
            "P9SNG4WZTC9KEMGXDX7JTQX8RPJJRT4YTA83L8GXDNDDHB7C79CN8UWGL" \
            "U5EMNMBREQN5MYTYHGYK067DWX6C2JJ7L2HE4NGVXZV5XH9RDP9SNG4WZ" \
            "TC9KEMGXDX7JTQX8RPJJRT4YTA83L8GXDNDDHB7C79CN8UWGLU5EMNMBR" \
            "EQN5MYTYHGYK";
        kp.PublicKey = pl;
        kp.PrivateKey = pr;
      break;
    }
  }

  // Generate reg. key
  dwResult = KG_GenerateRegistrationKey(&kp);

  if (dwResult == EP_NO_ERROR)
  {
    SetDlgItemText(IDC_EDITKEY, kp.Key);
  } else
  {
    char* sError;
    switch (dwResult)
    {
      case EP_ERROR_UNKNOWN:
        sError = "EP_ERROR_UNKNOWN";
        break;
      case EP_ERROR_KEYBUFFEREMPTY:
        sError = "EP_ERROR_KEYBUFFEREMPTY";
        break;
      case EP_ERROR_KEYBUFFERISLESS:
        sError = "EP_ERROR_KEYBUFFERISLESS";
        break;
      case EP_ERROR_REGINFOEMPTY:
        sError = "EP_ERROR_REGINFOEMPTY";
        break;
      case EP_ERROR_REGINFOTOOLARGE:
        sError = "EP_ERROR_REGINFOTOOLARGE";
        break;
      case EP_ERROR_PRIVATEKEYISNOTSET:
        sError = "EP_ERROR_PRIVATEKEYISNOTSET";
        break;
      case EP_ERROR_PUBLICKEYISNOTSET:
        sError = "EP_ERROR_PUBLICKEYISNOTSET";
        break;
      case EP_ERROR_PRIVATEKEYISINVALID:
        sError = "EP_ERROR_PRIVATEKEYISINVALID";
        break;
      case EP_ERROR_PUBLICKEYISINVALID:
        sError = "EP_ERROR_PUBLICKEYISINVALID";
        break;
      case EP_ERROR_KEYMODEISINVALID:
        sError = "EP_ERROR_KEYMODEISINVALID";
        break;
      case EP_ERROR_KEYBASEISINVALID:
        sError = "EP_ERROR_KEYBASEISINVALID";
        break;
      case EP_ERROR_CURRENTDATEISINVALID:
        sError = "EP_ERROR_CURRENTDATEISINVALID";
        break;
      case EP_ERROR_EXPIRATIONDATEISINVALID:
        sError = "EP_ERROR_EXPIRATIONDATEISINVALID";
        break;
      case EP_ERROR_KEYISINVALID:
        sError = "EP_ERROR_KEYISINVALID";
        break;
      case EP_ERROR_HARDWAREID:
        sError = "EP_ERROR_HARDWAREID";
        break;
      case EP_ERROR_HARDWAREBUFFEREMPTY:
        sError = "EP_ERROR_HARDWAREBUFFEREMPTY";
        break;
      case EP_ERROR_HARDWAREIDINVALIDFORKEY:
        sError = "EP_ERROR_HARDWAREIDINVALIDFORKEY";
        break;
      case EP_ERROR_PROJECTFILENOTFOUND:
        sError = "EP_ERROR_PROJECTFILENOTFOUND";
        break;
      case EP_ERROR_INVALIDPROJECTFILE:
        sError = "EP_ERROR_INVALIDPROJECTFILE";
        break;
      case EP_ERROR_EXECUTIONSNUMBERINVALID:
        sError = "EP_ERROR_EXECUTIONSNUMBERINVALID";
        break;
      case EP_ERROR_DAYSNUMBERINVALID:
        sError = "EP_ERROR_DAYSNUMBERINVALID";
        break;
      case EP_ERROR_COUNTRYCODEINVALID:
        sError = "EP_ERROR_COUNTRYCODEINVALID";
        break;
      case EP_ERROR_RUNTIMEINVALID:
        sError = "EP_ERROR_RUNTIMEINVALID";
        break;
      case EP_ERROR_GLOBALTIMEINVALID:
        sError = "EP_ERROR_GLOBALTIMEINVALID";
        break;
      case EP_ERROR_INSTALLBEFOREINVALID:
        sError = "EP_ERROR_INSTALLBEFOREINVALID";
        break;
      case EP_ERROR_INSTALLAFTERINVALID:
        sError = "EP_ERROR_INSTALLAFTERINVALID";
        break;
      default:
        sError = "Unknown error";
        break;
    }
    SetDlgItemText(IDC_EDITKEY, sError);
  }
}

Show/Hide C# (.NET) function example

        private void btnGenerate_Click(object sender, System.EventArgs e)
        {
            tbKey.Clear();
            if (tbUserInfo.Text == string.Empty)
            {
                MessageBox.Show("User info field is empty!");
                return;
            }
            Enigma_KeyGen_IDE.TKeyGenParams kg = new Enigma_KeyGen_IDE.TKeyGenParams();

            kg.KeyMode = cbKeyMode.SelectedIndex;
            kg.KeyBase = cbKeyBase.SelectedIndex;
            kg.KeyWithHyphens = cbHyphens.Checked;
            switch (kg.KeyMode)
            {
                case Enigma_KeyGen_IDE.RM_512:
                    {
                        kg.PublicKey = "0201B810DA4A1ADD4351378790A98138533067CP4S86R7D8THS45GBCVUM635EPRQRMYRP3DAA5DUPZ6ABDSFP7F5AC" +
                                       "P7ERGH4A7Y6B6NW6NMMBZF83WVER9Y4MMBNLBQDKR7KFVLGLV067CFDQC" +
                                       "WCHGQVVRN24DECEPBL96YJQJTVDCRTNQG3E4WW4GK4GQ5X5L5H88D3XYH" +
                                       "CBRBNASPD3P5CNYFKFHBCSDHHD6WPTCC4XVSM5S88067C2JSTCMVT48C8" +
                                       "HC7SHKGTFJBM28P6XTBCNWHMV6J6KN6W5Q9TQLVR285U6GVCAAUTZLRTP" +
                                       "SRGDQ742B4742XF4MACRR747YDP5FZZ9D";
                        kg.PrivateKey = "00C98B2SF9UBJA605AJX53GJFXJV8UH4A6PY2L6CV4MAMV7V3ERRVY99Y" +
                                        "72V2P77Z2J3KBPGWR3WXKG5GF9Z6CKXJHY5VUMBTQ66H2MRZPCU00DLFJ" +
                                        "675JTTTNEK00DLFJ675JTTTNEK";
                        break;
                    }
                case Enigma_KeyGen_IDE.RM_768:
                    {
                        kg.PublicKey = "0201B810DA4A1ADD4351378790A9813853309AEHRR66KMK99UEPX8C54WQFDZQ5Y96WUCVZYMXBC32SJV7T5SBPR54E" +
                                       "2DBH8UD9RNHTJ9BLJV6NHX52W7PZDDTTJDDGF3YFVL7PJFL8RS8THTFDF" +
                                       "4RY7K3QXLTMXMC8DDSRVRWBVMMP3UYKCDDC7KGL9PG509ACPTRQ4MMUKG" +
                                       "DAUJFFFGSCBFLYK9X9E74M58PW5FG9B9RTLXJQ4STPVCHJTEH8BP557VZ" +
                                       "PQYDBUZJXXJNGVZELFL4UL3LHHE8A645CK593DVWCQBSX4ZCCQ3ST8GCZ" +
                                       "LW2729XK3NT7GST3LMQGXSHLDWCXE09AENVX2QTX3VLT6FWB4JND875XZ" +
                                       "WQ26GW76TV3KVVHK7U489LLPBQ39HUWKMA65U3HKWBDHKBZEB525PHEH2" +
                                       "YQHRZGNJAAYZXMWN8RNZ9T7VMZAJMP2V3S9NXZ9RHL96F7AT3NTMN36V4" +
                                       "ACSFEN4DR6TJR95";
                        kg.PrivateKey = "019VRB95TKY456YC48LBS9FK34YN080VVPDJPPKU6XA9EPLX7HTVN3VST" +
                                        "TNJZFPH4HQAFY58R593KFKSNZ7WEZBA9AZ6PGN735EWEFUAEM3G8XVUFN" +
                                        "L2ZFRPXA4V8KVXE4M8GACUJAT7H3TTWZT9ZDE43ZF46HC01AHFR85MVR2" +
                                        "UP7K3N53M8MTNWBUP01AHFR85MVR2UP7K3N53M8MTNWBUP";
                        break;
                    }
                case Enigma_KeyGen_IDE.RM_1024:
                    {
                        kg.PublicKey = "0201B810DA4A1ADD4351378790A981385330CDG9YQSEUK2HT546KWW46NHSCHMD2TNCSPVNSKGQC6CHDUSU9CC4LDPL" +
                                       "TD3NLRVD3TFV9BU2SYBUBU9TXKLQ3CTKZE5GN9VFG37R9YNK2FE58K7ZY" +
                                       "WTUJYFSJTBMDLLGA9GJ2LJXGHSS9CESGC2K69H65YQGAC7CRGF5T3CPLA" +
                                       "5BDJZKVCUWPZRNA2DN7L956LZVZBQUDPX6PF30CDBH26Z82VE4QQ8N85L" +
                                       "QHYJYYCJ6WQ89H9K9VVQX925SG5FJ79AGVZB6M8TTFKCJ56FAREP8GSTC" +
                                       "NKWCXEALDP9Y2ZLS9QKZV8JRNDHG9D8BRDSCTMDQK9NLAPZ9TGYFS9G7U" +
                                       "LXHYJF7F9A89HPXGTU2N4FQQJL98WZ5QND2KTEMMUUZFAX953HCGNSWUW" +
                                       "U2M7LBEWZSH9GW5SC0CDJDY2HC4HJYUSVTAVXZ7MYVJWF3CU9WC3SVPSL" +
                                       "29WF46DVS2SYKSSAMATPPYGJDE3PBFMGS34CXWQSXKCEAE63L2EXTS9NE" +
                                       "2G597XASY3S34XMYST5YZF4THUTYT5DY9UKKXU6PH8MLXRPZMPMMR83JU" +
                                       "X2WGNEW8ZGL4SKUCUB8CEAB6UZ4FB66WTP3B64VMX7XG75T4Y35479";
                        kg.PrivateKey = "020MLJ7XTRVLBDNUVMKGUFHCU8XBGMHHVRA0ADSHPBC7NVSZ82AM867XC" +
                                        "BELNKMR7CZ56C4SW8KKRD9WZLE5X992GZVSZXS5J6JG9SLDW3Y696TU4D" +
                                        "QZP778LVFKVRKANQD6FUGN2ACWUJM9ZK6ME7WXWDZ88LTWHME52RKUDKX" +
                                        "STT7RGWP7HFUJDGWEUG4ZHQ25DCQJ644CLEXRR3G020SAAREJB4WXZ4H2" +
                                        "JEH4AB4U8FGFTA4CAF020SAAREJB4WXZ4H2JEH4AB4U8FGFTA4CAF";
                        break;
                    }
                case Enigma_KeyGen_IDE.RM_2048:
                    {
                        kg.PublicKey = "0201B810DA4A1ADD4351378790A98138533199H9KZC4CQ5ZKPEGYDW2EHN5AKZA5G5KP4HU8USWJR8XWW7MCH7244RV" +
                                       "PSXFHVU6YQRK4LPUHM497XJYPLLA3DHUZWXK3CB5SUYF75NPYLTNPRUAP" +
                                       "CTVDHAKYWTRQ97HES2E59WDN2LJKFYA2K8BGFSBHP4A6BF5FSDTS8NWLL" +
                                       "C5NEQ76NJ9BAMWXG55UPFFMRQZTU5KV2G6LSPQUJJWA9U4LJ5SCJ9M9ZQ" +
                                       "Z6K7LZA9UAMJ533UQ5J3JPNQAUWJGZFRFCTGAGSBWPWRRF9HRGF9MCX55" +
                                       "QRYGPYMRE6DBJ65SJDX34FVPYWWKWQ48MCKXYXPHQ23BJ42U8ZMDD8CG5" +
                                       "DPHZQ5XTXUKA277XK6PKSTLJ88ZZ9EBXH62REMRZZRGNPKHYM34RW722S" +
                                       "SZHMPFKY7X8UZ19ADGX3UQ7X444XH7MZXEZYW2YLFHR8YL3PTCXVSYX89" +
                                       "ZXN7KW2XNBE8XS3TQRGZVF6KA5USH56NEZYH5RNWBBPVE9LD6H42RQWR5" +
                                       "YVQMT5EQYQTK6YM9V8DA5BJCLGGZ2UGD6NPA2X3SNUS47F7HJBNBCWHRA" +
                                       "YPPCQ5HWCJNPDHUDQMRN2P6PWJFWJ6CLVNK8HXEFLE4ENPXAFN89CRS43" +
                                       "RUMVGDJQCSRB535XYCS6BZYLA9Q6HJV425F26XXHRGA7C8R8BVMELAPEH" +
                                       "5DSA9KXTCV4H2RNVDFHG3YJSERZVFPWHYA823LUBENBL5U3J4LJX2KQLW" +
                                       "L5XGGESPSE2FQWKSQ4NUCDLBEJPQAT2A2477DYS2XEXKLYEAKUN22622C" +
                                       "RLBCAHPFNEV2FJ2H8N3JQGXJRGP19AFHGRW6SS2ZSFYK8EZAPVYL4MCP4" +
                                       "6UMR64Y9T89FHWEPXBRHKWJCSNNNGPU984J5XW4BWTU6PDWPN24W8RU55" +
                                       "A9C3U9H7VHS5PFURASHBT4JAEE5ZKJBSYMCMDVBLU973R72RVPA6U96A2" +
                                       "LX8HMASVST9RVJ7W66V4DYWRDZZQ3673W7C7LVF68TWPLNMYEUQ8FDZRN" +
                                       "P38D9BX5YA3VENETDUUUMR9U7FFP4NZM7G4Y6J6EASK5SAXXTRMZ8F3AH" +
                                       "5FC54E543N739BY5KVZQM7JZWD2P2HPE7BDRMM9JFCGPBWWASTZ7UDNRV" +
                                       "6AFHVMBR9AGAERE9M6W6S2ZT8PBTABPDCKBPPPV6QW9DRXZUGAHDDRRSY" +
                                       "XM4YXQ2QJX6CL33N7RV8846LK8A3DFLDXWZ2NKF8V";
                        kg.PrivateKey = "02DB825DUDFYHA88AG49NMM742HCQEJDKQQGDR6G3GL7MCED16DU9KTVE" +
                                        "47XQ3M92FFKX8FU9ZXT7AK7VTGGJSYQERCZBR8J2DE2CFE3VUU4W7JEQJ" +
                                        "L49HDUXBW7SNPCV8MHXM7EQHYPQK3GSPQYV5VWESQE4AYWFZHXN2UX7Z3" +
                                        "T3CV52XURB3YFKLUCY6CJTRACRVVDD568F6F28U74ABWCZ2ZMC32E83V3" +
                                        "4JZZPDBF3KEYQWREETGKQT6NANCMAD4XDEXW5LCYBJ3GMDJBM3E7FNK98" +
                                        "7JEUYEV7QNKGKNTDVMRG3G5L8NC9CNHQS8AVDMDBEGCG3DHGJUGPG2244" +
                                        "2C9LCD8FJ2LSDMQXLHCGCLP7ZSYQT2UJ4QFGU2CH3BTT3UADZMQSBAV33" +
                                        "B3Z2Y8Y8RRD9J754G02DJ372LR8APP7HXKB2GNPHP6T65C3RR48Q8BHGP" +
                                        "KEZ6PX2D02DJ372LR8APP7HXKB2GNPHP6T65C3RR48Q8BHGPKEZ6PX2D";
                        break;
                    }
                case Enigma_KeyGen_IDE.RM_3072:
                    {
                        kg.PublicKey = "0201B810DA4A1ADD4351378790A98138533267BJBN6W8SY33Y47RWJHWS385XWRV9TSVSB5EM7ECZYNSJ44ZKSD8KV4" +
                                       "6Y9T6TNC6QMDW4V6DBMADU3YUKLP88TCLEUD9FTEUHGXM6T57AQ2EMB59" +
                                       "UPQVNSUT7Z4EHAMDQ6N77VK2A6P847MMWJH9E7C5XX6FNF6MHGWERPWQV" +
                                       "9ZLVR9Z7X5D5Z2XQL6MBM7BDCT2DEDVRBFNDDBLG6LHZ9APM48LS5TKTJ" +
                                       "AGDYFDRVHEGTDH47PCLL8YJ4ZAWCB59F8BN5PZL3NQACP32G3YNBX5E3J" +
                                       "7S28XLRGAX55ZML5XE6Q68EUAL38VUBJ2MZ2UGCCHM7CE6S99N44X9RMV" +
                                       "7B55HULJ4KHPFYSBDUSPQTCWGS76BEQST2QCZDZ2T4FBA4YUJFF47AACE" +
                                       "A4EEFESEYWN48UZCSDZAMGSU5VB9UJKR2XQUSDFS3TNG9QKURQWS7N5Q3" +
                                       "VPYT4QAGGQ5GW2MMXHDJYW55FQPHSS255GVJ7WLLP85JHS8K6DVTJWB4W" +
                                       "4Y8ZEFF7KP6W74PAA8FVPZVDW4RKGMQ8V56Q6R4V34XFE5HR4FZS8GZ6R" +
                                       "36RKW6WN34S2AHR9LCGF8LULB7ZN6NC2AA5RPDZYGWSPPME6267CGLZCP" +
                                       "GG98W557RXCDWAETJHDCRPUXX7AD3E8SL9WMGBV9QFHMSV9UFV7H9NTX3" +
                                       "QYV95CN9P9DSYQWL35R2BWB4GKW6CTWVB2X6WH3P2WFBE6X55KBLAMDB3" +
                                       "SRDSDVY37GKH78MUHY7KDJDC8SJU5FUQRYZ49ULX3YSZL7E284GFVZSGD" +
                                       "FTTQNR6VMBM3LLR78SUSVMJW88XT2K4UHEATRU3V9MMR2VGNGCY9S6R7M" +
                                       "4ELNPEBBMQP2HVPLY5M5VPA92V7NU8ZZ58YYTW5QK9USZ5LV59UZGB2CF" +
                                       "DPZ6HFYU5WB7UU3UYWVNSNKM3W7GBYKJP8TMFW2YN6GNSSE4ZKFVZRLUT" +
                                       "8QPZBBEQT5H9H5Z53D7QV4AJTKTX4EMW62TDWXQVK24JZPSG2VXKCMYZL" +
                                       "BUASE25R3EEK9KBLJ8VX83ZXGTBL5CCDBY33HJ6FKX8AW3WPRX3XTCS9G" +
                                       "2B9SVK2XFFKNSPGFG6FZNS8P2HERFGFL79DKUZZFWHFH4H9UZ7F7F6W3Z" +
                                       "WN84JRRA7SU8T89EQMRBEPVYMMGLGSUMFWWMEDLJM5EGP5WEX9LDUAQXS" +
                                       "55LKDQVRKX4R8NNBHSYBHSNMFYA2C6KGQQFK3TN267DPSZT3PTKHTLNMU" +
                                       "V2YYZZRX3953LPWAKYF8LJUVMEQT3ZC4F9SWMYGUHG6XX66PJFQWSRUW2" +
                                       "C79YLGZ6ZAFS7HLXBTH55UD3EGFBZQ5CLNJDZTEJACDVBCM5FQBTX4DKK" +
                                       "UDGNSMWWLC5UMQRHW89CTU5636WYDXVZZDAUZ529458LDN2DAR9QADWRZ" +
                                       "UTU8MCKN8ACH3R36YKE52DDF67SM5UDUH7PTATHXE65UCGFRCV49UTF29" +
                                       "BGDSUWGRMC839HUZYQVAG985YUF5KJCAVGKRD8E4YMPJ38KR6HD2KHDGY" +
                                       "PJDMJMN4Y3DTJW5MYX3VUPF32637LMAWFM4QCU7BMP74SCF4N5QXZZVBE" +
                                       "LAQMPYMJC2ZWJ9XFV33YXTTPH3SG9KMUABLL83P7L3UBVM763XJPR5UEH" +
                                       "DZ73XJUGR9QP6299K5PU46XGVWKWFAKWYMRXUSLCFJ3WQTEC6QJH6E5V8" +
                                       "X2RMA5TXGSBEWLGSMNQ2SH6G9MLKK4S486DN4M4QVDTYTM4JQETAJQGP7" +
                                       "6NUR4UNDXR4W4JQSNWDTUGX69SEDC3AL8ZF4TJBQQRXSX2A86UUWCDCFH" +
                                       "JE94A8EP3Q6A2QTYKEE62MV4VJB2AB";
                        kg.PrivateKey = "04DMQBFL5GKK4RXWEZYPEY8QB5GHBBGW3EY766DFF2Q6PLFLR4SSRWXBN" +
                                        "W5CFGFC84UJ8PKRDQQYWN9921AH8AGZAQRWJYZ7C3QUJJCJAAGGT5P5GG" +
                                        "LY6K5W4JZJDW7Y8EWS6SSYCS2MCR93MY9DG6VXLBRYVZWDX6XNFU286HM" +
                                        "AM9E82KJVZNYGC8RXRW43SFFWDLR8C96R58A42F3TGLXPVWLGMNPPAWS4" +
                                        "S2SSMNQLUPBAQMP7AUKAGV5CKL342W6UKQY3TUPXKGFXFES725PEX93UX" +
                                        "X4K8JRY3MPQ5S94VNPBXQ5N6LDBLWB67LBLDCGNQS3JEKW667UF8LA8Q6" +
                                        "B3AF4XGZKYB7BVVHF49DJUHSFJZRD63S4GMMAPQ8Q87HKN9G3J3575JEL" +
                                        "5C29NZLWQW6MSYWJ7S3NKLKPWGU75ZJXKEL6Z9V97HAMDYHM6ARCH58EP" +
                                        "WRPZUXN8RRWGCDFM6BH6XUTRTFE3VMAAZAUUKHKL6AFC2PCPXFRDWLVYP" +
                                        "ZKUGY8QDEZNECK9K5Y5MET9SRWQ36JF77XJ6NUKSMZ6DKUPEH4W43YQAE" +
                                        "CV7XVFWJ7ZTRVFQJZFU5BS8AL77YLCXDCR5VPFFZ9NP7EBBQ2AA04DP3S" +
                                        "86B3YD8AFXQ3KPPNTPHBTQSM8PUHJHG87RUM4EV63GKPBRGSN3VX63FCS" +
                                        "646DLWSH86B542U3F04DP3S86B3YD8AFXQ3KPPNTPHBTQSM8PUHJHG87R" +
                                        "UM4EV63GKPBRGSN3VX63FCS646DLWSH86B542U3F";
                        break;
                    }
                case Enigma_KeyGen_IDE.RM_4096:
                    {
                        kg.PublicKey = "0201B810DA4A1ADD4351378790A98138533334BN75EUD4LFWYFVNFGBRCEMKKXG62QRBXL8GMHQ975B68FJVEMNXQQ7" +
                                       "RKR7RCZMWDVP86QPB3LR49G9BM7EUUZXNCRZBXRF4PEY3RX6UXT4X286K" +
                                       "WMR7AMEE6QNP9AEHGWJT9AVU3F62F37B5GVX2BQF73QWHRFQSQ6XMRP6M" +
                                       "ZDRQ8JT89UF3YRK5UL34MM3L8HLDTWAJF5YY7MRWJUFDQRK9JNCJ6C9KJ" +
                                       "WRE5ACQSNS24NEAHDYKS3AK75HBCTKP9NR2CSL7Q9PPXM4TF7L37USP77" +
                                       "Z7WER6JY67F7YGKTP6MFRMKK9H8XFPZ9XWKK97XCFXK7AW4TB96WGEH4B" +
                                       "YPF9QRF2DGC3LCHW8VTD2EMHVRDR6EEBUG8R4XYKJPLBPRCJP445DU2BW" +
                                       "JWELKAY45GKDU5HLTTDTWRH2JFKJ7AVAKLPEELN29YHX5JR773P9ERW7N" +
                                       "UFMWDKD4UL4YPU5QW2L4A7ZN3E8ZDQVEZUR6ZRDQXRLQRLUNHVB4XGBWD" +
                                       "HM79NGJARHDBQJCD8NWZCWPBY26QARP7A5S48DCV29F7MUTHU3YAHYVS7" +
                                       "ZPGXJZZA5HBBY4K5BQPUG6MVCBG8H3C7VL8KH9EH58NUVCE6F2CGMSM94" +
                                       "4CQDKNVGWWWRNK4DG26UT88Y9ULUPJ25G9KLTQPK3TBXZEK43X8KPMJT8" +
                                       "DF6MTQ5RB94XR2BT9H9NYYTXL29GF8KZY9QNHAW4LTT2RDQTD2ELWPSV4" +
                                       "4AND9K8G5VKLQ287UBEVHA82CMSMGQQBMNQZVAZ9G8T5TD6G9F7XQHMJT" +
                                       "HCL6PFEDUW5MN9JASF2EKPT2H33325A3SFGGM5C3RYKZSYSSQC5FLHNX9" +
                                       "VHN4HQVWD66YECY4R97JZHQALRTCHXUWH85LSJCCTQZT8JF52FHG6FV9J" +
                                       "UJWEU24K9Z7SKYTYA9NH7GW29FSNKUK3DMFXY48VEYZVDRTTMLFYSJH8B" +
                                       "RQXV72REYGSM6SLX89EVQ52CN9N8YDLWHAWCDDNM89YN2FCRTLE8688XN" +
                                       "F4MZMFE6GP9JK2JTFJVUKBLES2ZVWSBCJE9N3D7DG9LL9Z3U42QFJJPE2" +
                                       "HE5XCRY25UND96R9D7655ZBSCPF796FJZ4GPLY7AMZLGLR77GRP467ELK" +
                                       "PXSZ9ZF8MUYFDHV4EFACPZ79CDFTYW56NE9JDWDVUMNLY9EXDSF8ZNABE" +
                                       "MDQU6T9RVLTNRMZJJ8EJSUM9TV8YA6MNWF2Y66MD3VQ9L662F5X6VE9ZC" +
                                       "PPRTNMEV2DG9BUMFMSL7PUR9H5QG6VVBDBMEU3PLABL57HMSQ5C83E9X8" +
                                       "RTPY4QSEH2H7R2QDJHT5LQSFNQJL2NZ24GLNTFXG468WC5UUTDD68G8HM" +
                                       "477Z8P4F9ZZHUGZ6VPFF32A2MPWY8LPXNECCKM9EEVLDDPUJ8LXN2AE6K" +
                                       "Y2Q42FVBCJM9GQTXNRHBED735KCFD4YGV4U5U3LJD6NJ886W6XQLWH3G7" +
                                       "3VZ6T5YDUQP6DA5ZHLKQSGATDJHUWC2ELTE7QJFXH8H9EAQYZPPMW76JG" +
                                       "Z48UBND9VXFXZMSGBNWQPNQG7E4TCBDMVKUSA9TTVSNLN3DXEZNXH787R" +
                                       "N7XHFBJNZ5W74DUMNBYVHEQDYMZBQCFMS8LGSDUAU6QE9DD5Q334BX62T" +
                                       "JP5WQQDS2ZEWW76XW7VMLX3L7V9UVD7RL297VDBVRFPQ5MYA3YFVBVNVA" +
                                       "R5TJXMQ4X2U2PW6UWSKBXT58HG3QPZM2RVEX2PDMCVJDFTJMXR9NPLW4C" +
                                       "6AE4Q9A8TTAQ68BSN9WWTFFTSX68ECVARFPDBBH5DMP4KYFARTFVCSWNF" +
                                       "FGAPBYYGFJA4MGHEDWTNE54MPGER7EPCZEV2ESJRMM6XDMFGABG97HECN" +
                                       "3SZFUBRKCNDZ2TE9F6EERULRCDAV5EMY6KVY9NY9MYNPP2FQ5WFWLMRYD" +
                                       "4TNYYHE6EDMQ6KK79HH5Q5KBW6DDQYYNUR365W2454CHEZWZAPU82SX4H" +
                                       "KHNZXBRVWAT7G9CJBKHNBPSVEL67X8UJHBFHZH8ZD4NSEVFZM4Y768TJ6" +
                                       "QP3BGEKLTY4UZUWHG63QMKVWAQW9E7WRFNJCH4XRD97JHNKMFUTRFVH68" +
                                       "G5CKSMGC725AZ9CBSL2JX43P4EY44CMF56AJ6BEXVCJP2ZDWCT9G55K4D" +
                                       "F24J7TTJMFXTQH95CBNX67CBPNWEKHCWQV6VD73Y9KCZHNBFUFS8TCYNN" +
                                       "WXRGFKNVRDFUKWHDWDDTSPEW8YCKLPMX2GUV3N4JFJMUE6TSJR6Z53C9F" +
                                       "SKZAY3EN7G66JPBF5E9S6Y7RQHPWZHSRDQ7XH87PHUJFLJFGD7WNE3Q9P" +
                                       "EXMW33LVJBFEUXKNUB6SU7ZYCEX96XT8G27FLUV7XPV4JK64DWDJCX9WV" +
                                       "4VL8CK23FQJ28UG9JUZTQJ3DRL32BTJVRD4LVQ6MK9LCE7ZZP925JK7ZD" +
                                       "92SCV4DDJJ5EXMVBF";
                        kg.PrivateKey = "067DN6F8YFBTWF5QH8MHJB39Z7VNN2P56HS8RPBURAWB8KPL8FQWX4HSP" +
                                        "RTY4HWFMFXAVX2YUY99G2U2KKK56CBE4BCPZWS3KJ98XRW4PY2CDQ3ALF" +
                                        "Y3HGJG42NRY9ZVGZZB59TE29KGC825BYBX3FRFMYBVN2VTHM8YM2KULXM" +
                                        "H24XSHNVK4HEQ9L5264844DMBFUUXSBA9PT9LEXT6449TMAMF7RL6KU6C" +
                                        "GP6FU9DNMJCNTUREF2U9WUMJBMXMMHWKWDG4VU5JQNFFNNWCP2YE2DGFD" +
                                        "N3H27NTNR58GBNTTZBRK66BKWNVMF8H59KALB6K93Y8UWDUWV5HJZGV8X" +
                                        "3AS5EG982DYV4W9CQ3GRRFRR8NABQC98FTAG465SXQ3JPN7X7VULQZX4X" +
                                        "UK68URBFPGCW2UPBYH6CRG6C7YBRAURM2KMGN5L8XH4AUQN8WM4P454WN" +
                                        "NWRE5SQEC78FK3LHHQU5VLXLYYN8F2NXGG7CCQ92EEC63ZE6S7CC7RTML" +
                                        "UMM3PAXPL5CJZFL26JNNYPVLAHM75NDL8AS8JR48PFXK49D4A6TY2ZU9Y" +
                                        "XX2Y2TLA3J8T56EPY236FEDGZEHTQR73NE2Y7LKL7423FFKGGPWYL8PB5" +
                                        "VWD54PG328ACE6V8VLSGVP9VJMMWS2VDVU459C8K5XK869Z5KM4JWHAVE" +
                                        "G56ZESC6HHJ423N6SAH2DW2UQZDQHSMKWUCHPUKZZPJXCQXF55Q3BJW6Z" +
                                        "QYK4HM4Q8XWU8NT844E8YM96EGHSYEUKAJ3QDXANN2DELSGARH7LR2XH9" +
                                        "UQBQNXGPZGB6JTEQP8HAQK5ZZYJE067DWX6C2JJ7L2HE4NGVXZV5XH9RD" +
                                        "P9SNG4WZTC9KEMGXDX7JTQX8RPJJRT4YTA83L8GXDNDDHB7C79CN8UWGL" +
                                        "U5EMNMBREQN5MYTYHGYK067DWX6C2JJ7L2HE4NGVXZV5XH9RDP9SNG4WZ" +
                                        "TC9KEMGXDX7JTQX8RPJJRT4YTA83L8GXDNDDHB7C79CN8UWGLU5EMNMBR" +
                                        "EQN5MYTYHGYK";
                        break;
                    }
            }
            kg.Key = new string('\0', 2048);
            kg.KeyLen = kg.Key.Length;

            kg.RegInfo = tbUserInfo.Text;
            kg.RegInfoLen = kg.RegInfo.Length;

            kg.UseKeyExpiration = cbExpiration.Checked;
            if (kg.UseKeyExpiration)
            {
                kg.ExpirationYear = dtpExpiration.Value.Year;
                kg.ExpirationMonth = dtpExpiration.Value.Month;
                kg.ExpirationDay = dtpExpiration.Value.Day;
            }
            // Hardware ID
            kg.UseHardwareLocking = cbHardware.Checked;
            if (kg.UseHardwareLocking)
            {
                kg.HardwareID = tbHardware.Text;
            }
            // Register After
            kg.UseRegisterAfter = cbRegisterAfter.Checked;
            if (kg.UseRegisterAfter)
            {
                kg.RegisterAfterYear = dtpRegisterAfter.Value.Year;
                kg.RegisterAfterMonth = dtpRegisterAfter.Value.Month;
                kg.RegisterAfterDay = dtpRegisterAfter.Value.Day;
            }
            // Register Before
            kg.UseRegisterBefore = cbRegisterBefore.Checked;
            if (kg.UseRegisterBefore)
            {
                kg.RegisterBeforeYear = dtpRegisterBefore.Value.Year;
                kg.RegisterBeforeMonth = dtpRegisterBefore.Value.Month;
                kg.RegisterBeforeDay = dtpRegisterBefore.Value.Day;
            }
            // Executions
            kg.UseExecutionsLimit = cbExecutions.Checked;
            if (kg.UseExecutionsLimit)
            {
                kg.ExecutionsCount = (int)udExecutions.Value;
            }
            // Days
            kg.UseDaysLimit = cbDays.Checked;
            if (kg.UseDaysLimit)
            {
                kg.DaysCount = (int)udDays.Value;
            }
            // Runtime
            kg.UseRunTimeLimit = cbRuntime.Checked;
            if (kg.UseRunTimeLimit)
            {
                kg.RunTimeMinutes = (int)udRuntime.Value;
            }
            // Global Time
            kg.UseGlobalTimeLimit = cbGlobalTime.Checked;
            if (kg.UseGlobalTimeLimit)
            {
                kg.GlobalTimeMinutes = (int)udGlobalTime.Value;
            }
            // Country
            kg.UseCountyLimit = cbCountry.Checked;
            if (kg.UseCountyLimit)
            {
                Enigma_KeyGen_IDE ide = new Enigma_KeyGen_IDE();
                kg.CountryCode = ide.KEY_COUNTRIES[comCountries.SelectedIndex].Code;
            }

            kg.EncryptedSections = new bool[Enigma_KeyGen_IDE.NUMBER_OF_CRYPTED_SECTIONS];
            kg.EncryptedSections[0] = cbSection1.Checked;
            kg.EncryptedSections[1] = cbSection2.Checked;
            kg.EncryptedSections[2] = cbSection3.Checked;
            kg.EncryptedSections[3] = cbSection4.Checked;
            kg.EncryptedSections[4] = cbSection5.Checked;
            kg.EncryptedSections[5] = cbSection6.Checked;
            kg.EncryptedSections[6] = cbSection7.Checked;
            kg.EncryptedSections[7] = cbSection8.Checked;
            kg.EncryptedSections[8] = cbSection9.Checked;
            kg.EncryptedSections[9] = cbSection10.Checked;
            kg.EncryptedSections[10] = cbSection11.Checked;
            kg.EncryptedSections[11] = cbSection12.Checked;
            kg.EncryptedSections[12] = cbSection13.Checked;
            kg.EncryptedSections[13] = cbSection14.Checked;
            kg.EncryptedSections[14] = cbSection15.Checked;
            kg.EncryptedSections[15] = cbSection16.Checked;

            // Secure constant (get it from project file)!
            kg.EncryptedConstant = 2113444489;

            // Generate reg. key

            uint dwResult = Enigma_KeyGen_IDE.KG_GenerateRegistrationKey(ref kg);
            if (dwResult == Enigma_KeyGen_IDE.EP_NO_ERROR)
            {
                tbKey.Text = kg.Key;
            }
            else
            {
                switch (dwResult)
                {
                    case Enigma_KeyGen_IDE.EP_ERROR_UNKNOWN:
                        tbKey.Text = "EP_ERROR_UNKNOWN";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_KEYBUFFEREMPTY:
                        tbKey.Text = "EP_ERROR_KEYBUFFEREMPTY";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_KEYBUFFERISLESS:
                        tbKey.Text = "EP_ERROR_KEYBUFFERISLESS";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_REGINFOEMPTY:
                        tbKey.Text = "EP_ERROR_REGINFOEMPTY";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_REGINFOTOOLARGE:
                        tbKey.Text = "EP_ERROR_REGINFOTOOLARGE";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_PRIVATEKEYISNOTSET:
                        tbKey.Text = "EP_ERROR_PRIVATEKEYISNOTSET";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_PUBLICKEYISNOTSET:
                        tbKey.Text = "EP_ERROR_PUBLICKEYISNOTSET";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_PRIVATEKEYISINVALID:
                        tbKey.Text = "EP_ERROR_PRIVATEKEYISINVALID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_PUBLICKEYISINVALID:
                        tbKey.Text = "EP_ERROR_PUBLICKEYISINVALID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_KEYMODEISINVALID:
                        tbKey.Text = "EP_ERROR_KEYMODEISINVALID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_KEYBASEISINVALID:
                        tbKey.Text = "EP_ERROR_KEYBASEISINVALID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_CURRENTDATEISINVALID:
                        tbKey.Text = "EP_ERROR_CURRENTDATEISINVALID";
                        break;

                    case Enigma_KeyGen_IDE.EP_ERROR_EXPIRATIONDATEISINVALID:
                        tbKey.Text = "EP_ERROR_EXPIRATIONDATEISINVALID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_KEYISINVALID:
                        tbKey.Text = "EP_ERROR_KEYISINVALID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_HARDWAREID:
                        tbKey.Text = "EP_ERROR_HARDWAREID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_HARDWAREBUFFEREMPTY:
                        tbKey.Text = "EP_ERROR_HARDWAREBUFFEREMPTY";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_HARDWAREIDINVALIDFORKEY:
                        tbKey.Text = "EP_ERROR_HARDWAREIDINVALIDFORKEY";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_PROJECTFILENOTFOUND:
                        tbKey.Text = "EP_ERROR_PROJECTFILENOTFOUND";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_INVALIDPROJECTFILE:
                        tbKey.Text = "EP_ERROR_INVALIDPROJECTFILE";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_EXECUTIONSNUMBERINVALID:
                        tbKey.Text = "EP_ERROR_EXECUTIONSNUMBERINVALID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_DAYSNUMBERINVALID:
                        tbKey.Text = "EP_ERROR_DAYSNUMBERINVALID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_COUNTRYCODEINVALID:
                        tbKey.Text = "EP_ERROR_COUNTRYCODEINVALID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_RUNTIMEINVALID:
                        tbKey.Text = "EP_ERROR_RUNTIMEINVALID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_GLOBALTIMEINVALID:
                        tbKey.Text = "EP_ERROR_GLOBALTIMEINVALID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_INSTALLBEFOREINVALID:
                        tbKey.Text = "EP_ERROR_INSTALLBEFOREINVALID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_INSTALLAFTERINVALID:
                        tbKey.Text = "EP_ERROR_INSTALLAFTERINVALID";
                        break;
                    default:
                        tbKey.Text = "Unknown error";
                        break;
                }
            }
        }

Show/Hide Visual Basic function example

Private Sub bGet_Click()
  Dim kg As TKeyGenParams
  Dim I As Integer
  Dim dwResult As Long

  tKey.Text = vbNullString
  If tbUserInfo.Text = vbNullString Then
    MsgBox "User info field is empty!"
    Exit Sub
  End If

  ' Key mode
  kg.KeyMode = cbKeyMode.ListIndex
  ' Key base
  kg.KeyBase = cbKeyBase.ListIndex
  ' Hyphens
  kg.KeyWithHyphens = cbHyphens.Value

  Select Case kg.KeyMode
    Case RM_512
      kg.PublicKey = "0201B810DA4A1ADD4351378790A98138533067CP4S86R7D8THS45GBCVUM635EPRQRMYRP3DAA5DUPZ6ABDSFP7F5AC" & _
                     "P7ERGH4A7Y6B6NW6NMMBZF83WVER9Y4MMBNLBQDKR7KFVLGLV067CFDQC" & _
                     "WCHGQVVRN24DECEPBL96YJQJTVDCRTNQG3E4WW4GK4GQ5X5L5H88D3XYH" & _
                     "CBRBNASPD3P5CNYFKFHBCSDHHD6WPTCC4XVSM5S88067C2JSTCMVT48C8" & _
                     "HC7SHKGTFJBM28P6XTBCNWHMV6J6KN6W5Q9TQLVR285U6GVCAAUTZLRTP" & _
                     "SRGDQ742B4742XF4MACRR747YDP5FZZ9D" & vbNullChar
      kg.PrivateKey = "00C98B2SF9UBJA605AJX53GJFXJV8UH4A6PY2L6CV4MAMV7V3ERRVY99Y" & _
                      "72V2P77Z2J3KBPGWR3WXKG5GF9Z6CKXJHY5VUMBTQ66H2MRZPCU00DLFJ" & _
                      "675JTTTNEK00DLFJ675JTTTNEK" & vbNullChar
    Case RM_768
      kg.PublicKey = "0201B810DA4A1ADD4351378790A98138533067CP4S86R7D8THS45GBCVUM635EPRQRMYRP3DAA5DUPZ6ABDSFP7F5AC" & _
                     "P7ERGH4A7Y6B6NW6NMMBZF83WVER9Y4MMBNLBQDKR7KFVLGLV067CFDQC" & _
                     "WCHGQVVRN24DECEPBL96YJQJTVDCRTNQG3E4WW4GK4GQ5X5L5H88D3XYH" & _
                     "CBRBNASPD3P5CNYFKFHBCSDHHD6WPTCC4XVSM5S88067C2JSTCMVT48C8" & _
                     "HC7SHKGTFJBM28P6XTBCNWHMV6J6KN6W5Q9TQLVR285U6GVCAAUTZLRTP" & _
                     "SRGDQ742B4742XF4MACRR747YDP5FZZ9D" & vbNullChar
      kg.PrivateKey = "00C98B2SF9UBJA605AJX53GJFXJV8UH4A6PY2L6CV4MAMV7V3ERRVY99Y" & _
                      "72V2P77Z2J3KBPGWR3WXKG5GF9Z6CKXJHY5VUMBTQ66H2MRZPCU00DLFJ" & _
                      "675JTTTNEK00DLFJ675JTTTNEK" & vbNullChar
    Case RM_1024
      kg.PublicKey = "0201B810DA4A1ADD4351378790A981385330CDG9YQSEUK2HT546KWW46NHSCHMD2TNCSPVNSKGQC6CHDUSU9CC4LDPL" & _
                       "TD3NLRVD3TFV9BU2SYBUBU9TXKLQ3CTKZE5GN9VFG37R9YNK2FE58K7ZY" & _
                       "WTUJYFSJTBMDLLGA9GJ2LJXGHSS9CESGC2K69H65YQGAC7CRGF5T3CPLA" & _
                       "5BDJZKVCUWPZRNA2DN7L956LZVZBQUDPX6PF30CDBH26Z82VE4QQ8N85L" & _
                       "QHYJYYCJ6WQ89H9K9VVQX925SG5FJ79AGVZB6M8TTFKCJ56FAREP8GSTC" & _
                       "NKWCXEALDP9Y2ZLS9QKZV8JRNDHG9D8BRDSCTMDQK9NLAPZ9TGYFS9G7U" & _
                       "LXHYJF7F9A89HPXGTU2N4FQQJL98WZ5QND2KTEMMUUZFAX953HCGNSWUW" & _
                       "U2M7LBEWZSH9GW5SC0CDJDY2HC4HJYUSVTAVXZ7MYVJWF3CU9WC3SVPSL" & _
                       "29WF46DVS2SYKSSAMATPPYGJDE3PBFMGS34CXWQSXKCEAE63L2EXTS9NE" & _
                       "2G597XASY3S34XMYST5YZF4THUTYT5DY9UKKXU6PH8MLXRPZMPMMR83JU" & _
                       "X2WGNEW8ZGL4SKUCUB8CEAB6UZ4FB66WTP3B64VMX7XG75T4Y35479" & vbNullChar
      kg.PrivateKey = "020MLJ7XTRVLBDNUVMKGUFHCU8XBGMHHVRA0ADSHPBC7NVSZ82AM867XC" & _
                       "BELNKMR7CZ56C4SW8KKRD9WZLE5X992GZVSZXS5J6JG9SLDW3Y696TU4D" & _
                       "QZP778LVFKVRKANQD6FUGN2ACWUJM9ZK6ME7WXWDZ88LTWHME52RKUDKX" & _
                       "STT7RGWP7HFUJDGWEUG4ZHQ25DCQJ644CLEXRR3G020SAAREJB4WXZ4H2" & _
                       "JEH4AB4U8FGFTA4CAF020SAAREJB4WXZ4H2JEH4AB4U8FGFTA4CAF" & vbNullChar
    Case RM_2048
      kg.PublicKey = "0201B810DA4A1ADD4351378790A98138533199H9KZC4CQ5ZKPEGYDW2EHN5AKZA5G5KP4HU8USWJR8XWW7MCH7244RV" & _
                       "PSXFHVU6YQRK4LPUHM497XJYPLLA3DHUZWXK3CB5SUYF75NPYLTNPRUAP" & _
                       "CTVDHAKYWTRQ97HES2E59WDN2LJKFYA2K8BGFSBHP4A6BF5FSDTS8NWLL" & _
                       "C5NEQ76NJ9BAMWXG55UPFFMRQZTU5KV2G6LSPQUJJWA9U4LJ5SCJ9M9ZQ" & _
                       "Z6K7LZA9UAMJ533UQ5J3JPNQAUWJGZFRFCTGAGSBWPWRRF9HRGF9MCX55" & _
                       "QRYGPYMRE6DBJ65SJDX34FVPYWWKWQ48MCKXYXPHQ23BJ42U8ZMDD8CG5" & _
                       "DPHZQ5XTXUKA277XK6PKSTLJ88ZZ9EBXH62REMRZZRGNPKHYM34RW722S" & _
                       "SZHMPFKY7X8UZ19ADGX3UQ7X444XH7MZXEZYW2YLFHR8YL3PTCXVSYX89" & _
                       "ZXN7KW2XNBE8XS3TQRGZVF6KA5USH56NEZYH5RNWBBPVE9LD6H42RQWR5" & _
                       "YVQMT5EQYQTK6YM9V8DA5BJCLGGZ2UGD6NPA2X3SNUS47F7HJBNBCWHRA" & _
                       "YPPCQ5HWCJNPDHUDQMRN2P6PWJFWJ6CLVNK8HXEFLE4ENPXAFN89CRS43" & _
                       "RUMVGDJQCSRB535XYCS6BZYLA9Q6HJV425F26XXHRGA7C8R8BVMELAPEH" & _
                       "5DSA9KXTCV4H2RNVDFHG3YJSERZVFPWHYA823LUBENBL5U3J4LJX2KQLW" & _
                       "L5XGGESPSE2FQWKSQ4NUCDLBEJPQAT2A2477DYS2XEXKLYEAKUN22622C" & _
                       "RLBCAHPFNEV2FJ2H8N3JQGXJRGP19AFHGRW6SS2ZSFYK8EZAPVYL4MCP4" & _
                       "6UMR64Y9T89FHWEPXBRHKWJCSNNNGPU984J5XW4BWTU6PDWPN24W8RU55" & _
                       "A9C3U9H7VHS5PFURASHBT4JAEE5ZKJBSYMCMDVBLU973R72RVPA6U96A2" & _
                       "LX8HMASVST9RVJ7W66V4DYWRDZZQ3673W7C7LVF68TWPLNMYEUQ8FDZRN" & _
                       "P38D9BX5YA3VENETDUUUMR9U7FFP4NZM7G4Y6J6EASK5SAXXTRMZ8F3AH" & _
                       "5FC54E543N739BY5KVZQM7JZWD2P2HPE7BDRMM9JFCGPBWWASTZ7UDNRV" & _
                       "6AFHVMBR9AGAERE9M6W6S2ZT8PBTABPDCKBPPPV6QW9DRXZUGAHDDRRSY" & _
                       "XM4YXQ2QJX6CL33N7RV8846LK8A3DFLDXWZ2NKF8V" & vbNullChar
      kg.PrivateKey = "02DB825DUDFYHA88AG49NMM742HCQEJDKQQGDR6G3GL7MCED16DU9KTVE" & _
                       "47XQ3M92FFKX8FU9ZXT7AK7VTGGJSYQERCZBR8J2DE2CFE3VUU4W7JEQJ" & _
                       "L49HDUXBW7SNPCV8MHXM7EQHYPQK3GSPQYV5VWESQE4AYWFZHXN2UX7Z3" & _
                       "T3CV52XURB3YFKLUCY6CJTRACRVVDD568F6F28U74ABWCZ2ZMC32E83V3" & _
                       "4JZZPDBF3KEYQWREETGKQT6NANCMAD4XDEXW5LCYBJ3GMDJBM3E7FNK98" & _
                       "7JEUYEV7QNKGKNTDVMRG3G5L8NC9CNHQS8AVDMDBEGCG3DHGJUGPG2244" & _
                       "2C9LCD8FJ2LSDMQXLHCGCLP7ZSYQT2UJ4QFGU2CH3BTT3UADZMQSBAV33" & _
                       "B3Z2Y8Y8RRD9J754G02DJ372LR8APP7HXKB2GNPHP6T65C3RR48Q8BHGP" & _
                       "KEZ6PX2D02DJ372LR8APP7HXKB2GNPHP6T65C3RR48Q8BHGPKEZ6PX2D" & vbNullChar
    Case RM_3072
      kg.PublicKey = "0201B810DA4A1ADD4351378790A98138533267BJBN6W8SY33Y47RWJHWS385XWRV9TSVSB5EM7ECZYNSJ44ZKSD8KV4" & _
                       "6Y9T6TNC6QMDW4V6DBMADU3YUKLP88TCLEUD9FTEUHGXM6T57AQ2EMB59" & _
                       "UPQVNSUT7Z4EHAMDQ6N77VK2A6P847MMWJH9E7C5XX6FNF6MHGWERPWQV" & _
                       "9ZLVR9Z7X5D5Z2XQL6MBM7BDCT2DEDVRBFNDDBLG6LHZ9APM48LS5TKTJ" & _
                       "AGDYFDRVHEGTDH47PCLL8YJ4ZAWCB59F8BN5PZL3NQACP32G3YNBX5E3J" & _
                       "7S28XLRGAX55ZML5XE6Q68EUAL38VUBJ2MZ2UGCCHM7CE6S99N44X9RMV" & _
                       "7B55HULJ4KHPFYSBDUSPQTCWGS76BEQST2QCZDZ2T4FBA4YUJFF47AACE" & _
                       "A4EEFESEYWN48UZCSDZAMGSU5VB9UJKR2XQUSDFS3TNG9QKURQWS7N5Q3" & _
                       "VPYT4QAGGQ5GW2MMXHDJYW55FQPHSS255GVJ7WLLP85JHS8K6DVTJWB4W" & _
                       "4Y8ZEFF7KP6W74PAA8FVPZVDW4RKGMQ8V56Q6R4V34XFE5HR4FZS8GZ6R" & _
                       "36RKW6WN34S2AHR9LCGF8LULB7ZN6NC2AA5RPDZYGWSPPME6267CGLZCP" & _
                       "GG98W557RXCDWAETJHDCRPUXX7AD3E8SL9WMGBV9QFHMSV9UFV7H9NTX3" & _
                       "QYV95CN9P9DSYQWL35R2BWB4GKW6CTWVB2X6WH3P2WFBE6X55KBLAMDB3" & _
                       "SRDSDVY37GKH78MUHY7KDJDC8SJU5FUQRYZ49ULX3YSZL7E284GFVZSGD" & _
                       "FTTQNR6VMBM3LLR78SUSVMJW88XT2K4UHEATRU3V9MMR2VGNGCY9S6R7M" & _
                       "4ELNPEBBMQP2HVPLY5M5VPA92V7NU8ZZ58YYTW5QK9USZ5LV59UZGB2CF" & _
                       "DPZ6HFYU5WB7UU3UYWVNSNKM3W7GBYKJP8TMFW2YN6GNSSE4ZKFVZRLUT" & _
                       "8QPZBBEQT5H9H5Z53D7QV4AJTKTX4EMW62TDWXQVK24JZPSG2VXKCMYZL" & _
                       "BUASE25R3EEK9KBLJ8VX83ZXGTBL5CCDBY33HJ6FKX8AW3WPRX3XTCS9G" & _
                       "2B9SVK2XFFKNSPGFG6FZNS8P2HERFGFL79DKUZZFWHFH4H9UZ7F7F6W3Z" & _
                       "WN84JRRA7SU8T89EQMRBEPVYMMGLGSUMFWWMEDLJM5EGP5WEX9LDUAQXS" & _
                       "55LKDQVRKX4R8NNBHSYBHSNMFYA2C6KGQQFK3TN267DPSZT3PTKHTLNMU" & _
                       "V2YYZZRX3953LPWAKYF8LJUVMEQT3ZC4F9SWMYGUHG6XX66PJFQWSRUW2" & _
                       "C79YLGZ6ZAFS7HLXBTH55UD3EGFBZQ5CLNJDZTEJACDVBCM5FQBTX4DKK"
       kg.PublicKey = kg.PublicKey & _
                       "UDGNSMWWLC5UMQRHW89CTU5636WYDXVZZDAUZ529458LDN2DAR9QADWRZ" & _
                       "UTU8MCKN8ACH3R36YKE52DDF67SM5UDUH7PTATHXE65UCGFRCV49UTF29" & _
                       "BGDSUWGRMC839HUZYQVAG985YUF5KJCAVGKRD8E4YMPJ38KR6HD2KHDGY" & _
                       "PJDMJMN4Y3DTJW5MYX3VUPF32637LMAWFM4QCU7BMP74SCF4N5QXZZVBE" & _
                       "LAQMPYMJC2ZWJ9XFV33YXTTPH3SG9KMUABLL83P7L3UBVM763XJPR5UEH" & _
                       "DZ73XJUGR9QP6299K5PU46XGVWKWFAKWYMRXUSLCFJ3WQTEC6QJH6E5V8" & _
                       "X2RMA5TXGSBEWLGSMNQ2SH6G9MLKK4S486DN4M4QVDTYTM4JQETAJQGP7" & _
                       "6NUR4UNDXR4W4JQSNWDTUGX69SEDC3AL8ZF4TJBQQRXSX2A86UUWCDCFH" & _
                       "JE94A8EP3Q6A2QTYKEE62MV4VJB2AB" & vbNullChar
      kg.PrivateKey = "04DMQBFL5GKK4RXWEZYPEY8QB5GHBBGW3EY766DFF2Q6PLFLR4SSRWXBN" & _
                       "W5CFGFC84UJ8PKRDQQYWN9921AH8AGZAQRWJYZ7C3QUJJCJAAGGT5P5GG" & _
                       "LY6K5W4JZJDW7Y8EWS6SSYCS2MCR93MY9DG6VXLBRYVZWDX6XNFU286HM" & _
                       "AM9E82KJVZNYGC8RXRW43SFFWDLR8C96R58A42F3TGLXPVWLGMNPPAWS4" & _
                       "S2SSMNQLUPBAQMP7AUKAGV5CKL342W6UKQY3TUPXKGFXFES725PEX93UX" & _
                       "X4K8JRY3MPQ5S94VNPBXQ5N6LDBLWB67LBLDCGNQS3JEKW667UF8LA8Q6" & _
                       "B3AF4XGZKYB7BVVHF49DJUHSFJZRD63S4GMMAPQ8Q87HKN9G3J3575JEL" & _
                       "5C29NZLWQW6MSYWJ7S3NKLKPWGU75ZJXKEL6Z9V97HAMDYHM6ARCH58EP" & _
                       "WRPZUXN8RRWGCDFM6BH6XUTRTFE3VMAAZAUUKHKL6AFC2PCPXFRDWLVYP" & _
                       "ZKUGY8QDEZNECK9K5Y5MET9SRWQ36JF77XJ6NUKSMZ6DKUPEH4W43YQAE" & _
                       "CV7XVFWJ7ZTRVFQJZFU5BS8AL77YLCXDCR5VPFFZ9NP7EBBQ2AA04DP3S" & _
                       "86B3YD8AFXQ3KPPNTPHBTQSM8PUHJHG87RUM4EV63GKPBRGSN3VX63FCS" & _
                       "646DLWSH86B542U3F04DP3S86B3YD8AFXQ3KPPNTPHBTQSM8PUHJHG87R" & _
                       "UM4EV63GKPBRGSN3VX63FCS646DLWSH86B542U3F" & vbNullChar
    Case RM_4096
      kg.PublicKey = "0201B810DA4A1ADD4351378790A98138533334BN75EUD4LFWYFVNFGBRCEMKKXG62QRBXL8GMHQ975B68FJVEMNXQQ7" & _
                       "RKR7RCZMWDVP86QPB3LR49G9BM7EUUZXNCRZBXRF4PEY3RX6UXT4X286K" & _
                       "WMR7AMEE6QNP9AEHGWJT9AVU3F62F37B5GVX2BQF73QWHRFQSQ6XMRP6M" & _
                       "ZDRQ8JT89UF3YRK5UL34MM3L8HLDTWAJF5YY7MRWJUFDQRK9JNCJ6C9KJ" & _
                       "WRE5ACQSNS24NEAHDYKS3AK75HBCTKP9NR2CSL7Q9PPXM4TF7L37USP77" & _
                       "Z7WER6JY67F7YGKTP6MFRMKK9H8XFPZ9XWKK97XCFXK7AW4TB96WGEH4B" & _
                       "YPF9QRF2DGC3LCHW8VTD2EMHVRDR6EEBUG8R4XYKJPLBPRCJP445DU2BW" & _
                       "JWELKAY45GKDU5HLTTDTWRH2JFKJ7AVAKLPEELN29YHX5JR773P9ERW7N" & _
                       "UFMWDKD4UL4YPU5QW2L4A7ZN3E8ZDQVEZUR6ZRDQXRLQRLUNHVB4XGBWD" & _
                       "HM79NGJARHDBQJCD8NWZCWPBY26QARP7A5S48DCV29F7MUTHU3YAHYVS7" & _
                       "ZPGXJZZA5HBBY4K5BQPUG6MVCBG8H3C7VL8KH9EH58NUVCE6F2CGMSM94" & _
                       "4CQDKNVGWWWRNK4DG26UT88Y9ULUPJ25G9KLTQPK3TBXZEK43X8KPMJT8" & _
                       "DF6MTQ5RB94XR2BT9H9NYYTXL29GF8KZY9QNHAW4LTT2RDQTD2ELWPSV4" & _
                       "4AND9K8G5VKLQ287UBEVHA82CMSMGQQBMNQZVAZ9G8T5TD6G9F7XQHMJT" & _
                       "HCL6PFEDUW5MN9JASF2EKPT2H33325A3SFGGM5C3RYKZSYSSQC5FLHNX9" & _
                       "VHN4HQVWD66YECY4R97JZHQALRTCHXUWH85LSJCCTQZT8JF52FHG6FV9J" & _
                       "UJWEU24K9Z7SKYTYA9NH7GW29FSNKUK3DMFXY48VEYZVDRTTMLFYSJH8B" & _
                       "RQXV72REYGSM6SLX89EVQ52CN9N8YDLWHAWCDDNM89YN2FCRTLE8688XN" & _
                       "F4MZMFE6GP9JK2JTFJVUKBLES2ZVWSBCJE9N3D7DG9LL9Z3U42QFJJPE2" & _
                       "HE5XCRY25UND96R9D7655ZBSCPF796FJZ4GPLY7AMZLGLR77GRP467ELK" & _
                       "PXSZ9ZF8MUYFDHV4EFACPZ79CDFTYW56NE9JDWDVUMNLY9EXDSF8ZNABE" & _
                       "MDQU6T9RVLTNRMZJJ8EJSUM9TV8YA6MNWF2Y66MD3VQ9L662F5X6VE9ZC" & _
                       "PPRTNMEV2DG9BUMFMSL7PUR9H5QG6VVBDBMEU3PLABL57HMSQ5C83E9X8" & _
                       "RTPY4QSEH2H7R2QDJHT5LQSFNQJL2NZ24GLNTFXG468WC5UUTDD68G8HM"
      kg.PublicKey = kg.PublicKey & _
                       "477Z8P4F9ZZHUGZ6VPFF32A2MPWY8LPXNECCKM9EEVLDDPUJ8LXN2AE6K" & _
                       "Y2Q42FVBCJM9GQTXNRHBED735KCFD4YGV4U5U3LJD6NJ886W6XQLWH3G7" & _
                       "3VZ6T5YDUQP6DA5ZHLKQSGATDJHUWC2ELTE7QJFXH8H9EAQYZPPMW76JG" & _
                       "Z48UBND9VXFXZMSGBNWQPNQG7E4TCBDMVKUSA9TTVSNLN3DXEZNXH787R" & _
                       "N7XHFBJNZ5W74DUMNBYVHEQDYMZBQCFMS8LGSDUAU6QE9DD5Q334BX62T" & _
                       "JP5WQQDS2ZEWW76XW7VMLX3L7V9UVD7RL297VDBVRFPQ5MYA3YFVBVNVA" & _
                       "R5TJXMQ4X2U2PW6UWSKBXT58HG3QPZM2RVEX2PDMCVJDFTJMXR9NPLW4C" & _
                       "6AE4Q9A8TTAQ68BSN9WWTFFTSX68ECVARFPDBBH5DMP4KYFARTFVCSWNF" & _
                       "FGAPBYYGFJA4MGHEDWTNE54MPGER7EPCZEV2ESJRMM6XDMFGABG97HECN" & _
                       "3SZFUBRKCNDZ2TE9F6EERULRCDAV5EMY6KVY9NY9MYNPP2FQ5WFWLMRYD" & _
                       "4TNYYHE6EDMQ6KK79HH5Q5KBW6DDQYYNUR365W2454CHEZWZAPU82SX4H" & _
                       "KHNZXBRVWAT7G9CJBKHNBPSVEL67X8UJHBFHZH8ZD4NSEVFZM4Y768TJ6" & _
                       "QP3BGEKLTY4UZUWHG63QMKVWAQW9E7WRFNJCH4XRD97JHNKMFUTRFVH68" & _
                       "G5CKSMGC725AZ9CBSL2JX43P4EY44CMF56AJ6BEXVCJP2ZDWCT9G55K4D" & _
                       "F24J7TTJMFXTQH95CBNX67CBPNWEKHCWQV6VD73Y9KCZHNBFUFS8TCYNN" & _
                       "WXRGFKNVRDFUKWHDWDDTSPEW8YCKLPMX2GUV3N4JFJMUE6TSJR6Z53C9F" & _
                       "SKZAY3EN7G66JPBF5E9S6Y7RQHPWZHSRDQ7XH87PHUJFLJFGD7WNE3Q9P" & _
                       "EXMW33LVJBFEUXKNUB6SU7ZYCEX96XT8G27FLUV7XPV4JK64DWDJCX9WV" & _
                       "4VL8CK23FQJ28UG9JUZTQJ3DRL32BTJVRD4LVQ6MK9LCE7ZZP925JK7ZD" & _
                       "92SCV4DDJJ5EXMVBF" & vbNullChar
      kg.PrivateKey = "067DN6F8YFBTWF5QH8MHJB39Z7VNN2P56HS8RPBURAWB8KPL8FQWX4HSP" & _
                       "RTY4HWFMFXAVX2YUY99G2U2KKK56CBE4BCPZWS3KJ98XRW4PY2CDQ3ALF" & _
                       "Y3HGJG42NRY9ZVGZZB59TE29KGC825BYBX3FRFMYBVN2VTHM8YM2KULXM" & _
                       "H24XSHNVK4HEQ9L5264844DMBFUUXSBA9PT9LEXT6449TMAMF7RL6KU6C" & _
                       "GP6FU9DNMJCNTUREF2U9WUMJBMXMMHWKWDG4VU5JQNFFNNWCP2YE2DGFD" & _
                       "N3H27NTNR58GBNTTZBRK66BKWNVMF8H59KALB6K93Y8UWDUWV5HJZGV8X" & _
                       "3AS5EG982DYV4W9CQ3GRRFRR8NABQC98FTAG465SXQ3JPN7X7VULQZX4X" & _
                       "UK68URBFPGCW2UPBYH6CRG6C7YBRAURM2KMGN5L8XH4AUQN8WM4P454WN" & _
                       "NWRE5SQEC78FK3LHHQU5VLXLYYN8F2NXGG7CCQ92EEC63ZE6S7CC7RTML" & _
                       "UMM3PAXPL5CJZFL26JNNYPVLAHM75NDL8AS8JR48PFXK49D4A6TY2ZU9Y" & _
                       "XX2Y2TLA3J8T56EPY236FEDGZEHTQR73NE2Y7LKL7423FFKGGPWYL8PB5" & _
                       "VWD54PG328ACE6V8VLSGVP9VJMMWS2VDVU459C8K5XK869Z5KM4JWHAVE" & _
                       "G56ZESC6HHJ423N6SAH2DW2UQZDQHSMKWUCHPUKZZPJXCQXF55Q3BJW6Z" & _
                       "QYK4HM4Q8XWU8NT844E8YM96EGHSYEUKAJ3QDXANN2DELSGARH7LR2XH9" & _
                       "UQBQNXGPZGB6JTEQP8HAQK5ZZYJE067DWX6C2JJ7L2HE4NGVXZV5XH9RD" & _
                       "P9SNG4WZTC9KEMGXDX7JTQX8RPJJRT4YTA83L8GXDNDDHB7C79CN8UWGL" & _
                       "U5EMNMBREQN5MYTYHGYK067DWX6C2JJ7L2HE4NGVXZV5XH9RDP9SNG4WZ" & _
                       "TC9KEMGXDX7JTQX8RPJJRT4YTA83L8GXDNDDHB7C79CN8UWGLU5EMNMBR" & _
                       "EQN5MYTYHGYK" & vbNullChar
  End Select

  ' Fill key buffer
  kg.Key = String$(2048, 0)
  kg.KeyLen = 2048
  ' Fill User Info buffer
  kg.RegInfo = tbUserInfo.Text
  kg.RegInfoLen = Len(tbUserInfo.Text)
  ' Key expiration info
  kg.UseKeyExpiration = cbExpiration.Value
  If kg.UseKeyExpiration Then
    kg.ExpirationDay = dtpExpiration.Day
    kg.ExpirationMonth = dtpExpiration.Month
    kg.ExpirationYear = dtpExpiration.Year
  End If
  ' Register After
  kg.UseRegisterAfter = cbRegisterAfter.Value
  If kg.UseRegisterAfter Then
    kg.RegisterAfterDay = dtpRegisterAfter.Day
    kg.RegisterAfterMonth = dtpRegisterAfter.Month
    kg.RegisterAfterYear = dtpRegisterAfter.Year
  End If
  ' Register Before
  kg.UseRegisterBefore = cbRegisterBefore.Value
  If kg.UseRegisterBefore Then
    kg.RegisterBeforeDay = dtpRegisterBefore.Day
    kg.RegisterBeforeMonth = dtpRegisterBefore.Month
    kg.RegisterBeforeYear = dtpRegisterBefore.Year
  End If
  ' Executions
  kg.UseExecutionsLimit = cbExecutions.Value
  If kg.UseExecutionsLimit Then
    kg.ExecutionsCount = tExecutions.Text
  End If
  ' Days
  kg.UseDaysLimit = cbDays.Value
  If kg.UseDaysLimit Then
    kg.DaysCount = tDays.Text
  End If
  ' Runtime
  kg.UseRunTimeLimit = cbRuntime.Value
  If kg.UseRunTimeLimit Then
    kg.RunTimeMinutes = tRuntime.Text
  End If
  ' Global Time
  kg.UseGlobalTimeLimit = cbGlobalTime.Value
  If kg.UseGlobalTimeLimit Then
    kg.GlobalTimeMinutes = tGlobalTime.Text
  End If
  ' Country
  kg.UseCountyLimit = cbCountry.Value
  If kg.UseCountyLimit Then
    kg.CountryCode = comCountries.ItemData(comCountries.ListIndex)
  End If
  ' Hardware ID
  kg.UseHardwareLocking = cbHardware.Value
  If kg.UseHardwareLocking Then
    kg.HardwareID = tHardware.Text
  End If
  ' Crypt Sections
  For I = 1 To NUMBER_OF_CRYPTED_SECTIONS
    kg.EncryptedSections(I - 1) = cbSection(I - 1).Value
  Next I

  kg.EncryptedConstant = D2113444489

  ' Generate reg. key
  dwResult = KG_GenerateRegistrationKey(kg)
  If dwResult = ERROR_OK Then
    tKey.Text = kg.Key
  Else
    Select Case dwResult
      Case EP_ERROR_UNKNOWN
        tKey.Text = "EP_ERROR_UNKNOWN"
      Case EP_ERROR_KEYBUFFEREMPTY
        tKey.Text = "EP_ERROR_KEYBUFFEREMPTY"
      Case EP_ERROR_KEYBUFFERISLESS
        tKey.Text = "EP_ERROR_KEYBUFFERISLESS"
      Case EP_ERROR_REGINFOEMPTY
        tKey.Text = "EP_ERROR_REGINFOEMPTY"
      Case EP_ERROR_REGINFOTOOLARGE
        tKey.Text = "EP_ERROR_REGINFOTOOLARGE"
      Case EP_ERROR_PRIVATEKEYISNOTSET
        tKey.Text = "EP_ERROR_PRIVATEKEYISNOTSET"
      Case EP_ERROR_PUBLICKEYISNOTSET
        tKey.Text = "EP_ERROR_PUBLICKEYISNOTSET"
      Case EP_ERROR_PRIVATEKEYISINVALID
        tKey.Text = "EP_ERROR_PRIVATEKEYISINVALID"
      Case EP_ERROR_PUBLICKEYISINVALID
        tKey.Text = "EP_ERROR_PUBLICKEYISINVALID"
      Case EP_ERROR_KEYMODEISINVALID
        tKey.Text = "EP_ERROR_KEYMODEISINVALID"
      Case EP_ERROR_KEYBASEISINVALID
        tKey.Text = "EP_ERROR_KEYBASEISINVALID"
      Case EP_ERROR_CURRENTDATEISINVALID
        tKey.Text = "EP_ERROR_CURRENTDATEISINVALID"
      Case EP_ERROR_EXPIRATIONDATEISINVALID
        tKey.Text = "EP_ERROR_EXPIRATIONDATEISINVALID"
      Case EP_ERROR_KEYISINVALID
        tKey.Text = "EP_ERROR_KEYISINVALID"
      Case EP_ERROR_HARDWAREID
        tKey.Text = "EP_ERROR_HARDWAREID"
      Case EP_ERROR_HARDWAREBUFFEREMPTY
        tKey.Text = "EP_ERROR_HARDWAREBUFFEREMPTY"
      Case EP_ERROR_HARDWAREIDINVALIDFORKEY
        tKey.Text = "EP_ERROR_HARDWAREIDINVALIDFORKEY"
      Case EP_ERROR_PROJECTFILENOTFOUND
        tKey.Text = "EP_ERROR_PROJECTFILENOTFOUND"
      Case EP_ERROR_INVALIDPROJECTFILE
        tKey.Text = "EP_ERROR_INVALIDPROJECTFILE"
      Case EP_ERROR_EXECUTIONSNUMBERINVALID
        tKey.Text = "EP_ERROR_EXECUTIONSNUMBERINVALID"
      Case EP_ERROR_DAYSNUMBERINVALID
        tKey.Text = "EP_ERROR_DAYSNUMBERINVALID"
      Case EP_ERROR_COUNTRYCODEINVALID
        tKey.Text = "EP_ERROR_COUNTRYCODEINVALID"
      Case EP_ERROR_RUNTIMEINVALID
        tKey.Text = "EP_ERROR_RUNTIMEINVALID"
      Case EP_ERROR_GLOBALTIMEINVALID
        tKey.Text = "EP_ERROR_GLOBALTIMEINVALID"
      Case EP_ERROR_INSTALLBEFOREINVALID
        tKey.Text = "EP_ERROR_INSTALLBEFOREINVALID"
      Case EP_ERROR_INSTALLAFTERINVALID
        tKey.Text = "EP_ERROR_INSTALLAFTERINVALID"
      Case Else
        tKey.Text = "Unknown error"
    End Select
  End If
End Sub

See function examples in the installation folder, Examples\Keygen subfolder.


Function KG_GenerateRegistrationKeyFromProject

The function is similar to KG_GenerateRegistrationKey. The main difference of this function is that it reads secure information (PublicKey, PrivateKey, KeyMode, KeyBase and EncryptedConstant) from the project file and you do not have to set up these parameters in the input structure TGenKeyParam. KG_GenerateRegistrationKeyFromProject has one additional parameter - ProjectFile. ProjectFile is a pointer to ANSI - null terminated string, which defines the path to the Enigma Protector project file.

Warning: ProjectFile has to contain an absolute path to the project file.

Return Values

EP_NO_ERROR=0 | the function succeeds. In this case, Key parameter of TKeyGenParams structure should contain a pointer to the null terminated string - registration key.
EP_ERROR_UNKNOWN=1 | unknown error
EP_ERROR_KEYBUFFEREMPTY=2 | memory buffer for registration key is not allocated
EP_ERROR_KEYBUFFERISLESS=3 | size of allocated memory for registration key is less than required
EP_ERROR_REGINFOEMPTY=4 | registration information is not specified
EP_ERROR_REGINFOTOOLARGE=5 | registration information is empty (has a null size)
EP_ERROR_PRIVATEKEYISNOTSET=6 | private key is not set
EP_ERROR_PUBLICKEYISNOTSET=7 | public key is not set
EP_ERROR_PRIVATEKEYISINVALID=8 | private key is invalid
EP_ERROR_PUBLICKEYISINVALID=9 | public key is invalid
EP_ERROR_KEYMODEISINVALID=10 | key mode is invalid
EP_ERROR_KEYBASEISINVALID=11 | key base is invalid
EP_ERROR_CURRENTDATEISINVALID=12 | current date is invalid
EP_ERROR_EXPIRATIONDATEISINVALID=13 | expiration date is invalid
EP_ERROR_KEYISINVALID=14 | key is invalid
EP_ERROR_HARDWAREID=15 | hardware id is invalid
EP_ERROR_HARDWAREBUFFEREMPTY=16 | hardware id buffer is empty
EP_ERROR_HARDWAREIDINVALIDFORKEY=17 | hardware id is invalid for the key
EP_ERROR_PROJECTFILENOTFOUND=18 | project file is not found
EP_ERROR_INVALIDPROJECTFILE=19 | project file is invalid
EP_ERROR_EXECUTIONSNUMBERINVALID=20 | executions number is invalid
EP_ERROR_DAYSNUMBERINVALID=21 | days number is invalid
EP_ERROR_COUNTRYCODEINVALID=22 | country code is invalid
EP_ERROR_RUNTIMEINVALID=23 | run-time value is invalid
EP_ERROR_GLOBALTIMEINVALID=24 | global time is invalid
EP_ERROR_INSTALLBEFOREINVALID=25 | register before date is invalid
EP_ERROR_INSTALLAFTERINVALID=26 | register after date is invalid

Definition

Show/Hide Delphi function definition

function KG_GenerateRegistrationKeyFromProject(ProjectFile : PAnsiChar; kg : PKeyGenParams) : dword; external 'keygen.dll' name 'KG_GenerateRegistrationKeyFromProject';

Show/Hide C++ function definition

 extern  "C" __declspec( dllimport ) __stdcall int KG_GenerateRegistrationKeyFromProject(char* pfile, PKeyGenParams kg);

Show/Hide C# (.NET) function definition

public class Enigma_KeyGen_IDE
{
    [DllImport("keygen.dll", CallingConvention = CallingConvention.StdCall)]
    public static extern uint KG_GenerateRegistrationKeyFromProject(string FileName, ref TKeyGenParams kg);
}

Show/Hide Visual Basic function definition

Public Declare Function KG_GenerateRegistrationKeyFromProject Lib "keygen.dll" (ByVal ProjectName As String, ByRef kg As TKeyGenParams) As Long

Examples

Show/Hide Delphi function example

procedure TfrmMain.bGenFPClick(Sender: TObject);
var
  kg : TKeyGenParams;
  KeyBuffer : array [0..2047] of char;
  dwResult : dword;
begin
  mKey.Clear;

  if eUserInfo.Text = '' then
  begin
    ShowMessage('User info field is empty!');
    Exit;
  end;

  ZeroMemory(@kg, SizeOf(kg));
  // Hyphens
  kg.KeyWithHyphens := cbHyphens.Checked;
  // Fill key buffer
  ZeroMemory(@KeyBuffer, SizeOf(KeyBuffer));
  kg.Key := @KeyBuffer;
  kg.KeyLen := SizeOf(KeyBuffer);
  // Fill User Info
  kg.RegInfo := PAnsiChar(AnsiString(eUserInfo.Text));
  kg.RegInfoLen := strlen(PAnsiChar(kg.RegInfo));
  // Key expiration info
  kg.UseKeyExpiration := cbExpirationDate.Checked;
  kg.ExpirationYear := YearOf(DateTimePicker1.DateTime);
  kg.ExpirationMonth := MonthOf(DateTimePicker1.DateTime);
  kg.ExpirationDay := DayOf(DateTimePicker1.DateTime);
  // Register After date
  kg.UseRegisterAfter := cbRegisterAfter.Checked;
  if kg.UseRegisterAfter then
  begin
    kg.RegisterAfterYear := YearOf(dtpRegisterAfter.DateTime);
    kg.RegisterAfterMonth := MonthOf(dtpRegisterAfter.DateTime);
    kg.RegisterAfterDay := DayOf(dtpRegisterAfter.DateTime);
  end;
  // Register Before date
  kg.UseRegisterBefore := cbRegisterBefore.Checked;
  if kg.UseRegisterBefore then
  begin
    kg.RegisterBeforeYear := YearOf(dtpRegisterBefore.DateTime);
    kg.RegisterBeforeMonth := MonthOf(dtpRegisterBefore.DateTime);
    kg.RegisterBeforeDay := DayOf(dtpRegisterBefore.DateTime);
  end;
  // Country
  kg.UseCountyLimit := cbCountry.Checked;
  if kg.UseCountyLimit then
  begin
    kg.CountryCode := KEY_COUNTRIES[comCountries.ItemIndex].Code;
  end;
  // Executions
  kg.UseExecutionsLimit := cbExecutions.Checked;
  if kg.UseExecutionsLimit then
  begin
    kg.ExecutionsCount := StrToInt(eExecutions.Text);
  end;
  // Days
  kg.UseDaysLimit := cbDays.Checked;
  if kg.UseDaysLimit then
  begin
    kg.DaysCount := StrToInt(eDays.Text);
  end;
  // Runtime
  kg.UseRunTimeLimit := cbRuntime.Checked;
  if kg.UseRunTimeLimit then
  begin
    kg.RunTimeMinutes := StrToInt(eRuntime.Text);
  end;
  // Global time
  kg.UseGlobalTimeLimit := cbGlobalTime.Checked;
  if kg.UseGlobalTimeLimit then
  begin
    kg.GlobalTimeMinutes := StrToInt(eGlobalTime.Text);
  end;
  // Hardware ID
  kg.UseHardwareLocking := cbHardwareID.Checked;
  kg.HardwareID := PAnsiChar(AnsiString(eHardware.Text));
  // Crypt Sections
  kg.EncryptedSections[1] := cbSection1.Checked;
  kg.EncryptedSections[2] := cbSection2.Checked;
  kg.EncryptedSections[3] := cbSection3.Checked;
  kg.EncryptedSections[4] := cbSection4.Checked;
  kg.EncryptedSections[5] := cbSection5.Checked;
  kg.EncryptedSections[6] := cbSection6.Checked;
  kg.EncryptedSections[7] := cbSection7.Checked;
  kg.EncryptedSections[8] := cbSection8.Checked;
  kg.EncryptedSections[9] := cbSection9.Checked;
  kg.EncryptedSections[10] := cbSection10.Checked;
  kg.EncryptedSections[11] := cbSection11.Checked;
  kg.EncryptedSections[12] := cbSection12.Checked;
  kg.EncryptedSections[13] := cbSection13.Checked;
  kg.EncryptedSections[14] := cbSection14.Checked;
  kg.EncryptedSections[15] := cbSection15.Checked;
  kg.EncryptedSections[16] := cbSection16.Checked;
  // Generate reg. key
  dwResult := KG_GenerateRegistrationKeyFromProject('default.enigma', @kg);
  if dwResult = EP_NO_ERROR then
  begin
    mKey.Text := String(PAnsiChar(kg.Key));
  end else
  begin
    case dwResult of
      EP_ERROR_UNKNOWN                 : mKey.Text := 'EP_ERROR_UNKNOWN                ';
      EP_ERROR_KEYBUFFEREMPTY          : mKey.Text := 'EP_ERROR_KEYBUFFEREMPTY         ';
      EP_ERROR_KEYBUFFERISLESS         : mKey.Text := 'EP_ERROR_KEYBUFFERISLESS        ';
      EP_ERROR_REGINFOEMPTY            : mKey.Text := 'EP_ERROR_REGINFOEMPTY           ';
      EP_ERROR_REGINFOTOOLARGE         : mKey.Text := 'EP_ERROR_REGINFOTOOLARGE        ';
      EP_ERROR_PRIVATEKEYISNOTSET      : mKey.Text := 'EP_ERROR_PRIVATEKEYISNOTSET     ';
      EP_ERROR_PUBLICKEYISNOTSET       : mKey.Text := 'EP_ERROR_PUBLICKEYISNOTSET      ';
      EP_ERROR_PRIVATEKEYISINVALID     : mKey.Text := 'EP_ERROR_PRIVATEKEYISINVALID    ';
      EP_ERROR_PUBLICKEYISINVALID      : mKey.Text := 'EP_ERROR_PUBLICKEYISINVALID     ';
      EP_ERROR_KEYMODEISINVALID        : mKey.Text := 'EP_ERROR_KEYMODEISINVALID       ';
      EP_ERROR_KEYBASEISINVALID        : mKey.Text := 'EP_ERROR_KEYBASEISINVALID       ';
      EP_ERROR_CURRENTDATEISINVALID    : mKey.Text := 'EP_ERROR_CURRENTDATEISINVALID   ';
      EP_ERROR_EXPIRATIONDATEISINVALID : mKey.Text := 'EP_ERROR_EXPIRATIONDATEISINVALID';
      EP_ERROR_KEYISINVALID            : mKey.Text := 'EP_ERROR_KEYISINVALID           ';
      EP_ERROR_HARDWAREID              : mKey.Text := 'EP_ERROR_HARDWAREID             ';
      EP_ERROR_HARDWAREBUFFEREMPTY     : mKey.Text := 'EP_ERROR_HARDWAREBUFFEREMPTY    ';
      EP_ERROR_HARDWAREIDINVALIDFORKEY : mKey.Text := 'EP_ERROR_HARDWAREIDINVALIDFORKEY';
      EP_ERROR_PROJECTFILENOTFOUND     : mKey.Text := 'EP_ERROR_PROJECTFILENOTFOUND    ';
      EP_ERROR_INVALIDPROJECTFILE      : mKey.Text := 'EP_ERROR_INVALIDPROJECTFILE     ';
      EP_ERROR_EXECUTIONSNUMBERINVALID : mKey.Text := 'EP_ERROR_EXECUTIONSNUMBERINVALID';
      EP_ERROR_DAYSNUMBERINVALID       : mKey.Text := 'EP_ERROR_DAYSNUMBERINVALID      ';
      EP_ERROR_COUNTRYCODEINVALID      : mKey.Text := 'EP_ERROR_COUNTRYCODEINVALID     ';
      EP_ERROR_RUNTIMEINVALID          : mKey.Text := 'EP_ERROR_RUNTIMEINVALID         ';
      EP_ERROR_GLOBALTIMEINVALID       : mKey.Text := 'EP_ERROR_GLOBALTIMEINVALID      ';
      EP_ERROR_INSTALLBEFOREINVALID    : mKey.Text := 'EP_ERROR_INSTALLBEFOREINVALID   ';
      EP_ERROR_INSTALLAFTERINVALID     : mKey.Text := 'EP_ERROR_INSTALLAFTERINVALID    ';
      else mKey.Text := 'Unknown error';
    end;
  end;
end;

Show/Hide Borland C++ Builder function example

void __fastcall TfrmMain::bGenFPClick(TObject *Sender)
{
  TKeyGenParams kg;
  char keybuffer[2048];
  WORD wYear;
  WORD wDay;
  WORD wMonth;
  DWORD dwResult;

  mKey->Clear();

  if (eUserInfo->Text == "")
  {
    ShowMessage("Registration info is empty!");
    return;
  }

  // Clear params buffer
  memset(&kg, 0, sizeof(kg));
  // Hyphens
  kg.KeyWithHyphens = cbHyphens->Checked;

  // Fill key buffer
  memset(&keybuffer, 0, sizeof(keybuffer));
  kg.Key = (char*) keybuffer;
  kg.KeyLen = sizeof(keybuffer);

  // Fill User Info
  char namebuf[255];
  memset(&namebuf, 0, sizeof(namebuf));
  memcpy(&namebuf, eUserInfo->Text.c_str(), eUserInfo->Text.Length());
  kg.RegInfo = namebuf;
  kg.RegInfoLen = eUserInfo->Text.Length();

  // Hardware ID
  kg.UseHardwareLocking = cbHardware->Checked;
  if (kg.UseHardwareLocking)
  {
    char hdbuf[255];
    memset(&hdbuf, 0, sizeof(hdbuf));
    memcpy(&hdbuf, eHardware->Text.c_str(), eHardware->Text.Length());
    kg.HardwareID = hdbuf;
  }

  // Key expiration info
  kg.UseKeyExpiration = cbExpiration->Checked;
  if (kg.UseKeyExpiration)
  {
    DecodeDate(dtpExpiration->DateTime, wYear, wMonth, wDay);
    kg.ExpirationYear = wYear;
    kg.ExpirationMonth = wMonth;
    kg.ExpirationDay = wDay;
  }

  // Register After
  kg.UseRegisterAfter = cbRegisterAfter->Checked;
  if (kg.UseRegisterAfter)
  {
    DecodeDate(dtpRegisterAfter->DateTime, wYear, wMonth, wDay);
    kg.RegisterAfterYear = wYear;
    kg.RegisterAfterMonth = wMonth;
    kg.RegisterAfterDay = wDay;
  }

  // Register Before
  kg.UseRegisterBefore = cbRegisterBefore->Checked;
  if (kg.UseRegisterBefore)
  {
    DecodeDate(dtpRegisterBefore->DateTime, wYear, wMonth, wDay);
    kg.RegisterBeforeYear = wYear;
    kg.RegisterBeforeMonth = wMonth;
    kg.RegisterBeforeDay = wDay;
  }

  // Executions
  kg.UseExecutionsLimit = cbExecutions->Checked;
  if (kg.UseExecutionsLimit)
  {
    kg.ExecutionsCount = seExecutions->Value;
  }

  // Days
  kg.UseDaysLimit = cbDays->Checked;
  if (kg.UseDaysLimit)
  {
    kg.DaysCount = seDays->Value;
  }

  // Runtime
  kg.UseRunTimeLimit = cbRuntime->Checked;
  if (kg.UseRunTimeLimit)
  {
    kg.RunTimeMinutes = seRuntime->Value;
  }

  // Global Time
  kg.UseGlobalTimeLimit = cbGlobalTime->Checked;
  if (kg.UseGlobalTimeLimit)
  {
    kg.GlobalTimeMinutes = seGlobalTime->Value;
  }

  // Country
  kg.UseCountyLimit = cbCountry->Checked;
  if (kg.UseCountyLimit)
  {
    kg.CountryCode = KEY_COUNTRIES[comCountry->ItemIndex].Code;
  }

  // Crypt Sections
  kg.EncryptedSections[0] = cbSection1->Checked;
  kg.EncryptedSections[1] = cbSection2->Checked;
  kg.EncryptedSections[2] = cbSection3->Checked;
  kg.EncryptedSections[3] = cbSection4->Checked;
  kg.EncryptedSections[4] = cbSection5->Checked;
  kg.EncryptedSections[5] = cbSection6->Checked;
  kg.EncryptedSections[6] = cbSection7->Checked;
  kg.EncryptedSections[7] = cbSection8->Checked;
  kg.EncryptedSections[8] = cbSection9->Checked;
  kg.EncryptedSections[9] = cbSection10->Checked;
  kg.EncryptedSections[10] = cbSection11->Checked;
  kg.EncryptedSections[11] = cbSection12->Checked;
  kg.EncryptedSections[12] = cbSection13->Checked;
  kg.EncryptedSections[13] = cbSection14->Checked;
  kg.EncryptedSections[14] = cbSection15->Checked;
  kg.EncryptedSections[15] = cbSection16->Checked;

  dwResult = KG_GenerateRegistrationKeyFromProject("default.enigma", &kg);

  if (dwResult == EP_NO_ERROR)
  {
    mKey->Text = (AnsiString)kg.Key;
  } else
  {
    switch (dwResult)
    {
      case EP_ERROR_UNKNOWN:
        mKey->Text = "EP_ERROR_UNKNOWN";
        break;
      case EP_ERROR_KEYBUFFEREMPTY:
        mKey->Text = "EP_ERROR_KEYBUFFEREMPTY";
        break;
      case EP_ERROR_KEYBUFFERISLESS:
        mKey->Text = "EP_ERROR_KEYBUFFERISLESS";
        break;
      case EP_ERROR_REGINFOEMPTY:
        mKey->Text = "EP_ERROR_REGINFOEMPTY";
        break;
      case EP_ERROR_REGINFOTOOLARGE:
        mKey->Text = "EP_ERROR_REGINFOTOOLARGE";
        break;
      case EP_ERROR_PRIVATEKEYISNOTSET:
        mKey->Text = "EP_ERROR_PRIVATEKEYISNOTSET";
        break;
      case EP_ERROR_PUBLICKEYISNOTSET:
        mKey->Text = "EP_ERROR_PUBLICKEYISNOTSET";
        break;
      case EP_ERROR_PRIVATEKEYISINVALID:
        mKey->Text = "EP_ERROR_PRIVATEKEYISINVALID";
        break;
      case EP_ERROR_PUBLICKEYISINVALID:
        mKey->Text = "EP_ERROR_PUBLICKEYISINVALID";
        break;
      case EP_ERROR_KEYMODEISINVALID:
        mKey->Text = "EP_ERROR_KEYMODEISINVALID";
        break;
      case EP_ERROR_KEYBASEISINVALID:
        mKey->Text = "EP_ERROR_KEYBASEISINVALID";
        break;
      case EP_ERROR_CURRENTDATEISINVALID:
        mKey->Text = "EP_ERROR_CURRENTDATEISINVALID";
        break;
      case EP_ERROR_EXPIRATIONDATEISINVALID:
        mKey->Text = "EP_ERROR_EXPIRATIONDATEISINVALID";
        break;
      case EP_ERROR_KEYISINVALID:
        mKey->Text = "EP_ERROR_KEYISINVALID";
        break;
      case EP_ERROR_HARDWAREID:
        mKey->Text = "EP_ERROR_HARDWAREID";
        break;
      case EP_ERROR_HARDWAREBUFFEREMPTY:
        mKey->Text = "EP_ERROR_HARDWAREBUFFEREMPTY";
        break;
      case EP_ERROR_HARDWAREIDINVALIDFORKEY:
        mKey->Text = "EP_ERROR_HARDWAREIDINVALIDFORKEY";
        break;
      case EP_ERROR_PROJECTFILENOTFOUND:
        mKey->Text = "EP_ERROR_PROJECTFILENOTFOUND";
        break;
      case EP_ERROR_INVALIDPROJECTFILE:
        mKey->Text = "EP_ERROR_INVALIDPROJECTFILE";
        break;
      case EP_ERROR_EXECUTIONSNUMBERINVALID:
        mKey->Text = "EP_ERROR_EXECUTIONSNUMBERINVALID";
        break;
      case EP_ERROR_DAYSNUMBERINVALID:
        mKey->Text = "EP_ERROR_DAYSNUMBERINVALID";
        break;
      case EP_ERROR_COUNTRYCODEINVALID:
        mKey->Text = "EP_ERROR_COUNTRYCODEINVALID";
        break;
      case EP_ERROR_RUNTIMEINVALID:
        mKey->Text = "EP_ERROR_RUNTIMEINVALID";
        break;
      case EP_ERROR_GLOBALTIMEINVALID:
        mKey->Text = "EP_ERROR_GLOBALTIMEINVALID";
        break;
      case EP_ERROR_INSTALLBEFOREINVALID:
        mKey->Text = "EP_ERROR_INSTALLBEFOREINVALID";
        break;
      case EP_ERROR_INSTALLAFTERINVALID:
        mKey->Text = "EP_ERROR_INSTALLAFTERINVALID";
        break;
      default:
        mKey->Text = "Unknown error";
        break;
    }
  }
}

Show/Hide Visual C++ function example

void CKeygenDlg::OnBnClickedButtongenfp()
{
    // TODO: Add your control notification handler code here
    // TODO: Add your control notification handler code here
  TKeyGenParams kp;
  char keybuffer[2048];
  char tmp[255];
  char username[255];
  char hardwareid[255];
  SYSTEMTIME lpDate;
  DWORD dwResult;

  // Clear params buffer
  memset(&kp, 0, sizeof(kp));
  // Clear key buffer
  memset(&keybuffer, 0, sizeof(keybuffer));

  kp.Key = (char*) keybuffer;
  kp.KeyLen = sizeof(keybuffer);

  // Fill User Info
  memset(&username, 0, sizeof(username));
  GetDlgItemText(IDC_EDITNAME, (char*)&username, sizeof(username));
  kp.RegInfo = (char*)&username;
  kp.RegInfoLen = strlen(kp.RegInfo);

  // Key expiration info
  if (IsDlgButtonChecked(IDC_CHECKEXPIRATION) != 0)
  {
      kp.UseKeyExpiration = true;
      SendDlgItemMessage(IDC_DTPEXPIRATION, DTM_GETSYSTEMTIME, GDT_VALID, (LPARAM)&lpDate);
      kp.ExpirationYear = lpDate.wYear;
      kp.ExpirationMonth = lpDate.wMonth;
      kp.ExpirationDay = lpDate.wDay;
  }

  // Register After
  if (IsDlgButtonChecked(IDC_CHECKREGAFTER) != 0)
  {
      kp.UseRegisterAfter = true;
      SendDlgItemMessage(IDC_DTPREGAFTER, DTM_GETSYSTEMTIME, GDT_VALID, (LPARAM)&lpDate);
      kp.RegisterAfterYear = lpDate.wYear;
      kp.RegisterAfterMonth = lpDate.wMonth;
      kp.RegisterAfterDay = lpDate.wDay;
  }

  // Register Before
  if (IsDlgButtonChecked(IDC_CHECKREGBEFORE) != 0)
  {
      kp.UseRegisterBefore = true;
      SendDlgItemMessage(IDC_DTPREGBEFORE, DTM_GETSYSTEMTIME, GDT_VALID, (LPARAM)&lpDate);
      kp.RegisterBeforeYear = lpDate.wYear;
      kp.RegisterBeforeMonth = lpDate.wMonth;
      kp.RegisterBeforeDay = lpDate.wDay;
  }

  // Executions
  if (IsDlgButtonChecked(IDC_CHECKEXECS) != 0)
  {
      kp.UseExecutionsLimit = true;
      memset(&tmp, 0, sizeof(tmp));
      GetDlgItemText(IDC_EDITEXECS, (char*)&tmp, sizeof(tmp));
      kp.ExecutionsCount = atoi((char*)&tmp);
  }

  // Days
  if (IsDlgButtonChecked(IDC_CHECKDAYS) != 0)
  {
      kp.UseDaysLimit = true;
      memset(&tmp, 0, sizeof(tmp));
      GetDlgItemText(IDC_EDITDAYS, (char*)&tmp, sizeof(tmp));
      kp.DaysCount = atoi((char*)&tmp);
  }

  // Run-time
  if (IsDlgButtonChecked(IDC_CHECKRTIME) != 0)
  {
      kp.UseRunTimeLimit = true;
      memset(&tmp, 0, sizeof(tmp));
      GetDlgItemText(IDC_EDITRTIME, (char*)&tmp, sizeof(tmp));
      kp.RunTimeMinutes = atoi((char*)&tmp);
  }

  // Global time
  if (IsDlgButtonChecked(IDC_CHECKGTIME) != 0)
  {
      kp.UseGlobalTimeLimit = true;
      memset(&tmp, 0, sizeof(tmp));
      GetDlgItemText(IDC_EDITGTIME, (char*)&tmp, sizeof(tmp));
      kp.GlobalTimeMinutes = atoi((char*)&tmp);
  }

  // Country Lock
  if (IsDlgButtonChecked(IDC_CHECKCOUNTRY) != 0)
  {
      kp.UseCountyLimit = true;
      kp.CountryCode = KEY_COUNTRIES[com_counties.GetCurSel()].Code;
  }

  // Hardware ID
  if (IsDlgButtonChecked(IDC_CHECKHD) != 0)
  {
      kp.UseHardwareLocking = true;
      memset(&hardwareid, 0, sizeof(hardwareid));
      GetDlgItemText(IDC_EDITHD, (char*)&hardwareid, sizeof(hardwareid));
      kp.HardwareID = (char*)&hardwareid;
  }

  // Crypt Sections
  if (IsDlgButtonChecked(IDC_CHECKS1) != 0) { kp.EncryptedSections[0] = true; }
  if (IsDlgButtonChecked(IDC_CHECKS2) != 0) { kp.EncryptedSections[1] = true; }
  if (IsDlgButtonChecked(IDC_CHECKS3) != 0) { kp.EncryptedSections[2] = true; }
  if (IsDlgButtonChecked(IDC_CHECKS4) != 0) { kp.EncryptedSections[3] = true; }
  if (IsDlgButtonChecked(IDC_CHECKS5) != 0) { kp.EncryptedSections[4] = true; }
  if (IsDlgButtonChecked(IDC_CHECKS6) != 0) { kp.EncryptedSections[5] = true; }
  if (IsDlgButtonChecked(IDC_CHECKS7) != 0) { kp.EncryptedSections[6] = true; }
  if (IsDlgButtonChecked(IDC_CHECKS8) != 0) { kp.EncryptedSections[7] = true; }
  if (IsDlgButtonChecked(IDC_CHECKS9) != 0) { kp.EncryptedSections[8] = true; }
  if (IsDlgButtonChecked(IDC_CHECKS10) != 0) { kp.EncryptedSections[9] = true; }
  if (IsDlgButtonChecked(IDC_CHECKS11) != 0) { kp.EncryptedSections[10] = true; }
  if (IsDlgButtonChecked(IDC_CHECKS12) != 0) { kp.EncryptedSections[11] = true; }
  if (IsDlgButtonChecked(IDC_CHECKS13) != 0) { kp.EncryptedSections[12] = true; }
  if (IsDlgButtonChecked(IDC_CHECKS14) != 0) { kp.EncryptedSections[13] = true; }
  if (IsDlgButtonChecked(IDC_CHECKS15) != 0) { kp.EncryptedSections[14] = true; }
  if (IsDlgButtonChecked(IDC_CHECKS16) != 0) { kp.EncryptedSections[15] = true; }

  kp.KeyWithHyphens = IsDlgButtonChecked(IDC_CHECKHYPHENS) != 0;

  // Generate reg. key
  dwResult = KG_GenerateRegistrationKeyFromProject("default.enigma", &kp);

  if (dwResult == EP_NO_ERROR)
  {
    SetDlgItemText(IDC_EDITKEY, kp.Key);
  } else
  {
    char* sError;
    switch (dwResult)
    {
      case EP_ERROR_UNKNOWN:
        sError = "EP_ERROR_UNKNOWN";
        break;
      case EP_ERROR_KEYBUFFEREMPTY:
        sError = "EP_ERROR_KEYBUFFEREMPTY";
        break;
      case EP_ERROR_KEYBUFFERISLESS:
        sError = "EP_ERROR_KEYBUFFERISLESS";
        break;
      case EP_ERROR_REGINFOEMPTY:
        sError = "EP_ERROR_REGINFOEMPTY";
        break;
      case EP_ERROR_REGINFOTOOLARGE:
        sError = "EP_ERROR_REGINFOTOOLARGE";
        break;
      case EP_ERROR_PRIVATEKEYISNOTSET:
        sError = "EP_ERROR_PRIVATEKEYISNOTSET";
        break;
      case EP_ERROR_PUBLICKEYISNOTSET:
        sError = "EP_ERROR_PUBLICKEYISNOTSET";
        break;
      case EP_ERROR_PRIVATEKEYISINVALID:
        sError = "EP_ERROR_PRIVATEKEYISINVALID";
        break;
      case EP_ERROR_PUBLICKEYISINVALID:
        sError = "EP_ERROR_PUBLICKEYISINVALID";
        break;
      case EP_ERROR_KEYMODEISINVALID:
        sError = "EP_ERROR_KEYMODEISINVALID";
        break;
      case EP_ERROR_KEYBASEISINVALID:
        sError = "EP_ERROR_KEYBASEISINVALID";
        break;
      case EP_ERROR_CURRENTDATEISINVALID:
        sError = "EP_ERROR_CURRENTDATEISINVALID";
        break;
      case EP_ERROR_EXPIRATIONDATEISINVALID:
        sError = "EP_ERROR_EXPIRATIONDATEISINVALID";
        break;
      case EP_ERROR_KEYISINVALID:
        sError = "EP_ERROR_KEYISINVALID";
        break;
      case EP_ERROR_HARDWAREID:
        sError = "EP_ERROR_HARDWAREID";
        break;
      case EP_ERROR_HARDWAREBUFFEREMPTY:
        sError = "EP_ERROR_HARDWAREBUFFEREMPTY";
        break;
      case EP_ERROR_HARDWAREIDINVALIDFORKEY:
        sError = "EP_ERROR_HARDWAREIDINVALIDFORKEY";
        break;
      case EP_ERROR_PROJECTFILENOTFOUND:
        sError = "EP_ERROR_PROJECTFILENOTFOUND";
        break;
      case EP_ERROR_INVALIDPROJECTFILE:
        sError = "EP_ERROR_INVALIDPROJECTFILE";
        break;
      case EP_ERROR_EXECUTIONSNUMBERINVALID:
        sError = "EP_ERROR_EXECUTIONSNUMBERINVALID";
        break;
      case EP_ERROR_DAYSNUMBERINVALID:
        sError = "EP_ERROR_DAYSNUMBERINVALID";
        break;
      case EP_ERROR_COUNTRYCODEINVALID:
        sError = "EP_ERROR_COUNTRYCODEINVALID";
        break;
      case EP_ERROR_RUNTIMEINVALID:
        sError = "EP_ERROR_RUNTIMEINVALID";
        break;
      case EP_ERROR_GLOBALTIMEINVALID:
        sError = "EP_ERROR_GLOBALTIMEINVALID";
        break;
      case EP_ERROR_INSTALLBEFOREINVALID:
        sError = "EP_ERROR_INSTALLBEFOREINVALID";
        break;
      case EP_ERROR_INSTALLAFTERINVALID:
        sError = "EP_ERROR_INSTALLAFTERINVALID";
        break;
      default:
        sError = "Unknown error";
        break;
    }
    SetDlgItemText(IDC_EDITKEY, sError);
  }
}

Show/Hide C# (.NET) function example

        private void btnGenerateFP_Click(object sender, EventArgs e)
        {
            tbKey.Clear();
            if (tbUserInfo.Text == string.Empty)
            {
                MessageBox.Show("User info field is empty!");
                return;
            }
            Enigma_KeyGen_IDE.TKeyGenParams kg = new Enigma_KeyGen_IDE.TKeyGenParams();
            kg.KeyWithHyphens = cbHyphens.Checked;

            kg.Key = new string('\0', 2048);
            kg.KeyLen = kg.Key.Length;

            kg.RegInfo = tbUserInfo.Text;
            kg.RegInfoLen = kg.RegInfo.Length;

            kg.UseKeyExpiration = cbExpiration.Checked;
            if (kg.UseKeyExpiration)
            {
                kg.ExpirationYear = dtpExpiration.Value.Year;
                kg.ExpirationMonth = dtpExpiration.Value.Month;
                kg.ExpirationDay = dtpExpiration.Value.Day;
            }
            // Hardware ID
            kg.UseHardwareLocking = cbHardware.Checked;
            if (kg.UseHardwareLocking)
            {
                kg.HardwareID = tbHardware.Text;
            }
            // Register After
            kg.UseRegisterAfter = cbRegisterAfter.Checked;
            if (kg.UseRegisterAfter)
            {
                kg.RegisterAfterYear = dtpRegisterAfter.Value.Year;
                kg.RegisterAfterMonth = dtpRegisterAfter.Value.Month;
                kg.RegisterAfterDay = dtpRegisterAfter.Value.Day;
            }
            // Register Before
            kg.UseRegisterBefore = cbRegisterBefore.Checked;
            if (kg.UseRegisterBefore)
            {
                kg.RegisterBeforeYear = dtpRegisterBefore.Value.Year;
                kg.RegisterBeforeMonth = dtpRegisterBefore.Value.Month;
                kg.RegisterBeforeDay = dtpRegisterBefore.Value.Day;
            }
            // Executions
            kg.UseExecutionsLimit = cbExecutions.Checked;
            if (kg.UseExecutionsLimit)
            {
                kg.ExecutionsCount = (int)udExecutions.Value;
            }
            // Days
            kg.UseDaysLimit = cbDays.Checked;
            if (kg.UseDaysLimit)
            {
                kg.DaysCount = (int)udDays.Value;
            }
            // Runtime
            kg.UseRunTimeLimit = cbRuntime.Checked;
            if (kg.UseRunTimeLimit)
            {
                kg.RunTimeMinutes = (int)udRuntime.Value;
            }
            // Global Time
            kg.UseGlobalTimeLimit = cbGlobalTime.Checked;
            if (kg.UseGlobalTimeLimit)
            {
                kg.GlobalTimeMinutes = (int)udGlobalTime.Value;
            }
            // Country
            kg.UseCountyLimit = cbCountry.Checked;
            if (kg.UseCountyLimit)
            {
                Enigma_KeyGen_IDE ide = new Enigma_KeyGen_IDE();
                kg.CountryCode = ide.KEY_COUNTRIES[comCountries.SelectedIndex].Code;
            }

            kg.EncryptedSections = new bool[Enigma_KeyGen_IDE.NUMBER_OF_CRYPTED_SECTIONS];
            kg.EncryptedSections[0] = cbSection1.Checked;
            kg.EncryptedSections[1] = cbSection2.Checked;
            kg.EncryptedSections[2] = cbSection3.Checked;
            kg.EncryptedSections[3] = cbSection4.Checked;
            kg.EncryptedSections[4] = cbSection5.Checked;
            kg.EncryptedSections[5] = cbSection6.Checked;
            kg.EncryptedSections[6] = cbSection7.Checked;
            kg.EncryptedSections[7] = cbSection8.Checked;
            kg.EncryptedSections[8] = cbSection9.Checked;
            kg.EncryptedSections[9] = cbSection10.Checked;
            kg.EncryptedSections[10] = cbSection11.Checked;
            kg.EncryptedSections[11] = cbSection12.Checked;
            kg.EncryptedSections[12] = cbSection13.Checked;
            kg.EncryptedSections[13] = cbSection14.Checked;
            kg.EncryptedSections[14] = cbSection15.Checked;
            kg.EncryptedSections[15] = cbSection16.Checked;

            // Generate reg. key

            uint dwResult = Enigma_KeyGen_IDE.KG_GenerateRegistrationKeyFromProject("default.enigma", ref kg);
            if (dwResult == Enigma_KeyGen_IDE.EP_NO_ERROR)
            {
                tbKey.Text = kg.Key;
            }
            else
            {
                switch (dwResult)
                {
                    case Enigma_KeyGen_IDE.EP_ERROR_UNKNOWN:
                        tbKey.Text = "EP_ERROR_UNKNOWN";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_KEYBUFFEREMPTY:
                        tbKey.Text = "EP_ERROR_KEYBUFFEREMPTY";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_KEYBUFFERISLESS:
                        tbKey.Text = "EP_ERROR_KEYBUFFERISLESS";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_REGINFOEMPTY:
                        tbKey.Text = "EP_ERROR_REGINFOEMPTY";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_REGINFOTOOLARGE:
                        tbKey.Text = "EP_ERROR_REGINFOTOOLARGE";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_PRIVATEKEYISNOTSET:
                        tbKey.Text = "EP_ERROR_PRIVATEKEYISNOTSET";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_PUBLICKEYISNOTSET:
                        tbKey.Text = "EP_ERROR_PUBLICKEYISNOTSET";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_PRIVATEKEYISINVALID:
                        tbKey.Text = "EP_ERROR_PRIVATEKEYISINVALID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_PUBLICKEYISINVALID:
                        tbKey.Text = "EP_ERROR_PUBLICKEYISINVALID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_KEYMODEISINVALID:
                        tbKey.Text = "EP_ERROR_KEYMODEISINVALID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_KEYBASEISINVALID:
                        tbKey.Text = "EP_ERROR_KEYBASEISINVALID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_CURRENTDATEISINVALID:
                        tbKey.Text = "EP_ERROR_CURRENTDATEISINVALID";
                        break;

                    case Enigma_KeyGen_IDE.EP_ERROR_EXPIRATIONDATEISINVALID:
                        tbKey.Text = "EP_ERROR_EXPIRATIONDATEISINVALID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_KEYISINVALID:
                        tbKey.Text = "EP_ERROR_KEYISINVALID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_HARDWAREID:
                        tbKey.Text = "EP_ERROR_HARDWAREID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_HARDWAREBUFFEREMPTY:
                        tbKey.Text = "EP_ERROR_HARDWAREBUFFEREMPTY";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_HARDWAREIDINVALIDFORKEY:
                        tbKey.Text = "EP_ERROR_HARDWAREIDINVALIDFORKEY";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_PROJECTFILENOTFOUND:
                        tbKey.Text = "EP_ERROR_PROJECTFILENOTFOUND";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_INVALIDPROJECTFILE:
                        tbKey.Text = "EP_ERROR_INVALIDPROJECTFILE";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_EXECUTIONSNUMBERINVALID:
                        tbKey.Text = "EP_ERROR_EXECUTIONSNUMBERINVALID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_DAYSNUMBERINVALID:
                        tbKey.Text = "EP_ERROR_DAYSNUMBERINVALID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_COUNTRYCODEINVALID:
                        tbKey.Text = "EP_ERROR_COUNTRYCODEINVALID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_RUNTIMEINVALID:
                        tbKey.Text = "EP_ERROR_RUNTIMEINVALID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_GLOBALTIMEINVALID:
                        tbKey.Text = "EP_ERROR_GLOBALTIMEINVALID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_INSTALLBEFOREINVALID:
                        tbKey.Text = "EP_ERROR_INSTALLBEFOREINVALID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_INSTALLAFTERINVALID:
                        tbKey.Text = "EP_ERROR_INSTALLAFTERINVALID";
                        break;
                    default:
                        tbKey.Text = "Unknown error";
                        break;
                }
            }
        }

Show/Hide Visual Basic function example

Private Sub bGenFP_Click()
  Dim kg As TKeyGenParams
  Dim I As Integer
  Dim dwResult As Long

  tKey.Text = vbNullString
  If tbUserInfo.Text = vbNullString Then
    MsgBox "User info field is empty!"
    Exit Sub
  End If

  ' Hyphens
  kg.KeyWithHyphens = cbHyphens.Value

  ' Fill key buffer
  kg.Key = String$(2048, 0)
  kg.KeyLen = 2048
  ' Fill User Info buffer
  kg.RegInfo = tbUserInfo.Text
  kg.RegInfoLen = Len(tbUserInfo.Text)
  ' Key expiration info
  kg.UseKeyExpiration = cbExpiration.Value
  If kg.UseKeyExpiration Then
    kg.ExpirationDay = dtpExpiration.Day
    kg.ExpirationMonth = dtpExpiration.Month
    kg.ExpirationYear = dtpExpiration.Year
  End If
  ' Register After
  kg.UseRegisterAfter = cbRegisterAfter.Value
  If kg.UseRegisterAfter Then
    kg.RegisterAfterDay = dtpRegisterAfter.Day
    kg.RegisterAfterMonth = dtpRegisterAfter.Month
    kg.RegisterAfterYear = dtpRegisterAfter.Year
  End If
  ' Register Before
  kg.UseRegisterBefore = cbRegisterBefore.Value
  If kg.UseRegisterBefore Then
    kg.RegisterBeforeDay = dtpRegisterBefore.Day
    kg.RegisterBeforeMonth = dtpRegisterBefore.Month
    kg.RegisterBeforeYear = dtpRegisterBefore.Year
  End If
  ' Executions
  kg.UseExecutionsLimit = cbExecutions.Value
  If kg.UseExecutionsLimit Then
    kg.ExecutionsCount = tExecutions.Text
  End If
  ' Days
  kg.UseDaysLimit = cbDays.Value
  If kg.UseDaysLimit Then
    kg.DaysCount = tDays.Text
  End If
  ' Runtime
  kg.UseRunTimeLimit = cbRuntime.Value
  If kg.UseRunTimeLimit Then
    kg.RunTimeMinutes = tRuntime.Text
  End If
  ' Global Time
  kg.UseGlobalTimeLimit = cbGlobalTime.Value
  If kg.UseGlobalTimeLimit Then
    kg.GlobalTimeMinutes = tGlobalTime.Text
  End If
  ' Country
  kg.UseCountyLimit = cbCountry.Value
  If kg.UseCountyLimit Then
    kg.CountryCode = comCountries.ItemData(comCountries.ListIndex)
  End If
  ' Hardware ID
  kg.UseHardwareLocking = cbHardware.Value
  If kg.UseHardwareLocking Then
    kg.HardwareID = tHardware.Text
  End If
  ' Crypt Sections
  For I = 1 To NUMBER_OF_CRYPTED_SECTIONS
    kg.EncryptedSections(I - 1) = cbSection(I - 1).Value
  Next I

  ' Generate reg. key
  dwResult = KG_GenerateRegistrationKeyFromProject("default.enigma", kg)
  If dwResult = ERROR_OK Then
    tKey.Text = kg.Key
  Else
    Select Case dwResult
      Case EP_ERROR_UNKNOWN
        tKey.Text = "EP_ERROR_UNKNOWN"
      Case EP_ERROR_KEYBUFFEREMPTY
        tKey.Text = "EP_ERROR_KEYBUFFEREMPTY"
      Case EP_ERROR_KEYBUFFERISLESS
        tKey.Text = "EP_ERROR_KEYBUFFERISLESS"
      Case EP_ERROR_REGINFOEMPTY
        tKey.Text = "EP_ERROR_REGINFOEMPTY"
      Case EP_ERROR_REGINFOTOOLARGE
        tKey.Text = "EP_ERROR_REGINFOTOOLARGE"
      Case EP_ERROR_PRIVATEKEYISNOTSET
        tKey.Text = "EP_ERROR_PRIVATEKEYISNOTSET"
      Case EP_ERROR_PUBLICKEYISNOTSET
        tKey.Text = "EP_ERROR_PUBLICKEYISNOTSET"
      Case EP_ERROR_PRIVATEKEYISINVALID
        tKey.Text = "EP_ERROR_PRIVATEKEYISINVALID"
      Case EP_ERROR_PUBLICKEYISINVALID
        tKey.Text = "EP_ERROR_PUBLICKEYISINVALID"
      Case EP_ERROR_KEYMODEISINVALID
        tKey.Text = "EP_ERROR_KEYMODEISINVALID"
      Case EP_ERROR_KEYBASEISINVALID
        tKey.Text = "EP_ERROR_KEYBASEISINVALID"
      Case EP_ERROR_CURRENTDATEISINVALID
        tKey.Text = "EP_ERROR_CURRENTDATEISINVALID"
      Case EP_ERROR_EXPIRATIONDATEISINVALID
        tKey.Text = "EP_ERROR_EXPIRATIONDATEISINVALID"
      Case EP_ERROR_KEYISINVALID
        tKey.Text = "EP_ERROR_KEYISINVALID"
      Case EP_ERROR_HARDWAREID
        tKey.Text = "EP_ERROR_HARDWAREID"
      Case EP_ERROR_HARDWAREBUFFEREMPTY
        tKey.Text = "EP_ERROR_HARDWAREBUFFEREMPTY"
      Case EP_ERROR_HARDWAREIDINVALIDFORKEY
        tKey.Text = "EP_ERROR_HARDWAREIDINVALIDFORKEY"
      Case EP_ERROR_PROJECTFILENOTFOUND
        tKey.Text = "EP_ERROR_PROJECTFILENOTFOUND"
      Case EP_ERROR_INVALIDPROJECTFILE
        tKey.Text = "EP_ERROR_INVALIDPROJECTFILE"
      Case EP_ERROR_EXECUTIONSNUMBERINVALID
        tKey.Text = "EP_ERROR_EXECUTIONSNUMBERINVALID"
      Case EP_ERROR_DAYSNUMBERINVALID
        tKey.Text = "EP_ERROR_DAYSNUMBERINVALID"
      Case EP_ERROR_COUNTRYCODEINVALID
        tKey.Text = "EP_ERROR_COUNTRYCODEINVALID"
      Case EP_ERROR_RUNTIMEINVALID
        tKey.Text = "EP_ERROR_RUNTIMEINVALID"
      Case EP_ERROR_GLOBALTIMEINVALID
        tKey.Text = "EP_ERROR_GLOBALTIMEINVALID"
      Case EP_ERROR_INSTALLBEFOREINVALID
        tKey.Text = "EP_ERROR_INSTALLBEFOREINVALID"
      Case EP_ERROR_INSTALLAFTERINVALID
        tKey.Text = "EP_ERROR_INSTALLAFTERINVALID"
     Case Else
        tKey.Text = "Unknown error"
    End Select
  End If
End Sub

See function examples in the installation folder, Examples\Keygen subfolder.


TKeyGenParamsA type

TKeyGenParamsA structure is used by KG_GenerateRegistrationKeyA and KG_GenerateRegistrationKeyFromProjectA to generate registration keys.

Structure description

KeyMode

(input parameter) mode of registration key (RSA 512/768/1024/2048/3072/4096). It may have the following values (see Registration Features - Common Registration key safety/length value):

RM_512 = 0;
RM_768 = 1;
RM_1024 = 2;
RM_2048 = 3;
RM_3072 = 4;
RM_4096 = 5;
KeyBase

(input parameter) base of registration key (Base 2/8/16/32/64). It may have the following values (see Registration Features - Common Registration key output base value):

RB_2 = 0;
RB_8 = 1;
RB_16 = 2;
RB_32 = 3;
RB_64 = 4;
KeyWithHyphens

(input parameter) add hyphens to the key, set to 1 if true or 0 if false (see Creating Keys);
Key

(input parameter) pointer to the memory where the registration key will be placed. The registration key will be represented as ANSI, null terminated string. Please be sure that the buffer allocated for the registration key has sufficient size, we recommend allocating a buffer at least 2048 bytes long;

KeyLen | (input parameter) size of the registration key buffer;
RegInfo

(input parameter) pointer to ANSI, null terminated string, which is the registration name;
UseKeyExpiration | (input parameter) if the value is 0, then the key does not have expiration, if the value is 1, then the key is time-limited. The key will expire on the date specified in the ExpirationYear, ExpirationMonth, ExpirationDay parameters (see Creating Keys);
ExpirationYear | (input parameter) year of key expiration date;
ExpirationMonth | (input parameter) month of key expiration date;
ExpirationDay | (input parameter) day of key expiration date;
UseHardwareLocking

(input parameter) if the key is hardware-locked, set this parameter to 1, otherwise it should be 0 (see Creating Keys);
HardwareIDType | (input parameter) pointer to ANSI, null terminated hardware id string;
UseExecutionsLimit

(input parameter) to enable executions limit, set this parameter to 1, otherwise it should be 0 (see Creating Keys);
ExecutionsCount | (input parameter) number of executions to limit the registration key to;
UseDaysLimit

(input parameter) to enable days limit, set this parameter to 1, otherwise it should be 0 (see Creating Keys);
DaysCount | (input parameter) number of days to limit the registration key to;
UseRunTimeLimit

(input parameter) to enable run-time limit, set this parameter to 1, otherwise it should be 0 (see Creating Keys);
RunTimeMinutes | (input parameter) number of run-time minutes to limit the registration key to;
UseGlobalTimeLimit

(input parameter) to enable global time limit, set this parameter to 1, otherwise it should be 0 (see Creating Keys);
GlobalTimeMinutes | (input parameter) number of global time minutes to limit the registration key to;
UseCountyLimit

(input parameter) to enable country limit, set this parameter to 1, otherwise it should be 0 (see Creating Keys);
CountryCode | (input parameter) the country code to lock the registration key to (see Enigma API EP_MiscCountryCode to get the code of a particular country);
UseRegisterAfter | (input parameter) to enable Register After limit for the registration key, set this value to 1, otherwise it should be 0. The Register After date is specified in the RegisterAfterYear, RegisterAfterMonth, RegisterAfterDay parameters (see Creating Keys);
RegisterAfterYear | (input parameter) year of Register After date;
RegisterAfterMonth | (input parameter) month of Register After date;
RegisterAfterDay | (input parameter) day of Register After date;
UseRegisterBefore | (input parameter) to enable Register Before limit for the registration key, set this value to 1, otherwise it should be 0. The Register Before date is specified in the RegisterBeforeYear, RegisterBeforeMonth, RegisterBeforeDay parameters (see Creating Keys);
RegisterBeforeYear | (input parameter) year of Register Before date;
RegisterBeforeMonth | (input parameter) month of Register Before date;
RegisterBeforeDay | (input parameter) day of Register Before date;
EncryptedConstant | (input parameter) integer constant, obtain it from the project file (see Registration Features - Common Registration, Information for Custom Keys Generator box, Encryption Constant value);
EncryptedSections | (input parameter) array of 16-byte length, which points to the encrypted sections, that will be decrypted by this key (see Creating Keys);
PublicKey | (input parameter) pointer to ANSI, null terminated string, which is a unique constant, should be obtained from the project (see Registration Features - Common Registration, Information for Custom Keys Generator box, Public Key value);
PrivateKey | (input parameter) pointer to ANSI, null terminated string, which is a unique constant, should be obtained from the project (see Registration Features - Common Registration, Information for Custom Keys Generator box, Private Key value).

Definition

Show/Hide Delphi structure definition

  TKeyGenParamsA = record
    KeyMode             : dword;    // {in} key generation mode (~RSA ???)
    KeyBase             : dword;    // {in} key output base (Base ???)
    KeyWithHyphens      : boolean;  // {in} add hyphens to the key?
    Key                 : pointer;  // {in} buffer for ansi string registration key
    KeyLen              : dword;    // {in} registration key size
    RegInfo             : PAnsiChar;  // {in} registration info/name
    UseKeyExpiration    : boolean;  // {in} use key expiration?
    ExpirationYear      : dword;    // {in} key expiration year
    ExpirationMonth     : dword;    // {in} key expiration month
    ExpirationDay       : dword;    // {in} key expiration day
    UseHardwareLocking  : boolean;  // {in} is key hardware locked?
    HardwareID          : PAnsiChar;// {in} pointer to null terminated hardware string
    UseExecutionsLimit  : boolean;  // {in} limit key by executions?
    ExecutionsCount     : dword;    // {in} number of executions
    UseDaysLimit        : boolean;  // {in} limit key by days?
    DaysCount           : dword;    // {in} number of days
    UseRunTimeLimit     : boolean;  // {in} limit key by run time?
    RunTimeMinutes      : dword;    // {in} run time minutes
    UseGlobalTimeLimit  : boolean;  // {in} limit key by global time?
    GlobalTimeMinutes   : dword;    // {in} global time minutes
    UseCountyLimit      : boolean;  // {in} limit key by country?
    CountryCode         : dword;    // {in} country code
    UseRegisterAfter    : boolean;  // {in} register key after date?
    RegisterAfterYear   : dword;    // {in} register after year
    RegisterAfterMonth  : dword;    // {in} register after month
    RegisterAfterDay    : dword;    // {in} register after day
    UseRegisterBefore   : boolean;  // {in} register key before date?
    RegisterBeforeYear  : dword;    // {in} register before year
    RegisterBeforeMonth : dword;    // {in} register before month
    RegisterBeforeDay   : dword;    // {in} register before day
    EncryptedConstant   : dword;    // {in} Encryption Constant - should be extracted from project file
    EncryptedSections   : array [1..NUMBER_OF_CRYPTED_SECTIONS] of boolean; // {in} Crypted sections
    PrivateKey          : PAnsiChar;   // {in} Private Key - should be extracted from project file
    PublicKey           : PAnsiChar;   // {in} Public Key - should be extracted from project file
  end;
  PKeyGenParamsA = ^TKeyGenParamsA;

Show/Hide C++ structure definition

typedef struct _TKeyGenParamsA
{
    DWORD KeyMode;             // {in} key generation mode (~RSA ???)
    DWORD KeyBase;             // {in} key output base (Base ???)
    bool KeyWithHyphens;       // {in} add hyphens to the key?
    char* Key;                 // {in} buffer for registration key
    DWORD KeyLen;              // {in} registration key size
    char* RegInfo;             // {in} registration info/name
    bool UseKeyExpiration;     // {in} use key expiration?
    DWORD ExpirationYear;      // {in} key expiration year
    DWORD ExpirationMonth;     // {in} key expiration month
    DWORD ExpirationDay;       // {in} key expiration day
    bool UseHardwareLocking;   // {in} is key hardware locked?
    char* HardwareID;          // {in} pointer to null terminated hardware string
    bool UseExecutionsLimit;   // {in} limit key by executions?
    DWORD ExecutionsCount;     // {in} number of executions
    bool UseDaysLimit;         // {in} limit key by days?
    DWORD DaysCount;           // {in} number of days
    bool UseRunTimeLimit;      // {in} limit key by run time?
    DWORD RunTimeMinutes;      // {in} run time minutes
    bool UseGlobalTimeLimit;   // {in} limit key by global time?
    DWORD GlobalTimeMinutes;   // {in} global time minutes
    bool UseCountyLimit;       // {in} limit key by country?
    DWORD CountryCode;         // {in} country code
    bool UseRegisterAfter;     // {in} register key after date?
    DWORD RegisterAfterYear;   // {in} register after year
    DWORD RegisterAfterMonth;  // {in} register after month
    DWORD RegisterAfterDay;    // {in} register after day
    bool UseRegisterBefore;    // {in} register key before date?
    DWORD RegisterBeforeYear;  // {in} register before year
    DWORD RegisterBeforeMonth; // {in} register before month
    DWORD RegisterBeforeDay;   // {in} register before day
    DWORD EncryptedConstant;   // {in} Encryption Constant - should be extracted from project file
    bool  EncryptedSections[NUMBER_OF_CRYPTED_SECTIONS]; // {in} Crypted sections
    char* PrivateKey;          // {in} Private Key - should be extracted from project file
    char* PublicKey;           // {in} Public Key - should be extracted from project file
} TKeyGenParamsA, *PKeyGenParamsA;

Show/Hide C# (.NET) structure definition

    public struct TKeyGenParamsA
    {
        public Int32 KeyMode;            // {in} key generation mode (~RSA ???)
        public Int32 KeyBase;            // {in} key output base (Base ???)
        public bool KeyWithHyphens;      // {in} add hyphens to the key?
        public string Key;               // {in} buffer for registration key
        public Int32 KeyLen;             // {in} registration key buffer size
        public string RegInfo;           // {in} registration info/name
        public bool UseKeyExpiration;    // {in} use key expiration?
        public Int32 ExpirationYear;     // {in} key expiration year
        public Int32 ExpirationMonth;    // {in} key expiration month
        public Int32 ExpirationDay;      // {in} key expiration day
        public bool UseHardwareLocking;  // {in} is key hardware locked?
        public string HardwareID;        // {in} pointer to null terminated hardware string
        public bool UseExecutionsLimit;  // {in} limit key by executions?
        public Int32 ExecutionsCount;    // {in} number of executions
        public bool UseDaysLimit;        // {in} limit key by days?
        public Int32 DaysCount;          // {in} number of days
        public bool UseRunTimeLimit;     // {in} limit key by run time?
        public Int32 RunTimeMinutes;     // {in} run time minutes
        public bool UseGlobalTimeLimit;  // {in} limit key by global time?
        public Int32 GlobalTimeMinutes;  // {in} global time minutes
        public bool UseCountyLimit;      // {in} limit key by country?
        public Int32 CountryCode;        // {in} country code
        public bool UseRegisterAfter;    // {in} register key after date?
        public Int32 RegisterAfterYear;  // {in} register after year
        public Int32 RegisterAfterMonth; // {in} register after month
        public Int32 RegisterAfterDay;   // {in} register after day
        public bool UseRegisterBefore;   // {in} register key before date?
        public Int32 RegisterBeforeYear; // {in} register before year
        public Int32 RegisterBeforeMonth;// {in} register before month
        public Int32 RegisterBeforeDay;  // {in} register before day
        public Int32 EncryptedConstant;  // {in} Encryption Constant - should be extracted from project file
        [MarshalAs(UnmanagedType.ByValArray, SizeConst = NUMBER_OF_CRYPTED_SECTIONS)]
        public byte[] EncryptedSections; // {in} Crypted sections
        public string PrivateKey;        // {in} Private Key - should be extracted from project file
        public string PublicKey;         // {in} Public Key - should be extracted from project file
    }


Function KG_GenerateRegistrationKeyA

The KG_GenerateRegistrationKeyA function is a almost the same as the KG_GenerateRegistrationKey function and is used for ANSI-based registration key generation. Note: to enable the application to accept ANSI registration keys, the UNICODE Registration Scheme parameter from the Registration Features - Common panel should be disabled. The function has one parameter - PKeyGenParamsA, which is a pointer to the TGenKeyParamsA structure. This function requires the following necessary input parameters: PublicKey, PrivateKey, KeyMode, KeyBase and EncryptedConstant (other parameters are optional) that should be obtained from the project (see the Registration Features - Common panel, Information for Custom Generator box).

Return Values

EP_NO_ERROR=0 | the function succeeds. In this case, Key parameter of TKeyGenParams structure should contain a pointer to the null terminated string - registration key.
EP_ERROR_UNKNOWN=1 | unknown error
EP_ERROR_KEYBUFFEREMPTY=2 | memory buffer for registration key is not allocated
EP_ERROR_KEYBUFFERISLESS=3 | size of allocated memory for registration key is less than required
EP_ERROR_REGINFOEMPTY=4 | registration information is not specified
EP_ERROR_REGINFOTOOLARGE=5 | registration information is empty (has a null size)
EP_ERROR_PRIVATEKEYISNOTSET=6 | private key is not set
EP_ERROR_PUBLICKEYISNOTSET=7 | public key is not set
EP_ERROR_PRIVATEKEYISINVALID=8 | private key is invalid
EP_ERROR_PUBLICKEYISINVALID=9 | public key is invalid
EP_ERROR_KEYMODEISINVALID=10 | key mode is invalid
EP_ERROR_KEYBASEISINVALID=11 | key base is invalid
EP_ERROR_CURRENTDATEISINVALID=12 | current date is invalid
EP_ERROR_EXPIRATIONDATEISINVALID=13 | expiration date is invalid
EP_ERROR_KEYISINVALID=14 | key is invalid
EP_ERROR_HARDWAREID=15 | hardware id is invalid
EP_ERROR_HARDWAREBUFFEREMPTY=16 | hardware id buffer is empty
EP_ERROR_HARDWAREIDINVALIDFORKEY=17 | hardware id is invalid for the key
EP_ERROR_PROJECTFILENOTFOUND=18 | project file is not found
EP_ERROR_INVALIDPROJECTFILE=19 | project file is invalid
EP_ERROR_EXECUTIONSNUMBERINVALID=20 | executions number is invalid
EP_ERROR_DAYSNUMBERINVALID=21 | days number is invalid
EP_ERROR_COUNTRYCODEINVALID=22 | country code is invalid
EP_ERROR_RUNTIMEINVALID=23 | run-time value is invalid
EP_ERROR_GLOBALTIMEINVALID=24 | global time is invalid
EP_ERROR_INSTALLBEFOREINVALID=25 | register before date is invalid
EP_ERROR_INSTALLAFTERINVALID=26 | register after date is invalid

Definition

Show/Hide Delphi function definition

function KG_GenerateRegistrationKeyA(kg : PKeyGenParamsA) : dword; external keygen_api_dll_name name 'KG_GenerateRegistrationKeyA';

Show/Hide C++ function definition

 extern  "C" __declspec( dllimport ) __stdcall int KG_GenerateRegistrationKeyA(PKeyGenParamsA kg);

Show/Hide C# (.NET) function definition

public class Enigma_KeyGen_IDE
{
    [DllImport("keygen.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
    public static extern uint KG_GenerateRegistrationKeyA(ref TKeyGenParamsA kg);
}

See function examples in the installation folder, Examples\Keygen subfolder.


Function KG_GenerateRegistrationKeyFromProjectA

KG_GenerateRegistrationKeyFromProjectA returns the same result as the KG_GenerateRegistrationKeyFromProject function and is used for generating ANSI-based registration keys. The main difference of this function is that it reads secure information (PublicKey, PrivateKey, KeyMode, KeyBase and EncryptedConstant) from the project file and you do not have to set up these parameters in the input structure TGenKeyParamA. KG_GenerateRegistrationKeyFromProjectA has two parameters, one of them is ProjectFile, which is a pointer to ANSI - null terminated string - the path to the Enigma Protector project file, and another parameter is a pointer to the TGenKeyParamA structure.

Warning: ProjectFile has to contain the absolute path to the project file.

Return Values

EP_NO_ERROR=0 | the function succeeds. In this case, Key parameter of TKeyGenParams structure should contain a pointer to the null terminated string - registration key.
EP_ERROR_UNKNOWN=1 | unknown error
EP_ERROR_KEYBUFFEREMPTY=2 | memory buffer for registration key is not allocated
EP_ERROR_KEYBUFFERISLESS=3 | size of allocated memory for registration key is less than required
EP_ERROR_REGINFOEMPTY=4 | registration information is not specified
EP_ERROR_REGINFOTOOLARGE=5 | registration information is empty (has a null size)
EP_ERROR_PRIVATEKEYISNOTSET=6 | private key is not set
EP_ERROR_PUBLICKEYISNOTSET=7 | public key is not set
EP_ERROR_PRIVATEKEYISINVALID=8 | private key is invalid
EP_ERROR_PUBLICKEYISINVALID=9 | public key is invalid
EP_ERROR_KEYMODEISINVALID=10 | key mode is invalid
EP_ERROR_KEYBASEISINVALID=11 | key base is invalid
EP_ERROR_CURRENTDATEISINVALID=12 | current date is invalid
EP_ERROR_EXPIRATIONDATEISINVALID=13 | expiration date is invalid
EP_ERROR_KEYISINVALID=14 | key is invalid
EP_ERROR_HARDWAREID=15 | hardware id is invalid
EP_ERROR_HARDWAREBUFFEREMPTY=16 | hardware id buffer is empty
EP_ERROR_HARDWAREIDINVALIDFORKEY=17 | hardware id is invalid for the key
EP_ERROR_PROJECTFILENOTFOUND=18 | project file is not found
EP_ERROR_INVALIDPROJECTFILE=19 | project file is invalid
EP_ERROR_EXECUTIONSNUMBERINVALID=20 | executions number is invalid
EP_ERROR_DAYSNUMBERINVALID=21 | days number is invalid
EP_ERROR_COUNTRYCODEINVALID=22 | country code is invalid
EP_ERROR_RUNTIMEINVALID=23 | run-time value is invalid
EP_ERROR_GLOBALTIMEINVALID=24 | global time is invalid
EP_ERROR_INSTALLBEFOREINVALID=25 | register before date is invalid
EP_ERROR_INSTALLAFTERINVALID=26 | register after date is invalid

Definition

Show/Hide Delphi function definition

function KG_GenerateRegistrationKeyFromProjectA(ProjectFile : PAnsiChar; kg : PKeyGenParamsA) : dword; external keygen_api_dll_name name 'KG_GenerateRegistrationKeyFromProjectA';

Show/Hide C++ function definition

 extern  "C" __declspec( dllimport ) __stdcall int KG_GenerateRegistrationKeyFromProjectA(char* pfile, PKeyGenParamsA kg);

Show/Hide C# (.NET) function definition

public class Enigma_KeyGen_IDE
{
    [DllImport("keygen.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
    public static extern uint KG_GenerateRegistrationKeyFromProjectA(string FileName, ref TKeyGenParamsA kg);
}

See function examples in the installation folder, Examples\Keygen subfolder.


TKeyGenParamsW type

TKeyGenParamsW structure is used by KG_GenerateRegistrationKeyW and KG_GenerateRegistrationKeyFromProjectW to generate registration keys.

Structure description

KeyMode

(input parameter) mode of registration key (RSA 512/768/1024/2048/3072/4096). It may have the following values (see Registration Features - Common Registration key safety/length value):

RM_512 = 0;
RM_768 = 1;
RM_1024 = 2;
RM_2048 = 3;
RM_3072 = 4;
RM_4096 = 5;
KeyBase

(input parameter) base of registration key (Base 2/8/16/32/64). It may have the following values (see Registration Features - Common Registration key output base value):

RB_2 = 0;
RB_8 = 1;
RB_16 = 2;
RB_32 = 3;
RB_64 = 4;
KeyWithHyphens

(input parameter) add hyphens to the key, set to 1 if true or 0 if false (see Creating Keys);
Key

(input parameter) pointer to the memory where the registration key will be placed. The registration key will be represented as unicode, null terminated string. Please be sure that the buffer allocated for the registration key has sufficien size, we recommend allocating a buffer at least 4096 bytes long;

KeyLen | (input parameter) size of registration key buffer;
RegInfo

(input parameter) pointer to unicode, null terminated string, which is the registration name;
UseKeyExpiration | (input parameter) if the value is 0, then the key does not have expiration, if the value is 1, then the key is time-limited. The key will expire on the date specified in the ExpirationYear, ExpirationMonth, ExpirationDay parameters (see Creating Keys);
ExpirationYear | (input parameter) year of key expiration date;
ExpirationMonth | (input parameter) month of key expiration date;
ExpirationDay | (input parameter) day of key expiration date;
UseHardwareLocking

(input parameter) if the key is hardware-locked, set this parameter to 1, otherwise it should be 0 (see Creating Keys);
HardwareIDType | (input parameter) pointer to ANSI, null terminated hardware id string;
UseExecutionsLimit

(input parameter) to enable executions limit, set this parameter to 1, otherwise it should be 0 (see Creating Keys);
ExecutionsCount | (input parameter) number of executions to limit the registration key to;
UseDaysLimit

(input parameter) to enable days limit, set this parameter to 1, otherwise it should be 0 (see Creating Keys);
DaysCount | (input parameter) number of days to limit the registration key to;
UseRunTimeLimit

(input parameter) to enable run-time limit, set this parameter to 1, otherwise it should be 0 (see Creating Keys);
RunTimeMinutes | (input parameter) number of run-time minutes to limit the registration key to;
UseGlobalTimeLimit

(input parameter) to enable global time limit, set this parameter to 1, otherwise it should be 0 (see Creating Keys);
GlobalTimeMinutes | (input parameter) number of global time minutes to limit the registration key to;
UseCountyLimit

(input parameter) to enable country limit, set this parameter to 1, otherwise it should be 0 (see Creating Keys);
CountryCode | (input parameter) the country code to limit the registration key to (see Enigma API EP_MiscCountryCode to get the code of a particular country);
UseRegisterAfter | (input parameter) to enable Register After limit for registration key, set this value to 1, otherwise it should be 0. The Register After date is specified in the RegisterAfterYear, RegisterAfterMonth, RegisterAfterDay parameters (see Creating Keys);
RegisterAfterYear | (input parameter) year of Register After date;
RegisterAfterMonth | (input parameter) month of Register After date;
RegisterAfterDay | (input parameter) day of Register After date;
UseRegisterBefore | (input parameter) to enable Register Before limit for registration key, set this value to 1, otherwise it should be 0. The Register Before date is specified in the RegisterBeforeYear, RegisterBeforeMonth, RegisterBeforeDay parameters (see Creating Keys);
RegisterBeforeYear | (input parameter) year of Register Before date;
RegisterBeforeMonth | (input parameter) month of Register Before date;
RegisterBeforeDay | (input parameter) day of Register Before date;
EncryptedConstant | (input parameter) integer constant, obtain it from the project file (see Registration Features - Common Registration, Information for Custom Keys Generator box, Encryption Constant value);
EncryptedSections | (input parameter) array of 16-byte length, which points to the encrypted sections, that will be decrypted by this key (see Creating Keys);
PublicKey | (input parameter) pointer to unicode, null terminated string, which is a unique constant, should be obtained from the project (see Registration Features - Common Registration, Information for Custom Keys Generator box, Public Key value);
PrivateKey | (input parameter) pointer to unicode, null terminated string, which is a unique constant, should be obtained from the project (see Registration Features - Common Registration, Information for Custom Keys Generator box, Private Key value).

Definition

Show/Hide Delphi structure definition

  TKeyGenParamsW = record
    KeyMode             : dword;    // {in} key generation mode (~RSA ???)
    KeyBase             : dword;    // {in} key output base (Base ???)
    KeyWithHyphens      : boolean;  // {in} add hyphens to the key?
    Key                 : pointer;  // {in} buffer for unicode string registration key
    KeyLen              : dword;    // {in} registration key size
    RegInfo             : PWideChar;  // {in} registration info/name
    UseKeyExpiration    : boolean;  // {in} use key expiration?
    ExpirationYear      : dword;    // {in} key expiration year
    ExpirationMonth     : dword;    // {in} key expiration month
    ExpirationDay       : dword;    // {in} key expiration day
    UseHardwareLocking  : boolean;  // {in} is key hardware locked?
    HardwareID          : PWideChar;// {in} pointer to null terminated hardware string
    UseExecutionsLimit  : boolean;  // {in} limit key by executions?
    ExecutionsCount     : dword;    // {in} number of executions
    UseDaysLimit        : boolean;  // {in} limit key by days?
    DaysCount           : dword;    // {in} number of days
    UseRunTimeLimit     : boolean;  // {in} limit key by run time?
    RunTimeMinutes      : dword;    // {in} run time minutes
    UseGlobalTimeLimit  : boolean;  // {in} limit key by global time?
    GlobalTimeMinutes   : dword;    // {in} global time minutes
    UseCountyLimit      : boolean;  // {in} limit key by country?
    CountryCode         : dword;    // {in} country code
    UseRegisterAfter    : boolean;  // {in} register key after date?
    RegisterAfterYear   : dword;    // {in} register after year
    RegisterAfterMonth  : dword;    // {in} register after month
    RegisterAfterDay    : dword;    // {in} register after day
    UseRegisterBefore   : boolean;  // {in} register key before date?
    RegisterBeforeYear  : dword;    // {in} register before year
    RegisterBeforeMonth : dword;    // {in} register before month
    RegisterBeforeDay   : dword;    // {in} register before day
    EncryptedConstant   : dword;    // {in} Encryption Constant - should be extracted from project file
    EncryptedSections   : array [1..NUMBER_OF_CRYPTED_SECTIONS] of boolean; // {in} Crypted sections
    PrivateKey          : PWideChar;   // {in} Private Key - should be extracted from project file
    PublicKey           : PWideChar;   // {in} Public Key - should be extracted from project file
  end;
  PKeyGenParamsW = ^TKeyGenParamsW;

Show/Hide C++ structure definition

typedef struct _TKeyGenParamsW
{
    DWORD KeyMode;             // {in} key generation mode (~RSA ???)
    DWORD KeyBase;             // {in} key output base (Base ???)
    bool KeyWithHyphens;       // {in} add hyphens to the key?
    wchar_t* Key;                 // {in} buffer for registration key
    DWORD KeyLen;              // {in} registration key size
    wchar_t* RegInfo;             // {in} registration info/name
    bool UseKeyExpiration;     // {in} use key expiration?
    DWORD ExpirationYear;      // {in} key expiration year
    DWORD ExpirationMonth;     // {in} key expiration month
    DWORD ExpirationDay;       // {in} key expiration day
    bool UseHardwareLocking;   // {in} is key hardware locked?
    wchar_t* HardwareID;          // {in} pointer to null terminated hardware string
    bool UseExecutionsLimit;   // {in} limit key by executions?
    DWORD ExecutionsCount;     // {in} number of executions
    bool UseDaysLimit;         // {in} limit key by days?
    DWORD DaysCount;           // {in} number of days
    bool UseRunTimeLimit;      // {in} limit key by run time?
    DWORD RunTimeMinutes;      // {in} run time minutes
    bool UseGlobalTimeLimit;   // {in} limit key by global time?
    DWORD GlobalTimeMinutes;   // {in} global time minutes
    bool UseCountyLimit;       // {in} limit key by country?
    DWORD CountryCode;         // {in} country code
    bool UseRegisterAfter;     // {in} register key after date?
    DWORD RegisterAfterYear;   // {in} register after year
    DWORD RegisterAfterMonth;  // {in} register after month
    DWORD RegisterAfterDay;    // {in} register after day
    bool UseRegisterBefore;    // {in} register key before date?
    DWORD RegisterBeforeYear;  // {in} register before year
    DWORD RegisterBeforeMonth; // {in} register before month
    DWORD RegisterBeforeDay;   // {in} register before day
    DWORD EncryptedConstant;   // {in} Encryption Constant - should be extracted from project file
    bool  EncryptedSections[NUMBER_OF_CRYPTED_SECTIONS]; // {in} Crypted sections
    wchar_t* PrivateKey;          // {in} Private Key - should be extracted from project file
    wchar_t* PublicKey;           // {in} Public Key - should be extracted from project file
} TKeyGenParamsW, *PKeyGenParamsW;

Show/Hide C# (.NET) structure definition

    public struct TKeyGenParamsW
    {
        public Int32 KeyMode;            // {in} key generation mode (~RSA ???)
        public Int32 KeyBase;            // {in} key output base (Base ???)
        public bool KeyWithHyphens;      // {in} add hyphens to the key?
        [MarshalAs(UnmanagedType.LPWStr)]
        public string Key;               // {in} buffer for registration key
        public Int32 KeyLen;             // {in} registration key buffer size
        [MarshalAs(UnmanagedType.LPWStr)]
        public string RegInfo;           // {in} registration info/name
        public bool UseKeyExpiration;    // {in} use key expiration?
        public Int32 ExpirationYear;     // {in} key expiration year
        public Int32 ExpirationMonth;    // {in} key expiration month
        public Int32 ExpirationDay;      // {in} key expiration day
        public bool UseHardwareLocking;  // {in} is key hardware locked?
        [MarshalAs(UnmanagedType.LPWStr)]
        public string HardwareID;        // {in} pointer to null terminated hardware string
        public bool UseExecutionsLimit;  // {in} limit key by executions?
        public Int32 ExecutionsCount;    // {in} number of executions
        public bool UseDaysLimit;        // {in} limit key by days?
        public Int32 DaysCount;          // {in} number of days
        public bool UseRunTimeLimit;     // {in} limit key by run time?
        public Int32 RunTimeMinutes;     // {in} run time minutes
        public bool UseGlobalTimeLimit;  // {in} limit key by global time?
        public Int32 GlobalTimeMinutes;  // {in} global time minutes
        public bool UseCountyLimit;      // {in} limit key by country?
        public Int32 CountryCode;        // {in} country code
        public bool UseRegisterAfter;    // {in} register key after date?
        public Int32 RegisterAfterYear;  // {in} register after year
        public Int32 RegisterAfterMonth; // {in} register after month
        public Int32 RegisterAfterDay;   // {in} register after day
        public bool UseRegisterBefore;   // {in} register key before date?
        public Int32 RegisterBeforeYear; // {in} register before year
        public Int32 RegisterBeforeMonth;// {in} register before month
        public Int32 RegisterBeforeDay;  // {in} register before day
        public Int32 EncryptedConstant;  // {in} Encryption Constant - should be extracted from project file
        [MarshalAs(UnmanagedType.ByValArray, SizeConst = NUMBER_OF_CRYPTED_SECTIONS)]
        public byte[] EncryptedSections; // {in} Crypted sections
        [MarshalAs(UnmanagedType.LPWStr)]
        public string PrivateKey;        // {in} Private Key - should be extracted from project file
        [MarshalAs(UnmanagedType.LPWStr)]
        public string PublicKey;         // {in} Public Key - should be extracted from project file
    }


Function KG_GenerateRegistrationKeyW

KG_GenerateRegistrationKeyW, as well as the KG_GenerateRegistrationKey function, is used for generating registration keys, but it uses unicode-based information. Note: to enable the application to accept unicode registration keys, the UNICODE Registration Scheme parameter from the Registration Features - Common panel should be enabled. The function has one parameter - PKeyGenParamsA, which is a pointer to the TGenKeyParamsW structure. This function requires the following necessary input parameters: PublicKey, PrivateKey, KeyMode, KeyBase and EncryptedConstant (other parameters are optional), that should be obtained from the project (see the Registration Features - Common panel, Information for Custom Generator box).

Return Values

EP_NO_ERROR=0 | the function succeeds. In this case, Key parameter of TKeyGenParams structure should contain a pointer to the null terminated string - registration key.
EP_ERROR_UNKNOWN=1 | unknown error
EP_ERROR_KEYBUFFEREMPTY=2 | memory buffer for registration key is not allocated
EP_ERROR_KEYBUFFERISLESS=3 | size of allocated memory for registration key is less than required
EP_ERROR_REGINFOEMPTY=4 | registration information is not specified
EP_ERROR_REGINFOTOOLARGE=5 | registration information is empty (has a null size)
EP_ERROR_PRIVATEKEYISNOTSET=6 | private key is not set
EP_ERROR_PUBLICKEYISNOTSET=7 | public key is not set
EP_ERROR_PRIVATEKEYISINVALID=8 | private key is invalid
EP_ERROR_PUBLICKEYISINVALID=9 | public key is invalid
EP_ERROR_KEYMODEISINVALID=10 | key mode is invalid
EP_ERROR_KEYBASEISINVALID=11 | key base is invalid
EP_ERROR_CURRENTDATEISINVALID=12 | current date is invalid
EP_ERROR_EXPIRATIONDATEISINVALID=13 | expiration date is invalid
EP_ERROR_KEYISINVALID=14 | key is invalid
EP_ERROR_HARDWAREID=15 | hardware id is invalid
EP_ERROR_HARDWAREBUFFEREMPTY=16 | hardware id buffer is empty
EP_ERROR_HARDWAREIDINVALIDFORKEY=17 | hardware id is invalid for the key
EP_ERROR_PROJECTFILENOTFOUND=18 | project file is not found
EP_ERROR_INVALIDPROJECTFILE=19 | project file is invalid
EP_ERROR_EXECUTIONSNUMBERINVALID=20 | executions number is invalid
EP_ERROR_DAYSNUMBERINVALID=21 | days number is invalid
EP_ERROR_COUNTRYCODEINVALID=22 | country code is invalid
EP_ERROR_RUNTIMEINVALID=23 | run-time value is invalid
EP_ERROR_GLOBALTIMEINVALID=24 | global time is invalid
EP_ERROR_INSTALLBEFOREINVALID=25 | register before date is invalid
EP_ERROR_INSTALLAFTERINVALID=26 | register after date is invalid

Definition

Show/Hide Delphi function definition

function KG_GenerateRegistrationKeyW(kg : PKeyGenParamsW) : dword; external keygen_api_dll_name name 'KG_GenerateRegistrationKeyW';

Show/Hide C++ function definition

 extern  "C" __declspec( dllimport ) __stdcall int KG_GenerateRegistrationKeyW(PKeyGenParamsW kg);

Show/Hide C# (.NET) function definition

public class Enigma_KeyGen_IDE
{
    [DllImport("keygen.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.StdCall)]
    public static extern uint KG_GenerateRegistrationKeyW(ref TKeyGenParamsW kg);
}

Examples

Show/Hide Delphi function example

procedure TfrmMain.bGenClick(Sender: TObject);
var
  kg : TKeyGenParamsW;
  KeyBuffer : array [0..2047] of widechar;
  dwResult : dword;
begin
  mKey.Clear;

  if eUserInfo.Text = '' then
  begin
    ShowMessage('User info field is empty!');
    Exit;
  end;

  ZeroMemory(@kg, SizeOf(kg));
  // Key mode
  kg.KeyMode := cbKeyMode.ItemIndex;
  // Key base
  kg.KeyBase := cbKeyBase.ItemIndex;
  // Hyphens
  kg.KeyWithHyphens := cbHyphens.Checked;
  case kg.KeyMode of
    RM_512:
    begin
      kg.PublicKey  := '0201B810DA4A1ADD4351378790A98138533067CP4S86R7D8THS45GBCVUM635EPRQRMYRP3DAA5DUPZ6ABDSFP7F5AC' +
                       'P7ERGH4A7Y6B6NW6NMMBZF83WVER9Y4MMBNLBQDKR7KFVLGLV067CFDQC' +
                       'WCHGQVVRN24DECEPBL96YJQJTVDCRTNQG3E4WW4GK4GQ5X5L5H88D3XYH' +
                       'CBRBNASPD3P5CNYFKFHBCSDHHD6WPTCC4XVSM5S88067C2JSTCMVT48C8' +
                       'HC7SHKGTFJBM28P6XTBCNWHMV6J6KN6W5Q9TQLVR285U6GVCAAUTZLRTP' +
                       'SRGDQ742B4742XF4MACRR747YDP5FZZ9D';
      kg.PrivateKey := '00C98B2SF9UBJA605AJX53GJFXJV8UH4A6PY2L6CV4MAMV7V3ERRVY99Y' +
                       '72V2P77Z2J3KBPGWR3WXKG5GF9Z6CKXJHY5VUMBTQ66H2MRZPCU00DLFJ' +
                       '675JTTTNEK00DLFJ675JTTTNEK';
    end;
    RM_768:
    begin
      kg.PublicKey  := '0201B810DA4A1ADD4351378790A9813853309AEHRR66KMK99UEPX8C54WQFDZQ5Y96WUCVZYMXBC32SJV7T5SBPR54E' +
                       '2DBH8UD9RNHTJ9BLJV6NHX52W7PZDDTTJDDGF3YFVL7PJFL8RS8THTFDF' +
                       '4RY7K3QXLTMXMC8DDSRVRWBVMMP3UYKCDDC7KGL9PG509ACPTRQ4MMUKG' +
                       'DAUJFFFGSCBFLYK9X9E74M58PW5FG9B9RTLXJQ4STPVCHJTEH8BP557VZ' +
                       'PQYDBUZJXXJNGVZELFL4UL3LHHE8A645CK593DVWCQBSX4ZCCQ3ST8GCZ' +
                       'LW2729XK3NT7GST3LMQGXSHLDWCXE09AENVX2QTX3VLT6FWB4JND875XZ' +
                       'WQ26GW76TV3KVVHK7U489LLPBQ39HUWKMA65U3HKWBDHKBZEB525PHEH2' +
                       'YQHRZGNJAAYZXMWN8RNZ9T7VMZAJMP2V3S9NXZ9RHL96F7AT3NTMN36V4' +
                       'ACSFEN4DR6TJR95';
      kg.PrivateKey := '019VRB95TKY456YC48LBS9FK34YN080VVPDJPPKU6XA9EPLX7HTVN3VST' +
                       'TNJZFPH4HQAFY58R593KFKSNZ7WEZBA9AZ6PGN735EWEFUAEM3G8XVUFN' +
                       'L2ZFRPXA4V8KVXE4M8GACUJAT7H3TTWZT9ZDE43ZF46HC01AHFR85MVR2' +
                       'UP7K3N53M8MTNWBUP01AHFR85MVR2UP7K3N53M8MTNWBUP';
    end;
    RM_1024:
    begin
      kg.PublicKey  := '0201B810DA4A1ADD4351378790A981385330CDG9YQSEUK2HT546KWW46NHSCHMD2TNCSPVNSKGQC6CHDUSU9CC4LDPL' +
                       'TD3NLRVD3TFV9BU2SYBUBU9TXKLQ3CTKZE5GN9VFG37R9YNK2FE58K7ZY' +
                       'WTUJYFSJTBMDLLGA9GJ2LJXGHSS9CESGC2K69H65YQGAC7CRGF5T3CPLA' +
                       '5BDJZKVCUWPZRNA2DN7L956LZVZBQUDPX6PF30CDBH26Z82VE4QQ8N85L' +
                       'QHYJYYCJ6WQ89H9K9VVQX925SG5FJ79AGVZB6M8TTFKCJ56FAREP8GSTC' +
                       'NKWCXEALDP9Y2ZLS9QKZV8JRNDHG9D8BRDSCTMDQK9NLAPZ9TGYFS9G7U' +
                       'LXHYJF7F9A89HPXGTU2N4FQQJL98WZ5QND2KTEMMUUZFAX953HCGNSWUW' +
                       'U2M7LBEWZSH9GW5SC0CDJDY2HC4HJYUSVTAVXZ7MYVJWF3CU9WC3SVPSL' +
                       '29WF46DVS2SYKSSAMATPPYGJDE3PBFMGS34CXWQSXKCEAE63L2EXTS9NE' +
                       '2G597XASY3S34XMYST5YZF4THUTYT5DY9UKKXU6PH8MLXRPZMPMMR83JU' +
                       'X2WGNEW8ZGL4SKUCUB8CEAB6UZ4FB66WTP3B64VMX7XG75T4Y35479';
      kg.PrivateKey := '020MLJ7XTRVLBDNUVMKGUFHCU8XBGMHHVRA0ADSHPBC7NVSZ82AM867XC' +
                       'BELNKMR7CZ56C4SW8KKRD9WZLE5X992GZVSZXS5J6JG9SLDW3Y696TU4D' +
                       'QZP778LVFKVRKANQD6FUGN2ACWUJM9ZK6ME7WXWDZ88LTWHME52RKUDKX' +
                       'STT7RGWP7HFUJDGWEUG4ZHQ25DCQJ644CLEXRR3G020SAAREJB4WXZ4H2' +
                       'JEH4AB4U8FGFTA4CAF020SAAREJB4WXZ4H2JEH4AB4U8FGFTA4CAF';
    end;
    RM_2048:
    begin
      kg.PublicKey  := '0201B810DA4A1ADD4351378790A98138533199H9KZC4CQ5ZKPEGYDW2EHN5AKZA5G5KP4HU8USWJR8XWW7MCH7244RV' +
                       'PSXFHVU6YQRK4LPUHM497XJYPLLA3DHUZWXK3CB5SUYF75NPYLTNPRUAP' +
                       'CTVDHAKYWTRQ97HES2E59WDN2LJKFYA2K8BGFSBHP4A6BF5FSDTS8NWLL' +
                       'C5NEQ76NJ9BAMWXG55UPFFMRQZTU5KV2G6LSPQUJJWA9U4LJ5SCJ9M9ZQ' +
                       'Z6K7LZA9UAMJ533UQ5J3JPNQAUWJGZFRFCTGAGSBWPWRRF9HRGF9MCX55' +
                       'QRYGPYMRE6DBJ65SJDX34FVPYWWKWQ48MCKXYXPHQ23BJ42U8ZMDD8CG5' +
                       'DPHZQ5XTXUKA277XK6PKSTLJ88ZZ9EBXH62REMRZZRGNPKHYM34RW722S' +
                       'SZHMPFKY7X8UZ19ADGX3UQ7X444XH7MZXEZYW2YLFHR8YL3PTCXVSYX89' +
                       'ZXN7KW2XNBE8XS3TQRGZVF6KA5USH56NEZYH5RNWBBPVE9LD6H42RQWR5' +
                       'YVQMT5EQYQTK6YM9V8DA5BJCLGGZ2UGD6NPA2X3SNUS47F7HJBNBCWHRA' +
                       'YPPCQ5HWCJNPDHUDQMRN2P6PWJFWJ6CLVNK8HXEFLE4ENPXAFN89CRS43' +
                       'RUMVGDJQCSRB535XYCS6BZYLA9Q6HJV425F26XXHRGA7C8R8BVMELAPEH' +
                       '5DSA9KXTCV4H2RNVDFHG3YJSERZVFPWHYA823LUBENBL5U3J4LJX2KQLW' +
                       'L5XGGESPSE2FQWKSQ4NUCDLBEJPQAT2A2477DYS2XEXKLYEAKUN22622C' +
                       'RLBCAHPFNEV2FJ2H8N3JQGXJRGP19AFHGRW6SS2ZSFYK8EZAPVYL4MCP4' +
                       '6UMR64Y9T89FHWEPXBRHKWJCSNNNGPU984J5XW4BWTU6PDWPN24W8RU55' +
                       'A9C3U9H7VHS5PFURASHBT4JAEE5ZKJBSYMCMDVBLU973R72RVPA6U96A2' +
                       'LX8HMASVST9RVJ7W66V4DYWRDZZQ3673W7C7LVF68TWPLNMYEUQ8FDZRN' +
                       'P38D9BX5YA3VENETDUUUMR9U7FFP4NZM7G4Y6J6EASK5SAXXTRMZ8F3AH' +
                       '5FC54E543N739BY5KVZQM7JZWD2P2HPE7BDRMM9JFCGPBWWASTZ7UDNRV' +
                       '6AFHVMBR9AGAERE9M6W6S2ZT8PBTABPDCKBPPPV6QW9DRXZUGAHDDRRSY' +
                       'XM4YXQ2QJX6CL33N7RV8846LK8A3DFLDXWZ2NKF8V';
      kg.PrivateKey := '02DB825DUDFYHA88AG49NMM742HCQEJDKQQGDR6G3GL7MCED16DU9KTVE' +
                       '47XQ3M92FFKX8FU9ZXT7AK7VTGGJSYQERCZBR8J2DE2CFE3VUU4W7JEQJ' +
                       'L49HDUXBW7SNPCV8MHXM7EQHYPQK3GSPQYV5VWESQE4AYWFZHXN2UX7Z3' +
                       'T3CV52XURB3YFKLUCY6CJTRACRVVDD568F6F28U74ABWCZ2ZMC32E83V3' +
                       '4JZZPDBF3KEYQWREETGKQT6NANCMAD4XDEXW5LCYBJ3GMDJBM3E7FNK98' +
                       '7JEUYEV7QNKGKNTDVMRG3G5L8NC9CNHQS8AVDMDBEGCG3DHGJUGPG2244' +
                       '2C9LCD8FJ2LSDMQXLHCGCLP7ZSYQT2UJ4QFGU2CH3BTT3UADZMQSBAV33' +
                       'B3Z2Y8Y8RRD9J754G02DJ372LR8APP7HXKB2GNPHP6T65C3RR48Q8BHGP' +
                       'KEZ6PX2D02DJ372LR8APP7HXKB2GNPHP6T65C3RR48Q8BHGPKEZ6PX2D';
    end;
    RM_3072:
    begin
      kg.PublicKey  := '0201B810DA4A1ADD4351378790A98138533267BJBN6W8SY33Y47RWJHWS385XWRV9TSVSB5EM7ECZYNSJ44ZKSD8KV4' +
                       '6Y9T6TNC6QMDW4V6DBMADU3YUKLP88TCLEUD9FTEUHGXM6T57AQ2EMB59' +
                       'UPQVNSUT7Z4EHAMDQ6N77VK2A6P847MMWJH9E7C5XX6FNF6MHGWERPWQV' +
                       '9ZLVR9Z7X5D5Z2XQL6MBM7BDCT2DEDVRBFNDDBLG6LHZ9APM48LS5TKTJ' +
                       'AGDYFDRVHEGTDH47PCLL8YJ4ZAWCB59F8BN5PZL3NQACP32G3YNBX5E3J' +
                       '7S28XLRGAX55ZML5XE6Q68EUAL38VUBJ2MZ2UGCCHM7CE6S99N44X9RMV' +
                       '7B55HULJ4KHPFYSBDUSPQTCWGS76BEQST2QCZDZ2T4FBA4YUJFF47AACE' +
                       'A4EEFESEYWN48UZCSDZAMGSU5VB9UJKR2XQUSDFS3TNG9QKURQWS7N5Q3' +
                       'VPYT4QAGGQ5GW2MMXHDJYW55FQPHSS255GVJ7WLLP85JHS8K6DVTJWB4W' +
                       '4Y8ZEFF7KP6W74PAA8FVPZVDW4RKGMQ8V56Q6R4V34XFE5HR4FZS8GZ6R' +
                       '36RKW6WN34S2AHR9LCGF8LULB7ZN6NC2AA5RPDZYGWSPPME6267CGLZCP' +
                       'GG98W557RXCDWAETJHDCRPUXX7AD3E8SL9WMGBV9QFHMSV9UFV7H9NTX3' +
                       'QYV95CN9P9DSYQWL35R2BWB4GKW6CTWVB2X6WH3P2WFBE6X55KBLAMDB3' +
                       'SRDSDVY37GKH78MUHY7KDJDC8SJU5FUQRYZ49ULX3YSZL7E284GFVZSGD' +
                       'FTTQNR6VMBM3LLR78SUSVMJW88XT2K4UHEATRU3V9MMR2VGNGCY9S6R7M' +
                       '4ELNPEBBMQP2HVPLY5M5VPA92V7NU8ZZ58YYTW5QK9USZ5LV59UZGB2CF' +
                       'DPZ6HFYU5WB7UU3UYWVNSNKM3W7GBYKJP8TMFW2YN6GNSSE4ZKFVZRLUT' +
                       '8QPZBBEQT5H9H5Z53D7QV4AJTKTX4EMW62TDWXQVK24JZPSG2VXKCMYZL' +
                       'BUASE25R3EEK9KBLJ8VX83ZXGTBL5CCDBY33HJ6FKX8AW3WPRX3XTCS9G' +
                       '2B9SVK2XFFKNSPGFG6FZNS8P2HERFGFL79DKUZZFWHFH4H9UZ7F7F6W3Z' +
                       'WN84JRRA7SU8T89EQMRBEPVYMMGLGSUMFWWMEDLJM5EGP5WEX9LDUAQXS' +
                       '55LKDQVRKX4R8NNBHSYBHSNMFYA2C6KGQQFK3TN267DPSZT3PTKHTLNMU' +
                       'V2YYZZRX3953LPWAKYF8LJUVMEQT3ZC4F9SWMYGUHG6XX66PJFQWSRUW2' +
                       'C79YLGZ6ZAFS7HLXBTH55UD3EGFBZQ5CLNJDZTEJACDVBCM5FQBTX4DKK' +
                       'UDGNSMWWLC5UMQRHW89CTU5636WYDXVZZDAUZ529458LDN2DAR9QADWRZ' +
                       'UTU8MCKN8ACH3R36YKE52DDF67SM5UDUH7PTATHXE65UCGFRCV49UTF29' +
                       'BGDSUWGRMC839HUZYQVAG985YUF5KJCAVGKRD8E4YMPJ38KR6HD2KHDGY' +
                       'PJDMJMN4Y3DTJW5MYX3VUPF32637LMAWFM4QCU7BMP74SCF4N5QXZZVBE' +
                       'LAQMPYMJC2ZWJ9XFV33YXTTPH3SG9KMUABLL83P7L3UBVM763XJPR5UEH' +
                       'DZ73XJUGR9QP6299K5PU46XGVWKWFAKWYMRXUSLCFJ3WQTEC6QJH6E5V8' +
                       'X2RMA5TXGSBEWLGSMNQ2SH6G9MLKK4S486DN4M4QVDTYTM4JQETAJQGP7' +
                       '6NUR4UNDXR4W4JQSNWDTUGX69SEDC3AL8ZF4TJBQQRXSX2A86UUWCDCFH' +
                       'JE94A8EP3Q6A2QTYKEE62MV4VJB2AB';
      kg.PrivateKey := '04DMQBFL5GKK4RXWEZYPEY8QB5GHBBGW3EY766DFF2Q6PLFLR4SSRWXBN' +
                       'W5CFGFC84UJ8PKRDQQYWN9921AH8AGZAQRWJYZ7C3QUJJCJAAGGT5P5GG' +
                       'LY6K5W4JZJDW7Y8EWS6SSYCS2MCR93MY9DG6VXLBRYVZWDX6XNFU286HM' +
                       'AM9E82KJVZNYGC8RXRW43SFFWDLR8C96R58A42F3TGLXPVWLGMNPPAWS4' +
                       'S2SSMNQLUPBAQMP7AUKAGV5CKL342W6UKQY3TUPXKGFXFES725PEX93UX' +
                       'X4K8JRY3MPQ5S94VNPBXQ5N6LDBLWB67LBLDCGNQS3JEKW667UF8LA8Q6' +
                       'B3AF4XGZKYB7BVVHF49DJUHSFJZRD63S4GMMAPQ8Q87HKN9G3J3575JEL' +
                       '5C29NZLWQW6MSYWJ7S3NKLKPWGU75ZJXKEL6Z9V97HAMDYHM6ARCH58EP' +
                       'WRPZUXN8RRWGCDFM6BH6XUTRTFE3VMAAZAUUKHKL6AFC2PCPXFRDWLVYP' +
                       'ZKUGY8QDEZNECK9K5Y5MET9SRWQ36JF77XJ6NUKSMZ6DKUPEH4W43YQAE' +
                       'CV7XVFWJ7ZTRVFQJZFU5BS8AL77YLCXDCR5VPFFZ9NP7EBBQ2AA04DP3S' +
                       '86B3YD8AFXQ3KPPNTPHBTQSM8PUHJHG87RUM4EV63GKPBRGSN3VX63FCS' +
                       '646DLWSH86B542U3F04DP3S86B3YD8AFXQ3KPPNTPHBTQSM8PUHJHG87R' +
                       'UM4EV63GKPBRGSN3VX63FCS646DLWSH86B542U3F';
    end;
    RM_4096:
    begin
      kg.PublicKey  := '0201B810DA4A1ADD4351378790A98138533334BN75EUD4LFWYFVNFGBRCEMKKXG62QRBXL8GMHQ975B68FJVEMNXQQ7' +
                       'RKR7RCZMWDVP86QPB3LR49G9BM7EUUZXNCRZBXRF4PEY3RX6UXT4X286K' +
                       'WMR7AMEE6QNP9AEHGWJT9AVU3F62F37B5GVX2BQF73QWHRFQSQ6XMRP6M' +
                       'ZDRQ8JT89UF3YRK5UL34MM3L8HLDTWAJF5YY7MRWJUFDQRK9JNCJ6C9KJ' +
                       'WRE5ACQSNS24NEAHDYKS3AK75HBCTKP9NR2CSL7Q9PPXM4TF7L37USP77' +
                       'Z7WER6JY67F7YGKTP6MFRMKK9H8XFPZ9XWKK97XCFXK7AW4TB96WGEH4B' +
                       'YPF9QRF2DGC3LCHW8VTD2EMHVRDR6EEBUG8R4XYKJPLBPRCJP445DU2BW' +
                       'JWELKAY45GKDU5HLTTDTWRH2JFKJ7AVAKLPEELN29YHX5JR773P9ERW7N' +
                       'UFMWDKD4UL4YPU5QW2L4A7ZN3E8ZDQVEZUR6ZRDQXRLQRLUNHVB4XGBWD' +
                       'HM79NGJARHDBQJCD8NWZCWPBY26QARP7A5S48DCV29F7MUTHU3YAHYVS7' +
                       'ZPGXJZZA5HBBY4K5BQPUG6MVCBG8H3C7VL8KH9EH58NUVCE6F2CGMSM94' +
                       '4CQDKNVGWWWRNK4DG26UT88Y9ULUPJ25G9KLTQPK3TBXZEK43X8KPMJT8' +
                       'DF6MTQ5RB94XR2BT9H9NYYTXL29GF8KZY9QNHAW4LTT2RDQTD2ELWPSV4' +
                       '4AND9K8G5VKLQ287UBEVHA82CMSMGQQBMNQZVAZ9G8T5TD6G9F7XQHMJT' +
                       'HCL6PFEDUW5MN9JASF2EKPT2H33325A3SFGGM5C3RYKZSYSSQC5FLHNX9' +
                       'VHN4HQVWD66YECY4R97JZHQALRTCHXUWH85LSJCCTQZT8JF52FHG6FV9J' +
                       'UJWEU24K9Z7SKYTYA9NH7GW29FSNKUK3DMFXY48VEYZVDRTTMLFYSJH8B' +
                       'RQXV72REYGSM6SLX89EVQ52CN9N8YDLWHAWCDDNM89YN2FCRTLE8688XN' +
                       'F4MZMFE6GP9JK2JTFJVUKBLES2ZVWSBCJE9N3D7DG9LL9Z3U42QFJJPE2' +
                       'HE5XCRY25UND96R9D7655ZBSCPF796FJZ4GPLY7AMZLGLR77GRP467ELK' +
                       'PXSZ9ZF8MUYFDHV4EFACPZ79CDFTYW56NE9JDWDVUMNLY9EXDSF8ZNABE' +
                       'MDQU6T9RVLTNRMZJJ8EJSUM9TV8YA6MNWF2Y66MD3VQ9L662F5X6VE9ZC' +
                       'PPRTNMEV2DG9BUMFMSL7PUR9H5QG6VVBDBMEU3PLABL57HMSQ5C83E9X8' +
                       'RTPY4QSEH2H7R2QDJHT5LQSFNQJL2NZ24GLNTFXG468WC5UUTDD68G8HM' +
                       '477Z8P4F9ZZHUGZ6VPFF32A2MPWY8LPXNECCKM9EEVLDDPUJ8LXN2AE6K' +
                       'Y2Q42FVBCJM9GQTXNRHBED735KCFD4YGV4U5U3LJD6NJ886W6XQLWH3G7' +
                       '3VZ6T5YDUQP6DA5ZHLKQSGATDJHUWC2ELTE7QJFXH8H9EAQYZPPMW76JG' +
                       'Z48UBND9VXFXZMSGBNWQPNQG7E4TCBDMVKUSA9TTVSNLN3DXEZNXH787R' +
                       'N7XHFBJNZ5W74DUMNBYVHEQDYMZBQCFMS8LGSDUAU6QE9DD5Q334BX62T' +
                       'JP5WQQDS2ZEWW76XW7VMLX3L7V9UVD7RL297VDBVRFPQ5MYA3YFVBVNVA' +
                       'R5TJXMQ4X2U2PW6UWSKBXT58HG3QPZM2RVEX2PDMCVJDFTJMXR9NPLW4C' +
                       '6AE4Q9A8TTAQ68BSN9WWTFFTSX68ECVARFPDBBH5DMP4KYFARTFVCSWNF' +
                       'FGAPBYYGFJA4MGHEDWTNE54MPGER7EPCZEV2ESJRMM6XDMFGABG97HECN' +
                       '3SZFUBRKCNDZ2TE9F6EERULRCDAV5EMY6KVY9NY9MYNPP2FQ5WFWLMRYD' +
                       '4TNYYHE6EDMQ6KK79HH5Q5KBW6DDQYYNUR365W2454CHEZWZAPU82SX4H' +
                       'KHNZXBRVWAT7G9CJBKHNBPSVEL67X8UJHBFHZH8ZD4NSEVFZM4Y768TJ6' +
                       'QP3BGEKLTY4UZUWHG63QMKVWAQW9E7WRFNJCH4XRD97JHNKMFUTRFVH68' +
                       'G5CKSMGC725AZ9CBSL2JX43P4EY44CMF56AJ6BEXVCJP2ZDWCT9G55K4D' +
                       'F24J7TTJMFXTQH95CBNX67CBPNWEKHCWQV6VD73Y9KCZHNBFUFS8TCYNN' +
                       'WXRGFKNVRDFUKWHDWDDTSPEW8YCKLPMX2GUV3N4JFJMUE6TSJR6Z53C9F' +
                       'SKZAY3EN7G66JPBF5E9S6Y7RQHPWZHSRDQ7XH87PHUJFLJFGD7WNE3Q9P' +
                       'EXMW33LVJBFEUXKNUB6SU7ZYCEX96XT8G27FLUV7XPV4JK64DWDJCX9WV' +
                       '4VL8CK23FQJ28UG9JUZTQJ3DRL32BTJVRD4LVQ6MK9LCE7ZZP925JK7ZD' +
                       '92SCV4DDJJ5EXMVBF';
      kg.PrivateKey := '067DN6F8YFBTWF5QH8MHJB39Z7VNN2P56HS8RPBURAWB8KPL8FQWX4HSP' +
                       'RTY4HWFMFXAVX2YUY99G2U2KKK56CBE4BCPZWS3KJ98XRW4PY2CDQ3ALF' +
                       'Y3HGJG42NRY9ZVGZZB59TE29KGC825BYBX3FRFMYBVN2VTHM8YM2KULXM' +
                       'H24XSHNVK4HEQ9L5264844DMBFUUXSBA9PT9LEXT6449TMAMF7RL6KU6C' +
                       'GP6FU9DNMJCNTUREF2U9WUMJBMXMMHWKWDG4VU5JQNFFNNWCP2YE2DGFD' +
                       'N3H27NTNR58GBNTTZBRK66BKWNVMF8H59KALB6K93Y8UWDUWV5HJZGV8X' +
                       '3AS5EG982DYV4W9CQ3GRRFRR8NABQC98FTAG465SXQ3JPN7X7VULQZX4X' +
                       'UK68URBFPGCW2UPBYH6CRG6C7YBRAURM2KMGN5L8XH4AUQN8WM4P454WN' +
                       'NWRE5SQEC78FK3LHHQU5VLXLYYN8F2NXGG7CCQ92EEC63ZE6S7CC7RTML' +
                       'UMM3PAXPL5CJZFL26JNNYPVLAHM75NDL8AS8JR48PFXK49D4A6TY2ZU9Y' +
                       'XX2Y2TLA3J8T56EPY236FEDGZEHTQR73NE2Y7LKL7423FFKGGPWYL8PB5' +
                       'VWD54PG328ACE6V8VLSGVP9VJMMWS2VDVU459C8K5XK869Z5KM4JWHAVE' +
                       'G56ZESC6HHJ423N6SAH2DW2UQZDQHSMKWUCHPUKZZPJXCQXF55Q3BJW6Z' +
                       'QYK4HM4Q8XWU8NT844E8YM96EGHSYEUKAJ3QDXANN2DELSGARH7LR2XH9' +
                       'UQBQNXGPZGB6JTEQP8HAQK5ZZYJE067DWX6C2JJ7L2HE4NGVXZV5XH9RD' +
                       'P9SNG4WZTC9KEMGXDX7JTQX8RPJJRT4YTA83L8GXDNDDHB7C79CN8UWGL' +
                       'U5EMNMBREQN5MYTYHGYK067DWX6C2JJ7L2HE4NGVXZV5XH9RDP9SNG4WZ' +
                       'TC9KEMGXDX7JTQX8RPJJRT4YTA83L8GXDNDDHB7C79CN8UWGLU5EMNMBR' +
                       'EQN5MYTYHGYK';
    end;
  end;

  // Fill key buffer
  ZeroMemory(@KeyBuffer, SizeOf(KeyBuffer));
  kg.Key := @KeyBuffer;
  kg.KeyLen := SizeOf(KeyBuffer);
  // Fill User Info
  kg.RegInfo := PWideChar(eUserInfo.Text);
  // Key expiration info
  kg.UseKeyExpiration := cbExpirationDate.Checked;
  kg.ExpirationYear := YearOf(DateTimePicker1.DateTime);
  kg.ExpirationMonth := MonthOf(DateTimePicker1.DateTime);
  kg.ExpirationDay := DayOf(DateTimePicker1.DateTime);
  // Register After date
  kg.UseRegisterAfter := cbRegisterAfter.Checked;
  if kg.UseRegisterAfter then
  begin
    kg.RegisterAfterYear := YearOf(dtpRegisterAfter.DateTime);
    kg.RegisterAfterMonth := MonthOf(dtpRegisterAfter.DateTime);
    kg.RegisterAfterDay := DayOf(dtpRegisterAfter.DateTime);
  end;
  // Register Before date
  kg.UseRegisterBefore := cbRegisterBefore.Checked;
  if kg.UseRegisterBefore then
  begin
    kg.RegisterBeforeYear := YearOf(dtpRegisterBefore.DateTime);
    kg.RegisterBeforeMonth := MonthOf(dtpRegisterBefore.DateTime);
    kg.RegisterBeforeDay := DayOf(dtpRegisterBefore.DateTime);
  end;
  // Country
  kg.UseCountyLimit := cbCountry.Checked;
  if kg.UseCountyLimit then
  begin
    kg.CountryCode := KEY_COUNTRIES[comCountries.ItemIndex].Code;
  end;
  // Executions
  kg.UseExecutionsLimit := cbExecutions.Checked;
  if kg.UseExecutionsLimit then
  begin
    kg.ExecutionsCount := StrToInt(eExecutions.Text);
  end;
  // Days
  kg.UseDaysLimit := cbDays.Checked;
  if kg.UseDaysLimit then
  begin
    kg.DaysCount := StrToInt(eDays.Text);
  end;
  // Runtime
  kg.UseRunTimeLimit := cbRuntime.Checked;
  if kg.UseRunTimeLimit then
  begin
    kg.RunTimeMinutes := StrToInt(eRuntime.Text);
  end;
  // Global time
  kg.UseGlobalTimeLimit := cbGlobalTime.Checked;
  if kg.UseGlobalTimeLimit then
  begin
    kg.GlobalTimeMinutes := StrToInt(eGlobalTime.Text);
  end;
  // Hardware ID
  kg.UseHardwareLocking := cbHardwareID.Checked;
  kg.HardwareID := PWideChar(eHardware.Text);
  // Crypt Sections
  kg.EncryptedSections[1] := cbSection1.Checked;
  kg.EncryptedSections[2] := cbSection2.Checked;
  kg.EncryptedSections[3] := cbSection3.Checked;
  kg.EncryptedSections[4] := cbSection4.Checked;
  kg.EncryptedSections[5] := cbSection5.Checked;
  kg.EncryptedSections[6] := cbSection6.Checked;
  kg.EncryptedSections[7] := cbSection7.Checked;
  kg.EncryptedSections[8] := cbSection8.Checked;
  kg.EncryptedSections[9] := cbSection9.Checked;
  kg.EncryptedSections[10] := cbSection10.Checked;
  kg.EncryptedSections[11] := cbSection11.Checked;
  kg.EncryptedSections[12] := cbSection12.Checked;
  kg.EncryptedSections[13] := cbSection13.Checked;
  kg.EncryptedSections[14] := cbSection14.Checked;
  kg.EncryptedSections[15] := cbSection15.Checked;
  kg.EncryptedSections[16] := cbSection16.Checked;

  // Secure constant (get it from project file)!
  kg.EncryptedConstant := 2113444489;

  // Generate reg. key
  dwResult := KG_GenerateRegistrationKeyW(@kg);
  if dwResult = EP_NO_ERROR then
  begin
    mKey.Text := String(PWideChar(kg.Key));
  end else
  begin
    case dwResult of
      EP_ERROR_UNKNOWN                 : mKey.Text := 'EP_ERROR_UNKNOWN                ';
      EP_ERROR_KEYBUFFEREMPTY          : mKey.Text := 'EP_ERROR_KEYBUFFEREMPTY         ';
      EP_ERROR_KEYBUFFERISLESS         : mKey.Text := 'EP_ERROR_KEYBUFFERISLESS        ';
      EP_ERROR_REGINFOEMPTY            : mKey.Text := 'EP_ERROR_REGINFOEMPTY           ';
      EP_ERROR_REGINFOTOOLARGE         : mKey.Text := 'EP_ERROR_REGINFOTOOLARGE        ';
      EP_ERROR_PRIVATEKEYISNOTSET      : mKey.Text := 'EP_ERROR_PRIVATEKEYISNOTSET     ';
      EP_ERROR_PUBLICKEYISNOTSET       : mKey.Text := 'EP_ERROR_PUBLICKEYISNOTSET      ';
      EP_ERROR_PRIVATEKEYISINVALID     : mKey.Text := 'EP_ERROR_PRIVATEKEYISINVALID    ';
      EP_ERROR_PUBLICKEYISINVALID      : mKey.Text := 'EP_ERROR_PUBLICKEYISINVALID     ';
      EP_ERROR_KEYMODEISINVALID        : mKey.Text := 'EP_ERROR_KEYMODEISINVALID       ';
      EP_ERROR_KEYBASEISINVALID        : mKey.Text := 'EP_ERROR_KEYBASEISINVALID       ';
      EP_ERROR_CURRENTDATEISINVALID    : mKey.Text := 'EP_ERROR_CURRENTDATEISINVALID   ';
      EP_ERROR_EXPIRATIONDATEISINVALID : mKey.Text := 'EP_ERROR_EXPIRATIONDATEISINVALID';
      EP_ERROR_KEYISINVALID            : mKey.Text := 'EP_ERROR_KEYISINVALID           ';
      EP_ERROR_HARDWAREID              : mKey.Text := 'EP_ERROR_HARDWAREID             ';
      EP_ERROR_HARDWAREBUFFEREMPTY     : mKey.Text := 'EP_ERROR_HARDWAREBUFFEREMPTY    ';
      EP_ERROR_HARDWAREIDINVALIDFORKEY : mKey.Text := 'EP_ERROR_HARDWAREIDINVALIDFORKEY';
      EP_ERROR_PROJECTFILENOTFOUND     : mKey.Text := 'EP_ERROR_PROJECTFILENOTFOUND    ';
      EP_ERROR_INVALIDPROJECTFILE      : mKey.Text := 'EP_ERROR_INVALIDPROJECTFILE     ';
      EP_ERROR_EXECUTIONSNUMBERINVALID : mKey.Text := 'EP_ERROR_EXECUTIONSNUMBERINVALID';
      EP_ERROR_DAYSNUMBERINVALID       : mKey.Text := 'EP_ERROR_DAYSNUMBERINVALID      ';
      EP_ERROR_COUNTRYCODEINVALID      : mKey.Text := 'EP_ERROR_COUNTRYCODEINVALID     ';
      EP_ERROR_RUNTIMEINVALID          : mKey.Text := 'EP_ERROR_RUNTIMEINVALID         ';
      EP_ERROR_GLOBALTIMEINVALID       : mKey.Text := 'EP_ERROR_GLOBALTIMEINVALID      ';
      EP_ERROR_INSTALLBEFOREINVALID    : mKey.Text := 'EP_ERROR_INSTALLBEFOREINVALID   ';
      EP_ERROR_INSTALLAFTERINVALID     : mKey.Text := 'EP_ERROR_INSTALLAFTERINVALID    ';
      else mKey.Text := 'Unknown error';
    end;
  end;
end;

Show/Hide Visual C++ function example

void CKeygenDlg::OnBnClickedButtongen()
{
    // TODO: Add your control notification handler code here
  TKeyGenParamsW kp;
  wchar_t keybuffer[2048];
  wchar_t tmp[255];
  wchar_t username[255];
  wchar_t hardwareid[255];
  SYSTEMTIME lpDate;
  DWORD dwResult;

  // Clear params buffer
  memset(&kp, 0, sizeof(kp));
  // Clear key buffer
  memset(&keybuffer, 0, sizeof(keybuffer));

  kp.Key = (wchar_t*) keybuffer;
  kp.KeyLen = sizeof(keybuffer);

  // Fill User Info
  memset(&username, 0, sizeof(username));
  GetDlgItemTextW(IDC_EDITNAME, (wchar_t*)&username, sizeof(username));
  kp.RegInfo = (wchar_t*)&username;

  // Key expiration info
  if (IsDlgButtonChecked(IDC_CHECKEXPIRATION) != 0)
  {
      kp.UseKeyExpiration = true;
      SendDlgItemMessage(IDC_DTPEXPIRATION, DTM_GETSYSTEMTIME, GDT_VALID, (LPARAM)&lpDate);
      kp.ExpirationYear = lpDate.wYear;
      kp.ExpirationMonth = lpDate.wMonth;
      kp.ExpirationDay = lpDate.wDay;
  }

  // Register After
  if (IsDlgButtonChecked(IDC_CHECKREGAFTER) != 0)
  {
      kp.UseRegisterAfter = true;
      SendDlgItemMessage(IDC_DTPREGAFTER, DTM_GETSYSTEMTIME, GDT_VALID, (LPARAM)&lpDate);
      kp.RegisterAfterYear = lpDate.wYear;
      kp.RegisterAfterMonth = lpDate.wMonth;
      kp.RegisterAfterDay = lpDate.wDay;
  }

  // Register Before
  if (IsDlgButtonChecked(IDC_CHECKREGBEFORE) != 0)
  {
      kp.UseRegisterBefore = true;
      SendDlgItemMessage(IDC_DTPREGBEFORE, DTM_GETSYSTEMTIME, GDT_VALID, (LPARAM)&lpDate);
      kp.RegisterBeforeYear = lpDate.wYear;
      kp.RegisterBeforeMonth = lpDate.wMonth;
      kp.RegisterBeforeDay = lpDate.wDay;
  }

  // Executions
  if (IsDlgButtonChecked(IDC_CHECKEXECS) != 0)
  {
      kp.UseExecutionsLimit = true;
      memset(&tmp, 0, sizeof(tmp));
      GetDlgItemTextW(IDC_EDITEXECS, (wchar_t*)&tmp, sizeof(tmp));
      kp.ExecutionsCount = atoi((char*)&tmp);
  }

  // Days
  if (IsDlgButtonChecked(IDC_CHECKDAYS) != 0)
  {
      kp.UseDaysLimit = true;
      memset(&tmp, 0, sizeof(tmp));
      GetDlgItemTextW(IDC_EDITDAYS, (wchar_t*)&tmp, sizeof(tmp));
      kp.DaysCount = _wtoi((wchar_t*)&tmp);
  }

  // Run-time
  if (IsDlgButtonChecked(IDC_CHECKRTIME) != 0)
  {
      kp.UseRunTimeLimit = true;
      memset(&tmp, 0, sizeof(tmp));
      GetDlgItemText(IDC_EDITRTIME, (wchar_t*)&tmp, sizeof(tmp));
      kp.RunTimeMinutes = _wtoi((wchar_t*)&tmp);
  }

  // Global time
  if (IsDlgButtonChecked(IDC_CHECKGTIME) != 0)
  {
      kp.UseGlobalTimeLimit = true;
      memset(&tmp, 0, sizeof(tmp));
      GetDlgItemTextW(IDC_EDITGTIME, (wchar_t*)&tmp, sizeof(tmp));
      kp.GlobalTimeMinutes = _wtoi((wchar_t*)&tmp);
  }

  // Country Lock
  if (IsDlgButtonChecked(IDC_CHECKCOUNTRY) != 0)
  {
      kp.UseCountyLimit = true;
      kp.CountryCode = KEY_COUNTRIES[com_counties.GetCurSel()].Code;
  }

  // Hardware ID
  if (IsDlgButtonChecked(IDC_CHECKHD) != 0)
  {
      kp.UseHardwareLocking = true;
      memset(&hardwareid, 0, sizeof(hardwareid));
      GetDlgItemTextW(IDC_EDITHD, (wchar_t*)&hardwareid, sizeof(hardwareid));
      kp.HardwareID = (wchar_t*)&hardwareid;
  }

  // Crypt Sections
  if (IsDlgButtonChecked(IDC_CHECKS1) != 0) { kp.EncryptedSections[0] = true; }
  if (IsDlgButtonChecked(IDC_CHECKS2) != 0) { kp.EncryptedSections[1] = true; }
  if (IsDlgButtonChecked(IDC_CHECKS3) != 0) { kp.EncryptedSections[2] = true; }
  if (IsDlgButtonChecked(IDC_CHECKS4) != 0) { kp.EncryptedSections[3] = true; }
  if (IsDlgButtonChecked(IDC_CHECKS5) != 0) { kp.EncryptedSections[4] = true; }
  if (IsDlgButtonChecked(IDC_CHECKS6) != 0) { kp.EncryptedSections[5] = true; }
  if (IsDlgButtonChecked(IDC_CHECKS7) != 0) { kp.EncryptedSections[6] = true; }
  if (IsDlgButtonChecked(IDC_CHECKS8) != 0) { kp.EncryptedSections[7] = true; }
  if (IsDlgButtonChecked(IDC_CHECKS9) != 0) { kp.EncryptedSections[8] = true; }
  if (IsDlgButtonChecked(IDC_CHECKS10) != 0) { kp.EncryptedSections[9] = true; }
  if (IsDlgButtonChecked(IDC_CHECKS11) != 0) { kp.EncryptedSections[10] = true; }
  if (IsDlgButtonChecked(IDC_CHECKS12) != 0) { kp.EncryptedSections[11] = true; }
  if (IsDlgButtonChecked(IDC_CHECKS13) != 0) { kp.EncryptedSections[12] = true; }
  if (IsDlgButtonChecked(IDC_CHECKS14) != 0) { kp.EncryptedSections[13] = true; }
  if (IsDlgButtonChecked(IDC_CHECKS15) != 0) { kp.EncryptedSections[14] = true; }
  if (IsDlgButtonChecked(IDC_CHECKS16) != 0) { kp.EncryptedSections[15] = true; }

  kp.KeyMode = com_key_mode.GetCurSel();
  kp.KeyBase = com_key_base.GetCurSel();

  kp.KeyWithHyphens = IsDlgButtonChecked(IDC_CHECKHYPHENS) != 0;

  kp.EncryptedConstant = 2113444489;

  switch (kp.KeyMode)
  {
    case RM_512:
    {
        wchar_t pl[] = L"0201B810DA4A1ADD4351378790A98138533067CP4S86R7D8THS45GBCVUM635EPRQRMYRP3DAA5DUPZ6ABDSFP7F5AC" \
            L"P7ERGH4A7Y6B6NW6NMMBZF83WVER9Y4MMBNLBQDKR7KFVLGLV067CFDQC" \
            L"WCHGQVVRN24DECEPBL96YJQJTVDCRTNQG3E4WW4GK4GQ5X5L5H88D3XYH" \
            L"CBRBNASPD3P5CNYFKFHBCSDHHD6WPTCC4XVSM5S88067C2JSTCMVT48C8" \
            L"HC7SHKGTFJBM28P6XTBCNWHMV6J6KN6W5Q9TQLVR285U6GVCAAUTZLRTP" \
            L"SRGDQ742B4742XF4MACRR747YDP5FZZ9D";
        wchar_t pr[] = L"00C98B2SF9UBJA605AJX53GJFXJV8UH4A6PY2L6CV4MAMV7V3ERRVY99Y" \
            L"72V2P77Z2J3KBPGWR3WXKG5GF9Z6CKXJHY5VUMBTQ66H2MRZPCU00DLFJ" \
            L"675JTTTNEK00DLFJ675JTTTNEK";
        kp.PublicKey = pl;
        kp.PrivateKey = pr;
      break;
    }
    case RM_768:
    {
        wchar_t pl[] = L"0201B810DA4A1ADD4351378790A9813853309AEHRR66KMK99UEPX8C54WQFDZQ5Y96WUCVZYMXBC32SJV7T5SBPR54E" \
            L"2DBH8UD9RNHTJ9BLJV6NHX52W7PZDDTTJDDGF3YFVL7PJFL8RS8THTFDF" \
            L"4RY7K3QXLTMXMC8DDSRVRWBVMMP3UYKCDDC7KGL9PG509ACPTRQ4MMUKG" \
            L"DAUJFFFGSCBFLYK9X9E74M58PW5FG9B9RTLXJQ4STPVCHJTEH8BP557VZ" \
            L"PQYDBUZJXXJNGVZELFL4UL3LHHE8A645CK593DVWCQBSX4ZCCQ3ST8GCZ" \
            L"LW2729XK3NT7GST3LMQGXSHLDWCXE09AENVX2QTX3VLT6FWB4JND875XZ" \
            L"WQ26GW76TV3KVVHK7U489LLPBQ39HUWKMA65U3HKWBDHKBZEB525PHEH2" \
            L"YQHRZGNJAAYZXMWN8RNZ9T7VMZAJMP2V3S9NXZ9RHL96F7AT3NTMN36V4" \
            L"ACSFEN4DR6TJR95";
        wchar_t pr[] = L"019VRB95TKY456YC48LBS9FK34YN080VVPDJPPKU6XA9EPLX7HTVN3VST" \
            L"TNJZFPH4HQAFY58R593KFKSNZ7WEZBA9AZ6PGN735EWEFUAEM3G8XVUFN" \
            L"L2ZFRPXA4V8KVXE4M8GACUJAT7H3TTWZT9ZDE43ZF46HC01AHFR85MVR2" \
            L"UP7K3N53M8MTNWBUP01AHFR85MVR2UP7K3N53M8MTNWBUP";
        kp.PublicKey = pl;
        kp.PrivateKey = pr;
      break;
    }
    case RM_1024:
    {
        wchar_t pl[] = L"0201B810DA4A1ADD4351378790A981385330CDG9YQSEUK2HT546KWW46NHSCHMD2TNCSPVNSKGQC6CHDUSU9CC4LDPL" \
            L"TD3NLRVD3TFV9BU2SYBUBU9TXKLQ3CTKZE5GN9VFG37R9YNK2FE58K7ZY" \
            L"WTUJYFSJTBMDLLGA9GJ2LJXGHSS9CESGC2K69H65YQGAC7CRGF5T3CPLA" \
            L"5BDJZKVCUWPZRNA2DN7L956LZVZBQUDPX6PF30CDBH26Z82VE4QQ8N85L" \
            L"QHYJYYCJ6WQ89H9K9VVQX925SG5FJ79AGVZB6M8TTFKCJ56FAREP8GSTC" \
            L"NKWCXEALDP9Y2ZLS9QKZV8JRNDHG9D8BRDSCTMDQK9NLAPZ9TGYFS9G7U" \
            L"LXHYJF7F9A89HPXGTU2N4FQQJL98WZ5QND2KTEMMUUZFAX953HCGNSWUW" \
            L"U2M7LBEWZSH9GW5SC0CDJDY2HC4HJYUSVTAVXZ7MYVJWF3CU9WC3SVPSL" \
            L"29WF46DVS2SYKSSAMATPPYGJDE3PBFMGS34CXWQSXKCEAE63L2EXTS9NE" \
            L"2G597XASY3S34XMYST5YZF4THUTYT5DY9UKKXU6PH8MLXRPZMPMMR83JU" \
            L"X2WGNEW8ZGL4SKUCUB8CEAB6UZ4FB66WTP3B64VMX7XG75T4Y35479";
        wchar_t pr[] = L"020MLJ7XTRVLBDNUVMKGUFHCU8XBGMHHVRA0ADSHPBC7NVSZ82AM867XC" \
            L"BELNKMR7CZ56C4SW8KKRD9WZLE5X992GZVSZXS5J6JG9SLDW3Y696TU4D" \
            L"QZP778LVFKVRKANQD6FUGN2ACWUJM9ZK6ME7WXWDZ88LTWHME52RKUDKX" \
            L"STT7RGWP7HFUJDGWEUG4ZHQ25DCQJ644CLEXRR3G020SAAREJB4WXZ4H2" \
            L"JEH4AB4U8FGFTA4CAF020SAAREJB4WXZ4H2JEH4AB4U8FGFTA4CAF";
        kp.PublicKey = pl;
        kp.PrivateKey = pr;
      break;
    }
    case RM_2048:
    {
        wchar_t pl[] = L"0201B810DA4A1ADD4351378790A98138533199H9KZC4CQ5ZKPEGYDW2EHN5AKZA5G5KP4HU8USWJR8XWW7MCH7244RV" \
            L"PSXFHVU6YQRK4LPUHM497XJYPLLA3DHUZWXK3CB5SUYF75NPYLTNPRUAP" \
            L"CTVDHAKYWTRQ97HES2E59WDN2LJKFYA2K8BGFSBHP4A6BF5FSDTS8NWLL" \
            L"C5NEQ76NJ9BAMWXG55UPFFMRQZTU5KV2G6LSPQUJJWA9U4LJ5SCJ9M9ZQ" \
            L"Z6K7LZA9UAMJ533UQ5J3JPNQAUWJGZFRFCTGAGSBWPWRRF9HRGF9MCX55" \
            L"QRYGPYMRE6DBJ65SJDX34FVPYWWKWQ48MCKXYXPHQ23BJ42U8ZMDD8CG5" \
            L"DPHZQ5XTXUKA277XK6PKSTLJ88ZZ9EBXH62REMRZZRGNPKHYM34RW722S" \
            L"SZHMPFKY7X8UZ19ADGX3UQ7X444XH7MZXEZYW2YLFHR8YL3PTCXVSYX89" \
            L"ZXN7KW2XNBE8XS3TQRGZVF6KA5USH56NEZYH5RNWBBPVE9LD6H42RQWR5" \
            L"YVQMT5EQYQTK6YM9V8DA5BJCLGGZ2UGD6NPA2X3SNUS47F7HJBNBCWHRA" \
            L"YPPCQ5HWCJNPDHUDQMRN2P6PWJFWJ6CLVNK8HXEFLE4ENPXAFN89CRS43" \
            L"RUMVGDJQCSRB535XYCS6BZYLA9Q6HJV425F26XXHRGA7C8R8BVMELAPEH" \
            L"5DSA9KXTCV4H2RNVDFHG3YJSERZVFPWHYA823LUBENBL5U3J4LJX2KQLW" \
            L"L5XGGESPSE2FQWKSQ4NUCDLBEJPQAT2A2477DYS2XEXKLYEAKUN22622C" \
            L"RLBCAHPFNEV2FJ2H8N3JQGXJRGP19AFHGRW6SS2ZSFYK8EZAPVYL4MCP4" \
            L"6UMR64Y9T89FHWEPXBRHKWJCSNNNGPU984J5XW4BWTU6PDWPN24W8RU55" \
            L"A9C3U9H7VHS5PFURASHBT4JAEE5ZKJBSYMCMDVBLU973R72RVPA6U96A2" \
            L"LX8HMASVST9RVJ7W66V4DYWRDZZQ3673W7C7LVF68TWPLNMYEUQ8FDZRN" \
            L"P38D9BX5YA3VENETDUUUMR9U7FFP4NZM7G4Y6J6EASK5SAXXTRMZ8F3AH" \
            L"5FC54E543N739BY5KVZQM7JZWD2P2HPE7BDRMM9JFCGPBWWASTZ7UDNRV" \
            L"6AFHVMBR9AGAERE9M6W6S2ZT8PBTABPDCKBPPPV6QW9DRXZUGAHDDRRSY" \
            L"XM4YXQ2QJX6CL33N7RV8846LK8A3DFLDXWZ2NKF8V";
        wchar_t pr[] = L"02DB825DUDFYHA88AG49NMM742HCQEJDKQQGDR6G3GL7MCED16DU9KTVE" \
            L"47XQ3M92FFKX8FU9ZXT7AK7VTGGJSYQERCZBR8J2DE2CFE3VUU4W7JEQJ" \
            L"L49HDUXBW7SNPCV8MHXM7EQHYPQK3GSPQYV5VWESQE4AYWFZHXN2UX7Z3" \
            L"T3CV52XURB3YFKLUCY6CJTRACRVVDD568F6F28U74ABWCZ2ZMC32E83V3" \
            L"4JZZPDBF3KEYQWREETGKQT6NANCMAD4XDEXW5LCYBJ3GMDJBM3E7FNK98" \
            L"7JEUYEV7QNKGKNTDVMRG3G5L8NC9CNHQS8AVDMDBEGCG3DHGJUGPG2244" \
            L"2C9LCD8FJ2LSDMQXLHCGCLP7ZSYQT2UJ4QFGU2CH3BTT3UADZMQSBAV33" \
            L"B3Z2Y8Y8RRD9J754G02DJ372LR8APP7HXKB2GNPHP6T65C3RR48Q8BHGP" \
            L"KEZ6PX2D02DJ372LR8APP7HXKB2GNPHP6T65C3RR48Q8BHGPKEZ6PX2D";
        kp.PublicKey = pl;
        kp.PrivateKey = pr;
      break;
    }
    case RM_3072:
    {
        wchar_t pl[] = L"0201B810DA4A1ADD4351378790A98138533267BJBN6W8SY33Y47RWJHWS385XWRV9TSVSB5EM7ECZYNSJ44ZKSD8KV4" \
            L"6Y9T6TNC6QMDW4V6DBMADU3YUKLP88TCLEUD9FTEUHGXM6T57AQ2EMB59" \
            L"UPQVNSUT7Z4EHAMDQ6N77VK2A6P847MMWJH9E7C5XX6FNF6MHGWERPWQV" \
            L"9ZLVR9Z7X5D5Z2XQL6MBM7BDCT2DEDVRBFNDDBLG6LHZ9APM48LS5TKTJ" \
            L"AGDYFDRVHEGTDH47PCLL8YJ4ZAWCB59F8BN5PZL3NQACP32G3YNBX5E3J" \
            L"7S28XLRGAX55ZML5XE6Q68EUAL38VUBJ2MZ2UGCCHM7CE6S99N44X9RMV" \
            L"7B55HULJ4KHPFYSBDUSPQTCWGS76BEQST2QCZDZ2T4FBA4YUJFF47AACE" \
            L"A4EEFESEYWN48UZCSDZAMGSU5VB9UJKR2XQUSDFS3TNG9QKURQWS7N5Q3" \
            L"VPYT4QAGGQ5GW2MMXHDJYW55FQPHSS255GVJ7WLLP85JHS8K6DVTJWB4W" \
            L"4Y8ZEFF7KP6W74PAA8FVPZVDW4RKGMQ8V56Q6R4V34XFE5HR4FZS8GZ6R" \
            L"36RKW6WN34S2AHR9LCGF8LULB7ZN6NC2AA5RPDZYGWSPPME6267CGLZCP" \
            L"GG98W557RXCDWAETJHDCRPUXX7AD3E8SL9WMGBV9QFHMSV9UFV7H9NTX3" \
            L"QYV95CN9P9DSYQWL35R2BWB4GKW6CTWVB2X6WH3P2WFBE6X55KBLAMDB3" \
            L"SRDSDVY37GKH78MUHY7KDJDC8SJU5FUQRYZ49ULX3YSZL7E284GFVZSGD" \
            L"FTTQNR6VMBM3LLR78SUSVMJW88XT2K4UHEATRU3V9MMR2VGNGCY9S6R7M" \
            L"4ELNPEBBMQP2HVPLY5M5VPA92V7NU8ZZ58YYTW5QK9USZ5LV59UZGB2CF" \
            L"DPZ6HFYU5WB7UU3UYWVNSNKM3W7GBYKJP8TMFW2YN6GNSSE4ZKFVZRLUT" \
            L"8QPZBBEQT5H9H5Z53D7QV4AJTKTX4EMW62TDWXQVK24JZPSG2VXKCMYZL" \
            L"BUASE25R3EEK9KBLJ8VX83ZXGTBL5CCDBY33HJ6FKX8AW3WPRX3XTCS9G" \
            L"2B9SVK2XFFKNSPGFG6FZNS8P2HERFGFL79DKUZZFWHFH4H9UZ7F7F6W3Z" \
            L"WN84JRRA7SU8T89EQMRBEPVYMMGLGSUMFWWMEDLJM5EGP5WEX9LDUAQXS" \
            L"55LKDQVRKX4R8NNBHSYBHSNMFYA2C6KGQQFK3TN267DPSZT3PTKHTLNMU" \
            L"V2YYZZRX3953LPWAKYF8LJUVMEQT3ZC4F9SWMYGUHG6XX66PJFQWSRUW2" \
            L"C79YLGZ6ZAFS7HLXBTH55UD3EGFBZQ5CLNJDZTEJACDVBCM5FQBTX4DKK" \
            L"UDGNSMWWLC5UMQRHW89CTU5636WYDXVZZDAUZ529458LDN2DAR9QADWRZ" \
            L"UTU8MCKN8ACH3R36YKE52DDF67SM5UDUH7PTATHXE65UCGFRCV49UTF29" \
            L"BGDSUWGRMC839HUZYQVAG985YUF5KJCAVGKRD8E4YMPJ38KR6HD2KHDGY" \
            L"PJDMJMN4Y3DTJW5MYX3VUPF32637LMAWFM4QCU7BMP74SCF4N5QXZZVBE" \
            L"LAQMPYMJC2ZWJ9XFV33YXTTPH3SG9KMUABLL83P7L3UBVM763XJPR5UEH" \
            L"DZ73XJUGR9QP6299K5PU46XGVWKWFAKWYMRXUSLCFJ3WQTEC6QJH6E5V8" \
            L"X2RMA5TXGSBEWLGSMNQ2SH6G9MLKK4S486DN4M4QVDTYTM4JQETAJQGP7" \
            L"6NUR4UNDXR4W4JQSNWDTUGX69SEDC3AL8ZF4TJBQQRXSX2A86UUWCDCFH" \
            L"JE94A8EP3Q6A2QTYKEE62MV4VJB2AB";
        wchar_t pr[] = L"04DMQBFL5GKK4RXWEZYPEY8QB5GHBBGW3EY766DFF2Q6PLFLR4SSRWXBN" \
            L"W5CFGFC84UJ8PKRDQQYWN9921AH8AGZAQRWJYZ7C3QUJJCJAAGGT5P5GG" \
            L"LY6K5W4JZJDW7Y8EWS6SSYCS2MCR93MY9DG6VXLBRYVZWDX6XNFU286HM" \
            L"AM9E82KJVZNYGC8RXRW43SFFWDLR8C96R58A42F3TGLXPVWLGMNPPAWS4" \
            L"S2SSMNQLUPBAQMP7AUKAGV5CKL342W6UKQY3TUPXKGFXFES725PEX93UX" \
            L"X4K8JRY3MPQ5S94VNPBXQ5N6LDBLWB67LBLDCGNQS3JEKW667UF8LA8Q6" \
            L"B3AF4XGZKYB7BVVHF49DJUHSFJZRD63S4GMMAPQ8Q87HKN9G3J3575JEL" \
            L"5C29NZLWQW6MSYWJ7S3NKLKPWGU75ZJXKEL6Z9V97HAMDYHM6ARCH58EP" \
            L"WRPZUXN8RRWGCDFM6BH6XUTRTFE3VMAAZAUUKHKL6AFC2PCPXFRDWLVYP" \
            L"ZKUGY8QDEZNECK9K5Y5MET9SRWQ36JF77XJ6NUKSMZ6DKUPEH4W43YQAE" \
            L"CV7XVFWJ7ZTRVFQJZFU5BS8AL77YLCXDCR5VPFFZ9NP7EBBQ2AA04DP3S" \
            L"86B3YD8AFXQ3KPPNTPHBTQSM8PUHJHG87RUM4EV63GKPBRGSN3VX63FCS" \
            L"646DLWSH86B542U3F04DP3S86B3YD8AFXQ3KPPNTPHBTQSM8PUHJHG87R" \
            L"UM4EV63GKPBRGSN3VX63FCS646DLWSH86B542U3F";
        kp.PublicKey = pl;
        kp.PrivateKey = pr;
      break;
    }
    case RM_4096:
    {
        wchar_t pl[] = L"0201B810DA4A1ADD4351378790A98138533334BN75EUD4LFWYFVNFGBRCEMKKXG62QRBXL8GMHQ975B68FJVEMNXQQ7" \
            L"RKR7RCZMWDVP86QPB3LR49G9BM7EUUZXNCRZBXRF4PEY3RX6UXT4X286K" \
            L"WMR7AMEE6QNP9AEHGWJT9AVU3F62F37B5GVX2BQF73QWHRFQSQ6XMRP6M" \
            L"ZDRQ8JT89UF3YRK5UL34MM3L8HLDTWAJF5YY7MRWJUFDQRK9JNCJ6C9KJ" \
            L"WRE5ACQSNS24NEAHDYKS3AK75HBCTKP9NR2CSL7Q9PPXM4TF7L37USP77" \
            L"Z7WER6JY67F7YGKTP6MFRMKK9H8XFPZ9XWKK97XCFXK7AW4TB96WGEH4B" \
            L"YPF9QRF2DGC3LCHW8VTD2EMHVRDR6EEBUG8R4XYKJPLBPRCJP445DU2BW" \
            L"JWELKAY45GKDU5HLTTDTWRH2JFKJ7AVAKLPEELN29YHX5JR773P9ERW7N" \
            L"UFMWDKD4UL4YPU5QW2L4A7ZN3E8ZDQVEZUR6ZRDQXRLQRLUNHVB4XGBWD" \
            L"HM79NGJARHDBQJCD8NWZCWPBY26QARP7A5S48DCV29F7MUTHU3YAHYVS7" \
            L"ZPGXJZZA5HBBY4K5BQPUG6MVCBG8H3C7VL8KH9EH58NUVCE6F2CGMSM94" \
            L"4CQDKNVGWWWRNK4DG26UT88Y9ULUPJ25G9KLTQPK3TBXZEK43X8KPMJT8" \
            L"DF6MTQ5RB94XR2BT9H9NYYTXL29GF8KZY9QNHAW4LTT2RDQTD2ELWPSV4" \
            L"4AND9K8G5VKLQ287UBEVHA82CMSMGQQBMNQZVAZ9G8T5TD6G9F7XQHMJT" \
            L"HCL6PFEDUW5MN9JASF2EKPT2H33325A3SFGGM5C3RYKZSYSSQC5FLHNX9" \
            L"VHN4HQVWD66YECY4R97JZHQALRTCHXUWH85LSJCCTQZT8JF52FHG6FV9J" \
            L"UJWEU24K9Z7SKYTYA9NH7GW29FSNKUK3DMFXY48VEYZVDRTTMLFYSJH8B" \
            L"RQXV72REYGSM6SLX89EVQ52CN9N8YDLWHAWCDDNM89YN2FCRTLE8688XN" \
            L"F4MZMFE6GP9JK2JTFJVUKBLES2ZVWSBCJE9N3D7DG9LL9Z3U42QFJJPE2" \
            L"HE5XCRY25UND96R9D7655ZBSCPF796FJZ4GPLY7AMZLGLR77GRP467ELK" \
            L"PXSZ9ZF8MUYFDHV4EFACPZ79CDFTYW56NE9JDWDVUMNLY9EXDSF8ZNABE" \
            L"MDQU6T9RVLTNRMZJJ8EJSUM9TV8YA6MNWF2Y66MD3VQ9L662F5X6VE9ZC" \
            L"PPRTNMEV2DG9BUMFMSL7PUR9H5QG6VVBDBMEU3PLABL57HMSQ5C83E9X8" \
            L"RTPY4QSEH2H7R2QDJHT5LQSFNQJL2NZ24GLNTFXG468WC5UUTDD68G8HM" \
            L"477Z8P4F9ZZHUGZ6VPFF32A2MPWY8LPXNECCKM9EEVLDDPUJ8LXN2AE6K" \
            L"Y2Q42FVBCJM9GQTXNRHBED735KCFD4YGV4U5U3LJD6NJ886W6XQLWH3G7" \
            L"3VZ6T5YDUQP6DA5ZHLKQSGATDJHUWC2ELTE7QJFXH8H9EAQYZPPMW76JG" \
            L"Z48UBND9VXFXZMSGBNWQPNQG7E4TCBDMVKUSA9TTVSNLN3DXEZNXH787R" \
            L"N7XHFBJNZ5W74DUMNBYVHEQDYMZBQCFMS8LGSDUAU6QE9DD5Q334BX62T" \
            L"JP5WQQDS2ZEWW76XW7VMLX3L7V9UVD7RL297VDBVRFPQ5MYA3YFVBVNVA" \
            L"R5TJXMQ4X2U2PW6UWSKBXT58HG3QPZM2RVEX2PDMCVJDFTJMXR9NPLW4C" \
            L"6AE4Q9A8TTAQ68BSN9WWTFFTSX68ECVARFPDBBH5DMP4KYFARTFVCSWNF" \
            L"FGAPBYYGFJA4MGHEDWTNE54MPGER7EPCZEV2ESJRMM6XDMFGABG97HECN" \
            L"3SZFUBRKCNDZ2TE9F6EERULRCDAV5EMY6KVY9NY9MYNPP2FQ5WFWLMRYD" \
            L"4TNYYHE6EDMQ6KK79HH5Q5KBW6DDQYYNUR365W2454CHEZWZAPU82SX4H" \
            L"KHNZXBRVWAT7G9CJBKHNBPSVEL67X8UJHBFHZH8ZD4NSEVFZM4Y768TJ6" \
            L"QP3BGEKLTY4UZUWHG63QMKVWAQW9E7WRFNJCH4XRD97JHNKMFUTRFVH68" \
            L"G5CKSMGC725AZ9CBSL2JX43P4EY44CMF56AJ6BEXVCJP2ZDWCT9G55K4D" \
            L"F24J7TTJMFXTQH95CBNX67CBPNWEKHCWQV6VD73Y9KCZHNBFUFS8TCYNN" \
            L"WXRGFKNVRDFUKWHDWDDTSPEW8YCKLPMX2GUV3N4JFJMUE6TSJR6Z53C9F" \
            L"SKZAY3EN7G66JPBF5E9S6Y7RQHPWZHSRDQ7XH87PHUJFLJFGD7WNE3Q9P" \
            L"EXMW33LVJBFEUXKNUB6SU7ZYCEX96XT8G27FLUV7XPV4JK64DWDJCX9WV" \
            L"4VL8CK23FQJ28UG9JUZTQJ3DRL32BTJVRD4LVQ6MK9LCE7ZZP925JK7ZD" \
            L"92SCV4DDJJ5EXMVBF";
        wchar_t pr[] = L"067DN6F8YFBTWF5QH8MHJB39Z7VNN2P56HS8RPBURAWB8KPL8FQWX4HSP" \
            L"RTY4HWFMFXAVX2YUY99G2U2KKK56CBE4BCPZWS3KJ98XRW4PY2CDQ3ALF" \
            L"Y3HGJG42NRY9ZVGZZB59TE29KGC825BYBX3FRFMYBVN2VTHM8YM2KULXM" \
            L"H24XSHNVK4HEQ9L5264844DMBFUUXSBA9PT9LEXT6449TMAMF7RL6KU6C" \
            L"GP6FU9DNMJCNTUREF2U9WUMJBMXMMHWKWDG4VU5JQNFFNNWCP2YE2DGFD" \
            L"N3H27NTNR58GBNTTZBRK66BKWNVMF8H59KALB6K93Y8UWDUWV5HJZGV8X" \
            L"3AS5EG982DYV4W9CQ3GRRFRR8NABQC98FTAG465SXQ3JPN7X7VULQZX4X" \
            L"UK68URBFPGCW2UPBYH6CRG6C7YBRAURM2KMGN5L8XH4AUQN8WM4P454WN" \
            L"NWRE5SQEC78FK3LHHQU5VLXLYYN8F2NXGG7CCQ92EEC63ZE6S7CC7RTML" \
            L"UMM3PAXPL5CJZFL26JNNYPVLAHM75NDL8AS8JR48PFXK49D4A6TY2ZU9Y" \
            L"XX2Y2TLA3J8T56EPY236FEDGZEHTQR73NE2Y7LKL7423FFKGGPWYL8PB5" \
            L"VWD54PG328ACE6V8VLSGVP9VJMMWS2VDVU459C8K5XK869Z5KM4JWHAVE" \
            L"G56ZESC6HHJ423N6SAH2DW2UQZDQHSMKWUCHPUKZZPJXCQXF55Q3BJW6Z" \
            L"QYK4HM4Q8XWU8NT844E8YM96EGHSYEUKAJ3QDXANN2DELSGARH7LR2XH9" \
            L"UQBQNXGPZGB6JTEQP8HAQK5ZZYJE067DWX6C2JJ7L2HE4NGVXZV5XH9RD" \
            L"P9SNG4WZTC9KEMGXDX7JTQX8RPJJRT4YTA83L8GXDNDDHB7C79CN8UWGL" \
            L"U5EMNMBREQN5MYTYHGYK067DWX6C2JJ7L2HE4NGVXZV5XH9RDP9SNG4WZ" \
            L"TC9KEMGXDX7JTQX8RPJJRT4YTA83L8GXDNDDHB7C79CN8UWGLU5EMNMBR" \
            L"EQN5MYTYHGYK";
        kp.PublicKey = pl;
        kp.PrivateKey = pr;
      break;
    }
  }

  // Generate reg. key
  dwResult = KG_GenerateRegistrationKeyW(&kp);

  if (dwResult == EP_NO_ERROR)
  {
    SetDlgItemTextW(IDC_EDITKEY, kp.Key);
  } else
  {
    wchar_t* sError;
    switch (dwResult)
    {
      case EP_ERROR_UNKNOWN:
        sError = L"EP_ERROR_UNKNOWN";
        break;
      case EP_ERROR_KEYBUFFEREMPTY:
        sError = L"EP_ERROR_KEYBUFFEREMPTY";
        break;
      case EP_ERROR_KEYBUFFERISLESS:
        sError = L"EP_ERROR_KEYBUFFERISLESS";
        break;
      case EP_ERROR_REGINFOEMPTY:
        sError = L"EP_ERROR_REGINFOEMPTY";
        break;
      case EP_ERROR_REGINFOTOOLARGE:
        sError = L"EP_ERROR_REGINFOTOOLARGE";
        break;
      case EP_ERROR_PRIVATEKEYISNOTSET:
        sError = L"EP_ERROR_PRIVATEKEYISNOTSET";
        break;
      case EP_ERROR_PUBLICKEYISNOTSET:
        sError = L"EP_ERROR_PUBLICKEYISNOTSET";
        break;
      case EP_ERROR_PRIVATEKEYISINVALID:
        sError = L"EP_ERROR_PRIVATEKEYISINVALID";
        break;
      case EP_ERROR_PUBLICKEYISINVALID:
        sError = L"EP_ERROR_PUBLICKEYISINVALID";
        break;
      case EP_ERROR_KEYMODEISINVALID:
        sError = L"EP_ERROR_KEYMODEISINVALID";
        break;
      case EP_ERROR_KEYBASEISINVALID:
        sError = L"EP_ERROR_KEYBASEISINVALID";
        break;
      case EP_ERROR_CURRENTDATEISINVALID:
        sError = L"EP_ERROR_CURRENTDATEISINVALID";
        break;
      case EP_ERROR_EXPIRATIONDATEISINVALID:
        sError = L"EP_ERROR_EXPIRATIONDATEISINVALID";
        break;
      case EP_ERROR_KEYISINVALID:
        sError = L"EP_ERROR_KEYISINVALID";
        break;
      case EP_ERROR_HARDWAREID:
        sError = L"EP_ERROR_HARDWAREID";
        break;
      case EP_ERROR_HARDWAREBUFFEREMPTY:
        sError = L"EP_ERROR_HARDWAREBUFFEREMPTY";
        break;
      case EP_ERROR_HARDWAREIDINVALIDFORKEY:
        sError = L"EP_ERROR_HARDWAREIDINVALIDFORKEY";
        break;
      case EP_ERROR_PROJECTFILENOTFOUND:
        sError = L"EP_ERROR_PROJECTFILENOTFOUND";
        break;
      case EP_ERROR_INVALIDPROJECTFILE:
        sError = L"EP_ERROR_INVALIDPROJECTFILE";
        break;
      case EP_ERROR_EXECUTIONSNUMBERINVALID:
        sError = L"EP_ERROR_EXECUTIONSNUMBERINVALID";
        break;
      case EP_ERROR_DAYSNUMBERINVALID:
        sError = L"EP_ERROR_DAYSNUMBERINVALID";
        break;
      case EP_ERROR_COUNTRYCODEINVALID:
        sError = L"EP_ERROR_COUNTRYCODEINVALID";
        break;
      case EP_ERROR_RUNTIMEINVALID:
        sError = L"EP_ERROR_RUNTIMEINVALID";
        break;
      case EP_ERROR_GLOBALTIMEINVALID:
        sError = L"EP_ERROR_GLOBALTIMEINVALID";
        break;
      case EP_ERROR_INSTALLBEFOREINVALID:
        sError = L"EP_ERROR_INSTALLBEFOREINVALID";
        break;
      case EP_ERROR_INSTALLAFTERINVALID:
        sError = L"EP_ERROR_INSTALLAFTERINVALID";
        break;
      default:
        sError = L"Unknown error";
        break;
    }
    SetDlgItemTextW(IDC_EDITKEY, sError);
  }
}

Show/Hide C# (.NET) function example

        private void btnGenerate_Click(object sender, System.EventArgs e)
        {
            tbKey.Clear();
            if (tbUserInfo.Text == string.Empty)
            {
                MessageBox.Show("User info field is empty!");
                return;
            }
            Enigma_KeyGen_IDE.TKeyGenParamsW kg = new Enigma_KeyGen_IDE.TKeyGenParamsW();
            kg.KeyMode = cbKeyMode.SelectedIndex;
            kg.KeyBase = cbKeyBase.SelectedIndex;
            kg.KeyWithHyphens = cbHyphens.Checked;
            switch (kg.KeyMode)
            {
                case Enigma_KeyGen_IDE.RM_512:
                    {
                        kg.PublicKey = "0201B810DA4A1ADD4351378790A98138533067CP4S86R7D8THS45GBCVUM635EPRQRMYRP3DAA5DUPZ6ABDSFP7F5AC" +
                                       "P7ERGH4A7Y6B6NW6NMMBZF83WVER9Y4MMBNLBQDKR7KFVLGLV067CFDQC" +
                                       "WCHGQVVRN24DECEPBL96YJQJTVDCRTNQG3E4WW4GK4GQ5X5L5H88D3XYH" +
                                       "CBRBNASPD3P5CNYFKFHBCSDHHD6WPTCC4XVSM5S88067C2JSTCMVT48C8" +
                                       "HC7SHKGTFJBM28P6XTBCNWHMV6J6KN6W5Q9TQLVR285U6GVCAAUTZLRTP" +
                                       "SRGDQ742B4742XF4MACRR747YDP5FZZ9D";
                        kg.PrivateKey = "00C98B2SF9UBJA605AJX53GJFXJV8UH4A6PY2L6CV4MAMV7V3ERRVY99Y" +
                                        "72V2P77Z2J3KBPGWR3WXKG5GF9Z6CKXJHY5VUMBTQ66H2MRZPCU00DLFJ" +
                                        "675JTTTNEK00DLFJ675JTTTNEK";
                        break;
                    }
                case Enigma_KeyGen_IDE.RM_768:
                    {
                        kg.PublicKey = "0201B810DA4A1ADD4351378790A9813853309AEHRR66KMK99UEPX8C54WQFDZQ5Y96WUCVZYMXBC32SJV7T5SBPR54E" +
                                       "2DBH8UD9RNHTJ9BLJV6NHX52W7PZDDTTJDDGF3YFVL7PJFL8RS8THTFDF" +
                                       "4RY7K3QXLTMXMC8DDSRVRWBVMMP3UYKCDDC7KGL9PG509ACPTRQ4MMUKG" +
                                       "DAUJFFFGSCBFLYK9X9E74M58PW5FG9B9RTLXJQ4STPVCHJTEH8BP557VZ" +
                                       "PQYDBUZJXXJNGVZELFL4UL3LHHE8A645CK593DVWCQBSX4ZCCQ3ST8GCZ" +
                                       "LW2729XK3NT7GST3LMQGXSHLDWCXE09AENVX2QTX3VLT6FWB4JND875XZ" +
                                       "WQ26GW76TV3KVVHK7U489LLPBQ39HUWKMA65U3HKWBDHKBZEB525PHEH2" +
                                       "YQHRZGNJAAYZXMWN8RNZ9T7VMZAJMP2V3S9NXZ9RHL96F7AT3NTMN36V4" +
                                       "ACSFEN4DR6TJR95";
                        kg.PrivateKey = "019VRB95TKY456YC48LBS9FK34YN080VVPDJPPKU6XA9EPLX7HTVN3VST" +
                                        "TNJZFPH4HQAFY58R593KFKSNZ7WEZBA9AZ6PGN735EWEFUAEM3G8XVUFN" +
                                        "L2ZFRPXA4V8KVXE4M8GACUJAT7H3TTWZT9ZDE43ZF46HC01AHFR85MVR2" +
                                        "UP7K3N53M8MTNWBUP01AHFR85MVR2UP7K3N53M8MTNWBUP";
                        break;
                    }
                case Enigma_KeyGen_IDE.RM_1024:
                    {
                        kg.PublicKey = "0201B810DA4A1ADD4351378790A981385330CDG9YQSEUK2HT546KWW46NHSCHMD2TNCSPVNSKGQC6CHDUSU9CC4LDPL" +
                                       "TD3NLRVD3TFV9BU2SYBUBU9TXKLQ3CTKZE5GN9VFG37R9YNK2FE58K7ZY" +
                                       "WTUJYFSJTBMDLLGA9GJ2LJXGHSS9CESGC2K69H65YQGAC7CRGF5T3CPLA" +
                                       "5BDJZKVCUWPZRNA2DN7L956LZVZBQUDPX6PF30CDBH26Z82VE4QQ8N85L" +
                                       "QHYJYYCJ6WQ89H9K9VVQX925SG5FJ79AGVZB6M8TTFKCJ56FAREP8GSTC" +
                                       "NKWCXEALDP9Y2ZLS9QKZV8JRNDHG9D8BRDSCTMDQK9NLAPZ9TGYFS9G7U" +
                                       "LXHYJF7F9A89HPXGTU2N4FQQJL98WZ5QND2KTEMMUUZFAX953HCGNSWUW" +
                                       "U2M7LBEWZSH9GW5SC0CDJDY2HC4HJYUSVTAVXZ7MYVJWF3CU9WC3SVPSL" +
                                       "29WF46DVS2SYKSSAMATPPYGJDE3PBFMGS34CXWQSXKCEAE63L2EXTS9NE" +
                                       "2G597XASY3S34XMYST5YZF4THUTYT5DY9UKKXU6PH8MLXRPZMPMMR83JU" +
                                       "X2WGNEW8ZGL4SKUCUB8CEAB6UZ4FB66WTP3B64VMX7XG75T4Y35479";
                        kg.PrivateKey = "020MLJ7XTRVLBDNUVMKGUFHCU8XBGMHHVRA0ADSHPBC7NVSZ82AM867XC" +
                                        "BELNKMR7CZ56C4SW8KKRD9WZLE5X992GZVSZXS5J6JG9SLDW3Y696TU4D" +
                                        "QZP778LVFKVRKANQD6FUGN2ACWUJM9ZK6ME7WXWDZ88LTWHME52RKUDKX" +
                                        "STT7RGWP7HFUJDGWEUG4ZHQ25DCQJ644CLEXRR3G020SAAREJB4WXZ4H2" +
                                        "JEH4AB4U8FGFTA4CAF020SAAREJB4WXZ4H2JEH4AB4U8FGFTA4CAF";
                        break;
                    }
                case Enigma_KeyGen_IDE.RM_2048:
                    {
                        kg.PublicKey = "0201B810DA4A1ADD4351378790A98138533199H9KZC4CQ5ZKPEGYDW2EHN5AKZA5G5KP4HU8USWJR8XWW7MCH7244RV" +
                                       "PSXFHVU6YQRK4LPUHM497XJYPLLA3DHUZWXK3CB5SUYF75NPYLTNPRUAP" +
                                       "CTVDHAKYWTRQ97HES2E59WDN2LJKFYA2K8BGFSBHP4A6BF5FSDTS8NWLL" +
                                       "C5NEQ76NJ9BAMWXG55UPFFMRQZTU5KV2G6LSPQUJJWA9U4LJ5SCJ9M9ZQ" +
                                       "Z6K7LZA9UAMJ533UQ5J3JPNQAUWJGZFRFCTGAGSBWPWRRF9HRGF9MCX55" +
                                       "QRYGPYMRE6DBJ65SJDX34FVPYWWKWQ48MCKXYXPHQ23BJ42U8ZMDD8CG5" +
                                       "DPHZQ5XTXUKA277XK6PKSTLJ88ZZ9EBXH62REMRZZRGNPKHYM34RW722S" +
                                       "SZHMPFKY7X8UZ19ADGX3UQ7X444XH7MZXEZYW2YLFHR8YL3PTCXVSYX89" +
                                       "ZXN7KW2XNBE8XS3TQRGZVF6KA5USH56NEZYH5RNWBBPVE9LD6H42RQWR5" +
                                       "YVQMT5EQYQTK6YM9V8DA5BJCLGGZ2UGD6NPA2X3SNUS47F7HJBNBCWHRA" +
                                       "YPPCQ5HWCJNPDHUDQMRN2P6PWJFWJ6CLVNK8HXEFLE4ENPXAFN89CRS43" +
                                       "RUMVGDJQCSRB535XYCS6BZYLA9Q6HJV425F26XXHRGA7C8R8BVMELAPEH" +
                                       "5DSA9KXTCV4H2RNVDFHG3YJSERZVFPWHYA823LUBENBL5U3J4LJX2KQLW" +
                                       "L5XGGESPSE2FQWKSQ4NUCDLBEJPQAT2A2477DYS2XEXKLYEAKUN22622C" +
                                       "RLBCAHPFNEV2FJ2H8N3JQGXJRGP19AFHGRW6SS2ZSFYK8EZAPVYL4MCP4" +
                                       "6UMR64Y9T89FHWEPXBRHKWJCSNNNGPU984J5XW4BWTU6PDWPN24W8RU55" +
                                       "A9C3U9H7VHS5PFURASHBT4JAEE5ZKJBSYMCMDVBLU973R72RVPA6U96A2" +
                                       "LX8HMASVST9RVJ7W66V4DYWRDZZQ3673W7C7LVF68TWPLNMYEUQ8FDZRN" +
                                       "P38D9BX5YA3VENETDUUUMR9U7FFP4NZM7G4Y6J6EASK5SAXXTRMZ8F3AH" +
                                       "5FC54E543N739BY5KVZQM7JZWD2P2HPE7BDRMM9JFCGPBWWASTZ7UDNRV" +
                                       "6AFHVMBR9AGAERE9M6W6S2ZT8PBTABPDCKBPPPV6QW9DRXZUGAHDDRRSY" +
                                       "XM4YXQ2QJX6CL33N7RV8846LK8A3DFLDXWZ2NKF8V";
                        kg.PrivateKey = "02DB825DUDFYHA88AG49NMM742HCQEJDKQQGDR6G3GL7MCED16DU9KTVE" +
                                        "47XQ3M92FFKX8FU9ZXT7AK7VTGGJSYQERCZBR8J2DE2CFE3VUU4W7JEQJ" +
                                        "L49HDUXBW7SNPCV8MHXM7EQHYPQK3GSPQYV5VWESQE4AYWFZHXN2UX7Z3" +
                                        "T3CV52XURB3YFKLUCY6CJTRACRVVDD568F6F28U74ABWCZ2ZMC32E83V3" +
                                        "4JZZPDBF3KEYQWREETGKQT6NANCMAD4XDEXW5LCYBJ3GMDJBM3E7FNK98" +
                                        "7JEUYEV7QNKGKNTDVMRG3G5L8NC9CNHQS8AVDMDBEGCG3DHGJUGPG2244" +
                                        "2C9LCD8FJ2LSDMQXLHCGCLP7ZSYQT2UJ4QFGU2CH3BTT3UADZMQSBAV33" +
                                        "B3Z2Y8Y8RRD9J754G02DJ372LR8APP7HXKB2GNPHP6T65C3RR48Q8BHGP" +
                                        "KEZ6PX2D02DJ372LR8APP7HXKB2GNPHP6T65C3RR48Q8BHGPKEZ6PX2D";
                        break;
                    }
                case Enigma_KeyGen_IDE.RM_3072:
                    {
                        kg.PublicKey = "0201B810DA4A1ADD4351378790A98138533267BJBN6W8SY33Y47RWJHWS385XWRV9TSVSB5EM7ECZYNSJ44ZKSD8KV4" +
                                       "6Y9T6TNC6QMDW4V6DBMADU3YUKLP88TCLEUD9FTEUHGXM6T57AQ2EMB59" +
                                       "UPQVNSUT7Z4EHAMDQ6N77VK2A6P847MMWJH9E7C5XX6FNF6MHGWERPWQV" +
                                       "9ZLVR9Z7X5D5Z2XQL6MBM7BDCT2DEDVRBFNDDBLG6LHZ9APM48LS5TKTJ" +
                                       "AGDYFDRVHEGTDH47PCLL8YJ4ZAWCB59F8BN5PZL3NQACP32G3YNBX5E3J" +
                                       "7S28XLRGAX55ZML5XE6Q68EUAL38VUBJ2MZ2UGCCHM7CE6S99N44X9RMV" +
                                       "7B55HULJ4KHPFYSBDUSPQTCWGS76BEQST2QCZDZ2T4FBA4YUJFF47AACE" +
                                       "A4EEFESEYWN48UZCSDZAMGSU5VB9UJKR2XQUSDFS3TNG9QKURQWS7N5Q3" +
                                       "VPYT4QAGGQ5GW2MMXHDJYW55FQPHSS255GVJ7WLLP85JHS8K6DVTJWB4W" +
                                       "4Y8ZEFF7KP6W74PAA8FVPZVDW4RKGMQ8V56Q6R4V34XFE5HR4FZS8GZ6R" +
                                       "36RKW6WN34S2AHR9LCGF8LULB7ZN6NC2AA5RPDZYGWSPPME6267CGLZCP" +
                                       "GG98W557RXCDWAETJHDCRPUXX7AD3E8SL9WMGBV9QFHMSV9UFV7H9NTX3" +
                                       "QYV95CN9P9DSYQWL35R2BWB4GKW6CTWVB2X6WH3P2WFBE6X55KBLAMDB3" +
                                       "SRDSDVY37GKH78MUHY7KDJDC8SJU5FUQRYZ49ULX3YSZL7E284GFVZSGD" +
                                       "FTTQNR6VMBM3LLR78SUSVMJW88XT2K4UHEATRU3V9MMR2VGNGCY9S6R7M" +
                                       "4ELNPEBBMQP2HVPLY5M5VPA92V7NU8ZZ58YYTW5QK9USZ5LV59UZGB2CF" +
                                       "DPZ6HFYU5WB7UU3UYWVNSNKM3W7GBYKJP8TMFW2YN6GNSSE4ZKFVZRLUT" +
                                       "8QPZBBEQT5H9H5Z53D7QV4AJTKTX4EMW62TDWXQVK24JZPSG2VXKCMYZL" +
                                       "BUASE25R3EEK9KBLJ8VX83ZXGTBL5CCDBY33HJ6FKX8AW3WPRX3XTCS9G" +
                                       "2B9SVK2XFFKNSPGFG6FZNS8P2HERFGFL79DKUZZFWHFH4H9UZ7F7F6W3Z" +
                                       "WN84JRRA7SU8T89EQMRBEPVYMMGLGSUMFWWMEDLJM5EGP5WEX9LDUAQXS" +
                                       "55LKDQVRKX4R8NNBHSYBHSNMFYA2C6KGQQFK3TN267DPSZT3PTKHTLNMU" +
                                       "V2YYZZRX3953LPWAKYF8LJUVMEQT3ZC4F9SWMYGUHG6XX66PJFQWSRUW2" +
                                       "C79YLGZ6ZAFS7HLXBTH55UD3EGFBZQ5CLNJDZTEJACDVBCM5FQBTX4DKK" +
                                       "UDGNSMWWLC5UMQRHW89CTU5636WYDXVZZDAUZ529458LDN2DAR9QADWRZ" +
                                       "UTU8MCKN8ACH3R36YKE52DDF67SM5UDUH7PTATHXE65UCGFRCV49UTF29" +
                                       "BGDSUWGRMC839HUZYQVAG985YUF5KJCAVGKRD8E4YMPJ38KR6HD2KHDGY" +
                                       "PJDMJMN4Y3DTJW5MYX3VUPF32637LMAWFM4QCU7BMP74SCF4N5QXZZVBE" +
                                       "LAQMPYMJC2ZWJ9XFV33YXTTPH3SG9KMUABLL83P7L3UBVM763XJPR5UEH" +
                                       "DZ73XJUGR9QP6299K5PU46XGVWKWFAKWYMRXUSLCFJ3WQTEC6QJH6E5V8" +
                                       "X2RMA5TXGSBEWLGSMNQ2SH6G9MLKK4S486DN4M4QVDTYTM4JQETAJQGP7" +
                                       "6NUR4UNDXR4W4JQSNWDTUGX69SEDC3AL8ZF4TJBQQRXSX2A86UUWCDCFH" +
                                       "JE94A8EP3Q6A2QTYKEE62MV4VJB2AB";
                        kg.PrivateKey = "04DMQBFL5GKK4RXWEZYPEY8QB5GHBBGW3EY766DFF2Q6PLFLR4SSRWXBN" +
                                        "W5CFGFC84UJ8PKRDQQYWN9921AH8AGZAQRWJYZ7C3QUJJCJAAGGT5P5GG" +
                                        "LY6K5W4JZJDW7Y8EWS6SSYCS2MCR93MY9DG6VXLBRYVZWDX6XNFU286HM" +
                                        "AM9E82KJVZNYGC8RXRW43SFFWDLR8C96R58A42F3TGLXPVWLGMNPPAWS4" +
                                        "S2SSMNQLUPBAQMP7AUKAGV5CKL342W6UKQY3TUPXKGFXFES725PEX93UX" +
                                        "X4K8JRY3MPQ5S94VNPBXQ5N6LDBLWB67LBLDCGNQS3JEKW667UF8LA8Q6" +
                                        "B3AF4XGZKYB7BVVHF49DJUHSFJZRD63S4GMMAPQ8Q87HKN9G3J3575JEL" +
                                        "5C29NZLWQW6MSYWJ7S3NKLKPWGU75ZJXKEL6Z9V97HAMDYHM6ARCH58EP" +
                                        "WRPZUXN8RRWGCDFM6BH6XUTRTFE3VMAAZAUUKHKL6AFC2PCPXFRDWLVYP" +
                                        "ZKUGY8QDEZNECK9K5Y5MET9SRWQ36JF77XJ6NUKSMZ6DKUPEH4W43YQAE" +
                                        "CV7XVFWJ7ZTRVFQJZFU5BS8AL77YLCXDCR5VPFFZ9NP7EBBQ2AA04DP3S" +
                                        "86B3YD8AFXQ3KPPNTPHBTQSM8PUHJHG87RUM4EV63GKPBRGSN3VX63FCS" +
                                        "646DLWSH86B542U3F04DP3S86B3YD8AFXQ3KPPNTPHBTQSM8PUHJHG87R" +
                                        "UM4EV63GKPBRGSN3VX63FCS646DLWSH86B542U3F";
                        break;
                    }
                case Enigma_KeyGen_IDE.RM_4096:
                    {
                        kg.PublicKey = "0201B810DA4A1ADD4351378790A98138533334BN75EUD4LFWYFVNFGBRCEMKKXG62QRBXL8GMHQ975B68FJVEMNXQQ7" +
                                       "RKR7RCZMWDVP86QPB3LR49G9BM7EUUZXNCRZBXRF4PEY3RX6UXT4X286K" +
                                       "WMR7AMEE6QNP9AEHGWJT9AVU3F62F37B5GVX2BQF73QWHRFQSQ6XMRP6M" +
                                       "ZDRQ8JT89UF3YRK5UL34MM3L8HLDTWAJF5YY7MRWJUFDQRK9JNCJ6C9KJ" +
                                       "WRE5ACQSNS24NEAHDYKS3AK75HBCTKP9NR2CSL7Q9PPXM4TF7L37USP77" +
                                       "Z7WER6JY67F7YGKTP6MFRMKK9H8XFPZ9XWKK97XCFXK7AW4TB96WGEH4B" +
                                       "YPF9QRF2DGC3LCHW8VTD2EMHVRDR6EEBUG8R4XYKJPLBPRCJP445DU2BW" +
                                       "JWELKAY45GKDU5HLTTDTWRH2JFKJ7AVAKLPEELN29YHX5JR773P9ERW7N" +
                                       "UFMWDKD4UL4YPU5QW2L4A7ZN3E8ZDQVEZUR6ZRDQXRLQRLUNHVB4XGBWD" +
                                       "HM79NGJARHDBQJCD8NWZCWPBY26QARP7A5S48DCV29F7MUTHU3YAHYVS7" +
                                       "ZPGXJZZA5HBBY4K5BQPUG6MVCBG8H3C7VL8KH9EH58NUVCE6F2CGMSM94" +
                                       "4CQDKNVGWWWRNK4DG26UT88Y9ULUPJ25G9KLTQPK3TBXZEK43X8KPMJT8" +
                                       "DF6MTQ5RB94XR2BT9H9NYYTXL29GF8KZY9QNHAW4LTT2RDQTD2ELWPSV4" +
                                       "4AND9K8G5VKLQ287UBEVHA82CMSMGQQBMNQZVAZ9G8T5TD6G9F7XQHMJT" +
                                       "HCL6PFEDUW5MN9JASF2EKPT2H33325A3SFGGM5C3RYKZSYSSQC5FLHNX9" +
                                       "VHN4HQVWD66YECY4R97JZHQALRTCHXUWH85LSJCCTQZT8JF52FHG6FV9J" +
                                       "UJWEU24K9Z7SKYTYA9NH7GW29FSNKUK3DMFXY48VEYZVDRTTMLFYSJH8B" +
                                       "RQXV72REYGSM6SLX89EVQ52CN9N8YDLWHAWCDDNM89YN2FCRTLE8688XN" +
                                       "F4MZMFE6GP9JK2JTFJVUKBLES2ZVWSBCJE9N3D7DG9LL9Z3U42QFJJPE2" +
                                       "HE5XCRY25UND96R9D7655ZBSCPF796FJZ4GPLY7AMZLGLR77GRP467ELK" +
                                       "PXSZ9ZF8MUYFDHV4EFACPZ79CDFTYW56NE9JDWDVUMNLY9EXDSF8ZNABE" +
                                       "MDQU6T9RVLTNRMZJJ8EJSUM9TV8YA6MNWF2Y66MD3VQ9L662F5X6VE9ZC" +
                                       "PPRTNMEV2DG9BUMFMSL7PUR9H5QG6VVBDBMEU3PLABL57HMSQ5C83E9X8" +
                                       "RTPY4QSEH2H7R2QDJHT5LQSFNQJL2NZ24GLNTFXG468WC5UUTDD68G8HM" +
                                       "477Z8P4F9ZZHUGZ6VPFF32A2MPWY8LPXNECCKM9EEVLDDPUJ8LXN2AE6K" +
                                       "Y2Q42FVBCJM9GQTXNRHBED735KCFD4YGV4U5U3LJD6NJ886W6XQLWH3G7" +
                                       "3VZ6T5YDUQP6DA5ZHLKQSGATDJHUWC2ELTE7QJFXH8H9EAQYZPPMW76JG" +
                                       "Z48UBND9VXFXZMSGBNWQPNQG7E4TCBDMVKUSA9TTVSNLN3DXEZNXH787R" +
                                       "N7XHFBJNZ5W74DUMNBYVHEQDYMZBQCFMS8LGSDUAU6QE9DD5Q334BX62T" +
                                       "JP5WQQDS2ZEWW76XW7VMLX3L7V9UVD7RL297VDBVRFPQ5MYA3YFVBVNVA" +
                                       "R5TJXMQ4X2U2PW6UWSKBXT58HG3QPZM2RVEX2PDMCVJDFTJMXR9NPLW4C" +
                                       "6AE4Q9A8TTAQ68BSN9WWTFFTSX68ECVARFPDBBH5DMP4KYFARTFVCSWNF" +
                                       "FGAPBYYGFJA4MGHEDWTNE54MPGER7EPCZEV2ESJRMM6XDMFGABG97HECN" +
                                       "3SZFUBRKCNDZ2TE9F6EERULRCDAV5EMY6KVY9NY9MYNPP2FQ5WFWLMRYD" +
                                       "4TNYYHE6EDMQ6KK79HH5Q5KBW6DDQYYNUR365W2454CHEZWZAPU82SX4H" +
                                       "KHNZXBRVWAT7G9CJBKHNBPSVEL67X8UJHBFHZH8ZD4NSEVFZM4Y768TJ6" +
                                       "QP3BGEKLTY4UZUWHG63QMKVWAQW9E7WRFNJCH4XRD97JHNKMFUTRFVH68" +
                                       "G5CKSMGC725AZ9CBSL2JX43P4EY44CMF56AJ6BEXVCJP2ZDWCT9G55K4D" +
                                       "F24J7TTJMFXTQH95CBNX67CBPNWEKHCWQV6VD73Y9KCZHNBFUFS8TCYNN" +
                                       "WXRGFKNVRDFUKWHDWDDTSPEW8YCKLPMX2GUV3N4JFJMUE6TSJR6Z53C9F" +
                                       "SKZAY3EN7G66JPBF5E9S6Y7RQHPWZHSRDQ7XH87PHUJFLJFGD7WNE3Q9P" +
                                       "EXMW33LVJBFEUXKNUB6SU7ZYCEX96XT8G27FLUV7XPV4JK64DWDJCX9WV" +
                                       "4VL8CK23FQJ28UG9JUZTQJ3DRL32BTJVRD4LVQ6MK9LCE7ZZP925JK7ZD" +
                                       "92SCV4DDJJ5EXMVBF";
                        kg.PrivateKey = "067DN6F8YFBTWF5QH8MHJB39Z7VNN2P56HS8RPBURAWB8KPL8FQWX4HSP" +
                                        "RTY4HWFMFXAVX2YUY99G2U2KKK56CBE4BCPZWS3KJ98XRW4PY2CDQ3ALF" +
                                        "Y3HGJG42NRY9ZVGZZB59TE29KGC825BYBX3FRFMYBVN2VTHM8YM2KULXM" +
                                        "H24XSHNVK4HEQ9L5264844DMBFUUXSBA9PT9LEXT6449TMAMF7RL6KU6C" +
                                        "GP6FU9DNMJCNTUREF2U9WUMJBMXMMHWKWDG4VU5JQNFFNNWCP2YE2DGFD" +
                                        "N3H27NTNR58GBNTTZBRK66BKWNVMF8H59KALB6K93Y8UWDUWV5HJZGV8X" +
                                        "3AS5EG982DYV4W9CQ3GRRFRR8NABQC98FTAG465SXQ3JPN7X7VULQZX4X" +
                                        "UK68URBFPGCW2UPBYH6CRG6C7YBRAURM2KMGN5L8XH4AUQN8WM4P454WN" +
                                        "NWRE5SQEC78FK3LHHQU5VLXLYYN8F2NXGG7CCQ92EEC63ZE6S7CC7RTML" +
                                        "UMM3PAXPL5CJZFL26JNNYPVLAHM75NDL8AS8JR48PFXK49D4A6TY2ZU9Y" +
                                        "XX2Y2TLA3J8T56EPY236FEDGZEHTQR73NE2Y7LKL7423FFKGGPWYL8PB5" +
                                        "VWD54PG328ACE6V8VLSGVP9VJMMWS2VDVU459C8K5XK869Z5KM4JWHAVE" +
                                        "G56ZESC6HHJ423N6SAH2DW2UQZDQHSMKWUCHPUKZZPJXCQXF55Q3BJW6Z" +
                                        "QYK4HM4Q8XWU8NT844E8YM96EGHSYEUKAJ3QDXANN2DELSGARH7LR2XH9" +
                                        "UQBQNXGPZGB6JTEQP8HAQK5ZZYJE067DWX6C2JJ7L2HE4NGVXZV5XH9RD" +
                                        "P9SNG4WZTC9KEMGXDX7JTQX8RPJJRT4YTA83L8GXDNDDHB7C79CN8UWGL" +
                                        "U5EMNMBREQN5MYTYHGYK067DWX6C2JJ7L2HE4NGVXZV5XH9RDP9SNG4WZ" +
                                        "TC9KEMGXDX7JTQX8RPJJRT4YTA83L8GXDNDDHB7C79CN8UWGLU5EMNMBR" +
                                        "EQN5MYTYHGYK";
                        break;
                    }
            }
            kg.Key = new string('\0', 2048);
            kg.KeyLen = kg.Key.Length;

            kg.RegInfo = tbUserInfo.Text;

            kg.UseKeyExpiration = cbExpiration.Checked;
            if (kg.UseKeyExpiration)
            {
                kg.ExpirationYear = dtpExpiration.Value.Year;
                kg.ExpirationMonth = dtpExpiration.Value.Month;
                kg.ExpirationDay = dtpExpiration.Value.Day;
            }
            // Hardware ID
            kg.UseHardwareLocking = cbHardware.Checked;
            if (kg.UseHardwareLocking)
            {
                kg.HardwareID = tbHardware.Text;
            }
            // Register After
            kg.UseRegisterAfter = cbRegisterAfter.Checked;
            if (kg.UseRegisterAfter)
            {
                kg.RegisterAfterYear = dtpRegisterAfter.Value.Year;
                kg.RegisterAfterMonth = dtpRegisterAfter.Value.Month;
                kg.RegisterAfterDay = dtpRegisterAfter.Value.Day;
            }
            // Register Before
            kg.UseRegisterBefore = cbRegisterBefore.Checked;
            if (kg.UseRegisterBefore)
            {
                kg.RegisterBeforeYear = dtpRegisterBefore.Value.Year;
                kg.RegisterBeforeMonth = dtpRegisterBefore.Value.Month;
                kg.RegisterBeforeDay = dtpRegisterBefore.Value.Day;
            }
            // Executions
            kg.UseExecutionsLimit = cbExecutions.Checked;
            if (kg.UseExecutionsLimit)
            {
                kg.ExecutionsCount = (int)udExecutions.Value;
            }
            // Days
            kg.UseDaysLimit = cbDays.Checked;
            if (kg.UseDaysLimit)
            {
                kg.DaysCount = (int)udDays.Value;
            }
            // Runtime
            kg.UseRunTimeLimit = cbRuntime.Checked;
            if (kg.UseRunTimeLimit)
            {
                kg.RunTimeMinutes = (int)udRuntime.Value;
            }
            // Global Time
            kg.UseGlobalTimeLimit = cbGlobalTime.Checked;
            if (kg.UseGlobalTimeLimit)
            {
                kg.GlobalTimeMinutes = (int)udGlobalTime.Value;
            }
            // Country
            kg.UseCountyLimit = cbCountry.Checked;
            if (kg.UseCountyLimit)
            {
                Enigma_KeyGen_IDE ide = new Enigma_KeyGen_IDE();
                kg.CountryCode = ide.KEY_COUNTRIES[comCountries.SelectedIndex].Code;
            }

            kg.EncryptedSections = new bool[Enigma_KeyGen_IDE.NUMBER_OF_CRYPTED_SECTIONS];
            kg.EncryptedSections[0] = cbSection1.Checked;
            kg.EncryptedSections[1] = cbSection2.Checked;
            kg.EncryptedSections[2] = cbSection3.Checked;
            kg.EncryptedSections[3] = cbSection4.Checked;
            kg.EncryptedSections[4] = cbSection5.Checked;
            kg.EncryptedSections[5] = cbSection6.Checked;
            kg.EncryptedSections[6] = cbSection7.Checked;
            kg.EncryptedSections[7] = cbSection8.Checked;
            kg.EncryptedSections[8] = cbSection9.Checked;
            kg.EncryptedSections[9] = cbSection10.Checked;
            kg.EncryptedSections[10] = cbSection11.Checked;
            kg.EncryptedSections[11] = cbSection12.Checked;
            kg.EncryptedSections[12] = cbSection13.Checked;
            kg.EncryptedSections[13] = cbSection14.Checked;
            kg.EncryptedSections[14] = cbSection15.Checked;
            kg.EncryptedSections[15] = cbSection16.Checked;

            // Secure constant (get it from project file)!
            kg.EncryptedConstant = 2113444489;

            // Generate reg. key

            uint dwResult = Enigma_KeyGen_IDE.KG_GenerateRegistrationKeyW(ref kg);
            if (dwResult == Enigma_KeyGen_IDE.EP_NO_ERROR)
            {
                tbKey.Text = kg.Key;
            }
            else
            {
                switch (dwResult)
                {
                    case Enigma_KeyGen_IDE.EP_ERROR_UNKNOWN:
                        tbKey.Text = "EP_ERROR_UNKNOWN";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_KEYBUFFEREMPTY:
                        tbKey.Text = "EP_ERROR_KEYBUFFEREMPTY";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_KEYBUFFERISLESS:
                        tbKey.Text = "EP_ERROR_KEYBUFFERISLESS";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_REGINFOEMPTY:
                        tbKey.Text = "EP_ERROR_REGINFOEMPTY";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_REGINFOTOOLARGE:
                        tbKey.Text = "EP_ERROR_REGINFOTOOLARGE";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_PRIVATEKEYISNOTSET:
                        tbKey.Text = "EP_ERROR_PRIVATEKEYISNOTSET";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_PUBLICKEYISNOTSET:
                        tbKey.Text = "EP_ERROR_PUBLICKEYISNOTSET";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_PRIVATEKEYISINVALID:
                        tbKey.Text = "EP_ERROR_PRIVATEKEYISINVALID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_PUBLICKEYISINVALID:
                        tbKey.Text = "EP_ERROR_PUBLICKEYISINVALID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_KEYMODEISINVALID:
                        tbKey.Text = "EP_ERROR_KEYMODEISINVALID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_KEYBASEISINVALID:
                        tbKey.Text = "EP_ERROR_KEYBASEISINVALID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_CURRENTDATEISINVALID:
                        tbKey.Text = "EP_ERROR_CURRENTDATEISINVALID";
                        break;

                    case Enigma_KeyGen_IDE.EP_ERROR_EXPIRATIONDATEISINVALID:
                        tbKey.Text = "EP_ERROR_EXPIRATIONDATEISINVALID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_KEYISINVALID:
                        tbKey.Text = "EP_ERROR_KEYISINVALID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_HARDWAREID:
                        tbKey.Text = "EP_ERROR_HARDWAREID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_HARDWAREBUFFEREMPTY:
                        tbKey.Text = "EP_ERROR_HARDWAREBUFFEREMPTY";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_HARDWAREIDINVALIDFORKEY:
                        tbKey.Text = "EP_ERROR_HARDWAREIDINVALIDFORKEY";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_PROJECTFILENOTFOUND:
                        tbKey.Text = "EP_ERROR_PROJECTFILENOTFOUND";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_INVALIDPROJECTFILE:
                        tbKey.Text = "EP_ERROR_INVALIDPROJECTFILE";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_EXECUTIONSNUMBERINVALID:
                        tbKey.Text = "EP_ERROR_EXECUTIONSNUMBERINVALID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_DAYSNUMBERINVALID:
                        tbKey.Text = "EP_ERROR_DAYSNUMBERINVALID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_COUNTRYCODEINVALID:
                        tbKey.Text = "EP_ERROR_COUNTRYCODEINVALID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_RUNTIMEINVALID:
                        tbKey.Text = "EP_ERROR_RUNTIMEINVALID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_GLOBALTIMEINVALID:
                        tbKey.Text = "EP_ERROR_GLOBALTIMEINVALID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_INSTALLBEFOREINVALID:
                        tbKey.Text = "EP_ERROR_INSTALLBEFOREINVALID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_INSTALLAFTERINVALID:
                        tbKey.Text = "EP_ERROR_INSTALLAFTERINVALID";
                        break;
                    default:
                        tbKey.Text = "Unknown error";
                        break;
                }
            }
        }

See function examples in the installation folder, Examples\KeygenUnicode subfolder.


Function KG_GenerateRegistrationKeyFromProjectW

KG_GenerateRegistrationKeyFromProjectW, as well as the KG_GenerateRegistrationKeyW function, is used for generating unicode-based registration keys. Note: to enable the application to accept unicode registration keys, the UNICODE Registration Scheme parameter from the Registration Features - Common panel should be enabled. The function reads secure information (PublicKey, PrivateKey, KeyMode, KeyBase and EncryptedConstant) from the project file and you do not have to set up these parameters in the input structure TGenKeyParamW. KG_GenerateRegistrationKeyFromProjectW has two parameters, one of them is ProjectFile, which is a pointer to unicode - null terminated string - the path to the Enigma Protector project file, and another parameter is a pointer to the TGenKeyParamW structure.

Return Values

EP_NO_ERROR=0 | the function succeeds. In this case, Key parameter of TKeyGenParams structure should contain a pointer to the null terminated string - registration key.
EP_ERROR_UNKNOWN=1 | unknown error
EP_ERROR_KEYBUFFEREMPTY=2 | memory buffer for registration key is not allocated
EP_ERROR_KEYBUFFERISLESS=3 | size of allocated memory for registration key is less than required
EP_ERROR_REGINFOEMPTY=4 | registration information is not specified
EP_ERROR_REGINFOTOOLARGE=5 | registration information is empty (has a null size)
EP_ERROR_PRIVATEKEYISNOTSET=6 | private key is not set
EP_ERROR_PUBLICKEYISNOTSET=7 | public key is not set
EP_ERROR_PRIVATEKEYISINVALID=8 | private key is invalid
EP_ERROR_PUBLICKEYISINVALID=9 | public key is invalid
EP_ERROR_KEYMODEISINVALID=10 | key mode is invalid
EP_ERROR_KEYBASEISINVALID=11 | key base is invalid
EP_ERROR_CURRENTDATEISINVALID=12 | current date is invalid
EP_ERROR_EXPIRATIONDATEISINVALID=13 | expiration date is invalid
EP_ERROR_KEYISINVALID=14 | key is invalid
EP_ERROR_HARDWAREID=15 | hardware id is invalid
EP_ERROR_HARDWAREBUFFEREMPTY=16 | hardware id buffer is empty
EP_ERROR_HARDWAREIDINVALIDFORKEY=17 | hardware id is invalid for the key
EP_ERROR_PROJECTFILENOTFOUND=18 | project file is not found
EP_ERROR_INVALIDPROJECTFILE=19 | project file is invalid
EP_ERROR_EXECUTIONSNUMBERINVALID=20 | executions number is invalid
EP_ERROR_DAYSNUMBERINVALID=21 | days number is invalid
EP_ERROR_COUNTRYCODEINVALID=22 | country code is invalid
EP_ERROR_RUNTIMEINVALID=23 | run-time value is invalid
EP_ERROR_GLOBALTIMEINVALID=24 | global time is invalid
EP_ERROR_INSTALLBEFOREINVALID=25 | register before date is invalid
EP_ERROR_INSTALLAFTERINVALID=26 | register after date is invalid

Definition

Show/Hide Delphi function definition

function KG_GenerateRegistrationKeyW(kg : PKeyGenParamsW) : dword; external keygen_api_dll_name name 'KG_GenerateRegistrationKeyW';

Show/Hide C++ function definition

 extern  "C" __declspec( dllimport ) __stdcall int KG_GenerateRegistrationKeyW(PKeyGenParamsW kg);

Show/Hide C# (.NET) function definition

public class Enigma_KeyGen_IDE
{
    [DllImport("keygen.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.StdCall)]
    public static extern uint KG_GenerateRegistrationKeyW(ref TKeyGenParamsW kg);
}

Examples

Show/Hide Delphi function example

procedure TfrmMain.bGenFPClick(Sender: TObject);
var
  kg : TKeyGenParamsW;
  KeyBuffer : array [0..2047] of widechar;
  dwResult : dword;
begin
  mKey.Clear;

  if eUserInfo.Text = '' then
  begin
    ShowMessage('User info field is empty!');
    Exit;
  end;

  ZeroMemory(@kg, SizeOf(kg));
  // Hyphens
  kg.KeyWithHyphens := cbHyphens.Checked;
  // Fill key buffer
  ZeroMemory(@KeyBuffer, SizeOf(KeyBuffer));
  kg.Key := @KeyBuffer;
  kg.KeyLen := SizeOf(KeyBuffer);
  // Fill User Info
  kg.RegInfo := PWideChar(eUserInfo.Text);
  // Key expiration info
  kg.UseKeyExpiration := cbExpirationDate.Checked;
  kg.ExpirationYear := YearOf(DateTimePicker1.DateTime);
  kg.ExpirationMonth := MonthOf(DateTimePicker1.DateTime);
  kg.ExpirationDay := DayOf(DateTimePicker1.DateTime);
  // Register After date
  kg.UseRegisterAfter := cbRegisterAfter.Checked;
  if kg.UseRegisterAfter then
  begin
    kg.RegisterAfterYear := YearOf(dtpRegisterAfter.DateTime);
    kg.RegisterAfterMonth := MonthOf(dtpRegisterAfter.DateTime);
    kg.RegisterAfterDay := DayOf(dtpRegisterAfter.DateTime);
  end;
  // Register Before date
  kg.UseRegisterBefore := cbRegisterBefore.Checked;
  if kg.UseRegisterBefore then
  begin
    kg.RegisterBeforeYear := YearOf(dtpRegisterBefore.DateTime);
    kg.RegisterBeforeMonth := MonthOf(dtpRegisterBefore.DateTime);
    kg.RegisterBeforeDay := DayOf(dtpRegisterBefore.DateTime);
  end;
  // Country
  kg.UseCountyLimit := cbCountry.Checked;
  if kg.UseCountyLimit then
  begin
    kg.CountryCode := KEY_COUNTRIES[comCountries.ItemIndex].Code;
  end;
  // Executions
  kg.UseExecutionsLimit := cbExecutions.Checked;
  if kg.UseExecutionsLimit then
  begin
    kg.ExecutionsCount := StrToInt(eExecutions.Text);
  end;
  // Days
  kg.UseDaysLimit := cbDays.Checked;
  if kg.UseDaysLimit then
  begin
    kg.DaysCount := StrToInt(eDays.Text);
  end;
  // Runtime
  kg.UseRunTimeLimit := cbRuntime.Checked;
  if kg.UseRunTimeLimit then
  begin
    kg.RunTimeMinutes := StrToInt(eRuntime.Text);
  end;
  // Global time
  kg.UseGlobalTimeLimit := cbGlobalTime.Checked;
  if kg.UseGlobalTimeLimit then
  begin
    kg.GlobalTimeMinutes := StrToInt(eGlobalTime.Text);
  end;
  // Hardware ID
  kg.UseHardwareLocking := cbHardwareID.Checked;
  kg.HardwareID := PWideChar(eHardware.Text);
  // Crypt Sections
  kg.EncryptedSections[1] := cbSection1.Checked;
  kg.EncryptedSections[2] := cbSection2.Checked;
  kg.EncryptedSections[3] := cbSection3.Checked;
  kg.EncryptedSections[4] := cbSection4.Checked;
  kg.EncryptedSections[5] := cbSection5.Checked;
  kg.EncryptedSections[6] := cbSection6.Checked;
  kg.EncryptedSections[7] := cbSection7.Checked;
  kg.EncryptedSections[8] := cbSection8.Checked;
  kg.EncryptedSections[9] := cbSection9.Checked;
  kg.EncryptedSections[10] := cbSection10.Checked;
  kg.EncryptedSections[11] := cbSection11.Checked;
  kg.EncryptedSections[12] := cbSection12.Checked;
  kg.EncryptedSections[13] := cbSection13.Checked;
  kg.EncryptedSections[14] := cbSection14.Checked;
  kg.EncryptedSections[15] := cbSection15.Checked;
  kg.EncryptedSections[16] := cbSection16.Checked;
  // Generate reg. key
  dwResult := KG_GenerateRegistrationKeyFromProjectW('default.enigma', @kg);
  if dwResult = EP_NO_ERROR then
  begin
    mKey.Text := String(PWideChar(kg.Key));
  end else
  begin
    case dwResult of
      EP_ERROR_UNKNOWN                 : mKey.Text := 'EP_ERROR_UNKNOWN                ';
      EP_ERROR_KEYBUFFEREMPTY          : mKey.Text := 'EP_ERROR_KEYBUFFEREMPTY         ';
      EP_ERROR_KEYBUFFERISLESS         : mKey.Text := 'EP_ERROR_KEYBUFFERISLESS        ';
      EP_ERROR_REGINFOEMPTY            : mKey.Text := 'EP_ERROR_REGINFOEMPTY           ';
      EP_ERROR_REGINFOTOOLARGE         : mKey.Text := 'EP_ERROR_REGINFOTOOLARGE        ';
      EP_ERROR_PRIVATEKEYISNOTSET      : mKey.Text := 'EP_ERROR_PRIVATEKEYISNOTSET     ';
      EP_ERROR_PUBLICKEYISNOTSET       : mKey.Text := 'EP_ERROR_PUBLICKEYISNOTSET      ';
      EP_ERROR_PRIVATEKEYISINVALID     : mKey.Text := 'EP_ERROR_PRIVATEKEYISINVALID    ';
      EP_ERROR_PUBLICKEYISINVALID      : mKey.Text := 'EP_ERROR_PUBLICKEYISINVALID     ';
      EP_ERROR_KEYMODEISINVALID        : mKey.Text := 'EP_ERROR_KEYMODEISINVALID       ';
      EP_ERROR_KEYBASEISINVALID        : mKey.Text := 'EP_ERROR_KEYBASEISINVALID       ';
      EP_ERROR_CURRENTDATEISINVALID    : mKey.Text := 'EP_ERROR_CURRENTDATEISINVALID   ';
      EP_ERROR_EXPIRATIONDATEISINVALID : mKey.Text := 'EP_ERROR_EXPIRATIONDATEISINVALID';
      EP_ERROR_KEYISINVALID            : mKey.Text := 'EP_ERROR_KEYISINVALID           ';
      EP_ERROR_HARDWAREID              : mKey.Text := 'EP_ERROR_HARDWAREID             ';
      EP_ERROR_HARDWAREBUFFEREMPTY     : mKey.Text := 'EP_ERROR_HARDWAREBUFFEREMPTY    ';
      EP_ERROR_HARDWAREIDINVALIDFORKEY : mKey.Text := 'EP_ERROR_HARDWAREIDINVALIDFORKEY';
      EP_ERROR_PROJECTFILENOTFOUND     : mKey.Text := 'EP_ERROR_PROJECTFILENOTFOUND    ';
      EP_ERROR_INVALIDPROJECTFILE      : mKey.Text := 'EP_ERROR_INVALIDPROJECTFILE     ';
      EP_ERROR_EXECUTIONSNUMBERINVALID : mKey.Text := 'EP_ERROR_EXECUTIONSNUMBERINVALID';
      EP_ERROR_DAYSNUMBERINVALID       : mKey.Text := 'EP_ERROR_DAYSNUMBERINVALID      ';
      EP_ERROR_COUNTRYCODEINVALID      : mKey.Text := 'EP_ERROR_COUNTRYCODEINVALID     ';
      EP_ERROR_RUNTIMEINVALID          : mKey.Text := 'EP_ERROR_RUNTIMEINVALID         ';
      EP_ERROR_GLOBALTIMEINVALID       : mKey.Text := 'EP_ERROR_GLOBALTIMEINVALID      ';
      EP_ERROR_INSTALLBEFOREINVALID    : mKey.Text := 'EP_ERROR_INSTALLBEFOREINVALID   ';
      EP_ERROR_INSTALLAFTERINVALID     : mKey.Text := 'EP_ERROR_INSTALLAFTERINVALID    ';
      else mKey.Text := 'Unknown error';
    end;
  end;
end;

Show/Hide Visual C++ function example

void CKeygenDlg::OnBnClickedButtongenfp()
{
    // TODO: Add your control notification handler code here
    // TODO: Add your control notification handler code here
  TKeyGenParamsW kp;
  wchar_t keybuffer[2048];
  wchar_t tmp[255];
  wchar_t username[255];
  wchar_t hardwareid[255];
  SYSTEMTIME lpDate;
  DWORD dwResult;

  // Clear params buffer
  memset(&kp, 0, sizeof(kp));
  // Clear key buffer
  memset(&keybuffer, 0, sizeof(keybuffer));

  kp.Key = (wchar_t*) keybuffer;
  kp.KeyLen = sizeof(keybuffer);

  // Fill User Info
  memset(&username, 0, sizeof(username));
  GetDlgItemTextW(IDC_EDITNAME, (wchar_t*)&username, sizeof(username));
  kp.RegInfo = (wchar_t*)&username;

  // Key expiration info
  if (IsDlgButtonChecked(IDC_CHECKEXPIRATION) != 0)
  {
      kp.UseKeyExpiration = true;
      SendDlgItemMessage(IDC_DTPEXPIRATION, DTM_GETSYSTEMTIME, GDT_VALID, (LPARAM)&lpDate);
      kp.ExpirationYear = lpDate.wYear;
      kp.ExpirationMonth = lpDate.wMonth;
      kp.ExpirationDay = lpDate.wDay;
  }

  // Register After
  if (IsDlgButtonChecked(IDC_CHECKREGAFTER) != 0)
  {
      kp.UseRegisterAfter = true;
      SendDlgItemMessage(IDC_DTPREGAFTER, DTM_GETSYSTEMTIME, GDT_VALID, (LPARAM)&lpDate);
      kp.RegisterAfterYear = lpDate.wYear;
      kp.RegisterAfterMonth = lpDate.wMonth;
      kp.RegisterAfterDay = lpDate.wDay;
  }

  // Register Before
  if (IsDlgButtonChecked(IDC_CHECKREGBEFORE) != 0)
  {
      kp.UseRegisterBefore = true;
      SendDlgItemMessage(IDC_DTPREGBEFORE, DTM_GETSYSTEMTIME, GDT_VALID, (LPARAM)&lpDate);
      kp.RegisterBeforeYear = lpDate.wYear;
      kp.RegisterBeforeMonth = lpDate.wMonth;
      kp.RegisterBeforeDay = lpDate.wDay;
  }

  // Executions
  if (IsDlgButtonChecked(IDC_CHECKEXECS) != 0)
  {
      kp.UseExecutionsLimit = true;
      memset(&tmp, 0, sizeof(tmp));
      GetDlgItemTextW(IDC_EDITEXECS, (wchar_t*)&tmp, sizeof(tmp));
      kp.ExecutionsCount = _wtoi((wchar_t*)&tmp);
  }

  // Days
  if (IsDlgButtonChecked(IDC_CHECKDAYS) != 0)
  {
      kp.UseDaysLimit = true;
      memset(&tmp, 0, sizeof(tmp));
      GetDlgItemTextW(IDC_EDITDAYS, (wchar_t*)&tmp, sizeof(tmp));
      kp.DaysCount = _wtoi((wchar_t*)&tmp);
  }

  // Run-time
  if (IsDlgButtonChecked(IDC_CHECKRTIME) != 0)
  {
      kp.UseRunTimeLimit = true;
      memset(&tmp, 0, sizeof(tmp));
      GetDlgItemTextW(IDC_EDITRTIME, (wchar_t*)&tmp, sizeof(tmp));
      kp.RunTimeMinutes = _wtoi((wchar_t*)&tmp);
  }

  // Global time
  if (IsDlgButtonChecked(IDC_CHECKGTIME) != 0)
  {
      kp.UseGlobalTimeLimit = true;
      memset(&tmp, 0, sizeof(tmp));
      GetDlgItemTextW(IDC_EDITGTIME, (wchar_t*)&tmp, sizeof(tmp));
      kp.GlobalTimeMinutes = _wtoi((wchar_t*)&tmp);
  }

  // Country Lock
  if (IsDlgButtonChecked(IDC_CHECKCOUNTRY) != 0)
  {
      kp.UseCountyLimit = true;
      kp.CountryCode = KEY_COUNTRIES[com_counties.GetCurSel()].Code;
  }

  // Hardware ID
  if (IsDlgButtonChecked(IDC_CHECKHD) != 0)
  {
      kp.UseHardwareLocking = true;
      memset(&hardwareid, 0, sizeof(hardwareid));
      GetDlgItemTextW(IDC_EDITHD, (wchar_t*)&hardwareid, sizeof(hardwareid));
      kp.HardwareID = (wchar_t*)&hardwareid;
  }

  // Crypt Sections
  if (IsDlgButtonChecked(IDC_CHECKS1) != 0) { kp.EncryptedSections[0] = true; }
  if (IsDlgButtonChecked(IDC_CHECKS2) != 0) { kp.EncryptedSections[1] = true; }
  if (IsDlgButtonChecked(IDC_CHECKS3) != 0) { kp.EncryptedSections[2] = true; }
  if (IsDlgButtonChecked(IDC_CHECKS4) != 0) { kp.EncryptedSections[3] = true; }
  if (IsDlgButtonChecked(IDC_CHECKS5) != 0) { kp.EncryptedSections[4] = true; }
  if (IsDlgButtonChecked(IDC_CHECKS6) != 0) { kp.EncryptedSections[5] = true; }
  if (IsDlgButtonChecked(IDC_CHECKS7) != 0) { kp.EncryptedSections[6] = true; }
  if (IsDlgButtonChecked(IDC_CHECKS8) != 0) { kp.EncryptedSections[7] = true; }
  if (IsDlgButtonChecked(IDC_CHECKS9) != 0) { kp.EncryptedSections[8] = true; }
  if (IsDlgButtonChecked(IDC_CHECKS10) != 0) { kp.EncryptedSections[9] = true; }
  if (IsDlgButtonChecked(IDC_CHECKS11) != 0) { kp.EncryptedSections[10] = true; }
  if (IsDlgButtonChecked(IDC_CHECKS12) != 0) { kp.EncryptedSections[11] = true; }
  if (IsDlgButtonChecked(IDC_CHECKS13) != 0) { kp.EncryptedSections[12] = true; }
  if (IsDlgButtonChecked(IDC_CHECKS14) != 0) { kp.EncryptedSections[13] = true; }
  if (IsDlgButtonChecked(IDC_CHECKS15) != 0) { kp.EncryptedSections[14] = true; }
  if (IsDlgButtonChecked(IDC_CHECKS16) != 0) { kp.EncryptedSections[15] = true; }

  kp.KeyWithHyphens = IsDlgButtonChecked(IDC_CHECKHYPHENS) != 0;

  // Generate reg. key
  dwResult = KG_GenerateRegistrationKeyFromProjectW(L"default.enigma", &kp);

  if (dwResult == EP_NO_ERROR)
  {
    SetDlgItemTextW(IDC_EDITKEY, kp.Key);
  } else
  {
    wchar_t* sError;
    switch (dwResult)
    {
      case EP_ERROR_UNKNOWN:
        sError = L"EP_ERROR_UNKNOWN";
        break;
      case EP_ERROR_KEYBUFFEREMPTY:
        sError = L"EP_ERROR_KEYBUFFEREMPTY";
        break;
      case EP_ERROR_KEYBUFFERISLESS:
        sError = L"EP_ERROR_KEYBUFFERISLESS";
        break;
      case EP_ERROR_REGINFOEMPTY:
        sError = L"EP_ERROR_REGINFOEMPTY";
        break;
      case EP_ERROR_REGINFOTOOLARGE:
        sError = L"EP_ERROR_REGINFOTOOLARGE";
        break;
      case EP_ERROR_PRIVATEKEYISNOTSET:
        sError = L"EP_ERROR_PRIVATEKEYISNOTSET";
        break;
      case EP_ERROR_PUBLICKEYISNOTSET:
        sError = L"EP_ERROR_PUBLICKEYISNOTSET";
        break;
      case EP_ERROR_PRIVATEKEYISINVALID:
        sError = L"EP_ERROR_PRIVATEKEYISINVALID";
        break;
      case EP_ERROR_PUBLICKEYISINVALID:
        sError = L"EP_ERROR_PUBLICKEYISINVALID";
        break;
      case EP_ERROR_KEYMODEISINVALID:
        sError = L"EP_ERROR_KEYMODEISINVALID";
        break;
      case EP_ERROR_KEYBASEISINVALID:
        sError = L"EP_ERROR_KEYBASEISINVALID";
        break;
      case EP_ERROR_CURRENTDATEISINVALID:
        sError = L"EP_ERROR_CURRENTDATEISINVALID";
        break;
      case EP_ERROR_EXPIRATIONDATEISINVALID:
        sError = L"EP_ERROR_EXPIRATIONDATEISINVALID";
        break;
      case EP_ERROR_KEYISINVALID:
        sError = L"EP_ERROR_KEYISINVALID";
        break;
      case EP_ERROR_HARDWAREID:
        sError = L"EP_ERROR_HARDWAREID";
        break;
      case EP_ERROR_HARDWAREBUFFEREMPTY:
        sError = L"EP_ERROR_HARDWAREBUFFEREMPTY";
        break;
      case EP_ERROR_HARDWAREIDINVALIDFORKEY:
        sError = L"EP_ERROR_HARDWAREIDINVALIDFORKEY";
        break;
      case EP_ERROR_PROJECTFILENOTFOUND:
        sError = L"EP_ERROR_PROJECTFILENOTFOUND";
        break;
      case EP_ERROR_INVALIDPROJECTFILE:
        sError = L"EP_ERROR_INVALIDPROJECTFILE";
        break;
      case EP_ERROR_EXECUTIONSNUMBERINVALID:
        sError = L"EP_ERROR_EXECUTIONSNUMBERINVALID";
        break;
      case EP_ERROR_DAYSNUMBERINVALID:
        sError = L"EP_ERROR_DAYSNUMBERINVALID";
        break;
      case EP_ERROR_COUNTRYCODEINVALID:
        sError = L"EP_ERROR_COUNTRYCODEINVALID";
        break;
      case EP_ERROR_RUNTIMEINVALID:
        sError = L"EP_ERROR_RUNTIMEINVALID";
        break;
      case EP_ERROR_GLOBALTIMEINVALID:
        sError = L"EP_ERROR_GLOBALTIMEINVALID";
        break;
      case EP_ERROR_INSTALLBEFOREINVALID:
        sError = L"EP_ERROR_INSTALLBEFOREINVALID";
        break;
      case EP_ERROR_INSTALLAFTERINVALID:
        sError = L"EP_ERROR_INSTALLAFTERINVALID";
        break;
      default:
        sError = L"Unknown error";
        break;
    }
    SetDlgItemTextW(IDC_EDITKEY, sError);
  }
}

Show/Hide C# (.NET) function example

        private void btnGenerateFP_Click(object sender, EventArgs e)
        {
            tbKey.Clear();
            if (tbUserInfo.Text == string.Empty)
            {
                MessageBox.Show("User info field is empty!");
                return;
            }
            Enigma_KeyGen_IDE.TKeyGenParamsW kg = new Enigma_KeyGen_IDE.TKeyGenParamsW();
            kg.KeyWithHyphens = cbHyphens.Checked;

            kg.Key = new string('\0', 2048);
            kg.KeyLen = kg.Key.Length;

            kg.RegInfo = tbUserInfo.Text;

            kg.UseKeyExpiration = cbExpiration.Checked;
            if (kg.UseKeyExpiration)
            {
                kg.ExpirationYear = dtpExpiration.Value.Year;
                kg.ExpirationMonth = dtpExpiration.Value.Month;
                kg.ExpirationDay = dtpExpiration.Value.Day;
            }
            // Hardware ID
            kg.UseHardwareLocking = cbHardware.Checked;
            if (kg.UseHardwareLocking)
            {
                kg.HardwareID = tbHardware.Text;
            }
            // Register After
            kg.UseRegisterAfter = cbRegisterAfter.Checked;
            if (kg.UseRegisterAfter)
            {
                kg.RegisterAfterYear = dtpRegisterAfter.Value.Year;
                kg.RegisterAfterMonth = dtpRegisterAfter.Value.Month;
                kg.RegisterAfterDay = dtpRegisterAfter.Value.Day;
            }
            // Register Before
            kg.UseRegisterBefore = cbRegisterBefore.Checked;
            if (kg.UseRegisterBefore)
            {
                kg.RegisterBeforeYear = dtpRegisterBefore.Value.Year;
                kg.RegisterBeforeMonth = dtpRegisterBefore.Value.Month;
                kg.RegisterBeforeDay = dtpRegisterBefore.Value.Day;
            }
            // Executions
            kg.UseExecutionsLimit = cbExecutions.Checked;
            if (kg.UseExecutionsLimit)
            {
                kg.ExecutionsCount = (int)udExecutions.Value;
            }
            // Days
            kg.UseDaysLimit = cbDays.Checked;
            if (kg.UseDaysLimit)
            {
                kg.DaysCount = (int)udDays.Value;
            }
            // Runtime
            kg.UseRunTimeLimit = cbRuntime.Checked;
            if (kg.UseRunTimeLimit)
            {
                kg.RunTimeMinutes = (int)udRuntime.Value;
            }
            // Global Time
            kg.UseGlobalTimeLimit = cbGlobalTime.Checked;
            if (kg.UseGlobalTimeLimit)
            {
                kg.GlobalTimeMinutes = (int)udGlobalTime.Value;
            }
            // Country
            kg.UseCountyLimit = cbCountry.Checked;
            if (kg.UseCountyLimit)
            {
                Enigma_KeyGen_IDE ide = new Enigma_KeyGen_IDE();
                kg.CountryCode = ide.KEY_COUNTRIES[comCountries.SelectedIndex].Code;
            }

            kg.EncryptedSections = new bool[Enigma_KeyGen_IDE.NUMBER_OF_CRYPTED_SECTIONS];
            kg.EncryptedSections[0] = cbSection1.Checked;
            kg.EncryptedSections[1] = cbSection2.Checked;
            kg.EncryptedSections[2] = cbSection3.Checked;
            kg.EncryptedSections[3] = cbSection4.Checked;
            kg.EncryptedSections[4] = cbSection5.Checked;
            kg.EncryptedSections[5] = cbSection6.Checked;
            kg.EncryptedSections[6] = cbSection7.Checked;
            kg.EncryptedSections[7] = cbSection8.Checked;
            kg.EncryptedSections[8] = cbSection9.Checked;
            kg.EncryptedSections[9] = cbSection10.Checked;
            kg.EncryptedSections[10] = cbSection11.Checked;
            kg.EncryptedSections[11] = cbSection12.Checked;
            kg.EncryptedSections[12] = cbSection13.Checked;
            kg.EncryptedSections[13] = cbSection14.Checked;
            kg.EncryptedSections[14] = cbSection15.Checked;
            kg.EncryptedSections[15] = cbSection16.Checked;

            // Generate reg. key

            uint dwResult = Enigma_KeyGen_IDE.KG_GenerateRegistrationKeyFromProjectW("default.enigma", ref kg);
            if (dwResult == Enigma_KeyGen_IDE.EP_NO_ERROR)
            {
                tbKey.Text = kg.Key;
            }
            else
            {
                switch (dwResult)
                {
                    case Enigma_KeyGen_IDE.EP_ERROR_UNKNOWN:
                        tbKey.Text = "EP_ERROR_UNKNOWN";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_KEYBUFFEREMPTY:
                        tbKey.Text = "EP_ERROR_KEYBUFFEREMPTY";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_KEYBUFFERISLESS:
                        tbKey.Text = "EP_ERROR_KEYBUFFERISLESS";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_REGINFOEMPTY:
                        tbKey.Text = "EP_ERROR_REGINFOEMPTY";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_REGINFOTOOLARGE:
                        tbKey.Text = "EP_ERROR_REGINFOTOOLARGE";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_PRIVATEKEYISNOTSET:
                        tbKey.Text = "EP_ERROR_PRIVATEKEYISNOTSET";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_PUBLICKEYISNOTSET:
                        tbKey.Text = "EP_ERROR_PUBLICKEYISNOTSET";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_PRIVATEKEYISINVALID:
                        tbKey.Text = "EP_ERROR_PRIVATEKEYISINVALID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_PUBLICKEYISINVALID:
                        tbKey.Text = "EP_ERROR_PUBLICKEYISINVALID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_KEYMODEISINVALID:
                        tbKey.Text = "EP_ERROR_KEYMODEISINVALID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_KEYBASEISINVALID:
                        tbKey.Text = "EP_ERROR_KEYBASEISINVALID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_CURRENTDATEISINVALID:
                        tbKey.Text = "EP_ERROR_CURRENTDATEISINVALID";
                        break;

                    case Enigma_KeyGen_IDE.EP_ERROR_EXPIRATIONDATEISINVALID:
                        tbKey.Text = "EP_ERROR_EXPIRATIONDATEISINVALID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_KEYISINVALID:
                        tbKey.Text = "EP_ERROR_KEYISINVALID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_HARDWAREID:
                        tbKey.Text = "EP_ERROR_HARDWAREID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_HARDWAREBUFFEREMPTY:
                        tbKey.Text = "EP_ERROR_HARDWAREBUFFEREMPTY";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_HARDWAREIDINVALIDFORKEY:
                        tbKey.Text = "EP_ERROR_HARDWAREIDINVALIDFORKEY";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_PROJECTFILENOTFOUND:
                        tbKey.Text = "EP_ERROR_PROJECTFILENOTFOUND";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_INVALIDPROJECTFILE:
                        tbKey.Text = "EP_ERROR_INVALIDPROJECTFILE";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_EXECUTIONSNUMBERINVALID:
                        tbKey.Text = "EP_ERROR_EXECUTIONSNUMBERINVALID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_DAYSNUMBERINVALID:
                        tbKey.Text = "EP_ERROR_DAYSNUMBERINVALID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_COUNTRYCODEINVALID:
                        tbKey.Text = "EP_ERROR_COUNTRYCODEINVALID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_RUNTIMEINVALID:
                        tbKey.Text = "EP_ERROR_RUNTIMEINVALID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_GLOBALTIMEINVALID:
                        tbKey.Text = "EP_ERROR_GLOBALTIMEINVALID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_INSTALLBEFOREINVALID:
                        tbKey.Text = "EP_ERROR_INSTALLBEFOREINVALID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_INSTALLAFTERINVALID:
                        tbKey.Text = "EP_ERROR_INSTALLAFTERINVALID";
                        break;
                    default:
                        tbKey.Text = "Unknown error";
                        break;
                }
            }
        }

See function examples in the installation folder, Examples\KeygenUnicode subfolder.


TKeyVerifyParams type

TKeyVerifyParams structure is used by KG_VerifyRegistrationInfo and KG_VerifyRegistrationInfoFromProject to verify registration information.

Structure description

KeyMode

(input parameter) mode of registration key (RSA 512/768/1024/2048/3072/4096). It may have the following values (see Registration Features - Common Registration key safety/length value):

RM_512 = 0;
RM_768 = 1;
RM_1024 = 2;
RM_2048 = 3;
RM_3072 = 4;
RM_4096 = 5;
KeyBase

(input parameter) base of registration key (Base 2/8/16/32/64). It may have the following values (see Registration Features - Common Registration key output base value):

RB_2 = 0;
RB_8 = 1;
RB_16 = 2;
RB_32 = 3;
RB_64 = 4;
Key

(input parameter) pointer to the memory where the registration key will be placed. The registration key will be represented as ANSI, null terminated string. Please be sure that the buffer allocated for the registration key has sufficient size, we recommend allocating a buffer at least 2048 bytes long;

KeyLen | (input parameter) size of registration key buffer;
RegInfo

(input parameter) pointer to the memory where the registration name info is placed ;

RegInfoLen | (input parameter) size of registration info;
CreationYear | (output parameter) the year when the key was created
CreationMonth | (output parameter) the month when the key was created
CreationDay | (output parameter) the day when the key was created
UseKeyExpiration | (output parameter) if the value is 0, then the key does not have expiration, if the value is 1, then the key is time-limited. The key will expire on the date specified in the ExpirationYear, ExpirationMonth, ExpirationDay parameters (see Creating Keys);
ExpirationYear | (output parameter) year of key expiration date;
ExpirationMonth | (output parameter) month of key expiration date;
ExpirationDay | (output parameter) day of key expiration date;
UseHardwareLocking

(input parameter) if the key is hardware-locked, set this parameter to 1, otherwise it should be 0 (see Creating Keys);
HardwareIDType | (input parameter) pointer to ANSI, null terminated hardware id string;
UseExecutionsLimit

(output parameter) key is executions-limited; the parameter is 1 if the key is limited, and 0 if it is not (see Creating Keys);
ExecutionsCount | (output parameter) number of executions the registration key is limited to;
UseDaysLimit

(output parameter) key is days-limited; the parameter is 1 if the key is limited, and 0 if it is not (see Creating Keys);
DaysCount | (output parameter) number of days the registration key is limited to;
UseRunTimeLimit

(output parameter) key is run-time-limited; the parameter is 1 if the key is limited, and 0 if it is not (see Creating Keys);
RunTimeMinutes | (output parameter) number of run-time minutes the registration key is limited to;
UseGlobalTimeLimit

(output parameter) key is global time-limited; the parameter is 1 if the key is limited, and 0 if it is not (see Creating Keys);
GlobalTimeMinutes | (output parameter) number of global time minutes the registration key is limited to;
UseCountyLimit

(output parameter) key is country-limited; the parameter is 1 if the key is limited, and 0 if it is not (see Creating Keys);
CountryCode | (output parameter) the country code the registration key is limited to (see Enigma API EP_MiscCountryCode to get the code of a particular country);
UseRegisterAfter | (output parameter) the registration key has Register After date; the parameter is 1 if true, and 0 if false. The Register After date is specified in the RegisterAfterYear, RegisterAfterMonth, RegisterAfterDay parameters (see Creating Keys);
RegisterAfterYear | (output parameter) year of Register After date;
RegisterAfterMonth | (output parameter) month of Register After date;
RegisterAfterDay | (output parameter) day of Register After date;
UseRegisterBefore | (output parameter) the registration key has Register Before date; the parameter is 1 if true, and 0 if false. The Register Before date is specified in the RegisterBeforeYear, RegisterBeforeMonth, RegisterBeforeDay parameters (see Creating Keys);
RegisterBeforeYear | (output parameter) year of Register Before date;
RegisterBeforeMonth | (output parameter) month of Register Before date;
RegisterBeforeDay | (output parameter) day of Register Before date;
EncryptedConstant | (input parameter) integer constant, obtain it from the project file (see Registration Features - Common Registration, Information for Custom Keys Generator box, Encryption Constant value);
EncryptedSections | (output parameter) array of 16-byte length, which shows the encrypted sections, that will be decrypted with this registration key (see Creating Keys);
PublicKey | (input parameter) pointer to ANSI, null terminated string, which is a unique constant, should be obtained from the project (see Registration Features - Common Registration, Information for Custom Keys Generator box, Public Key value);

Definition

Show/Hide Delphi structure definition

type
  TKeyVerifyParams = record
    RegInfo             : pointer;  // {in} registration info/name
    RegInfoLen          : dword;    // {in} registration info/name size
    KeyMode             : dword;    // {in} key generation mode (~RSA ???)
    KeyBase             : dword;    // {in} key output base (Base ???)
    Key                 : pointer;  // {in} buffer for registration key
    KeyLen              : dword;    // {in} registration key size
    CreationYear        : dword;    // {out} key creation year
    CreationMonth       : dword;    // {out} key creation month
    CreationDay         : dword;    // {out} key creation day
    UseKeyExpiration    : boolean;  // {out} has key expiration date?
    ExpirationYear      : dword;    // {out} key expiration year
    ExpirationMonth     : dword;    // {out} key expiration month
    ExpirationDay       : dword;    // {out} key expiration day
    UseHardwareLocking  : boolean;  // {in/out} hardware locked key
    HardwareID          : PAnsiChar;// {in} pointer to null terminated hardware string
    UseExecutionsLimit  : boolean;  // {out} limit key by executions?
    ExecutionsCount     : dword;    // {out} number of executions
    UseDaysLimit        : boolean;  // {out} limit key by days?
    DaysCount           : dword;    // {out} number of days
    UseRunTimeLimit     : boolean;  // {out} limit key by run time?
    RunTimeMinutes      : dword;    // {out} run time minutes
    UseGlobalTimeLimit  : boolean;  // {out} limit key by global time?
    GlobalTimeMinutes   : dword;    // {out} global time minutes
    UseCountyLimit      : boolean;  // {out} limit key by country?
    CountryCode         : dword;    // {out} country code
    UseRegisterAfter    : boolean;  // {out} register key after date?
    RegisterAfterYear   : dword;    // {out} register after year
    RegisterAfterMonth  : dword;    // {out} register after month
    RegisterAfterDay    : dword;    // {out} register after day
    UseRegisterBefore   : boolean;  // {out} register key before date?
    RegisterBeforeYear  : dword;    // {out} register before year
    RegisterBeforeMonth : dword;    // {out} register before month
    RegisterBeforeDay   : dword;    // {out} register before day
    EncryptedConstant   : dword;    // Encryption Constant - should be extracted from project file
    EncryptedSections   : array [1..NUMBER_OF_CRYPTED_SECTIONS] of boolean; // Crypted sections
    PublicKey           : PAnsiChar;   // Public Key - should be extracted from project file
  end;
  PKeyVerifyParams = ^TKeyVerifyParams;

Show/Hide C++ structure definition

typedef struct _TKeyVerifyParams
{
    char* RegInfo;             // {in} registration info/name
    DWORD RegInfoLen;          // {in} registration info/name size
    DWORD KeyMode;             // {in} key generation mode (~RSA ???)
    DWORD KeyBase;             // {in} key output base (Base ???)
    char* Key;                 // {in} buffer for registration key
    DWORD KeyLen;              // {in} registration key size
    DWORD CreationYear;        // {out} key creation year
    DWORD CreationMonth;       // {out} key creation month
    DWORD CreationDay;         // {out} key creation day
    bool UseKeyExpiration;     // {out} has key expiration date?
    DWORD ExpirationYear;      // {out} key expiration year
    DWORD ExpirationMonth;     // {out} key expiration month
    DWORD ExpirationDay;       // {out} key expiration day
    bool UseHardwareLocking;   // {in} hardware locked key
    char* HardwareID;          // {in} pointer to null terminated hardware string
    bool UseExecutionsLimit;   // {out} limit key by executions?
    DWORD ExecutionsCount;     // {out} number of executions
    bool UseDaysLimit;         // {out} limit key by days?
    DWORD DaysCount;           // {out} number of days
    bool UseRunTimeLimit;      // {out} limit key by run time?
    DWORD RunTimeMinutes;      // {out} run time minutes
    bool UseGlobalTimeLimit;   // {out} limit key by global time?
    DWORD GlobalTimeMinutes;   // {out} global time minutes
    bool UseCountyLimit;       // {out} limit key by country?
    DWORD CountryCode;         // {out} country code
    bool UseRegisterAfter;     // {out} register key after date?
    DWORD RegisterAfterYear;   // {out} register after year
    DWORD RegisterAfterMonth;  // {out} register after month
    DWORD RegisterAfterDay;    // {out} register after day
    bool UseRegisterBefore;    // {out} register key before date?
    DWORD RegisterBeforeYear;  // {out} register before year
    DWORD RegisterBeforeMonth; // {out} register before month
    DWORD RegisterBeforeDay;   // {out} register before day
    DWORD EncryptedConstant;   // {in} Encryption Constant - should be extracted from project file
    bool EncryptedSections[NUMBER_OF_CRYPTED_SECTIONS]; // {out} Crypted sections
    char* PublicKey;           // {in} Public Key - should be extracted from project file
} TKeyVerifyParams, *PKeyVerifyParams;

Show/Hide C# (.NET) structure definition

    public struct TKeyVerifyParams
    {
        public string RegInfo;           // {in} registration info/name
        public Int32 RegInfoLen;         // {in} registration info/name size
        public Int32 KeyMode;            // {in} key generation mode (~RSA ???)
        public Int32 KeyBase;            // {in} key output base (Base ???)
        public string Key;               // {in} buffer for registration key
        public Int32 KeyLen;             // {in} registration key size
        public Int32 CreationYear;       // {out} key creation year
        public Int32 CreationMonth;      // {out} key creation month
        public Int32 CreationDay;        // {out} key creation day
        public bool UseKeyExpiration;    // {out} has key expiration date?
        public Int32 ExpirationYear;     // {out} key expiration year
        public Int32 ExpirationMonth;    // {out} key expiration month
        public Int32 ExpirationDay;      // {out} key expiration day
        public bool UseHardwareLocking;  // {in} hardware locked key
        public string HardwareID;        // {in} pointer to null terminated hardware string
        public bool UseExecutionsLimit;  // {out} limit key by executions?
        public Int32 ExecutionsCount;    // {out} number of executions
        public bool UseDaysLimit;        // {out} limit key by days?
        public Int32 DaysCount;          // {out} number of days
        public bool UseRunTimeLimit;     // {out} limit key by run time?
        public Int32 RunTimeMinutes;     // {out} run time minutes
        public bool UseGlobalTimeLimit;  // {out} limit key by global time?
        public Int32 GlobalTimeMinutes;  // {out} global time minutes
        public bool UseCountyLimit;      // {out} limit key by country?
        public Int32 CountryCode;        // {out} country code
        public bool UseRegisterAfter;    // {out} register key after date?
        public Int32 RegisterAfterYear;  // {out} register after year
        public Int32 RegisterAfterMonth; // {out} register after month
        public Int32 RegisterAfterDay;   // {out} register after day
        public bool UseRegisterBefore;   // {out} register key before date?
        public Int32 RegisterBeforeYear; // {out} register before year
        public Int32 RegisterBeforeMonth;// {out} register before month
        public Int32 RegisterBeforeDay;  // {out} register before day
        public Int32 EncryptedConstant;  // {in} Encryption Constant - should be extracted from project file
        [MarshalAs(UnmanagedType.ByValArray, SizeConst = NUMBER_OF_CRYPTED_SECTIONS)]
        public byte[] EncryptedSections; // {out} Crypted sections
        public string PublicKey;         // {in} Public Key - should be extracted from project file
    }

Show/Hide Visual Basic structure definition

Public Type TKeyVerifyParams
    RegInfo As String ' {in} registration info/name
    RegInfoLen As Long ' {in} registration info/name size
    KeyMode As Long ' {in} key generation mode (~RSA ???)
    KeyBase As Long ' {in} key output base (Base ???)
    Key As String ' {in} buffer for registration key
    KeyLen As Long ' {in} registration key size
    CreationYear As Long ' {out} key creation year
    CreationMonth As Long ' {out} key creation month
    CreationDay As Long ' {out} key creation day
    UseKeyExpiration As Boolean ' {out} has key expiration date?
    ExpirationYear As Long ' {out} key expiration year
    ExpirationMonth As Long ' {out} key expiration month
    ExpirationDay As Long ' {out} key expiration day
    UseHardwareLocking As Boolean ' {in} hardware locked key
    HardwareID As String ' {in} pointer to null terminated hardware string
    UseExecutionsLimit As Boolean ' {out} limit key by executions?
    ExecutionsCount As Long ' {out} number of executions
    UseDaysLimit As Boolean ' {out} limit key by days?
    DaysCount As Long ' {out} number of days
    UseRunTimeLimit As Boolean ' {out} limit key by run time?
    RunTimeMinutes As Long ' {out} run time minutes
    UseGlobalTimeLimit As Boolean ' {out} limit key by global time?
    GlobalTimeMinutes As Long ' {out} global time minutes
    UseCountyLimit As Boolean ' {out} limit key by country?
    CountryCode As Long ' {out} country code
    UseRegisterAfter As Boolean ' {out} register key after date?
    RegisterAfterYear As Long ' {out} register after year
    RegisterAfterMonth As Long ' {out} register after month
    RegisterAfterDay As Long ' {out} register after day
    UseRegisterBefore As Boolean ' {out} register key before date?
    RegisterBeforeYear As Long ' {out} register before year
    RegisterBeforeMonth As Long ' {out} register before month
    RegisterBeforeDay As Long ' {out} register before day
    EncryptedConstant As Long ' {in} Encryption Constant - should be extracted from project file
    EncryptedSections(NUMBER_OF_CRYPTED_SECTIONS - 1) As Byte ' {out} Crypted sections
    PublicKey As String ' {in} Public Key - should be extracted from project file
End Type


Function KG_VerifyRegistrationInfo

KG_VerifyRegistrationInfo is used for verifying the registration information and extracting registration key parameters from ANSI-based registration information. The function has one parameter - a pointer to the TKeyVerifyParams structure. Please note, the TKeyVerifyParams structure should contain secure parameters from the Enigma Protector project. These parameters are PublicKey, KeyMode, KeyBase and EncryptedConstant (see the Registration Features - Common panel, Information for Custom Generator box).

Return Values

EP_NO_ERROR=0 | the function succeeds, TKeyVerifyParams structure contains registration key parameters;
EP_ERROR_UNKNOWN=1 | unknown error
EP_ERROR_KEYBUFFEREMPTY=2 | memory buffer for registration key is not allocated
EP_ERROR_KEYBUFFERISLESS=3 | size of allocated memory for registration key is less than required
EP_ERROR_REGINFOEMPTY=4 | registration information is not specified
EP_ERROR_REGINFOTOOLARGE=5 | registration information is empty (has a null size)
EP_ERROR_PRIVATEKEYISNOTSET=6 | private key is not set
EP_ERROR_PUBLICKEYISNOTSET=7 | public key is not set
EP_ERROR_PRIVATEKEYISINVALID=8 | private key is invalid
EP_ERROR_PUBLICKEYISINVALID=9 | public key is invalid
EP_ERROR_KEYMODEISINVALID=10 | key mode is invalid
EP_ERROR_KEYBASEISINVALID=11 | key base is invalid
EP_ERROR_CURRENTDATEISINVALID=12 | current date is invalid
EP_ERROR_EXPIRATIONDATEISINVALID=13 | expiration date is invalid
EP_ERROR_KEYISINVALID=14 | key is invalid
EP_ERROR_HARDWAREID=15 | hardware id is invalid
EP_ERROR_HARDWAREBUFFEREMPTY=16 | hardware id buffer is empty
EP_ERROR_HARDWAREIDINVALIDFORKEY=17 | hardware id is invalid for the key
EP_ERROR_PROJECTFILENOTFOUND=18 | project file is not found
EP_ERROR_INVALIDPROJECTFILE=19 | project file is invalid
EP_ERROR_EXECUTIONSNUMBERINVALID=20 | executions number is invalid
EP_ERROR_DAYSNUMBERINVALID=21 | days number is invalid
EP_ERROR_COUNTRYCODEINVALID=22 | country code is invalid
EP_ERROR_RUNTIMEINVALID=23 | run-time value is invalid
EP_ERROR_GLOBALTIMEINVALID=24 | global time is invalid
EP_ERROR_INSTALLBEFOREINVALID=25 | register before date is invalid
EP_ERROR_INSTALLAFTERINVALID=26 | register after date is invalid

Definition

Show/Hide Delphi function definition

function KG_VerifyRegistrationInfo(kv : PKeyVerifyParams) : dword; external 'keygen.dll' name 'KG_VerifyRegistrationInfo';

Show/Hide C++ function definition

 extern  "C" __declspec( dllimport ) __stdcall int KG_VerifyRegistrationInfo(PKeyVerifyParams kv);

Show/Hide C# (.NET) function definition

public class Enigma_KeyGen_IDE
{
    [DllImport("keygen.dll", CallingConvention = CallingConvention.StdCall)]
    public static extern uint KG_VerifyRegistrationInfo(ref TKeyVerifyParams kv);
}

Show/Hide Visual Basic function definition

Public Declare Function KG_VerifyRegistrationInfo Lib "keygen.dll" (ByRef kv As TKeyVerifyParams) As Long

Examples

Show/Hide Delphi function example

procedure TfrmMain.btnVerifyClick(Sender: TObject);
var
  kv : TKeyVerifyParams;
  i : integer;
  dwResult : dword;
  stemp : string;
  sresult : string;
begin
  if eUserInfo.Text = '' then
  begin
    ShowMessage('User info field is empty!');
    Exit;
  end;
  if mKey.Text = '' then
  begin
    ShowMessage('Key field is empty!');
    Exit;
  end;

  kv.RegInfo := PAnsiChar(AnsiString(eUserInfo.Text));
  kv.RegInfoLen := strlen(PAnsiChar(kv.RegInfo));
  kv.Key := PAnsiChar(AnsiString(mKey.Text));
  kv.KeyLen := strlen(PAnsiChar(kv.Key));

    // Key mode
  kv.KeyMode := cbKeyMode.ItemIndex;
  // Key base
  kv.KeyBase := cbKeyBase.ItemIndex;
  case kv.KeyMode of
    RM_512:
    begin
      kv.PublicKey  := '0201B810DA4A1ADD4351378790A98138533067CP4S86R7D8THS45GBCVUM635EPRQRMYRP3DAA5DUPZ6ABDSFP7F5AC' +
                       'P7ERGH4A7Y6B6NW6NMMBZF83WVER9Y4MMBNLBQDKR7KFVLGLV067CFDQC' +
                       'WCHGQVVRN24DECEPBL96YJQJTVDCRTNQG3E4WW4GK4GQ5X5L5H88D3XYH' +
                       'CBRBNASPD3P5CNYFKFHBCSDHHD6WPTCC4XVSM5S88067C2JSTCMVT48C8' +
                       'HC7SHKGTFJBM28P6XTBCNWHMV6J6KN6W5Q9TQLVR285U6GVCAAUTZLRTP' +
                       'SRGDQ742B4742XF4MACRR747YDP5FZZ9D';
    end;
    RM_768:
    begin
      kv.PublicKey  := '0201B810DA4A1ADD4351378790A9813853309AEHRR66KMK99UEPX8C54WQFDZQ5Y96WUCVZYMXBC32SJV7T5SBPR54E' +
                       '2DBH8UD9RNHTJ9BLJV6NHX52W7PZDDTTJDDGF3YFVL7PJFL8RS8THTFDF' +
                       '4RY7K3QXLTMXMC8DDSRVRWBVMMP3UYKCDDC7KGL9PG509ACPTRQ4MMUKG' +
                       'DAUJFFFGSCBFLYK9X9E74M58PW5FG9B9RTLXJQ4STPVCHJTEH8BP557VZ' +
                       'PQYDBUZJXXJNGVZELFL4UL3LHHE8A645CK593DVWCQBSX4ZCCQ3ST8GCZ' +
                       'LW2729XK3NT7GST3LMQGXSHLDWCXE09AENVX2QTX3VLT6FWB4JND875XZ' +
                       'WQ26GW76TV3KVVHK7U489LLPBQ39HUWKMA65U3HKWBDHKBZEB525PHEH2' +
                       'YQHRZGNJAAYZXMWN8RNZ9T7VMZAJMP2V3S9NXZ9RHL96F7AT3NTMN36V4' +
                       'ACSFEN4DR6TJR95';
    end;
    RM_1024:
    begin
      kv.PublicKey  := '0201B810DA4A1ADD4351378790A981385330CDG9YQSEUK2HT546KWW46NHSCHMD2TNCSPVNSKGQC6CHDUSU9CC4LDPL' +
                       'TD3NLRVD3TFV9BU2SYBUBU9TXKLQ3CTKZE5GN9VFG37R9YNK2FE58K7ZY' +
                       'WTUJYFSJTBMDLLGA9GJ2LJXGHSS9CESGC2K69H65YQGAC7CRGF5T3CPLA' +
                       '5BDJZKVCUWPZRNA2DN7L956LZVZBQUDPX6PF30CDBH26Z82VE4QQ8N85L' +
                       'QHYJYYCJ6WQ89H9K9VVQX925SG5FJ79AGVZB6M8TTFKCJ56FAREP8GSTC' +
                       'NKWCXEALDP9Y2ZLS9QKZV8JRNDHG9D8BRDSCTMDQK9NLAPZ9TGYFS9G7U' +
                       'LXHYJF7F9A89HPXGTU2N4FQQJL98WZ5QND2KTEMMUUZFAX953HCGNSWUW' +
                       'U2M7LBEWZSH9GW5SC0CDJDY2HC4HJYUSVTAVXZ7MYVJWF3CU9WC3SVPSL' +
                       '29WF46DVS2SYKSSAMATPPYGJDE3PBFMGS34CXWQSXKCEAE63L2EXTS9NE' +
                       '2G597XASY3S34XMYST5YZF4THUTYT5DY9UKKXU6PH8MLXRPZMPMMR83JU' +
                       'X2WGNEW8ZGL4SKUCUB8CEAB6UZ4FB66WTP3B64VMX7XG75T4Y35479';
    end;
    RM_2048:
    begin
      kv.PublicKey  := '0201B810DA4A1ADD4351378790A98138533199H9KZC4CQ5ZKPEGYDW2EHN5AKZA5G5KP4HU8USWJR8XWW7MCH7244RV' +
                       'PSXFHVU6YQRK4LPUHM497XJYPLLA3DHUZWXK3CB5SUYF75NPYLTNPRUAP' +
                       'CTVDHAKYWTRQ97HES2E59WDN2LJKFYA2K8BGFSBHP4A6BF5FSDTS8NWLL' +
                       'C5NEQ76NJ9BAMWXG55UPFFMRQZTU5KV2G6LSPQUJJWA9U4LJ5SCJ9M9ZQ' +
                       'Z6K7LZA9UAMJ533UQ5J3JPNQAUWJGZFRFCTGAGSBWPWRRF9HRGF9MCX55' +
                       'QRYGPYMRE6DBJ65SJDX34FVPYWWKWQ48MCKXYXPHQ23BJ42U8ZMDD8CG5' +
                       'DPHZQ5XTXUKA277XK6PKSTLJ88ZZ9EBXH62REMRZZRGNPKHYM34RW722S' +
                       'SZHMPFKY7X8UZ19ADGX3UQ7X444XH7MZXEZYW2YLFHR8YL3PTCXVSYX89' +
                       'ZXN7KW2XNBE8XS3TQRGZVF6KA5USH56NEZYH5RNWBBPVE9LD6H42RQWR5' +
                       'YVQMT5EQYQTK6YM9V8DA5BJCLGGZ2UGD6NPA2X3SNUS47F7HJBNBCWHRA' +
                       'YPPCQ5HWCJNPDHUDQMRN2P6PWJFWJ6CLVNK8HXEFLE4ENPXAFN89CRS43' +
                       'RUMVGDJQCSRB535XYCS6BZYLA9Q6HJV425F26XXHRGA7C8R8BVMELAPEH' +
                       '5DSA9KXTCV4H2RNVDFHG3YJSERZVFPWHYA823LUBENBL5U3J4LJX2KQLW' +
                       'L5XGGESPSE2FQWKSQ4NUCDLBEJPQAT2A2477DYS2XEXKLYEAKUN22622C' +
                       'RLBCAHPFNEV2FJ2H8N3JQGXJRGP19AFHGRW6SS2ZSFYK8EZAPVYL4MCP4' +
                       '6UMR64Y9T89FHWEPXBRHKWJCSNNNGPU984J5XW4BWTU6PDWPN24W8RU55' +
                       'A9C3U9H7VHS5PFURASHBT4JAEE5ZKJBSYMCMDVBLU973R72RVPA6U96A2' +
                       'LX8HMASVST9RVJ7W66V4DYWRDZZQ3673W7C7LVF68TWPLNMYEUQ8FDZRN' +
                       'P38D9BX5YA3VENETDUUUMR9U7FFP4NZM7G4Y6J6EASK5SAXXTRMZ8F3AH' +
                       '5FC54E543N739BY5KVZQM7JZWD2P2HPE7BDRMM9JFCGPBWWASTZ7UDNRV' +
                       '6AFHVMBR9AGAERE9M6W6S2ZT8PBTABPDCKBPPPV6QW9DRXZUGAHDDRRSY' +
                       'XM4YXQ2QJX6CL33N7RV8846LK8A3DFLDXWZ2NKF8V';
    end;
    RM_3072:
    begin
      kv.PublicKey  := '0201B810DA4A1ADD4351378790A98138533267BJBN6W8SY33Y47RWJHWS385XWRV9TSVSB5EM7ECZYNSJ44ZKSD8KV4' +
                       '6Y9T6TNC6QMDW4V6DBMADU3YUKLP88TCLEUD9FTEUHGXM6T57AQ2EMB59' +
                       'UPQVNSUT7Z4EHAMDQ6N77VK2A6P847MMWJH9E7C5XX6FNF6MHGWERPWQV' +
                       '9ZLVR9Z7X5D5Z2XQL6MBM7BDCT2DEDVRBFNDDBLG6LHZ9APM48LS5TKTJ' +
                       'AGDYFDRVHEGTDH47PCLL8YJ4ZAWCB59F8BN5PZL3NQACP32G3YNBX5E3J' +
                       '7S28XLRGAX55ZML5XE6Q68EUAL38VUBJ2MZ2UGCCHM7CE6S99N44X9RMV' +
                       '7B55HULJ4KHPFYSBDUSPQTCWGS76BEQST2QCZDZ2T4FBA4YUJFF47AACE' +
                       'A4EEFESEYWN48UZCSDZAMGSU5VB9UJKR2XQUSDFS3TNG9QKURQWS7N5Q3' +
                       'VPYT4QAGGQ5GW2MMXHDJYW55FQPHSS255GVJ7WLLP85JHS8K6DVTJWB4W' +
                       '4Y8ZEFF7KP6W74PAA8FVPZVDW4RKGMQ8V56Q6R4V34XFE5HR4FZS8GZ6R' +
                       '36RKW6WN34S2AHR9LCGF8LULB7ZN6NC2AA5RPDZYGWSPPME6267CGLZCP' +
                       'GG98W557RXCDWAETJHDCRPUXX7AD3E8SL9WMGBV9QFHMSV9UFV7H9NTX3' +
                       'QYV95CN9P9DSYQWL35R2BWB4GKW6CTWVB2X6WH3P2WFBE6X55KBLAMDB3' +
                       'SRDSDVY37GKH78MUHY7KDJDC8SJU5FUQRYZ49ULX3YSZL7E284GFVZSGD' +
                       'FTTQNR6VMBM3LLR78SUSVMJW88XT2K4UHEATRU3V9MMR2VGNGCY9S6R7M' +
                       '4ELNPEBBMQP2HVPLY5M5VPA92V7NU8ZZ58YYTW5QK9USZ5LV59UZGB2CF' +
                       'DPZ6HFYU5WB7UU3UYWVNSNKM3W7GBYKJP8TMFW2YN6GNSSE4ZKFVZRLUT' +
                       '8QPZBBEQT5H9H5Z53D7QV4AJTKTX4EMW62TDWXQVK24JZPSG2VXKCMYZL' +
                       'BUASE25R3EEK9KBLJ8VX83ZXGTBL5CCDBY33HJ6FKX8AW3WPRX3XTCS9G' +
                       '2B9SVK2XFFKNSPGFG6FZNS8P2HERFGFL79DKUZZFWHFH4H9UZ7F7F6W3Z' +
                       'WN84JRRA7SU8T89EQMRBEPVYMMGLGSUMFWWMEDLJM5EGP5WEX9LDUAQXS' +
                       '55LKDQVRKX4R8NNBHSYBHSNMFYA2C6KGQQFK3TN267DPSZT3PTKHTLNMU' +
                       'V2YYZZRX3953LPWAKYF8LJUVMEQT3ZC4F9SWMYGUHG6XX66PJFQWSRUW2' +
                       'C79YLGZ6ZAFS7HLXBTH55UD3EGFBZQ5CLNJDZTEJACDVBCM5FQBTX4DKK' +
                       'UDGNSMWWLC5UMQRHW89CTU5636WYDXVZZDAUZ529458LDN2DAR9QADWRZ' +
                       'UTU8MCKN8ACH3R36YKE52DDF67SM5UDUH7PTATHXE65UCGFRCV49UTF29' +
                       'BGDSUWGRMC839HUZYQVAG985YUF5KJCAVGKRD8E4YMPJ38KR6HD2KHDGY' +
                       'PJDMJMN4Y3DTJW5MYX3VUPF32637LMAWFM4QCU7BMP74SCF4N5QXZZVBE' +
                       'LAQMPYMJC2ZWJ9XFV33YXTTPH3SG9KMUABLL83P7L3UBVM763XJPR5UEH' +
                       'DZ73XJUGR9QP6299K5PU46XGVWKWFAKWYMRXUSLCFJ3WQTEC6QJH6E5V8' +
                       'X2RMA5TXGSBEWLGSMNQ2SH6G9MLKK4S486DN4M4QVDTYTM4JQETAJQGP7' +
                       '6NUR4UNDXR4W4JQSNWDTUGX69SEDC3AL8ZF4TJBQQRXSX2A86UUWCDCFH' +
                       'JE94A8EP3Q6A2QTYKEE62MV4VJB2AB';
    end;
    RM_4096:
    begin
      kv.PublicKey  := '0201B810DA4A1ADD4351378790A98138533334BN75EUD4LFWYFVNFGBRCEMKKXG62QRBXL8GMHQ975B68FJVEMNXQQ7' +
                       'RKR7RCZMWDVP86QPB3LR49G9BM7EUUZXNCRZBXRF4PEY3RX6UXT4X286K' +
                       'WMR7AMEE6QNP9AEHGWJT9AVU3F62F37B5GVX2BQF73QWHRFQSQ6XMRP6M' +
                       'ZDRQ8JT89UF3YRK5UL34MM3L8HLDTWAJF5YY7MRWJUFDQRK9JNCJ6C9KJ' +
                       'WRE5ACQSNS24NEAHDYKS3AK75HBCTKP9NR2CSL7Q9PPXM4TF7L37USP77' +
                       'Z7WER6JY67F7YGKTP6MFRMKK9H8XFPZ9XWKK97XCFXK7AW4TB96WGEH4B' +
                       'YPF9QRF2DGC3LCHW8VTD2EMHVRDR6EEBUG8R4XYKJPLBPRCJP445DU2BW' +
                       'JWELKAY45GKDU5HLTTDTWRH2JFKJ7AVAKLPEELN29YHX5JR773P9ERW7N' +
                       'UFMWDKD4UL4YPU5QW2L4A7ZN3E8ZDQVEZUR6ZRDQXRLQRLUNHVB4XGBWD' +
                       'HM79NGJARHDBQJCD8NWZCWPBY26QARP7A5S48DCV29F7MUTHU3YAHYVS7' +
                       'ZPGXJZZA5HBBY4K5BQPUG6MVCBG8H3C7VL8KH9EH58NUVCE6F2CGMSM94' +
                       '4CQDKNVGWWWRNK4DG26UT88Y9ULUPJ25G9KLTQPK3TBXZEK43X8KPMJT8' +
                       'DF6MTQ5RB94XR2BT9H9NYYTXL29GF8KZY9QNHAW4LTT2RDQTD2ELWPSV4' +
                       '4AND9K8G5VKLQ287UBEVHA82CMSMGQQBMNQZVAZ9G8T5TD6G9F7XQHMJT' +
                       'HCL6PFEDUW5MN9JASF2EKPT2H33325A3SFGGM5C3RYKZSYSSQC5FLHNX9' +
                       'VHN4HQVWD66YECY4R97JZHQALRTCHXUWH85LSJCCTQZT8JF52FHG6FV9J' +
                       'UJWEU24K9Z7SKYTYA9NH7GW29FSNKUK3DMFXY48VEYZVDRTTMLFYSJH8B' +
                       'RQXV72REYGSM6SLX89EVQ52CN9N8YDLWHAWCDDNM89YN2FCRTLE8688XN' +
                       'F4MZMFE6GP9JK2JTFJVUKBLES2ZVWSBCJE9N3D7DG9LL9Z3U42QFJJPE2' +
                       'HE5XCRY25UND96R9D7655ZBSCPF796FJZ4GPLY7AMZLGLR77GRP467ELK' +
                       'PXSZ9ZF8MUYFDHV4EFACPZ79CDFTYW56NE9JDWDVUMNLY9EXDSF8ZNABE' +
                       'MDQU6T9RVLTNRMZJJ8EJSUM9TV8YA6MNWF2Y66MD3VQ9L662F5X6VE9ZC' +
                       'PPRTNMEV2DG9BUMFMSL7PUR9H5QG6VVBDBMEU3PLABL57HMSQ5C83E9X8' +
                       'RTPY4QSEH2H7R2QDJHT5LQSFNQJL2NZ24GLNTFXG468WC5UUTDD68G8HM' +
                       '477Z8P4F9ZZHUGZ6VPFF32A2MPWY8LPXNECCKM9EEVLDDPUJ8LXN2AE6K' +
                       'Y2Q42FVBCJM9GQTXNRHBED735KCFD4YGV4U5U3LJD6NJ886W6XQLWH3G7' +
                       '3VZ6T5YDUQP6DA5ZHLKQSGATDJHUWC2ELTE7QJFXH8H9EAQYZPPMW76JG' +
                       'Z48UBND9VXFXZMSGBNWQPNQG7E4TCBDMVKUSA9TTVSNLN3DXEZNXH787R' +
                       'N7XHFBJNZ5W74DUMNBYVHEQDYMZBQCFMS8LGSDUAU6QE9DD5Q334BX62T' +
                       'JP5WQQDS2ZEWW76XW7VMLX3L7V9UVD7RL297VDBVRFPQ5MYA3YFVBVNVA' +
                       'R5TJXMQ4X2U2PW6UWSKBXT58HG3QPZM2RVEX2PDMCVJDFTJMXR9NPLW4C' +
                       '6AE4Q9A8TTAQ68BSN9WWTFFTSX68ECVARFPDBBH5DMP4KYFARTFVCSWNF' +
                       'FGAPBYYGFJA4MGHEDWTNE54MPGER7EPCZEV2ESJRMM6XDMFGABG97HECN' +
                       '3SZFUBRKCNDZ2TE9F6EERULRCDAV5EMY6KVY9NY9MYNPP2FQ5WFWLMRYD' +
                       '4TNYYHE6EDMQ6KK79HH5Q5KBW6DDQYYNUR365W2454CHEZWZAPU82SX4H' +
                       'KHNZXBRVWAT7G9CJBKHNBPSVEL67X8UJHBFHZH8ZD4NSEVFZM4Y768TJ6' +
                       'QP3BGEKLTY4UZUWHG63QMKVWAQW9E7WRFNJCH4XRD97JHNKMFUTRFVH68' +
                       'G5CKSMGC725AZ9CBSL2JX43P4EY44CMF56AJ6BEXVCJP2ZDWCT9G55K4D' +
                       'F24J7TTJMFXTQH95CBNX67CBPNWEKHCWQV6VD73Y9KCZHNBFUFS8TCYNN' +
                       'WXRGFKNVRDFUKWHDWDDTSPEW8YCKLPMX2GUV3N4JFJMUE6TSJR6Z53C9F' +
                       'SKZAY3EN7G66JPBF5E9S6Y7RQHPWZHSRDQ7XH87PHUJFLJFGD7WNE3Q9P' +
                       'EXMW33LVJBFEUXKNUB6SU7ZYCEX96XT8G27FLUV7XPV4JK64DWDJCX9WV' +
                       '4VL8CK23FQJ28UG9JUZTQJ3DRL32BTJVRD4LVQ6MK9LCE7ZZP925JK7ZD' +
                       '92SCV4DDJJ5EXMVBF';
    end;
  end;

  // Hardware ID
  kv.UseHardwareLocking := cbHardwareID.Checked;
  if kv.UseHardwareLocking then
  begin
    kv.HardwareID := PAnsiChar(AnsiString(eHardware.Text));
  end;

  // Secure constant (get it from project file)!
  kv.EncryptedConstant := 2113444489;

  dwResult := KG_VerifyRegistrationInfo(@kv);

  if dwResult = EP_NO_ERROR then
  begin
    sresult := 'Key is valid!'#13#10;
    sresult := format(sresult + 'Creation Date: %s'#13#10, [DateToStr(EncodeDate(kv.CreationYear, kv.CreationMonth, kv.CreationDay))]);
    if kv.UseKeyExpiration then
    begin
      sresult := format(sresult + 'Expiration Date: %s'#13#10, [DateToStr(EncodeDate(kv.ExpirationYear, kv.ExpirationMonth, kv.ExpirationDay))]);
    end;
    if kv.UseRegisterAfter then
    begin
      sresult := format(sresult + 'Register After Date: %s'#13#10, [DateToStr(EncodeDate(kv.RegisterAfterYear, kv.RegisterAfterMonth, kv.RegisterAfterDay))]);
    end;
    if kv.UseRegisterBefore then
    begin
      sresult := format(sresult + 'Register Before Date: %s'#13#10, [DateToStr(EncodeDate(kv.RegisterBeforeYear, kv.RegisterBeforeMonth, kv.RegisterBeforeDay))]);
    end;
    if kv.UseCountyLimit then
    begin
      for i := 0 to length(KEY_COUNTRIES) - 1 do
      begin
        if kv.CountryCode = KEY_COUNTRIES[i].Code then
        begin
          stemp := KEY_COUNTRIES[i].Name;
          break;
        end;
      end;
      sresult := format(sresult + 'Locked to country: %s'#13#10, [stemp]);
    end;
    if kv.UseExecutionsLimit then
    begin
      sresult := format(sresult + 'Executions limit: %d executions'#13#10, [kv.ExecutionsCount]);
    end;
    if kv.UseDaysLimit then
    begin
      sresult := format(sresult + 'Days limit: %d days'#13#10, [kv.DaysCount]);
    end;
    if kv.UseRunTimeLimit then
    begin
      sresult := format(sresult + 'Run-time limit: %d minutes'#13#10, [kv.RunTimeMinutes]);
    end;
    if kv.UseGlobalTimeLimit then
    begin
      sresult := format(sresult + 'Global Time limit: %d minutes'#13#10, [kv.GlobalTimeMinutes]);
    end;
    for i := 1 to NUMBER_OF_CRYPTED_SECTIONS do
    begin
      if kv.EncryptedSections[i] then
      begin
        sresult := format(sresult + 'Unlocked section #%d'#13#10, [i]);
      end;
    end;
  end else
  begin
    case dwResult of
      EP_ERROR_UNKNOWN                 : sresult := 'EP_ERROR_UNKNOWN                ';
      EP_ERROR_KEYBUFFEREMPTY          : sresult := 'EP_ERROR_KEYBUFFEREMPTY         ';
      EP_ERROR_KEYBUFFERISLESS         : sresult := 'EP_ERROR_KEYBUFFERISLESS        ';
      EP_ERROR_REGINFOEMPTY            : sresult := 'EP_ERROR_REGINFOEMPTY           ';
      EP_ERROR_REGINFOTOOLARGE         : sresult := 'EP_ERROR_REGINFOTOOLARGE        ';
      EP_ERROR_PRIVATEKEYISNOTSET      : sresult := 'EP_ERROR_PRIVATEKEYISNOTSET     ';
      EP_ERROR_PUBLICKEYISNOTSET       : sresult := 'EP_ERROR_PUBLICKEYISNOTSET      ';
      EP_ERROR_PRIVATEKEYISINVALID     : sresult := 'EP_ERROR_PRIVATEKEYISINVALID    ';
      EP_ERROR_PUBLICKEYISINVALID      : sresult := 'EP_ERROR_PUBLICKEYISINVALID     ';
      EP_ERROR_KEYMODEISINVALID        : sresult := 'EP_ERROR_KEYMODEISINVALID       ';
      EP_ERROR_KEYBASEISINVALID        : sresult := 'EP_ERROR_KEYBASEISINVALID       ';
      EP_ERROR_CURRENTDATEISINVALID    : sresult := 'EP_ERROR_CURRENTDATEISINVALID   ';
      EP_ERROR_EXPIRATIONDATEISINVALID : sresult := 'EP_ERROR_EXPIRATIONDATEISINVALID';
      EP_ERROR_KEYISINVALID            : sresult := 'EP_ERROR_KEYISINVALID           ';
      EP_ERROR_HARDWAREID              : sresult := 'EP_ERROR_HARDWAREID             ';
      EP_ERROR_HARDWAREBUFFEREMPTY     : sresult := 'EP_ERROR_HARDWAREBUFFEREMPTY    ';
      EP_ERROR_HARDWAREIDINVALIDFORKEY : sresult := 'EP_ERROR_HARDWAREIDINVALIDFORKEY';
      EP_ERROR_PROJECTFILENOTFOUND     : sresult := 'EP_ERROR_PROJECTFILENOTFOUND    ';
      EP_ERROR_INVALIDPROJECTFILE      : sresult := 'EP_ERROR_INVALIDPROJECTFILE     ';
      EP_ERROR_EXECUTIONSNUMBERINVALID : sresult := 'EP_ERROR_EXECUTIONSNUMBERINVALID';
      EP_ERROR_DAYSNUMBERINVALID       : sresult := 'EP_ERROR_DAYSNUMBERINVALID      ';
      EP_ERROR_COUNTRYCODEINVALID      : sresult := 'EP_ERROR_COUNTRYCODEINVALID     ';
      EP_ERROR_RUNTIMEINVALID          : sresult := 'EP_ERROR_RUNTIMEINVALID         ';
      EP_ERROR_GLOBALTIMEINVALID       : sresult := 'EP_ERROR_GLOBALTIMEINVALID      ';
      EP_ERROR_INSTALLBEFOREINVALID    : sresult := 'EP_ERROR_INSTALLBEFOREINVALID   ';
      EP_ERROR_INSTALLAFTERINVALID     : sresult := 'EP_ERROR_INSTALLAFTERINVALID    ';
      else sresult := 'Unknown error';
    end;
  end;
  ShowMessage(sresult);
end;

Show/Hide Borland C++ Builder function example

void __fastcall TfrmMain::btnVerifyClick(TObject *Sender)
{
  if (eUserInfo->Text == "")
  {
    ShowMessage("Registration info is empty!");
    return;
  }
  if (mKey->Text == "")
  {
    ShowMessage("Registration key is empty!");
    return;
  }

  TKeyVerifyParams kv;
  WORD wYear;
  WORD wDay;
  WORD wMonth;
  DWORD dwResult;

  // Clear params buffer
  memset(&kv, 0, sizeof(kv));
  // Key mode
  kv.KeyMode = cbKeyMode->ItemIndex;
  // Key base
  kv.KeyBase = cbKeyBase->ItemIndex;

  AnsiString asPublicKey;
  switch (kv.KeyMode)
  {
    case RM_512:
    {
      asPublicKey  =  "0201B810DA4A1ADD4351378790A98138533067CP4S86R7D8THS45GBCVUM635EPRQRMYRP3DAA5DUPZ6ABDSFP7F5AC";
      asPublicKey +=  "P7ERGH4A7Y6B6NW6NMMBZF83WVER9Y4MMBNLBQDKR7KFVLGLV067CFDQC";
      asPublicKey +=  "WCHGQVVRN24DECEPBL96YJQJTVDCRTNQG3E4WW4GK4GQ5X5L5H88D3XYH";
      asPublicKey +=  "CBRBNASPD3P5CNYFKFHBCSDHHD6WPTCC4XVSM5S88067C2JSTCMVT48C8";
      asPublicKey +=  "HC7SHKGTFJBM28P6XTBCNWHMV6J6KN6W5Q9TQLVR285U6GVCAAUTZLRTP";
      asPublicKey +=  "SRGDQ742B4742XF4MACRR747YDP5FZZ9D" + 0;
      break;
    }
    case RM_768:
    {
      asPublicKey  =   "0201B810DA4A1ADD4351378790A9813853309AEHRR66KMK99UEPX8C54WQFDZQ5Y96WUCVZYMXBC32SJV7T5SBPR54E";
      asPublicKey  +=  "2DBH8UD9RNHTJ9BLJV6NHX52W7PZDDTTJDDGF3YFVL7PJFL8RS8THTFDF";
      asPublicKey  +=  "4RY7K3QXLTMXMC8DDSRVRWBVMMP3UYKCDDC7KGL9PG509ACPTRQ4MMUKG";
      asPublicKey  +=  "DAUJFFFGSCBFLYK9X9E74M58PW5FG9B9RTLXJQ4STPVCHJTEH8BP557VZ";
      asPublicKey  +=  "PQYDBUZJXXJNGVZELFL4UL3LHHE8A645CK593DVWCQBSX4ZCCQ3ST8GCZ";
      asPublicKey  +=  "LW2729XK3NT7GST3LMQGXSHLDWCXE09AENVX2QTX3VLT6FWB4JND875XZ";
      asPublicKey  +=  "WQ26GW76TV3KVVHK7U489LLPBQ39HUWKMA65U3HKWBDHKBZEB525PHEH2";
      asPublicKey  +=  "YQHRZGNJAAYZXMWN8RNZ9T7VMZAJMP2V3S9NXZ9RHL96F7AT3NTMN36V4";
      asPublicKey  +=  "ACSFEN4DR6TJR95";
      break;
    }
    case RM_1024:
    {
      asPublicKey  =   "0201B810DA4A1ADD4351378790A981385330CDG9YQSEUK2HT546KWW46NHSCHMD2TNCSPVNSKGQC6CHDUSU9CC4LDPL";
      asPublicKey  +=  "TD3NLRVD3TFV9BU2SYBUBU9TXKLQ3CTKZE5GN9VFG37R9YNK2FE58K7ZY";
      asPublicKey  +=  "WTUJYFSJTBMDLLGA9GJ2LJXGHSS9CESGC2K69H65YQGAC7CRGF5T3CPLA";
      asPublicKey  +=  "5BDJZKVCUWPZRNA2DN7L956LZVZBQUDPX6PF30CDBH26Z82VE4QQ8N85L";
      asPublicKey  +=  "QHYJYYCJ6WQ89H9K9VVQX925SG5FJ79AGVZB6M8TTFKCJ56FAREP8GSTC";
      asPublicKey  +=  "NKWCXEALDP9Y2ZLS9QKZV8JRNDHG9D8BRDSCTMDQK9NLAPZ9TGYFS9G7U";
      asPublicKey  +=  "LXHYJF7F9A89HPXGTU2N4FQQJL98WZ5QND2KTEMMUUZFAX953HCGNSWUW";
      asPublicKey  +=  "U2M7LBEWZSH9GW5SC0CDJDY2HC4HJYUSVTAVXZ7MYVJWF3CU9WC3SVPSL";
      asPublicKey  +=  "29WF46DVS2SYKSSAMATPPYGJDE3PBFMGS34CXWQSXKCEAE63L2EXTS9NE";
      asPublicKey  +=  "2G597XASY3S34XMYST5YZF4THUTYT5DY9UKKXU6PH8MLXRPZMPMMR83JU";
      asPublicKey  +=  "X2WGNEW8ZGL4SKUCUB8CEAB6UZ4FB66WTP3B64VMX7XG75T4Y35479";
      break;
    }
    case RM_2048:
    {
      asPublicKey  =   "0201B810DA4A1ADD4351378790A98138533199H9KZC4CQ5ZKPEGYDW2EHN5AKZA5G5KP4HU8USWJR8XWW7MCH7244RV";
      asPublicKey  +=  "PSXFHVU6YQRK4LPUHM497XJYPLLA3DHUZWXK3CB5SUYF75NPYLTNPRUAP";
      asPublicKey  +=  "CTVDHAKYWTRQ97HES2E59WDN2LJKFYA2K8BGFSBHP4A6BF5FSDTS8NWLL";
      asPublicKey  +=  "C5NEQ76NJ9BAMWXG55UPFFMRQZTU5KV2G6LSPQUJJWA9U4LJ5SCJ9M9ZQ";
      asPublicKey  +=  "Z6K7LZA9UAMJ533UQ5J3JPNQAUWJGZFRFCTGAGSBWPWRRF9HRGF9MCX55";
      asPublicKey  +=  "QRYGPYMRE6DBJ65SJDX34FVPYWWKWQ48MCKXYXPHQ23BJ42U8ZMDD8CG5";
      asPublicKey  +=  "DPHZQ5XTXUKA277XK6PKSTLJ88ZZ9EBXH62REMRZZRGNPKHYM34RW722S";
      asPublicKey  +=  "SZHMPFKY7X8UZ19ADGX3UQ7X444XH7MZXEZYW2YLFHR8YL3PTCXVSYX89";
      asPublicKey  +=  "ZXN7KW2XNBE8XS3TQRGZVF6KA5USH56NEZYH5RNWBBPVE9LD6H42RQWR5";
      asPublicKey  +=  "YVQMT5EQYQTK6YM9V8DA5BJCLGGZ2UGD6NPA2X3SNUS47F7HJBNBCWHRA";
      asPublicKey  +=  "YPPCQ5HWCJNPDHUDQMRN2P6PWJFWJ6CLVNK8HXEFLE4ENPXAFN89CRS43";
      asPublicKey  +=  "RUMVGDJQCSRB535XYCS6BZYLA9Q6HJV425F26XXHRGA7C8R8BVMELAPEH";
      asPublicKey  +=  "5DSA9KXTCV4H2RNVDFHG3YJSERZVFPWHYA823LUBENBL5U3J4LJX2KQLW";
      asPublicKey  +=  "L5XGGESPSE2FQWKSQ4NUCDLBEJPQAT2A2477DYS2XEXKLYEAKUN22622C";
      asPublicKey  +=  "RLBCAHPFNEV2FJ2H8N3JQGXJRGP19AFHGRW6SS2ZSFYK8EZAPVYL4MCP4";
      asPublicKey  +=  "6UMR64Y9T89FHWEPXBRHKWJCSNNNGPU984J5XW4BWTU6PDWPN24W8RU55";
      asPublicKey  +=  "A9C3U9H7VHS5PFURASHBT4JAEE5ZKJBSYMCMDVBLU973R72RVPA6U96A2";
      asPublicKey  +=  "LX8HMASVST9RVJ7W66V4DYWRDZZQ3673W7C7LVF68TWPLNMYEUQ8FDZRN";
      asPublicKey  +=  "P38D9BX5YA3VENETDUUUMR9U7FFP4NZM7G4Y6J6EASK5SAXXTRMZ8F3AH";
      asPublicKey  +=  "5FC54E543N739BY5KVZQM7JZWD2P2HPE7BDRMM9JFCGPBWWASTZ7UDNRV";
      asPublicKey  +=  "6AFHVMBR9AGAERE9M6W6S2ZT8PBTABPDCKBPPPV6QW9DRXZUGAHDDRRSY";
      asPublicKey  +=  "XM4YXQ2QJX6CL33N7RV8846LK8A3DFLDXWZ2NKF8V";
      break;
    }
    case RM_3072:
    {
      asPublicKey  =   "0201B810DA4A1ADD4351378790A98138533267BJBN6W8SY33Y47RWJHWS385XWRV9TSVSB5EM7ECZYNSJ44ZKSD8KV4";
      asPublicKey  +=  "6Y9T6TNC6QMDW4V6DBMADU3YUKLP88TCLEUD9FTEUHGXM6T57AQ2EMB59";
      asPublicKey  +=  "UPQVNSUT7Z4EHAMDQ6N77VK2A6P847MMWJH9E7C5XX6FNF6MHGWERPWQV";
      asPublicKey  +=  "9ZLVR9Z7X5D5Z2XQL6MBM7BDCT2DEDVRBFNDDBLG6LHZ9APM48LS5TKTJ";
      asPublicKey  +=  "AGDYFDRVHEGTDH47PCLL8YJ4ZAWCB59F8BN5PZL3NQACP32G3YNBX5E3J";
      asPublicKey  +=  "7S28XLRGAX55ZML5XE6Q68EUAL38VUBJ2MZ2UGCCHM7CE6S99N44X9RMV";
      asPublicKey  +=  "7B55HULJ4KHPFYSBDUSPQTCWGS76BEQST2QCZDZ2T4FBA4YUJFF47AACE";
      asPublicKey  +=  "A4EEFESEYWN48UZCSDZAMGSU5VB9UJKR2XQUSDFS3TNG9QKURQWS7N5Q3";
      asPublicKey  +=  "VPYT4QAGGQ5GW2MMXHDJYW55FQPHSS255GVJ7WLLP85JHS8K6DVTJWB4W";
      asPublicKey  +=  "4Y8ZEFF7KP6W74PAA8FVPZVDW4RKGMQ8V56Q6R4V34XFE5HR4FZS8GZ6R";
      asPublicKey  +=  "36RKW6WN34S2AHR9LCGF8LULB7ZN6NC2AA5RPDZYGWSPPME6267CGLZCP";
      asPublicKey  +=  "GG98W557RXCDWAETJHDCRPUXX7AD3E8SL9WMGBV9QFHMSV9UFV7H9NTX3";
      asPublicKey  +=  "QYV95CN9P9DSYQWL35R2BWB4GKW6CTWVB2X6WH3P2WFBE6X55KBLAMDB3";
      asPublicKey  +=  "SRDSDVY37GKH78MUHY7KDJDC8SJU5FUQRYZ49ULX3YSZL7E284GFVZSGD";
      asPublicKey  +=  "FTTQNR6VMBM3LLR78SUSVMJW88XT2K4UHEATRU3V9MMR2VGNGCY9S6R7M";
      asPublicKey  +=  "4ELNPEBBMQP2HVPLY5M5VPA92V7NU8ZZ58YYTW5QK9USZ5LV59UZGB2CF";
      asPublicKey  +=  "DPZ6HFYU5WB7UU3UYWVNSNKM3W7GBYKJP8TMFW2YN6GNSSE4ZKFVZRLUT";
      asPublicKey  +=  "8QPZBBEQT5H9H5Z53D7QV4AJTKTX4EMW62TDWXQVK24JZPSG2VXKCMYZL";
      asPublicKey  +=  "BUASE25R3EEK9KBLJ8VX83ZXGTBL5CCDBY33HJ6FKX8AW3WPRX3XTCS9G";
      asPublicKey  +=  "2B9SVK2XFFKNSPGFG6FZNS8P2HERFGFL79DKUZZFWHFH4H9UZ7F7F6W3Z";
      asPublicKey  +=  "WN84JRRA7SU8T89EQMRBEPVYMMGLGSUMFWWMEDLJM5EGP5WEX9LDUAQXS";
      asPublicKey  +=  "55LKDQVRKX4R8NNBHSYBHSNMFYA2C6KGQQFK3TN267DPSZT3PTKHTLNMU";
      asPublicKey  +=  "V2YYZZRX3953LPWAKYF8LJUVMEQT3ZC4F9SWMYGUHG6XX66PJFQWSRUW2";
      asPublicKey  +=  "C79YLGZ6ZAFS7HLXBTH55UD3EGFBZQ5CLNJDZTEJACDVBCM5FQBTX4DKK";
      asPublicKey  +=  "UDGNSMWWLC5UMQRHW89CTU5636WYDXVZZDAUZ529458LDN2DAR9QADWRZ";
      asPublicKey  +=  "UTU8MCKN8ACH3R36YKE52DDF67SM5UDUH7PTATHXE65UCGFRCV49UTF29";
      asPublicKey  +=  "BGDSUWGRMC839HUZYQVAG985YUF5KJCAVGKRD8E4YMPJ38KR6HD2KHDGY";
      asPublicKey  +=  "PJDMJMN4Y3DTJW5MYX3VUPF32637LMAWFM4QCU7BMP74SCF4N5QXZZVBE";
      asPublicKey  +=  "LAQMPYMJC2ZWJ9XFV33YXTTPH3SG9KMUABLL83P7L3UBVM763XJPR5UEH";
      asPublicKey  +=  "DZ73XJUGR9QP6299K5PU46XGVWKWFAKWYMRXUSLCFJ3WQTEC6QJH6E5V8";
      asPublicKey  +=  "X2RMA5TXGSBEWLGSMNQ2SH6G9MLKK4S486DN4M4QVDTYTM4JQETAJQGP7";
      asPublicKey  +=  "6NUR4UNDXR4W4JQSNWDTUGX69SEDC3AL8ZF4TJBQQRXSX2A86UUWCDCFH";
      asPublicKey  +=  "JE94A8EP3Q6A2QTYKEE62MV4VJB2AB";
      break;
    }
    case RM_4096:
    {
      asPublicKey  =   "0201B810DA4A1ADD4351378790A98138533334BN75EUD4LFWYFVNFGBRCEMKKXG62QRBXL8GMHQ975B68FJVEMNXQQ7";
      asPublicKey  +=  "RKR7RCZMWDVP86QPB3LR49G9BM7EUUZXNCRZBXRF4PEY3RX6UXT4X286K";
      asPublicKey  +=  "WMR7AMEE6QNP9AEHGWJT9AVU3F62F37B5GVX2BQF73QWHRFQSQ6XMRP6M";
      asPublicKey  +=  "ZDRQ8JT89UF3YRK5UL34MM3L8HLDTWAJF5YY7MRWJUFDQRK9JNCJ6C9KJ";
      asPublicKey  +=  "WRE5ACQSNS24NEAHDYKS3AK75HBCTKP9NR2CSL7Q9PPXM4TF7L37USP77";
      asPublicKey  +=  "Z7WER6JY67F7YGKTP6MFRMKK9H8XFPZ9XWKK97XCFXK7AW4TB96WGEH4B";
      asPublicKey  +=  "YPF9QRF2DGC3LCHW8VTD2EMHVRDR6EEBUG8R4XYKJPLBPRCJP445DU2BW";
      asPublicKey  +=  "JWELKAY45GKDU5HLTTDTWRH2JFKJ7AVAKLPEELN29YHX5JR773P9ERW7N";
      asPublicKey  +=  "UFMWDKD4UL4YPU5QW2L4A7ZN3E8ZDQVEZUR6ZRDQXRLQRLUNHVB4XGBWD";
      asPublicKey  +=  "HM79NGJARHDBQJCD8NWZCWPBY26QARP7A5S48DCV29F7MUTHU3YAHYVS7";
      asPublicKey  +=  "ZPGXJZZA5HBBY4K5BQPUG6MVCBG8H3C7VL8KH9EH58NUVCE6F2CGMSM94";
      asPublicKey  +=  "4CQDKNVGWWWRNK4DG26UT88Y9ULUPJ25G9KLTQPK3TBXZEK43X8KPMJT8";
      asPublicKey  +=  "DF6MTQ5RB94XR2BT9H9NYYTXL29GF8KZY9QNHAW4LTT2RDQTD2ELWPSV4";
      asPublicKey  +=  "4AND9K8G5VKLQ287UBEVHA82CMSMGQQBMNQZVAZ9G8T5TD6G9F7XQHMJT";
      asPublicKey  +=  "HCL6PFEDUW5MN9JASF2EKPT2H33325A3SFGGM5C3RYKZSYSSQC5FLHNX9";
      asPublicKey  +=  "VHN4HQVWD66YECY4R97JZHQALRTCHXUWH85LSJCCTQZT8JF52FHG6FV9J";
      asPublicKey  +=  "UJWEU24K9Z7SKYTYA9NH7GW29FSNKUK3DMFXY48VEYZVDRTTMLFYSJH8B";
      asPublicKey  +=  "RQXV72REYGSM6SLX89EVQ52CN9N8YDLWHAWCDDNM89YN2FCRTLE8688XN";
      asPublicKey  +=  "F4MZMFE6GP9JK2JTFJVUKBLES2ZVWSBCJE9N3D7DG9LL9Z3U42QFJJPE2";
      asPublicKey  +=  "HE5XCRY25UND96R9D7655ZBSCPF796FJZ4GPLY7AMZLGLR77GRP467ELK";
      asPublicKey  +=  "PXSZ9ZF8MUYFDHV4EFACPZ79CDFTYW56NE9JDWDVUMNLY9EXDSF8ZNABE";
      asPublicKey  +=  "MDQU6T9RVLTNRMZJJ8EJSUM9TV8YA6MNWF2Y66MD3VQ9L662F5X6VE9ZC";
      asPublicKey  +=  "PPRTNMEV2DG9BUMFMSL7PUR9H5QG6VVBDBMEU3PLABL57HMSQ5C83E9X8";
      asPublicKey  +=  "RTPY4QSEH2H7R2QDJHT5LQSFNQJL2NZ24GLNTFXG468WC5UUTDD68G8HM";
      asPublicKey  +=  "477Z8P4F9ZZHUGZ6VPFF32A2MPWY8LPXNECCKM9EEVLDDPUJ8LXN2AE6K";
      asPublicKey  +=  "Y2Q42FVBCJM9GQTXNRHBED735KCFD4YGV4U5U3LJD6NJ886W6XQLWH3G7";
      asPublicKey  +=  "3VZ6T5YDUQP6DA5ZHLKQSGATDJHUWC2ELTE7QJFXH8H9EAQYZPPMW76JG";
      asPublicKey  +=  "Z48UBND9VXFXZMSGBNWQPNQG7E4TCBDMVKUSA9TTVSNLN3DXEZNXH787R";
      asPublicKey  +=  "N7XHFBJNZ5W74DUMNBYVHEQDYMZBQCFMS8LGSDUAU6QE9DD5Q334BX62T";
      asPublicKey  +=  "JP5WQQDS2ZEWW76XW7VMLX3L7V9UVD7RL297VDBVRFPQ5MYA3YFVBVNVA";
      asPublicKey  +=  "R5TJXMQ4X2U2PW6UWSKBXT58HG3QPZM2RVEX2PDMCVJDFTJMXR9NPLW4C";
      asPublicKey  +=  "6AE4Q9A8TTAQ68BSN9WWTFFTSX68ECVARFPDBBH5DMP4KYFARTFVCSWNF";
      asPublicKey  +=  "FGAPBYYGFJA4MGHEDWTNE54MPGER7EPCZEV2ESJRMM6XDMFGABG97HECN";
      asPublicKey  +=  "3SZFUBRKCNDZ2TE9F6EERULRCDAV5EMY6KVY9NY9MYNPP2FQ5WFWLMRYD";
      asPublicKey  +=  "4TNYYHE6EDMQ6KK79HH5Q5KBW6DDQYYNUR365W2454CHEZWZAPU82SX4H";
      asPublicKey  +=  "KHNZXBRVWAT7G9CJBKHNBPSVEL67X8UJHBFHZH8ZD4NSEVFZM4Y768TJ6";
      asPublicKey  +=  "QP3BGEKLTY4UZUWHG63QMKVWAQW9E7WRFNJCH4XRD97JHNKMFUTRFVH68";
      asPublicKey  +=  "G5CKSMGC725AZ9CBSL2JX43P4EY44CMF56AJ6BEXVCJP2ZDWCT9G55K4D";
      asPublicKey  +=  "F24J7TTJMFXTQH95CBNX67CBPNWEKHCWQV6VD73Y9KCZHNBFUFS8TCYNN";
      asPublicKey  +=  "WXRGFKNVRDFUKWHDWDDTSPEW8YCKLPMX2GUV3N4JFJMUE6TSJR6Z53C9F";
      asPublicKey  +=  "SKZAY3EN7G66JPBF5E9S6Y7RQHPWZHSRDQ7XH87PHUJFLJFGD7WNE3Q9P";
      asPublicKey  +=  "EXMW33LVJBFEUXKNUB6SU7ZYCEX96XT8G27FLUV7XPV4JK64DWDJCX9WV";
      asPublicKey  +=  "4VL8CK23FQJ28UG9JUZTQJ3DRL32BTJVRD4LVQ6MK9LCE7ZZP925JK7ZD";
      asPublicKey  +=  "92SCV4DDJJ5EXMVBF";
      break;
    }
  }
  kv.PublicKey = asPublicKey.c_str();

  // Fill key buffer
  char keybuf[2048];
  memset(&keybuf, 0, sizeof(keybuf));
  memcpy(&keybuf, mKey->Text.c_str(), mKey->Text.Length());
  kv.Key = keybuf;
  kv.KeyLen = mKey->Text.Length();

  // Fill User Info
  char namebuf[255];
  memset(&namebuf, 0, sizeof(namebuf));
  memcpy(&namebuf, eUserInfo->Text.c_str(), eUserInfo->Text.Length());
  kv.RegInfo = namebuf;
  kv.RegInfoLen = eUserInfo->Text.Length();

  // Hardware ID
  kv.UseHardwareLocking = cbHardware->Checked;
  if (kv.UseHardwareLocking)
  {
    char hdbuf[255];
    memset(&hdbuf, 0, sizeof(hdbuf));
    memcpy(&hdbuf, eHardware->Text.c_str(), eHardware->Text.Length());
    kv.HardwareID = hdbuf;
  }

  // Secure constant (get it from project file)!
  kv.EncryptedConstant = 2113444489;

  dwResult = KG_VerifyRegistrationInfo(&kv);

  AnsiString sresult;
  if (dwResult == EP_NO_ERROR)
  {
    sresult = "Valid registration key!\n";
    sresult += Format("Creation date %d/%d/%d\n", ARRAYOFCONST(((int)kv.CreationYear, (int)kv.CreationMonth, (int)kv.CreationDay)));
    if (kv.UseKeyExpiration)
    {
      sresult += Format("Expiration date %d/%d/%d\n", ARRAYOFCONST(((int)kv.ExpirationYear, (int)kv.ExpirationMonth, (int)kv.ExpirationDay)));
    }
    if (kv.UseRegisterAfter)
    {
      sresult += Format("Register After date %d/%d/%d\n", ARRAYOFCONST(((int)kv.RegisterAfterYear, (int)kv.RegisterAfterMonth, (int)kv.RegisterAfterDay)));
    }
    if (kv.UseRegisterBefore)
    {
      sresult += Format("Register Before date %d/%d/%d\n", ARRAYOFCONST(((int)kv.RegisterBeforeYear, (int)kv.RegisterBeforeMonth, (int)kv.RegisterBeforeDay)));
    }
    if (kv.UseExecutionsLimit)
    {
      sresult += Format("Executions %d\n", ARRAYOFCONST(((int)kv.ExecutionsCount)));
    }
    if (kv.UseDaysLimit)
    {
      sresult += Format("Days %d\n", ARRAYOFCONST(((int)kv.DaysCount)));
    }
    if (kv.UseRunTimeLimit)
    {
      sresult += Format("Run-time minutes %d\n", ARRAYOFCONST(((int)kv.RunTimeMinutes)));
    }
    if (kv.UseGlobalTimeLimit)
    {
      sresult += Format("Global Time minutes %d\n", ARRAYOFCONST(((int)kv.GlobalTimeMinutes)));
    }
    if (kv.UseCountyLimit)
    {
      for (int i = 0; i < ARRAYSIZE(KEY_COUNTRIES); i++)
      {
        if (kv.CountryCode == KEY_COUNTRIES[i].Code)
        {
          sresult += Format("Country Lock %s\n", ARRAYOFCONST((KEY_COUNTRIES[i].Name)));
          break;
        }
      }
    }
    for (int i = 0; i < NUMBER_OF_CRYPTED_SECTIONS; i++)
    {
      if (kv.EncryptedSections[i])
      {
        sresult += Format("Unlocked section #%d\n", ARRAYOFCONST((i + 1)));
      }
    }
  } else
  {
    switch (dwResult)
    {
      case EP_ERROR_UNKNOWN:
        sresult = "EP_ERROR_UNKNOWN";
        break;
      case EP_ERROR_KEYBUFFEREMPTY:
        sresult = "EP_ERROR_KEYBUFFEREMPTY";
        break;
      case EP_ERROR_KEYBUFFERISLESS:
        sresult = "EP_ERROR_KEYBUFFERISLESS";
        break;
      case EP_ERROR_REGINFOEMPTY:
        sresult = "EP_ERROR_REGINFOEMPTY";
        break;
      case EP_ERROR_REGINFOTOOLARGE:
        sresult = "EP_ERROR_REGINFOTOOLARGE";
        break;
      case EP_ERROR_PRIVATEKEYISNOTSET:
        sresult = "EP_ERROR_PRIVATEKEYISNOTSET";
        break;
      case EP_ERROR_PUBLICKEYISNOTSET:
        sresult = "EP_ERROR_PUBLICKEYISNOTSET";
        break;
      case EP_ERROR_PRIVATEKEYISINVALID:
        sresult = "EP_ERROR_PRIVATEKEYISINVALID";
        break;
      case EP_ERROR_PUBLICKEYISINVALID:
        sresult = "EP_ERROR_PUBLICKEYISINVALID";
        break;
      case EP_ERROR_KEYMODEISINVALID:
        sresult = "EP_ERROR_KEYMODEISINVALID";
        break;
      case EP_ERROR_KEYBASEISINVALID:
        sresult = "EP_ERROR_KEYBASEISINVALID";
        break;
      case EP_ERROR_CURRENTDATEISINVALID:
        sresult = "EP_ERROR_CURRENTDATEISINVALID";
        break;
      case EP_ERROR_EXPIRATIONDATEISINVALID:
        sresult = "EP_ERROR_EXPIRATIONDATEISINVALID";
        break;
      case EP_ERROR_KEYISINVALID:
        sresult = "EP_ERROR_KEYISINVALID";
        break;
      case EP_ERROR_HARDWAREID:
        sresult = "EP_ERROR_HARDWAREID";
        break;
      case EP_ERROR_HARDWAREBUFFEREMPTY:
        sresult = "EP_ERROR_HARDWAREBUFFEREMPTY";
        break;
      case EP_ERROR_HARDWAREIDINVALIDFORKEY:
        sresult = "EP_ERROR_HARDWAREIDINVALIDFORKEY";
        break;
      case EP_ERROR_PROJECTFILENOTFOUND:
        sresult = "EP_ERROR_PROJECTFILENOTFOUND";
        break;
      case EP_ERROR_INVALIDPROJECTFILE:
        sresult = "EP_ERROR_INVALIDPROJECTFILE";
        break;
      case EP_ERROR_EXECUTIONSNUMBERINVALID:
        mKey->Text = "EP_ERROR_EXECUTIONSNUMBERINVALID";
        break;
      case EP_ERROR_DAYSNUMBERINVALID:
        mKey->Text = "EP_ERROR_DAYSNUMBERINVALID";
        break;
      case EP_ERROR_COUNTRYCODEINVALID:
        mKey->Text = "EP_ERROR_COUNTRYCODEINVALID";
        break;
      case EP_ERROR_RUNTIMEINVALID:
        mKey->Text = "EP_ERROR_RUNTIMEINVALID";
        break;
      case EP_ERROR_GLOBALTIMEINVALID:
        mKey->Text = "EP_ERROR_GLOBALTIMEINVALID";
        break;
      case EP_ERROR_INSTALLBEFOREINVALID:
        mKey->Text = "EP_ERROR_INSTALLBEFOREINVALID";
        break;
      case EP_ERROR_INSTALLAFTERINVALID:
        mKey->Text = "EP_ERROR_INSTALLAFTERINVALID";
        break;
      default:
        sresult = "Unknown error";
        break;
    }
  }
  ShowMessage(sresult);
}

Show/Hide Visual C++ function example

void CKeygenDlg::OnBnClickedButtonver()
{
    // TODO: Add your control notification handler code here
  TKeyVerifyParams kv;
  char keybuffer[2048];
  char username[255];
  char hardwareid[255];
  DWORD dwResult;

  // Clear params buffer
  memset(&kv, 0, sizeof(kv));
  // Clear key buffer
  memset(&keybuffer, 0, sizeof(keybuffer));
  GetDlgItemText(IDC_EDITKEY, (char*)&keybuffer, sizeof(keybuffer));
  kv.Key = (char*) keybuffer;
  kv.KeyLen = strlen(kv.Key);

  // Fill User Info
  memset(&username, 0, sizeof(username));
  GetDlgItemText(IDC_EDITNAME, (char*)&username, sizeof(username));
  kv.RegInfo = (char*)&username;
  kv.RegInfoLen = strlen(kv.RegInfo);

  // Hardware ID
  if (IsDlgButtonChecked(IDC_CHECKHD) != 0)
  {
      kv.UseHardwareLocking = true;
      memset(&hardwareid, 0, sizeof(hardwareid));
      GetDlgItemText(IDC_EDITHD, (char*)&hardwareid, sizeof(hardwareid));
      kv.HardwareID = (char*)&hardwareid;
  }

  kv.KeyMode = com_key_mode.GetCurSel();
  kv.KeyBase = com_key_base.GetCurSel();

  kv.EncryptedConstant = 2113444489;

  switch (kv.KeyMode)
  {
    case RM_512:
    {
        char pl[] = "0201B810DA4A1ADD4351378790A98138533067CP4S86R7D8THS45GBCVUM635EPRQRMYRP3DAA5DUPZ6ABDSFP7F5AC" \
            "P7ERGH4A7Y6B6NW6NMMBZF83WVER9Y4MMBNLBQDKR7KFVLGLV067CFDQC" \
            "WCHGQVVRN24DECEPBL96YJQJTVDCRTNQG3E4WW4GK4GQ5X5L5H88D3XYH" \
            "CBRBNASPD3P5CNYFKFHBCSDHHD6WPTCC4XVSM5S88067C2JSTCMVT48C8" \
            "HC7SHKGTFJBM28P6XTBCNWHMV6J6KN6W5Q9TQLVR285U6GVCAAUTZLRTP" \
            "SRGDQ742B4742XF4MACRR747YDP5FZZ9D";
        kv.PublicKey = pl;
      break;
    }
    case RM_768:
    {
        char pl[] = "0201B810DA4A1ADD4351378790A9813853309AEHRR66KMK99UEPX8C54WQFDZQ5Y96WUCVZYMXBC32SJV7T5SBPR54E" \
            "2DBH8UD9RNHTJ9BLJV6NHX52W7PZDDTTJDDGF3YFVL7PJFL8RS8THTFDF" \
            "4RY7K3QXLTMXMC8DDSRVRWBVMMP3UYKCDDC7KGL9PG509ACPTRQ4MMUKG" \
            "DAUJFFFGSCBFLYK9X9E74M58PW5FG9B9RTLXJQ4STPVCHJTEH8BP557VZ" \
            "PQYDBUZJXXJNGVZELFL4UL3LHHE8A645CK593DVWCQBSX4ZCCQ3ST8GCZ" \
            "LW2729XK3NT7GST3LMQGXSHLDWCXE09AENVX2QTX3VLT6FWB4JND875XZ" \
            "WQ26GW76TV3KVVHK7U489LLPBQ39HUWKMA65U3HKWBDHKBZEB525PHEH2" \
            "YQHRZGNJAAYZXMWN8RNZ9T7VMZAJMP2V3S9NXZ9RHL96F7AT3NTMN36V4" \
            "ACSFEN4DR6TJR95";
        kv.PublicKey = pl;
      break;
    }
    case RM_1024:
    {
        char pl[] = "0201B810DA4A1ADD4351378790A981385330CDG9YQSEUK2HT546KWW46NHSCHMD2TNCSPVNSKGQC6CHDUSU9CC4LDPL" \
            "TD3NLRVD3TFV9BU2SYBUBU9TXKLQ3CTKZE5GN9VFG37R9YNK2FE58K7ZY" \
            "WTUJYFSJTBMDLLGA9GJ2LJXGHSS9CESGC2K69H65YQGAC7CRGF5T3CPLA" \
            "5BDJZKVCUWPZRNA2DN7L956LZVZBQUDPX6PF30CDBH26Z82VE4QQ8N85L" \
            "QHYJYYCJ6WQ89H9K9VVQX925SG5FJ79AGVZB6M8TTFKCJ56FAREP8GSTC" \
            "NKWCXEALDP9Y2ZLS9QKZV8JRNDHG9D8BRDSCTMDQK9NLAPZ9TGYFS9G7U" \
            "LXHYJF7F9A89HPXGTU2N4FQQJL98WZ5QND2KTEMMUUZFAX953HCGNSWUW" \
            "U2M7LBEWZSH9GW5SC0CDJDY2HC4HJYUSVTAVXZ7MYVJWF3CU9WC3SVPSL" \
            "29WF46DVS2SYKSSAMATPPYGJDE3PBFMGS34CXWQSXKCEAE63L2EXTS9NE" \
            "2G597XASY3S34XMYST5YZF4THUTYT5DY9UKKXU6PH8MLXRPZMPMMR83JU" \
            "X2WGNEW8ZGL4SKUCUB8CEAB6UZ4FB66WTP3B64VMX7XG75T4Y35479";
        kv.PublicKey = pl;
      break;
    }
    case RM_2048:
    {
        char pl[] = "0201B810DA4A1ADD4351378790A98138533199H9KZC4CQ5ZKPEGYDW2EHN5AKZA5G5KP4HU8USWJR8XWW7MCH7244RV" \
            "PSXFHVU6YQRK4LPUHM497XJYPLLA3DHUZWXK3CB5SUYF75NPYLTNPRUAP" \
            "CTVDHAKYWTRQ97HES2E59WDN2LJKFYA2K8BGFSBHP4A6BF5FSDTS8NWLL" \
            "C5NEQ76NJ9BAMWXG55UPFFMRQZTU5KV2G6LSPQUJJWA9U4LJ5SCJ9M9ZQ" \
            "Z6K7LZA9UAMJ533UQ5J3JPNQAUWJGZFRFCTGAGSBWPWRRF9HRGF9MCX55" \
            "QRYGPYMRE6DBJ65SJDX34FVPYWWKWQ48MCKXYXPHQ23BJ42U8ZMDD8CG5" \
            "DPHZQ5XTXUKA277XK6PKSTLJ88ZZ9EBXH62REMRZZRGNPKHYM34RW722S" \
            "SZHMPFKY7X8UZ19ADGX3UQ7X444XH7MZXEZYW2YLFHR8YL3PTCXVSYX89" \
            "ZXN7KW2XNBE8XS3TQRGZVF6KA5USH56NEZYH5RNWBBPVE9LD6H42RQWR5" \
            "YVQMT5EQYQTK6YM9V8DA5BJCLGGZ2UGD6NPA2X3SNUS47F7HJBNBCWHRA" \
            "YPPCQ5HWCJNPDHUDQMRN2P6PWJFWJ6CLVNK8HXEFLE4ENPXAFN89CRS43" \
            "RUMVGDJQCSRB535XYCS6BZYLA9Q6HJV425F26XXHRGA7C8R8BVMELAPEH" \
            "5DSA9KXTCV4H2RNVDFHG3YJSERZVFPWHYA823LUBENBL5U3J4LJX2KQLW" \
            "L5XGGESPSE2FQWKSQ4NUCDLBEJPQAT2A2477DYS2XEXKLYEAKUN22622C" \
            "RLBCAHPFNEV2FJ2H8N3JQGXJRGP19AFHGRW6SS2ZSFYK8EZAPVYL4MCP4" \
            "6UMR64Y9T89FHWEPXBRHKWJCSNNNGPU984J5XW4BWTU6PDWPN24W8RU55" \
            "A9C3U9H7VHS5PFURASHBT4JAEE5ZKJBSYMCMDVBLU973R72RVPA6U96A2" \
            "LX8HMASVST9RVJ7W66V4DYWRDZZQ3673W7C7LVF68TWPLNMYEUQ8FDZRN" \
            "P38D9BX5YA3VENETDUUUMR9U7FFP4NZM7G4Y6J6EASK5SAXXTRMZ8F3AH" \
            "5FC54E543N739BY5KVZQM7JZWD2P2HPE7BDRMM9JFCGPBWWASTZ7UDNRV" \
            "6AFHVMBR9AGAERE9M6W6S2ZT8PBTABPDCKBPPPV6QW9DRXZUGAHDDRRSY" \
            "XM4YXQ2QJX6CL33N7RV8846LK8A3DFLDXWZ2NKF8V";
        kv.PublicKey = pl;
      break;
    }
    case RM_3072:
    {
        char pl[] = "0201B810DA4A1ADD4351378790A98138533267BJBN6W8SY33Y47RWJHWS385XWRV9TSVSB5EM7ECZYNSJ44ZKSD8KV4" \
            "6Y9T6TNC6QMDW4V6DBMADU3YUKLP88TCLEUD9FTEUHGXM6T57AQ2EMB59" \
            "UPQVNSUT7Z4EHAMDQ6N77VK2A6P847MMWJH9E7C5XX6FNF6MHGWERPWQV" \
            "9ZLVR9Z7X5D5Z2XQL6MBM7BDCT2DEDVRBFNDDBLG6LHZ9APM48LS5TKTJ" \
            "AGDYFDRVHEGTDH47PCLL8YJ4ZAWCB59F8BN5PZL3NQACP32G3YNBX5E3J" \
            "7S28XLRGAX55ZML5XE6Q68EUAL38VUBJ2MZ2UGCCHM7CE6S99N44X9RMV" \
            "7B55HULJ4KHPFYSBDUSPQTCWGS76BEQST2QCZDZ2T4FBA4YUJFF47AACE" \
            "A4EEFESEYWN48UZCSDZAMGSU5VB9UJKR2XQUSDFS3TNG9QKURQWS7N5Q3" \
            "VPYT4QAGGQ5GW2MMXHDJYW55FQPHSS255GVJ7WLLP85JHS8K6DVTJWB4W" \
            "4Y8ZEFF7KP6W74PAA8FVPZVDW4RKGMQ8V56Q6R4V34XFE5HR4FZS8GZ6R" \
            "36RKW6WN34S2AHR9LCGF8LULB7ZN6NC2AA5RPDZYGWSPPME6267CGLZCP" \
            "GG98W557RXCDWAETJHDCRPUXX7AD3E8SL9WMGBV9QFHMSV9UFV7H9NTX3" \
            "QYV95CN9P9DSYQWL35R2BWB4GKW6CTWVB2X6WH3P2WFBE6X55KBLAMDB3" \
            "SRDSDVY37GKH78MUHY7KDJDC8SJU5FUQRYZ49ULX3YSZL7E284GFVZSGD" \
            "FTTQNR6VMBM3LLR78SUSVMJW88XT2K4UHEATRU3V9MMR2VGNGCY9S6R7M" \
            "4ELNPEBBMQP2HVPLY5M5VPA92V7NU8ZZ58YYTW5QK9USZ5LV59UZGB2CF" \
            "DPZ6HFYU5WB7UU3UYWVNSNKM3W7GBYKJP8TMFW2YN6GNSSE4ZKFVZRLUT" \
            "8QPZBBEQT5H9H5Z53D7QV4AJTKTX4EMW62TDWXQVK24JZPSG2VXKCMYZL" \
            "BUASE25R3EEK9KBLJ8VX83ZXGTBL5CCDBY33HJ6FKX8AW3WPRX3XTCS9G" \
            "2B9SVK2XFFKNSPGFG6FZNS8P2HERFGFL79DKUZZFWHFH4H9UZ7F7F6W3Z" \
            "WN84JRRA7SU8T89EQMRBEPVYMMGLGSUMFWWMEDLJM5EGP5WEX9LDUAQXS" \
            "55LKDQVRKX4R8NNBHSYBHSNMFYA2C6KGQQFK3TN267DPSZT3PTKHTLNMU" \
            "V2YYZZRX3953LPWAKYF8LJUVMEQT3ZC4F9SWMYGUHG6XX66PJFQWSRUW2" \
            "C79YLGZ6ZAFS7HLXBTH55UD3EGFBZQ5CLNJDZTEJACDVBCM5FQBTX4DKK" \
            "UDGNSMWWLC5UMQRHW89CTU5636WYDXVZZDAUZ529458LDN2DAR9QADWRZ" \
            "UTU8MCKN8ACH3R36YKE52DDF67SM5UDUH7PTATHXE65UCGFRCV49UTF29" \
            "BGDSUWGRMC839HUZYQVAG985YUF5KJCAVGKRD8E4YMPJ38KR6HD2KHDGY" \
            "PJDMJMN4Y3DTJW5MYX3VUPF32637LMAWFM4QCU7BMP74SCF4N5QXZZVBE" \
            "LAQMPYMJC2ZWJ9XFV33YXTTPH3SG9KMUABLL83P7L3UBVM763XJPR5UEH" \
            "DZ73XJUGR9QP6299K5PU46XGVWKWFAKWYMRXUSLCFJ3WQTEC6QJH6E5V8" \
            "X2RMA5TXGSBEWLGSMNQ2SH6G9MLKK4S486DN4M4QVDTYTM4JQETAJQGP7" \
            "6NUR4UNDXR4W4JQSNWDTUGX69SEDC3AL8ZF4TJBQQRXSX2A86UUWCDCFH" \
            "JE94A8EP3Q6A2QTYKEE62MV4VJB2AB";
        kv.PublicKey = pl;
      break;
    }
    case RM_4096:
    {
        char pl[] = "0201B810DA4A1ADD4351378790A98138533334BN75EUD4LFWYFVNFGBRCEMKKXG62QRBXL8GMHQ975B68FJVEMNXQQ7" \
            "RKR7RCZMWDVP86QPB3LR49G9BM7EUUZXNCRZBXRF4PEY3RX6UXT4X286K" \
            "WMR7AMEE6QNP9AEHGWJT9AVU3F62F37B5GVX2BQF73QWHRFQSQ6XMRP6M" \
            "ZDRQ8JT89UF3YRK5UL34MM3L8HLDTWAJF5YY7MRWJUFDQRK9JNCJ6C9KJ" \
            "WRE5ACQSNS24NEAHDYKS3AK75HBCTKP9NR2CSL7Q9PPXM4TF7L37USP77" \
            "Z7WER6JY67F7YGKTP6MFRMKK9H8XFPZ9XWKK97XCFXK7AW4TB96WGEH4B" \
            "YPF9QRF2DGC3LCHW8VTD2EMHVRDR6EEBUG8R4XYKJPLBPRCJP445DU2BW" \
            "JWELKAY45GKDU5HLTTDTWRH2JFKJ7AVAKLPEELN29YHX5JR773P9ERW7N" \
            "UFMWDKD4UL4YPU5QW2L4A7ZN3E8ZDQVEZUR6ZRDQXRLQRLUNHVB4XGBWD" \
            "HM79NGJARHDBQJCD8NWZCWPBY26QARP7A5S48DCV29F7MUTHU3YAHYVS7" \
            "ZPGXJZZA5HBBY4K5BQPUG6MVCBG8H3C7VL8KH9EH58NUVCE6F2CGMSM94" \
            "4CQDKNVGWWWRNK4DG26UT88Y9ULUPJ25G9KLTQPK3TBXZEK43X8KPMJT8" \
            "DF6MTQ5RB94XR2BT9H9NYYTXL29GF8KZY9QNHAW4LTT2RDQTD2ELWPSV4" \
            "4AND9K8G5VKLQ287UBEVHA82CMSMGQQBMNQZVAZ9G8T5TD6G9F7XQHMJT" \
            "HCL6PFEDUW5MN9JASF2EKPT2H33325A3SFGGM5C3RYKZSYSSQC5FLHNX9" \
            "VHN4HQVWD66YECY4R97JZHQALRTCHXUWH85LSJCCTQZT8JF52FHG6FV9J" \
            "UJWEU24K9Z7SKYTYA9NH7GW29FSNKUK3DMFXY48VEYZVDRTTMLFYSJH8B" \
            "RQXV72REYGSM6SLX89EVQ52CN9N8YDLWHAWCDDNM89YN2FCRTLE8688XN" \
            "F4MZMFE6GP9JK2JTFJVUKBLES2ZVWSBCJE9N3D7DG9LL9Z3U42QFJJPE2" \
            "HE5XCRY25UND96R9D7655ZBSCPF796FJZ4GPLY7AMZLGLR77GRP467ELK" \
            "PXSZ9ZF8MUYFDHV4EFACPZ79CDFTYW56NE9JDWDVUMNLY9EXDSF8ZNABE" \
            "MDQU6T9RVLTNRMZJJ8EJSUM9TV8YA6MNWF2Y66MD3VQ9L662F5X6VE9ZC" \
            "PPRTNMEV2DG9BUMFMSL7PUR9H5QG6VVBDBMEU3PLABL57HMSQ5C83E9X8" \
            "RTPY4QSEH2H7R2QDJHT5LQSFNQJL2NZ24GLNTFXG468WC5UUTDD68G8HM" \
            "477Z8P4F9ZZHUGZ6VPFF32A2MPWY8LPXNECCKM9EEVLDDPUJ8LXN2AE6K" \
            "Y2Q42FVBCJM9GQTXNRHBED735KCFD4YGV4U5U3LJD6NJ886W6XQLWH3G7" \
            "3VZ6T5YDUQP6DA5ZHLKQSGATDJHUWC2ELTE7QJFXH8H9EAQYZPPMW76JG" \
            "Z48UBND9VXFXZMSGBNWQPNQG7E4TCBDMVKUSA9TTVSNLN3DXEZNXH787R" \
            "N7XHFBJNZ5W74DUMNBYVHEQDYMZBQCFMS8LGSDUAU6QE9DD5Q334BX62T" \
            "JP5WQQDS2ZEWW76XW7VMLX3L7V9UVD7RL297VDBVRFPQ5MYA3YFVBVNVA" \
            "R5TJXMQ4X2U2PW6UWSKBXT58HG3QPZM2RVEX2PDMCVJDFTJMXR9NPLW4C" \
            "6AE4Q9A8TTAQ68BSN9WWTFFTSX68ECVARFPDBBH5DMP4KYFARTFVCSWNF" \
            "FGAPBYYGFJA4MGHEDWTNE54MPGER7EPCZEV2ESJRMM6XDMFGABG97HECN" \
            "3SZFUBRKCNDZ2TE9F6EERULRCDAV5EMY6KVY9NY9MYNPP2FQ5WFWLMRYD" \
            "4TNYYHE6EDMQ6KK79HH5Q5KBW6DDQYYNUR365W2454CHEZWZAPU82SX4H" \
            "KHNZXBRVWAT7G9CJBKHNBPSVEL67X8UJHBFHZH8ZD4NSEVFZM4Y768TJ6" \
            "QP3BGEKLTY4UZUWHG63QMKVWAQW9E7WRFNJCH4XRD97JHNKMFUTRFVH68" \
            "G5CKSMGC725AZ9CBSL2JX43P4EY44CMF56AJ6BEXVCJP2ZDWCT9G55K4D" \
            "F24J7TTJMFXTQH95CBNX67CBPNWEKHCWQV6VD73Y9KCZHNBFUFS8TCYNN" \
            "WXRGFKNVRDFUKWHDWDDTSPEW8YCKLPMX2GUV3N4JFJMUE6TSJR6Z53C9F" \
            "SKZAY3EN7G66JPBF5E9S6Y7RQHPWZHSRDQ7XH87PHUJFLJFGD7WNE3Q9P" \
            "EXMW33LVJBFEUXKNUB6SU7ZYCEX96XT8G27FLUV7XPV4JK64DWDJCX9WV" \
            "4VL8CK23FQJ28UG9JUZTQJ3DRL32BTJVRD4LVQ6MK9LCE7ZZP925JK7ZD" \
            "92SCV4DDJJ5EXMVBF";
        kv.PublicKey = pl;
      break;
    }
  }

  // Generate reg. key
  dwResult = KG_VerifyRegistrationInfo(&kv);

  if (dwResult == EP_NO_ERROR)
  {
      char tmp[255];
      // Creation date
      char mes[2048] = "Valid Registration Key!\n";
      sprintf(tmp, "Creation date: %d/%d/%d\n", kv.CreationDay, kv.CreationMonth, kv.CreationYear);
      strcat(mes, tmp);
      // Expiration date
      if (kv.UseKeyExpiration)
      {
          sprintf(tmp, "Expiration date: %d/%d/%d\n", kv.ExpirationDay, kv.ExpirationMonth, kv.ExpirationYear);
          strcat(mes, tmp);
      }
      // Register After date
      if (kv.UseRegisterAfter)
      {
          sprintf(tmp, "Register After date: %d/%d/%d\n", kv.RegisterAfterDay, kv.RegisterAfterMonth, kv.RegisterAfterYear);
          strcat(mes, tmp);
      }
      // Register Before date
      if (kv.UseRegisterBefore)
      {
          sprintf(tmp, "Register Before date: %d/%d/%d\n", kv.RegisterBeforeDay, kv.RegisterBeforeMonth, kv.RegisterBeforeYear);
          strcat(mes, tmp);
      }
      // Executions
      if (kv.UseExecutionsLimit)
      {
          sprintf(tmp, "Executions: %d\n", kv.ExecutionsCount);
          strcat(mes, tmp);
      }
      // Days
      if (kv.UseDaysLimit)
      {
          sprintf(tmp, "Days: %d\n", kv.DaysCount);
          strcat(mes, tmp);
      }
      // Run-time
      if (kv.UseRunTimeLimit)
      {
          sprintf(tmp, "Run-time: %d minutes\n", kv.RunTimeMinutes);
          strcat(mes, tmp);
      }
      // Global Time
      if (kv.UseGlobalTimeLimit)
      {
          sprintf(tmp, "Global Time: %d minutes\n", kv.GlobalTimeMinutes);
          strcat(mes, tmp);
      }
      // Country
      if (kv.UseCountyLimit)
      {
          for (int i = 0; i < ARRAYSIZE(KEY_COUNTRIES); i++)
          {
              if (kv.CountryCode == KEY_COUNTRIES[i].Code)
              {
                  sprintf(tmp, "Country Lock: %s\n", KEY_COUNTRIES[i].Name);
                  strcat(mes, tmp);
                  break;
              }
          }
      }
      for (int i = 0; i < NUMBER_OF_CRYPTED_SECTIONS; i++)
      {
          if (kv.EncryptedSections[i])
          {
              sprintf(tmp, "Unlocked section: #%d\n", i + 1);
              strcat(mes, tmp);
          }
      }
      MessageBox(mes);
  } else
  {
    char* sError;
    switch (dwResult)
    {
      case EP_ERROR_UNKNOWN:
        sError = "EP_ERROR_UNKNOWN";
        break;
      case EP_ERROR_KEYBUFFEREMPTY:
        sError = "EP_ERROR_KEYBUFFEREMPTY";
        break;
      case EP_ERROR_KEYBUFFERISLESS:
        sError = "EP_ERROR_KEYBUFFERISLESS";
        break;
      case EP_ERROR_REGINFOEMPTY:
        sError = "EP_ERROR_REGINFOEMPTY";
        break;
      case EP_ERROR_REGINFOTOOLARGE:
        sError = "EP_ERROR_REGINFOTOOLARGE";
        break;
      case EP_ERROR_PRIVATEKEYISNOTSET:
        sError = "EP_ERROR_PRIVATEKEYISNOTSET";
        break;
      case EP_ERROR_PUBLICKEYISNOTSET:
        sError = "EP_ERROR_PUBLICKEYISNOTSET";
        break;
      case EP_ERROR_PRIVATEKEYISINVALID:
        sError = "EP_ERROR_PRIVATEKEYISINVALID";
        break;
      case EP_ERROR_PUBLICKEYISINVALID:
        sError = "EP_ERROR_PUBLICKEYISINVALID";
        break;
      case EP_ERROR_KEYMODEISINVALID:
        sError = "EP_ERROR_KEYMODEISINVALID";
        break;
      case EP_ERROR_KEYBASEISINVALID:
        sError = "EP_ERROR_KEYBASEISINVALID";
        break;
      case EP_ERROR_CURRENTDATEISINVALID:
        sError = "EP_ERROR_CURRENTDATEISINVALID";
        break;
      case EP_ERROR_EXPIRATIONDATEISINVALID:
        sError = "EP_ERROR_EXPIRATIONDATEISINVALID";
        break;
      case EP_ERROR_KEYISINVALID:
        sError = "EP_ERROR_KEYISINVALID";
        break;
      case EP_ERROR_HARDWAREID:
        sError = "EP_ERROR_HARDWAREID";
        break;
      case EP_ERROR_HARDWAREBUFFEREMPTY:
        sError = "EP_ERROR_HARDWAREBUFFEREMPTY";
        break;
      case EP_ERROR_HARDWAREIDINVALIDFORKEY:
        sError = "EP_ERROR_HARDWAREIDINVALIDFORKEY";
        break;
      case EP_ERROR_PROJECTFILENOTFOUND:
        sError = "EP_ERROR_PROJECTFILENOTFOUND";
        break;
      case EP_ERROR_INVALIDPROJECTFILE:
        sError = "EP_ERROR_INVALIDPROJECTFILE";
        break;
      case EP_ERROR_EXECUTIONSNUMBERINVALID:
        sError = "EP_ERROR_EXECUTIONSNUMBERINVALID";
        break;
      case EP_ERROR_DAYSNUMBERINVALID:
        sError = "EP_ERROR_DAYSNUMBERINVALID";
        break;
      case EP_ERROR_COUNTRYCODEINVALID:
        sError = "EP_ERROR_COUNTRYCODEINVALID";
        break;
      case EP_ERROR_RUNTIMEINVALID:
        sError = "EP_ERROR_RUNTIMEINVALID";
        break;
      case EP_ERROR_GLOBALTIMEINVALID:
        sError = "EP_ERROR_GLOBALTIMEINVALID";
        break;
      case EP_ERROR_INSTALLBEFOREINVALID:
        sError = "EP_ERROR_INSTALLBEFOREINVALID";
        break;
      case EP_ERROR_INSTALLAFTERINVALID:
        sError = "EP_ERROR_INSTALLAFTERINVALID";
        break;
      default:
        sError = "Unknown error";
        break;
    }
    MessageBox(sError);
  }
}

Show/Hide C# (.NET) function example

        private void btnVerify_Click(object sender, EventArgs e)
        {
            if (tbUserInfo.Text == string.Empty)
            {
                MessageBox.Show("User info field is empty!");
                return;
            }
            if (tbUserInfo.Text == string.Empty)
            {
                MessageBox.Show("Registration key field is empty!");
                return;
            }
            Enigma_KeyGen_IDE.TKeyVerifyParams kv = new Enigma_KeyGen_IDE.TKeyVerifyParams();
            kv.KeyMode = cbKeyMode.SelectedIndex;
            kv.KeyBase = cbKeyBase.SelectedIndex;
            switch (kv.KeyMode)
            {
                case Enigma_KeyGen_IDE.RM_512:
                    {
                        kv.PublicKey = "0201B810DA4A1ADD4351378790A98138533067CP4S86R7D8THS45GBCVUM635EPRQRMYRP3DAA5DUPZ6ABDSFP7F5AC" +
                                       "P7ERGH4A7Y6B6NW6NMMBZF83WVER9Y4MMBNLBQDKR7KFVLGLV067CFDQC" +
                                       "WCHGQVVRN24DECEPBL96YJQJTVDCRTNQG3E4WW4GK4GQ5X5L5H88D3XYH" +
                                       "CBRBNASPD3P5CNYFKFHBCSDHHD6WPTCC4XVSM5S88067C2JSTCMVT48C8" +
                                       "HC7SHKGTFJBM28P6XTBCNWHMV6J6KN6W5Q9TQLVR285U6GVCAAUTZLRTP" +
                                       "SRGDQ742B4742XF4MACRR747YDP5FZZ9D";
                        break;
                    }
                case Enigma_KeyGen_IDE.RM_768:
                    {
                        kv.PublicKey = "0201B810DA4A1ADD4351378790A9813853309AEHRR66KMK99UEPX8C54WQFDZQ5Y96WUCVZYMXBC32SJV7T5SBPR54E" +
                                       "2DBH8UD9RNHTJ9BLJV6NHX52W7PZDDTTJDDGF3YFVL7PJFL8RS8THTFDF" +
                                       "4RY7K3QXLTMXMC8DDSRVRWBVMMP3UYKCDDC7KGL9PG509ACPTRQ4MMUKG" +
                                       "DAUJFFFGSCBFLYK9X9E74M58PW5FG9B9RTLXJQ4STPVCHJTEH8BP557VZ" +
                                       "PQYDBUZJXXJNGVZELFL4UL3LHHE8A645CK593DVWCQBSX4ZCCQ3ST8GCZ" +
                                       "LW2729XK3NT7GST3LMQGXSHLDWCXE09AENVX2QTX3VLT6FWB4JND875XZ" +
                                       "WQ26GW76TV3KVVHK7U489LLPBQ39HUWKMA65U3HKWBDHKBZEB525PHEH2" +
                                       "YQHRZGNJAAYZXMWN8RNZ9T7VMZAJMP2V3S9NXZ9RHL96F7AT3NTMN36V4" +
                                       "ACSFEN4DR6TJR95";
                        break;
                    }
                case Enigma_KeyGen_IDE.RM_1024:
                    {
                        kv.PublicKey = "0201B810DA4A1ADD4351378790A981385330CDG9YQSEUK2HT546KWW46NHSCHMD2TNCSPVNSKGQC6CHDUSU9CC4LDPL" +
                                       "TD3NLRVD3TFV9BU2SYBUBU9TXKLQ3CTKZE5GN9VFG37R9YNK2FE58K7ZY" +
                                       "WTUJYFSJTBMDLLGA9GJ2LJXGHSS9CESGC2K69H65YQGAC7CRGF5T3CPLA" +
                                       "5BDJZKVCUWPZRNA2DN7L956LZVZBQUDPX6PF30CDBH26Z82VE4QQ8N85L" +
                                       "QHYJYYCJ6WQ89H9K9VVQX925SG5FJ79AGVZB6M8TTFKCJ56FAREP8GSTC" +
                                       "NKWCXEALDP9Y2ZLS9QKZV8JRNDHG9D8BRDSCTMDQK9NLAPZ9TGYFS9G7U" +
                                       "LXHYJF7F9A89HPXGTU2N4FQQJL98WZ5QND2KTEMMUUZFAX953HCGNSWUW" +
                                       "U2M7LBEWZSH9GW5SC0CDJDY2HC4HJYUSVTAVXZ7MYVJWF3CU9WC3SVPSL" +
                                       "29WF46DVS2SYKSSAMATPPYGJDE3PBFMGS34CXWQSXKCEAE63L2EXTS9NE" +
                                       "2G597XASY3S34XMYST5YZF4THUTYT5DY9UKKXU6PH8MLXRPZMPMMR83JU" +
                                       "X2WGNEW8ZGL4SKUCUB8CEAB6UZ4FB66WTP3B64VMX7XG75T4Y35479";
                        break;
                    }
                case Enigma_KeyGen_IDE.RM_2048:
                    {
                        kv.PublicKey = "0201B810DA4A1ADD4351378790A98138533199H9KZC4CQ5ZKPEGYDW2EHN5AKZA5G5KP4HU8USWJR8XWW7MCH7244RV" +
                                       "PSXFHVU6YQRK4LPUHM497XJYPLLA3DHUZWXK3CB5SUYF75NPYLTNPRUAP" +
                                       "CTVDHAKYWTRQ97HES2E59WDN2LJKFYA2K8BGFSBHP4A6BF5FSDTS8NWLL" +
                                       "C5NEQ76NJ9BAMWXG55UPFFMRQZTU5KV2G6LSPQUJJWA9U4LJ5SCJ9M9ZQ" +
                                       "Z6K7LZA9UAMJ533UQ5J3JPNQAUWJGZFRFCTGAGSBWPWRRF9HRGF9MCX55" +
                                       "QRYGPYMRE6DBJ65SJDX34FVPYWWKWQ48MCKXYXPHQ23BJ42U8ZMDD8CG5" +
                                       "DPHZQ5XTXUKA277XK6PKSTLJ88ZZ9EBXH62REMRZZRGNPKHYM34RW722S" +
                                       "SZHMPFKY7X8UZ19ADGX3UQ7X444XH7MZXEZYW2YLFHR8YL3PTCXVSYX89" +
                                       "ZXN7KW2XNBE8XS3TQRGZVF6KA5USH56NEZYH5RNWBBPVE9LD6H42RQWR5" +
                                       "YVQMT5EQYQTK6YM9V8DA5BJCLGGZ2UGD6NPA2X3SNUS47F7HJBNBCWHRA" +
                                       "YPPCQ5HWCJNPDHUDQMRN2P6PWJFWJ6CLVNK8HXEFLE4ENPXAFN89CRS43" +
                                       "RUMVGDJQCSRB535XYCS6BZYLA9Q6HJV425F26XXHRGA7C8R8BVMELAPEH" +
                                       "5DSA9KXTCV4H2RNVDFHG3YJSERZVFPWHYA823LUBENBL5U3J4LJX2KQLW" +
                                       "L5XGGESPSE2FQWKSQ4NUCDLBEJPQAT2A2477DYS2XEXKLYEAKUN22622C" +
                                       "RLBCAHPFNEV2FJ2H8N3JQGXJRGP19AFHGRW6SS2ZSFYK8EZAPVYL4MCP4" +
                                       "6UMR64Y9T89FHWEPXBRHKWJCSNNNGPU984J5XW4BWTU6PDWPN24W8RU55" +
                                       "A9C3U9H7VHS5PFURASHBT4JAEE5ZKJBSYMCMDVBLU973R72RVPA6U96A2" +
                                       "LX8HMASVST9RVJ7W66V4DYWRDZZQ3673W7C7LVF68TWPLNMYEUQ8FDZRN" +
                                       "P38D9BX5YA3VENETDUUUMR9U7FFP4NZM7G4Y6J6EASK5SAXXTRMZ8F3AH" +
                                       "5FC54E543N739BY5KVZQM7JZWD2P2HPE7BDRMM9JFCGPBWWASTZ7UDNRV" +
                                       "6AFHVMBR9AGAERE9M6W6S2ZT8PBTABPDCKBPPPV6QW9DRXZUGAHDDRRSY" +
                                       "XM4YXQ2QJX6CL33N7RV8846LK8A3DFLDXWZ2NKF8V";
                        break;
                    }
                case Enigma_KeyGen_IDE.RM_3072:
                    {
                        kv.PublicKey = "0201B810DA4A1ADD4351378790A98138533267BJBN6W8SY33Y47RWJHWS385XWRV9TSVSB5EM7ECZYNSJ44ZKSD8KV4" +
                                       "6Y9T6TNC6QMDW4V6DBMADU3YUKLP88TCLEUD9FTEUHGXM6T57AQ2EMB59" +
                                       "UPQVNSUT7Z4EHAMDQ6N77VK2A6P847MMWJH9E7C5XX6FNF6MHGWERPWQV" +
                                       "9ZLVR9Z7X5D5Z2XQL6MBM7BDCT2DEDVRBFNDDBLG6LHZ9APM48LS5TKTJ" +
                                       "AGDYFDRVHEGTDH47PCLL8YJ4ZAWCB59F8BN5PZL3NQACP32G3YNBX5E3J" +
                                       "7S28XLRGAX55ZML5XE6Q68EUAL38VUBJ2MZ2UGCCHM7CE6S99N44X9RMV" +
                                       "7B55HULJ4KHPFYSBDUSPQTCWGS76BEQST2QCZDZ2T4FBA4YUJFF47AACE" +
                                       "A4EEFESEYWN48UZCSDZAMGSU5VB9UJKR2XQUSDFS3TNG9QKURQWS7N5Q3" +
                                       "VPYT4QAGGQ5GW2MMXHDJYW55FQPHSS255GVJ7WLLP85JHS8K6DVTJWB4W" +
                                       "4Y8ZEFF7KP6W74PAA8FVPZVDW4RKGMQ8V56Q6R4V34XFE5HR4FZS8GZ6R" +
                                       "36RKW6WN34S2AHR9LCGF8LULB7ZN6NC2AA5RPDZYGWSPPME6267CGLZCP" +
                                       "GG98W557RXCDWAETJHDCRPUXX7AD3E8SL9WMGBV9QFHMSV9UFV7H9NTX3" +
                                       "QYV95CN9P9DSYQWL35R2BWB4GKW6CTWVB2X6WH3P2WFBE6X55KBLAMDB3" +
                                       "SRDSDVY37GKH78MUHY7KDJDC8SJU5FUQRYZ49ULX3YSZL7E284GFVZSGD" +
                                       "FTTQNR6VMBM3LLR78SUSVMJW88XT2K4UHEATRU3V9MMR2VGNGCY9S6R7M" +
                                       "4ELNPEBBMQP2HVPLY5M5VPA92V7NU8ZZ58YYTW5QK9USZ5LV59UZGB2CF" +
                                       "DPZ6HFYU5WB7UU3UYWVNSNKM3W7GBYKJP8TMFW2YN6GNSSE4ZKFVZRLUT" +
                                       "8QPZBBEQT5H9H5Z53D7QV4AJTKTX4EMW62TDWXQVK24JZPSG2VXKCMYZL" +
                                       "BUASE25R3EEK9KBLJ8VX83ZXGTBL5CCDBY33HJ6FKX8AW3WPRX3XTCS9G" +
                                       "2B9SVK2XFFKNSPGFG6FZNS8P2HERFGFL79DKUZZFWHFH4H9UZ7F7F6W3Z" +
                                       "WN84JRRA7SU8T89EQMRBEPVYMMGLGSUMFWWMEDLJM5EGP5WEX9LDUAQXS" +
                                       "55LKDQVRKX4R8NNBHSYBHSNMFYA2C6KGQQFK3TN267DPSZT3PTKHTLNMU" +
                                       "V2YYZZRX3953LPWAKYF8LJUVMEQT3ZC4F9SWMYGUHG6XX66PJFQWSRUW2" +
                                       "C79YLGZ6ZAFS7HLXBTH55UD3EGFBZQ5CLNJDZTEJACDVBCM5FQBTX4DKK" +
                                       "UDGNSMWWLC5UMQRHW89CTU5636WYDXVZZDAUZ529458LDN2DAR9QADWRZ" +
                                       "UTU8MCKN8ACH3R36YKE52DDF67SM5UDUH7PTATHXE65UCGFRCV49UTF29" +
                                       "BGDSUWGRMC839HUZYQVAG985YUF5KJCAVGKRD8E4YMPJ38KR6HD2KHDGY" +
                                       "PJDMJMN4Y3DTJW5MYX3VUPF32637LMAWFM4QCU7BMP74SCF4N5QXZZVBE" +
                                       "LAQMPYMJC2ZWJ9XFV33YXTTPH3SG9KMUABLL83P7L3UBVM763XJPR5UEH" +
                                       "DZ73XJUGR9QP6299K5PU46XGVWKWFAKWYMRXUSLCFJ3WQTEC6QJH6E5V8" +
                                       "X2RMA5TXGSBEWLGSMNQ2SH6G9MLKK4S486DN4M4QVDTYTM4JQETAJQGP7" +
                                       "6NUR4UNDXR4W4JQSNWDTUGX69SEDC3AL8ZF4TJBQQRXSX2A86UUWCDCFH" +
                                       "JE94A8EP3Q6A2QTYKEE62MV4VJB2AB";
                        break;
                    }
                case Enigma_KeyGen_IDE.RM_4096:
                    {
                        kv.PublicKey = "0201B810DA4A1ADD4351378790A98138533334BN75EUD4LFWYFVNFGBRCEMKKXG62QRBXL8GMHQ975B68FJVEMNXQQ7" +
                                       "RKR7RCZMWDVP86QPB3LR49G9BM7EUUZXNCRZBXRF4PEY3RX6UXT4X286K" +
                                       "WMR7AMEE6QNP9AEHGWJT9AVU3F62F37B5GVX2BQF73QWHRFQSQ6XMRP6M" +
                                       "ZDRQ8JT89UF3YRK5UL34MM3L8HLDTWAJF5YY7MRWJUFDQRK9JNCJ6C9KJ" +
                                       "WRE5ACQSNS24NEAHDYKS3AK75HBCTKP9NR2CSL7Q9PPXM4TF7L37USP77" +
                                       "Z7WER6JY67F7YGKTP6MFRMKK9H8XFPZ9XWKK97XCFXK7AW4TB96WGEH4B" +
                                       "YPF9QRF2DGC3LCHW8VTD2EMHVRDR6EEBUG8R4XYKJPLBPRCJP445DU2BW" +
                                       "JWELKAY45GKDU5HLTTDTWRH2JFKJ7AVAKLPEELN29YHX5JR773P9ERW7N" +
                                       "UFMWDKD4UL4YPU5QW2L4A7ZN3E8ZDQVEZUR6ZRDQXRLQRLUNHVB4XGBWD" +
                                       "HM79NGJARHDBQJCD8NWZCWPBY26QARP7A5S48DCV29F7MUTHU3YAHYVS7" +
                                       "ZPGXJZZA5HBBY4K5BQPUG6MVCBG8H3C7VL8KH9EH58NUVCE6F2CGMSM94" +
                                       "4CQDKNVGWWWRNK4DG26UT88Y9ULUPJ25G9KLTQPK3TBXZEK43X8KPMJT8" +
                                       "DF6MTQ5RB94XR2BT9H9NYYTXL29GF8KZY9QNHAW4LTT2RDQTD2ELWPSV4" +
                                       "4AND9K8G5VKLQ287UBEVHA82CMSMGQQBMNQZVAZ9G8T5TD6G9F7XQHMJT" +
                                       "HCL6PFEDUW5MN9JASF2EKPT2H33325A3SFGGM5C3RYKZSYSSQC5FLHNX9" +
                                       "VHN4HQVWD66YECY4R97JZHQALRTCHXUWH85LSJCCTQZT8JF52FHG6FV9J" +
                                       "UJWEU24K9Z7SKYTYA9NH7GW29FSNKUK3DMFXY48VEYZVDRTTMLFYSJH8B" +
                                       "RQXV72REYGSM6SLX89EVQ52CN9N8YDLWHAWCDDNM89YN2FCRTLE8688XN" +
                                       "F4MZMFE6GP9JK2JTFJVUKBLES2ZVWSBCJE9N3D7DG9LL9Z3U42QFJJPE2" +
                                       "HE5XCRY25UND96R9D7655ZBSCPF796FJZ4GPLY7AMZLGLR77GRP467ELK" +
                                       "PXSZ9ZF8MUYFDHV4EFACPZ79CDFTYW56NE9JDWDVUMNLY9EXDSF8ZNABE" +
                                       "MDQU6T9RVLTNRMZJJ8EJSUM9TV8YA6MNWF2Y66MD3VQ9L662F5X6VE9ZC" +
                                       "PPRTNMEV2DG9BUMFMSL7PUR9H5QG6VVBDBMEU3PLABL57HMSQ5C83E9X8" +
                                       "RTPY4QSEH2H7R2QDJHT5LQSFNQJL2NZ24GLNTFXG468WC5UUTDD68G8HM" +
                                       "477Z8P4F9ZZHUGZ6VPFF32A2MPWY8LPXNECCKM9EEVLDDPUJ8LXN2AE6K" +
                                       "Y2Q42FVBCJM9GQTXNRHBED735KCFD4YGV4U5U3LJD6NJ886W6XQLWH3G7" +
                                       "3VZ6T5YDUQP6DA5ZHLKQSGATDJHUWC2ELTE7QJFXH8H9EAQYZPPMW76JG" +
                                       "Z48UBND9VXFXZMSGBNWQPNQG7E4TCBDMVKUSA9TTVSNLN3DXEZNXH787R" +
                                       "N7XHFBJNZ5W74DUMNBYVHEQDYMZBQCFMS8LGSDUAU6QE9DD5Q334BX62T" +
                                       "JP5WQQDS2ZEWW76XW7VMLX3L7V9UVD7RL297VDBVRFPQ5MYA3YFVBVNVA" +
                                       "R5TJXMQ4X2U2PW6UWSKBXT58HG3QPZM2RVEX2PDMCVJDFTJMXR9NPLW4C" +
                                       "6AE4Q9A8TTAQ68BSN9WWTFFTSX68ECVARFPDBBH5DMP4KYFARTFVCSWNF" +
                                       "FGAPBYYGFJA4MGHEDWTNE54MPGER7EPCZEV2ESJRMM6XDMFGABG97HECN" +
                                       "3SZFUBRKCNDZ2TE9F6EERULRCDAV5EMY6KVY9NY9MYNPP2FQ5WFWLMRYD" +
                                       "4TNYYHE6EDMQ6KK79HH5Q5KBW6DDQYYNUR365W2454CHEZWZAPU82SX4H" +
                                       "KHNZXBRVWAT7G9CJBKHNBPSVEL67X8UJHBFHZH8ZD4NSEVFZM4Y768TJ6" +
                                       "QP3BGEKLTY4UZUWHG63QMKVWAQW9E7WRFNJCH4XRD97JHNKMFUTRFVH68" +
                                       "G5CKSMGC725AZ9CBSL2JX43P4EY44CMF56AJ6BEXVCJP2ZDWCT9G55K4D" +
                                       "F24J7TTJMFXTQH95CBNX67CBPNWEKHCWQV6VD73Y9KCZHNBFUFS8TCYNN" +
                                       "WXRGFKNVRDFUKWHDWDDTSPEW8YCKLPMX2GUV3N4JFJMUE6TSJR6Z53C9F" +
                                       "SKZAY3EN7G66JPBF5E9S6Y7RQHPWZHSRDQ7XH87PHUJFLJFGD7WNE3Q9P" +
                                       "EXMW33LVJBFEUXKNUB6SU7ZYCEX96XT8G27FLUV7XPV4JK64DWDJCX9WV" +
                                       "4VL8CK23FQJ28UG9JUZTQJ3DRL32BTJVRD4LVQ6MK9LCE7ZZP925JK7ZD" +
                                       "92SCV4DDJJ5EXMVBF";
                        break;
                    }
            }

            kv.Key = tbKey.Text;
            kv.KeyLen = tbKey.Text.Length;

            kv.RegInfo = tbUserInfo.Text;
            kv.RegInfoLen = tbUserInfo.Text.Length;

            // Hardware ID
            kv.UseHardwareLocking = cbHardware.Checked;
            if (kv.UseHardwareLocking)
            {
                kv.HardwareID = tbHardware.Text;
            }

            // Secure constant (get it from project file)!
            kv.EncryptedConstant = 2113444489;

            // Generate reg. key
            uint dwResult = Enigma_KeyGen_IDE.KG_VerifyRegistrationInfo(ref kv);

            string sout = string.Empty;
            if (dwResult == Enigma_KeyGen_IDE.EP_NO_ERROR)
            {
                //
                sout = "Valid key!\n";
                sout = string.Format(sout + "Creation Date: {0}/{1}/{2}\n", kv.CreationDay, kv.CreationMonth, kv.CreationYear);
                if (kv.UseKeyExpiration)
                {
                    sout += string.Format("Expiration Date: {0}/{1}/{2}\n", kv.ExpirationDay, kv.ExpirationMonth, kv.ExpirationYear);
                }
                if (kv.UseRegisterAfter)
                {
                    sout += string.Format("Register After: {0}/{1}/{2}\n", kv.RegisterAfterDay, kv.RegisterAfterMonth, kv.RegisterAfterYear);
                }
                if (kv.UseRegisterBefore)
                {
                    sout += string.Format("Register Before: {0}/{1}/{2}\n", kv.RegisterBeforeDay, kv.RegisterBeforeMonth, kv.RegisterBeforeYear);
                }
                if (kv.UseCountyLimit)
                {
                    Enigma_KeyGen_IDE ide = new Enigma_KeyGen_IDE();
                    foreach (Enigma_KeyGen_IDE.TKeyCountries country in ide.KEY_COUNTRIES)
                    {
                        if (country.Code == kv.CountryCode)
                        {
                            sout += string.Format("Country Lock: {0}\n", country.Name);
                            break;
                        }
                    }
                }
                if (kv.UseExecutionsLimit)
                {
                    sout += string.Format("Executions: {0}\n", kv.ExecutionsCount);
                }
                if (kv.UseDaysLimit)
                {
                    sout += string.Format("Days: {0}\n", kv.DaysCount);
                }
                if (kv.UseRunTimeLimit)
                {
                    sout += string.Format("Runtime: {0}\n", kv.RunTimeMinutes);
                }
                if (kv.UseGlobalTimeLimit)
                {
                    sout += string.Format("Global Time: {0}\n", kv.GlobalTimeMinutes);
                }
                for (int i = 0; i < Enigma_KeyGen_IDE.NUMBER_OF_CRYPTED_SECTIONS; i++)
                {
                    if (Convert.ToBoolean(kv.EncryptedSections[i]))
                    {
                        sout += string.Format("Unlock section: #{0}\n", i + 1);
                    }
                }
            }
            else
            {
                switch (dwResult)
                {
                    case Enigma_KeyGen_IDE.EP_ERROR_UNKNOWN:
                        sout = "EP_ERROR_UNKNOWN";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_KEYBUFFEREMPTY:
                        sout = "EP_ERROR_KEYBUFFEREMPTY";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_KEYBUFFERISLESS:
                        sout = "EP_ERROR_KEYBUFFERISLESS";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_REGINFOEMPTY:
                        sout = "EP_ERROR_REGINFOEMPTY";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_REGINFOTOOLARGE:
                        sout = "EP_ERROR_REGINFOTOOLARGE";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_PRIVATEKEYISNOTSET:
                        sout = "EP_ERROR_PRIVATEKEYISNOTSET";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_PUBLICKEYISNOTSET:
                        sout = "EP_ERROR_PUBLICKEYISNOTSET";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_PRIVATEKEYISINVALID:
                        sout = "EP_ERROR_PRIVATEKEYISINVALID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_PUBLICKEYISINVALID:
                        sout = "EP_ERROR_PUBLICKEYISINVALID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_KEYMODEISINVALID:
                        sout = "EP_ERROR_KEYMODEISINVALID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_KEYBASEISINVALID:
                        sout = "EP_ERROR_KEYBASEISINVALID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_CURRENTDATEISINVALID:
                        sout = "EP_ERROR_CURRENTDATEISINVALID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_EXPIRATIONDATEISINVALID:
                        sout = "EP_ERROR_EXPIRATIONDATEISINVALID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_KEYISINVALID:
                        sout = "EP_ERROR_KEYISINVALID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_HARDWAREID:
                        sout = "EP_ERROR_HARDWAREID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_HARDWAREBUFFEREMPTY:
                        sout = "EP_ERROR_HARDWAREBUFFEREMPTY";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_HARDWAREIDINVALIDFORKEY:
                        sout = "EP_ERROR_HARDWAREIDINVALIDFORKEY";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_PROJECTFILENOTFOUND:
                        sout = "EP_ERROR_PROJECTFILENOTFOUND";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_INVALIDPROJECTFILE:
                        sout = "EP_ERROR_INVALIDPROJECTFILE";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_EXECUTIONSNUMBERINVALID:
                        tbKey.Text = "EP_ERROR_EXECUTIONSNUMBERINVALID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_DAYSNUMBERINVALID:
                        tbKey.Text = "EP_ERROR_DAYSNUMBERINVALID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_COUNTRYCODEINVALID:
                        tbKey.Text = "EP_ERROR_COUNTRYCODEINVALID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_RUNTIMEINVALID:
                        tbKey.Text = "EP_ERROR_RUNTIMEINVALID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_GLOBALTIMEINVALID:
                        tbKey.Text = "EP_ERROR_GLOBALTIMEINVALID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_INSTALLBEFOREINVALID:
                        tbKey.Text = "EP_ERROR_INSTALLBEFOREINVALID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_INSTALLAFTERINVALID:
                        tbKey.Text = "EP_ERROR_INSTALLAFTERINVALID";
                        break;
                    default:
                        sout = "Unknown error";
                        break;
                }
            }
            MessageBox.Show(sout);
        }

Show/Hide Visual Basic function example

Private Sub btnVerify_Click()
  Dim kv As TKeyVerifyParams
  Dim I As Integer
  Dim dwResult As Long
  Dim sresult As String

  If tbUserInfo.Text = vbNullString Then
    MsgBox "User info field is empty!"
    Exit Sub
  End If

  If tKey.Text = vbNullString Then
    MsgBox "Key field is empty!"
    Exit Sub
  End If

  ' Key mode
  kv.KeyMode = cbKeyMode.ListIndex
  ' Key base
  kv.KeyBase = cbKeyBase.ListIndex

  Select Case kv.KeyMode
    Case RM_512
      kv.PublicKey = "0201B810DA4A1ADD4351378790A98138533067CP4S86R7D8THS45GBCVUM635EPRQRMYRP3DAA5DUPZ6ABDSFP7F5AC" & _
                     "P7ERGH4A7Y6B6NW6NMMBZF83WVER9Y4MMBNLBQDKR7KFVLGLV067CFDQC" & _
                     "WCHGQVVRN24DECEPBL96YJQJTVDCRTNQG3E4WW4GK4GQ5X5L5H88D3XYH" & _
                     "CBRBNASPD3P5CNYFKFHBCSDHHD6WPTCC4XVSM5S88067C2JSTCMVT48C8" & _
                     "HC7SHKGTFJBM28P6XTBCNWHMV6J6KN6W5Q9TQLVR285U6GVCAAUTZLRTP" & _
                     "SRGDQ742B4742XF4MACRR747YDP5FZZ9D" & vbNullChar
    Case RM_768
      kv.PublicKey = "0201B810DA4A1ADD4351378790A98138533067CP4S86R7D8THS45GBCVUM635EPRQRMYRP3DAA5DUPZ6ABDSFP7F5AC" & _
                     "P7ERGH4A7Y6B6NW6NMMBZF83WVER9Y4MMBNLBQDKR7KFVLGLV067CFDQC" & _
                     "WCHGQVVRN24DECEPBL96YJQJTVDCRTNQG3E4WW4GK4GQ5X5L5H88D3XYH" & _
                     "CBRBNASPD3P5CNYFKFHBCSDHHD6WPTCC4XVSM5S88067C2JSTCMVT48C8" & _
                     "HC7SHKGTFJBM28P6XTBCNWHMV6J6KN6W5Q9TQLVR285U6GVCAAUTZLRTP" & _
                     "SRGDQ742B4742XF4MACRR747YDP5FZZ9D" & vbNullChar
    Case RM_1024
      kv.PublicKey = "0201B810DA4A1ADD4351378790A981385330CDG9YQSEUK2HT546KWW46NHSCHMD2TNCSPVNSKGQC6CHDUSU9CC4LDPL" & _
                       "TD3NLRVD3TFV9BU2SYBUBU9TXKLQ3CTKZE5GN9VFG37R9YNK2FE58K7ZY" & _
                       "WTUJYFSJTBMDLLGA9GJ2LJXGHSS9CESGC2K69H65YQGAC7CRGF5T3CPLA" & _
                       "5BDJZKVCUWPZRNA2DN7L956LZVZBQUDPX6PF30CDBH26Z82VE4QQ8N85L" & _
                       "QHYJYYCJ6WQ89H9K9VVQX925SG5FJ79AGVZB6M8TTFKCJ56FAREP8GSTC" & _
                       "NKWCXEALDP9Y2ZLS9QKZV8JRNDHG9D8BRDSCTMDQK9NLAPZ9TGYFS9G7U" & _
                       "LXHYJF7F9A89HPXGTU2N4FQQJL98WZ5QND2KTEMMUUZFAX953HCGNSWUW" & _
                       "U2M7LBEWZSH9GW5SC0CDJDY2HC4HJYUSVTAVXZ7MYVJWF3CU9WC3SVPSL" & _
                       "29WF46DVS2SYKSSAMATPPYGJDE3PBFMGS34CXWQSXKCEAE63L2EXTS9NE" & _
                       "2G597XASY3S34XMYST5YZF4THUTYT5DY9UKKXU6PH8MLXRPZMPMMR83JU" & _
                       "X2WGNEW8ZGL4SKUCUB8CEAB6UZ4FB66WTP3B64VMX7XG75T4Y35479" & vbNullChar
    Case RM_2048
      kv.PublicKey = "0201B810DA4A1ADD4351378790A98138533199H9KZC4CQ5ZKPEGYDW2EHN5AKZA5G5KP4HU8USWJR8XWW7MCH7244RV" & _
                       "PSXFHVU6YQRK4LPUHM497XJYPLLA3DHUZWXK3CB5SUYF75NPYLTNPRUAP" & _
                       "CTVDHAKYWTRQ97HES2E59WDN2LJKFYA2K8BGFSBHP4A6BF5FSDTS8NWLL" & _
                       "C5NEQ76NJ9BAMWXG55UPFFMRQZTU5KV2G6LSPQUJJWA9U4LJ5SCJ9M9ZQ" & _
                       "Z6K7LZA9UAMJ533UQ5J3JPNQAUWJGZFRFCTGAGSBWPWRRF9HRGF9MCX55" & _
                       "QRYGPYMRE6DBJ65SJDX34FVPYWWKWQ48MCKXYXPHQ23BJ42U8ZMDD8CG5" & _
                       "DPHZQ5XTXUKA277XK6PKSTLJ88ZZ9EBXH62REMRZZRGNPKHYM34RW722S" & _
                       "SZHMPFKY7X8UZ19ADGX3UQ7X444XH7MZXEZYW2YLFHR8YL3PTCXVSYX89" & _
                       "ZXN7KW2XNBE8XS3TQRGZVF6KA5USH56NEZYH5RNWBBPVE9LD6H42RQWR5" & _
                       "YVQMT5EQYQTK6YM9V8DA5BJCLGGZ2UGD6NPA2X3SNUS47F7HJBNBCWHRA" & _
                       "YPPCQ5HWCJNPDHUDQMRN2P6PWJFWJ6CLVNK8HXEFLE4ENPXAFN89CRS43" & _
                       "RUMVGDJQCSRB535XYCS6BZYLA9Q6HJV425F26XXHRGA7C8R8BVMELAPEH" & _
                       "5DSA9KXTCV4H2RNVDFHG3YJSERZVFPWHYA823LUBENBL5U3J4LJX2KQLW" & _
                       "L5XGGESPSE2FQWKSQ4NUCDLBEJPQAT2A2477DYS2XEXKLYEAKUN22622C" & _
                       "RLBCAHPFNEV2FJ2H8N3JQGXJRGP19AFHGRW6SS2ZSFYK8EZAPVYL4MCP4" & _
                       "6UMR64Y9T89FHWEPXBRHKWJCSNNNGPU984J5XW4BWTU6PDWPN24W8RU55" & _
                       "A9C3U9H7VHS5PFURASHBT4JAEE5ZKJBSYMCMDVBLU973R72RVPA6U96A2" & _
                       "LX8HMASVST9RVJ7W66V4DYWRDZZQ3673W7C7LVF68TWPLNMYEUQ8FDZRN" & _
                       "P38D9BX5YA3VENETDUUUMR9U7FFP4NZM7G4Y6J6EASK5SAXXTRMZ8F3AH" & _
                       "5FC54E543N739BY5KVZQM7JZWD2P2HPE7BDRMM9JFCGPBWWASTZ7UDNRV" & _
                       "6AFHVMBR9AGAERE9M6W6S2ZT8PBTABPDCKBPPPV6QW9DRXZUGAHDDRRSY" & _
                       "XM4YXQ2QJX6CL33N7RV8846LK8A3DFLDXWZ2NKF8V" & vbNullChar
    Case RM_3072
      kv.PublicKey = "0201B810DA4A1ADD4351378790A98138533267BJBN6W8SY33Y47RWJHWS385XWRV9TSVSB5EM7ECZYNSJ44ZKSD8KV4" & _
                       "6Y9T6TNC6QMDW4V6DBMADU3YUKLP88TCLEUD9FTEUHGXM6T57AQ2EMB59" & _
                       "UPQVNSUT7Z4EHAMDQ6N77VK2A6P847MMWJH9E7C5XX6FNF6MHGWERPWQV" & _
                       "9ZLVR9Z7X5D5Z2XQL6MBM7BDCT2DEDVRBFNDDBLG6LHZ9APM48LS5TKTJ" & _
                       "AGDYFDRVHEGTDH47PCLL8YJ4ZAWCB59F8BN5PZL3NQACP32G3YNBX5E3J" & _
                       "7S28XLRGAX55ZML5XE6Q68EUAL38VUBJ2MZ2UGCCHM7CE6S99N44X9RMV" & _
                       "7B55HULJ4KHPFYSBDUSPQTCWGS76BEQST2QCZDZ2T4FBA4YUJFF47AACE" & _
                       "A4EEFESEYWN48UZCSDZAMGSU5VB9UJKR2XQUSDFS3TNG9QKURQWS7N5Q3" & _
                       "VPYT4QAGGQ5GW2MMXHDJYW55FQPHSS255GVJ7WLLP85JHS8K6DVTJWB4W" & _
                       "4Y8ZEFF7KP6W74PAA8FVPZVDW4RKGMQ8V56Q6R4V34XFE5HR4FZS8GZ6R" & _
                       "36RKW6WN34S2AHR9LCGF8LULB7ZN6NC2AA5RPDZYGWSPPME6267CGLZCP" & _
                       "GG98W557RXCDWAETJHDCRPUXX7AD3E8SL9WMGBV9QFHMSV9UFV7H9NTX3" & _
                       "QYV95CN9P9DSYQWL35R2BWB4GKW6CTWVB2X6WH3P2WFBE6X55KBLAMDB3" & _
                       "SRDSDVY37GKH78MUHY7KDJDC8SJU5FUQRYZ49ULX3YSZL7E284GFVZSGD" & _
                       "FTTQNR6VMBM3LLR78SUSVMJW88XT2K4UHEATRU3V9MMR2VGNGCY9S6R7M" & _
                       "4ELNPEBBMQP2HVPLY5M5VPA92V7NU8ZZ58YYTW5QK9USZ5LV59UZGB2CF" & _
                       "DPZ6HFYU5WB7UU3UYWVNSNKM3W7GBYKJP8TMFW2YN6GNSSE4ZKFVZRLUT" & _
                       "8QPZBBEQT5H9H5Z53D7QV4AJTKTX4EMW62TDWXQVK24JZPSG2VXKCMYZL" & _
                       "BUASE25R3EEK9KBLJ8VX83ZXGTBL5CCDBY33HJ6FKX8AW3WPRX3XTCS9G" & _
                       "2B9SVK2XFFKNSPGFG6FZNS8P2HERFGFL79DKUZZFWHFH4H9UZ7F7F6W3Z" & _
                       "WN84JRRA7SU8T89EQMRBEPVYMMGLGSUMFWWMEDLJM5EGP5WEX9LDUAQXS" & _
                       "55LKDQVRKX4R8NNBHSYBHSNMFYA2C6KGQQFK3TN267DPSZT3PTKHTLNMU" & _
                       "V2YYZZRX3953LPWAKYF8LJUVMEQT3ZC4F9SWMYGUHG6XX66PJFQWSRUW2" & _
                       "C79YLGZ6ZAFS7HLXBTH55UD3EGFBZQ5CLNJDZTEJACDVBCM5FQBTX4DKK"
       kv.PublicKey = kv.PublicKey & _
                       "UDGNSMWWLC5UMQRHW89CTU5636WYDXVZZDAUZ529458LDN2DAR9QADWRZ" & _
                       "UTU8MCKN8ACH3R36YKE52DDF67SM5UDUH7PTATHXE65UCGFRCV49UTF29" & _
                       "BGDSUWGRMC839HUZYQVAG985YUF5KJCAVGKRD8E4YMPJ38KR6HD2KHDGY" & _
                       "PJDMJMN4Y3DTJW5MYX3VUPF32637LMAWFM4QCU7BMP74SCF4N5QXZZVBE" & _
                       "LAQMPYMJC2ZWJ9XFV33YXTTPH3SG9KMUABLL83P7L3UBVM763XJPR5UEH" & _
                       "DZ73XJUGR9QP6299K5PU46XGVWKWFAKWYMRXUSLCFJ3WQTEC6QJH6E5V8" & _
                       "X2RMA5TXGSBEWLGSMNQ2SH6G9MLKK4S486DN4M4QVDTYTM4JQETAJQGP7" & _
                       "6NUR4UNDXR4W4JQSNWDTUGX69SEDC3AL8ZF4TJBQQRXSX2A86UUWCDCFH" & _
                       "JE94A8EP3Q6A2QTYKEE62MV4VJB2AB" & vbNullChar
    Case RM_4096
      kv.PublicKey = "0201B810DA4A1ADD4351378790A98138533334BN75EUD4LFWYFVNFGBRCEMKKXG62QRBXL8GMHQ975B68FJVEMNXQQ7" & _
                       "RKR7RCZMWDVP86QPB3LR49G9BM7EUUZXNCRZBXRF4PEY3RX6UXT4X286K" & _
                       "WMR7AMEE6QNP9AEHGWJT9AVU3F62F37B5GVX2BQF73QWHRFQSQ6XMRP6M" & _
                       "ZDRQ8JT89UF3YRK5UL34MM3L8HLDTWAJF5YY7MRWJUFDQRK9JNCJ6C9KJ" & _
                       "WRE5ACQSNS24NEAHDYKS3AK75HBCTKP9NR2CSL7Q9PPXM4TF7L37USP77" & _
                       "Z7WER6JY67F7YGKTP6MFRMKK9H8XFPZ9XWKK97XCFXK7AW4TB96WGEH4B" & _
                       "YPF9QRF2DGC3LCHW8VTD2EMHVRDR6EEBUG8R4XYKJPLBPRCJP445DU2BW" & _
                       "JWELKAY45GKDU5HLTTDTWRH2JFKJ7AVAKLPEELN29YHX5JR773P9ERW7N" & _
                       "UFMWDKD4UL4YPU5QW2L4A7ZN3E8ZDQVEZUR6ZRDQXRLQRLUNHVB4XGBWD" & _
                       "HM79NGJARHDBQJCD8NWZCWPBY26QARP7A5S48DCV29F7MUTHU3YAHYVS7" & _
                       "ZPGXJZZA5HBBY4K5BQPUG6MVCBG8H3C7VL8KH9EH58NUVCE6F2CGMSM94" & _
                       "4CQDKNVGWWWRNK4DG26UT88Y9ULUPJ25G9KLTQPK3TBXZEK43X8KPMJT8" & _
                       "DF6MTQ5RB94XR2BT9H9NYYTXL29GF8KZY9QNHAW4LTT2RDQTD2ELWPSV4" & _
                       "4AND9K8G5VKLQ287UBEVHA82CMSMGQQBMNQZVAZ9G8T5TD6G9F7XQHMJT" & _
                       "HCL6PFEDUW5MN9JASF2EKPT2H33325A3SFGGM5C3RYKZSYSSQC5FLHNX9" & _
                       "VHN4HQVWD66YECY4R97JZHQALRTCHXUWH85LSJCCTQZT8JF52FHG6FV9J" & _
                       "UJWEU24K9Z7SKYTYA9NH7GW29FSNKUK3DMFXY48VEYZVDRTTMLFYSJH8B" & _
                       "RQXV72REYGSM6SLX89EVQ52CN9N8YDLWHAWCDDNM89YN2FCRTLE8688XN" & _
                       "F4MZMFE6GP9JK2JTFJVUKBLES2ZVWSBCJE9N3D7DG9LL9Z3U42QFJJPE2" & _
                       "HE5XCRY25UND96R9D7655ZBSCPF796FJZ4GPLY7AMZLGLR77GRP467ELK" & _
                       "PXSZ9ZF8MUYFDHV4EFACPZ79CDFTYW56NE9JDWDVUMNLY9EXDSF8ZNABE" & _
                       "MDQU6T9RVLTNRMZJJ8EJSUM9TV8YA6MNWF2Y66MD3VQ9L662F5X6VE9ZC" & _
                       "PPRTNMEV2DG9BUMFMSL7PUR9H5QG6VVBDBMEU3PLABL57HMSQ5C83E9X8" & _
                       "RTPY4QSEH2H7R2QDJHT5LQSFNQJL2NZ24GLNTFXG468WC5UUTDD68G8HM"
      kv.PublicKey = kv.PublicKey & _
                       "477Z8P4F9ZZHUGZ6VPFF32A2MPWY8LPXNECCKM9EEVLDDPUJ8LXN2AE6K" & _
                       "Y2Q42FVBCJM9GQTXNRHBED735KCFD4YGV4U5U3LJD6NJ886W6XQLWH3G7" & _
                       "3VZ6T5YDUQP6DA5ZHLKQSGATDJHUWC2ELTE7QJFXH8H9EAQYZPPMW76JG" & _
                       "Z48UBND9VXFXZMSGBNWQPNQG7E4TCBDMVKUSA9TTVSNLN3DXEZNXH787R" & _
                       "N7XHFBJNZ5W74DUMNBYVHEQDYMZBQCFMS8LGSDUAU6QE9DD5Q334BX62T" & _
                       "JP5WQQDS2ZEWW76XW7VMLX3L7V9UVD7RL297VDBVRFPQ5MYA3YFVBVNVA" & _
                       "R5TJXMQ4X2U2PW6UWSKBXT58HG3QPZM2RVEX2PDMCVJDFTJMXR9NPLW4C" & _
                       "6AE4Q9A8TTAQ68BSN9WWTFFTSX68ECVARFPDBBH5DMP4KYFARTFVCSWNF" & _
                       "FGAPBYYGFJA4MGHEDWTNE54MPGER7EPCZEV2ESJRMM6XDMFGABG97HECN" & _
                       "3SZFUBRKCNDZ2TE9F6EERULRCDAV5EMY6KVY9NY9MYNPP2FQ5WFWLMRYD" & _
                       "4TNYYHE6EDMQ6KK79HH5Q5KBW6DDQYYNUR365W2454CHEZWZAPU82SX4H" & _
                       "KHNZXBRVWAT7G9CJBKHNBPSVEL67X8UJHBFHZH8ZD4NSEVFZM4Y768TJ6" & _
                       "QP3BGEKLTY4UZUWHG63QMKVWAQW9E7WRFNJCH4XRD97JHNKMFUTRFVH68" & _
                       "G5CKSMGC725AZ9CBSL2JX43P4EY44CMF56AJ6BEXVCJP2ZDWCT9G55K4D" & _
                       "F24J7TTJMFXTQH95CBNX67CBPNWEKHCWQV6VD73Y9KCZHNBFUFS8TCYNN" & _
                       "WXRGFKNVRDFUKWHDWDDTSPEW8YCKLPMX2GUV3N4JFJMUE6TSJR6Z53C9F" & _
                       "SKZAY3EN7G66JPBF5E9S6Y7RQHPWZHSRDQ7XH87PHUJFLJFGD7WNE3Q9P" & _
                       "EXMW33LVJBFEUXKNUB6SU7ZYCEX96XT8G27FLUV7XPV4JK64DWDJCX9WV" & _
                       "4VL8CK23FQJ28UG9JUZTQJ3DRL32BTJVRD4LVQ6MK9LCE7ZZP925JK7ZD" & _
                       "92SCV4DDJJ5EXMVBF" & vbNullChar
  End Select

  ' Fill key buffer
  kv.Key = tKey.Text
  kv.KeyLen = Len(tKey.Text)
  ' Fill User Info buffer
  kv.RegInfo = tbUserInfo.Text
  kv.RegInfoLen = Len(tbUserInfo.Text)
  ' Hardware ID
  kv.UseHardwareLocking = cbHardware.Value
  If kv.UseHardwareLocking Then
    kv.HardwareID = tbHardware.Text
  End If

  kv.EncryptedConstant = 2113444489

  ' Verify reg. key
  dwResult = KG_VerifyRegistrationInfo(kv)
  If dwResult = ERROR_OK Then
    sresult = "Key is valid!" & Chr$(13)
    sresult = sresult & "Key creation date: " & Str$(kv.CreationDay) & "/" & Str$(kv.CreationMonth) & "/" & Str$(kv.CreationYear) & Chr$(13)
    If kv.UseKeyExpiration Then
      sresult = sresult & "Key expiration date: " & Str$(kv.ExpirationDay) & "/" & Str$(kv.ExpirationMonth) & "/" & Str$(kv.ExpirationYear) & Chr$(13)
    End If
    If kv.UseRegisterAfter Then
      sresult = sresult & "Register After date: " & Str$(kv.RegisterAfterDay) & "/" & Str$(kv.RegisterAfterMonth) & "/" & Str$(kv.RegisterAfterYear) & Chr$(13)
    End If
    If kv.UseRegisterBefore Then
      sresult = sresult & "Register Before date: " & Str$(kv.RegisterBeforeDay) & "/" & Str$(kv.RegisterBeforeMonth) & "/" & Str$(kv.RegisterBeforeYear) & Chr$(13)
    End If
    If kv.UseExecutionsLimit Then
      sresult = sresult & "Executions: " & Str$(kv.ExecutionsCount) & Chr$(13)
    End If
    If kv.UseDaysLimit Then
      sresult = sresult & "Days: " & Str$(kv.DaysCount) & Chr$(13)
    End If
    If kv.UseRunTimeLimit Then
      sresult = sresult & "Runtime: " & Str$(kv.RunTimeMinutes) & Chr$(13)
    End If
    If kv.UseGlobalTimeLimit Then
      sresult = sresult & "Global Time: " & Str$(kv.GlobalTimeMinutes) & Chr$(13)
    End If
    If kv.UseCountyLimit Then
      For I = 0 To comCountries.ListCount - 1
        If comCountries.ItemData(I) = kv.CountryCode Then
          sresult = sresult & "Country Lock: " & comCountries.List(I) & Chr$(13)
        End If
      Next I
    End If
    For I = 1 To NUMBER_OF_CRYPTED_SECTIONS
      If kv.EncryptedSections(I - 1) = 1 Then
        sresult = sresult & "Unlock section #" & Str$(I) & Chr$(13)
      End If
    Next I
  Else
    Select Case dwResult
      Case EP_ERROR_UNKNOWN
        sresult = "EP_ERROR_UNKNOWN"
      Case EP_ERROR_KEYBUFFEREMPTY
        sresult = "EP_ERROR_KEYBUFFEREMPTY"
      Case EP_ERROR_KEYBUFFERISLESS
        sresult = "EP_ERROR_KEYBUFFERISLESS"
      Case EP_ERROR_REGINFOEMPTY
        sresult = "EP_ERROR_REGINFOEMPTY"
      Case EP_ERROR_REGINFOTOOLARGE
        sresult = "EP_ERROR_REGINFOTOOLARGE"
      Case EP_ERROR_PRIVATEKEYISNOTSET
        sresult = "EP_ERROR_PRIVATEKEYISNOTSET"
      Case EP_ERROR_PUBLICKEYISNOTSET
        sresult = "EP_ERROR_PUBLICKEYISNOTSET"
      Case EP_ERROR_PRIVATEKEYISINVALID
        sresult = "EP_ERROR_PRIVATEKEYISINVALID"
      Case EP_ERROR_PUBLICKEYISINVALID
        sresult = "EP_ERROR_PUBLICKEYISINVALID"
      Case EP_ERROR_KEYMODEISINVALID
        sresult = "EP_ERROR_KEYMODEISINVALID"
      Case EP_ERROR_KEYBASEISINVALID
        sresult = "EP_ERROR_KEYBASEISINVALID"
      Case EP_ERROR_CURRENTDATEISINVALID
        sresult = "EP_ERROR_CURRENTDATEISINVALID"
      Case EP_ERROR_EXPIRATIONDATEISINVALID
        sresult = "EP_ERROR_EXPIRATIONDATEISINVALID"
      Case EP_ERROR_KEYISINVALID
        sresult = "EP_ERROR_KEYISINVALID"
      Case EP_ERROR_HARDWAREID
        sresult = "EP_ERROR_HARDWAREID"
      Case EP_ERROR_HARDWAREBUFFEREMPTY
        sresult = "EP_ERROR_HARDWAREBUFFEREMPTY"
      Case EP_ERROR_HARDWAREIDINVALIDFORKEY
        sresult = "EP_ERROR_HARDWAREIDINVALIDFORKEY"
      Case EP_ERROR_PROJECTFILENOTFOUND
        sresult = "EP_ERROR_PROJECTFILENOTFOUND"
      Case EP_ERROR_INVALIDPROJECTFILE
        sresult = "EP_ERROR_INVALIDPROJECTFILE"
      Case EP_ERROR_EXECUTIONSNUMBERINVALID
        tKey.Text = "EP_ERROR_EXECUTIONSNUMBERINVALID"
      Case EP_ERROR_DAYSNUMBERINVALID
        tKey.Text = "EP_ERROR_DAYSNUMBERINVALID"
      Case EP_ERROR_COUNTRYCODEINVALID
        tKey.Text = "EP_ERROR_COUNTRYCODEINVALID"
      Case EP_ERROR_RUNTIMEINVALID
        tKey.Text = "EP_ERROR_RUNTIMEINVALID"
      Case EP_ERROR_GLOBALTIMEINVALID
        tKey.Text = "EP_ERROR_GLOBALTIMEINVALID"
      Case EP_ERROR_INSTALLBEFOREINVALID
        tKey.Text = "EP_ERROR_INSTALLBEFOREINVALID"
      Case EP_ERROR_INSTALLAFTERINVALID
        tKey.Text = "EP_ERROR_INSTALLAFTERINVALID"
      Case Else
        sresult = "Unknown error"
    End Select
  End If
  MsgBox sresult
End Sub

See function examples in the installation folder, Examples\Keygen subfolder.


Function KG_VerifyRegistrationInfoFromProject

KG_VerifyRegistrationInfoFromProject is used for verifying the registration information and extracting registration key parameters from ANSI-based registration information. The function has two parameters, one of them is a pointer to the TKeyVerifyParams structure, the other one is ANSI - null terminated string - the path to the Enigma Protector project file. The function reads secure information from the project file, so it does not require secure parameters PublicKey, KeyMode, KeyBase and EncryptedConstant in the TKeyVerifyParams structure.

Return Values

EP_NO_ERROR=0 | the function succeeds, TKeyVerifyParams structure contains registration key parameters;
EP_ERROR_UNKNOWN=1 | unknown error
EP_ERROR_KEYBUFFEREMPTY=2 | memory buffer for registration key is not allocated
EP_ERROR_KEYBUFFERISLESS=3 | size of allocated memory for registration key is less than required
EP_ERROR_REGINFOEMPTY=4 | registration information is not specified
EP_ERROR_REGINFOTOOLARGE=5 | registration information is empty (has a null size)
EP_ERROR_PRIVATEKEYISNOTSET=6 | private key is not set
EP_ERROR_PUBLICKEYISNOTSET=7 | public key is not set
EP_ERROR_PRIVATEKEYISINVALID=8 | private key is invalid
EP_ERROR_PUBLICKEYISINVALID=9 | public key is invalid
EP_ERROR_KEYMODEISINVALID=10 | key mode is invalid
EP_ERROR_KEYBASEISINVALID=11 | key base is invalid
EP_ERROR_CURRENTDATEISINVALID=12 | current date is invalid
EP_ERROR_EXPIRATIONDATEISINVALID=13 | expiration date is invalid
EP_ERROR_KEYISINVALID=14 | key is invalid
EP_ERROR_HARDWAREID=15 | hardware id is invalid
EP_ERROR_HARDWAREBUFFEREMPTY=16 | hardware id buffer is empty
EP_ERROR_HARDWAREIDINVALIDFORKEY=17 | hardware id is invalid for the key
EP_ERROR_PROJECTFILENOTFOUND=18 | project file is not found
EP_ERROR_INVALIDPROJECTFILE=19 | project file is invalid
EP_ERROR_EXECUTIONSNUMBERINVALID=20 | executions number is invalid
EP_ERROR_DAYSNUMBERINVALID=21 | days number is invalid
EP_ERROR_COUNTRYCODEINVALID=22 | country code is invalid
EP_ERROR_RUNTIMEINVALID=23 | run-time value is invalid
EP_ERROR_GLOBALTIMEINVALID=24 | global time is invalid
EP_ERROR_INSTALLBEFOREINVALID=25 | register before date is invalid
EP_ERROR_INSTALLAFTERINVALID=26 | register after date is invalid

Definition

Show/Hide Delphi function definition

function KG_VerifyRegistrationInfoFromProject(ProjectFile : PAnsiChar; kv : PKeyVerifyParams) : dword; external 'keygen.dll' name 'KG_VerifyRegistrationInfoFromProject';

Show/Hide C++ function definition

 extern  "C" __declspec( dllimport ) __stdcall int KG_VerifyRegistrationInfoFromProject(char* pfile, PKeyVerifyParams kv);

Show/Hide C# (.NET) function definition

public class Enigma_KeyGen_IDE
{
    [DllImport("keygen.dll", CallingConvention = CallingConvention.StdCall)]
    public static extern uint KG_VerifyRegistrationInfoFromProject(string FileName, ref TKeyVerifyParams kv);
}

Show/Hide Visual Basic function definition

Public Declare Function KG_VerifyRegistrationInfoFromProject Lib "keygen.dll" (ByVal ProjectName As String, ByRef kv As TKeyVerifyParams) As Long

Examples

Show/Hide Delphi function example

procedure TfrmMain.btnVerifyPClick(Sender: TObject);
var
  kv : TKeyVerifyParams;
  i : integer;
  dwResult : dword;
  stemp : string;
  sresult : string;
begin
  if eUserInfo.Text = '' then
  begin
    ShowMessage('User info field is empty!');
    Exit;
  end;
  if mKey.Text = '' then
  begin
    ShowMessage('Key field is empty!');
    Exit;
  end;

  kv.RegInfo := PAnsiChar(AnsiString(eUserInfo.Text));
  kv.RegInfoLen := strlen(PAnsiChar(kv.RegInfo));
  kv.Key := PAnsiChar(AnsiString(mKey.Text));
  kv.KeyLen := strlen(PAnsiChar(kv.Key));
  // Hardware ID
  kv.UseHardwareLocking := cbHardwareID.Checked;
  if kv.UseHardwareLocking then
  begin
    kv.HardwareID := PAnsiChar(AnsiString(eHardware.Text));
  end;

  dwResult := KG_VerifyRegistrationInfoFromProject('default.enigma', @kv);

  if dwResult = EP_NO_ERROR then
  begin
    sresult := 'Key is valid!'#13#10;
    sresult := format(sresult + 'Creation Date: %s'#13#10, [DateToStr(EncodeDate(kv.CreationYear, kv.CreationMonth, kv.CreationDay))]);
    if kv.UseKeyExpiration then
    begin
      sresult := format(sresult + 'Expiration Date: %s'#13#10, [DateToStr(EncodeDate(kv.ExpirationYear, kv.ExpirationMonth, kv.ExpirationDay))]);
    end;
    if kv.UseRegisterAfter then
    begin
      sresult := format(sresult + 'Register After Date: %s'#13#10, [DateToStr(EncodeDate(kv.RegisterAfterYear, kv.RegisterAfterMonth, kv.RegisterAfterDay))]);
    end;
    if kv.UseRegisterBefore then
    begin
      sresult := format(sresult + 'Register Before Date: %s'#13#10, [DateToStr(EncodeDate(kv.RegisterBeforeYear, kv.RegisterBeforeMonth, kv.RegisterBeforeDay))]);
    end;
    if kv.UseCountyLimit then
    begin
      for i := 0 to length(KEY_COUNTRIES) - 1 do
      begin
        if kv.CountryCode = KEY_COUNTRIES[i].Code then
        begin
          stemp := KEY_COUNTRIES[i].Name;
          break;
        end;
      end;
      sresult := format(sresult + 'Locked to country: %s'#13#10, [stemp]);
    end;
    if kv.UseExecutionsLimit then
    begin
      sresult := format(sresult + 'Executions limit: %d executions'#13#10, [kv.ExecutionsCount]);
    end;
    if kv.UseDaysLimit then
    begin
      sresult := format(sresult + 'Days limit: %d days'#13#10, [kv.DaysCount]);
    end;
    if kv.UseRunTimeLimit then
    begin
      sresult := format(sresult + 'Run-time limit: %d minutes'#13#10, [kv.RunTimeMinutes]);
    end;
    if kv.UseGlobalTimeLimit then
    begin
      sresult := format(sresult + 'Global Time limit: %d minutes'#13#10, [kv.GlobalTimeMinutes]);
    end;
    for i := 1 to NUMBER_OF_CRYPTED_SECTIONS do
    begin
      if kv.EncryptedSections[i] then
      begin
        sresult := format(sresult + 'Unlocked section #%d'#13#10, [i]);
      end;
    end;
  end else
  begin
    case dwResult of
      EP_ERROR_UNKNOWN                 : sresult := 'EP_ERROR_UNKNOWN                ';
      EP_ERROR_KEYBUFFEREMPTY          : sresult := 'EP_ERROR_KEYBUFFEREMPTY         ';
      EP_ERROR_KEYBUFFERISLESS         : sresult := 'EP_ERROR_KEYBUFFERISLESS        ';
      EP_ERROR_REGINFOEMPTY            : sresult := 'EP_ERROR_REGINFOEMPTY           ';
      EP_ERROR_REGINFOTOOLARGE         : sresult := 'EP_ERROR_REGINFOTOOLARGE        ';
      EP_ERROR_PRIVATEKEYISNOTSET      : sresult := 'EP_ERROR_PRIVATEKEYISNOTSET     ';
      EP_ERROR_PUBLICKEYISNOTSET       : sresult := 'EP_ERROR_PUBLICKEYISNOTSET      ';
      EP_ERROR_PRIVATEKEYISINVALID     : sresult := 'EP_ERROR_PRIVATEKEYISINVALID    ';
      EP_ERROR_PUBLICKEYISINVALID      : sresult := 'EP_ERROR_PUBLICKEYISINVALID     ';
      EP_ERROR_KEYMODEISINVALID        : sresult := 'EP_ERROR_KEYMODEISINVALID       ';
      EP_ERROR_KEYBASEISINVALID        : sresult := 'EP_ERROR_KEYBASEISINVALID       ';
      EP_ERROR_CURRENTDATEISINVALID    : sresult := 'EP_ERROR_CURRENTDATEISINVALID   ';
      EP_ERROR_EXPIRATIONDATEISINVALID : sresult := 'EP_ERROR_EXPIRATIONDATEISINVALID';
      EP_ERROR_KEYISINVALID            : sresult := 'EP_ERROR_KEYISINVALID           ';
      EP_ERROR_HARDWAREID              : sresult := 'EP_ERROR_HARDWAREID             ';
      EP_ERROR_HARDWAREBUFFEREMPTY     : sresult := 'EP_ERROR_HARDWAREBUFFEREMPTY    ';
      EP_ERROR_HARDWAREIDINVALIDFORKEY : sresult := 'EP_ERROR_HARDWAREIDINVALIDFORKEY';
      EP_ERROR_PROJECTFILENOTFOUND     : sresult := 'EP_ERROR_PROJECTFILENOTFOUND    ';
      EP_ERROR_INVALIDPROJECTFILE      : sresult := 'EP_ERROR_INVALIDPROJECTFILE     ';
      EP_ERROR_EXECUTIONSNUMBERINVALID : sresult := 'EP_ERROR_EXECUTIONSNUMBERINVALID';
      EP_ERROR_DAYSNUMBERINVALID       : sresult := 'EP_ERROR_DAYSNUMBERINVALID      ';
      EP_ERROR_COUNTRYCODEINVALID      : sresult := 'EP_ERROR_COUNTRYCODEINVALID     ';
      EP_ERROR_RUNTIMEINVALID          : sresult := 'EP_ERROR_RUNTIMEINVALID         ';
      EP_ERROR_GLOBALTIMEINVALID       : sresult := 'EP_ERROR_GLOBALTIMEINVALID      ';
      EP_ERROR_INSTALLBEFOREINVALID    : sresult := 'EP_ERROR_INSTALLBEFOREINVALID   ';
      EP_ERROR_INSTALLAFTERINVALID     : sresult := 'EP_ERROR_INSTALLAFTERINVALID    ';
      else sresult := 'Unknown error';
    end;
  end;
  ShowMessage(sresult);
end;

Show/Hide Borland C++ Builder function example

void __fastcall TfrmMain::btnVerifyFPClick(TObject *Sender)
{
  if (eUserInfo->Text == "")
  {
    ShowMessage("Registration info is empty!");
    return;
  }
  if (mKey->Text == "")
  {
    ShowMessage("Registration key is empty!");
    return;
  }

  TKeyVerifyParams kv;
  WORD wYear;
  WORD wDay;
  WORD wMonth;
  DWORD dwResult;

  // Clear params buffer
  memset(&kv, 0, sizeof(kv));

  // Fill key buffer
  char keybuf[2048];
  memset(&keybuf, 0, sizeof(keybuf));
  memcpy(&keybuf, mKey->Text.c_str(), mKey->Text.Length());
  kv.Key = keybuf;
  kv.KeyLen = mKey->Text.Length();

  // Fill User Info
  char namebuf[255];
  memset(&namebuf, 0, sizeof(namebuf));
  memcpy(&namebuf, eUserInfo->Text.c_str(), eUserInfo->Text.Length());
  kv.RegInfo = namebuf;
  kv.RegInfoLen = eUserInfo->Text.Length();

  // Hardware ID
  kv.UseHardwareLocking = cbHardware->Checked;
  if (kv.UseHardwareLocking)
  {
    char hdbuf[255];
    memset(&hdbuf, 0, sizeof(hdbuf));
    memcpy(&hdbuf, eHardware->Text.c_str(), eHardware->Text.Length());
    kv.HardwareID = hdbuf;
  }

  dwResult = KG_VerifyRegistrationInfoFromProject("default.enigma", &kv);

  AnsiString sresult;
  if (dwResult == EP_NO_ERROR)
  {
    sresult = "Valid registration key!\n";
    sresult += Format("Creation date %d/%d/%d\n", ARRAYOFCONST(((int)kv.CreationYear, (int)kv.CreationMonth, (int)kv.CreationDay)));
    if (kv.UseKeyExpiration)
    {
      sresult += Format("Expiration date %d/%d/%d\n", ARRAYOFCONST(((int)kv.ExpirationYear, (int)kv.ExpirationMonth, (int)kv.ExpirationDay)));
    }
    if (kv.UseRegisterAfter)
    {
      sresult += Format("Register After date %d/%d/%d\n", ARRAYOFCONST(((int)kv.RegisterAfterYear, (int)kv.RegisterAfterMonth, (int)kv.RegisterAfterDay)));
    }
    if (kv.UseRegisterBefore)
    {
      sresult += Format("Register Before date %d/%d/%d\n", ARRAYOFCONST(((int)kv.RegisterBeforeYear, (int)kv.RegisterBeforeMonth, (int)kv.RegisterBeforeDay)));
    }
    if (kv.UseExecutionsLimit)
    {
      sresult += Format("Executions %d\n", ARRAYOFCONST(((int)kv.ExecutionsCount)));
    }
    if (kv.UseDaysLimit)
    {
      sresult += Format("Days %d\n", ARRAYOFCONST(((int)kv.DaysCount)));
    }
    if (kv.UseRunTimeLimit)
    {
      sresult += Format("Run-time minutes %d\n", ARRAYOFCONST(((int)kv.RunTimeMinutes)));
    }
    if (kv.UseGlobalTimeLimit)
    {
      sresult += Format("Global Time minutes %d\n", ARRAYOFCONST(((int)kv.GlobalTimeMinutes)));
    }
    if (kv.UseCountyLimit)
    {
      for (int i = 0; i < ARRAYSIZE(KEY_COUNTRIES); i++)
      {
        if (kv.CountryCode == KEY_COUNTRIES[i].Code)
        {
          sresult += Format("Country Lock %s\n", ARRAYOFCONST((KEY_COUNTRIES[i].Name)));
          break;
        }
      }
    }
    for (int i = 0; i < NUMBER_OF_CRYPTED_SECTIONS; i++)
    {
      if (kv.EncryptedSections[i])
      {
        sresult += Format("Unlocked section #%d\n", ARRAYOFCONST((i + 1)));
      }
    }
  } else
  {
    switch (dwResult)
    {
      case EP_ERROR_UNKNOWN:
        sresult = "EP_ERROR_UNKNOWN";
        break;
      case EP_ERROR_KEYBUFFEREMPTY:
        sresult = "EP_ERROR_KEYBUFFEREMPTY";
        break;
      case EP_ERROR_KEYBUFFERISLESS:
        sresult = "EP_ERROR_KEYBUFFERISLESS";
        break;
      case EP_ERROR_REGINFOEMPTY:
        sresult = "EP_ERROR_REGINFOEMPTY";
        break;
      case EP_ERROR_REGINFOTOOLARGE:
        sresult = "EP_ERROR_REGINFOTOOLARGE";
        break;
      case EP_ERROR_PRIVATEKEYISNOTSET:
        sresult = "EP_ERROR_PRIVATEKEYISNOTSET";
        break;
      case EP_ERROR_PUBLICKEYISNOTSET:
        sresult = "EP_ERROR_PUBLICKEYISNOTSET";
        break;
      case EP_ERROR_PRIVATEKEYISINVALID:
        sresult = "EP_ERROR_PRIVATEKEYISINVALID";
        break;
      case EP_ERROR_PUBLICKEYISINVALID:
        sresult = "EP_ERROR_PUBLICKEYISINVALID";
        break;
      case EP_ERROR_KEYMODEISINVALID:
        sresult = "EP_ERROR_KEYMODEISINVALID";
        break;
      case EP_ERROR_KEYBASEISINVALID:
        sresult = "EP_ERROR_KEYBASEISINVALID";
        break;
      case EP_ERROR_CURRENTDATEISINVALID:
        sresult = "EP_ERROR_CURRENTDATEISINVALID";
        break;
      case EP_ERROR_EXPIRATIONDATEISINVALID:
        sresult = "EP_ERROR_EXPIRATIONDATEISINVALID";
        break;
      case EP_ERROR_KEYISINVALID:
        sresult = "EP_ERROR_KEYISINVALID";
        break;
      case EP_ERROR_HARDWAREID:
        sresult = "EP_ERROR_HARDWAREID";
        break;
      case EP_ERROR_HARDWAREBUFFEREMPTY:
        sresult = "EP_ERROR_HARDWAREBUFFEREMPTY";
        break;
      case EP_ERROR_HARDWAREIDINVALIDFORKEY:
        sresult = "EP_ERROR_HARDWAREIDINVALIDFORKEY";
        break;
      case EP_ERROR_PROJECTFILENOTFOUND:
        sresult = "EP_ERROR_PROJECTFILENOTFOUND";
        break;
      case EP_ERROR_INVALIDPROJECTFILE:
        sresult = "EP_ERROR_INVALIDPROJECTFILE";
        break;
      case EP_ERROR_EXECUTIONSNUMBERINVALID:
        mKey->Text = "EP_ERROR_EXECUTIONSNUMBERINVALID";
        break;
      case EP_ERROR_DAYSNUMBERINVALID:
        mKey->Text = "EP_ERROR_DAYSNUMBERINVALID";
        break;
      case EP_ERROR_COUNTRYCODEINVALID:
        mKey->Text = "EP_ERROR_COUNTRYCODEINVALID";
        break;
      case EP_ERROR_RUNTIMEINVALID:
        mKey->Text = "EP_ERROR_RUNTIMEINVALID";
        break;
      case EP_ERROR_GLOBALTIMEINVALID:
        mKey->Text = "EP_ERROR_GLOBALTIMEINVALID";
        break;
      case EP_ERROR_INSTALLBEFOREINVALID:
        mKey->Text = "EP_ERROR_INSTALLBEFOREINVALID";
        break;
      case EP_ERROR_INSTALLAFTERINVALID:
        mKey->Text = "EP_ERROR_INSTALLAFTERINVALID";
        break;
      default:
        sresult = "Unknown error";
        break;
    }
  }
  ShowMessage(sresult);
}

Show/Hide Visual C++ function example

void CKeygenDlg::OnBnClickedButtonverfp()
{
    // TODO: Add your control notification handler code here
  TKeyVerifyParams kv;
  char keybuffer[2048];
  char username[255];
  char hardwareid[255];
  DWORD dwResult;

  // Clear params buffer
  memset(&kv, 0, sizeof(kv));
  // Clear key buffer
  memset(&keybuffer, 0, sizeof(keybuffer));
  GetDlgItemText(IDC_EDITKEY, (char*)&keybuffer, sizeof(keybuffer));
  kv.Key = (char*) keybuffer;
  kv.KeyLen = strlen(kv.Key);

  // Fill User Info
  memset(&username, 0, sizeof(username));
  GetDlgItemText(IDC_EDITNAME, (char*)&username, sizeof(username));
  kv.RegInfo = (char*)&username;
  kv.RegInfoLen = strlen(kv.RegInfo);

  // Hardware ID
  if (IsDlgButtonChecked(IDC_CHECKHD) != 0)
  {
      kv.UseHardwareLocking = true;
      memset(&hardwareid, 0, sizeof(hardwareid));
      GetDlgItemText(IDC_EDITHD, (char*)&hardwareid, sizeof(hardwareid));
      kv.HardwareID = (char*)&hardwareid;
  }

  // Generate reg. key
  dwResult = KG_VerifyRegistrationInfoFromProject("default.enigma", &kv);

  if (dwResult == EP_NO_ERROR)
  {
      char tmp[255];
      // Creation date
      char mes[2048] = "Valid Registration Key!\n";
      sprintf(tmp, "Creation date: %d/%d/%d\n", kv.CreationDay, kv.CreationMonth, kv.CreationYear);
      strcat(mes, tmp);
      // Expiration date
      if (kv.UseKeyExpiration)
      {
          sprintf(tmp, "Expiration date: %d/%d/%d\n", kv.ExpirationDay, kv.ExpirationMonth, kv.ExpirationYear);
          strcat(mes, tmp);
      }
      // Register After date
      if (kv.UseRegisterAfter)
      {
          sprintf(tmp, "Register After date: %d/%d/%d\n", kv.RegisterAfterDay, kv.RegisterAfterMonth, kv.RegisterAfterYear);
          strcat(mes, tmp);
      }
      // Register Before date
      if (kv.UseRegisterBefore)
      {
          sprintf(tmp, "Register Before date: %d/%d/%d\n", kv.RegisterBeforeDay, kv.RegisterBeforeMonth, kv.RegisterBeforeYear);
          strcat(mes, tmp);
      }
      // Executions
      if (kv.UseExecutionsLimit)
      {
          sprintf(tmp, "Executions: %d\n", kv.ExecutionsCount);
          strcat(mes, tmp);
      }
      // Days
      if (kv.UseDaysLimit)
      {
          sprintf(tmp, "Days: %d\n", kv.DaysCount);
          strcat(mes, tmp);
      }
      // Run-time
      if (kv.UseRunTimeLimit)
      {
          sprintf(tmp, "Run-time: %d minutes\n", kv.RunTimeMinutes);
          strcat(mes, tmp);
      }
      // Global Time
      if (kv.UseGlobalTimeLimit)
      {
          sprintf(tmp, "Global Time: %d minutes\n", kv.GlobalTimeMinutes);
          strcat(mes, tmp);
      }
      // Country
      if (kv.UseCountyLimit)
      {
          for (int i = 0; i < ARRAYSIZE(KEY_COUNTRIES); i++)
          {
              if (kv.CountryCode == KEY_COUNTRIES[i].Code)
              {
                  sprintf(tmp, "Country Lock: %s\n", KEY_COUNTRIES[i].Name);
                  strcat(mes, tmp);
                  break;
              }
          }
      }
      for (int i = 0; i < NUMBER_OF_CRYPTED_SECTIONS; i++)
      {
          if (kv.EncryptedSections[i])
          {
              sprintf(tmp, "Unlocked section: #%d\n", i + 1);
              strcat(mes, tmp);
          }
      }
      MessageBox(mes);
  } else
  {
    char* sError;
    switch (dwResult)
    {
      case EP_ERROR_UNKNOWN:
        sError = "EP_ERROR_UNKNOWN";
        break;
      case EP_ERROR_KEYBUFFEREMPTY:
        sError = "EP_ERROR_KEYBUFFEREMPTY";
        break;
      case EP_ERROR_KEYBUFFERISLESS:
        sError = "EP_ERROR_KEYBUFFERISLESS";
        break;
      case EP_ERROR_REGINFOEMPTY:
        sError = "EP_ERROR_REGINFOEMPTY";
        break;
      case EP_ERROR_REGINFOTOOLARGE:
        sError = "EP_ERROR_REGINFOTOOLARGE";
        break;
      case EP_ERROR_PRIVATEKEYISNOTSET:
        sError = "EP_ERROR_PRIVATEKEYISNOTSET";
        break;
      case EP_ERROR_PUBLICKEYISNOTSET:
        sError = "EP_ERROR_PUBLICKEYISNOTSET";
        break;
      case EP_ERROR_PRIVATEKEYISINVALID:
        sError = "EP_ERROR_PRIVATEKEYISINVALID";
        break;
      case EP_ERROR_PUBLICKEYISINVALID:
        sError = "EP_ERROR_PUBLICKEYISINVALID";
        break;
      case EP_ERROR_KEYMODEISINVALID:
        sError = "EP_ERROR_KEYMODEISINVALID";
        break;
      case EP_ERROR_KEYBASEISINVALID:
        sError = "EP_ERROR_KEYBASEISINVALID";
        break;
      case EP_ERROR_CURRENTDATEISINVALID:
        sError = "EP_ERROR_CURRENTDATEISINVALID";
        break;
      case EP_ERROR_EXPIRATIONDATEISINVALID:
        sError = "EP_ERROR_EXPIRATIONDATEISINVALID";
        break;
      case EP_ERROR_KEYISINVALID:
        sError = "EP_ERROR_KEYISINVALID";
        break;
      case EP_ERROR_HARDWAREID:
        sError = "EP_ERROR_HARDWAREID";
        break;
      case EP_ERROR_HARDWAREBUFFEREMPTY:
        sError = "EP_ERROR_HARDWAREBUFFEREMPTY";
        break;
      case EP_ERROR_HARDWAREIDINVALIDFORKEY:
        sError = "EP_ERROR_HARDWAREIDINVALIDFORKEY";
        break;
      case EP_ERROR_PROJECTFILENOTFOUND:
        sError = "EP_ERROR_PROJECTFILENOTFOUND";
        break;
      case EP_ERROR_INVALIDPROJECTFILE:
        sError = "EP_ERROR_INVALIDPROJECTFILE";
        break;
      case EP_ERROR_EXECUTIONSNUMBERINVALID:
        sError = "EP_ERROR_EXECUTIONSNUMBERINVALID";
        break;
      case EP_ERROR_DAYSNUMBERINVALID:
        sError = "EP_ERROR_DAYSNUMBERINVALID";
        break;
      case EP_ERROR_COUNTRYCODEINVALID:
        sError = "EP_ERROR_COUNTRYCODEINVALID";
        break;
      case EP_ERROR_RUNTIMEINVALID:
        sError = "EP_ERROR_RUNTIMEINVALID";
        break;
      case EP_ERROR_GLOBALTIMEINVALID:
        sError = "EP_ERROR_GLOBALTIMEINVALID";
        break;
      case EP_ERROR_INSTALLBEFOREINVALID:
        sError = "EP_ERROR_INSTALLBEFOREINVALID";
        break;
      case EP_ERROR_INSTALLAFTERINVALID:
        sError = "EP_ERROR_INSTALLAFTERINVALID";
        break;
      default:
        sError = "Unknown error";
        break;
    }
    MessageBox(sError);
  }
}

Show/Hide C# (.NET) function example

        private void btnVerifyFP_Click(object sender, EventArgs e)
        {
            if (tbUserInfo.Text == string.Empty)
            {
                MessageBox.Show("User info field is empty!");
                return;
            }
            if (tbUserInfo.Text == string.Empty)
            {
                MessageBox.Show("Registration key field is empty!");
                return;
            }
            Enigma_KeyGen_IDE.TKeyVerifyParams kv = new Enigma_KeyGen_IDE.TKeyVerifyParams();

            kv.Key = tbKey.Text;
            kv.KeyLen = tbKey.Text.Length;

            kv.RegInfo = tbUserInfo.Text;
            kv.RegInfoLen = tbUserInfo.Text.Length;

            // Hardware ID
            kv.UseHardwareLocking = cbHardware.Checked;
            if (kv.UseHardwareLocking)
            {
                kv.HardwareID = tbHardware.Text;
            }

            // Generate reg. key
            uint dwResult = Enigma_KeyGen_IDE.KG_VerifyRegistrationInfoFromProject("default.enigma", ref kv);

            string sout = string.Empty;
            if (dwResult == Enigma_KeyGen_IDE.EP_NO_ERROR)
            {
                //
                sout = "Valid key!\n";
                sout = string.Format(sout + "Creation Date: {0}/{1}/{2}\n", kv.CreationDay, kv.CreationMonth, kv.CreationYear);
                if (kv.UseKeyExpiration)
                {
                    sout = string.Format(sout + "Expiration Date: {0}/{1}/{2}\n", kv.ExpirationDay, kv.ExpirationMonth, kv.ExpirationYear);
                }
                if (kv.UseRegisterAfter)
                {
                    sout += string.Format("Register After: {0}/{1}/{2}\n", kv.RegisterAfterDay, kv.RegisterAfterMonth, kv.RegisterAfterYear);
                }
                if (kv.UseRegisterBefore)
                {
                    sout += string.Format("Register Before: {0}/{1}/{2}\n", kv.RegisterBeforeDay, kv.RegisterBeforeMonth, kv.RegisterBeforeYear);
                }
                if (kv.UseCountyLimit)
                {
                    Enigma_KeyGen_IDE ide = new Enigma_KeyGen_IDE();
                    foreach (Enigma_KeyGen_IDE.TKeyCountries country in ide.KEY_COUNTRIES)
                    {
                        if (country.Code == kv.CountryCode)
                        {
                            sout += string.Format("Country Lock: {0}\n", country.Name);
                            break;
                        }
                    }
                }
                if (kv.UseExecutionsLimit)
                {
                    sout += string.Format("Executions: {0}\n", kv.ExecutionsCount);
                }
                if (kv.UseDaysLimit)
                {
                    sout += string.Format("Days: {0}\n", kv.DaysCount);
                }
                if (kv.UseRunTimeLimit)
                {
                    sout += string.Format("Runtime: {0}\n", kv.RunTimeMinutes);
                }
                if (kv.UseGlobalTimeLimit)
                {
                    sout += string.Format("Global Time: {0}\n", kv.GlobalTimeMinutes);
                }
                for (int i = 0; i < Enigma_KeyGen_IDE.NUMBER_OF_CRYPTED_SECTIONS; i++)
                {
                    if (Convert.ToBoolean(kv.EncryptedSections[i]))
                    {
                        sout = string.Format(sout + "Unlock section: #{0}\n", i + 1);
                    }
                }
            }
            else
            {
                switch (dwResult)
                {
                    case Enigma_KeyGen_IDE.EP_ERROR_UNKNOWN:
                        sout = "EP_ERROR_UNKNOWN";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_KEYBUFFEREMPTY:
                        sout = "EP_ERROR_KEYBUFFEREMPTY";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_KEYBUFFERISLESS:
                        sout = "EP_ERROR_KEYBUFFERISLESS";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_REGINFOEMPTY:
                        sout = "EP_ERROR_REGINFOEMPTY";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_REGINFOTOOLARGE:
                        sout = "EP_ERROR_REGINFOTOOLARGE";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_PRIVATEKEYISNOTSET:
                        sout = "EP_ERROR_PRIVATEKEYISNOTSET";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_PUBLICKEYISNOTSET:
                        sout = "EP_ERROR_PUBLICKEYISNOTSET";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_PRIVATEKEYISINVALID:
                        sout = "EP_ERROR_PRIVATEKEYISINVALID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_PUBLICKEYISINVALID:
                        sout = "EP_ERROR_PUBLICKEYISINVALID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_KEYMODEISINVALID:
                        sout = "EP_ERROR_KEYMODEISINVALID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_KEYBASEISINVALID:
                        sout = "EP_ERROR_KEYBASEISINVALID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_CURRENTDATEISINVALID:
                        sout = "EP_ERROR_CURRENTDATEISINVALID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_EXPIRATIONDATEISINVALID:
                        sout = "EP_ERROR_EXPIRATIONDATEISINVALID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_KEYISINVALID:
                        sout = "EP_ERROR_KEYISINVALID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_HARDWAREID:
                        sout = "EP_ERROR_HARDWAREID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_HARDWAREBUFFEREMPTY:
                        sout = "EP_ERROR_HARDWAREBUFFEREMPTY";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_HARDWAREIDINVALIDFORKEY:
                        sout = "EP_ERROR_HARDWAREIDINVALIDFORKEY";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_PROJECTFILENOTFOUND:
                        sout = "EP_ERROR_PROJECTFILENOTFOUND";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_INVALIDPROJECTFILE:
                        sout = "EP_ERROR_INVALIDPROJECTFILE";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_EXECUTIONSNUMBERINVALID:
                        tbKey.Text = "EP_ERROR_EXECUTIONSNUMBERINVALID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_DAYSNUMBERINVALID:
                        tbKey.Text = "EP_ERROR_DAYSNUMBERINVALID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_COUNTRYCODEINVALID:
                        tbKey.Text = "EP_ERROR_COUNTRYCODEINVALID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_RUNTIMEINVALID:
                        tbKey.Text = "EP_ERROR_RUNTIMEINVALID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_GLOBALTIMEINVALID:
                        tbKey.Text = "EP_ERROR_GLOBALTIMEINVALID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_INSTALLBEFOREINVALID:
                        tbKey.Text = "EP_ERROR_INSTALLBEFOREINVALID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_INSTALLAFTERINVALID:
                        tbKey.Text = "EP_ERROR_INSTALLAFTERINVALID";
                        break;
                    default:
                        sout = "Unknown error";
                        break;
                }
            }
            MessageBox.Show(sout);
        }

Show/Hide Visual Basic function example

Private Sub btnVerifyFP_Click()
  Dim kv As TKeyVerifyParams
  Dim I As Integer
  Dim dwResult As Long
  Dim sresult As String

  If tbUserInfo.Text = vbNullString Then
    MsgBox "User info field is empty!"
    Exit Sub
  End If

  If tKey.Text = vbNullString Then
    MsgBox "Key field is empty!"
    Exit Sub
  End If

  ' Fill key buffer
  kv.Key = tKey.Text
  kv.KeyLen = Len(tKey.Text)
  ' Fill User Info buffer
  kv.RegInfo = tbUserInfo.Text
  kv.RegInfoLen = Len(tbUserInfo.Text)
  ' Hardware ID
  kv.UseHardwareLocking = cbHardware.Value
  If kv.UseHardwareLocking Then
    kv.HardwareID = tbHardware.Text
  End If

  ' Verify reg. key
  dwResult = KG_VerifyRegistrationInfoFromProject("default.enigma", kv)
  If dwResult = ERROR_OK Then
    sresult = "Key is valid!" & Chr$(13)
    sresult = sresult & "Key creation date: " & Str$(kv.CreationDay) & "/" & Str$(kv.CreationMonth) & "/" & Str$(kv.CreationYear) & Chr$(13)
    If kv.UseKeyExpiration Then
      sresult = sresult & "Key expiration date: " & Str$(kv.ExpirationDay) & "/" & Str$(kv.ExpirationMonth) & "/" & Str$(kv.ExpirationYear) & Chr$(13)
    End If
    If kv.UseRegisterAfter Then
      sresult = sresult & "Register After date: " & Str$(kv.RegisterAfterDay) & "/" & Str$(kv.RegisterAfterMonth) & "/" & Str$(kv.RegisterAfterYear) & Chr$(13)
    End If
    If kv.UseRegisterBefore Then
      sresult = sresult & "Register Before date: " & Str$(kv.RegisterBeforeDay) & "/" & Str$(kv.RegisterBeforeMonth) & "/" & Str$(kv.RegisterBeforeYear) & Chr$(13)
    End If
    If kv.UseExecutionsLimit Then
      sresult = sresult & "Executions: " & Str$(kv.ExecutionsCount) & Chr$(13)
    End If
    If kv.UseDaysLimit Then
      sresult = sresult & "Days: " & Str$(kv.DaysCount) & Chr$(13)
    End If
    If kv.UseRunTimeLimit Then
      sresult = sresult & "Runtime: " & Str$(kv.RunTimeMinutes) & Chr$(13)
    End If
    If kv.UseGlobalTimeLimit Then
      sresult = sresult & "Global Time: " & Str$(kv.GlobalTimeMinutes) & Chr$(13)
    End If
    If kv.UseCountyLimit Then
      For I = 0 To comCountries.ListCount - 1
        If comCountries.ItemData(I) = kv.CountryCode Then
          sresult = sresult & "Country Lock: " & comCountries.List(I) & Chr$(13)
        End If
      Next I
    End If
    For I = 1 To NUMBER_OF_CRYPTED_SECTIONS
      If kv.EncryptedSections(I - 1) = 1 Then
        sresult = sresult & "Unlock section #" & Str$(I) & Chr$(13)
      End If
    Next I
  Else
    Select Case dwResult
      Case EP_ERROR_UNKNOWN
        sresult = "EP_ERROR_UNKNOWN"
      Case EP_ERROR_KEYBUFFEREMPTY
        sresult = "EP_ERROR_KEYBUFFEREMPTY"
      Case EP_ERROR_KEYBUFFERISLESS
        sresult = "EP_ERROR_KEYBUFFERISLESS"
      Case EP_ERROR_REGINFOEMPTY
        sresult = "EP_ERROR_REGINFOEMPTY"
      Case EP_ERROR_REGINFOTOOLARGE
        sresult = "EP_ERROR_REGINFOTOOLARGE"
      Case EP_ERROR_PRIVATEKEYISNOTSET
        sresult = "EP_ERROR_PRIVATEKEYISNOTSET"
      Case EP_ERROR_PUBLICKEYISNOTSET
        sresult = "EP_ERROR_PUBLICKEYISNOTSET"
      Case EP_ERROR_PRIVATEKEYISINVALID
        sresult = "EP_ERROR_PRIVATEKEYISINVALID"
      Case EP_ERROR_PUBLICKEYISINVALID
        sresult = "EP_ERROR_PUBLICKEYISINVALID"
      Case EP_ERROR_KEYMODEISINVALID
        sresult = "EP_ERROR_KEYMODEISINVALID"
      Case EP_ERROR_KEYBASEISINVALID
        sresult = "EP_ERROR_KEYBASEISINVALID"
      Case EP_ERROR_CURRENTDATEISINVALID
        sresult = "EP_ERROR_CURRENTDATEISINVALID"
      Case EP_ERROR_EXPIRATIONDATEISINVALID
        sresult = "EP_ERROR_EXPIRATIONDATEISINVALID"
      Case EP_ERROR_KEYISINVALID
        sresult = "EP_ERROR_KEYISINVALID"
      Case EP_ERROR_HARDWAREID
        sresult = "EP_ERROR_HARDWAREID"
      Case EP_ERROR_HARDWAREBUFFEREMPTY
        sresult = "EP_ERROR_HARDWAREBUFFEREMPTY"
      Case EP_ERROR_HARDWAREIDINVALIDFORKEY
        sresult = "EP_ERROR_HARDWAREIDINVALIDFORKEY"
      Case EP_ERROR_PROJECTFILENOTFOUND
        sresult = "EP_ERROR_PROJECTFILENOTFOUND"
      Case EP_ERROR_INVALIDPROJECTFILE
        sresult = "EP_ERROR_INVALIDPROJECTFILE"
      Case EP_ERROR_EXECUTIONSNUMBERINVALID
        tKey.Text = "EP_ERROR_EXECUTIONSNUMBERINVALID"
      Case EP_ERROR_DAYSNUMBERINVALID
        tKey.Text = "EP_ERROR_DAYSNUMBERINVALID"
      Case EP_ERROR_COUNTRYCODEINVALID
        tKey.Text = "EP_ERROR_COUNTRYCODEINVALID"
      Case EP_ERROR_RUNTIMEINVALID
        tKey.Text = "EP_ERROR_RUNTIMEINVALID"
      Case EP_ERROR_GLOBALTIMEINVALID
        tKey.Text = "EP_ERROR_GLOBALTIMEINVALID"
      Case EP_ERROR_INSTALLBEFOREINVALID
        tKey.Text = "EP_ERROR_INSTALLBEFOREINVALID"
      Case EP_ERROR_INSTALLAFTERINVALID
        tKey.Text = "EP_ERROR_INSTALLAFTERINVALID"
      Case Else
        sresult = "Unknown error"
    End Select
  End If
  MsgBox sresult
End Sub

See function examples in the installation folder, Examples\Keygen subfolder.


TKeyVerifyParamsA type

TKeyVerifyParamsA structure is used by KG_VerifyRegistrationInfoA and KG_VerifyRegistrationInfoFromProjectA to verify registration information.

Structure description

KeyMode

(input parameter) mode of registration key (RSA 512/768/1024/2048/3072/4096). It may have the following values (see Registration Features - Common Registration key safety/length value):

RM_512 = 0;
RM_768 = 1;
RM_1024 = 2;
RM_2048 = 3;
RM_3072 = 4;
RM_4096 = 5;
KeyBase

(input parameter) base of registration key (Base 2/8/16/32/64). It may have the following values (see Registration Features - Common Registration key output base value):

RB_2 = 0;
RB_8 = 1;
RB_16 = 2;
RB_32 = 3;
RB_64 = 4;
Key | (input parameter) pointer to the ANSI, null terminated string, which is the registration key;
KeyLen | (input parameter) size of registration key buffer;
RegInfo | (input parameter) pointer to ANSI, null terminated string, which is the registration name;
CreationYear | (output parameter) the year when the key was created
CreationMonth | (output parameter) the month when the key was created
CreationDay | (output parameter) the day when the key was created
UseKeyExpiration | (output parameter) if the value is 0, then the key does not have expiration, if the value is 1, then the key is time-limited. The key will expire on the date specified in the ExpirationYear, ExpirationMonth, ExpirationDay parameters (see Creating Keys);
ExpirationYear | (output parameter) year of key expiration date;
ExpirationMonth | (output parameter) month of key expiration date;
ExpirationDay | (output parameter) day of key expiration date;
UseHardwareLocking

(input parameter) if the key is hardware-locked, set this parameter to 1, otherwise it should be 0 (see Creating Keys);
HardwareIDType | (input parameter) pointer to ANSI, null terminated hardware id string;
UseExecutionsLimit

(output parameter) key is executions-limited; the parameter is 1 if the key is limited, and 0 if it is not (see Creating Keys);
ExecutionsCount | (output parameter) number of executions the registration key is limited to;
UseDaysLimit

(output parameter) key is days-limited; the parameter is 1 if the key is limited, and 0 if it is not (see Creating Keys);
DaysCount | (output parameter) number of days the registration key is limited to;
UseRunTimeLimit

(output parameter) key is run-time-limited; the parameter is 1 if the key is limited, and 0 if it is not (see Creating Keys);
RunTimeMinutes | (output parameter) number of run-time minutes the registration key is limited to;
UseGlobalTimeLimit

(output parameter) key is global time-limited; the parameter is 1 if the key is limited, and 0 if it is not (see Creating Keys);
GlobalTimeMinutes | (output parameter) number of global time minutes the registration key is limited to;
UseCountyLimit

(output parameter) key is country-limited; the parameter is 1 if the key is limited, and 0 if it is not (see Creating Keys);
CountryCode | (output parameter) the country code the registration key is locked to (see Enigma API EP_MiscCountryCode to get the code of a particular country);
UseRegisterAfter | (output parameter) the registration key has Register After date; the parameter is 1 if true yes and 0 if false. The Register After date is specified in the RegisterAfterYear, RegisterAfterMonth, RegisterAfterDay parameters (see Creating Keys);
RegisterAfterYear | (output parameter) year of Register After date;
RegisterAfterMonth | (output parameter) month of Register After date;
RegisterAfterDay | (output parameter) day of Register After date;
UseRegisterBefore | (output parameter) the registration key has Register Before date; the parameter is 1 if true, and 0 if false. The Register Before date is specified in the RegisterBeforeYear, RegisterBeforeMonth, RegisterBeforeDay parameters (see Creating Keys);
RegisterBeforeYear | (output parameter) year of Register Before date;
RegisterBeforeMonth | (output parameter) month of Register Before date;
RegisterBeforeDay | (output parameter) day of Register Before date;
EncryptedConstant | (input parameter) integer constant, obtain it from the project file (see Registration Features - Common Registration, Information for Custom Keys Generator box, Encryption Constant value);
EncryptedSections | (output parameter) array of 16-byte length, which the encrypted sections, that will be decrypted with this registration key (see Creating Keys);
PublicKey | (input parameter) pointer to ANSI, null terminated string, which is a unique constant, should be obtained from the project (see Registration Features - Common Registration, Information for Custom Keys Generator box, Public Key value);

Definition

Show/Hide Delphi structure definition

  TKeyVerifyParamsA = record
    RegInfo             : PAnsiChar;  // {in} registration info/name
    KeyMode             : dword;    // {in} key generation mode (~RSA ???)
    KeyBase             : dword;    // {in} key output base (Base ???)
    Key                 : pointer;  // {in} buffer with ansi string registration key
    KeyLen              : dword;    // {in} registration key size
    CreationYear        : dword;    // {out} key creation year
    CreationMonth       : dword;    // {out} key creation month
    CreationDay         : dword;    // {out} key creation day
    UseKeyExpiration    : boolean;  // {out} has key expiration date?
    ExpirationYear      : dword;    // {out} key expiration year
    ExpirationMonth     : dword;    // {out} key expiration month
    ExpirationDay       : dword;    // {out} key expiration day
    UseHardwareLocking  : boolean;  // {in/out} hardware locked key
    HardwareID          : PAnsiChar;// {in} pointer to null terminated hardware string
    UseExecutionsLimit  : boolean;  // {out} limit key by executions?
    ExecutionsCount     : dword;    // {out} number of executions
    UseDaysLimit        : boolean;  // {out} limit key by days?
    DaysCount           : dword;    // {out} number of days
    UseRunTimeLimit     : boolean;  // {out} limit key by run time?
    RunTimeMinutes      : dword;    // {out} run time minutes
    UseGlobalTimeLimit  : boolean;  // {out} limit key by global time?
    GlobalTimeMinutes   : dword;    // {out} global time minutes
    UseCountyLimit      : boolean;  // {out} limit key by country?
    CountryCode         : dword;    // {out} country code
    UseRegisterAfter    : boolean;  // {out} register key after date?
    RegisterAfterYear   : dword;    // {out} register after year
    RegisterAfterMonth  : dword;    // {out} register after month
    RegisterAfterDay    : dword;    // {out} register after day
    UseRegisterBefore   : boolean;  // {out} register key before date?
    RegisterBeforeYear  : dword;    // {out} register before year
    RegisterBeforeMonth : dword;    // {out} register before month
    RegisterBeforeDay   : dword;    // {out} register before day
    EncryptedConstant   : dword;    // Encryption Constant - should be extracted from project file
    EncryptedSections   : array [1..NUMBER_OF_CRYPTED_SECTIONS] of boolean; // Crypted sections
    PublicKey           : PAnsiChar;   // Public Key - should be extracted from project file
  end;
  PKeyVerifyParamsA = ^TKeyVerifyParamsA;

Show/Hide C++ structure definition

typedef struct _TKeyVerifyParamsA
{
    char* RegInfo;             // {in} registration info/name
    DWORD KeyMode;             // {in} key generation mode (~RSA ???)
    DWORD KeyBase;             // {in} key output base (Base ???)
    char* Key;                 // {in} buffer for registration key
    DWORD KeyLen;              // {in} registration key size
    DWORD CreationYear;        // {out} key creation year
    DWORD CreationMonth;       // {out} key creation month
    DWORD CreationDay;         // {out} key creation day
    bool UseKeyExpiration;     // {out} has key expiration date?
    DWORD ExpirationYear;      // {out} key expiration year
    DWORD ExpirationMonth;     // {out} key expiration month
    DWORD ExpirationDay;       // {out} key expiration day
    bool UseHardwareLocking;   // {in} hardware locked key
    char* HardwareID;          // {in} pointer to null terminated hardware string
    bool UseExecutionsLimit;   // {out} limit key by executions?
    DWORD ExecutionsCount;     // {out} number of executions
    bool UseDaysLimit;         // {out} limit key by days?
    DWORD DaysCount;           // {out} number of days
    bool UseRunTimeLimit;      // {out} limit key by run time?
    DWORD RunTimeMinutes;      // {out} run time minutes
    bool UseGlobalTimeLimit;   // {out} limit key by global time?
    DWORD GlobalTimeMinutes;   // {out} global time minutes
    bool UseCountyLimit;       // {out} limit key by country?
    DWORD CountryCode;         // {out} country code
    bool UseRegisterAfter;     // {out} register key after date?
    DWORD RegisterAfterYear;   // {out} register after year
    DWORD RegisterAfterMonth;  // {out} register after month
    DWORD RegisterAfterDay;    // {out} register after day
    bool UseRegisterBefore;    // {out} register key before date?
    DWORD RegisterBeforeYear;  // {out} register before year
    DWORD RegisterBeforeMonth; // {out} register before month
    DWORD RegisterBeforeDay;   // {out} register before day
    DWORD EncryptedConstant;   // {in} Encryption Constant - should be extracted from project file
    bool EncryptedSections[NUMBER_OF_CRYPTED_SECTIONS]; // {out} Crypted sections
    char* PublicKey;           // {in} Public Key - should be extracted from project file
} TKeyVerifyParamsA, *PKeyVerifyParamsA;

Show/Hide C# (.NET) structure definition

    public struct TKeyVerifyParamsA
    {
        public string RegInfo;           // {in} registration info/name
        public Int32 KeyMode;            // {in} key generation mode (~RSA ???)
        public Int32 KeyBase;            // {in} key output base (Base ???)
        public string Key;               // {in} buffer for registration key
        public Int32 KeyLen;             // {in} registration key size
        public Int32 CreationYear;       // {out} key creation year
        public Int32 CreationMonth;      // {out} key creation month
        public Int32 CreationDay;        // {out} key creation day
        public bool UseKeyExpiration;    // {out} has key expiration date?
        public Int32 ExpirationYear;     // {out} key expiration year
        public Int32 ExpirationMonth;    // {out} key expiration month
        public Int32 ExpirationDay;      // {out} key expiration day
        public bool UseHardwareLocking;  // {in} hardware locked key
        public string HardwareID;        // {in} pointer to null terminated hardware string
        public bool UseExecutionsLimit;  // {out} limit key by executions?
        public Int32 ExecutionsCount;    // {out} number of executions
        public bool UseDaysLimit;        // {out} limit key by days?
        public Int32 DaysCount;          // {out} number of days
        public bool UseRunTimeLimit;     // {out} limit key by run time?
        public Int32 RunTimeMinutes;     // {out} run time minutes
        public bool UseGlobalTimeLimit;  // {out} limit key by global time?
        public Int32 GlobalTimeMinutes;  // {out} global time minutes
        public bool UseCountyLimit;      // {out} limit key by country?
        public Int32 CountryCode;        // {out} country code
        public bool UseRegisterAfter;    // {out} register key after date?
        public Int32 RegisterAfterYear;  // {out} register after year
        public Int32 RegisterAfterMonth; // {out} register after month
        public Int32 RegisterAfterDay;   // {out} register after day
        public bool UseRegisterBefore;   // {out} register key before date?
        public Int32 RegisterBeforeYear; // {out} register before year
        public Int32 RegisterBeforeMonth;// {out} register before month
        public Int32 RegisterBeforeDay;  // {out} register before day
        public Int32 EncryptedConstant;  // {in} Encryption Constant - should be extracted from project file
        [MarshalAs(UnmanagedType.ByValArray, SizeConst = NUMBER_OF_CRYPTED_SECTIONS)]
        public byte[] EncryptedSections; // {out} Crypted sections
        public string PublicKey;         // {in} Public Key - should be extracted from project file
    }


Function KG_VerifyRegistrationInfoA

KG_VerifyRegistrationInfoA, as well as the KG_VerifyRegistrationInfo function, is used for verifying the registration information and extracting registration key parameters from ANSI-based registration information. The function has one parameter - a pointer to the TKeyVerifyParamsA structure. Please note, the TKeyVerifyParamsA structure should contain secure parameters from the Enigma Protector project. These parameters are PublicKey, KeyMode, KeyBase and EncryptedConstant (see the Registration Features - Common panel, Information for Custom Generator box).

Return Values

EP_NO_ERROR=0 | the function succeeds, TKeyVerifyParamsA structure contains registration key parameters;
EP_ERROR_UNKNOWN=1 | unknown error
EP_ERROR_KEYBUFFEREMPTY=2 | memory buffer for registration key is not allocated
EP_ERROR_KEYBUFFERISLESS=3 | size of allocated memory for registration key is less than required
EP_ERROR_REGINFOEMPTY=4 | registration information is not specified
EP_ERROR_REGINFOTOOLARGE=5 | registration information is empty (has a null size)
EP_ERROR_PRIVATEKEYISNOTSET=6 | private key is not set
EP_ERROR_PUBLICKEYISNOTSET=7 | public key is not set
EP_ERROR_PRIVATEKEYISINVALID=8 | private key is invalid
EP_ERROR_PUBLICKEYISINVALID=9 | public key is invalid
EP_ERROR_KEYMODEISINVALID=10 | key mode is invalid
EP_ERROR_KEYBASEISINVALID=11 | key base is invalid
EP_ERROR_CURRENTDATEISINVALID=12 | current date is invalid
EP_ERROR_EXPIRATIONDATEISINVALID=13 | expiration date is invalid
EP_ERROR_KEYISINVALID=14 | key is invalid
EP_ERROR_HARDWAREID=15 | hardware id is invalid
EP_ERROR_HARDWAREBUFFEREMPTY=16 | hardware id buffer is empty
EP_ERROR_HARDWAREIDINVALIDFORKEY=17 | hardware id is invalid for the key
EP_ERROR_PROJECTFILENOTFOUND=18 | project file is not found
EP_ERROR_INVALIDPROJECTFILE=19 | project file is invalid
EP_ERROR_EXECUTIONSNUMBERINVALID=20 | executions number is invalid
EP_ERROR_DAYSNUMBERINVALID=21 | days number is invalid
EP_ERROR_COUNTRYCODEINVALID=22 | country code is invalid
EP_ERROR_RUNTIMEINVALID=23 | run-time value is invalid
EP_ERROR_GLOBALTIMEINVALID=24 | global time is invalid
EP_ERROR_INSTALLBEFOREINVALID=25 | register before date is invalid
EP_ERROR_INSTALLAFTERINVALID=26 | register after date is invalid

Definition

Show/Hide Delphi function definition

function KG_VerifyRegistrationInfoA(kv : PKeyVerifyParamsA) : dword; external 'keygen.dll' name 'KG_VerifyRegistrationInfoA';

Show/Hide C++ function definition

 extern  "C" __declspec( dllimport ) __stdcall int KG_VerifyRegistrationInfoA(PKeyVerifyParamsA kv);

Show/Hide C# (.NET) function definition

public class Enigma_KeyGen_IDE
{
    [DllImport("keygen.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
    public static extern uint KG_VerifyRegistrationInfoA(ref TKeyVerifyParamsA kv);
}

See function examples in the installation folder, Examples\Keygen subfolder.


Function KG_VerifyRegistrationInfoFromProjectA

KG_VerifyRegistrationInfoFromProjectA is used for verifying the registration information and extracting registration key parameters from ANSI-based registration information. The function has two parameters, one of them is a pointer to the TKeyVerifyParamsA structure, the other one is ANSI - null terminated string - the path to the Enigma Protector project file. The function reads secure information from the project file, so it does not require secure parameters PublicKey, KeyMode, KeyBase and EncryptedConstant in the TKeyVerifyParamsA structure.

Return Values

EP_NO_ERROR=0 | the function succeeds, TKeyVerifyParamsA structure contains registration key parameters;
EP_ERROR_UNKNOWN=1 | unknown error
EP_ERROR_KEYBUFFEREMPTY=2 | memory buffer for registration key is not allocated
EP_ERROR_KEYBUFFERISLESS=3 | size of allocated memory for registration key is less than required
EP_ERROR_REGINFOEMPTY=4 | registration information is not specified
EP_ERROR_REGINFOTOOLARGE=5 | registration information is empty (has a null size)
EP_ERROR_PRIVATEKEYISNOTSET=6 | private key is not set
EP_ERROR_PUBLICKEYISNOTSET=7 | public key is not set
EP_ERROR_PRIVATEKEYISINVALID=8 | private key is invalid
EP_ERROR_PUBLICKEYISINVALID=9 | public key is invalid
EP_ERROR_KEYMODEISINVALID=10 | key mode is invalid
EP_ERROR_KEYBASEISINVALID=11 | key base is invalid
EP_ERROR_CURRENTDATEISINVALID=12 | current date is invalid
EP_ERROR_EXPIRATIONDATEISINVALID=13 | expiration date is invalid
EP_ERROR_KEYISINVALID=14 | key is invalid
EP_ERROR_HARDWAREID=15 | hardware id is invalid
EP_ERROR_HARDWAREBUFFEREMPTY=16 | hardware id buffer is empty
EP_ERROR_HARDWAREIDINVALIDFORKEY=17 | hardware id is invalid for the key
EP_ERROR_PROJECTFILENOTFOUND=18 | project file is not found
EP_ERROR_INVALIDPROJECTFILE=19 | project file is invalid
EP_ERROR_EXECUTIONSNUMBERINVALID=20 | executions number is invalid
EP_ERROR_DAYSNUMBERINVALID=21 | days number is invalid
EP_ERROR_COUNTRYCODEINVALID=22 | country code is invalid
EP_ERROR_RUNTIMEINVALID=23 | run-time value is invalid
EP_ERROR_GLOBALTIMEINVALID=24 | global time is invalid
EP_ERROR_INSTALLBEFOREINVALID=25 | register before date is invalid
EP_ERROR_INSTALLAFTERINVALID=26 | register after date is invalid

Definition

Show/Hide Delphi function definition

function KG_VerifyRegistrationInfoFromProjectA(ProjectFile : PAnsiChar; kv : PKeyVerifyParamsA) : dword; external 'keygen.dll' name 'KG_VerifyRegistrationInfoFromProjectA';

Show/Hide C++ function definition

 extern  "C" __declspec( dllimport ) __stdcall int KG_VerifyRegistrationInfoFromProjectA(char* pfile, PKeyVerifyParamsA kv);

Show/Hide C# (.NET) function definition

public class Enigma_KeyGen_IDE
{
    [DllImport("keygen.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
    public static extern uint KG_VerifyRegistrationInfoFromProjectA(string FileName, ref TKeyVerifyParamsA kv);
}

See function examples in the installation folder, Examples\Keygen subfolder.


TKeyVerifyParamsW type

TKeyVerifyParamsW structure is used by KG_VerifyRegistrationInfoW and KG_VerifyRegistrationInfoFromProjectW to verify registration information.

Structure description

KeyMode

(input parameter) mode of registration key (RSA 512/768/1024/2048/3072/4096). It may have the following values (see Registration Features - Common Registration key safety/length value):

RM_512 = 0;
RM_768 = 1;
RM_1024 = 2;
RM_2048 = 3;
RM_3072 = 4;
RM_4096 = 5;
KeyBase

(input parameter) base of registration key (Base 2/8/16/32/64). It may have the following values (see Registration Features - Common Registration key output base value):

RB_2 = 0;
RB_8 = 1;
RB_16 = 2;
RB_32 = 3;
RB_64 = 4;
Key | (input parameter) pointer to the unicode, null terminated string, which is the registration key;
KeyLen | (input parameter) size of registration key buffer;
RegInfo | (input parameter) pointer to unicode, null terminated string, which is the registration name;
CreationYear | (output parameter) the year when the key was created
CreationMonth | (output parameter) the month when the key was created
CreationDay | (output parameter) the day when the key was created
UseKeyExpiration | (output parameter) if the value is 0, then the key does not have expiration, if the value is 1, then the key is time-limited. The key will expire on the date specified in the ExpirationYear, ExpirationMonth, ExpirationDay parameters (see Creating Keys);
ExpirationYear | (output parameter) year of key expiration date;
ExpirationMonth | (output parameter) month of key expiration date;
ExpirationDay | (output parameter) day of key expiration date;
UseHardwareLocking

(input parameter) if the key is hardware-locked, set this parameter to 1, otherwise it should be 0 (see Creating Keys);
HardwareIDType | (input parameter) pointer to unicode, null terminated hardware id string;
UseExecutionsLimit

(output parameter) key is executions-limited; the parameter is 1 if the key is limited, and 0 if it is not (see Creating Keys);
ExecutionsCount | (output parameter) number of executions the registration key is limited to;
UseDaysLimit

(output parameter) key is days-limited; the parameter is 1 if the key is limited, and 0 if it is not (see Creating Keys);
DaysCount | (output parameter) number of days the registration key is limited to;
UseRunTimeLimit

(output parameter) key is run-time-limited; the parameter is 1 if the key is limited, and 0 if it is not (see Creating Keys);
RunTimeMinutes | (output parameter) number of run-time minutes the registration key is limited to;
UseGlobalTimeLimit

(output parameter) key is global time-limited; the parameter is 1 if the key is limited, and 0 if it is not (see Creating Keys);
GlobalTimeMinutes | (output parameter) number of global time minutes the registration key is limited to;
UseCountyLimit

(output parameter) key is country-limited; the parameter is 1 if the key is limited, and 0 if it is not (see Creating Keys);
CountryCode | (output parameter) the country code the registration key is locked to (see Enigma API EP_MiscCountryCode to get the code of a particular country);
UseRegisterAfter | (output parameter) the registration key has Register After date; the parameter is 1 if true, and 0 if false. The Register After date is specified in the RegisterAfterYear, RegisterAfterMonth, RegisterAfterDay parameters (see Creating Keys);
RegisterAfterYear | (output parameter) year of Register After date;
RegisterAfterMonth | (output parameter) month of Register After date;
RegisterAfterDay | (output parameter) day of Register After date;
UseRegisterBefore | (output parameter) the registration key has Register Before date; the parameter is 1 if true, and 0 if false. The Register Before date is specified in the RegisterBeforeYear, RegisterBeforeMonth, RegisterBeforeDay parameters (see Creating Keys);
RegisterBeforeYear | (output parameter) year of Register Before date;
RegisterBeforeMonth | (output parameter) month of Register Before date;
RegisterBeforeDay | (output parameter) day of Register Before date;
EncryptedConstant | (input parameter) integer constant, obtain it from the project file (see Registration Features - Common Registration, Information for Custom Keys Generator box, Encryption Constant value);
EncryptedSections | (output parameter) array of 16-byte length, which shows the encrypted, that will be decrypted with this registration key (see Creating Keys);
PublicKey | (input parameter) pointer to unicode, null terminated string, which is a unique constant, should be obtained from the project (see Registration Features - Common Registration, Information for Custom Keys Generator box, Public Key value);

Definition

Show/Hide Delphi structure definition

  TKeyVerifyParamsW = record
    RegInfo             : PWideChar;  // {in} registration info/name
    KeyMode             : dword;    // {in} key generation mode (~RSA ???)
    KeyBase             : dword;    // {in} key output base (Base ???)
    Key                 : pointer;  // {in} buffer with unicode string registration key
    KeyLen              : dword;    // {in} registration key size
    CreationYear        : dword;    // {out} key creation year
    CreationMonth       : dword;    // {out} key creation month
    CreationDay         : dword;    // {out} key creation day
    UseKeyExpiration    : boolean;  // {out} has key expiration date?
    ExpirationYear      : dword;    // {out} key expiration year
    ExpirationMonth     : dword;    // {out} key expiration month
    ExpirationDay       : dword;    // {out} key expiration day
    UseHardwareLocking  : boolean;  // {in/out} hardware locked key
    HardwareID          : PWideChar;// {in} pointer to null terminated hardware string
    UseExecutionsLimit  : boolean;  // {out} limit key by executions?
    ExecutionsCount     : dword;    // {out} number of executions
    UseDaysLimit        : boolean;  // {out} limit key by days?
    DaysCount           : dword;    // {out} number of days
    UseRunTimeLimit     : boolean;  // {out} limit key by run time?
    RunTimeMinutes      : dword;    // {out} run time minutes
    UseGlobalTimeLimit  : boolean;  // {out} limit key by global time?
    GlobalTimeMinutes   : dword;    // {out} global time minutes
    UseCountyLimit      : boolean;  // {out} limit key by country?
    CountryCode         : dword;    // {out} country code
    UseRegisterAfter    : boolean;  // {out} register key after date?
    RegisterAfterYear   : dword;    // {out} register after year
    RegisterAfterMonth  : dword;    // {out} register after month
    RegisterAfterDay    : dword;    // {out} register after day
    UseRegisterBefore   : boolean;  // {out} register key before date?
    RegisterBeforeYear  : dword;    // {out} register before year
    RegisterBeforeMonth : dword;    // {out} register before month
    RegisterBeforeDay   : dword;    // {out} register before day
    EncryptedConstant   : dword;    // Encryption Constant - should be extracted from project file
    EncryptedSections   : array [1..NUMBER_OF_CRYPTED_SECTIONS] of boolean; // Crypted sections
    PublicKey           : PWideChar;   // Public Key - should be extracted from project file
  end;
  PKeyVerifyParamsW = ^TKeyVerifyParamsW;

Show/Hide C++ structure definition

typedef struct _TKeyVerifyParamsW
{
    wchar_t* RegInfo;             // {in} registration info/name
    DWORD KeyMode;             // {in} key generation mode (~RSA ???)
    DWORD KeyBase;             // {in} key output base (Base ???)
    wchar_t* Key;                 // {in} buffer for registration key
    DWORD KeyLen;              // {in} registration key size
    DWORD CreationYear;        // {out} key creation year
    DWORD CreationMonth;       // {out} key creation month
    DWORD CreationDay;         // {out} key creation day
    bool UseKeyExpiration;     // {out} has key expiration date?
    DWORD ExpirationYear;      // {out} key expiration year
    DWORD ExpirationMonth;     // {out} key expiration month
    DWORD ExpirationDay;       // {out} key expiration day
    bool UseHardwareLocking;   // {in} hardware locked key
    wchar_t* HardwareID;          // {in} pointer to null terminated hardware string
    bool UseExecutionsLimit;   // {out} limit key by executions?
    DWORD ExecutionsCount;     // {out} number of executions
    bool UseDaysLimit;         // {out} limit key by days?
    DWORD DaysCount;           // {out} number of days
    bool UseRunTimeLimit;      // {out} limit key by run time?
    DWORD RunTimeMinutes;      // {out} run time minutes
    bool UseGlobalTimeLimit;   // {out} limit key by global time?
    DWORD GlobalTimeMinutes;   // {out} global time minutes
    bool UseCountyLimit;       // {out} limit key by country?
    DWORD CountryCode;         // {out} country code
    bool UseRegisterAfter;     // {out} register key after date?
    DWORD RegisterAfterYear;   // {out} register after year
    DWORD RegisterAfterMonth;  // {out} register after month
    DWORD RegisterAfterDay;    // {out} register after day
    bool UseRegisterBefore;    // {out} register key before date?
    DWORD RegisterBeforeYear;  // {out} register before year
    DWORD RegisterBeforeMonth; // {out} register before month
    DWORD RegisterBeforeDay;   // {out} register before day
    DWORD EncryptedConstant;   // {in} Encryption Constant - should be extracted from project file
    bool EncryptedSections[NUMBER_OF_CRYPTED_SECTIONS]; // {out} Crypted sections
    wchar_t* PublicKey;           // {in} Public Key - should be extracted from project file
} TKeyVerifyParamsW, *PKeyVerifyParamsW;

Show/Hide C# (.NET) structure definition

    public struct TKeyVerifyParamsW
    {
        [MarshalAs(UnmanagedType.LPWStr)]
        public string RegInfo;           // {in} registration info/name
        public Int32 KeyMode;            // {in} key generation mode (~RSA ???)
        public Int32 KeyBase;            // {in} key output base (Base ???)
        [MarshalAs(UnmanagedType.LPWStr)]
        public string Key;               // {in} buffer for registration key
        public Int32 KeyLen;             // {in} registration key size
        public Int32 CreationYear;       // {out} key creation year
        public Int32 CreationMonth;      // {out} key creation month
        public Int32 CreationDay;        // {out} key creation day
        public bool UseKeyExpiration;    // {out} has key expiration date?
        public Int32 ExpirationYear;     // {out} key expiration year
        public Int32 ExpirationMonth;    // {out} key expiration month
        public Int32 ExpirationDay;      // {out} key expiration day
        public bool UseHardwareLocking;  // {in} hardware locked key
        [MarshalAs(UnmanagedType.LPWStr)]
        public string HardwareID;        // {in} pointer to null terminated hardware string
        public bool UseExecutionsLimit;  // {out} limit key by executions?
        public Int32 ExecutionsCount;    // {out} number of executions
        public bool UseDaysLimit;        // {out} limit key by days?
        public Int32 DaysCount;          // {out} number of days
        public bool UseRunTimeLimit;     // {out} limit key by run time?
        public Int32 RunTimeMinutes;     // {out} run time minutes
        public bool UseGlobalTimeLimit;  // {out} limit key by global time?
        public Int32 GlobalTimeMinutes;  // {out} global time minutes
        public bool UseCountyLimit;      // {out} limit key by country?
        public Int32 CountryCode;        // {out} country code
        public bool UseRegisterAfter;    // {out} register key after date?
        public Int32 RegisterAfterYear;  // {out} register after year
        public Int32 RegisterAfterMonth; // {out} register after month
        public Int32 RegisterAfterDay;   // {out} register after day
        public bool UseRegisterBefore;   // {out} register key before date?
        public Int32 RegisterBeforeYear; // {out} register before year
        public Int32 RegisterBeforeMonth;// {out} register before month
        public Int32 RegisterBeforeDay;  // {out} register before day
        public Int32 EncryptedConstant;  // {in} Encryption Constant - should be extracted from project file
        [MarshalAs(UnmanagedType.ByValArray, SizeConst = NUMBER_OF_CRYPTED_SECTIONS)]
        public byte[] EncryptedSections; // {out} Crypted sections
        [MarshalAs(UnmanagedType.LPWStr)]
        public string PublicKey;         // {in} Public Key - should be extracted from project file
    }


Function KG_VerifyRegistrationInfoW

KG_VerifyRegistrationInfoW is used for verifying the registration information and extracting registration key parameters from unicode-based registration information. The function has one parameter - a pointer to the TKeyVerifyParamsW structure. Please note, the TKeyVerifyParamsW structure should contain secure parameters from the Enigma Protector project. These parameters are PublicKey, KeyMode, KeyBase and EncryptedConstant (see the Registration Features - Common panel, Information for Custom Generator box).

Return Values

EP_NO_ERROR=0 | the function succeeds, TKeyVerifyParamsW structure contains registration key parameters;
EP_ERROR_UNKNOWN=1 | unknown error
EP_ERROR_KEYBUFFEREMPTY=2 | memory buffer for registration key is not allocated
EP_ERROR_KEYBUFFERISLESS=3 | size of allocated memory for registration key is less than required
EP_ERROR_REGINFOEMPTY=4 | registration information is not specified
EP_ERROR_REGINFOTOOLARGE=5 | registration information is empty (has a null size)
EP_ERROR_PRIVATEKEYISNOTSET=6 | private key is not set
EP_ERROR_PUBLICKEYISNOTSET=7 | public key is not set
EP_ERROR_PRIVATEKEYISINVALID=8 | private key is invalid
EP_ERROR_PUBLICKEYISINVALID=9 | public key is invalid
EP_ERROR_KEYMODEISINVALID=10 | key mode is invalid
EP_ERROR_KEYBASEISINVALID=11 | key base is invalid
EP_ERROR_CURRENTDATEISINVALID=12 | current date is invalid
EP_ERROR_EXPIRATIONDATEISINVALID=13 | expiration date is invalid
EP_ERROR_KEYISINVALID=14 | key is invalid
EP_ERROR_HARDWAREID=15 | hardware id is invalid
EP_ERROR_HARDWAREBUFFEREMPTY=16 | hardware id buffer is empty
EP_ERROR_HARDWAREIDINVALIDFORKEY=17 | hardware id is invalid for the key
EP_ERROR_PROJECTFILENOTFOUND=18 | project file is not found
EP_ERROR_INVALIDPROJECTFILE=19 | project file is invalid
EP_ERROR_EXECUTIONSNUMBERINVALID=20 | executions number is invalid
EP_ERROR_DAYSNUMBERINVALID=21 | days number is invalid
EP_ERROR_COUNTRYCODEINVALID=22 | country code is invalid
EP_ERROR_RUNTIMEINVALID=23 | run-time value is invalid
EP_ERROR_GLOBALTIMEINVALID=24 | global time is invalid
EP_ERROR_INSTALLBEFOREINVALID=25 | register before date is invalid
EP_ERROR_INSTALLAFTERINVALID=26 | register after date is invalid

Definition

Show/Hide Delphi function definition

function KG_VerifyRegistrationInfoW(kv : PKeyVerifyParamsW) : dword; external 'keygen.dll' name 'KG_VerifyRegistrationInfoW';

Show/Hide C++ function definition

 extern  "C" __declspec( dllimport ) __stdcall int KG_VerifyRegistrationInfoW(PKeyVerifyParamsW kv);

Show/Hide C# (.NET) function definition

public class Enigma_KeyGen_IDE
{
    [DllImport("keygen.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.StdCall)]
    public static extern uint KG_VerifyRegistrationInfoW(ref TKeyVerifyParamsW kv);
}

Examples

Show/Hide Delphi function example

procedure TfrmMain.btnVerifyClick(Sender: TObject);
var
  kv : TKeyVerifyParamsW;
  i : integer;
  dwResult : dword;
  stemp : string;
  sresult : string;
begin
  if eUserInfo.Text = '' then
  begin
    ShowMessage('User info field is empty!');
    Exit;
  end;
  if mKey.Text = '' then
  begin
    ShowMessage('Key field is empty!');
    Exit;
  end;

  kv.RegInfo := PWideChar(eUserInfo.Text);
  kv.Key := PWideChar(mKey.Text);
  kv.KeyLen := length(mKey.Text);

    // Key mode
  kv.KeyMode := cbKeyMode.ItemIndex;
  // Key base
  kv.KeyBase := cbKeyBase.ItemIndex;
  case kv.KeyMode of
    RM_512:
    begin
      kv.PublicKey  := '0201B810DA4A1ADD4351378790A98138533067CP4S86R7D8THS45GBCVUM635EPRQRMYRP3DAA5DUPZ6ABDSFP7F5AC' +
                       'P7ERGH4A7Y6B6NW6NMMBZF83WVER9Y4MMBNLBQDKR7KFVLGLV067CFDQC' +
                       'WCHGQVVRN24DECEPBL96YJQJTVDCRTNQG3E4WW4GK4GQ5X5L5H88D3XYH' +
                       'CBRBNASPD3P5CNYFKFHBCSDHHD6WPTCC4XVSM5S88067C2JSTCMVT48C8' +
                       'HC7SHKGTFJBM28P6XTBCNWHMV6J6KN6W5Q9TQLVR285U6GVCAAUTZLRTP' +
                       'SRGDQ742B4742XF4MACRR747YDP5FZZ9D';
    end;
    RM_768:
    begin
      kv.PublicKey  := '0201B810DA4A1ADD4351378790A9813853309AEHRR66KMK99UEPX8C54WQFDZQ5Y96WUCVZYMXBC32SJV7T5SBPR54E' +
                       '2DBH8UD9RNHTJ9BLJV6NHX52W7PZDDTTJDDGF3YFVL7PJFL8RS8THTFDF' +
                       '4RY7K3QXLTMXMC8DDSRVRWBVMMP3UYKCDDC7KGL9PG509ACPTRQ4MMUKG' +
                       'DAUJFFFGSCBFLYK9X9E74M58PW5FG9B9RTLXJQ4STPVCHJTEH8BP557VZ' +
                       'PQYDBUZJXXJNGVZELFL4UL3LHHE8A645CK593DVWCQBSX4ZCCQ3ST8GCZ' +
                       'LW2729XK3NT7GST3LMQGXSHLDWCXE09AENVX2QTX3VLT6FWB4JND875XZ' +
                       'WQ26GW76TV3KVVHK7U489LLPBQ39HUWKMA65U3HKWBDHKBZEB525PHEH2' +
                       'YQHRZGNJAAYZXMWN8RNZ9T7VMZAJMP2V3S9NXZ9RHL96F7AT3NTMN36V4' +
                       'ACSFEN4DR6TJR95';
    end;
    RM_1024:
    begin
      kv.PublicKey  := '0201B810DA4A1ADD4351378790A981385330CDG9YQSEUK2HT546KWW46NHSCHMD2TNCSPVNSKGQC6CHDUSU9CC4LDPL' +
                       'TD3NLRVD3TFV9BU2SYBUBU9TXKLQ3CTKZE5GN9VFG37R9YNK2FE58K7ZY' +
                       'WTUJYFSJTBMDLLGA9GJ2LJXGHSS9CESGC2K69H65YQGAC7CRGF5T3CPLA' +
                       '5BDJZKVCUWPZRNA2DN7L956LZVZBQUDPX6PF30CDBH26Z82VE4QQ8N85L' +
                       'QHYJYYCJ6WQ89H9K9VVQX925SG5FJ79AGVZB6M8TTFKCJ56FAREP8GSTC' +
                       'NKWCXEALDP9Y2ZLS9QKZV8JRNDHG9D8BRDSCTMDQK9NLAPZ9TGYFS9G7U' +
                       'LXHYJF7F9A89HPXGTU2N4FQQJL98WZ5QND2KTEMMUUZFAX953HCGNSWUW' +
                       'U2M7LBEWZSH9GW5SC0CDJDY2HC4HJYUSVTAVXZ7MYVJWF3CU9WC3SVPSL' +
                       '29WF46DVS2SYKSSAMATPPYGJDE3PBFMGS34CXWQSXKCEAE63L2EXTS9NE' +
                       '2G597XASY3S34XMYST5YZF4THUTYT5DY9UKKXU6PH8MLXRPZMPMMR83JU' +
                       'X2WGNEW8ZGL4SKUCUB8CEAB6UZ4FB66WTP3B64VMX7XG75T4Y35479';
    end;
    RM_2048:
    begin
      kv.PublicKey  := '0201B810DA4A1ADD4351378790A98138533199H9KZC4CQ5ZKPEGYDW2EHN5AKZA5G5KP4HU8USWJR8XWW7MCH7244RV' +
                       'PSXFHVU6YQRK4LPUHM497XJYPLLA3DHUZWXK3CB5SUYF75NPYLTNPRUAP' +
                       'CTVDHAKYWTRQ97HES2E59WDN2LJKFYA2K8BGFSBHP4A6BF5FSDTS8NWLL' +
                       'C5NEQ76NJ9BAMWXG55UPFFMRQZTU5KV2G6LSPQUJJWA9U4LJ5SCJ9M9ZQ' +
                       'Z6K7LZA9UAMJ533UQ5J3JPNQAUWJGZFRFCTGAGSBWPWRRF9HRGF9MCX55' +
                       'QRYGPYMRE6DBJ65SJDX34FVPYWWKWQ48MCKXYXPHQ23BJ42U8ZMDD8CG5' +
                       'DPHZQ5XTXUKA277XK6PKSTLJ88ZZ9EBXH62REMRZZRGNPKHYM34RW722S' +
                       'SZHMPFKY7X8UZ19ADGX3UQ7X444XH7MZXEZYW2YLFHR8YL3PTCXVSYX89' +
                       'ZXN7KW2XNBE8XS3TQRGZVF6KA5USH56NEZYH5RNWBBPVE9LD6H42RQWR5' +
                       'YVQMT5EQYQTK6YM9V8DA5BJCLGGZ2UGD6NPA2X3SNUS47F7HJBNBCWHRA' +
                       'YPPCQ5HWCJNPDHUDQMRN2P6PWJFWJ6CLVNK8HXEFLE4ENPXAFN89CRS43' +
                       'RUMVGDJQCSRB535XYCS6BZYLA9Q6HJV425F26XXHRGA7C8R8BVMELAPEH' +
                       '5DSA9KXTCV4H2RNVDFHG3YJSERZVFPWHYA823LUBENBL5U3J4LJX2KQLW' +
                       'L5XGGESPSE2FQWKSQ4NUCDLBEJPQAT2A2477DYS2XEXKLYEAKUN22622C' +
                       'RLBCAHPFNEV2FJ2H8N3JQGXJRGP19AFHGRW6SS2ZSFYK8EZAPVYL4MCP4' +
                       '6UMR64Y9T89FHWEPXBRHKWJCSNNNGPU984J5XW4BWTU6PDWPN24W8RU55' +
                       'A9C3U9H7VHS5PFURASHBT4JAEE5ZKJBSYMCMDVBLU973R72RVPA6U96A2' +
                       'LX8HMASVST9RVJ7W66V4DYWRDZZQ3673W7C7LVF68TWPLNMYEUQ8FDZRN' +
                       'P38D9BX5YA3VENETDUUUMR9U7FFP4NZM7G4Y6J6EASK5SAXXTRMZ8F3AH' +
                       '5FC54E543N739BY5KVZQM7JZWD2P2HPE7BDRMM9JFCGPBWWASTZ7UDNRV' +
                       '6AFHVMBR9AGAERE9M6W6S2ZT8PBTABPDCKBPPPV6QW9DRXZUGAHDDRRSY' +
                       'XM4YXQ2QJX6CL33N7RV8846LK8A3DFLDXWZ2NKF8V';
    end;
    RM_3072:
    begin
      kv.PublicKey  := '0201B810DA4A1ADD4351378790A98138533267BJBN6W8SY33Y47RWJHWS385XWRV9TSVSB5EM7ECZYNSJ44ZKSD8KV4' +
                       '6Y9T6TNC6QMDW4V6DBMADU3YUKLP88TCLEUD9FTEUHGXM6T57AQ2EMB59' +
                       'UPQVNSUT7Z4EHAMDQ6N77VK2A6P847MMWJH9E7C5XX6FNF6MHGWERPWQV' +
                       '9ZLVR9Z7X5D5Z2XQL6MBM7BDCT2DEDVRBFNDDBLG6LHZ9APM48LS5TKTJ' +
                       'AGDYFDRVHEGTDH47PCLL8YJ4ZAWCB59F8BN5PZL3NQACP32G3YNBX5E3J' +
                       '7S28XLRGAX55ZML5XE6Q68EUAL38VUBJ2MZ2UGCCHM7CE6S99N44X9RMV' +
                       '7B55HULJ4KHPFYSBDUSPQTCWGS76BEQST2QCZDZ2T4FBA4YUJFF47AACE' +
                       'A4EEFESEYWN48UZCSDZAMGSU5VB9UJKR2XQUSDFS3TNG9QKURQWS7N5Q3' +
                       'VPYT4QAGGQ5GW2MMXHDJYW55FQPHSS255GVJ7WLLP85JHS8K6DVTJWB4W' +
                       '4Y8ZEFF7KP6W74PAA8FVPZVDW4RKGMQ8V56Q6R4V34XFE5HR4FZS8GZ6R' +
                       '36RKW6WN34S2AHR9LCGF8LULB7ZN6NC2AA5RPDZYGWSPPME6267CGLZCP' +
                       'GG98W557RXCDWAETJHDCRPUXX7AD3E8SL9WMGBV9QFHMSV9UFV7H9NTX3' +
                       'QYV95CN9P9DSYQWL35R2BWB4GKW6CTWVB2X6WH3P2WFBE6X55KBLAMDB3' +
                       'SRDSDVY37GKH78MUHY7KDJDC8SJU5FUQRYZ49ULX3YSZL7E284GFVZSGD' +
                       'FTTQNR6VMBM3LLR78SUSVMJW88XT2K4UHEATRU3V9MMR2VGNGCY9S6R7M' +
                       '4ELNPEBBMQP2HVPLY5M5VPA92V7NU8ZZ58YYTW5QK9USZ5LV59UZGB2CF' +
                       'DPZ6HFYU5WB7UU3UYWVNSNKM3W7GBYKJP8TMFW2YN6GNSSE4ZKFVZRLUT' +
                       '8QPZBBEQT5H9H5Z53D7QV4AJTKTX4EMW62TDWXQVK24JZPSG2VXKCMYZL' +
                       'BUASE25R3EEK9KBLJ8VX83ZXGTBL5CCDBY33HJ6FKX8AW3WPRX3XTCS9G' +
                       '2B9SVK2XFFKNSPGFG6FZNS8P2HERFGFL79DKUZZFWHFH4H9UZ7F7F6W3Z' +
                       'WN84JRRA7SU8T89EQMRBEPVYMMGLGSUMFWWMEDLJM5EGP5WEX9LDUAQXS' +
                       '55LKDQVRKX4R8NNBHSYBHSNMFYA2C6KGQQFK3TN267DPSZT3PTKHTLNMU' +
                       'V2YYZZRX3953LPWAKYF8LJUVMEQT3ZC4F9SWMYGUHG6XX66PJFQWSRUW2' +
                       'C79YLGZ6ZAFS7HLXBTH55UD3EGFBZQ5CLNJDZTEJACDVBCM5FQBTX4DKK' +
                       'UDGNSMWWLC5UMQRHW89CTU5636WYDXVZZDAUZ529458LDN2DAR9QADWRZ' +
                       'UTU8MCKN8ACH3R36YKE52DDF67SM5UDUH7PTATHXE65UCGFRCV49UTF29' +
                       'BGDSUWGRMC839HUZYQVAG985YUF5KJCAVGKRD8E4YMPJ38KR6HD2KHDGY' +
                       'PJDMJMN4Y3DTJW5MYX3VUPF32637LMAWFM4QCU7BMP74SCF4N5QXZZVBE' +
                       'LAQMPYMJC2ZWJ9XFV33YXTTPH3SG9KMUABLL83P7L3UBVM763XJPR5UEH' +
                       'DZ73XJUGR9QP6299K5PU46XGVWKWFAKWYMRXUSLCFJ3WQTEC6QJH6E5V8' +
                       'X2RMA5TXGSBEWLGSMNQ2SH6G9MLKK4S486DN4M4QVDTYTM4JQETAJQGP7' +
                       '6NUR4UNDXR4W4JQSNWDTUGX69SEDC3AL8ZF4TJBQQRXSX2A86UUWCDCFH' +
                       'JE94A8EP3Q6A2QTYKEE62MV4VJB2AB';
    end;
    RM_4096:
    begin
      kv.PublicKey  := '0201B810DA4A1ADD4351378790A98138533334BN75EUD4LFWYFVNFGBRCEMKKXG62QRBXL8GMHQ975B68FJVEMNXQQ7' +
                       'RKR7RCZMWDVP86QPB3LR49G9BM7EUUZXNCRZBXRF4PEY3RX6UXT4X286K' +
                       'WMR7AMEE6QNP9AEHGWJT9AVU3F62F37B5GVX2BQF73QWHRFQSQ6XMRP6M' +
                       'ZDRQ8JT89UF3YRK5UL34MM3L8HLDTWAJF5YY7MRWJUFDQRK9JNCJ6C9KJ' +
                       'WRE5ACQSNS24NEAHDYKS3AK75HBCTKP9NR2CSL7Q9PPXM4TF7L37USP77' +
                       'Z7WER6JY67F7YGKTP6MFRMKK9H8XFPZ9XWKK97XCFXK7AW4TB96WGEH4B' +
                       'YPF9QRF2DGC3LCHW8VTD2EMHVRDR6EEBUG8R4XYKJPLBPRCJP445DU2BW' +
                       'JWELKAY45GKDU5HLTTDTWRH2JFKJ7AVAKLPEELN29YHX5JR773P9ERW7N' +
                       'UFMWDKD4UL4YPU5QW2L4A7ZN3E8ZDQVEZUR6ZRDQXRLQRLUNHVB4XGBWD' +
                       'HM79NGJARHDBQJCD8NWZCWPBY26QARP7A5S48DCV29F7MUTHU3YAHYVS7' +
                       'ZPGXJZZA5HBBY4K5BQPUG6MVCBG8H3C7VL8KH9EH58NUVCE6F2CGMSM94' +
                       '4CQDKNVGWWWRNK4DG26UT88Y9ULUPJ25G9KLTQPK3TBXZEK43X8KPMJT8' +
                       'DF6MTQ5RB94XR2BT9H9NYYTXL29GF8KZY9QNHAW4LTT2RDQTD2ELWPSV4' +
                       '4AND9K8G5VKLQ287UBEVHA82CMSMGQQBMNQZVAZ9G8T5TD6G9F7XQHMJT' +
                       'HCL6PFEDUW5MN9JASF2EKPT2H33325A3SFGGM5C3RYKZSYSSQC5FLHNX9' +
                       'VHN4HQVWD66YECY4R97JZHQALRTCHXUWH85LSJCCTQZT8JF52FHG6FV9J' +
                       'UJWEU24K9Z7SKYTYA9NH7GW29FSNKUK3DMFXY48VEYZVDRTTMLFYSJH8B' +
                       'RQXV72REYGSM6SLX89EVQ52CN9N8YDLWHAWCDDNM89YN2FCRTLE8688XN' +
                       'F4MZMFE6GP9JK2JTFJVUKBLES2ZVWSBCJE9N3D7DG9LL9Z3U42QFJJPE2' +
                       'HE5XCRY25UND96R9D7655ZBSCPF796FJZ4GPLY7AMZLGLR77GRP467ELK' +
                       'PXSZ9ZF8MUYFDHV4EFACPZ79CDFTYW56NE9JDWDVUMNLY9EXDSF8ZNABE' +
                       'MDQU6T9RVLTNRMZJJ8EJSUM9TV8YA6MNWF2Y66MD3VQ9L662F5X6VE9ZC' +
                       'PPRTNMEV2DG9BUMFMSL7PUR9H5QG6VVBDBMEU3PLABL57HMSQ5C83E9X8' +
                       'RTPY4QSEH2H7R2QDJHT5LQSFNQJL2NZ24GLNTFXG468WC5UUTDD68G8HM' +
                       '477Z8P4F9ZZHUGZ6VPFF32A2MPWY8LPXNECCKM9EEVLDDPUJ8LXN2AE6K' +
                       'Y2Q42FVBCJM9GQTXNRHBED735KCFD4YGV4U5U3LJD6NJ886W6XQLWH3G7' +
                       '3VZ6T5YDUQP6DA5ZHLKQSGATDJHUWC2ELTE7QJFXH8H9EAQYZPPMW76JG' +
                       'Z48UBND9VXFXZMSGBNWQPNQG7E4TCBDMVKUSA9TTVSNLN3DXEZNXH787R' +
                       'N7XHFBJNZ5W74DUMNBYVHEQDYMZBQCFMS8LGSDUAU6QE9DD5Q334BX62T' +
                       'JP5WQQDS2ZEWW76XW7VMLX3L7V9UVD7RL297VDBVRFPQ5MYA3YFVBVNVA' +
                       'R5TJXMQ4X2U2PW6UWSKBXT58HG3QPZM2RVEX2PDMCVJDFTJMXR9NPLW4C' +
                       '6AE4Q9A8TTAQ68BSN9WWTFFTSX68ECVARFPDBBH5DMP4KYFARTFVCSWNF' +
                       'FGAPBYYGFJA4MGHEDWTNE54MPGER7EPCZEV2ESJRMM6XDMFGABG97HECN' +
                       '3SZFUBRKCNDZ2TE9F6EERULRCDAV5EMY6KVY9NY9MYNPP2FQ5WFWLMRYD' +
                       '4TNYYHE6EDMQ6KK79HH5Q5KBW6DDQYYNUR365W2454CHEZWZAPU82SX4H' +
                       'KHNZXBRVWAT7G9CJBKHNBPSVEL67X8UJHBFHZH8ZD4NSEVFZM4Y768TJ6' +
                       'QP3BGEKLTY4UZUWHG63QMKVWAQW9E7WRFNJCH4XRD97JHNKMFUTRFVH68' +
                       'G5CKSMGC725AZ9CBSL2JX43P4EY44CMF56AJ6BEXVCJP2ZDWCT9G55K4D' +
                       'F24J7TTJMFXTQH95CBNX67CBPNWEKHCWQV6VD73Y9KCZHNBFUFS8TCYNN' +
                       'WXRGFKNVRDFUKWHDWDDTSPEW8YCKLPMX2GUV3N4JFJMUE6TSJR6Z53C9F' +
                       'SKZAY3EN7G66JPBF5E9S6Y7RQHPWZHSRDQ7XH87PHUJFLJFGD7WNE3Q9P' +
                       'EXMW33LVJBFEUXKNUB6SU7ZYCEX96XT8G27FLUV7XPV4JK64DWDJCX9WV' +
                       '4VL8CK23FQJ28UG9JUZTQJ3DRL32BTJVRD4LVQ6MK9LCE7ZZP925JK7ZD' +
                       '92SCV4DDJJ5EXMVBF';
    end;
  end;

  // Hardware ID
  kv.UseHardwareLocking := cbHardwareID.Checked;
  if kv.UseHardwareLocking then
  begin
    kv.HardwareID := PWideChar(eHardware.Text);
  end;

  // Secure constant (get it from project file)!
  kv.EncryptedConstant := 2113444489;

  dwResult := KG_VerifyRegistrationInfoW(@kv);

  if dwResult = EP_NO_ERROR then
  begin
    sresult := 'Key is valid!'#13#10;
    sresult := format(sresult + 'Creation Date: %s'#13#10, [DateToStr(EncodeDate(kv.CreationYear, kv.CreationMonth, kv.CreationDay))]);
    if kv.UseKeyExpiration then
    begin
      sresult := format(sresult + 'Expiration Date: %s'#13#10, [DateToStr(EncodeDate(kv.ExpirationYear, kv.ExpirationMonth, kv.ExpirationDay))]);
    end;
    if kv.UseRegisterAfter then
    begin
      sresult := format(sresult + 'Register After Date: %s'#13#10, [DateToStr(EncodeDate(kv.RegisterAfterYear, kv.RegisterAfterMonth, kv.RegisterAfterDay))]);
    end;
    if kv.UseRegisterBefore then
    begin
      sresult := format(sresult + 'Register Before Date: %s'#13#10, [DateToStr(EncodeDate(kv.RegisterBeforeYear, kv.RegisterBeforeMonth, kv.RegisterBeforeDay))]);
    end;
    if kv.UseCountyLimit then
    begin
      for i := 0 to length(KEY_COUNTRIES) - 1 do
      begin
        if kv.CountryCode = KEY_COUNTRIES[i].Code then
        begin
          stemp := KEY_COUNTRIES[i].Name;
          break;
        end;
      end;
      sresult := format(sresult + 'Locked to country: %s'#13#10, [stemp]);
    end;
    if kv.UseExecutionsLimit then
    begin
      sresult := format(sresult + 'Executions limit: %d executions'#13#10, [kv.ExecutionsCount]);
    end;
    if kv.UseDaysLimit then
    begin
      sresult := format(sresult + 'Days limit: %d days'#13#10, [kv.DaysCount]);
    end;
    if kv.UseRunTimeLimit then
    begin
      sresult := format(sresult + 'Run-time limit: %d minutes'#13#10, [kv.RunTimeMinutes]);
    end;
    if kv.UseGlobalTimeLimit then
    begin
      sresult := format(sresult + 'Global Time limit: %d minutes'#13#10, [kv.GlobalTimeMinutes]);
    end;
    for i := 1 to NUMBER_OF_CRYPTED_SECTIONS do
    begin
      if kv.EncryptedSections[i] then
      begin
        sresult := format(sresult + 'Unlocked section #%d'#13#10, [i]);
      end;
    end;
  end else
  begin
    case dwResult of
      EP_ERROR_UNKNOWN                 : sresult := 'EP_ERROR_UNKNOWN                ';
      EP_ERROR_KEYBUFFEREMPTY          : sresult := 'EP_ERROR_KEYBUFFEREMPTY         ';
      EP_ERROR_KEYBUFFERISLESS         : sresult := 'EP_ERROR_KEYBUFFERISLESS        ';
      EP_ERROR_REGINFOEMPTY            : sresult := 'EP_ERROR_REGINFOEMPTY           ';
      EP_ERROR_REGINFOTOOLARGE         : sresult := 'EP_ERROR_REGINFOTOOLARGE        ';
      EP_ERROR_PRIVATEKEYISNOTSET      : sresult := 'EP_ERROR_PRIVATEKEYISNOTSET     ';
      EP_ERROR_PUBLICKEYISNOTSET       : sresult := 'EP_ERROR_PUBLICKEYISNOTSET      ';
      EP_ERROR_PRIVATEKEYISINVALID     : sresult := 'EP_ERROR_PRIVATEKEYISINVALID    ';
      EP_ERROR_PUBLICKEYISINVALID      : sresult := 'EP_ERROR_PUBLICKEYISINVALID     ';
      EP_ERROR_KEYMODEISINVALID        : sresult := 'EP_ERROR_KEYMODEISINVALID       ';
      EP_ERROR_KEYBASEISINVALID        : sresult := 'EP_ERROR_KEYBASEISINVALID       ';
      EP_ERROR_CURRENTDATEISINVALID    : sresult := 'EP_ERROR_CURRENTDATEISINVALID   ';
      EP_ERROR_EXPIRATIONDATEISINVALID : sresult := 'EP_ERROR_EXPIRATIONDATEISINVALID';
      EP_ERROR_KEYISINVALID            : sresult := 'EP_ERROR_KEYISINVALID           ';
      EP_ERROR_HARDWAREID              : sresult := 'EP_ERROR_HARDWAREID             ';
      EP_ERROR_HARDWAREBUFFEREMPTY     : sresult := 'EP_ERROR_HARDWAREBUFFEREMPTY    ';
      EP_ERROR_HARDWAREIDINVALIDFORKEY : sresult := 'EP_ERROR_HARDWAREIDINVALIDFORKEY';
      EP_ERROR_PROJECTFILENOTFOUND     : sresult := 'EP_ERROR_PROJECTFILENOTFOUND    ';
      EP_ERROR_INVALIDPROJECTFILE      : sresult := 'EP_ERROR_INVALIDPROJECTFILE     ';
      EP_ERROR_EXECUTIONSNUMBERINVALID : sresult := 'EP_ERROR_EXECUTIONSNUMBERINVALID';
      EP_ERROR_DAYSNUMBERINVALID       : sresult := 'EP_ERROR_DAYSNUMBERINVALID      ';
      EP_ERROR_COUNTRYCODEINVALID      : sresult := 'EP_ERROR_COUNTRYCODEINVALID     ';
      EP_ERROR_RUNTIMEINVALID          : sresult := 'EP_ERROR_RUNTIMEINVALID         ';
      EP_ERROR_GLOBALTIMEINVALID       : sresult := 'EP_ERROR_GLOBALTIMEINVALID      ';
      EP_ERROR_INSTALLBEFOREINVALID    : sresult := 'EP_ERROR_INSTALLBEFOREINVALID   ';
      EP_ERROR_INSTALLAFTERINVALID     : sresult := 'EP_ERROR_INSTALLAFTERINVALID    ';
      else sresult := 'Unknown error';
    end;
  end;
  ShowMessage(sresult);
end;

Show/Hide Visual C++ function example

void CKeygenDlg::OnBnClickedButtonver()
{
    // TODO: Add your control notification handler code here
  TKeyVerifyParamsW kv;
  wchar_t keybuffer[2048];
  wchar_t username[255];
  wchar_t hardwareid[255];
  DWORD dwResult;

  // Clear params buffer
  memset(&kv, 0, sizeof(kv));
  // Clear key buffer
  memset(&keybuffer, 0, sizeof(keybuffer));
  GetDlgItemTextW(IDC_EDITKEY, (wchar_t*)&keybuffer, sizeof(keybuffer));
  kv.Key = (wchar_t*) keybuffer;
  kv.KeyLen = wcslen(kv.Key);

  // Fill User Info
  memset(&username, 0, sizeof(username));
  GetDlgItemTextW(IDC_EDITNAME, (wchar_t*)&username, sizeof(username));
  kv.RegInfo = (wchar_t*)&username;

  // Hardware ID
  if (IsDlgButtonChecked(IDC_CHECKHD) != 0)
  {
      kv.UseHardwareLocking = true;
      memset(&hardwareid, 0, sizeof(hardwareid));
      GetDlgItemTextW(IDC_EDITHD, (wchar_t*)&hardwareid, sizeof(hardwareid));
      kv.HardwareID = (wchar_t*)&hardwareid;
  }

  kv.KeyMode = com_key_mode.GetCurSel();
  kv.KeyBase = com_key_base.GetCurSel();

  kv.EncryptedConstant = 2113444489;

  switch (kv.KeyMode)
  {
    case RM_512:
    {
        wchar_t pl[] = L"0201B810DA4A1ADD4351378790A98138533067CP4S86R7D8THS45GBCVUM635EPRQRMYRP3DAA5DUPZ6ABDSFP7F5AC" \
            L"P7ERGH4A7Y6B6NW6NMMBZF83WVER9Y4MMBNLBQDKR7KFVLGLV067CFDQC" \
            L"WCHGQVVRN24DECEPBL96YJQJTVDCRTNQG3E4WW4GK4GQ5X5L5H88D3XYH" \
            L"CBRBNASPD3P5CNYFKFHBCSDHHD6WPTCC4XVSM5S88067C2JSTCMVT48C8" \
            L"HC7SHKGTFJBM28P6XTBCNWHMV6J6KN6W5Q9TQLVR285U6GVCAAUTZLRTP" \
            L"SRGDQ742B4742XF4MACRR747YDP5FZZ9D";
        kv.PublicKey = pl;
      break;
    }
    case RM_768:
    {
        wchar_t pl[] = L"0201B810DA4A1ADD4351378790A9813853309AEHRR66KMK99UEPX8C54WQFDZQ5Y96WUCVZYMXBC32SJV7T5SBPR54E" \
            L"2DBH8UD9RNHTJ9BLJV6NHX52W7PZDDTTJDDGF3YFVL7PJFL8RS8THTFDF" \
            L"4RY7K3QXLTMXMC8DDSRVRWBVMMP3UYKCDDC7KGL9PG509ACPTRQ4MMUKG" \
            L"DAUJFFFGSCBFLYK9X9E74M58PW5FG9B9RTLXJQ4STPVCHJTEH8BP557VZ" \
            L"PQYDBUZJXXJNGVZELFL4UL3LHHE8A645CK593DVWCQBSX4ZCCQ3ST8GCZ" \
            L"LW2729XK3NT7GST3LMQGXSHLDWCXE09AENVX2QTX3VLT6FWB4JND875XZ" \
            L"WQ26GW76TV3KVVHK7U489LLPBQ39HUWKMA65U3HKWBDHKBZEB525PHEH2" \
            L"YQHRZGNJAAYZXMWN8RNZ9T7VMZAJMP2V3S9NXZ9RHL96F7AT3NTMN36V4" \
            L"ACSFEN4DR6TJR95";
        kv.PublicKey = pl;
      break;
    }
    case RM_1024:
    {
        wchar_t pl[] = L"0201B810DA4A1ADD4351378790A981385330CDG9YQSEUK2HT546KWW46NHSCHMD2TNCSPVNSKGQC6CHDUSU9CC4LDPL" \
            L"TD3NLRVD3TFV9BU2SYBUBU9TXKLQ3CTKZE5GN9VFG37R9YNK2FE58K7ZY" \
            L"WTUJYFSJTBMDLLGA9GJ2LJXGHSS9CESGC2K69H65YQGAC7CRGF5T3CPLA" \
            L"5BDJZKVCUWPZRNA2DN7L956LZVZBQUDPX6PF30CDBH26Z82VE4QQ8N85L" \
            L"QHYJYYCJ6WQ89H9K9VVQX925SG5FJ79AGVZB6M8TTFKCJ56FAREP8GSTC" \
            L"NKWCXEALDP9Y2ZLS9QKZV8JRNDHG9D8BRDSCTMDQK9NLAPZ9TGYFS9G7U" \
            L"LXHYJF7F9A89HPXGTU2N4FQQJL98WZ5QND2KTEMMUUZFAX953HCGNSWUW" \
            L"U2M7LBEWZSH9GW5SC0CDJDY2HC4HJYUSVTAVXZ7MYVJWF3CU9WC3SVPSL" \
            L"29WF46DVS2SYKSSAMATPPYGJDE3PBFMGS34CXWQSXKCEAE63L2EXTS9NE" \
            L"2G597XASY3S34XMYST5YZF4THUTYT5DY9UKKXU6PH8MLXRPZMPMMR83JU" \
            L"X2WGNEW8ZGL4SKUCUB8CEAB6UZ4FB66WTP3B64VMX7XG75T4Y35479";
        kv.PublicKey = pl;
      break;
    }
    case RM_2048:
    {
        wchar_t pl[] = L"0201B810DA4A1ADD4351378790A98138533199H9KZC4CQ5ZKPEGYDW2EHN5AKZA5G5KP4HU8USWJR8XWW7MCH7244RV" \
            L"PSXFHVU6YQRK4LPUHM497XJYPLLA3DHUZWXK3CB5SUYF75NPYLTNPRUAP" \
            L"CTVDHAKYWTRQ97HES2E59WDN2LJKFYA2K8BGFSBHP4A6BF5FSDTS8NWLL" \
            L"C5NEQ76NJ9BAMWXG55UPFFMRQZTU5KV2G6LSPQUJJWA9U4LJ5SCJ9M9ZQ" \
            L"Z6K7LZA9UAMJ533UQ5J3JPNQAUWJGZFRFCTGAGSBWPWRRF9HRGF9MCX55" \
            L"QRYGPYMRE6DBJ65SJDX34FVPYWWKWQ48MCKXYXPHQ23BJ42U8ZMDD8CG5" \
            L"DPHZQ5XTXUKA277XK6PKSTLJ88ZZ9EBXH62REMRZZRGNPKHYM34RW722S" \
            L"SZHMPFKY7X8UZ19ADGX3UQ7X444XH7MZXEZYW2YLFHR8YL3PTCXVSYX89" \
            L"ZXN7KW2XNBE8XS3TQRGZVF6KA5USH56NEZYH5RNWBBPVE9LD6H42RQWR5" \
            L"YVQMT5EQYQTK6YM9V8DA5BJCLGGZ2UGD6NPA2X3SNUS47F7HJBNBCWHRA" \
            L"YPPCQ5HWCJNPDHUDQMRN2P6PWJFWJ6CLVNK8HXEFLE4ENPXAFN89CRS43" \
            L"RUMVGDJQCSRB535XYCS6BZYLA9Q6HJV425F26XXHRGA7C8R8BVMELAPEH" \
            L"5DSA9KXTCV4H2RNVDFHG3YJSERZVFPWHYA823LUBENBL5U3J4LJX2KQLW" \
            L"L5XGGESPSE2FQWKSQ4NUCDLBEJPQAT2A2477DYS2XEXKLYEAKUN22622C" \
            L"RLBCAHPFNEV2FJ2H8N3JQGXJRGP19AFHGRW6SS2ZSFYK8EZAPVYL4MCP4" \
            L"6UMR64Y9T89FHWEPXBRHKWJCSNNNGPU984J5XW4BWTU6PDWPN24W8RU55" \
            L"A9C3U9H7VHS5PFURASHBT4JAEE5ZKJBSYMCMDVBLU973R72RVPA6U96A2" \
            L"LX8HMASVST9RVJ7W66V4DYWRDZZQ3673W7C7LVF68TWPLNMYEUQ8FDZRN" \
            L"P38D9BX5YA3VENETDUUUMR9U7FFP4NZM7G4Y6J6EASK5SAXXTRMZ8F3AH" \
            L"5FC54E543N739BY5KVZQM7JZWD2P2HPE7BDRMM9JFCGPBWWASTZ7UDNRV" \
            L"6AFHVMBR9AGAERE9M6W6S2ZT8PBTABPDCKBPPPV6QW9DRXZUGAHDDRRSY" \
            L"XM4YXQ2QJX6CL33N7RV8846LK8A3DFLDXWZ2NKF8V";
        kv.PublicKey = pl;
      break;
    }
    case RM_3072:
    {
        wchar_t pl[] = L"0201B810DA4A1ADD4351378790A98138533267BJBN6W8SY33Y47RWJHWS385XWRV9TSVSB5EM7ECZYNSJ44ZKSD8KV4" \
            L"6Y9T6TNC6QMDW4V6DBMADU3YUKLP88TCLEUD9FTEUHGXM6T57AQ2EMB59" \
            L"UPQVNSUT7Z4EHAMDQ6N77VK2A6P847MMWJH9E7C5XX6FNF6MHGWERPWQV" \
            L"9ZLVR9Z7X5D5Z2XQL6MBM7BDCT2DEDVRBFNDDBLG6LHZ9APM48LS5TKTJ" \
            L"AGDYFDRVHEGTDH47PCLL8YJ4ZAWCB59F8BN5PZL3NQACP32G3YNBX5E3J" \
            L"7S28XLRGAX55ZML5XE6Q68EUAL38VUBJ2MZ2UGCCHM7CE6S99N44X9RMV" \
            L"7B55HULJ4KHPFYSBDUSPQTCWGS76BEQST2QCZDZ2T4FBA4YUJFF47AACE" \
            L"A4EEFESEYWN48UZCSDZAMGSU5VB9UJKR2XQUSDFS3TNG9QKURQWS7N5Q3" \
            L"VPYT4QAGGQ5GW2MMXHDJYW55FQPHSS255GVJ7WLLP85JHS8K6DVTJWB4W" \
            L"4Y8ZEFF7KP6W74PAA8FVPZVDW4RKGMQ8V56Q6R4V34XFE5HR4FZS8GZ6R" \
            L"36RKW6WN34S2AHR9LCGF8LULB7ZN6NC2AA5RPDZYGWSPPME6267CGLZCP" \
            L"GG98W557RXCDWAETJHDCRPUXX7AD3E8SL9WMGBV9QFHMSV9UFV7H9NTX3" \
            L"QYV95CN9P9DSYQWL35R2BWB4GKW6CTWVB2X6WH3P2WFBE6X55KBLAMDB3" \
            L"SRDSDVY37GKH78MUHY7KDJDC8SJU5FUQRYZ49ULX3YSZL7E284GFVZSGD" \
            L"FTTQNR6VMBM3LLR78SUSVMJW88XT2K4UHEATRU3V9MMR2VGNGCY9S6R7M" \
            L"4ELNPEBBMQP2HVPLY5M5VPA92V7NU8ZZ58YYTW5QK9USZ5LV59UZGB2CF" \
            L"DPZ6HFYU5WB7UU3UYWVNSNKM3W7GBYKJP8TMFW2YN6GNSSE4ZKFVZRLUT" \
            L"8QPZBBEQT5H9H5Z53D7QV4AJTKTX4EMW62TDWXQVK24JZPSG2VXKCMYZL" \
            L"BUASE25R3EEK9KBLJ8VX83ZXGTBL5CCDBY33HJ6FKX8AW3WPRX3XTCS9G" \
            L"2B9SVK2XFFKNSPGFG6FZNS8P2HERFGFL79DKUZZFWHFH4H9UZ7F7F6W3Z" \
            L"WN84JRRA7SU8T89EQMRBEPVYMMGLGSUMFWWMEDLJM5EGP5WEX9LDUAQXS" \
            L"55LKDQVRKX4R8NNBHSYBHSNMFYA2C6KGQQFK3TN267DPSZT3PTKHTLNMU" \
            L"V2YYZZRX3953LPWAKYF8LJUVMEQT3ZC4F9SWMYGUHG6XX66PJFQWSRUW2" \
            L"C79YLGZ6ZAFS7HLXBTH55UD3EGFBZQ5CLNJDZTEJACDVBCM5FQBTX4DKK" \
            L"UDGNSMWWLC5UMQRHW89CTU5636WYDXVZZDAUZ529458LDN2DAR9QADWRZ" \
            L"UTU8MCKN8ACH3R36YKE52DDF67SM5UDUH7PTATHXE65UCGFRCV49UTF29" \
            L"BGDSUWGRMC839HUZYQVAG985YUF5KJCAVGKRD8E4YMPJ38KR6HD2KHDGY" \
            L"PJDMJMN4Y3DTJW5MYX3VUPF32637LMAWFM4QCU7BMP74SCF4N5QXZZVBE" \
            L"LAQMPYMJC2ZWJ9XFV33YXTTPH3SG9KMUABLL83P7L3UBVM763XJPR5UEH" \
            L"DZ73XJUGR9QP6299K5PU46XGVWKWFAKWYMRXUSLCFJ3WQTEC6QJH6E5V8" \
            L"X2RMA5TXGSBEWLGSMNQ2SH6G9MLKK4S486DN4M4QVDTYTM4JQETAJQGP7" \
            L"6NUR4UNDXR4W4JQSNWDTUGX69SEDC3AL8ZF4TJBQQRXSX2A86UUWCDCFH" \
            L"JE94A8EP3Q6A2QTYKEE62MV4VJB2AB";
        kv.PublicKey = pl;
      break;
    }
    case RM_4096:
    {
        wchar_t pl[] = L"0201B810DA4A1ADD4351378790A98138533334BN75EUD4LFWYFVNFGBRCEMKKXG62QRBXL8GMHQ975B68FJVEMNXQQ7" \
            L"RKR7RCZMWDVP86QPB3LR49G9BM7EUUZXNCRZBXRF4PEY3RX6UXT4X286K" \
            L"WMR7AMEE6QNP9AEHGWJT9AVU3F62F37B5GVX2BQF73QWHRFQSQ6XMRP6M" \
            L"ZDRQ8JT89UF3YRK5UL34MM3L8HLDTWAJF5YY7MRWJUFDQRK9JNCJ6C9KJ" \
            L"WRE5ACQSNS24NEAHDYKS3AK75HBCTKP9NR2CSL7Q9PPXM4TF7L37USP77" \
            L"Z7WER6JY67F7YGKTP6MFRMKK9H8XFPZ9XWKK97XCFXK7AW4TB96WGEH4B" \
            L"YPF9QRF2DGC3LCHW8VTD2EMHVRDR6EEBUG8R4XYKJPLBPRCJP445DU2BW" \
            L"JWELKAY45GKDU5HLTTDTWRH2JFKJ7AVAKLPEELN29YHX5JR773P9ERW7N" \
            L"UFMWDKD4UL4YPU5QW2L4A7ZN3E8ZDQVEZUR6ZRDQXRLQRLUNHVB4XGBWD" \
            L"HM79NGJARHDBQJCD8NWZCWPBY26QARP7A5S48DCV29F7MUTHU3YAHYVS7" \
            L"ZPGXJZZA5HBBY4K5BQPUG6MVCBG8H3C7VL8KH9EH58NUVCE6F2CGMSM94" \
            L"4CQDKNVGWWWRNK4DG26UT88Y9ULUPJ25G9KLTQPK3TBXZEK43X8KPMJT8" \
            L"DF6MTQ5RB94XR2BT9H9NYYTXL29GF8KZY9QNHAW4LTT2RDQTD2ELWPSV4" \
            L"4AND9K8G5VKLQ287UBEVHA82CMSMGQQBMNQZVAZ9G8T5TD6G9F7XQHMJT" \
            L"HCL6PFEDUW5MN9JASF2EKPT2H33325A3SFGGM5C3RYKZSYSSQC5FLHNX9" \
            L"VHN4HQVWD66YECY4R97JZHQALRTCHXUWH85LSJCCTQZT8JF52FHG6FV9J" \
            L"UJWEU24K9Z7SKYTYA9NH7GW29FSNKUK3DMFXY48VEYZVDRTTMLFYSJH8B" \
            L"RQXV72REYGSM6SLX89EVQ52CN9N8YDLWHAWCDDNM89YN2FCRTLE8688XN" \
            L"F4MZMFE6GP9JK2JTFJVUKBLES2ZVWSBCJE9N3D7DG9LL9Z3U42QFJJPE2" \
            L"HE5XCRY25UND96R9D7655ZBSCPF796FJZ4GPLY7AMZLGLR77GRP467ELK" \
            L"PXSZ9ZF8MUYFDHV4EFACPZ79CDFTYW56NE9JDWDVUMNLY9EXDSF8ZNABE" \
            L"MDQU6T9RVLTNRMZJJ8EJSUM9TV8YA6MNWF2Y66MD3VQ9L662F5X6VE9ZC" \
            L"PPRTNMEV2DG9BUMFMSL7PUR9H5QG6VVBDBMEU3PLABL57HMSQ5C83E9X8" \
            L"RTPY4QSEH2H7R2QDJHT5LQSFNQJL2NZ24GLNTFXG468WC5UUTDD68G8HM" \
            L"477Z8P4F9ZZHUGZ6VPFF32A2MPWY8LPXNECCKM9EEVLDDPUJ8LXN2AE6K" \
            L"Y2Q42FVBCJM9GQTXNRHBED735KCFD4YGV4U5U3LJD6NJ886W6XQLWH3G7" \
            L"3VZ6T5YDUQP6DA5ZHLKQSGATDJHUWC2ELTE7QJFXH8H9EAQYZPPMW76JG" \
            L"Z48UBND9VXFXZMSGBNWQPNQG7E4TCBDMVKUSA9TTVSNLN3DXEZNXH787R" \
            L"N7XHFBJNZ5W74DUMNBYVHEQDYMZBQCFMS8LGSDUAU6QE9DD5Q334BX62T" \
            L"JP5WQQDS2ZEWW76XW7VMLX3L7V9UVD7RL297VDBVRFPQ5MYA3YFVBVNVA" \
            L"R5TJXMQ4X2U2PW6UWSKBXT58HG3QPZM2RVEX2PDMCVJDFTJMXR9NPLW4C" \
            L"6AE4Q9A8TTAQ68BSN9WWTFFTSX68ECVARFPDBBH5DMP4KYFARTFVCSWNF" \
            L"FGAPBYYGFJA4MGHEDWTNE54MPGER7EPCZEV2ESJRMM6XDMFGABG97HECN" \
            L"3SZFUBRKCNDZ2TE9F6EERULRCDAV5EMY6KVY9NY9MYNPP2FQ5WFWLMRYD" \
            L"4TNYYHE6EDMQ6KK79HH5Q5KBW6DDQYYNUR365W2454CHEZWZAPU82SX4H" \
            L"KHNZXBRVWAT7G9CJBKHNBPSVEL67X8UJHBFHZH8ZD4NSEVFZM4Y768TJ6" \
            L"QP3BGEKLTY4UZUWHG63QMKVWAQW9E7WRFNJCH4XRD97JHNKMFUTRFVH68" \
            L"G5CKSMGC725AZ9CBSL2JX43P4EY44CMF56AJ6BEXVCJP2ZDWCT9G55K4D" \
            L"F24J7TTJMFXTQH95CBNX67CBPNWEKHCWQV6VD73Y9KCZHNBFUFS8TCYNN" \
            L"WXRGFKNVRDFUKWHDWDDTSPEW8YCKLPMX2GUV3N4JFJMUE6TSJR6Z53C9F" \
            L"SKZAY3EN7G66JPBF5E9S6Y7RQHPWZHSRDQ7XH87PHUJFLJFGD7WNE3Q9P" \
            L"EXMW33LVJBFEUXKNUB6SU7ZYCEX96XT8G27FLUV7XPV4JK64DWDJCX9WV" \
            L"4VL8CK23FQJ28UG9JUZTQJ3DRL32BTJVRD4LVQ6MK9LCE7ZZP925JK7ZD" \
            L"92SCV4DDJJ5EXMVBF";
        kv.PublicKey = pl;
      break;
    }
  }

  // Generate reg. key
  dwResult = KG_VerifyRegistrationInfoW(&kv);

  if (dwResult == EP_NO_ERROR)
  {
      wchar_t tmp[255];
      memset(&tmp, 0, sizeof(tmp));
      // Creation date
      wchar_t mes[2048] = L"Valid Registration Key!\n";
      wsprintf(tmp, L"Creation date: %d/%d/%d\n", kv.CreationDay, kv.CreationMonth, kv.CreationYear);
      wcscat(mes, tmp);
      // Expiration date
      if (kv.UseKeyExpiration)
      {
          wsprintf(tmp, L"Expiration date: %d/%d/%d\n", kv.ExpirationDay, kv.ExpirationMonth, kv.ExpirationYear);
          wcscat(mes, tmp);
      }
      // Register After date
      if (kv.UseRegisterAfter)
      {
          wsprintf(tmp, L"Register After date: %d/%d/%d\n", kv.RegisterAfterDay, kv.RegisterAfterMonth, kv.RegisterAfterYear);
          wcscat(mes, tmp);
      }
      // Register Before date
      if (kv.UseRegisterBefore)
      {
          wsprintf(tmp, L"Register Before date: %d/%d/%d\n", kv.RegisterBeforeDay, kv.RegisterBeforeMonth, kv.RegisterBeforeYear);
          wcscat(mes, tmp);
      }
      // Executions
      if (kv.UseExecutionsLimit)
      {
          wsprintf(tmp, L"Executions: %d\n", kv.ExecutionsCount);
          wcscat(mes, tmp);
      }
      // Days
      if (kv.UseDaysLimit)
      {
          wsprintf(tmp, L"Days: %d\n", kv.DaysCount);
          wcscat(mes, tmp);
      }
      // Run-time
      if (kv.UseRunTimeLimit)
      {
          wsprintf(tmp, L"Run-time: %d minutes\n", kv.RunTimeMinutes);
          wcscat(mes, tmp);
      }
      // Global Time
      if (kv.UseGlobalTimeLimit)
      {
          wsprintf(tmp, L"Global Time: %d minutes\n", kv.GlobalTimeMinutes);
          wcscat(mes, tmp);
      }
      // Country
      if (kv.UseCountyLimit)
      {
          for (int i = 0; i < ARRAYSIZE(KEY_COUNTRIES); i++)
          {
              if (kv.CountryCode == KEY_COUNTRIES[i].Code)
              {
                  wchar_t wcn[255];
                  char* acn = KEY_COUNTRIES[i].Name;
                  int aln = strlen(acn) + 1;
                  MultiByteToWideChar(CP_ACP, 0, acn, aln, (LPWSTR)&wcn, aln);
                  wsprintf(tmp, L"Country Lock: %s\n", &wcn);
                  wcscat(mes, tmp);
                  break;
              }
          }
      }
      for (int i = 0; i < NUMBER_OF_CRYPTED_SECTIONS; i++)
      {
          if (kv.EncryptedSections[i])
          {
              wsprintf(tmp, L"Unlocked section: #%d\n", i + 1);
              wcscat(mes, tmp);
          }
      }
      MessageBox(mes);
  } else
  {
    wchar_t* sError;
    switch (dwResult)
    {
      case EP_ERROR_UNKNOWN:
        sError = L"EP_ERROR_UNKNOWN";
        break;
      case EP_ERROR_KEYBUFFEREMPTY:
        sError = L"EP_ERROR_KEYBUFFEREMPTY";
        break;
      case EP_ERROR_KEYBUFFERISLESS:
        sError = L"EP_ERROR_KEYBUFFERISLESS";
        break;
      case EP_ERROR_REGINFOEMPTY:
        sError = L"EP_ERROR_REGINFOEMPTY";
        break;
      case EP_ERROR_REGINFOTOOLARGE:
        sError = L"EP_ERROR_REGINFOTOOLARGE";
        break;
      case EP_ERROR_PRIVATEKEYISNOTSET:
        sError = L"EP_ERROR_PRIVATEKEYISNOTSET";
        break;
      case EP_ERROR_PUBLICKEYISNOTSET:
        sError = L"EP_ERROR_PUBLICKEYISNOTSET";
        break;
      case EP_ERROR_PRIVATEKEYISINVALID:
        sError = L"EP_ERROR_PRIVATEKEYISINVALID";
        break;
      case EP_ERROR_PUBLICKEYISINVALID:
        sError = L"EP_ERROR_PUBLICKEYISINVALID";
        break;
      case EP_ERROR_KEYMODEISINVALID:
        sError = L"EP_ERROR_KEYMODEISINVALID";
        break;
      case EP_ERROR_KEYBASEISINVALID:
        sError = L"EP_ERROR_KEYBASEISINVALID";
        break;
      case EP_ERROR_CURRENTDATEISINVALID:
        sError = L"EP_ERROR_CURRENTDATEISINVALID";
        break;
      case EP_ERROR_EXPIRATIONDATEISINVALID:
        sError = L"EP_ERROR_EXPIRATIONDATEISINVALID";
        break;
      case EP_ERROR_KEYISINVALID:
        sError = L"EP_ERROR_KEYISINVALID";
        break;
      case EP_ERROR_HARDWAREID:
        sError = L"EP_ERROR_HARDWAREID";
        break;
      case EP_ERROR_HARDWAREBUFFEREMPTY:
        sError = L"EP_ERROR_HARDWAREBUFFEREMPTY";
        break;
      case EP_ERROR_HARDWAREIDINVALIDFORKEY:
        sError = L"EP_ERROR_HARDWAREIDINVALIDFORKEY";
        break;
      case EP_ERROR_PROJECTFILENOTFOUND:
        sError = L"EP_ERROR_PROJECTFILENOTFOUND";
        break;
      case EP_ERROR_INVALIDPROJECTFILE:
        sError = L"EP_ERROR_INVALIDPROJECTFILE";
        break;
      case EP_ERROR_EXECUTIONSNUMBERINVALID:
        sError = L"EP_ERROR_EXECUTIONSNUMBERINVALID";
        break;
      case EP_ERROR_DAYSNUMBERINVALID:
        sError = L"EP_ERROR_DAYSNUMBERINVALID";
        break;
      case EP_ERROR_COUNTRYCODEINVALID:
        sError = L"EP_ERROR_COUNTRYCODEINVALID";
        break;
      case EP_ERROR_RUNTIMEINVALID:
        sError = L"EP_ERROR_RUNTIMEINVALID";
        break;
      case EP_ERROR_GLOBALTIMEINVALID:
        sError = L"EP_ERROR_GLOBALTIMEINVALID";
        break;
      case EP_ERROR_INSTALLBEFOREINVALID:
        sError = L"EP_ERROR_INSTALLBEFOREINVALID";
        break;
      case EP_ERROR_INSTALLAFTERINVALID:
        sError = L"EP_ERROR_INSTALLAFTERINVALID";
        break;
      default:
        sError = L"Unknown error";
        break;
    }
    MessageBox(sError);
  }
}

Show/Hide C# (.NET) function example

        private void btnVerify_Click(object sender, EventArgs e)
        {
            if (tbUserInfo.Text == string.Empty)
            {
                MessageBox.Show("User info field is empty!");
                return;
            }
            if (tbUserInfo.Text == string.Empty)
            {
                MessageBox.Show("Registration key field is empty!");
                return;
            }
            Enigma_KeyGen_IDE.TKeyVerifyParamsW kv = new Enigma_KeyGen_IDE.TKeyVerifyParamsW();
            kv.KeyMode = cbKeyMode.SelectedIndex;
            kv.KeyBase = cbKeyBase.SelectedIndex;
            switch (kv.KeyMode)
            {
                case Enigma_KeyGen_IDE.RM_512:
                    {
                        kv.PublicKey = "0201B810DA4A1ADD4351378790A98138533067CP4S86R7D8THS45GBCVUM635EPRQRMYRP3DAA5DUPZ6ABDSFP7F5AC" +
                                       "P7ERGH4A7Y6B6NW6NMMBZF83WVER9Y4MMBNLBQDKR7KFVLGLV067CFDQC" +
                                       "WCHGQVVRN24DECEPBL96YJQJTVDCRTNQG3E4WW4GK4GQ5X5L5H88D3XYH" +
                                       "CBRBNASPD3P5CNYFKFHBCSDHHD6WPTCC4XVSM5S88067C2JSTCMVT48C8" +
                                       "HC7SHKGTFJBM28P6XTBCNWHMV6J6KN6W5Q9TQLVR285U6GVCAAUTZLRTP" +
                                       "SRGDQ742B4742XF4MACRR747YDP5FZZ9D";
                        break;
                    }
                case Enigma_KeyGen_IDE.RM_768:
                    {
                        kv.PublicKey = "0201B810DA4A1ADD4351378790A9813853309AEHRR66KMK99UEPX8C54WQFDZQ5Y96WUCVZYMXBC32SJV7T5SBPR54E" +
                                       "2DBH8UD9RNHTJ9BLJV6NHX52W7PZDDTTJDDGF3YFVL7PJFL8RS8THTFDF" +
                                       "4RY7K3QXLTMXMC8DDSRVRWBVMMP3UYKCDDC7KGL9PG509ACPTRQ4MMUKG" +
                                       "DAUJFFFGSCBFLYK9X9E74M58PW5FG9B9RTLXJQ4STPVCHJTEH8BP557VZ" +
                                       "PQYDBUZJXXJNGVZELFL4UL3LHHE8A645CK593DVWCQBSX4ZCCQ3ST8GCZ" +
                                       "LW2729XK3NT7GST3LMQGXSHLDWCXE09AENVX2QTX3VLT6FWB4JND875XZ" +
                                       "WQ26GW76TV3KVVHK7U489LLPBQ39HUWKMA65U3HKWBDHKBZEB525PHEH2" +
                                       "YQHRZGNJAAYZXMWN8RNZ9T7VMZAJMP2V3S9NXZ9RHL96F7AT3NTMN36V4" +
                                       "ACSFEN4DR6TJR95";
                        break;
                    }
                case Enigma_KeyGen_IDE.RM_1024:
                    {
                        kv.PublicKey = "0201B810DA4A1ADD4351378790A981385330CDG9YQSEUK2HT546KWW46NHSCHMD2TNCSPVNSKGQC6CHDUSU9CC4LDPL" +
                                       "TD3NLRVD3TFV9BU2SYBUBU9TXKLQ3CTKZE5GN9VFG37R9YNK2FE58K7ZY" +
                                       "WTUJYFSJTBMDLLGA9GJ2LJXGHSS9CESGC2K69H65YQGAC7CRGF5T3CPLA" +
                                       "5BDJZKVCUWPZRNA2DN7L956LZVZBQUDPX6PF30CDBH26Z82VE4QQ8N85L" +
                                       "QHYJYYCJ6WQ89H9K9VVQX925SG5FJ79AGVZB6M8TTFKCJ56FAREP8GSTC" +
                                       "NKWCXEALDP9Y2ZLS9QKZV8JRNDHG9D8BRDSCTMDQK9NLAPZ9TGYFS9G7U" +
                                       "LXHYJF7F9A89HPXGTU2N4FQQJL98WZ5QND2KTEMMUUZFAX953HCGNSWUW" +
                                       "U2M7LBEWZSH9GW5SC0CDJDY2HC4HJYUSVTAVXZ7MYVJWF3CU9WC3SVPSL" +
                                       "29WF46DVS2SYKSSAMATPPYGJDE3PBFMGS34CXWQSXKCEAE63L2EXTS9NE" +
                                       "2G597XASY3S34XMYST5YZF4THUTYT5DY9UKKXU6PH8MLXRPZMPMMR83JU" +
                                       "X2WGNEW8ZGL4SKUCUB8CEAB6UZ4FB66WTP3B64VMX7XG75T4Y35479";
                        break;
                    }
                case Enigma_KeyGen_IDE.RM_2048:
                    {
                        kv.PublicKey = "0201B810DA4A1ADD4351378790A98138533199H9KZC4CQ5ZKPEGYDW2EHN5AKZA5G5KP4HU8USWJR8XWW7MCH7244RV" +
                                       "PSXFHVU6YQRK4LPUHM497XJYPLLA3DHUZWXK3CB5SUYF75NPYLTNPRUAP" +
                                       "CTVDHAKYWTRQ97HES2E59WDN2LJKFYA2K8BGFSBHP4A6BF5FSDTS8NWLL" +
                                       "C5NEQ76NJ9BAMWXG55UPFFMRQZTU5KV2G6LSPQUJJWA9U4LJ5SCJ9M9ZQ" +
                                       "Z6K7LZA9UAMJ533UQ5J3JPNQAUWJGZFRFCTGAGSBWPWRRF9HRGF9MCX55" +
                                       "QRYGPYMRE6DBJ65SJDX34FVPYWWKWQ48MCKXYXPHQ23BJ42U8ZMDD8CG5" +
                                       "DPHZQ5XTXUKA277XK6PKSTLJ88ZZ9EBXH62REMRZZRGNPKHYM34RW722S" +
                                       "SZHMPFKY7X8UZ19ADGX3UQ7X444XH7MZXEZYW2YLFHR8YL3PTCXVSYX89" +
                                       "ZXN7KW2XNBE8XS3TQRGZVF6KA5USH56NEZYH5RNWBBPVE9LD6H42RQWR5" +
                                       "YVQMT5EQYQTK6YM9V8DA5BJCLGGZ2UGD6NPA2X3SNUS47F7HJBNBCWHRA" +
                                       "YPPCQ5HWCJNPDHUDQMRN2P6PWJFWJ6CLVNK8HXEFLE4ENPXAFN89CRS43" +
                                       "RUMVGDJQCSRB535XYCS6BZYLA9Q6HJV425F26XXHRGA7C8R8BVMELAPEH" +
                                       "5DSA9KXTCV4H2RNVDFHG3YJSERZVFPWHYA823LUBENBL5U3J4LJX2KQLW" +
                                       "L5XGGESPSE2FQWKSQ4NUCDLBEJPQAT2A2477DYS2XEXKLYEAKUN22622C" +
                                       "RLBCAHPFNEV2FJ2H8N3JQGXJRGP19AFHGRW6SS2ZSFYK8EZAPVYL4MCP4" +
                                       "6UMR64Y9T89FHWEPXBRHKWJCSNNNGPU984J5XW4BWTU6PDWPN24W8RU55" +
                                       "A9C3U9H7VHS5PFURASHBT4JAEE5ZKJBSYMCMDVBLU973R72RVPA6U96A2" +
                                       "LX8HMASVST9RVJ7W66V4DYWRDZZQ3673W7C7LVF68TWPLNMYEUQ8FDZRN" +
                                       "P38D9BX5YA3VENETDUUUMR9U7FFP4NZM7G4Y6J6EASK5SAXXTRMZ8F3AH" +
                                       "5FC54E543N739BY5KVZQM7JZWD2P2HPE7BDRMM9JFCGPBWWASTZ7UDNRV" +
                                       "6AFHVMBR9AGAERE9M6W6S2ZT8PBTABPDCKBPPPV6QW9DRXZUGAHDDRRSY" +
                                       "XM4YXQ2QJX6CL33N7RV8846LK8A3DFLDXWZ2NKF8V";
                        break;
                    }
                case Enigma_KeyGen_IDE.RM_3072:
                    {
                        kv.PublicKey = "0201B810DA4A1ADD4351378790A98138533267BJBN6W8SY33Y47RWJHWS385XWRV9TSVSB5EM7ECZYNSJ44ZKSD8KV4" +
                                       "6Y9T6TNC6QMDW4V6DBMADU3YUKLP88TCLEUD9FTEUHGXM6T57AQ2EMB59" +
                                       "UPQVNSUT7Z4EHAMDQ6N77VK2A6P847MMWJH9E7C5XX6FNF6MHGWERPWQV" +
                                       "9ZLVR9Z7X5D5Z2XQL6MBM7BDCT2DEDVRBFNDDBLG6LHZ9APM48LS5TKTJ" +
                                       "AGDYFDRVHEGTDH47PCLL8YJ4ZAWCB59F8BN5PZL3NQACP32G3YNBX5E3J" +
                                       "7S28XLRGAX55ZML5XE6Q68EUAL38VUBJ2MZ2UGCCHM7CE6S99N44X9RMV" +
                                       "7B55HULJ4KHPFYSBDUSPQTCWGS76BEQST2QCZDZ2T4FBA4YUJFF47AACE" +
                                       "A4EEFESEYWN48UZCSDZAMGSU5VB9UJKR2XQUSDFS3TNG9QKURQWS7N5Q3" +
                                       "VPYT4QAGGQ5GW2MMXHDJYW55FQPHSS255GVJ7WLLP85JHS8K6DVTJWB4W" +
                                       "4Y8ZEFF7KP6W74PAA8FVPZVDW4RKGMQ8V56Q6R4V34XFE5HR4FZS8GZ6R" +
                                       "36RKW6WN34S2AHR9LCGF8LULB7ZN6NC2AA5RPDZYGWSPPME6267CGLZCP" +
                                       "GG98W557RXCDWAETJHDCRPUXX7AD3E8SL9WMGBV9QFHMSV9UFV7H9NTX3" +
                                       "QYV95CN9P9DSYQWL35R2BWB4GKW6CTWVB2X6WH3P2WFBE6X55KBLAMDB3" +
                                       "SRDSDVY37GKH78MUHY7KDJDC8SJU5FUQRYZ49ULX3YSZL7E284GFVZSGD" +
                                       "FTTQNR6VMBM3LLR78SUSVMJW88XT2K4UHEATRU3V9MMR2VGNGCY9S6R7M" +
                                       "4ELNPEBBMQP2HVPLY5M5VPA92V7NU8ZZ58YYTW5QK9USZ5LV59UZGB2CF" +
                                       "DPZ6HFYU5WB7UU3UYWVNSNKM3W7GBYKJP8TMFW2YN6GNSSE4ZKFVZRLUT" +
                                       "8QPZBBEQT5H9H5Z53D7QV4AJTKTX4EMW62TDWXQVK24JZPSG2VXKCMYZL" +
                                       "BUASE25R3EEK9KBLJ8VX83ZXGTBL5CCDBY33HJ6FKX8AW3WPRX3XTCS9G" +
                                       "2B9SVK2XFFKNSPGFG6FZNS8P2HERFGFL79DKUZZFWHFH4H9UZ7F7F6W3Z" +
                                       "WN84JRRA7SU8T89EQMRBEPVYMMGLGSUMFWWMEDLJM5EGP5WEX9LDUAQXS" +
                                       "55LKDQVRKX4R8NNBHSYBHSNMFYA2C6KGQQFK3TN267DPSZT3PTKHTLNMU" +
                                       "V2YYZZRX3953LPWAKYF8LJUVMEQT3ZC4F9SWMYGUHG6XX66PJFQWSRUW2" +
                                       "C79YLGZ6ZAFS7HLXBTH55UD3EGFBZQ5CLNJDZTEJACDVBCM5FQBTX4DKK" +
                                       "UDGNSMWWLC5UMQRHW89CTU5636WYDXVZZDAUZ529458LDN2DAR9QADWRZ" +
                                       "UTU8MCKN8ACH3R36YKE52DDF67SM5UDUH7PTATHXE65UCGFRCV49UTF29" +
                                       "BGDSUWGRMC839HUZYQVAG985YUF5KJCAVGKRD8E4YMPJ38KR6HD2KHDGY" +
                                       "PJDMJMN4Y3DTJW5MYX3VUPF32637LMAWFM4QCU7BMP74SCF4N5QXZZVBE" +
                                       "LAQMPYMJC2ZWJ9XFV33YXTTPH3SG9KMUABLL83P7L3UBVM763XJPR5UEH" +
                                       "DZ73XJUGR9QP6299K5PU46XGVWKWFAKWYMRXUSLCFJ3WQTEC6QJH6E5V8" +
                                       "X2RMA5TXGSBEWLGSMNQ2SH6G9MLKK4S486DN4M4QVDTYTM4JQETAJQGP7" +
                                       "6NUR4UNDXR4W4JQSNWDTUGX69SEDC3AL8ZF4TJBQQRXSX2A86UUWCDCFH" +
                                       "JE94A8EP3Q6A2QTYKEE62MV4VJB2AB";
                        break;
                    }
                case Enigma_KeyGen_IDE.RM_4096:
                    {
                        kv.PublicKey = "0201B810DA4A1ADD4351378790A98138533334BN75EUD4LFWYFVNFGBRCEMKKXG62QRBXL8GMHQ975B68FJVEMNXQQ7" +
                                       "RKR7RCZMWDVP86QPB3LR49G9BM7EUUZXNCRZBXRF4PEY3RX6UXT4X286K" +
                                       "WMR7AMEE6QNP9AEHGWJT9AVU3F62F37B5GVX2BQF73QWHRFQSQ6XMRP6M" +
                                       "ZDRQ8JT89UF3YRK5UL34MM3L8HLDTWAJF5YY7MRWJUFDQRK9JNCJ6C9KJ" +
                                       "WRE5ACQSNS24NEAHDYKS3AK75HBCTKP9NR2CSL7Q9PPXM4TF7L37USP77" +
                                       "Z7WER6JY67F7YGKTP6MFRMKK9H8XFPZ9XWKK97XCFXK7AW4TB96WGEH4B" +
                                       "YPF9QRF2DGC3LCHW8VTD2EMHVRDR6EEBUG8R4XYKJPLBPRCJP445DU2BW" +
                                       "JWELKAY45GKDU5HLTTDTWRH2JFKJ7AVAKLPEELN29YHX5JR773P9ERW7N" +
                                       "UFMWDKD4UL4YPU5QW2L4A7ZN3E8ZDQVEZUR6ZRDQXRLQRLUNHVB4XGBWD" +
                                       "HM79NGJARHDBQJCD8NWZCWPBY26QARP7A5S48DCV29F7MUTHU3YAHYVS7" +
                                       "ZPGXJZZA5HBBY4K5BQPUG6MVCBG8H3C7VL8KH9EH58NUVCE6F2CGMSM94" +
                                       "4CQDKNVGWWWRNK4DG26UT88Y9ULUPJ25G9KLTQPK3TBXZEK43X8KPMJT8" +
                                       "DF6MTQ5RB94XR2BT9H9NYYTXL29GF8KZY9QNHAW4LTT2RDQTD2ELWPSV4" +
                                       "4AND9K8G5VKLQ287UBEVHA82CMSMGQQBMNQZVAZ9G8T5TD6G9F7XQHMJT" +
                                       "HCL6PFEDUW5MN9JASF2EKPT2H33325A3SFGGM5C3RYKZSYSSQC5FLHNX9" +
                                       "VHN4HQVWD66YECY4R97JZHQALRTCHXUWH85LSJCCTQZT8JF52FHG6FV9J" +
                                       "UJWEU24K9Z7SKYTYA9NH7GW29FSNKUK3DMFXY48VEYZVDRTTMLFYSJH8B" +
                                       "RQXV72REYGSM6SLX89EVQ52CN9N8YDLWHAWCDDNM89YN2FCRTLE8688XN" +
                                       "F4MZMFE6GP9JK2JTFJVUKBLES2ZVWSBCJE9N3D7DG9LL9Z3U42QFJJPE2" +
                                       "HE5XCRY25UND96R9D7655ZBSCPF796FJZ4GPLY7AMZLGLR77GRP467ELK" +
                                       "PXSZ9ZF8MUYFDHV4EFACPZ79CDFTYW56NE9JDWDVUMNLY9EXDSF8ZNABE" +
                                       "MDQU6T9RVLTNRMZJJ8EJSUM9TV8YA6MNWF2Y66MD3VQ9L662F5X6VE9ZC" +
                                       "PPRTNMEV2DG9BUMFMSL7PUR9H5QG6VVBDBMEU3PLABL57HMSQ5C83E9X8" +
                                       "RTPY4QSEH2H7R2QDJHT5LQSFNQJL2NZ24GLNTFXG468WC5UUTDD68G8HM" +
                                       "477Z8P4F9ZZHUGZ6VPFF32A2MPWY8LPXNECCKM9EEVLDDPUJ8LXN2AE6K" +
                                       "Y2Q42FVBCJM9GQTXNRHBED735KCFD4YGV4U5U3LJD6NJ886W6XQLWH3G7" +
                                       "3VZ6T5YDUQP6DA5ZHLKQSGATDJHUWC2ELTE7QJFXH8H9EAQYZPPMW76JG" +
                                       "Z48UBND9VXFXZMSGBNWQPNQG7E4TCBDMVKUSA9TTVSNLN3DXEZNXH787R" +
                                       "N7XHFBJNZ5W74DUMNBYVHEQDYMZBQCFMS8LGSDUAU6QE9DD5Q334BX62T" +
                                       "JP5WQQDS2ZEWW76XW7VMLX3L7V9UVD7RL297VDBVRFPQ5MYA3YFVBVNVA" +
                                       "R5TJXMQ4X2U2PW6UWSKBXT58HG3QPZM2RVEX2PDMCVJDFTJMXR9NPLW4C" +
                                       "6AE4Q9A8TTAQ68BSN9WWTFFTSX68ECVARFPDBBH5DMP4KYFARTFVCSWNF" +
                                       "FGAPBYYGFJA4MGHEDWTNE54MPGER7EPCZEV2ESJRMM6XDMFGABG97HECN" +
                                       "3SZFUBRKCNDZ2TE9F6EERULRCDAV5EMY6KVY9NY9MYNPP2FQ5WFWLMRYD" +
                                       "4TNYYHE6EDMQ6KK79HH5Q5KBW6DDQYYNUR365W2454CHEZWZAPU82SX4H" +
                                       "KHNZXBRVWAT7G9CJBKHNBPSVEL67X8UJHBFHZH8ZD4NSEVFZM4Y768TJ6" +
                                       "QP3BGEKLTY4UZUWHG63QMKVWAQW9E7WRFNJCH4XRD97JHNKMFUTRFVH68" +
                                       "G5CKSMGC725AZ9CBSL2JX43P4EY44CMF56AJ6BEXVCJP2ZDWCT9G55K4D" +
                                       "F24J7TTJMFXTQH95CBNX67CBPNWEKHCWQV6VD73Y9KCZHNBFUFS8TCYNN" +
                                       "WXRGFKNVRDFUKWHDWDDTSPEW8YCKLPMX2GUV3N4JFJMUE6TSJR6Z53C9F" +
                                       "SKZAY3EN7G66JPBF5E9S6Y7RQHPWZHSRDQ7XH87PHUJFLJFGD7WNE3Q9P" +
                                       "EXMW33LVJBFEUXKNUB6SU7ZYCEX96XT8G27FLUV7XPV4JK64DWDJCX9WV" +
                                       "4VL8CK23FQJ28UG9JUZTQJ3DRL32BTJVRD4LVQ6MK9LCE7ZZP925JK7ZD" +
                                       "92SCV4DDJJ5EXMVBF";
                        break;
                    }
            }

            kv.Key = tbKey.Text;
            kv.KeyLen = tbKey.Text.Length;

            kv.RegInfo = tbUserInfo.Text;

            // Hardware ID
            kv.UseHardwareLocking = cbHardware.Checked;
            if (kv.UseHardwareLocking)
            {
                kv.HardwareID = tbHardware.Text;
            }

            // Secure constant (get it from project file)!
            kv.EncryptedConstant = 2113444489;

            // Generate reg. key
            uint dwResult = Enigma_KeyGen_IDE.KG_VerifyRegistrationInfoW(ref kv);

            string sout = string.Empty;
            if (dwResult == Enigma_KeyGen_IDE.EP_NO_ERROR)
            {
                //
                sout = "Valid key!\n";
                sout = string.Format(sout + "Creation Date: {0}/{1}/{2}\n", kv.CreationDay, kv.CreationMonth, kv.CreationYear);
                if (kv.UseKeyExpiration)
                {
                    sout += string.Format("Expiration Date: {0}/{1}/{2}\n", kv.ExpirationDay, kv.ExpirationMonth, kv.ExpirationYear);
                }
                if (kv.UseRegisterAfter)
                {
                    sout += string.Format("Register After: {0}/{1}/{2}\n", kv.RegisterAfterDay, kv.RegisterAfterMonth, kv.RegisterAfterYear);
                }
                if (kv.UseRegisterBefore)
                {
                    sout += string.Format("Register Before: {0}/{1}/{2}\n", kv.RegisterBeforeDay, kv.RegisterBeforeMonth, kv.RegisterBeforeYear);
                }
                if (kv.UseCountyLimit)
                {
                    Enigma_KeyGen_IDE ide = new Enigma_KeyGen_IDE();
                    foreach (Enigma_KeyGen_IDE.TKeyCountries country in ide.KEY_COUNTRIES)
                    {
                        if (country.Code == kv.CountryCode)
                        {
                            sout += string.Format("Country Lock: {0}\n", country.Name);
                            break;
                        }
                    }
                }
                if (kv.UseExecutionsLimit)
                {
                    sout += string.Format("Executions: {0}\n", kv.ExecutionsCount);
                }
                if (kv.UseDaysLimit)
                {
                    sout += string.Format("Days: {0}\n", kv.DaysCount);
                }
                if (kv.UseRunTimeLimit)
                {
                    sout += string.Format("Runtime: {0}\n", kv.RunTimeMinutes);
                }
                if (kv.UseGlobalTimeLimit)
                {
                    sout += string.Format("Global Time: {0}\n", kv.GlobalTimeMinutes);
                }
                for (int i = 0; i < Enigma_KeyGen_IDE.NUMBER_OF_CRYPTED_SECTIONS; i++)
                {
                    if (Convert.ToBoolean(kv.EncryptedSections[i]))
                    {
                        sout += string.Format("Unlock section: #{0}\n", i + 1);
                    }
                }
            }
            else
            {
                switch (dwResult)
                {
                    case Enigma_KeyGen_IDE.EP_ERROR_UNKNOWN:
                        sout = "EP_ERROR_UNKNOWN";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_KEYBUFFEREMPTY:
                        sout = "EP_ERROR_KEYBUFFEREMPTY";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_KEYBUFFERISLESS:
                        sout = "EP_ERROR_KEYBUFFERISLESS";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_REGINFOEMPTY:
                        sout = "EP_ERROR_REGINFOEMPTY";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_REGINFOTOOLARGE:
                        sout = "EP_ERROR_REGINFOTOOLARGE";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_PRIVATEKEYISNOTSET:
                        sout = "EP_ERROR_PRIVATEKEYISNOTSET";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_PUBLICKEYISNOTSET:
                        sout = "EP_ERROR_PUBLICKEYISNOTSET";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_PRIVATEKEYISINVALID:
                        sout = "EP_ERROR_PRIVATEKEYISINVALID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_PUBLICKEYISINVALID:
                        sout = "EP_ERROR_PUBLICKEYISINVALID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_KEYMODEISINVALID:
                        sout = "EP_ERROR_KEYMODEISINVALID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_KEYBASEISINVALID:
                        sout = "EP_ERROR_KEYBASEISINVALID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_CURRENTDATEISINVALID:
                        sout = "EP_ERROR_CURRENTDATEISINVALID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_EXPIRATIONDATEISINVALID:
                        sout = "EP_ERROR_EXPIRATIONDATEISINVALID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_KEYISINVALID:
                        sout = "EP_ERROR_KEYISINVALID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_HARDWAREID:
                        sout = "EP_ERROR_HARDWAREID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_HARDWAREBUFFEREMPTY:
                        sout = "EP_ERROR_HARDWAREBUFFEREMPTY";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_HARDWAREIDINVALIDFORKEY:
                        sout = "EP_ERROR_HARDWAREIDINVALIDFORKEY";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_PROJECTFILENOTFOUND:
                        sout = "EP_ERROR_PROJECTFILENOTFOUND";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_INVALIDPROJECTFILE:
                        sout = "EP_ERROR_INVALIDPROJECTFILE";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_EXECUTIONSNUMBERINVALID:
                        tbKey.Text = "EP_ERROR_EXECUTIONSNUMBERINVALID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_DAYSNUMBERINVALID:
                        tbKey.Text = "EP_ERROR_DAYSNUMBERINVALID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_COUNTRYCODEINVALID:
                        tbKey.Text = "EP_ERROR_COUNTRYCODEINVALID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_RUNTIMEINVALID:
                        tbKey.Text = "EP_ERROR_RUNTIMEINVALID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_GLOBALTIMEINVALID:
                        tbKey.Text = "EP_ERROR_GLOBALTIMEINVALID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_INSTALLBEFOREINVALID:
                        tbKey.Text = "EP_ERROR_INSTALLBEFOREINVALID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_INSTALLAFTERINVALID:
                        tbKey.Text = "EP_ERROR_INSTALLAFTERINVALID";
                        break;
                    default:
                        sout = "Unknown error";
                        break;
                }
            }
            MessageBox.Show(sout);
        }

See function examples in the installation folder, Examples\KeygeUnicode subfolder.


Function KG_VerifyRegistrationInfoFromProjectW

KG_VerifyRegistrationInfoFromProjectW is used for verifying the registration information and extracting registration key parameters from unicode-based registration information. The function has two parameters, one of them is a pointer to the TKeyVerifyParamsW structure, the other one is unicode - null terminated string - the path to the Enigma Protector project file. The function reads secure information from the project file, so it does not require secure parameters PublicKey, KeyMode, KeyBase and EncryptedConstant in the TKeyVerifyParamsW structure.

Return Values

EP_NO_ERROR=0 | the function succeeds, TKeyVerifyParamsW structure contains registration key parameters;
EP_ERROR_UNKNOWN=1 | unknown error
EP_ERROR_KEYBUFFEREMPTY=2 | memory buffer for registration key is not allocated
EP_ERROR_KEYBUFFERISLESS=3 | size of allocated memory for registration key is less than required
EP_ERROR_REGINFOEMPTY=4 | registration information is not specified
EP_ERROR_REGINFOTOOLARGE=5 | registration information is empty (has a null size)
EP_ERROR_PRIVATEKEYISNOTSET=6 | private key is not set
EP_ERROR_PUBLICKEYISNOTSET=7 | public key is not set
EP_ERROR_PRIVATEKEYISINVALID=8 | private key is invalid
EP_ERROR_PUBLICKEYISINVALID=9 | public key is invalid
EP_ERROR_KEYMODEISINVALID=10 | key mode is invalid
EP_ERROR_KEYBASEISINVALID=11 | key base is invalid
EP_ERROR_CURRENTDATEISINVALID=12 | current date is invalid
EP_ERROR_EXPIRATIONDATEISINVALID=13 | expiration date is invalid
EP_ERROR_KEYISINVALID=14 | key is invalid
EP_ERROR_HARDWAREID=15 | hardware id is invalid
EP_ERROR_HARDWAREBUFFEREMPTY=16 | hardware id buffer is empty
EP_ERROR_HARDWAREIDINVALIDFORKEY=17 | hardware id is invalid for the key
EP_ERROR_PROJECTFILENOTFOUND=18 | project file is not found
EP_ERROR_INVALIDPROJECTFILE=19 | project file is invalid
EP_ERROR_EXECUTIONSNUMBERINVALID=20 | executions number is invalid
EP_ERROR_DAYSNUMBERINVALID=21 | days number is invalid
EP_ERROR_COUNTRYCODEINVALID=22 | country code is invalid
EP_ERROR_RUNTIMEINVALID=23 | run-time value is invalid
EP_ERROR_GLOBALTIMEINVALID=24 | global time is invalid
EP_ERROR_INSTALLBEFOREINVALID=25 | register before date is invalid
EP_ERROR_INSTALLAFTERINVALID=26 | register after date is invalid

Definition

Show/Hide Delphi function definition

function KG_VerifyRegistrationInfoFromProjectW(ProjectFile : PWideChar; kv : PKeyVerifyParamsW) : dword; external 'keygen.dll' name 'KG_VerifyRegistrationInfoFromProjectW';

Show/Hide C++ function definition

 extern  "C" __declspec( dllimport ) __stdcall int KG_VerifyRegistrationInfoFromProjectW(wchar_t* pfile, PKeyVerifyParamsW kv);

Show/Hide C# (.NET) function definition

public class Enigma_KeyGen_IDE
{
    [DllImport("keygen.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.StdCall)]
    public static extern uint KG_VerifyRegistrationInfoFromProjectW(string FileName, ref TKeyVerifyParamsW kv);
}

Examples

Show/Hide Delphi function example

procedure TfrmMain.btnVerifyPClick(Sender: TObject);
var
  kv : TKeyVerifyParamsW;
  i : integer;
  dwResult : dword;
  stemp : string;
  sresult : string;
begin
  if eUserInfo.Text = '' then
  begin
    ShowMessage('User info field is empty!');
    Exit;
  end;
  if mKey.Text = '' then
  begin
    ShowMessage('Key field is empty!');
    Exit;
  end;

  kv.RegInfo := PWideChar(eUserInfo.Text);
  kv.Key := PWideChar(mKey.Text);
  kv.KeyLen := length(mKey.Text);
  // Hardware ID
  kv.UseHardwareLocking := cbHardwareID.Checked;
  if kv.UseHardwareLocking then
  begin
    kv.HardwareID := PWideChar(eHardware.Text);
  end;

  dwResult := KG_VerifyRegistrationInfoFromProjectW('default.enigma', @kv);

  if dwResult = EP_NO_ERROR then
  begin
    sresult := 'Key is valid!'#13#10;
    sresult := format(sresult + 'Creation Date: %s'#13#10, [DateToStr(EncodeDate(kv.CreationYear, kv.CreationMonth, kv.CreationDay))]);
    if kv.UseKeyExpiration then
    begin
      sresult := format(sresult + 'Expiration Date: %s'#13#10, [DateToStr(EncodeDate(kv.ExpirationYear, kv.ExpirationMonth, kv.ExpirationDay))]);
    end;
    if kv.UseRegisterAfter then
    begin
      sresult := format(sresult + 'Register After Date: %s'#13#10, [DateToStr(EncodeDate(kv.RegisterAfterYear, kv.RegisterAfterMonth, kv.RegisterAfterDay))]);
    end;
    if kv.UseRegisterBefore then
    begin
      sresult := format(sresult + 'Register Before Date: %s'#13#10, [DateToStr(EncodeDate(kv.RegisterBeforeYear, kv.RegisterBeforeMonth, kv.RegisterBeforeDay))]);
    end;
    if kv.UseCountyLimit then
    begin
      for i := 0 to length(KEY_COUNTRIES) - 1 do
      begin
        if kv.CountryCode = KEY_COUNTRIES[i].Code then
        begin
          stemp := KEY_COUNTRIES[i].Name;
          break;
        end;
      end;
      sresult := format(sresult + 'Locked to country: %s'#13#10, [stemp]);
    end;
    if kv.UseExecutionsLimit then
    begin
      sresult := format(sresult + 'Executions limit: %d executions'#13#10, [kv.ExecutionsCount]);
    end;
    if kv.UseDaysLimit then
    begin
      sresult := format(sresult + 'Days limit: %d days'#13#10, [kv.DaysCount]);
    end;
    if kv.UseRunTimeLimit then
    begin
      sresult := format(sresult + 'Run-time limit: %d minutes'#13#10, [kv.RunTimeMinutes]);
    end;
    if kv.UseGlobalTimeLimit then
    begin
      sresult := format(sresult + 'Global Time limit: %d minutes'#13#10, [kv.GlobalTimeMinutes]);
    end;
    for i := 1 to NUMBER_OF_CRYPTED_SECTIONS do
    begin
      if kv.EncryptedSections[i] then
      begin
        sresult := format(sresult + 'Unlocked section #%d'#13#10, [i]);
      end;
    end;
  end else
  begin
    case dwResult of
      EP_ERROR_UNKNOWN                 : sresult := 'EP_ERROR_UNKNOWN                ';
      EP_ERROR_KEYBUFFEREMPTY          : sresult := 'EP_ERROR_KEYBUFFEREMPTY         ';
      EP_ERROR_KEYBUFFERISLESS         : sresult := 'EP_ERROR_KEYBUFFERISLESS        ';
      EP_ERROR_REGINFOEMPTY            : sresult := 'EP_ERROR_REGINFOEMPTY           ';
      EP_ERROR_REGINFOTOOLARGE         : sresult := 'EP_ERROR_REGINFOTOOLARGE        ';
      EP_ERROR_PRIVATEKEYISNOTSET      : sresult := 'EP_ERROR_PRIVATEKEYISNOTSET     ';
      EP_ERROR_PUBLICKEYISNOTSET       : sresult := 'EP_ERROR_PUBLICKEYISNOTSET      ';
      EP_ERROR_PRIVATEKEYISINVALID     : sresult := 'EP_ERROR_PRIVATEKEYISINVALID    ';
      EP_ERROR_PUBLICKEYISINVALID      : sresult := 'EP_ERROR_PUBLICKEYISINVALID     ';
      EP_ERROR_KEYMODEISINVALID        : sresult := 'EP_ERROR_KEYMODEISINVALID       ';
      EP_ERROR_KEYBASEISINVALID        : sresult := 'EP_ERROR_KEYBASEISINVALID       ';
      EP_ERROR_CURRENTDATEISINVALID    : sresult := 'EP_ERROR_CURRENTDATEISINVALID   ';
      EP_ERROR_EXPIRATIONDATEISINVALID : sresult := 'EP_ERROR_EXPIRATIONDATEISINVALID';
      EP_ERROR_KEYISINVALID            : sresult := 'EP_ERROR_KEYISINVALID           ';
      EP_ERROR_HARDWAREID              : sresult := 'EP_ERROR_HARDWAREID             ';
      EP_ERROR_HARDWAREBUFFEREMPTY     : sresult := 'EP_ERROR_HARDWAREBUFFEREMPTY    ';
      EP_ERROR_HARDWAREIDINVALIDFORKEY : sresult := 'EP_ERROR_HARDWAREIDINVALIDFORKEY';
      EP_ERROR_PROJECTFILENOTFOUND     : sresult := 'EP_ERROR_PROJECTFILENOTFOUND    ';
      EP_ERROR_INVALIDPROJECTFILE      : sresult := 'EP_ERROR_INVALIDPROJECTFILE     ';
      EP_ERROR_EXECUTIONSNUMBERINVALID : sresult := 'EP_ERROR_EXECUTIONSNUMBERINVALID';
      EP_ERROR_DAYSNUMBERINVALID       : sresult := 'EP_ERROR_DAYSNUMBERINVALID      ';
      EP_ERROR_COUNTRYCODEINVALID      : sresult := 'EP_ERROR_COUNTRYCODEINVALID     ';
      EP_ERROR_RUNTIMEINVALID          : sresult := 'EP_ERROR_RUNTIMEINVALID         ';
      EP_ERROR_GLOBALTIMEINVALID       : sresult := 'EP_ERROR_GLOBALTIMEINVALID      ';
      EP_ERROR_INSTALLBEFOREINVALID    : sresult := 'EP_ERROR_INSTALLBEFOREINVALID   ';
      EP_ERROR_INSTALLAFTERINVALID     : sresult := 'EP_ERROR_INSTALLAFTERINVALID    ';
      else sresult := 'Unknown error';
    end;
  end;
  ShowMessage(sresult);
end;

Show/Hide Visual C++ function example

void CKeygenDlg::OnBnClickedButtonverfp()
{
    // TODO: Add your control notification handler code here
  TKeyVerifyParamsW kv;
  wchar_t keybuffer[2048];
  wchar_t username[255];
  wchar_t hardwareid[255];
  DWORD dwResult;

  // Clear params buffer
  memset(&kv, 0, sizeof(kv));
  // Clear key buffer
  memset(&keybuffer, 0, sizeof(keybuffer));
  GetDlgItemTextW(IDC_EDITKEY, (wchar_t*)&keybuffer, sizeof(keybuffer));
  kv.Key = (wchar_t*) keybuffer;
  kv.KeyLen = wcslen(kv.Key);

  // Fill User Info
  memset(&username, 0, sizeof(username));
  GetDlgItemTextW(IDC_EDITNAME, (wchar_t*)&username, sizeof(username));
  kv.RegInfo = (wchar_t*)&username;

  // Hardware ID
  if (IsDlgButtonChecked(IDC_CHECKHD) != 0)
  {
      kv.UseHardwareLocking = true;
      memset(&hardwareid, 0, sizeof(hardwareid));
      GetDlgItemTextW(IDC_EDITHD, (wchar_t*)&hardwareid, sizeof(hardwareid));
      kv.HardwareID = (wchar_t*)&hardwareid;
  }

  // Generate reg. key
  dwResult = KG_VerifyRegistrationInfoFromProjectW(L"default.enigma", &kv);

  if (dwResult == EP_NO_ERROR)
  {
      wchar_t tmp[255];
      // Creation date
      wchar_t mes[2048] = L"Valid Registration Key!\n";
      wsprintf(tmp, L"Creation date: %d/%d/%d\n", kv.CreationDay, kv.CreationMonth, kv.CreationYear);
      wcscat(mes, tmp);
      // Expiration date
      if (kv.UseKeyExpiration)
      {
          wsprintf(tmp, L"Expiration date: %d/%d/%d\n", kv.ExpirationDay, kv.ExpirationMonth, kv.ExpirationYear);
          wcscat(mes, tmp);
      }
      // Register After date
      if (kv.UseRegisterAfter)
      {
          wsprintf(tmp, L"Register After date: %d/%d/%d\n", kv.RegisterAfterDay, kv.RegisterAfterMonth, kv.RegisterAfterYear);
          wcscat(mes, tmp);
      }
      // Register Before date
      if (kv.UseRegisterBefore)
      {
          wsprintf(tmp, L"Register Before date: %d/%d/%d\n", kv.RegisterBeforeDay, kv.RegisterBeforeMonth, kv.RegisterBeforeYear);
          wcscat(mes, tmp);
      }
      // Executions
      if (kv.UseExecutionsLimit)
      {
          wsprintf(tmp, L"Executions: %d\n", kv.ExecutionsCount);
          wcscat(mes, tmp);
      }
      // Days
      if (kv.UseDaysLimit)
      {
          wsprintf(tmp, L"Days: %d\n", kv.DaysCount);
          wcscat(mes, tmp);
      }
      // Run-time
      if (kv.UseRunTimeLimit)
      {
          wsprintf(tmp, L"Run-time: %d minutes\n", kv.RunTimeMinutes);
          wcscat(mes, tmp);
      }
      // Global Time
      if (kv.UseGlobalTimeLimit)
      {
          wsprintf(tmp, L"Global Time: %d minutes\n", kv.GlobalTimeMinutes);
          wcscat(mes, tmp);
      }
      // Country
      if (kv.UseCountyLimit)
      {
          for (int i = 0; i < ARRAYSIZE(KEY_COUNTRIES); i++)
          {
              if (kv.CountryCode == KEY_COUNTRIES[i].Code)
              {
                  wchar_t wcn[255];
                  char* acn = KEY_COUNTRIES[i].Name;
                  int aln = strlen(acn) + 1;
                  MultiByteToWideChar(CP_ACP, 0, acn, aln, (LPWSTR)&wcn, aln);
                  wsprintf(tmp, L"Country Lock: %s\n", &wcn);
                  wcscat(mes, tmp);
                  break;
              }
          }
      }
      for (int i = 0; i < NUMBER_OF_CRYPTED_SECTIONS; i++)
      {
          if (kv.EncryptedSections[i])
          {
              wsprintf(tmp, L"Unlocked section: #%d\n", i + 1);
              wcscat(mes, tmp);
          }
      }
      MessageBox(mes);
  } else
  {
    wchar_t* sError;
    switch (dwResult)
    {
      case EP_ERROR_UNKNOWN:
        sError = L"EP_ERROR_UNKNOWN";
        break;
      case EP_ERROR_KEYBUFFEREMPTY:
        sError = L"EP_ERROR_KEYBUFFEREMPTY";
        break;
      case EP_ERROR_KEYBUFFERISLESS:
        sError = L"EP_ERROR_KEYBUFFERISLESS";
        break;
      case EP_ERROR_REGINFOEMPTY:
        sError = L"EP_ERROR_REGINFOEMPTY";
        break;
      case EP_ERROR_REGINFOTOOLARGE:
        sError = L"EP_ERROR_REGINFOTOOLARGE";
        break;
      case EP_ERROR_PRIVATEKEYISNOTSET:
        sError = L"EP_ERROR_PRIVATEKEYISNOTSET";
        break;
      case EP_ERROR_PUBLICKEYISNOTSET:
        sError = L"EP_ERROR_PUBLICKEYISNOTSET";
        break;
      case EP_ERROR_PRIVATEKEYISINVALID:
        sError = L"EP_ERROR_PRIVATEKEYISINVALID";
        break;
      case EP_ERROR_PUBLICKEYISINVALID:
        sError = L"EP_ERROR_PUBLICKEYISINVALID";
        break;
      case EP_ERROR_KEYMODEISINVALID:
        sError = L"EP_ERROR_KEYMODEISINVALID";
        break;
      case EP_ERROR_KEYBASEISINVALID:
        sError = L"EP_ERROR_KEYBASEISINVALID";
        break;
      case EP_ERROR_CURRENTDATEISINVALID:
        sError = L"EP_ERROR_CURRENTDATEISINVALID";
        break;
      case EP_ERROR_EXPIRATIONDATEISINVALID:
        sError = L"EP_ERROR_EXPIRATIONDATEISINVALID";
        break;
      case EP_ERROR_KEYISINVALID:
        sError = L"EP_ERROR_KEYISINVALID";
        break;
      case EP_ERROR_HARDWAREID:
        sError = L"EP_ERROR_HARDWAREID";
        break;
      case EP_ERROR_HARDWAREBUFFEREMPTY:
        sError = L"EP_ERROR_HARDWAREBUFFEREMPTY";
        break;
      case EP_ERROR_HARDWAREIDINVALIDFORKEY:
        sError = L"EP_ERROR_HARDWAREIDINVALIDFORKEY";
        break;
      case EP_ERROR_PROJECTFILENOTFOUND:
        sError = L"EP_ERROR_PROJECTFILENOTFOUND";
        break;
      case EP_ERROR_INVALIDPROJECTFILE:
        sError = L"EP_ERROR_INVALIDPROJECTFILE";
        break;
      case EP_ERROR_EXECUTIONSNUMBERINVALID:
        sError = L"EP_ERROR_EXECUTIONSNUMBERINVALID";
        break;
      case EP_ERROR_DAYSNUMBERINVALID:
        sError = L"EP_ERROR_DAYSNUMBERINVALID";
        break;
      case EP_ERROR_COUNTRYCODEINVALID:
        sError = L"EP_ERROR_COUNTRYCODEINVALID";
        break;
      case EP_ERROR_RUNTIMEINVALID:
        sError = L"EP_ERROR_RUNTIMEINVALID";
        break;
      case EP_ERROR_GLOBALTIMEINVALID:
        sError = L"EP_ERROR_GLOBALTIMEINVALID";
        break;
      case EP_ERROR_INSTALLBEFOREINVALID:
        sError = L"EP_ERROR_INSTALLBEFOREINVALID";
        break;
      case EP_ERROR_INSTALLAFTERINVALID:
        sError = L"EP_ERROR_INSTALLAFTERINVALID";
        break;
      default:
        sError = L"Unknown error";
        break;
    }
    MessageBox(sError);
  }
}

Show/Hide C# (.NET) function example

        private void btnVerifyFP_Click(object sender, EventArgs e)
        {
            if (tbUserInfo.Text == string.Empty)
            {
                MessageBox.Show("User info field is empty!");
                return;
            }
            if (tbUserInfo.Text == string.Empty)
            {
                MessageBox.Show("Registration key field is empty!");
                return;
            }
            Enigma_KeyGen_IDE.TKeyVerifyParamsW kv = new Enigma_KeyGen_IDE.TKeyVerifyParamsW();

            kv.Key = tbKey.Text;
            kv.KeyLen = tbKey.Text.Length;

            kv.RegInfo = tbUserInfo.Text;

            // Hardware ID
            kv.UseHardwareLocking = cbHardware.Checked;
            if (kv.UseHardwareLocking)
            {
                kv.HardwareID = tbHardware.Text;
            }

            // Generate reg. key
            uint dwResult = Enigma_KeyGen_IDE.KG_VerifyRegistrationInfoFromProjectW("default.enigma", ref kv);

            string sout = string.Empty;
            if (dwResult == Enigma_KeyGen_IDE.EP_NO_ERROR)
            {
                //
                sout = "Valid key!\n";
                sout = string.Format(sout + "Creation Date: {0}/{1}/{2}\n", kv.CreationDay, kv.CreationMonth, kv.CreationYear);
                if (kv.UseKeyExpiration)
                {
                    sout = string.Format(sout + "Expiration Date: {0}/{1}/{2}\n", kv.ExpirationDay, kv.ExpirationMonth, kv.ExpirationYear);
                }
                if (kv.UseRegisterAfter)
                {
                    sout += string.Format("Register After: {0}/{1}/{2}\n", kv.RegisterAfterDay, kv.RegisterAfterMonth, kv.RegisterAfterYear);
                }
                if (kv.UseRegisterBefore)
                {
                    sout += string.Format("Register Before: {0}/{1}/{2}\n", kv.RegisterBeforeDay, kv.RegisterBeforeMonth, kv.RegisterBeforeYear);
                }
                if (kv.UseCountyLimit)
                {
                    Enigma_KeyGen_IDE ide = new Enigma_KeyGen_IDE();
                    foreach (Enigma_KeyGen_IDE.TKeyCountries country in ide.KEY_COUNTRIES)
                    {
                        if (country.Code == kv.CountryCode)
                        {
                            sout += string.Format("Country Lock: {0}\n", country.Name);
                            break;
                        }
                    }
                }
                if (kv.UseExecutionsLimit)
                {
                    sout += string.Format("Executions: {0}\n", kv.ExecutionsCount);
                }
                if (kv.UseDaysLimit)
                {
                    sout += string.Format("Days: {0}\n", kv.DaysCount);
                }
                if (kv.UseRunTimeLimit)
                {
                    sout += string.Format("Runtime: {0}\n", kv.RunTimeMinutes);
                }
                if (kv.UseGlobalTimeLimit)
                {
                    sout += string.Format("Global Time: {0}\n", kv.GlobalTimeMinutes);
                }
                for (int i = 0; i < Enigma_KeyGen_IDE.NUMBER_OF_CRYPTED_SECTIONS; i++)
                {
                    if (Convert.ToBoolean(kv.EncryptedSections[i]))
                    {
                        sout = string.Format(sout + "Unlock section: #{0}\n", i + 1);
                    }
                }
            }
            else
            {
                switch (dwResult)
                {
                    case Enigma_KeyGen_IDE.EP_ERROR_UNKNOWN:
                        sout = "EP_ERROR_UNKNOWN";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_KEYBUFFEREMPTY:
                        sout = "EP_ERROR_KEYBUFFEREMPTY";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_KEYBUFFERISLESS:
                        sout = "EP_ERROR_KEYBUFFERISLESS";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_REGINFOEMPTY:
                        sout = "EP_ERROR_REGINFOEMPTY";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_REGINFOTOOLARGE:
                        sout = "EP_ERROR_REGINFOTOOLARGE";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_PRIVATEKEYISNOTSET:
                        sout = "EP_ERROR_PRIVATEKEYISNOTSET";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_PUBLICKEYISNOTSET:
                        sout = "EP_ERROR_PUBLICKEYISNOTSET";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_PRIVATEKEYISINVALID:
                        sout = "EP_ERROR_PRIVATEKEYISINVALID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_PUBLICKEYISINVALID:
                        sout = "EP_ERROR_PUBLICKEYISINVALID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_KEYMODEISINVALID:
                        sout = "EP_ERROR_KEYMODEISINVALID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_KEYBASEISINVALID:
                        sout = "EP_ERROR_KEYBASEISINVALID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_CURRENTDATEISINVALID:
                        sout = "EP_ERROR_CURRENTDATEISINVALID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_EXPIRATIONDATEISINVALID:
                        sout = "EP_ERROR_EXPIRATIONDATEISINVALID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_KEYISINVALID:
                        sout = "EP_ERROR_KEYISINVALID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_HARDWAREID:
                        sout = "EP_ERROR_HARDWAREID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_HARDWAREBUFFEREMPTY:
                        sout = "EP_ERROR_HARDWAREBUFFEREMPTY";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_HARDWAREIDINVALIDFORKEY:
                        sout = "EP_ERROR_HARDWAREIDINVALIDFORKEY";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_PROJECTFILENOTFOUND:
                        sout = "EP_ERROR_PROJECTFILENOTFOUND";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_INVALIDPROJECTFILE:
                        sout = "EP_ERROR_INVALIDPROJECTFILE";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_EXECUTIONSNUMBERINVALID:
                        tbKey.Text = "EP_ERROR_EXECUTIONSNUMBERINVALID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_DAYSNUMBERINVALID:
                        tbKey.Text = "EP_ERROR_DAYSNUMBERINVALID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_COUNTRYCODEINVALID:
                        tbKey.Text = "EP_ERROR_COUNTRYCODEINVALID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_RUNTIMEINVALID:
                        tbKey.Text = "EP_ERROR_RUNTIMEINVALID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_GLOBALTIMEINVALID:
                        tbKey.Text = "EP_ERROR_GLOBALTIMEINVALID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_INSTALLBEFOREINVALID:
                        tbKey.Text = "EP_ERROR_INSTALLBEFOREINVALID";
                        break;
                    case Enigma_KeyGen_IDE.EP_ERROR_INSTALLAFTERINVALID:
                        tbKey.Text = "EP_ERROR_INSTALLAFTERINVALID";
                        break;
                    default:
                        sout = "Unknown error";
                        break;
                }
            }
            MessageBox.Show(sout);
        }

See function examples in the installation folder, Examples\KeygenUnicode subfolder.


Markers

Markers are special inclusions in the source code of the module that allow adding a wide range of possibilities to increase safety of the protected module. The functionality of an unprotected module will not be affected by markers. To activate markers you need to protect the module before using it.

We recommend to focus on VM markers and basically VM RISC markers as they provides the maximum protection strength.

Please Note:

  • Markers cannot be used in .NET applications (unless it is a .NET application with mixed assembly);
  • Visual Basic 6 applications should be compiled in native mode (not pcode).

The Enigma Protector supports the following kinds of markers:

  • VM markers - allow selecting code that will be emulated after the protection and executed under its own Virtual Processor. This marker is the best choice to protect weak points of the protection/registration routines
  • VM RISC markers - similar to VM markers, but provides the maximum protection strength to the virtualized code
  • Reg_Crypt markers - allow selecting parts of the code that should only be executed in a registered version
  • UnReg_Crypt markers - allow selecting parts of the code that should only be executed in an unregistered version
  • Decrypt_On_Execute markers - allow selecting parts of the code that should only be deciphered when the code needs to be executed
  • Unprotected markers - allow selecting the code that should not be executed in a protected version of a file
  • Check_Protection markers - this markers check the integrity of the protection code, and if it is corrupted, the code inside markers will not be executed
  • Run_Once markers - the selected code in this marker will be run only once while execution, after the first execution the marker will be deleted from memory and will never be executed again


Rules of markers usage

A Marker is a set of bytes placed into the source code and helping Enigma Protector find the code inside markers for processing. A marker consists of two parts: begin marker and end marker. You should remember the following rules of markers usage:

  • The end marker can't be placed before the begin marker, otherwise it will cause an error and all markers will be ignored.
    {WRONG: end marker comes before begin}

// Take enigma_ide.pas from the folder EnigmaSDK\Delphi
uses
  enigma_ide;

EP_Marker('reg_crypt_end1');
MessageBox(0, #10#13'This message appears only if application is registered' +
              #10#13'and section #1 unlocked by registration key' +
              #10#13, 'Application', 0);
EP_Marker('reg_crypt_begin1');

//DEPRECATED
{$I include\reg_crypt_end1.inc}
MessageBox(0, #10#13'This message appears only if application is registered' +
              #10#13'and section #1 unlocked by registration key' +
              #10#13, 'Application', 0);
{$I include\reg_crypt_begin1.inc}

    {RIGHT}
// Take enigma_ide.pas from the folder EnigmaSDK\Delphi
uses
  enigma_ide;

EP_Marker('reg_crypt_begin1');
MessageBox(0, #10#13'This message appears only if application is registered' +
              #10#13'and section #1 unlocked by registration key' +
              #10#13, 'Application', 0);
EP_Marker('reg_crypt_end1');

//DEPRECATED
{$I include\reg_crypt_begin1.inc}
MessageBox(0, #10#13'This message appears only if application is registered' +
              #10#13'and section #1 unlocked by registration key' +
              #10#13, 'Application', 0);
{$I include\reg_crypt_end1.inc}
  • The markers should be placed in pairs, i.e. there should be both begin and end markers. In case you have lost one marker from the pair, all markers will be ignored.
    {WRONG: one marker inside another}
// Take enigma_ide.pas from the folder EnigmaSDK\Delphi
uses
  enigma_ide;

EP_Marker('reg_crypt_begin1');
MessageBox(0, #10#13'This message appears only if application is registered' +
              #10#13'and section #1 unlocked by registration key' +
              #10#13, 'Application', 0);
EP_Marker('vm_risc_begin');
MessageBox(0, #10#13'This message from RISC virtual machine'#10#13, 'Application', 0);
EP_Marker('vm_risc_end');
EP_Marker('reg_crypt_end1');

//DEPRECATED
{$I include\reg_crypt_begin1.inc}
MessageBox(0, #10#13'This message appears only if application is registered' +
              #10#13'and section #1 unlocked by registration key' +
              #10#13, 'Application', 0);
{$I include\vm_risc_begin.inc}
MessageBox(0, #10#13'This message from RISC virtual machine'#10#13, 'Application', 0);
{$I include\vm_risc_end.inc}
{$I include\reg_crypt_end1.inc}

    {RIGHT}
// Take enigma_ide.pas from the folder EnigmaSDK\Delphi
uses
  enigma_ide;

EP_Marker('reg_crypt_begin1');
MessageBox(0, #10#13'This message appears only if application is registered' +
              #10#13'and section #1 unlocked by registration key' +
              #10#13, 'Application', 0);
EP_Marker('reg_crypt_end1');

EP_Marker('vm_risc_begin');
MessageBox(0, #10#13'This message from RISC virtual machineappears only if application is registered', 'Application', 0);
EP_Marker('vm_risc_end');

//DEPRECATED
{$I include\reg_crypt_begin1.inc}
MessageBox(0, #10#13'This message appears only if application is registered' +
              #10#13'and section #1 unlocked by registration key' +
              #10#13, 'Application', 0);
{$I include\reg_crypt_end1.inc}

{$I include\vm_risc_begin.inc}
MessageBox(0, #10#13'This message from RISC virtual machineappears only if application is registered', 'Application', 0);
{$I include\vm_risc_end.inc}
  • Markers should not contain any other kind of markers.
    {WRONG: code arounded by mutiple markers}
// Take enigma_ide.pas from the folder EnigmaSDK\Delphi
uses
  enigma_ide;

EP_Marker('reg_crypt_begin1');
EP_Marker('reg_crypt_begin2');
MessageBox(0, #10#13'This message appears only if application is registered' +
              #10#13'and section #1 unlocked by registration key' +
              #10#13, 'Application', 0);
EP_Marker('reg_crypt_end2');
EP_Marker('reg_crypt_end1');

//DEPRECATED
{$I include\reg_crypt_begin1.inc}
{$I include\reg_crypt_begin2.inc}
MessageBox(0, #10#13'This message appears only if application is registered' +
              #10#13'and section #1 unlocked by registration key' +
              #10#13, 'Application', 0);
{$I include\reg_crypt_end2.inc}
{$I include\reg_crypt_end1.inc}

    {RIGHT}

// Take enigma_ide.pas from the folder EnigmaSDK\Delphi
uses
  enigma_ide;

EP_Marker('reg_crypt_begin1');
MessageBox(0, #10#13'This message appears only if application is registered' +
              #10#13'and section #1 unlocked by registration key' +
              #10#13, 'Application', 0);
EP_Marker('reg_crypt_end1');

// DEPRECATED
{$I include\reg_crypt_begin1.inc}
MessageBox(0, #10#13'This message appears only if application is registered' +
              #10#13'and section #1 unlocked by registration key' +
              #10#13, 'Application', 0);
{$I include\reg_crypt_end1.inc}
  • Markers should separate completed parts of the code:
    {WRONG: one marker inside condition, another one outside}

// Take enigma_ide.pas from the folder EnigmaSDK\Delphi
uses
  enigma_ide;

EP_Marker('reg_crypt_begin1');
if EP_RegLoadKey(pcUserInfo, pcKey) then
begin
  eName.Text := string(pcUserInfo);
  EP_Marker('reg_crypt_end1');
  eKey.Text := string(pcKey);
  ShowMessage('Thanks for registration');
end;

//DEPRECATED
{$I include\reg_crypt_begin1.inc}
if EP_RegLoadKey(pcUserInfo, pcKey) then
begin
  eName.Text := string(pcUserInfo);
  {$I include\reg_crypt_end1.inc}
  eKey.Text := string(pcKey);
  ShowMessage('Thanks for registration');
end;

    {RIGHT}

// Take enigma_ide.pas from the folder EnigmaSDK\Delphi
uses
  enigma_ide;

EP_Marker('reg_crypt_begin1');
if EP_RegLoadKey(pcUserInfo, pcKey) then
begin
  eName.Text := string(pcUserInfo);
  eKey.Text := string(pcKey);
  ShowMessage('Thanks for registration');
end;
EP_Marker('reg_crypt_end1');

//DEPRECATED
{$I include\reg_crypt_begin1.inc}
if EP_RegLoadKey(pcUserInfo, pcKey) then
begin
  eName.Text := string(pcUserInfo);
  eKey.Text := string(pcKey);
  ShowMessage('Thanks for registration');
end;
{$I include\reg_crypt_end1.inc}
  • statements like If-Then-Else, For-To-Do, While-Do, Repeat-Until, Try-Except, Try-Finally etc. should be fully separated:
    {WRONG: marker inside condition, but should around the condition}

// Take enigma_ide.pas from the folder EnigmaSDK\Delphi
uses
  enigma_ide;

if EP_RegLoadKey(pcUserInfo, pcKey) then
begin
  EP_Marker('reg_crypt_begin1');
  eName.Text := string(pcUserInfo);
  eKey.Text := string(pcKey);
  ShowMessage('Thanks for registration');
  EP_Marker('reg_crypt_end1');
end;

//DEPRECATED
if EP_RegLoadKey(pcUserInfo, pcKey) then
begin
  {$I include\reg_crypt_begin1.inc}
  eName.Text := string(pcUserInfo);
  eKey.Text := string(pcKey);
  ShowMessage('Thanks for registration');
  {$I include\reg_crypt_end1.inc}
end;

    {RIGHT}

// Take enigma_ide.pas from the folder EnigmaSDK\Delphi
uses
  enigma_ide;

EP_Marker('reg_crypt_begin1');
if EP_RegLoadKey(pcUserInfo, pcKey) then
begin
  eName.Text := string(pcUserInfo);
  eKey.Text := string(pcKey);
  ShowMessage('Thanks for registration');
end;
EP_Marker('reg_crypt_end1');

//DEPRECATED
{$I include\reg_crypt_begin1.inc}
if EP_RegLoadKey(pcUserInfo, pcKey) then
begin
  eName.Text := string(pcUserInfo);
  eKey.Text := string(pcKey);
  ShowMessage('Thanks for registration');
end;
{$I include\reg_crypt_end1.inc}
  • for C and C++ users: the return; keyword can't be placed inside the marker (except for the VM and VM_RISC markers):
    {WRONG: return inside the marker}

// Take enigma_ide.h from the folder EnigmaSDK\VC
#include "enigma_ide.h"

void CTestDlg::CheckRegistered(BOOL bReg)
{
    CWnd* wnd;
    // Enable/disable unregister button
    wnd = GetDlgItem(IDC_BUTTON_UNREGISTER);
    wnd->EnableWindow(bReg);

    // Enable/disable unregister static
    wnd = GetDlgItem(IDC_BUTTON_REGISTER);
    wnd->EnableWindow(!bReg);
    // Enable/disable user info edit
    wnd = GetDlgItem(IDC_EDIT_USERINFO);
    wnd->EnableWindow(!bReg);
    // Enable/disable key edit
    wnd = GetDlgItem(IDC_EDIT_KEY);
    wnd->EnableWindow(!bReg);

    char* sName = NULL;
    char* sKey = NULL;
    EP_Marker('check_protection_begin');
    if (bReg)
    {
        if (EP_RegLoadKey(&sName, &sKey))
        {
            SetDlgItemText(IDC_EDIT_USERINFO, sName);
            SetDlgItemText(IDC_EDIT_KEY, sKey);
            return;
        }
    }
    EP_Marker('check_protection_end');
}

    {RIGHT}
// Take enigma_ide.h from the folder EnigmaSDK\VC
#include "enigma_ide.h"

void CTestDlg::CheckRegistered(BOOL bReg)
{
    CWnd* wnd;
    // Enable/disable unregister button
    wnd = GetDlgItem(IDC_BUTTON_UNREGISTER);
    wnd->EnableWindow(bReg);

    // Enable/disable unregister static
    wnd = GetDlgItem(IDC_BUTTON_REGISTER);
    wnd->EnableWindow(!bReg);
    // Enable/disable user info edit
    wnd = GetDlgItem(IDC_EDIT_USERINFO);
    wnd->EnableWindow(!bReg);
    // Enable/disable key edit
    wnd = GetDlgItem(IDC_EDIT_KEY);
    wnd->EnableWindow(!bReg);

    char* sName = NULL;
    char* sKey = NULL;

    EP_Marker('check_protection_begin');
    if (bReg)
    {
        if (EP_RegLoadKey(&sName, &sKey))
        {
            SetDlgItemText(IDC_EDIT_USERINFO, sName);
            SetDlgItemText(IDC_EDIT_KEY, sKey);
        }
    }
    EP_Marker('check_protection_end);
    return;
}
  • Free Pascal users should enable Intel Assembler Style in Compiler Options.
  • For 64 bit applications the markers are being inserted using EP_Marker function (some x64 compilers do not support inline assembler, which is used to place markers for x86 applications)
    // Take enigma_ide.pas from the folder EnigmaSDK\Delphi
uses
  enigma_ide;

EP_Marker('vm_risc_begin');
if EP_RegLoadKey(pcUserInfo, pcKey) then
begin
  eName.Text := string(pcUserInfo);
  eKey.Text := string(pcKey);
  ShowMessage('Thanks for registration');
end;
EP_Marker('vm_risc_end');

//DEPRECATED
{$I include\vm_risc_begin.inc}
if EP_RegLoadKey(pcUserInfo, pcKey) then
begin
  eName.Text := string(pcUserInfo);
  eKey.Text := string(pcKey);
  ShowMessage('Thanks for registration');
end;
{$I include\vm_risc_end.inc}
  • C and C++ compilers often use code optimization, due to this some markers can be placed to the code chaotically, thus markers are being rejected by protection (the warning message will be shown in the protection log). If the problem exists, the optimization should be disabled for the code inside markers, including markers. See more about optimization https://msdn.microsoft.com/en-us/library/chh3fb0k.aspx
    // Take enigma_ide.h from the folder EnigmaSDK\VC
#include "enigma_ide.h"

void Test()
{
    char* sName = NULL;
    char* sKey = NULL;
// Disable optimization
#pragma optimize( "", off )
    EP_Marker('check_protection_begin');
    if (bReg)
    {
        if (EP_RegLoadKey(&sName, &sKey))
        {
            SetDlgItemText(IDC_EDIT_USERINFO, sName);
            SetDlgItemText(IDC_EDIT_KEY, sKey);
        }
    }
    EP_Marker('check_protection_end');
// Enable optimization
#pragma optimize( "", on )
    return;
}


Markers VM

VM marker allows selecting parts of the code that will be analysed, virtualized and emulated. Virtualization means that the selected code will be translated into the PCODE (special programming language, which can only be read by Enigma) and executed under a Virtual Processor, and the application will require it. This cutting-edge technique allows protecting the weak points of your application that could be easily patched or analysed by crackers. Virtualized code is almost impossible to analyse for crackers, which makes the protection of your application much stronger. The Enigma Protector implements two types of Virtual Machines, see this to find out more about them. We recommended using as many of these markers as possible. Just note that the virtualized code will be executed more slowly than the original one, it is not recommended to virtualize extensively used parts of the code.

Classic Virtual Machine

Show/Hide Delphi marker content

uses
  enigma_ide;

procedure Test;
begin
  EP_Marker('vm_begin');
  // Put here code for protection

  EP_Marker('vm_end');
end;

// DEPRECATED
vm_begin.inc
asm
  DB $EB, $08, $56, $4D, $42, $45, $47, $49, $4E, $00
end;

vm_end.inc
asm
  DB $EB, $08, $56, $4D, $45, $4E, $44, $00, $00, $00
end;;

Show/Hide C++ marker content

// Take enigma_ide.h from the folder EnigmaSDK\VC
#include "enigma_ide.h"

#pragma optimize("", off)
void test()
{
    EP_Marker("vm_begin");

    // Put here code for protection

    EP_Marker("vm_end");
}
#pragma optimize("", on)

// DEPRECATED
vm_begin.inc
__asm
  {
    DB 0xEB, 0x08, 0x56, 0x4D, 0x42, 0x45, 0x47, 0x49, 0x4E, 0x00
  }

vm_end.inc
__asm
  {
    DB 0xEB, 0x08, 0x56, 0x4D, 0x45, 0x4E, 0x44, 0x00, 0x00, 0x00
  }

Show/Hide C++ x64 marker content

// Take enigma_ide.h from the folder EnigmaSDK\VC
#include "enigma_ide.h"

#pragma optimize("", off)
void test()
{
    EP_Marker("vm_begin");

    // Put here code for protection

    EP_Marker("vm_end");
}
#pragma optimize("", on)

Show/Hide Visual Basic marker content

Call VarPtr("VM_BEGIN")

Call VarPtr("VM_END")

Examples

Show/Hide Delphi classic marker example

// Take enigma_ide.pas from the folder EnigmaSDK\Delphi
uses
  enigma_ide;

begin
  EP_Marker('vm_begin');
  ShowMessage('This message is shown under virtualized code');
  EP_Marker('vm_end');

  // DEPRECATED
  {$I ..\..\..\EnigmaSDK\Delphi\vm_begin.inc}
  ShowMessage('This message is shown under virtualized code');
  {$I ..\..\..\EnigmaSDK\Delphi\vm_end.inc}
end;

See markers examples in the installation folder, Examples\MarkerVM subfolder.


Markers VM RISC

VM RISC markers are similar to VM markers, they also serve for code virtualization, however, RISC markers provide the maximum protection to the selected code. Apart of classic VM markers, RISC are more complex, heavy and slow. It is not recommended to protect parts of code that are speed sensitive (such as loops) because the execution speed of this code will be reduced in times after protection.

RISC Virtual Machine

Show/Hide Delphi marker content

// Take enigma_ide.pas from the folder EnigmaSDK\Delphi
uses
  enigma_ide;

procedure Test;
begin
  EP_Marker('vm_risc_begin');
  // Put here code for protection

  EP_Marker('vm_risc_end');
end;

// DEPRECATED
vm_begin.inc
asm
  DB $EB, $08, $56, $4D, $42, $45, $47, $49, $4E, $31
end;

vm_end.inc
asm
  DB $EB, $08, $56, $4D, $45, $4E, $44, $31, $00, $00
end;;

Show/Hide C++ marker content

// Take enigma_ide.h from the folder EnigmaSDK\VC
#include "enigma_ide.h"

#pragma optimize("", off)
void test()
{
    EP_Marker("vm_risc_begin");

    // Put here code for protection

    EP_Marker("vm_risc_end");
}
#pragma optimize("", on)

// DEPRECATED
vm_begin.inc
__asm
  {
    DB 0xEB, 0x08, 0x56, 0x4D, 0x42, 0x45, 0x47, 0x49, 0x4E, 0x31
  }

vm_end.inc
__asm
  {
    DB 0xEB, 0x08, 0x56, 0x4D, 0x45, 0x4E, 0x44, 0x31, 0x00, 0x00
  }

Show/Hide Visual Basic marker content

Call VarPtr("VM_RISC_BEGIN")

Call VarPtr("VM_RISC_END")

Examples

Show/Hide Delphi classic marker example

// Take enigma_ide.pas from the folder EnigmaSDK\Delphi
uses
  enigma_ide;

begin
  EP_Marker('vm_risc_begin');
  ShowMessage('This message is shown under virtualized code');
  EP_Marker('vm_risc_end');

  // DEPRECATED
  {$I ..\..\..\EnigmaSDK\Delphi\vm_risc_begin.inc}
  ShowMessage('This message is shown under virtualized code');
  {$I ..\..\..\EnigmaSDK\Delphi\vm_risc_end.inc}
end;

See markers examples in the installation folder, Examples\MarkerVMRISC subfolder.


Markers Reg_Crypt

Reg_Crypt markers allow selecting parts of the code that should be executed only in case the module is registered, and the registration key allows deciphering the crypted section. Enigma Protector supports 16 types of Reg_Crypt markers. Each marker can be used to select any number of the code parts. Note that the application has to be restarted after registration for the Reg_Crypt markers to work correctly. Restarting is not needed if you use the standard Registration Dialog.

The principle of work: after the module is protected, the code inside the begin/end markers will be encrypted and the execution of the code will be impossible. If you try to run the protected module, the code inside the markers will not be executed, but other functionality will stay the same. If a valid registration key is stored in the system, the loader checks what sections can be decrypted with this key, and if succeeds, the necessary encrypted section will be decrypted. I.e. if the registration key was generated with Section 1 unlocked, the reg_crypt_begin1/reg_crypt_end1 marker will be decrypted. To register the module, use internal Enigma API functions or perform registration by means of key files, or use the standard Registration Dialog. For detailed information on the registration key generator see Creating Keys.

Content

Show/Hide Delphi marker content

// Take enigma_ide.pas from the folder EnigmaSDK\Delphi
uses
  enigma_ide;

procedure Test;
begin
  // Replace XX on a marker number from 01 to 16
  EP_Marker('reg_crypt_beginXX');
  // Put here code for protection

  EP_Marker('reg_crypt_endXX');
end;

// DEPRECATED
reg_crypt_beginXX.inc
asm
  DB $EB, $08, $52, $47, $43, $52, $42, $XX, $00, $00
end;

reg_crypt_endXX.inc
asm
  DB $EB, $08, $52, $47, $43, $52, $45, $XX, $00, $00
end;

Show/Hide C++ marker content

// Take enigma_ide.h from the folder EnigmaSDK\VC
#include "enigma_ide.h"

#pragma optimize("", off)
void test()
{
    // Replace XX on a marker number from 01 to 16
    EP_Marker("reg_crypt_beginXX");

    // Put here code for protection

    EP_Marker("reg_crypt_endXX");
}
#pragma optimize("", on)

// DEPRECATED
reg_crypt_beginXX.inc
__asm
  {
    DB 0xEB, 0x08, 0x52, 0x47, 0x43, 0x52, 0x42, 0xXX, 0x00, 0x00
  }

reg_crypt_endXX.inc
__asm
  {
    DB 0xEB, 0x08, 0x52, 0x47, 0x43, 0x52, 0x45, 0xXX, 0x00, 0x00
  }

Show/Hide C++ x64 marker content

// Take enigma_ide.h from the folder EnigmaSDK\VC
#include "enigma_ide.h"

#pragma optimize("", off)
void test()
{
    EP_Marker("reg_crypt_begin1");

    // Put here code for protection

    EP_Marker("reg_crypt_end1");
}
#pragma optimize("", on)

Show/Hide Visual Basic marker content

Call VarPtr("REG_CRYPT_BEGINXX")

Call VarPtr("REG_CRYPT_ENDXX")

Examples

Show/Hide Delphi marker example

// Take enigma_ide.pas from the folder EnigmaSDK\Delphi
uses
  enigma_ide;

type
  TRegType = (rtUnregistered, rtSingle, rtSite, rtCompany, rtPrivate); // user-defined type of type of module registration

function GetRegistrationType : TRegType; // function returns the type of module registration
begin
  Result := rtUnregistered; // module is Unregistered

  EP_Marker('reg_crypt_begin1'); // begin marker of reg_crypt1 pair
  if EP_RegLoadAndCheckKey then // check validity of registration key
  begin
    Result := rtSingle; // module has Single license
    Exit; // exit from subroutine
  end;
  EP_Marker('reg_crypt_end1'); // end marker of reg_crypt1 pair

  EP_Marker('reg_crypt_begin2'); // begin marker of reg_crypt2 pair
  if EP_RegLoadAndCheckKey then // check validity of registration key
  begin
    Result := rtSite; // module has Site license
    Exit; // exit from subroutine
  end;
  EP_Marker('reg_crypt_end2'); // end marker of reg_crypt2 pair

  EP_Marker('reg_crypt_begin3'); // begin marker of reg_crypt3 pair
  if EP_RegLoadAndCheckKey then // check validity of registration key
  begin
    Result := rtCompany; // module has Company license
    Exit; // exit from subroutine
  end;
  EP_Marker('reg_crypt_end3'); // end marker of reg_crypt3 pair

  EP_Marker('reg_crypt_begin4'); // begin marker of reg_crypt4 pair
  if EP_RegLoadAndCheckKey then // check validity of registration key
  begin
    Result := rtPrivate; // module has Private license
    Exit; // exit from subroutine
  end;
  EP_Marker('reg_crypt_end4'); // end marker of reg_crypt4 pair

  //DEPRECATED
  {$I include\reg_crypt_begin1.inc} // begin marker of reg_crypt1 pair
  if EP_RegLoadAndCheckKey then // check validity of registration key
  begin
    Result := rtSingle; // module has Single license
    Exit; // exit from subroutine
  end;
  {$I include\reg_crypt_end1.inc} // end marker of reg_crypt1 pair

  {$I include\reg_crypt_begin2.inc} // begin marker of reg_crypt2 pair
  if EP_RegLoadAndCheckKey then // check validity of registration key
  begin
    Result := rtSite; // module has Site license
    Exit; // exit from subroutine
  end;
  {$I include\reg_crypt_end2.inc} // end marker of reg_crypt2 pair

  {$I include\reg_crypt_begin3.inc} // begin marker of reg_crypt3 pair
  if EP_RegLoadAndCheckKey then // check validity of registration key
  begin
    Result := rtCompany; // module has Company license
    Exit; // exit from subroutine
  end;
  {$I include\reg_crypt_end3.inc} // end marker of reg_crypt3 pair

  {$I include\reg_crypt_begin4.inc} // begin marker of reg_crypt4 pair
  if EP_RegLoadAndCheckKey then // check validity of registration key
  begin
    Result := rtPrivate; // module has Private license
    Exit; // exit from subroutine
  end;
  {$I include\reg_crypt_end4.inc} // end marker of reg_crypt4 pair

end;

Show/Hide C++ marker example

// Take enigma_ide.h from the folder EnigmaSDK\VC
#include "enigma_ide.h"

// user-defined constants of module type registration
#define rtUnregistered  0
#define rtSingle        1
#define rtSite          2
#define rtCompany       3
#define rtPrivate       4
//---------------------------------------------------------------------------

#pragma optimize("", off)
int GetRegistrationType () // function returns the type of module registration
{

  EP_Marker('reg_crypt_begin1'); // begin marker of reg_crypt1 pair
  if (EP_RegLoadAndCheckKey()){
    return rtSingle; // module has Single license
  };
  EP_Marker('reg_crypt_end1'); // end marker of reg_crypt1 pair

  EP_Marker('reg_crypt_begin2'); // begin marker of reg_crypt2 pair
  if (EP_RegLoadAndCheckKey()){
    return rtSite; // module has Site license
  };
  EP_Marker('reg_crypt_end2'); // end marker of reg_crypt2 pair

  EP_Marker('reg_crypt_begin3'); // begin marker of reg_crypt3 pair
  if (EP_RegLoadAndCheckKey()){
    return rtCompany; // module has Company license
  };
  EP_Marker('reg_crypt_end3'); // end marker of reg_crypt3 pair

  EP_Marker('reg_crypt_begin4'); // begin marker of reg_crypt4 pair
  if (EP_RegLoadAndCheckKey()){
    return rtPrivate; // module has Private license
  };
  EP_Marker('reg_crypt_end4'); // end marker of reg_crypt4 pair

  //DEPRECATED
  #include "include\reg_crypt_begin1.inc" // begin marker of reg_crypt1 pair
  if (EP_RegLoadAndCheckKey()){
    return rtSingle; // module has Single license
  };
  #include "include\reg_crypt_end1.inc" // end marker of reg_crypt1 pair

  #include "include\reg_crypt_begin2.inc" // begin marker of reg_crypt2 pair
  if (EP_RegLoadAndCheckKey()){
    return rtSite; // module has Site license
  };
  #include "include\reg_crypt_end2.inc" // end marker of reg_crypt2 pair

  #include "include\reg_crypt_begin3.inc" // begin marker of reg_crypt3 pair
  if (EP_RegLoadAndCheckKey()){
    return rtCompany; // module has Company license
  };
  #include "include\reg_crypt_end3.inc" // end marker of reg_crypt3 pair

  #include "include\reg_crypt_begin4.inc" // begin marker of reg_crypt4 pair
  if (EP_RegLoadAndCheckKey()){
    return rtPrivate; // module has Private license
  };
  #include "include\reg_crypt_end4.inc" // end marker of reg_crypt4 pair

  return rtUnregistered; // module is Unregistered
};
#pragma optimize("", on)

Show/Hide Visual Basic marker example

  Call VarPtr("REG_CRYPT_BEGIN1")
  MsgBox "Section #1 is unlocked by key!"
  Call VarPtr("REG_CRYPT_END1")
  Call VarPtr("REG_CRYPT_BEGIN2")
  MsgBox "Section #2 is unlocked by key!"
  Call VarPtr("REG_CRYPT_END2")
  Call VarPtr("REG_CRYPT_BEGIN3")
  MsgBox "Section #3 is unlocked by key!"
  Call VarPtr("REG_CRYPT_END3")
  Call VarPtr("REG_CRYPT_BEGIN4")
  MsgBox "Section #4 is unlocked by key!"
  Call VarPtr("REG_CRYPT_END4")
  Call VarPtr("REG_CRYPT_BEGIN5")
  MsgBox "Section #5 is unlocked by key!"
  Call VarPtr("REG_CRYPT_END5")
  MsgBox "If you did not see any message then this application is not registered or key does not unlock any section!"

See markers examples in the installation folder, Examples\MarkersRegCrypt subfolder.


Markers UnReg_Crypt

The UnReg_Crypt markers allow selecting parts of the code that should be executed only in case the module is not registered, or the module is registered but the registration key does not support deciphering of the current encrypted section. The Enigma Protector supports 16 types of UnReg_Crypt markers. Each marker can be used to select any number of the code parts. The principle of work: after the module is protected and started, The Enigma Protector loader will check the presence of a valid registration key for the module. If a registration key is not found, all unreg_crypt sections will be deciphered and prepared for execution. There is another case in which these sections will be deciphered - in case a valid registration key is found, but it does not allow deciphering the current unreg_crypt section. Generally, the unreg_crypt markers are the opposite of the reg_crypt markers.

Content

Show/Hide Delphi marker content

// Take enigma_ide.pas from the folder EnigmaSDK\Delphi
uses
  enigma_ide;

procedure Test;
begin
  // Replace XX with the necessary marker name, from 01 to 16

  EP_Marker('unreg_crypt_beginXX');
  // Put here code for protection

  EP_Marker('unreg_crypt_beginXX');
end;

// DEPRECATED
unreg_crypt_beginXX.inc
asm
  DB $EB, $08, $55, $4E, $52, $47, $43, $52, $42, $XX

end;

unreg_crypt_endXX.inc
asm
  DB $EB, $08, $55, $4E, $52, $47, $43, $52, $45, $XX
end;

Show/Hide C++ marker content

// Take enigma_ide.h from the folder EnigmaSDK\VC
#include "enigma_ide.h"

#pragma optimize("", off)
void test()
{
    // Replace XX with the necessary marker name, from 01 to 16
    EP_Marker("unreg_crypt_beginXX");

    // Put here code for protection

    EP_Marker("unreg_crypt_endXX");
}
#pragma optimize("", on)

// DEPRECATED
unreg_crypt_beginXX.inc
__asm
  {
    DB 0xEB, 0x08, 0x55, 0x4E, 0x52, 0x47, 0x43, 0x52, 0x42, 0xXX
  }

unreg_crypt_endXX.inc
__asm
  {
    DB 0xEB, 0x08, 0x55, 0x4E, 0x52, 0x47, 0x43, 0x52, 0x45, 0xXX
  }

Show/Hide C++ x64 marker content

// Take enigma_ide.h from the folder EnigmaSDK\VC
#include "enigma_ide.h"

#pragma optimize("", off)
void test()
{
    EP_Marker("unreg_crypt_begin1");

    // Put here code for protection

    EP_Marker("unreg_crypt_end1");
}
#pragma optimize("", on)

Show/Hide Visual Basic marker content

Call VarPtr("UNREG_CRYPT_BEGINXX")

Call VarPtr("UNREG_CRYPT_ENDXX")

Examples

Show/Hide Delphi marker example

// Take enigma_ide.pas from the folder EnigmaSDK\Delphi
uses
  enigma_ide; // Use the Enigma API module to call EP_RegLoadAndCheckKey function

begin
  EP_Marker('reg_crypt_begin1');
  if EP_RegLoadAndCheckKey then
  begin
    MessageBox(0, 'Application is registered!'#13#10 +
                  'The registration key created with the Unlock Section #1 disabled!'#13#10 +
                  'Marker unreg_crypt1 is deciphered', 'Application', 0);
  end else
  begin
    MessageBox(0, 'Application is not registered!'#13#10 +
                  'Marker unreg_crypt1 is deciphered', 'Application', 0);
  end;
  EP_Marker('reg_crypt_end1');

  EP_Marker('reg_crypt_begin1');
    MessageBox(0, 'Application is registered!'#13#10 +
                  'The registration key created with the Unlock Section #1 enabled!'#13#10 +
                  'Marker reg_crypt1 is deciphered', 'Application', 0);
  EP_Marker('reg_crypt_end1');

  //DEPRECATED
  {$I include/unreg_crypt_begin1.inc}
  if EP_RegLoadAndCheckKey then
  begin
    MessageBox(0, 'Application is registered!'#13#10 +
                  'The registration key created with the Unlock Section #1 disabled!'#13#10 +
                  'Marker unreg_crypt1 is deciphered', 'Application', 0);
  end else
  begin
    MessageBox(0, 'Application is not registered!'#13#10 +
                  'Marker unreg_crypt1 is deciphered', 'Application', 0);
  end;
  {$I include/unreg_crypt_end1.inc}

  {$I include/reg_crypt_begin1.inc}
    MessageBox(0, 'Application is registered!'#13#10 +
                  'The registration key created with the Unlock Section #1 enabled!'#13#10 +
                  'Marker reg_crypt1 is deciphered', 'Application', 0);
  {$I include/reg_crypt_end1.inc}
end.

Show/Hide C++ marker example

// Take enigma_ide.h from the folder EnigmaSDK\VC
#include "enigma_api.h"

#pragma optimize("", off)
BOOL TestMarkers ()
{

  EP_Marker("unreg_crypt_begin1"); // begin marker of unreg_crypt1 pair
  if (EP_RegLoadAndCheckKey()){
    MessageBox(0, "Application is registered!\n\rThe registration key created with the Unlock Section #1 disabled!\n\rMarker unreg_crypt1 is deciphered", "Application", 0);
  } else {
    MessageBox(0, "Application is not registered!\n\rMarker unreg_crypt1 is deciphered", "Application", 0);
  };
  EP_Marker("unreg_crypt_end1"); // end marker of unreg_crypt1 pair

  EP_Marker("unreg_crypt_begin1"); // begin marker of reg_crypt1 pair
    MessageBox(0, "Application is registered!\n\rThe registration key created with the Unlock Section #1 enabled!\n\rMarker reg_crypt1 is deciphered", "Application", 0);
  EP_Marker("unreg_crypt_end1"); // end marker of unreg_crypt1 pair

  //DEPRECATED
  #include "include\unreg_crypt_begin1.inc" // begin marker of unreg_crypt1 pair
  if (EP_RegLoadAndCheckKey()){
    MessageBox(0, "Application is registered!\n\rThe registration key created with the Unlock Section #1 disabled!\n\rMarker unreg_crypt1 is deciphered", "Application", 0);
  } else {
    MessageBox(0, "Application is not registered!\n\rMarker unreg_crypt1 is deciphered", "Application", 0);
  };
  #include "include\unreg_crypt_end1.inc" // end marker of unreg_crypt1 pair

  #include "include\reg_crypt_begin1.inc" // begin marker of reg_crypt1 pair
    MessageBox(0, "Application is registered!\n\rThe registration key created with the Unlock Section #1 enabled!\n\rMarker reg_crypt1 is deciphered", "Application", 0);
  #include "include\reg_crypt_end1.inc" // end marker of reg_crypt1 pair

  return TRUE;
}
#pragma optimize("", on)

Show/Hide Visual Basic marker example

  Call VarPtr("UNREG_CRYPT_BEGIN1")
  MsgBox "Application is unregistered or key does not unlock Section #1!"
  Call VarPtr("UNREG_CRYPT_END1")
  Call VarPtr("UNREG_CRYPT_BEGIN2")
  MsgBox "Application is unregistered or key does not unlock Section #2!"
  Call VarPtr("UNREG_CRYPT_END2")
  Call VarPtr("UNREG_CRYPT_BEGIN3")
  MsgBox "Application is unregistered or key does not unlock Section #3!"
  Call VarPtr("UNREG_CRYPT_END3")
  Call VarPtr("UNREG_CRYPT_BEGIN4")
  MsgBox "Application is unregistered or key does not unlock Section #4!"
  Call VarPtr("UNREG_CRYPT_END4")
  Call VarPtr("UNREG_CRYPT_BEGIN5")
  MsgBox "Application is unregistered or key does not unlock Section #5!"
  Call VarPtr("UNREG_CRYPT_END5")
  MsgBox "If you did not see any message then this application is registered and key unlocks sections #1, #2, #3, #4 and #5!"

See markers examples in the installation folder, Examples\UnRegCryptMarkers subfolder.


Markers Decrypt_On_Execute

Decrypt_On_Execute markers allow selecting parts of the code that should be deciphered only when the code needs to be executed. These markers do not affect the execution process and the functionality of the protected module. The code between these markes encipheres after protection and is only stored in the file. When the execution of the module has come to the begin marker, the code begins to decipher and execute. These markers can increase safety of the protected module and serve as an anti-dump technique. Most crackers dump the program from memory at the first execution command, and if you use the Decrypt_On_Execute markers, the cracker will not get the original code from memory and will not be able to restore the sources. You can use any number of Decrypt_On_Execute markers in your module.

Content

Show/Hide Delphi marker content

// Take enigma_ide.pas from the folder EnigmaSDK\Delphi
uses
  enigma_ide;

procedure Test;
begin
  EP_Marker('decrypt_on_execute_begin');
  // Put here code for protection

  EP_Marker('decrypt_on_execute_end');
end;

decrypt_on_execute_begin.inc
asm
  DB $EB, $0C, $45, $43, $52, $4F, $4E, $45, $58, $45, $43, $42, $00, $00
end;

decrypt_on_execute_end.inc
asm
  DB $EB, $0C, $45, $43, $52, $4F, $4E, $45, $58, $45, $43, $42, $00, $00
end;

Show/Hide C++ marker content

// Take enigma_ide.h from the folder EnigmaSDK\VC
#include "enigma_ide.h"

#pragma optimize("", off)
void test()
{
    EP_Marker("decrypt_on_execute_begin");

    // Put here code for protection

    EP_Marker("decrypt_on_execute_end");
}
#pragma optimize("", on)

// DEPRECATED
decrypt_on_execute_begin.inc
__asm
  {
    DB $EB, $0C, $45, $43, $52, $4F, $4E, $45, $58, $45, $43, $42, $00, $00
  }

decrypt_on_execute_end.inc
__asm
  {
    DB $EB, $0C, $45, $43, $52, $4F, $4E, $45, $58, $45, $43, $42, $00, $00
  }

Show/Hide C++ x64 marker content

// Take enigma_ide.h from the folder EnigmaSDK\VC
#include "enigma_ide.h"

#pragma optimize("", off)
void test()
{
    EP_Marker("decrypt_on_execute_begin");

    // Put here code for protection

    EP_Marker("decrypt_on_execute_end");
}
#pragma optimize("", on)

Show/Hide Visual Basic marker content

Call VarPtr("DECRYPT_ON_EXECUTE_BEGIN")

Call VarPtr("DECRYPT_ON_EXECUTE_END")

Examples

Show/Hide Delphi marker example

// Take enigma_ide.pas from the folder EnigmaSDK\Delphi
uses
  enigma_ide;

begin
  MessageBox(0, 'Application is started!'#13#10'The code between decrypt_on_execute markers is enciphered now!', 'Test', 0);

  // Start of code which is hidden in memory
  EP_Marker('decrypt_on_execute_begin');
  MessageBox(0, 'The message from deciphered code!', 'Test', 0);
  EP_Marker('decrypt_on_execute_end');

  //DEPRECATED
  {$I ..\..\..\EnigmaSDK\Delphi\decrypt_on_execute_begin.inc}
  MessageBox(0, 'The message from deciphered code!', 'Test', 0);
  {$I ..\..\..\EnigmaSDK\Delphi\decrypt_on_execute_end.inc}
end;

Show/Hide C++ marker example

// Take enigma_ide.h from the folder EnigmaSDK\VC
#include "enigma_ide.h"

#pragma optimize("", off)
{
  MessageBox(0, "Application is started!\r\nThe code between decrypt_on_execute markers is enciphered now!", "Test", 0);

  // Start of code which is hidden in memory
  EP_Marker("decrypt_on_execute_begin");
  MessageBox(0, "The message from deciphered code!", "Test", 0);
  EP_Marker("decrypt_on_execute_end");

  // DEPRECATED
  #include "..\..\..\EnigmaSDK\Bcb\decrypt_on_execute_begin.inc"
  MessageBox(0, "The message from deciphered code!", "Test", 0);
  #include "..\..\..\EnigmaSDK\Bcb\decrypt_on_execute_end.inc"
}
#pragma optimize("", on)

Show/Hide Visual Basic marker example

  MsgBox "The code between decrypt_on_execute markers is enciphered now!"
  Call VarPtr("DECRYPT_ON_EXECUTE_BEGIN")
  MsgBox "The message from deciphered code!"
  Call VarPtr("DECRYPT_ON_EXECUTE_END")

See markers examples in the installation folder, Examples\MarkersDecryptOnExecute subfolder.


Markers Check_Protection

Check_Protection markers can be used to check the integrity of the protection code. If the protection code is corrupted, the code inside the marker will not be executed, and if the protection is OK, the code inside the marker will be executed. This is a very good and useful way to hide the "weak" points from crackers, for example, the key check routine, etc. can be placed inside these markers.

Content

Show/Hide Delphi marker content

// Take enigma_ide.pas from the folder EnigmaSDK\Delphi
uses
  enigma_ide;

procedure Test;
begin
  EP_Marker('check_protection_begin');
  // Put here code for protection

  EP_Marker('check_protection_end');
end;

// DEPRECATED
check_protection_begin.inc
asm
  DB $EB, $08, $43, $48, $43, $4B, $50, $52, $54, $42
end;

check_protection_end.inc
asm
  DB $EB, $08, $43, $48, $43, $4B, $50, $52, $54, $45
end;

Show/Hide C++ marker content

// Take enigma_ide.h from the folder EnigmaSDK\VC
#include "enigma_ide.h"

#pragma optimize("", off)
void test()
{
    EP_Marker("check_protection_begin");

    // Put here code for protection

    EP_Marker("check_protection_end");
}
#pragma optimize("", on)

// DEPRECATED
check_protection_begin.inc
__asm
  {
    DB 0xEB, 0x08, 0x43, 0x48, 0x43, 0x4B, 0x50, 0x52, 0x54, 0x42
  }

check_protection_end.inc
__asm
  {
    DB 0xEB, 0x08, 0x43, 0x48, 0x43, 0x4B, 0x50, 0x52, 0x54, 0x45
  }

Show/Hide C++ x64 marker content

// Take enigma_ide.h from the folder EnigmaSDK\VC
#include "enigma_ide.h"

#pragma optimize("", off)
void test()
{
    EP_Marker("check_protection_begin");

    // Put here code for protection

    EP_Marker("check_protection_end");
}
#pragma optimize("", on)

Show/Hide Visual Basic marker content

Call VarPtr("CHECK_PROTECTION_BEGIN")

Call VarPtr("CHECK_PROTECTION_END")

Examples

Show/Hide Delphi marker example

// Take enigma_ide.pas from the folder EnigmaSDK\Delphi
uses
  enigma_ide;

begin
  EP_Marker('check_protection_begin');
  // This message will not be shown if protection is corrupted
  MessageBox(0, 'The protection is OK!', 'Application!', 0);
  EP_Marker('check_protection_end');

  // DEPRECATED
  {$I ..\..\..\EnigmaSDK\Delphi\check_protection_begin.inc}
  // This message will not be shown if protection is corrupted
  MessageBox(0, 'The protection is OK!', 'Application!', 0);
  {$I ..\..\..\EnigmaSDK\Delphi\check_protection_end.inc}

  // This message will be always shown
  MessageBox(0, 'If you did not see any message before then protection is corrupted!', 'Application', 0);
end;

Show/Hide Visual Basic marker example

  Call VarPtr("CHECK_PROTECTION_BEGIN")
  MsgBox "This message box is shown inside Check Protection marker! The protection is OK!"
  Call VarPtr("CHECK_PROTECTION_END")

See markers examples in the installation folder, Examples\CheckProtection subfolder.


Markers Run_Once

The Run_Once marker allows selecting part of the code that will be executed only the first time the file is executed. After the first execution the contents of this marker will be deleted from memory and will never be restored. If you try to run this code for a second time, it will be skipped.

Content

Show/Hide Delphi marker content

// Take enigma_ide.pas from the folder EnigmaSDK\Delphi
uses
  enigma_ide;

procedure Test;
begin
  EP_Marker('run_once_begin');
  // Put here code for protection

  EP_Marker('run_once_end');
end;

// DEPRECATED
run_once_begin.inc
asm
  DB $EB, $08, $72, $75, $6E, $6F, $6E, $63, $65, $42
end;

run_once_end.inc
asm
  DB $EB, $08, $72, $75, $6E, $6F, $6E, $63, $65, $45
end;

Show/Hide C++ marker content

// Take enigma_ide.h from the folder EnigmaSDK\VC
#include "enigma_ide.h"

#pragma optimize("", off)
void test()
{
    EP_Marker("run_once_begin");

    // Put here code for protection

    EP_Marker("run_once_end");
}
#pragma optimize("", on)

// DEPRECATED
run_once_begin.inc
__asm
  {
    DB 0xEB, 0x08, 0x72, 0x75, 0x6E, 0x6F, 0x6E, 0x63, 0x65, 0x42
  }

run_once_end.inc
__asm
  {
    DB 0xEB, 0x08, 0x72, 0x75, 0x6E, 0x6F, 0x6E, 0x63, 0x65, 0x45
  }

Show/Hide C++ x64 marker content

// Take enigma_ide.h from the folder EnigmaSDK\VC
#include "enigma_ide.h"

#pragma optimize("", off)
void test()
{
    EP_Marker("run_once_begin");

    // Put here code for protection

    EP_Marker("run_once_end");
}
#pragma optimize("", on)

Show/Hide Visual Basic marker content

Call VarPtr("RUN_ONCE_BEGIN")

Call VarPtr("RUN_ONCE_END")

Examples

Show/Hide Delphi marker example

// Take enigma_ide.pas from the folder EnigmaSDK\Delphi
uses
  enigma_ide;

begin
  EP_Marker('run_once_begin');
  // This message will be shown only once per execution
  ShowMessage('This message is under RunOnce marker');
  EP_Marker('run_once_end');

  //DEPRECATED
  {$I ..\..\..\EnigmaSDK\Delphi\run_once_begin.inc}
  // This message will be shown only once per execution
  ShowMessage('This message is under RunOnce marker');
  {$I ..\..\..\EnigmaSDK\Delphi\run_once_end.inc}
end;

See markers examples in the installation folder, Examples\MarkerRunOnce subfolder.


Markers Unprotected

The Unprotected markers allow selecting parts of the code that should be executed only in a non-protected version of the file. During the protection process, the code inside these markers is deleted and these parts will not be present in memory when the protected file starts. In short, the code inside these markers will not be executed after protection.

Content

Show/Hide Delphi marker content

// Take enigma_ide.pas from the folder EnigmaSDK\Delphi
uses
  enigma_ide;

procedure Test;
begin
  EP_Marker('unprotected_begin');
  // Put code here

  EP_Marker('unprotected_end');
end;

// DEPRECATED
unprotected_begin.inc
asm
  DB $EB, $08, $55, $4E, $50, $52, $4F, $54, $42, $00
end;

unprotected_end.inc
asm
  DB $EB, $08, $55, $4E, $50, $52, $4F, $54, $45, $00
end;

Show/Hide C++ marker content

// Take enigma_ide.h from the folder EnigmaSDK\VC
#include "enigma_ide.h"

#pragma optimize("", off)
void test()
{
    EP_Marker("unprotected_begin");

    // Put code here

    EP_Marker("unprotected_end");
}
#pragma optimize("", on)

// DEPRECATED
unprotected_begin.inc
__asm
  {
    DB 0xEB, 0x08, 0x55, 0x4E, 0x50, 0x52, 0x4F, 0x54, 0x42, 0x00
  }

unprotected_end.inc
__asm
  {
    DB 0xEB, 0x08, 0x55, 0x4E, 0x50, 0x52, 0x4F, 0x54, 0x45, 0x00
  }

Show/Hide C++ x64 marker content

// Take enigma_ide.h from the folder EnigmaSDK\VC
#include "enigma_ide.h"

#pragma optimize("", off)
void test()
{
    EP_Marker("unprotected_begin");

    // Put code here

    EP_Marker("unprotected_end");
}
#pragma optimize("", on)

Show/Hide Visual Basic marker content

Call VarPtr("UNPROTECTED_BEGIN")

Call VarPtr("UNPROTECTED_END")

Examples

Show/Hide Delphi marker example

// Take enigma_ide.pas from the folder EnigmaSDK\Delphi
uses
  enigma_ide;

begin
  EP_Marker('unprotected_begin');
  // This message will occur only in unprotected version of module
  MessageBox(0, 'If you are seeing this message then the module is not protected!', 'Application', 0);
  EP_Marker('unprotected_end');

  //DEPRECATED
  {$I ..\..\..\EnigmaSDK\Delphi\unprotected_begin.inc}
  // This message will occur only in unprotected version of module
  MessageBox(0, 'If you are seeing this message then the module is not protected!', 'Application', 0);
  {$I ..\..\..\EnigmaSDK\Delphi\unprotected_end.inc}
  // This message will always occur
  MessageBox(0, 'If you did not see any messages then the module is protected!', 'Application', 0);
end;

Show/Hide Visual Basic marker example

  Call VarPtr("UNPROTECTED_BEGIN")
  MsgBox "Application is NOT protected!"
  Call VarPtr("UNPROTECTED_END")
  MsgBox "If you did not see any message then application is protected!"

See markers examples in the installation folder, Examples\MarkersUnprotect subfolder.


Tutorials

The tutorials will help beginner users apply the necessary type of protection in a couple of minutes. Select the protection type you would like to have:

  • Simple envelope protection
  • Trial protection part 1
  • Trial protection part 2


Simple envelop protection

The simple envelop protection implies creation of a simple protection scheme based on the protection of the main executable of the module, and does not require to make any changes to the module sources. The protection only uses the internal functions of The Enigma Protector, that prevent file disassembling, reverse engineering, patching (changing file and memory contents), memory dumping. The internal parameter for the project is only the executable file of your module.

  • Create a unique project for file protection. See. Creating a protection project. This project can be used for creating more complex protection later.
  • Define the following settings: Input parameters, Protection parameters. Note: options related to the registration keys features and trial control features should not be used in the current project, so do not change these, leave them by default.
  • Module protection. Hit the "Protect" button and check the functionality of the protected module.


Delphi Examples

The sources below will guide you how to create a simple application displaying the "Hello World" message after execution. Note: the functionality of the module should not be changed after protection.

The full sources of the current project are located in the "Tutorials\Simple envelope protection\Delphi\" folder.

program test;
{$APPTYPE CONSOLE}
uses
  Windows, SysUtils;
begin
  MessageBox(0, 'This is The Enigma Protector test application.'#10#13 +
                'If after protection you will see this message then the application works correctly!',
                'Test Application', 0);
end.


Trial protection part 1 (without source changing)

Trial protection part 1
(without source changing)

Trial protection implies the use of specific trial options of The Enigma Protector to add time limitations to the protected module and use Enigma generated registration keys. The protection uses internal functions, so you do not need to make changes to the sources of your module. The only input parameter for the function is the executable file of your module.

  1. Create a unique project for file protection. See. Creation of protection project. This project can be later used for creating more complex protection.
  2. Define the following settings: Input parameters, Protection parameters.
  3. Choose trial period parameters. See. Trial Limitations.
    1. The Enigma Protector supports the following types of trial limitations: by count of module executions, by count of usage days (the trial period counter starts from the first execution of module on the user PC), by expiration date. Turn on the necessary additional parameters of the trial period.
    2. Set the reaction on trial expiration. Trial expiration means the impossibility of future usage of the module on the user PC, so you can turn on the "Terminate after execution" option on the "Trial Control" panel (See. Program Overview - Trial Control) and enter the time interval after which the module will be terminated. If this value is 0, the module will be terminated immediately after it is started.
    3. Trial period counter uses the system clock to calculate trial parameters. But a cracker can set the system clock backward to reset trial limitation and restore the functionality of the module. To prevent it, you can turn on the clock control function.
    4. During the development of new software releases, you need to reset trial parameters of older protected versions of module on the user PC. To do this, you can enable a special feature which will check the version of trial information on the user's PC, and if it is older than the current version, the trial limitations will be reset. To enable the feature, check the "Reset trial" box on the "Trial control" panel. Note: this feature uses version information which you have entered into the project input parameters. See Choosing input parameters).
  4. Set the registration keys features (See. Registration keys features). To delete trial limitations, the user needs to register your module. Module registration means saving the registration information on the user's PC. Choose the type and path for storing registration information. The Enigma Protector supports two types of registration information storage - registration information stored in an external file or in the Windows registry (See Program Overview - Registration Features).
  5. Module protection. Click the "Protect" button and check the functionality of the protected module.

Overview:

After the first module execution on the user's PC, Enigma loader starts incrementing the trial counter. If the trial period has expired, the loader generates the reaction defined in 3.2. In case of trial expiration you can restore the functionality of the protected module by means of a file with registration information. You need to create a registration key by means of internal registration key generator (See. Creating Keys). Subject to the selected type of registration information storage (external file or Windows registry), you need to create the following file(s) with registration information:

  • registration information stored in the Windows registry.

    Create any file with the .reg extension and place the following strings there:

    [HKEY_ROOT\HKEY_RELATIVE]
"Name"="User Information"
"Key"="XUCBSNJ9T642DCQP3FW8C6NJL75X7"

    here: HKEY_ROOT - root path of Windows registry, it can be:

    HKEY_LOCAL_MACHINE and HKEY_CURRENT_USER, - this field has been filled out in the Registration Features - Registration data storing panel, "Base place in registry" field;

    HKEY_RELATIVE - related path in the Windows registry, has been filled out in the "Relative path in registry" field

    User Information - information about the user the registration key has been generated for;

    XUCBSNJ9T642DCQP3FW8C6NJL75X7 - the registration key.

    Send the .reg file to the user. After the user double-clicks this file, a message will be displayed offering to add information into the Windows registry, the user must click "Yes". In case everything has been done successfully, the module will be registered.

  • registration information stored in the external file.

    Create a file with the name which you have typed in the Registration Features - Registration data storing, "Relative path in the file system" field and place the following information there:

    [Registration information]
Name=UserInfo
Key=XUCBSNJ9T642DCQP3FW8C6NJL75X7

    here UserInfo - information about the user the registration key has been generated for;

    XUCBSNJ9T642DCQP3FW8C6NJL75X7 - the registration key.

    Send this file to the user and instruct them to copy the registration file into the folder specified in the "Base folder in file system" field. In case everything has been done successfully, the module will be registered.


Delphi Examples

The sources below will guide you on how to create a simple application displaying a "Hello World" message after execution. Note: the functionality of the module should not be changed after protection. The full sources of the current project are located in the "Tutorials\Trial protection part 1\Delphi\" folder.

program test;
{$APPTYPE CONSOLE}
uses
  Windows,
  SysUtils;
begin
  MessageBox(0, 'This is The Enigma Protector test application.'#10#13 +
                'If after protection you will see this message then the application works correctly!',
                'Test Application', 0);
end.


Trial protection part 2 (Trial Enigma API's)

The protection is based on the limitation of the time period the module will work on the user's PC. The protection uses special Enigma API functions to get parameters of the trial period. After protection, you need to make the necessary changes to the sources of your module and provide the results of API call handling.

Changing the module sources.

The following internal Enigma API functions can be used to control trial parameters:

  • EP_TrialExecutions
  • EP_TrialDays
  • EP_TrialExpirationDate

The examples showing how to work with Enigma API trial functions for different development languages are located in the Tutorials\Trial protection part 2\ folder.

The main advantage of this protection option is manual handling of trial parameters during the work of the module. You can change custom events on trial parameters alterations and trial expiration.

The following actions for project creating, setting of protection parameters, creation and distribution of registration keys are similar to the Trial protection part 1.


Delphi Examples

In the example, the Enigma API function EP_TrialExecutions is used to return the total and remaining number of trial executions. If the count of remaining executions is below half of the total trial executions, a warning message will be displayed.

program test;
{$APPTYPE CONSOLE}
uses
  Windows,
  SysUtils,
  enigma_ide in 'include\enigma_ide.pas';
var
  Total, Left : word;
  sMessage : string;
begin
  // This is test application of trial Enigma API functions
  // If the function succeed then it returns true
  // If the function failed then
  // 1. the trial limit on executions number was not set before protection
  // 2. here is unexpected error
  if EP_TrialExecutions(Total, Left) then
  begin
    if Left = 0 then
    begin
      MessageBox(0, 'Your trial period has over!', 'Test application', 0);
    end else
    begin
      if (Total div Left) >= 2 then sMessage := 'You have left more then half executions of your trial! period';
      sMessage := sMessage + format('You have left %d from %d days of your trial period!', [Left, Total]);
      MessageBox(0, PAnsiChar(sMessage), 'Test application', 0);
    end;
  end;
  // You may also use EP_TrialDays and EP_TrialExpirationDate
  // functions to control trial period
end.


Enigma License Manager

Enigma Protector License Manager is designed for storaging and managing registered users information and licenses. The license manager allows adding full information about registered users and detailed info about user licenses. There are also possibilities to mark registration keys as stolen (such registration keys will be blocked after protection), manage license subscription information (info about the subscribed license and user specified in Enigma Mailer) and generate licenses. In short, it is a powerful, useful and user-friendly manager for generating and storing license information. Click the New Customer button to create a new customer record or select the necessary record and click the Edit Customer button to edit/view the record.

  • Adding/Editing Customer (Main Menu - Customer - New/Edit)
  • Keys Generator Properties (Main Manu - Manager - Key Generator Properties...)
  • Importing License Database (Main Menu - Manager - Import Database...)


Edit Customer

Here you can enter information about registered users. All fields are optional, you may keep them blank or enter some values. All these fields can also be filled out in the Enigma Mailer. Please, note also that the E-mail field is very important - this is the customer address, which will be used by the Enigma Mailer to send emails. In the right part of the window, there is a list of licenses associated with the current customer. Each customer may have any number of licenses (this is very useful if you use, for example, time-limited keys, - you may quickly generate/extend a license for an existing customer). To add/edit/delete a license click the following buttons.

  • Adding/Editing License

Additional Parameters - set up additional parameters for the customer record. To set up a list of customer additional parameters, refer to the License Manager Properties. To learn how to access additional parameters through the Enigma Mailer, click here.


Import Database

This feature allows importing License Manager databases from previously created projects into the current one and regenerate registration keys. It may help in the following cases:

  • If you have created a new project for the existing application and want to update the users' registration keys
  • If you have changed the parameters of the registration scheme (Hardware Locking type, Type or Base of registration keys)
  • If you migrate a project from an older version of Enigma Protector to a newer one
  • If you have decided to combine several projects

Step 1. Select the external database file name - files with .enigmadb extension. Click the Next button.

Step 2. Select the Import properties.

Re-generate registration keys - check it if you want to regenerate registration keys from the external database before adding to the current database. Please note that if registration keys stored in the external database are not valid for the current project and you uncheck this option, these keys will not be added.

Add hyphens to the keys - allows regenerating registration keys with hyphens.

Import expired keys - check to import expired keys.

Import stolen keys - check to import stolen keys.

Step 3. The import process has been started. Click the Finish button to exit the Wizard.


Edit License

Edit License window is very similar to the Key Generator window. It allows generating and verifying registration keys. In contrast to the simple interface of the Key Generator, the Edit License has a few additional fields. These fields are optional, and you may keep them blank or you may use them for the Enigma Mailer. There you may generate or paste the existing registration keys, but note that ONLY valid registration keys will be added into the License Manager database.

Registration Name - enter a registration name to generate a registration key for

Add Hyphens - if checked, the registration key is hyphenated

Registration Key - the generated registration key

Copy/Paste - click to copy/paste the registration key to/from clipboard

Hardware ID - enter the hardware ID to lock registration to a particular computer

- click to check out the entered hardware ID

Key Expiration - enter the key expiration date

Number of License - enter the number of licenses that handle the current license

License Price - enter the price of the current license

Reference Number - the license reference number

Stolen License - if the current license (registration key) is stolen, check this box. After the protection is enabled, this key will be treated as invalid

Comment - any comment to the license

Options used in the Enigma Mailer:

Subscribed License - if checked, an email will be generated for the current license in the Enigma Mailer after the Generate Emails button is clicked

Expire Subscription - enter the subscription expiration date. Emails will not be generated for the current license after the selected expiration date

Generate Email - click the button to generate an email. The template for the email is obtained from the Enigma Mailer - the latest used template. If you would like to associate several templates with this button, use the License Manager Properties

Additional Parameters - set up additional parameters for the license record. To learn how to set up the list of additional license parameters, refer to the License Manager Properties. To learn how to access additional parameters through the Enigma Mailer, click here.


Keys Generator Properties

Here you can set up the properties of the License Manager:

Expiration Date - set up default values for the Expiration Date field that will occur when the License Generator is opened.

Use Key Expiration - indicates if the Expiration Date check box is checked when the License Generator is opened;

Fixed Date - the date the Expiration Date field will contain.

Custom Date - Expiration date is dynamic and depends on the current date.

Crypted Sections - set up default values for the Crypted Sections that will occur when the License Generator is opened.

Stolen Keys

Automatically mark Expired Keys as Stolen - if checked, Enigma will automatically recognize expired keys as stolen with protection enabled. This will help avoid re-enabling of expired keys by manipulating the system clocks and add an additional protection level.

Subscription - enter subscription parameters. The License subscription check box and the subscription date will be filled out by default when the Edit License dialog is opened.

Generate Email - allows entering template files that will be associated with the Generate Email button in the Edit License dialog

Single template selected in Mailer - the Generate Email button will be associated only with one template which was last used in the Enigma Mailer

All templates in the folder - select or enter a folder name. Enigma will analyse the folder and associate all the template files found in the folder with the Generate Email button

Selected template files - add template files to the list which will be associated with the Generate Email button

Customer Parameters - allows setting up an unlimited number of additional parameters for customer records. These parameters will also be stored in the License Manager database and can be available through the Enigma Mailer. All parameters are of the string type.

Description - enter the name or description of the parameter. This value will be shown in the Edit Parameters window. It is only used as a notice.

Short Name - the short name of the parameter. The parameter will be stored under this name in the License Manager database in the customer XML node. Also, this value is used to access the parameter in Enigma Mailer during messages generation.

Default Value - a default value for this parameter. Each newly created customer will have this parameter value by default

License Parameters - allows setting up an unlimited number of additional parameters for license records. These parameters will also be stored in the License Manager database and can be available through the Enigma Mailer. All parameters are of the string type.

Description - enter the name or description of the parameter. This value will be shown in the Edit Parameters window. It is only used as a notice.

Short Name - the short name of the parameter. The parameter will be stored under this name in the License Manager database in the license XML node. Also, this value is used to access the parameter in the Enigma Mailer during messages generation.

Default Value - a default value for this parameter. Each newly created license will have this parameter value by default


Enigma Mailer

Enigma Protector Mailer is a special tool, which allows generating and sending emails to registered customers. Every software needs to inform the registered users of a version update or personal user's registration information. It is long and difficult to create emails for each customer, and if you have several thousands of registered customers, it is simply impossible to manually generate emails for each of them. Enigma Mailer is the best tool to create and send email automatically, everything you need is just a registration database (which you can create with the Enigma Registration Manager) and a template. A template is a common text pattern that should be proccessed by Enigma Mailer and applied to the each customer.

  • Customers List
  • Options
  • Template
  • Emails


Customers List Panel

Customers List panel - all registration records from the database are displayed here. To create a database, use the License Manager.

Select users from the list and right-click on them to generate emails for particular users.


Options Panel

Here are the common Enigma Mailer options used for connecting to the email server and sending emails.

EMail Address

FROM Address - the email address from which the emails will be sent. Note: this address should not differ from User Name and Password described below.

Account Information

User Name - the user name of the email account to connect to SMTP server.

Password - the password of the email account to connect to SMTP server.

Mail Server

You can obtain the SMTP Server name and Port Number from your email provider.

SMTP Server - the url of SMTP server to connect to;

Port Number - the port number for sending emails;

Use SSL - enables SSL connection to the mail server.

Send Delay

Delay - a delay in minutes in case a server error occurs. Sometimes the server generates an error while sending emails. For example, if you are tring to send a lot of emails, the server replies that the number of outgoing emails exceeds the quota. If this occurs, Enigma Mailer will try to send emails upon the expiry of the number of minutes specified in the Delay field.


Template Panel

Here you can set up a template that will be used for automatic email generation.

The template consists of 4 parts (as an email itself): FROM, TO, SUBJECT and BODY fields. These fields can contain any static words and regular expressions that will be replaced with the information from the users database. The table below shows regular expressions and the values they will be replaced with.

Regular Expression | Description
%CUSTOMERCOMPANY% | Customer's company name
%CUSTOMERFIRSTNAME% | Customer's first name
%CUSTOMERLASTNAME% | Customer's last name
%CUSTOMERSTREET% | Customer's steet address
%CUSTOMERSTATE% | Customer's state/province
%CUSTOMERZIP% | Customer's ZIP or postal code
%CUSTOMERCITY% | Customer's city
%CUSTOMERCOUNTRY% | Customer's country
%CUSTOMERLANGUAGE% | Customer's language
%CUSTOMERPHONE% | Customer's phone
%CUSTOMERFAX% | Customer's fax
%CUSTOMEREMAIL% | Customer's email
%REGNAME% | Registration name
%REGKEY% | Registration key
%REGKEYCREATEDATE% | Registration key creation date
%REGKEYEXPIRATIONDATE% | Registration key expiration date
%REGKEYHARDWARE% | Registration key Hardware ID
%REGKEYLICNUM% | Registration key license number
%REGKEYPRICE% | Registration key price
%REGKEYREFERENCE% | Registration key reference numer
%REGKEYCOMMENT% | Registration key comment

Access to additional parameters

To access additional customer parameters, quote the Short Name value of the parameter with %CUSTOMER at the beginning and % at the end. For example, if the Short Name of the additional customer parameter is "login", the regular expression used to access its value in Enigma Mailer will be %CUSTOMERLOGIN%

To access additional license parameters, quote the Short Name value of the parameter with %REG at the beginning and % at the end. For example, if the Short Name of additional license parameter is "license", the regular expression used to access its value in Enigma Mailer will be %REGLICENSE%

Open button - open a template from a file.

Save As button - save the template to a file.

A template file is a simple xml file. You can find template examples in the "Email Patterns" folder of the Enigma Protector.

Generate Emails button - click it to automatically generate emails.

Note: the database from the Enigma Protector Registration Manager will be used for email generation. Emails will be generated ONLY if the registration record is marked as "Subscribed" and not "Stolen". If the registration record contains a stolen flag, the email will NOT be generated, irrespective of whether the record is subscribed.


Emails Panel

This panel displays the emails database. Outbox - emails prepared to be sent. Sent Mail - emails that have already been sent. Trash - deleted emails. To move emails from/to categories right-click your mouse and select the "Move to category" option. The "Delete popup" option deletes all emails in the selected category.

Send - click this button to send the prepared emails from the Outbox folder.


Bugs and limitations

There are the following limitations on The Enigma Protector usage:

  1. it does not support modules having anything like CRC checking (the only solution for such modules would be using Virtual Box feature, see more: Protecting Overlay and Self-test Applications);
  2. it does not support multi-layered protection, i.e. using The Enigma Protector together with any other kind of packer/protector;

If you find any errors in The Enigma Protector or in the protected modules, please, let us know! While sending a malfunction report, describe all actions that led the module to the malfunction, as it is important for us to be able to help you. Also, we will be grateful if you could send us the project file and the unprotected version of your program module!


Click here to generate registration key from project file


Registration Keys Generator! POST method

Enter the Registration Name
Enter Hardware ID
Enter Expiration Date
Enter Unlock Section