The Enigma Protector简介

Enigma Protector 简介

Enigma Protector 是专门设计用来为您的应用程序添加高强度保护的强大工具，支持以下类型的文件格式：

  • Win32 可执行文件 (*.exe);
  • Windows 屏幕保护程序 (*.scr);
  • 动态链接库 (*.dll);
  • 32位 ActiveX 控件 (*.ocx);
  • .NET 可执行文件 (*.exe).

这里的术语“保护”主要指两方面内容。首先，“先试用后购买”的共享软件保护方案（多数共享软件的发布方式）；其次，保护软件的机器代码不被破解和分析。可以看出，两种保护方式是不同的，但是是相关的，应用保护可以有效的保护软件开发者的经济利益和技术保密。稍后我们会谈到详细内容。

Enigma 的保护体系和购买因素

支持“先试用后购买”

几乎所有的商业软件都有用户密钥保护系统，软件开发人员需要为此开发不同的加密算法，但是很多情况下，这些算法的反破解和反穷举保护都很弱。我们推荐给您的“先试用后购买”概念支持系统提供了强大的注册密钥功能，并且为软件开发人员和客户交互提供了简单的方式。Enigma Protector 的密钥生成系统具有很高的保护强度，使用 512 位的 RSA 加密算法，破解者几乎不可能伪造虚假的注册密钥。我们同时还提供软件试用限制的控制功能，用户可以在一定的试用期内试用被保护软件的功能。过了这段试用期，软件将无法继续运行，要恢复软件功能，用户必须购买或注册。

保护软件的机器代码

每一个共享软件开发者都会有自己的软件产品被破解的问题，序列号、注册机以及破解版到处在网络上流传。这样“先试后买”的想法会被扰乱，共享软件市场秩序也会被破坏，对共享软件作者来说也会有收入的损失。我们推荐给您的机器代码保护方案会压缩和加密机器代码，极大的增加那些想非法使用和分析代码的破解者的破解难度，并且压缩后的文件可以减少空间占用和传输带宽。

初次使用 Enigma Protector 您可以阅读以下章节：

  • 开始使用
  • 新手指南

许可管理

Enigma Protector 配有专业的许可管理工具：

  • 注册管理器 用于存储并管理注册用户的授权信息。使用注册管理器，您可以很轻松的将用户的注册信息添加到内部数据库，并且可以创建/编辑这些记录。
  • 邮件管理器 通过数据库自动创建并发送 Email 给用户。例如，软件开发商通常需要将新版软件的更新信息发送给注册用户，使用 Enigma 邮件管理器，就可以轻松完成这项工作。

Enigma Protector 加密特性

Enigma Protector 拥有高级注册密钥生成方案：

  • 舒适的密钥创建和验证界面。 您不必到处搜索如何为客户创建安全的注册密钥，Enigma Protector 可以帮助您轻松创建使用 RSA 512-bits 加密算法的注册密钥！
  • Enigma API - 特殊的应用程序接口函数。 Enigma API 是一组特殊的函数集，用于被保护的文件和 Enigma 装载器之间的通信，主要用来为保护的文件添加注册功能和控制试用参数。
  • 硬件锁定密钥。 此特性帮助您生成仅供某一特定计算机使用的注册密钥！该注册密钥具有硬件锁定功能，仅在您指定的计算机上生效。
  • 时间限制密钥。 如果您需要限制注册版程序的使用时间限制，只需要创建具有时间限制功能的注册密钥！

Enigma Protector 拥有多种时间限制特性：

  • 试用次数、天数、日期和运行时间限制。 共享软件最主要的特点是“先试用后购买”，客户需要评估软件的工作特性，所以我们在展示共享软件功能的同时需要给软件加上运行时间的限制。
  • 系统时钟控制。 此特性用来控制系统时钟的回拨，帮助您避免不诚实客户带来的损失。

Enigma Protector 拥有多种加密特性来保护您的软件免遭破解：

  • 反调试器保护。 调试器是一种在程序运行过程中逆向代码的特殊工具，所有的逆向工程师都使用调试器来分析您软件的工作流程和保护方式。使用反调试器保护可以有效的防止程序运行时被调试器加载。
  • 校验和保护。 校验和是一种特殊数据，用来检查软件数据是否被修改。每一种破解（例如修改注册流程）都需要修改机器码，此时 Enigma Protector 就可以检测到原文件是否被修改，并提醒用户。Enigma Protector 不仅检查被保护文件的机器码，壳自身的机器码也同样会检测！
  • 设置启动密码。 也许有时候您只希望某一特定的用户组使用保护后的文件，为文件设置启动密码就是最安全的方案。
  • 附加特性。 检测同时运行的进程数量、文件名称和磁盘类型。
  • 高级输入表保护。 没有人会知道您导入了哪些 API 函数。
  • 校验外部文件。如果您的软件发行包除主程序外还包括其它文件，您可以使用这个特性来校验那些外部文件是否被修改。
  • 检测运行中的进程。通过黑名单方式来检测禁止运行的文件或进程，可以通过文件名、窗口标题或类等方式，通常用于检测调试器、屏幕捕获工具、监视工具等。
  • 检测已安装的服务。
  • 检测 Windows 版本。
  • 检测虚拟机软件、虚拟系统。如果保护后的文件在虚拟机里 (VMWare, Virtual PC etc) 运行，会自动结束进程。

Enigma Protector 还可以帮助您为您的软件添加一些漂亮的东西，而您无需添加任何代码：

  • 启动画面（闪屏）。 为程序添加启动画面，可以在程序启动时显示您指定的图片。


产品订购

如果您对我们的产品有兴趣并想订购EnigmaProtector，请访问 www.enigmaprotector.com 获取订购信息。不同许可的产品价格如下表所示：

产品名称 | 单机用户许可价格 | 企业用户许可价格
Enigma Protector 专业版 | 149 USD | 299 USD

注册用户将获得9个月的免费升级。

汇款方式

推荐使用以下支付方式
● Shareit (www.shareit.com)
● Western Union (www.westernunion.com)
● WebMoney (www.wmtransfer.com)

* 请您在完成汇款后及时将汇款信息通过电子邮件发送到：support@enigmaprotector.com。
* 如果您需要其他汇款方式，也请您通过上面的电子邮件联系我们。


技术支持

如果您在使用EnigmaProtector的过程中有任何问题，或您需要在下一版中增加某一特性，请联系我们 wang@enigmaprotector.com

如果您在使用EnigmaProtector的过程中发现问题，请确保您使用的是最新版的软件。您可以从 www.enigmaprotector.com 下载最新版的 Enigma Protector 。

您还可以从“常见问题”页面或我们的技术支持论坛查找您需要的信息。


程序预览

Enigma Protector 的一些主要特性的描述：

  • 项目细节
  • 输入参数
  • 高级输入
  • 输出参数
  • 注册特性
  • 检测选项
  • 保护特性
  • 虚拟文件
  • 虚拟机加密
  • 其他选项
  • 试用控制


项目细节

输入项目文件的名称和描述。这些文本框仅提供用来让您了解该项目文件的相关信息，您可以随时修改这些信息，并不影响程序的运行。


输入参数

Input
本节主题包含需要定义的重要参数。

  • 要保护的文件 - 要保护文件的文件名。
  • 程序文件的图标 - 您所选择的文件的图标。
  • 输入产品名称 - 软件产品的名称。注意，此信息用来创建部分保护参数，对于同一个文件请不要改变。
  • 输入版本信息 - 软件产品的版本信息。版本信息会和“试用控制”功能关联，请为每一版的软件产品填写版本信息。
  • 实际获取 - 从资源中读取产品名称和版本信息。
  • 文件信息 - 特殊的文件信息，包括文件类型和文件大小，以及 32 位 Windows PE 文件头的主要信息。


高级输入

允许选择其他需要保护的文件，点击“添加文件”按钮后选择需要添加保护的文件即可；取消保护的文件，请点击 [image] 按钮；如果选择输出其他文件名，请点击“输出文件”列再修改成对应的名字。

在主程序加密之后保护其他文件 - 如果勾选此项，主程序（输入参数处选择的文件）将首先受到保护，如果不勾选此项，将优先保护高级输入选项内的文件。


输出参数

输入保护后的文件名称 - 输入您想生成的文件名字，如果您勾选了“与输入文件相同”则生成同源文件一样名字的文件，若没选择备份文件，将直接覆盖源文件。

与输入文件相同 - 勾选了此项，保护后的文件名将与被保护文件同名，如果不选择备份将直接覆盖源文件。

不需要创建备份（.bak）文件 - 如果勾选此项或者，EnigmaProtector将不生成备份文件，本选项同样适用于高级输入版块。


注册特性

本节内容帮助您了解使用及存储注册密钥的相关特性。创建注册密钥请参见 密钥生成器 一节，注册密钥实例请参见 Enigma API 描述 一节。

点击以下链接获取更多详细信息。

  • 常规选项
  • 密钥特性
  • 注册信息存储
  • 硬件锁定
  • 使用硬件ID加密
  • 注册对话框
  • 密钥过期提示


常规选项

这里提供了一些与注册密钥使用相关的功能选项。

UNICODE授权方案 - 支持使用UNICODE注册授权系统，这将意味着：

  • Keys Generator 支持 unicode 生成注册；
  • Key Generator of License Manager 支持 unicode 生成注册；
  • 在基本的检查、存储和读取注册信息时，可以使用unicode支持 Enigma API 了；
  • CGI Keys Generators 支持使用unicode 来调用；
  • 密钥生成器使用 keygen.dll已支持unicode调用；

请注意：

  • 如果您修改新建了EnigmaProtector项目，密钥将发生改变；
  • ansi 的检查、存储和读取注册信息将失效；

注册后才运行 - 保护后的程序只有在成功注册后才可以运行。

使用加密常量加密应用程序 - 使用加密常量来加密程序时，EnigmaProtector将在KEY中生成部分代码，意味着用户必须输入了正确的注册码，程序才能解码并运行；如果注册码里没有包含相应的区间解码，而程序设置了区间加密（使用SDK加密区间），具有自校验功能的程序运行时候将暂停执行，自校验和保护请您参看校验和保护版块； 如果改版块设置了自校验以及显示提示信息，程序将在结束时候提示用户程序出错，出错原因可自行设置为“程序未成功解码”或“自校验失败”等。反之，如果没有勾选提示信息，保护后的程序出错将直接退出或保持暂停运行状态。

注册密钥类型/长度/方式：

注册密钥长度：可选择的有~ RSA 512/768/1024/2048/3072/4096，长度越大解码将越久，但是强度更大；实际应用中，512位保护就足够了。

提示: 每次选择此项内容，加密常熟/私钥/公钥都有可能发生改变，意味着您可能需要重新导出注册机。

注册密钥输出方式：

选择注册输出密钥的方式

提示:如果您改变此项内容，生成的注册码方式均改变，请参看举例。

参见 创建密匙 一节获取更多信息。


密钥特性

密钥特性可以方便您设计生成具有多方面约束的注册密钥，如您勾选了上述任何选项，使用注册机算号的时候，必须具备已勾选特征，如您选择了“只允许有过期日期的密钥”则生成注册密钥时候，需要设置密钥过期时间。

只允许有硬件锁定的密钥 - 只允许注册密钥锁定硬件码，即算号时候需要输入用户反馈来的硬件ID码来生成注册密钥；

只允许有过期日期的密钥 - 只允许包含有过期日期的注册密钥；

只允许在日期之后需注册的密钥 - 只允许指定日期后需要注册密钥；

只允许在日期之前需注册的密钥 - 只允许指定日期前需要注册密钥；

只允许运行次数限制的密钥 - 只允许包含有运行次数限制的注册密钥；

只允许运行日期限制的密钥 - 只允许包含有运行日期限制的注册密钥；

只允许运行时间限制的密钥 - 只允许包含有运行时间限制的注册密钥；

只允许有总时间限制的密钥 - 只允许包含有总时间限制的注册密钥；

只允许有国家锁定的密钥 - 只允许包含有国家锁定的注册密钥；


硬件锁定

本节内容介绍选择注册密钥的锁定方式。Enigma Protector 拥有一系列将注册密钥锁定到个人计算机的特性，锁定的密钥只能在一台计算机上工作。关于使用函数 EP_RegHardwareID 创建硬件锁定注册密钥的详细用法，您可以在 Enigma API 描述 一节找到，或者参见 密钥生成器 一节。

锁定方式：

  • 驱动器卷标序列 - 硬盘系统分区的序列号；
  • 系统卷标名称 - 硬盘系统分区的名称；
  • 计算机名称 - 计算机名称（当前操作系统登录用户名称）；
  • CPU 类型 - CPU 类型；
  • 主板 - 主板 BIOS 信息；
  • Windows 序列号 - 已安装 Windows 系统的序列号。
锁定方式 | 不同操作系统是否相同 | 格式化硬盘后是否相同 | 用户能否修改 | 不同计算机是否相同
驱动器卷标序列 | 相同(*1) | 不同 | 可以(*4) | 极少
系统卷标名称 | 相同(*1) | 用户决定(*2) | 可以 | 极少
计算机名称 | 用户决定 | 用户决定(*3) | 可以 | 极少
CPU类型(*5) | 相同 | 相同 | 不可以 | 经常
主板BIOS(*5) | 相同 | 相同 | 不可以 | 极少
Windows序列号 | 不同 | 相同 | 不可以 | 极少
硬盘序列号 | 相同 | 相同 | 不可以 | 不同

(*1) 这种情况会发生在操作系统安装在同一个硬盘分区上。

(*2) 这种情况一般是用户格式化磁盘后使用了和先前相同的卷标名称。

(*3) 格式化系统分区意味着需要重新安装操作系统，这时用户可以选择使用和原系统相同的计算机名称。

(*4) 用户只能通过第三方的特殊软件修改。

(*5) Windows NT 系统 (Windows 2000, Windows XP, Windows Vista) 需要管理员或管理员组权限。

只允许更换 - 非常实用的一个功能，对应的硬件/序列号允许用户更换的次数，如您可以允许用户更改2次硬盘序列号，当用户仅仅更换硬盘时候，原来注册密钥仍然适用。


注册信息存储

本节向您说明如何存储注册密钥

The Enigma Protector 支持两种方式存储注册密钥，使用系统注册表或指定文件类型，同时还支持两种方式一起存储使用；

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

License file without encryption

with Encrypt Registration Information feature

License file with encryption

Disable copying of the registration information to another PC (the registration information will be encrypted with the user's Hardware ID) - this option allows to encrypt registration information also with the user's hardware id. If the registration information will be encrypted with hardware id, the registry item or with with registration information will be working and valid only on the PC where it was created. If user will attempt 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 hardware id will be changed on the user's PC, and even if the Allow Hardware Changes is enabled, the registry item or file with registration information will become invalid and application will require registration again;
  • Do not use this feature to lock registration information to particular PC. To lock license to particular PC you have to use Hardware Lock panel and generate the registration keys with user's hardware id.

一、使用系统注册表存储注册密钥

请注意，如果单独选择系统注册表存储注册密钥，重新安装系统后被保护的软件会重新要求您输入注册密钥；

注册表根目录 - 请选择注册密钥的存储位置，比如下注册表根目录

  • HKEY_CURRENT_USER
  • HKEY_LOCAL_MACHINE

注册表相对路径 - 修改此项内容，被保护的软件在正确注册时将生成对应的注册表项内容，例如，您设置“注册表根目录”和“注册表相对路径”分别为“HKEY_CURRENT_USER”和“\SOFTWARE\YourCompany\”时，被保护的软件在正确注册后将会自动在系统注册表写入如下内容

Registration name（注册用户名） - HKEY_CURRENT_USER\SOFTWARE\YourCompany\Name
Registration key（注册密钥值） - HKEY_CURRENT_USER\SOFTWARE\YourCompany\Key

二、使用指定文件类型存储注册密钥

使用文件存储 - 勾选此项将使用指定文件类型存储注册密钥。

文件存储根目录 - 选择更改此项内容将改变注册密钥的存储位置；

  • %DEFAULT FOLDER% - 指注册密钥将生成在与被保护程序同目录里；
  • %SYSTEM FOLDER% - 指注册密钥将存储在Windows系统的安装目录，如C:\；
  • %WINDOWS FOLDER% - 指Windows系统安装的文件目录，如C:\WINDOWS\SYSTEM\；
  • %My Documents FOLDER% - 指注册密钥将存储在“我的文档”目录里；
  • %My Pictures FOLDER% - 指注册密钥将存储在“我的图片”目录里；
  • %Program Files FOLDER% - 指注册密钥将存储在“程序”目录里；
  • %Program Files\Common FOLDER% - 指注册密钥将存储在“Program Files\Common folder”目录里；
  • %AllUsers\Documents FOLDER% - 指注册密钥将存储在“All Users\Documents folder”目录里；
  • %History FOLDER% - 指注册密钥将存储在“History（历史）”目录里；
  • %Cookies FOLDER% - 指注册密钥将存储在“Cookies”目录里；
  • %InternetCache FOLDER% - 指注册密钥将存储在“InternetCache（浏览器缓存）”目录里；

文件存储相对路径 - 修改此项，被保护程序在正确注册后将生成相应的注册文件；例如您想在某“文件存储根目录”下的“notpad”生成存储注册密钥的文件为“secret.dat”，则输入“\notepad\secret.dat”，当然这个注册文件后缀是任意的，如*.ini、*.txt等；

设置文件属性 - 允许设置生成的注册密钥存储文件的属性，如“存档/只读/隐藏/系统”。

三、两者同时使用来存储注册密钥

两者都用 - 勾选此项再分别设置注册表存储位置、文件存储位置，被保护程序将在正确注册后分别写注册表和指定文件来存储注册密钥。


使用硬件ID加密

此项功能允许使用硬件ID来加密/保护您开发的程序，并且您的程序将仅允许在指定硬件ID的计算机上，经过这样加密/保护的程序基本上不能被脱壳破解。

这是一个非常实用的功能，当被保护的程序运行在用户计算机上时，硬件ID将会显示并提示用户发送硬件ID给您以方便使用该硬件ID计算/加密注册密钥。

如果被保护的程序运行在非指定硬件ID环境下，程序将退出或根据试用条件进行弹出信息框警告用户或者静默退出。


注册对话框

这一特性允许您在对主程序不做任何修改的前提下，添加自定义的注册对话框。Note, this Registration Dialog can be also called by mean Enigma API function EP_RegShowDialog.

使用自定义注册对话框 - 激活自定义注册对话框显示。

过期时显示 - 仅在保护后的程序过期以后才显示注册对话框。

未注册时显示 - 被保护程序未注册的情况下将显示自定义注册对话框。

密钥有效时显示消息 - 当用户成功输入正确注册信息时显示消息；点击“编辑消息”按钮自定义消息内容。

密钥无效时显示消息 - 当用户未输入或输入错误的注册信息时显示消息；点击“编辑消息”按钮自定义消息内容。

窗口设计 - 点击此按钮设计自定义注册对话框样式。请点击链接 注册窗口设计器 了解更多内容。


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 http://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 appear 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 a 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 a standard Windows edit control on a form. Edit controls are used to retrieve text that users type. Edit controls can also display text to the user. Edit 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 a standard Windows group box, used to group related controls on a 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 a 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 to a 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 TLabel to a hyper link 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 a 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 a 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 a 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 to desing a custom registration dialog, apply own styles and window controls configuration. Here you are able to put own controls on the form and define registration events. Registration dialog designer contains 3 forms:

Components Palette

Contains a set of available components that you can put on the registration form. Main menu of the form allows to show Object Inspector and Designed Form. Description of components' properties see below. To place component on the registration form click on the necessary component on the Component Palette and then click on the Registration Form to put component at necessary position.

There are following controls available:

  • TForm - the registration form itself;
  • TEdit control allows to enter registration name and key, show a hardware id or contain any user text;
  • TLabel control allows to show any text;
  • TMemo control is very similar to TEdit control but may have multiple lines of the text;
  • TGroupBox control allows to group few controls on the form and also may contain a header text;
  • TButton is a push button control that allows manage users actions like registering, closing application or continue execution;
  • TSpeedButton control is very similar to TButton, but also may contain an image;
  • TLink control allows to open a browser window, default email client, open some text file in the external window or open/executed any other file;
  • TImage control allows to draw a simple geometric shape on the form;
  • TShape control allows to place an image to the form;
  • TBevel control allows to create beveled boxes, frames, or lines;
  • TPanel control allows to put an empty panel on a form. Panels have properties 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 to load registration form from external file;
  • Save to File - allows to save current registration form to external file;
  • Exit - exit designer;

Edit menu

  • Cut - cut selected control(s) to clipboard;
  • Copy - copy selected control(s) to clipboard;
  • Paste - paste copied/cutted control(s) from clipboard to 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;
  • Aligb to Grid - align selected control(s) to the grid;

View menu

  • Object Inspector - show Object Inspector;
  • Designed Form - show designing registration form;

Registration Form

This is a form that will be shown to the users to allow enter registration information. Click onto the necessary component that is placed on this form and it's properpies will be shown in the Object Inspector. To delete component from the form click right mouse button at the component and choose Delete item in the appeared popup menu, or click Del button (Note: registration form could not be deleted).

Right mouse click shows registration form popup menu.

  • Cut - cut selected control(s) to clipboard;
  • Copy - copy selected control(s) to clipboard;
  • Paste - paste copied/cutted control(s) from clipboard to 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;
  • Aligb to Grid - align selected control(s) to the grid;

Object Inspector

There are shown selected component properties. Navigate to 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;


注册密钥过期提示

通知用户密钥将要过期，只在设置密钥有效期的情况下有效。

显示密钥过期提示 - 允许显示密钥过期提示消息。

开始显示密钥过期提示的天数 - 指定密钥过期前多少天开始提示用户，点击 消息编辑器 获取更多信息。


检测选项

本节内容帮助您添加一系列检测选项，如文件内容改变、内存补丁等。

点击以下链接获取更多详细信息。

  • 反调试器保护
  • 校验和保护
  • 启动密码保护
  • 文件名保护
  • 磁盘驱动器保护
  • 进程实例数量限制
  • 用户区域限制
  • 外部文件
  • 运行中的进程
  • 已加载的驱动
  • 已安装的服务
  • Windows 版本
  • 虚拟机软件
  • 用户权限


反调试器保护

启用反调试器保护--检测您的运行环境是否有调试器存在。调试器是一种在程序运行过程中逆向代码的工具，例如 SoftIce, OllyDbg, TWD 等。

如果被保护的程序运行时发现有调试器存在，程序会拒绝运行。

进程结束时显示提示消息--如果激活此选项，发现调试器时会有提示消息。要编辑提示消息的内容请点击“编辑消息”按钮。如果未激活此选项，程序终止时不会有任何提示消息。


校验和保护

启用校验和保护 - 用来检测文件内容是否被修改。文件内容的改变是指文件启动和运行时源代码和内存代码被修改，文件内容的改变可以是被破解或病毒引起的。

如果被保护的程序启动时发现自身的文件内容或内存被修改，程序会拒绝运行。

运行时文件完整性检测 - 检测程序运行时内存代码是否被修改。多数程序运行时都有一部分具有只读属性的代码被映射到内存中,这项检测会持续监视内存的只读代码并检查校验和。如果发现任何修改，被保护的程序会立即结束自身进程。内存代码的修改只能是由于破解或病毒引起的。

进程结束时显示提示消息 - 如果您想通知用户程序被修改以及进程将要结束，请激活此选项。要编辑提示消息的内容请点击“编辑消息”按钮。如果未激活此选项，程序终止时不会有任何提示消息。


启动密码保护

使用密码启动 - 激活启动密码校验。使用此特性后，用户启动程序时会看到一个要求输入密码的对话框。只有密码正确，程序才会继续运行，否则会弹出提示消息然后自动退出。编辑不同的提示消息请点击 编辑消息 按钮。您可以设置任意数量的密码，并为每一个密码添加注释。注释是用作提示的字符串，并不影响程序的运行。

总是询问密码 - 程序每次启动都会询问密码；

只在第一次询问密码 - 只要用户填入正确的密码，以后就不会再询问；

按天数询问 - 即使密码正确，程序也会在设定的天数后再次询问；

星号显示密码 - 如果激活此选项，密码将会用 "*" 符号显示，否则为明文显示；

允许更换密码 - 允许用户更换启动密码。注意，此特性在同一台计算机上只支持更换一个密码。例如，用户使用了两个启动密码，并决定更换第一个启动密码 - 这样可以实现；如果他决定更换第二个密码，同样会成功，但是第一个密码会变回原来的值。

需要添加或编辑密码，请参考下面的图示


文件名称

启用文件名称保护 - 检测程序文件名是否被改变。使用这项功能可以阻止程序文件被改名。

程序启动时载入器会检测程序文件名（填写在“原文件名称”文本框中），如果与原文件名称不符，程序将拒绝运行。

“实际获取”按钮 - 从“输出文件名”读取并填入“原文件名称”文本框。

进程结束时显示提示消息 - 如果您想通知用户文件名称被改变，请激活此选项。要编辑提示消息的内容请点击“编辑消息”按钮。如果未激活此选项，程序终止时不会有任何提示消息。


磁盘驱动器保护

启用磁盘类型检测--当您希望被保护的程序仅允许运行在指定驱动器上（硬盘，光盘等）时，可以选择此选项内容

启用此选项后，被保护程序启动时候发现运行环境不是指定的驱动器时，将直接退出。

可供选项:

  • 软驱(可移动软盘驱动器).
  • 硬盘驱动器.
  • 网络驱动器.
  • 光盘驱动器.
  • 闪存驱动器.

进程结束时显示提示消息 - 勾选此项后，当被保护程序运行在非指定驱动器环境时，将会弹出信息框提醒用户注意；修改提示内容，请点击“编辑消息”按钮；如果不勾选此项，被保护程序将直接退出而没有任何提示。


进程实例数量限制

启用进程实例数量限制 - 用来限制同时运行的程序进程数量。

允许的进程实例数量 - 设定允许同时运行的程序进程的最多数量。

结束进程 - 如果勾选此项，运行被保护程序如果超过进程数量限制，被保护程序将退出。这是一个非常实用的功能，具体请参看SDK EP_CheckupCopies Enigma API应用举例。

如果进程实例数量超标，显示提示消息 - 如果允许同时运行的进程数量超过了您预先设定的数值，程序会拒绝运行，并显示提示消息。要编辑提示消息的内容请点击"编辑消息" 按钮。

程序启动时，Enigma 载入器会检查当前正在运行的拷贝进程数量，如果该数量超过了预先定义的数值，程序会拒绝运行。


用户区域限制

锁定用户允许运行的区域 - 允许您锁定用户可以运行的国家/区域。如果保护后的程序在未选择的国家运行，程序会拒绝运行，并显示提示消息（前提是您激活了“进程结束时显示提示消息”选项）；

选择所有 - 选择国家/区域列表中的所有国家/区域；

不选所有 - 取消选择国家/区域列表中的所有国家/区域；

反向选择 - 反向选择已选的条目。

进程结束时显示提示消息 - 如果激活此选项，进程结束时会有提示消息。要编辑提示消息的内容请点击“编辑消息”按钮，如果未激活此选项，程序终止时不会有任何提示消息。


外部文件

校验外部文件 - 校验您的软件发行包的其它文件是否被修改。当您将文件添加到列表，定义好要检测的参数之后，如果保护后的文件启动时发现任何一个参数改变了，程序将自动终止。点击文件列表，

“动作” - 您可以看到可用的检测参数，常用的有 :

  • 取消并在列表内删除保护文件
  • File checksum - 校验整个文件的内容
  • File Version - 校验文件的版本号（仅支持 Win32 可执行文件）
  • File Size - 校验文件大小
  • File Date - 校验文件的创建日期
  • File Attributes - 校验文件属性

“基本相对路径” - 定义了要校验的文件的基本相对路径，相对于保护后文件所在的目录。

“相对路径” - 定义了要校验的文件的相对路径，相对于“基本相对路径”而言。

例如：您保护了一个可执行文件，并且需要校验 Examples 子目录下的文件，您需要：添加一个文件到列表，选择“基本相对路径”为 %DEFAULT FOLDER% ，然后在“相对路径”填写子目录的名称 Examples.

添加文件 - 点击这个按钮添加文件到列表。

进程结束时显示提示消息 - 如果 Enigma 外壳检测到外部被修改了，程序会显示一条信息并结束进程。编辑提示消息请点击 编辑消息 按钮。


运行中的进程

校验运行中的进程 - 这个特性允许您添加敌意软件到进程黑名单，这些敌意软件将不会与保护后的程序同时运行。工作原理：保护后的程序启动时，Enigma 外壳会枚举正在运行的进程，并检测是否是黑名单里的进程；如果发现黑名单里的进程，Enigma 外壳会立即结束它。举例来说，这一特性可以检测 OllyDbg（调试器）、SnagIt（抓屏工具）、文件和注册表监视工具等。您可以修改不同的检测参数：

“动作” - 您可以看到可用的进程检测参数，常用的有：

  • Delete process from the list
  • File Name - 检测运行中的进程名称
  • Window Text - 检测进程窗口标题（注意：应用程序运行时窗口标题有可能会改变）
  • Window Class - 检测窗口的类

“文件名称” - 定义要搜索的进程名称。

“窗口标题” - 定义要搜索的窗口标题。

“窗口类” - 定义要搜索的窗口类。

添加进程 - 点击这个按钮添加进程到列表。提示：您可以添加任意进程到黑名单列表，并且可以随意编辑。弹出的窗口只是显示当前系统中正在运行的进程。

校验进程的间隔时间（单位：秒） - 如果勾选了此项，被保护程序运行时候将按您设置好的间隔秒数来校验进程；如果您校验的进程较多，我们建议间隔秒数为10秒以上，较短的间隔时间将占用较多CPU资源。

进程结束时显示提示消息 - 如果 Enigma 外壳检测到匹配黑名单的进程，程序会显示一条信息并结束进程。编辑提示消息请点击 编辑消息 按钮。


已加载的驱动

检测已加载的驱动 - 检测系统中是否已安装预定义的驱动程序。很多逆向工具都使用驱动来完成某些工作，检测已加载的驱动可以发现这些逆向工具。驱动的检测不只在被保护的文件启动时，而是在整个运行过程中都检测。

点击“添加”按钮添加驱动；点击“驱动名称”列下对应的名字可修改名称；点击图标 [image] 可取消加载对应驱动。 进程结束时显示提示消息 - 如果 Enigma 外壳检测到匹配黑名单的驱动，程序会显示一条信息并结束进程。编辑提示消息请点击 编辑消息 按钮。


已安装的服务

检测已安装的服务 - 注意：此特性不支持 Windows 95, 98 and ME 系统，并且需要管理员权限。这个特性允许您添加敌意服务到黑名单，这些敌意服务将不会与保护后的程序同时运行。您可以修改不同的检测参数：

“动作” - 您可以看到可用的服务检测参数，常用的有：

  • Delete service from the list
  • Check Name - 检测服务名称
  • Check Display Name - 检测扩展的服务名称

“名称” - 定义要搜索的服务名称。

“显示名称” - 扩展的服务名称。

添加服务 - 点击这个按钮添加服务到列表。提示：您可以添加任意服务到黑名单列表，并且可以随意编辑。弹出的窗口只是显示当前系统中已经安装的服务。

进程结束时显示提示消息 - 如果 Enigma 外壳检测到匹配黑名单的服务，程序会显示一条信息并结束进程。编辑提示消息请点击 编辑消息 按钮。


Windows 版本

检测 Windows 版本 - 这一特性允许您选择保护后的程序拒绝运行的 Windows 系统。如果 Enigma 外壳检测到当前的 Windows 版本不符合要求，进程会自动结束。

如果您需要添加其它版本的 Windows 系统，请联系我们。

进程结束时显示提示消息 - 如果 Enigma 检测到当前的 Windows 版本被拒绝，程序会显示一条信息并结束进程。编辑提示消息请点击 编辑消息 按钮。


虚拟机软件

检测虚拟机软件 - 检测保护后的程序是否运行在虚拟机。如果文件在虚拟机里运行，会自动结束进程。

如果您需要检测其它的虚拟机软件，请联系我们。

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

进程结束时显示提示消息 - 如果 Enigma 外壳检测到文件是在虚拟机里运行，程序会显示一条信息并结束进程。编辑提示消息请点击 编辑消息 按钮。


权限设置

有些应用程序（或程序的某些功能）需要高用户权限，Windows NT 系统支持两种用户帐号：管理员账号和受限的用户帐号。

检测管理员权限 - 检测保护后的程序运行的帐号是否具有管理员权限。如果是受限帐号，保护后的程序将不会启动。注意：Windows 95/98/ME 系统的用户总是具有高权限。

进程结束时显示提示消息 - 如果您需要通知用户提升登录用户的权限，可以激活此选项。编辑提示消息请点击 编辑消息 按钮。如果禁用此选项，进程结束时不会有任何通知。


保护特性

本节内容包含有一系列可以有效增加破解难度的保护特性。

点击以下链接获取更多详细信息。

  • 欺骗文件分析工具
  • 保留原文件大小
  • 额外的资源保护
  • 高级输入表保护
  • WinAPI 重定向
  • 模拟 WinAPI 功能
  • Inline Patching
  • 加密字符串


欺骗文件分析工具

此选项提供了欺骗 PEiD 之类的文件分析工具的功能。

Enigma Protector 在程序入口处插入一些可以欺骗文件分析工具的伪装代码。

区段名称 - 放置载入器代码的区段的名称，最多 8 字节长。

入口伪装为 - 定义用来欺骗文件分析工具的伪装代码的类型，可以选择分析工具识别的编译器类型。如果您认为没有必要伪装，可以将此选项设置为 "None" 。

注意：对于 Visual Basic 编译的程序使用 "Microsoft Visual C++" 伪装方式可能会引起未知错误。


保留原文件大小

启用保留原文件大小功能 - 允许您被保护过的文件保存为和原文件一样的大小。对于那些新手破解者，这项功能可以帮助隐藏保护工具。

备注：如果保护后的文件比原文件大，这项功能会被忽略。

Enigma Protector 仅仅是往被保护的文件中写入一些字节，使保护后的文件等于原文件大小。


额外的资源保护

使用额外的资源保护 - 使用附加的特性保护资源。这项功能会压缩和加密所有资源（排除在“压缩选项”/“压缩方式”面板中定义的资源）。这项功能可以有效的隐藏资源，防止被 ResHack, Restorator 资源修改工具读取。如果此选项被禁用，所有的资源都可以被看到。


高级输入表保护

启用高级输入表保护 - 对输入表的高级保护。这项功能会在内存中删除输入表，Enigma Protector 会在源代码中搜索输入表入口，并直接调用导入的功能。


WinAPI 重定向

提供了对系统链接库文件的重定向功能。

程序启动后，载入器检测系统链接库的内容并重定向被保护程序的输入表调用的 WinAPI 。同时，这部分 WinAPI 函数的功能已经被模拟，也就是说，这部分模拟的 WinAPI 函数功能同样可以使用。


模拟 WinAPI 功能

重定向一些 WinAPI 功能，使用 Enigma 内部函数模拟。Enigma 的内部函数可以完全模拟系统 WinAPI 的功能，所以并不影响程序的可使用性。使用这项功能可以有效的防止被保护的程序被破解。

请注意，如果您开发的程序使用了Enigma API，这个功能建议勾选上。


内联补丁

启用内联补丁保护，是一项使用线程保护的高级保护方法。如果被保护的程序发现保护线程有所改变，程序将终止运行而无任何提示。

工作原理：当被保护的程序运行时，将使用保护线程的方式启动程序（保护线程的数量您可以设定），每条线程将分别检测被保护程序（检测延时的间隔您可以设定）

保护线程数量 - 设定保护线程的数量，我们不建议仅仅设置保护1个线程，建议输入3-5个，最大不能超过15个。请注意：过多的线程保护数会占用较多CPU资源。

检测延时 - 您可以设置检测线程间隔的延时时间， 我们不建议您输入太大的延时值，因为太大的数值没有实际保护意义，但是太小的延时值会占用较多CPU资源。请多尝试设置几次，再选用较为合适的数值。


Resources Protection

Resources Protection allows to select types of resources in the executable file that will be protected. All resources in the file are being 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 an ICON resources, default icon is displaied with the file is shown in the file explorer. Note, 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, if any of two above options are enabled that means VERSION resources are protected, then the file version/information will not be shown in the properties dialog. Current option is recommended for most files.

Use first two options only if you exactly need protection of ICON and VERSION resources.

Note, following resources are not being protected also: STRINGS, MANIFEST, 'TYPELIB', 'REGISTRY'.


加密字符串

加密字符串 功能用来隐藏敏感的字符串信息。通常情况下，应用程序使用字符串来和用户沟通，但是字符串明文对破解者可见是很危险的。例如，软件开发者经常放置“注册码无效！”之类的确认信息，这样破解者就可以尝试找到调用这个字符串的代码，进而逆向注册流程。通过加密，您可以隐藏这些“危险的”字符串，只在使用的时候才提取。Enigma Protector 不会在程序工作时将字符串存储到进程内存，只在使用的时候才提取。要提取加密的字符串，您需要使用 Enigma API 函数 EP_ProtectedStringByID 或 EP_ProtectedStringByKey.

要添加/编辑/删除列表内字符串，可直接在列表中修改。

可以通过两种方式来定义字符串加密：

  • ID - 唯一的整数值；
  • Key - 任何唯一的字符串。

您可以修改 ID 和 Key 的值，但是需要注意的是，这两个值对于列表中所有字符串来说都必须是唯一的。Enigma Protector 默认会自动为每一个字符串创建唯一的 ID 和 Key 值，您可以保留这些自动创建的值。

要获取加密字符串的 ID 请使用 EP_ProtectedStringByID API 函数，或 EP_ProtectedStringByKey 函数来获取 Key 值。


虚拟文件打包系统

使用虚拟文件打包系统，您可以把开发程序时使用到的配套文件，如DLL/OCX等一起打包保护到一个EXE文件里，被保护的程序运行时候可以直接调用虚拟文件里的DLL/OCX等文件，而不必释放到用户磁盘中。点击下面链接了解更多内容：

  • 虚拟文件打包系统


虚拟文件

激活虚拟文件打包系统 - 激活虚拟文件打包系统后，您可以在开发的程序中打包加入多种类型的文件，保护后只生成一个文件。如果您在保护文件后删除列表内所有文件，则被保护文件照样正常运行而不受影响。虚拟文件打包系统支持打包多种类型文件，如txt、dll、avi、bpl、mp3、ocx（被保护程序如果需要调用虚拟文件中的dll/OCX等控件，dll/ocx控件将自动在用户系统中注册）等。

Warning: it is not recommended to use Virtual Box feature for protecting of Dynamic Link Libraries (DLL) files. Only DLLs that are calling once at main executable file start and never freed while application is working can be protected with Virtual Box. DLL files that are being called/freed multiple times per one session should not use Virtual Box, because it may cause application crash.

允许从任何目录加载 - 有时候您开发的程序需要在不同的目录里调用文件，勾选此项后，Enigma将支持从任何目录加载您需要打包进虚拟文件系统的文件。

退出时删除文件 - 如果您选择了"Always Write to Disk（运行就释放到磁盘）" 或 "Write if not Present（不存在就释放到磁盘）"，被保护的程序在退出时候就会删除之前释放到磁盘的文件。

压缩文件 - 激活此项后，虚拟文件打包系统会先把文件压缩后打包，不是必须的时候，不建议激活此项，因为那样会消耗更多的内容来解压文件，建议按原来文件大小打包。

点击“添加文件”或“添加文件夹”来添加需要打包的文件，所有功能菜单也可以单击右键实现。如：

  • 添加文件 - 每次可以添加进列表多个文件，每个文件将会按列表内文件所属被准确地打包好；
  • 添加文件目录 - 支持添加一个文件目录，即一个文件夹里的内容排列将按原来对应文件/子目录一起打包进来；
  • 新建文件夹目录 - 支持在列表中新建立一个文件夹目录。

如果想删除列表内文件或文件夹，请选择后点击删除按钮或按键盘“Del”键。

如果想修改列表内文件/文件夹属性/名字，请选择后单击“编辑”按钮，或者直接双击，编辑文件的对话框将弹出，具体请参看下图。

文件地址 - 显示出实际被打包文件地址，这个文件必须真实存在，点击“Browse（浏览）”按钮改变选择文件。

虚拟地址 - 把被打包文件转换成虚拟文件系统地址，如：

  • %DEFAULT FOLDER% - 被保护程序根目录；
  • %SYSTEM FOLDER% - Windows 系统安装目录，如System32 (WinNt) 或 System (Win9X) ；
  • %WINDOWS FOLDER% - Windows 安装目录；
  • %My Documents FOLDER% - “我的文档”目录；
  • %Program Files FOLDER% - “程序”目录；
  • %Program Files\Common FOLDER% - “程序”目录下的“Common”目录，即“Program Files\Common folder”；
  • %AllUsers\Documents FOLDER% - 即对应系统的“All Users\Documents folder”目录；
  • %History FOLDER% - “历史”文件夹；
  • %Cookies FOLDER% - “Cookies”文件夹；
  • %InternetCache FOLDER% - “Internet”缓存目录。

例如：

  • %DEFAULT FOLDER%\mydll.dll，表示“mydll.dll”将与被保护程序同在一目录中；
  • %DEFAULT FOLDER%\data\intro.avi，表示该文件将在被保护程序目录下的“data”文件夹中；
  • %SYSTEM FOLDER%\key.dat，表示该文件将在系统文件夹中，而且名字定位“key.dat”，如“c:\Windows\System32\”；
  • C:\myfile.key，表示该文件将在C盘目录下，名字为myfile.key。

注册ActiveX（COM）- 激活此选项，Enigma将尝试在文件运行时像ActiveX（COM）一样进行系统注册。

虚拟保护方式 - 被保护的文件虚拟保护方式，有以下选项：

  • Never Write to Disk- 被虚拟文件打包系统保护的文件永远不写入磁盘，但同样支持被您开发的程序所调用；
  • Always Write to Disk - 被虚拟文件打包系统保护的文件在被保护的主程序每次运行时都释放至磁盘；
  • Write if not Present - 如果磁盘上没有该文件，虚拟打包文件系统将释放该文件至磁盘。

Overwrite File Date/Time - 覆盖文件时间/年、月、日，激活此选项后，文件覆盖后将按设定好时间设置属性；

Overwrite File Attributes - 覆盖文件属性，激活此选项后，文件覆盖后将按设定好文件属性设置，如存档/只读/隐藏/系统属性。


Virtual Machine

Virtual Machine is a modern virtualization technology that allows to protect parts of the assembler sourse code of your module. Main idea of virtualization is converting original assembler code (which is well known for reverse engineers) to the PCODE - special programming language known only for Enigma Protector. When protected application requires to run virtualized code, the PCODE will be run on the internal Virtual Processor. Virtual Machine is very useful feature that allows to make reverse engineering/ analysing of the protected module very complex, our recommendation - using virtualization technology as much as possible. Also, note that not all code parts/functions should be virtualized. If the part of code or function executes too much times, it is not recommended to virtualize it, otherwise it slows down the work of your application and increase CPU loading. The better places for virtualization are parts of verifying registration code, trial control routines, cryptographic algorithms, in short, all the weak places that should not be reversed/cracked/analysed.

There are few ways the virtualization technology could be implemented:

  • by means VM Markers. If you are software developer, have the sources code of your application and is able to compile it, then the VM Markers is the better and recommended way to apply virtualization;
  • by using MAP file (MAP file - contains a list of functions with their addresses, it has same name as an input file choosen on Input Panel but have a .map extension. MAP file allows accurate analysing of the input file), selecting necessary functions. This is also a choice for software developers who are able to compile modules and generate MAP files. To learn more how to create MAP files for different development IDEs, see Making Of the Map File. Note, MAP file should be placed in the same folder with an input file and it should have same time span as an input file name. See Functions Selecting;
  • third way, if you are not software developer and can't use two above methods then you may simply click Select Functions button and Enigma Protector will try to analyse the input file and find all functions that are possible to virtualize. Remember, this way is not so stable as a two previous, so you have double check workability of the protected modules. See Functions Selecting.

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 marker will be just executed;
  • for Delphi developers, the MAP file compiled with Delphi may contain a set of functions with the same names but different addresses. Enigma Protectors stores selected functions by the name in the project file. After loading of project file, the only first appeared function with necessary name will be selected;

Follow the links below for more information.

  • File Entry Point
  • Functions Selecting


File Entry Point

File Entry Point

File Entry Point is a special function, starting with that the execution of any executable file begins. The file entry point function runs only one time per execution before any other code is executed.

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


Functions Selecting

There is shown a list of functions names selected for virtualization. To change the list, click Select Functions button. The below windows with the possibility to select functions should appear. Note, if you have a MAP file for the Input file then the list of functions will be shown, otherwise, Enigma will try to analyse file itself and the functions names will be represented with their addresses.

Selecting Functions

Select necessary functions for virtualization by checking them out. The information field at the bottom shows disassemble listing of selected function. For function coloring see below, Simulating topic. Right click on the list to show a popup menu.

Functions Selecting Menu

  • Go To - First Selected - allows to scroll a list to the first checked function;
  • Go To - Last Selected - allows to scroll a list to the last checked function;
  • Go To - Previous Selected - selectes the previous checked function;
  • Go To - Next Selected - selectes the next checked function;
  • Go To - List Beginning - scrolls the list to the beginning;
  • Go To - List End - scrolls the list to the end;
  • Select All - checks all functions in the list;
  • Deselect All - unchecks all functions in the list;
  • Invert Selection - checks unchecked and unchecks checked functions;

Accurate Selecting

Accurate selecting allows few tools for easier navigation through the list of functions and their selecting.

Enter Filter Expression - enter the text to sort selected functions. Only functions contained entered text will be shown after Apply button click. This tool is very useful when only members of particular class should be selected, just enter the class name, click Apply button and only members of this class will be shown.

Multiple Select - allows select and deselect a range of functions.

Show Functions - allows to show only Selected or Not Selected functions, or both.

Right click on the list to show a menu.

Accurate Selecting Menu

  • Go to Disassembly - allows quick navigation to Functions Selecting tab, for viewing disassemble listing of the selected function

Simulating

Simulating allows to estimate how many times selected functions are executing in your application. While simulating Enigma Protector executes input file entered in Input Panel, inserts some counters into executed processes that allows to count number of times particular function had been executed. Enigma Protector reads counters each second while application is working.

Click Start Simulating button to start simulating process. To stop simulating close executed application or click Stop Simulating button. If your application requires Command Line for some purposes, you enter this.

Note, this feature does not work with dll (COM/ActiveX etc) files, only exe files are supported.

After simulating you may uncheck highly used or unused functions. But, unselecting these functions is not a rule, just an advice, if you think the functions should be virtualized, there is no difference how many times it had been executed while simulating. Also note that virtualization of highly used functions may slows down work of your application and increase CPU loading, and virtualization of non used functions may also be dangerous because there is no way to check out workability selected functions after protection.

Functions coloring:

  • Gray color - Enigma Protector is not able to simulate execution of this function and know how many times it had been executed, or, there still was not attempt to simulate;
  • Blue color - while last simulating the function was not executed;
  • Green color - the number of times the functions was executed while last simulating is above zero and below the highly used value. Such functions are ideal for virtualization;
  • Yellow color - the number of executions of this functions is near to the highly used. You will have to check out the working speed of your application after protection;
  • Red color - function is highly used, it is not recommended to select this function, because it will slow down working speed of protected application.


其他选项

本节主题包含了程序保护的一些其它选项。

点击以下链接获取更多详细信息。

  • 闪屏设置
  • 水印
  • 插件
  • 自定义版本信息
  • 自定义显现资源
  • 加密标记分析
  • 命令行参数
  • 环境变量


闪屏设置

您可以为保护后的文件添加闪屏，也就是程序启动时显示的画面。

添加启动画面（闪屏） - Enigma Protector 支持三种格式的图片：BMP, PNG, JPG (JPE, JPEG)。

程序启动时显示 - 激活此选项，闪屏画面将在被保护程序运行时先显示出来，您还可以参看Enigma API EP_SplashScreenShow 和 EP_SplashScreenHide部分。

总在最前端显示 - 激活此选项，闪屏将显示在屏幕最前端，即不会被其他窗口所遮盖。

闪屏显示时不继续运行 - 激活此选项，被保护的程序在闪屏显示时，将停止往下执行。

鼠标点击关闭 - 激活此选项，闪屏将在鼠标点击其时自动关闭。

显示时间（毫秒） - 闪屏显示的毫秒数，单位：毫秒。


水印

启用水印功能 - 允许您为保护后的文件添加水印。水印是嵌入到文件中的特殊信息，添加后不可以别编辑或修改；如果文件中存储的水印信息被破坏，此文件将拒绝运行。Enigma Protector 支持放置文本或文件类型的水印。这个特性可以帮助软件开发人员为特定用户发放特定的版本，并跟踪此版本的动向，比如说可以确定泄漏版本的拥有者。

需要添加或编辑水印，请参考下面的图示。

水印名称 - 水印名称可以是任意字符串。

水印类型 - 如果水印类型是私人水印，只有拥有项目文件的开发人员才可以查看水印；如果是公共水印，任何人均可以查看。

水印文本 - 支持任意文本。

水印文件 - 附加任意文件到水印，可以使用水印查看器提取。

要查看保护文件的水印，需要从主菜单选择 - 工具 - 水印查看器。

需要在运行时获得水印内容，请使用 EP_MiscGetWatermark API 函数。


插件

Enigma Protector 提供对插件的支持，插件被嵌入到保护后的文件中，随被保护的文件一起运行。Enigma Protector 的插件存放在安装目录下的 Plugin 子目录。如果您想要添加自己的插件，将它复制到（例如）Enigma Protector\Plugins\ 目录，打开（重新打开）Enigma Protector 就可以看到了。使用插件可以扩展功能，加强保护，创建自己的保护系统，完全控制要保护的文件！您可以通过列表选择要嵌入保护的插件，双击来查看插件描述。

插件开发包 SDK

插件就是一个可以导出函数的 DLL 文件，可以使用任何编译器编译（MS C++, Borland C++, MASM, Delphi 等），只要它支持非托管代码（也就是不支持使用 .NET 技术编译的 DLL 文件）。

插件 DLL 可以导出的函数：

Enigma_Plugin_About - 返回 wide char (UNICODE) 字符串， 定义了插件名称和作者（信息显示在插件列表的“关于”一列）；
Enigma_Plugin_Description - 返回 wide char (UNICODE) 字符串，定义了插件描述和功能（双击列表中的插件时可以看到）；
Enigma_Plugin_OnInit - 保护后的文件启动时会调用这个子程序。注意，这个子程序会在被保护文件在内存中运行之前调用。例如，这里可以放置自己的调试器检测。

Enigma_Plugin_OnFinal - 保护后的文件运行后将会在内存调用这个子程序。

Enigma_Plugin_OnSaveKey - function is calling when protected file is trying to save registration information. It can be used to skip standard saving routine to allow more flexibility to save registration information. Function has 4 parameters, ARegName and ARegKey contain pointers to registration name and key buffers and ARegNameLen and ARegKeyLen contain number of bytes of name and key buffers. Note, for handling of Wide Strings and UNICODE registrtation scheme you should divide ARegNameLen and ARegKeyLen values on 2 to get actual length of the string. This function should return FALSE if it is not saved registration information (or it is not needed to save it) and TRUE if function succeeded. Note, standard saving routine will not be called if this function returned TRUE.

Enigma_Plugin_OnLoadKey - function is calling when protected file is trying to load registration information. It can be used to skip standard loading routine to allow more flexibility to load registration information. Function has 4 output parameters. ARegName and ARegKey after successful loading should contain pointers to the buffers of registration name and key and ARegNameLen and ARegKeyLen should contain number of bytes of name and key buffers. Note, you have to allocate buffers for ARegName and ARegKey manually (somewhere in global space). For handling of Wide Strings and UNICODE registrtation scheme you should multiply lengths of the strings on 2. This function should return FALSE if it is not loaded registration information (or it is not needed to load it) and TRUE if function succeeded. Note, standard loading routine will not be called if this function returned TRUE.


自定义版本信息

支持自定义本保护程序的属性，修改内容将改变您开发程序自己的属性。

查看被保护程序的属性，请在程序上单击右键，选择文件属性即可，如下图所示：


自定义显现资源

此项功能可自定义显现资源在被保护的程序中。

小提示：

  • Visual Styles Common Controls manifest allows to enable graphical themes of Windows XP/Vista for the protected file,
  • MS Visual Studio 2005/2008 manufest allows to check installation of Visual Studio 2005/2008 runtime libraries,
  • Each manifest can be manually edited and may contain information about product developer, it's description,
  • Manifest may help to define that the protected file should be run under administrative priveleges and so on.
  • You may select own .manifest file that should be embeded into protected file.

The limitation there is only brain of developer!


加密标记分析

加密标记分析版块相当于一个帮助工具，这里仅仅协助您分析保护后的程序做了那些加密内容，如果列表为空，表示被保护程序没有分析出加密标记，具体请点击查看 加密标识。

在下端“属性”处，有“排除不分析的区段”分项，Enigma会尝试分析/排除不分析部分区段以防止出错。


命令行参数

支持附加/追加命令行参数。输入命令行参数将直接通过保护模块。

附加参数 - 自定义命令行参数将直接覆盖原来命令行参数。

追加参数 - 自定义命令行参数将追加在原来命令行参数上。


Environment Variables

环境变量

自定义环境变量将在被保护程序运行时可以被调用，这是一个很好的隐藏/加密字符串的方法。请注意，变量名称/值限制在255字符内。

更多环境变量使用方法参看下面例子

几种语言使用自定义环境变量的例子

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);
}


试用控制

本节内容包含以下特性：

  • 试用限制（通过一定规则限制试用期）；
  • 提示消息（如果程序未注册，启动时会显示提示窗口）；
  • 时钟控制（控制系统时钟回拨）。

您可以使用特殊的 Enigma API 函数来嵌入试用控制，使用 Enigma API 可以为您的程序添加附属模块，这些附属模块提供了 Enigma API 接口。关于 Enigma API 的详细信息，您可以参见 API 描述 一节以及程序样例（Examples 文件夹位于 Enigma Protector 安装文件夹下）。要移除试用限制，用户必须注册他的拷贝，例如使用注册密匙。Enigma Protector 包含有特殊的资源用来 创建注册密匙 。

点击以下链接获取更多详细信息。

  • 常规选项
  • 存放试用信息
  • 锁定使用到用户区域
  • 试用次数限制
  • 试用天数限制
  • 过期天数限制
  • 过期日期限制
  • 运行时间限制
  • 提示消息
  • 系统时钟控制


常规选项

新版本重置试用期 - 新版本重置试用期意味着在新版本发布时试用期会被重新设定，如果您应用“试用天数”或“试用次数”限制，那么在程序新版本中，这两种试用方式都将被重新设定，也就是说新版本的程序限制会重新计数。

注意：要正确使用该功能，您必须在 输入参数 一节定义当前版本。

试用期过期时打开文件 - 允许您在试用期过期时打开一个预先设定的文件。文件只在您选择过期时结束进程时才打开，如果过期仍可继续运行，文件则不会打开。

文件名称 - 这里的文件名称用途很广，不仅仅可以填文件名，还可以是超链接和 Email 地址。

下方的表格列出了您可以在文件名称文本框里填写的内容：

File Name field content | Description
http://www.mysite.com/ | 超链接，系统将会用默认浏览器打开此链接；
mailto:admin@mysite.com | 电子邮件链接， 系统将会使用默认的邮件客户端打开此链接；
License.txt | 打开 license.txt 文件，系统会使用默认关联 .txt 文件格式的程序来打开此文件，该文件必须与被保护的文件放在同一文件夹；
Relative\Register.exe | 从当前文件夹的子文件夹运行 Register.exe ；
..\Register.exe | 从当前文件夹的上层文件夹运行 Register.exe ；
C:\Windows\Register.exe | 从绝对路径 c:\Windows 文件夹下运行 Register.exe。


存放试用信息

这是一项非常实用的功能，让您可以自由设置自定义的空间存储试用信息。这个功能不是必须被激活的，如果不激活此项功能，Enigma将按原定义好的地址存放试用信息。

点击“添加”将在列表内添加新存放地址，双击已经存在的地址可以进行修改，点击 [image] 将在列表内删除该地址。

添加/修改存放地址对话框：

加密密钥 - 直接输入或者点击随机生成按钮生成一个用来加密/解密试用信息的字符串；

注册表/文件 - 存放试用信息采用系统注册表还是自定义文件；

注册表主键地址 - 存放注册信息的注册表根键名，请注意：

  • 我们建议使用HKEY_CURRENT_USER作为存放试用信息的主键；
  • 试用信息存放在HKEY_LOCAL_MACHINE时，计算机所有用户将均可使用该信息；
  • HKEY_CLASSES_ROOT, HKEY_LOCAL_MACHINE, HKEY_USERS, HKEY_CURRENT_CONFIG 在非管理员权限的系统下有可能工作不正常。

注册表子健地址 - 存放注册信息的注册表子健地址；

Value Name - 注册信息name值；

Value Type - 注册信息的类型，如字符值或者二进制值；

文件存放注册信息方式 - 文件夹基本目录；

  • 如果使用%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%目录，被保护程序将需要Internet Explorer for Windows 95, Windows 98, Windows NT 4.0，如果版本较低，将会被修改成%DEFAULT FOLDER%
  • 如果使用%My Documents FOLDER%, %My Pictures FOLDER%, %History FOLDER%, %Cookies FOLDER%, %InternetCache FOLDER%目录，试用信息将被保存至当前用户帐号，否则将保存至Windows系统所有用户。

文件存放信息地址 - 在基本目录下的存放注册信息的文件夹地址；

File Name - 存放信息的文件名；

File Attributes - 存放信息文件的属性，有只读/存档/系统/隐藏属性，如不设置则按普通文件存档。


试用次数限制

启用试用次数限制 - 选中此复选框激活该功能。 这项功能主要是通过在 Windows 注册表中记录程序的运行次数来限制试用期，记录信息包含了程序的所有运行次数。程序启动时，Enigma Protector 载入器会检测当前的运行次数，如果这个值大于已定义的最大值（保护前在“最多运行次数”文本框定义），程序会拒绝运行。

您可以使用 Enigma API 来检测限制参数，使用 EP_TrialExecutions 函数来获取运行的总次数和剩余次数。您可以使用注册密匙来重设试用期， 如果 Enigma Protector 载入器检测到正确的注册密匙，试用期就会被重设。

在 x 秒后结束进程 - 如果程序检测到试用期过期了，程序会在 x 秒后结束自身进程。 如果该参数为零，那么程序会在主代码解密和执行前就结束进程。

进程结束时显示提示消息 - 如果您需要通知用户试用期已结束并且进程要结束，请选中此复选框。 您可以通过点击“编辑消息”按钮来编辑提示消息。如果此功能被禁用，程序结束前不会给用户任何提示。


试用天数限制

启用试用天数限制 - 选中此复选框激活该功能。这项功能主要是通过从第一次运行的日期开始计数来限制试用期。最多试用天数必须在应用保护前定义。

第一次运行的日期会在 Windows 注册表中记录，记录信息包含了被保护程序的试用天数。程序启动时，Enigma Protector 载入器会检测这个值，如果这个值大于已定义的最大值，程序会拒绝运行。

您可以使用 Enigma API 来检测限制参数，使用 EP_TrialDays 函数来获取总时间和剩余时间。您可以使用注册密匙来重设试用期， 如果 Enigma Protector 载入器检测到正确的注册密匙，试用期就会被重设。

注意：要阻止系统时钟回拨，请使用 试用控制 -> 系统时钟控制 功能。

在 x 秒后结束进程 - 如果程序检测到试用期过期了，程序会在 x 秒后结束自身进程。如果该参数为零，那么程序会在主代码解密和执行前就结束进程。

进程结束时显示提示消息 - 如果您需要通知用户试用期已结束并且进程要结束，请选中此复选框。您可以通过点击“编辑消息”按钮来编辑提示消息。如果此功能被禁用，程序结束前不会给用户任何提示。


过期日期限制

启用过期日期限制 - 选中此复选框激活该功能。 程序启动时，Enigma Protector 载入器会检测当前日期，并与已定义的过期日期对比。如果当前日期已过期，程序会拒绝运行。

您可以使用 Enigma API 来检测限制参数，使用 EP_TrialExecutionDate 函数来获取过期日期的年月日。您可以使用注册密匙来重设试用期， 如果 Enigma Protector 载入器检测到正确的注册密匙，试用期就会被重设。

注意：要阻止系统时钟回拨，请使用 试用控制 -> 系统时钟控制 功能。

在 x 秒后结束进程 - 如果程序检测到试用期过期了，程序会在 x 秒后结束自身进程。 如果该参数为零，那么程序会在主代码解密和执行前就结束进程。

进程结束时显示提示消息 - 如果您需要通知用户试用期已结束并且进程要结束，请选中此复选框。 您可以通过点击“编辑消息”按钮来编辑提示消息。 如果此功能被禁用，程序结束前不会给用户任何提示。


从日期到日期限制

启用从日期到日期限制 - 保护后的程序运行时，Enigma 载入器获取当前日期，如果该日期小于 开始试用日期 或大于 试用结束日期 ，程序会拒绝运行。

您可以通过 Enigma API 定义限制参数，使用 EP_TrialDateTillDate 函数获取试用期的开始和结束日期，使用注册密钥验证函数重设试用期。如果 Enigma Protector 的载入器检测到正确的注册密钥，则试用期会被重置。

在 x 秒后结束进程 - 如果程序检测到试用期过期了，程序会在 x 秒后结束自身进程。 如果该参数为零，那么程序会在主代码解密和执行前就结束进程。

进程结束时显示提示消息 - 如果您需要通知用户试用期已结束并且进程要结束，请选中此复选框。 您可以通过点击“编辑消息”按钮来编辑提示消息。如果此功能被禁用，程序结束前不会给用户任何提示。


运行时间限制

启用运行时间限制 - 选中此复选框激活运行时间限制功能。 激活此功能后，Enigma 载入器会在程序启动后开始计时运行时间，如果运行时间超过了“允许运行的总时间”就会触发“过期时行为”。如果不注册，程序每次运行都会有运行时间限制，注册后才可以无限制的运行。如果您需要手动检查运行总时间和剩余时间，您可以使用 Enigma API 函数， EP_TrialExecutionTime 函数会返回自程序启动时的总时间和剩余时间。您可以使用注册密匙检查函数来重置试用期，如果 Enigma Protector 载入器检测到正确的注册密匙，试用期会被重置。

过期时结束进程 - 如果程序检测到试用期过期了，程序会结束自身进程。如果试用时间为零，那么程序会在主代码解密和执行前就结束进程。

进程结束时显示提示消息 - 如果您需要通知用户试用期已结束并且进程要结束，请选中此复选框。您可以通过点击“编辑消息”按钮来编辑提示消息。如果此功能被禁用，程序结束前不会给用户任何提示。


锁定试用到用户区域

锁定试用到用户区域 - 锁定试用设置到指定的国家。在列表中选择试用设置生效的国家，如果被保护后的程序在未指定的国家运行，所有的试用限制都会被忽略，程序运行不会有任何限制。此选项对所有在“试用控制”面板中设置的试用限制都有效。

选择所有 - 选择国家列表中的所有国家；

不选所有 - 取消选择国家列表中的所有国家；

反向选择 - 反向选择已选的条目。


提示消息

启用提示消息 - 选中此复选框激活该功能。 如果激活此功能，程序启动时会显示一个提示消息的窗口，窗口内容（例如通知用户需要注册）您可以通过点击“编辑消息”按钮来编辑，用户必须注册才能移除此提示窗口。 如果 Enigma Protector 载入器检测到正确的注册密匙，提示窗口将不会再显示。

提示消息显示间隔（秒） - 定义了提示窗口再次显示的时间间隔。如果间隔时间设置为零，提示窗口只会显示一次。


系统时钟控制

发现系统时钟回拨时结束进程 - 选中此复选框激活系统时钟检测功能。 这项功能可以帮助您阻止用户为了逃避试用限制而采取的回拨系统时钟的行为。程序启动时，Enigma Protector 载入器会检测系统时间是否被修改，如果发现改变，程序将拒绝运行。

Do not check clock reversing if registered - use this to disable checking of the user time when application is registered. Please note, it is not recommnded to disable cloick reversing if the registration keys with (eg) expiration date are using.

Use protection date to check users clock - if the option enabled, Enigma Protector will also check if the current date on the user PC is not less then the date of protection. If the user PC date is less than date of protection then Enigma thinks the clock are back reversed. Please note, be sure your system clock (and Time Zone information) are correct.

注意：即使有效的密匙也不会影响该功能的检测。

进程结束时显示提示消息 - 如果您需要通知用户系统时间被修改并且将要恢复系统时间时，请选中此复选框。 您可以通过点击“编辑消息”按钮来编辑提示消息。 如果此功能被禁用，程序结束前不会给用户任何提示。


基本操作

创建新项目

要创建新的项目，请选择“新建项目”菜单。参见 创建项目文件 一节。

打开已存在的项目

要打开已存在才项目文件，请选择“打开项目...”菜单。

关闭项目

要关闭已经打开的项目文件，请选择“关闭项目”菜单。

保存项目

要保存项目文件，请选择“保存项目”菜单。

项目另存为

要用新文件名保存项目文件，请选择“项目另存为...”菜单。

退出 Enigma Protector

要关闭 Enigma Protector，请选择“离开”菜单。

改变当前界面语言

要改变当前界面的语言，请通过"语言" 菜单选择您需要的语言。语言文件必须放置在 Enigma Protector 安装目录下的 \lang 子目录中。

调用帮助手册

“帮助内容”菜单可以打开 Enigma Protector 的帮助手册。

解锁/注册

解锁/注册您的 Enigma Protector 产品。参见 订购 页面。

在线注册

在线注册为您提供了购买 Enigma Protector 的必要信息，您会被重定向到 Enigma Protector 的官方网站。注册后您会收到用来解锁 Enigma Protector 的注册名称和注册密钥。

调用密钥生成器

关于使用 Enigma Protector 密钥生成器的更多信息请参见 密钥生成器 一节。

关于信息

Enigma Protector 的关于对话框。

重置本地试用信息

此特性用来调试已打开的项目。在开发过程中，有时候需要重置本地试用信息来调试 Enigma Protector 试用参数，使用此命令清除本地计算机的试用信息。

重置本地注册信息

此特性用来调试已打开的项目。在开发过程中，有时候需要重置本地注册信息来调试 Enigma Protector 注册参数，使用此命令清除本地计算机的注册信息。

重置本地特殊信息

此特性用来重置/删除本地保存的特殊信息，仅供开发人员调试。特殊信息例如 启动密码 等信息。

选择项目参数：

通过图形界面选择项目参数，所有参数按树型分类。每一类参数都放置在独立的页面中。

<


消息编辑器

消息编辑器是一个窗口组件，用来编辑需要显示的消息。

使用超链接 - 如果您想在消息窗口放置带超链接的文本，请选中此复选框。

带超链接的文本 - 输入您想加入超链接的文本。

超链接地址 - 输入您的超链接地址。

您可以在文本消息框里插入特殊的变量字符串，消息显示时会由相应的值替换：

变量名称 | 描述 | 参考
%App_Name% | 项目输入参数对应的应用程序名称 | 输入参数
%App_Vers% | 项目输入参数对应的应用程序版本 | 输入参数
%CU_EXTFILES% | 未通过外部文件校验的文件名称 | 校验外部文件
%CU_EXECPR% | 未通过进程校验的进程名称 | 校验运行中的进程
%CU_INSTSERV% | 未通过服务校验的服务名称 | 检测已安装的服务
%CU_WINVER% | 当前 Windows 的版本 | 检测Windows版本
%CU_VIRTTOOLS% | 虚拟机的名称 | 检测虚拟机软件
%HardwareID% | 当前硬件 ID | 硬件锁定
%RegName% | 注册用户名 | Keys generator
%RegKey% | 注册密钥
%KeyExpYear% | 密钥到期年份
%KeyExpMonth% | 密钥到期月份
%KeyExpDay% | 密钥到期日期
%TrialExecsTotal% | 试用运行总次数 | 试用次数
%TrialExecsLeft% | 试用运行剩余次数
%TrialDaysTotal% | 试用期总天数 | 试用天数
%TrialDaysLeft% | 试用期剩余天数
%TrialExpYear% | 试用过期年份 | 试用日期
%TrialExpMonth% | 试用过期月份
%TrialExpDay% | 试用过期日期
%TrialStartYear% | 试用开始年份 | 从日期到日期限制
%TrialStartMonth% | 试用开始月份
%TrialStartDay% | 试用开始日期
%TrialEndYear% | 试用结束年份
%TrialEndMonth% | 试用结束月份
%TrialEndDay% | 试用到期日期
%TrialExecMinsTotal% | 试用总运行时间（分钟） | 运行时间限制
%TrialExecMinsLeft% | 试用剩余时间（分钟）

变量字符串不区分大小写。

消息图标 - 有多种图标供选择，图标将显示在弹出的信息框左上方。

在X秒后自动关闭消息框 - 弹出的消息框将在设定的秒数内自动关闭。

在X秒内禁用OK按钮 - 弹出的信息框在设点的秒数内将无法点击“OK/确认”按钮。

选择信息字体 - 选择弹出信息框内的字体。

预览 - 点击可预览设定好的信息框。


创建 MAP 文件

这里告诉您如何创建为虚拟机使用的 MAP 文件。当前版本的 Enigma Protector 支持由 Delphi 和 Borland C++ 以及 MS Visual Studio 创建的 MAP 文件。

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

在 Delphi 中创建 MAP 文件：

  • 在 Delphi 中打开您的项目文件；
  • 在主菜单选择 "Project" -> "Options"，或按 Shift+Ctrl+F11 ，您会看到下面的窗口：

  • 选择 "Linker" 标签并在 "Map File" 面板中打开 "Delails" 复选框：

  • 编译您的项目。在输出文件夹，您就会看到编译好的可执行文件和带 .map 扩展名的同名文件。这个 .map 文件就可以用来激活“虚拟机”功能。

在 Delphi 2007 及更新版本中创建:

  • 用Delphi打开您的项目文件；
  • 在主菜单里选择"Project" -> "Options"，或按 Shift+Ctrl+F11，在弹出的窗口的左边选择 "Linker" ，再选择 "Map file - Detailed"；

  • 编译您的项目。在输出文件夹，您就会看到编译好的可执行文件和带 .map 扩展名的同名文件。这个 .map 文件就可以用来激活“虚拟机”功能。

在 Borland C++ Builder 中创建 MAP 文件：

  • 在 C++ Builder 中打开您的项目文件。
  • 在主菜单选择 "Project" -> "Options"，或按 Shift+Ctrl+F11 ，您会看到下面的窗口：

  • 选择 "Linker" 标签并在 "Map File" 面板中打开 "Delails" 复选框：

  • 编译您的项目。在输出文件夹，您就会看到编译好的可执行文件和带 .map 扩展名的同名文件。这个 .map 文件就可以用来激活“虚拟机”功能。

在 MS Visual C++ 中创建 MAP 文件：

  • 在 MS Visual С++ 中打开您的项目文件。
  • 在主菜单选择 "Project" -> "Settings"，或按 Alt+F7

  • 选择 "Link" 选项卡和 "Category" - "Debug"

  • 激活 "Generate mapfile" 选项

  • 编译您的项目。

使用 MS Visual Studio 2003创建:

  • 使用MS Visual C++打开您的项目文件；
  • 在主菜单上选择 Project - Properties；
  • 在弹出窗口中选择 Configuration Properties - Linker - Debugging；如下图所示：

  • 编译您的项目即可。

注意：每次编译完 MAP 都不同，请确保您使用的是正确的可执行文件和 MAP 文件。


支持的文件格式

Enigma Protector 支持任何 Windows 32/64 PE 格式的可执行文件，支持如下扩展名： *.exe, *.dll, *.ocx, *.scr 等。支持多种Win32/Win64编译器，如C++, Delphi, MASM, Visual Basic, Free Pascal, FoxPro, Power Basic, TASM 等语言编写的程序。


Work with command line

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

  • To load project file into Enigma Protector: Enigma.exe Project.enigma
  • To start protection use console version:
    Version | Example
    Enigma Protector x86 (usual 32-bits version) | enigma32.exe [options] Project.enigma
    Enigma Protector x64 | enigma64.exe [options] Project.enigma
    Project.enigma is the Enigma Protector project file.
    Following options can be used:
    • -q enables quite protection mode, all messages are supressed
    • -qe enables quite protection mode, all messages are supressed except error messages


API 描述

Enigma API 是一组特殊的函数集，用来为保护的文件添加注册功能和控制试用参数，请确保 Enigma API 使用 stdcall 进行转换。处理注册信息的函数集如下：

  • Registration API - 注册密钥相关函数；
  • Trial API - 试用限制函数；
  • Crypt API - 加密函数；
  • Miscellaneous API - 保护字符串、程序版权、水印、区域等等综合函数；

参见 如何使用 Enigma API 页面来了解更多调用 API 函数的方法。

注意：Enigma API 仅在您的程序被保护后生效！即在您开发的程序中使用后，别忘记使用Enigma对程序进行保护。


Registration API

注册函数 API

注册函数API主要应用在检测、存储、读取和删除注册密钥信息（注册用户名和注册密钥）。

  • EP_RegCheckKey
  • EP_RegCheckKeyA
  • EP_RegCheckKeyW
  • EP_RegLoadKey
  • EP_RegLoadKeyA
  • EP_RegLoadKeyW
  • 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_RegShowDialog

参见 如何使用 Enigma API 页面来了解更多调用 API 函数的方法。

注意：Enigma API 仅在您的程序被保护后生效！即在您开发的程序中使用后，别忘记使用Enigma对程序进行保护。


EP_RegCheckKeyW

EP_RegCheckKey 函数用来验证注册信息。

参数

  • Name - 注册名称 - 指向以 \0 结尾的字符串指针；
  • Key - 注册密匙 - 指向以 \0 结尾的字符串指针。

返回值

如果函数成功执行，返回值为 1 ，否则为 0 。

备注

使用UNICODE注册信息需注意激活对应选项，请参看常规选项.
在以下情况函数不会执行成功：

  • 注册信息无效；
  • 未知错误。

定义

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 : PChar; Key : PChar) : 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);
}

实例

Show/Hide Delphi function example

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

function ProcessRegistration(Name, Key : string) : boolean;
begin
  Result := fasle;
  if EP_RegCheckKey(PChar(Name), PChar(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;
}

可以在安装文件夹下的 Examples 子文件夹查看函数实例。


EP_RegCheckKeyA

EP_RegCheckKeyA 函数用来验证注册信息，与 EP_RegCheckKey 函数类似

参数

  • Name - 注册名称 - 指向以 \0 结尾的字符串指针；
  • Key - 注册密匙 - 指向以 \0 结尾的字符串指针。

返回值

如果函数成功执行，返回值为 1 ，否则为 0 。

备注

应该禁止使用UNICODE注册信息，请参看REGISTRATION FEATURES - Common panel.
在以下情况函数不会执行成功：

  • 注册信息无效；
  • 未知错误。

定义

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);
}

可以在安装文件夹下的 Examples 子文件夹查看函数实例。


EP_RegCheckKey

EP_RegCheckKeyA 函数用来验证注册信息，与 EP_RegCheckKey 函数类似，但是其支持unicode字符串加密，请注意，如果使用这个函数，请激活UNICODE注册密钥，请参考常规选项.

参数

  • Name - 注册名称 - 指向以 \0 结尾的unicode字符串指针。
  • Key - 注册密钥- 指向以 \0 结尾的unicode字符串指针。

返回值

如果函数成功执行，返回值为 1 ，否则为 0 。

备注

在以下情况函数不会执行成功

  • 注册信息无效；
  • 程序没有被保护。

定义

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);
}

可以在安装文件夹下的 Examples 子文件夹查看函数实例。


EP_RegCheckAndSaveKey

EP_RegCheckAndSaveKey 函数用来验证和保存注册信息。它由两个函数 EP_RegCheckKey 和 EP_RegSaveKey 组成。 如果当前项目的注册信息有效，注册信息就会被保存，否则不会。

参数

  • Name - 注册名称 - 指向以 \0 结尾的字符串指针；
  • Key - 注册密匙 - 指向以 \0 结尾的字符串指针。

返回值

如果函数成功执行，返回值为 1 ，否则为 0 。

备注

应该禁止使用UNICODE注册信息，请参看常规选项.
在以下情况函数不会执行成功：

  • 注册信息无效；
  • 保存注册信息时发生错误（可以是文件被写保护或无法访问注册表）；
  • 未知错误。

定义

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 : PChar; Key : PChar) : 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);
}

举例

Show/Hide Delphi function example

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

function ProcessRegistration(Name, Key : string) : boolean;
begin
  Result := fasle;
  if EP_RegCheckAndSaveKey(PChar(Name), PChar(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");
    }
}

可以在安装文件夹下的 Examples 子文件夹查看函数实例。


EP_RegCheckAndSaveKeyA

EP_RegCheckAndSaveKeyA 与 EP_RegCheckAndSaveKey 函数类似。

参数

  • Name - 注册名称 - 指向以 \0 结尾的字符串指针；
  • Key - 注册密匙 - 指向以 \0 结尾的字符串指针。

返回值

如果函数成功执行，返回值为 1 ，否则为 0 。

备注

应该禁止使用UNICODE注册信息，请参看常规选项.
在以下情况函数不会执行成功：

  • 注册信息无效；
  • 保存注册信息时发生错误（可以是文件被写保护或无法访问注册表）；
  • 未知错误。

定义

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);
}

可以在安装文件夹下的 Examples 子文件夹查看函数实例。


EP_RegCheckAndSaveKeyW

EP_RegCheckAndSaveKeyW函数与EP_RegCheckAndSaveKey函数类似，但其使用unicode (wide)字符串加密，请注意，要使用此函数，需激活UNICODE注册信息，请参看常规选项.

参数

  • Name - 注册名称 - 指向以 \0 结尾的字符串指针；
  • Key - 注册密匙 - 指向以 \0 结尾的字符串指针。

返回值

如果函数成功执行，返回值为 1 ，否则为 0 。

备注

在以下情况函数不会执行成功：

  • 注册信息无效；
  • 保存注册信息时发生错误（可以是文件被写保护或无法访问注册表）；
  • 未知错误。

定义

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);
}

可以在安装文件夹下的 Examples\RegistrationUnicode 子文件夹查看函数实例。


EP_RegDeleteKey

EP_RegDeleteKey 函数用来删除已存在的注册信息。

参数

此函数没有参数。

返回值

如果函数成功执行，返回值为 1 ，否则为 0 。

备注

在以下情况函数不会执行成功：

  • 注册信息不存在；
  • 删除注册信息时发生错误（可以是无法删除带写保护的文件或无法访问注册表）；
  • 未知错误。

定义

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();
}

举例

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;
}

可以在安装文件夹下的 Examples 子文件夹查看函数实例。


EP_RegHardwareID

EP_RegHardware 函数用来取回用户计算机的唯一信息。查看 注册特性 - 硬件锁定 面板获取更多信息。

参数

此函数无参数。

返回值

如果函数成功执行，返回值是指向以 \0 结尾的字符串指针；如果失败，返回值为 0 。

备注

应该禁止使用UNICODE注册信息，请参看REGISTRATION FEATURES - Common panel.

定义

Show/Hide C++ function definition

extern "C" __declspec( dllimport ) __stdcall PCHAR 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();
}

举例

Show/Hide Delphi function example

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

procedure ShowHardwareID;
var
  pcHardware : pchar;
begin
  pcHardware := EP_RegHardwareID;
  if pcHardware <> nil then
  begin
    MessageBox(0, format('The Hardware ID is: %s', [string(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;
}

可以在安装文件夹下的 Examples 子文件夹查看函数实例。


EP_RegHardwareIDA

EP_RegHardwareIDA函数功能为获取用户计算机信息，参看硬件锁定面板获取更多信息。

参数

此函数无参数。

返回值

如果函数成功执行，返回值是指向以 \0 结尾的字符串指针；如果失败，返回值为 0 。

备注

应该禁止使用UNICODE注册信息，请参看REGISTRATION FEATURES - Common panel.

定义

Show/Hide C++ function definition

extern "C" __declspec( dllimport ) __stdcall PCHAR 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();
}

可以在安装文件夹下的 Examples 子文件夹查看函数实例。


EP_RegHardwareIDW

EP_RegHardwareIDW 函数功能同样是获取用户计算机信息，参看Registration Features - Hardware Lock 版块获取更多信息。请注意，使用本函数需激活UNICODE注册信息，请参看常规选项.

参数

此函数无参数。

返回值

如果函数成功执行，返回值是指向以 \0 结尾的字符串指针；如果失败，返回值为 0 。

定义

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();
}

可以在安装文件夹下的 Examples\RegistrationUnicode 子文件里查看函数实例。


EP_RegLoadKey

EP_RegLoadKey 函数用来读取注册信息。注册信息的存储位置和路径需要在 注册特性 - 注册信息存储 面板中定义。

参数

  • Name - 注册名称 - 指向以 \0 结尾的字符串指针；
  • Key - 注册密匙 - 指向以 \0 结尾的字符串指针。

返回值

如果函数成功执行，返回值为 1 ，否则为 0 。

备注

应该禁止使用UNICODE注册信息，请参看REGISTRATION FEATURES - Common panel.

本函数只是读取注册信息，并不进行真实校对，请确认您的注册信息/密钥是正确的，校对注册信息请使用 EP_RegCheckKey 或者使用 EP_RegLoadAndCheckKey 函数。

定义

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);
}

可以在安装文件夹下的 Examples 子文件夹查看函数实例。


EP_RegLoadKeyA

EP_RegLoadKey 函数功能为读取注册信息，与 EP_RegLoadKey 类似。

参数

  • Name - 注册名称 - 指向以 \0 结尾的字符串指针；
  • Key - 注册密匙 - 指向以 \0 结尾的字符串指针。

返回值

如果函数成功执行，返回值为 1 ，否则为 0 。

备注

应该禁止使用UNICODE注册信息，请参看REGISTRATION FEATURES - Common panel.

本函数只是读取注册信息，并不进行真实校对，请确认您的注册信息/密钥是正确的，校对注册信息请使用 EP_RegCheckKey 或者使用 EP_RegLoadAndCheckKey 函数。

定义

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);
}

可以在安装文件夹下的 Examples 子文件夹查看函数实例。


EP_RegLoadKeyW

EP_RegLoadKey 函数功能为读取注册信息，与 EP_RegLoadKey 类似。但该函数支持unicode (wide)字符加密。请注意，如果使用本函数，需激活UNICODE注册信息，请参看REGISTRATION FEATURES - Common panel.

参数

  • Name - 注册名称 - 指向以 \0 结尾的unicode字符串指针；
  • Key - 注册密匙 - 指向以 \0 结尾的unicode字符串指针。

返回值

如果函数成功执行，返回值为 1 ，否则为 0 。

备注

本函数只是读取注册信息，并不进行真实校对，请确认您的注册信息/密钥是正确的，校对注册信息请使用 EP_RegCheckKey 或者使用 EP_RegLoadAndCheckKey 函数。

定义

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);
}

可以在安装文件夹下的 Examples\RegistrationUnicode 子文件夹参看函数实例。


EP_RegSaveKey

EP_RegSaveKey 函数用来保存注册信息。注册信息的存储位置和路径需要在 注册特性 - 注册信息存储 面板中定义。

参数

  • Name - 注册名称 - 指向以 \0 结尾的字符串指针；
  • Key - 注册密匙 - 指向以 \0 结尾的字符串指针。

返回值

如果函数成功执行，返回值为 1 ，否则为 0 。

备注

此函数仅保存注册信息。如果要确认保存的注册名称/密匙是正确的，您必须通过函数 EP_RegCheckKey 函数来验证，或使用联合函数 EP_RegCheckAndSaveKey 。

定义

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);
}

举例

Show/Hide Delphi function example

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

function ProcessRegistration(Name, Key : string) : boolean;
begin
  Result := fasle;
  if EP_RegCheckKey(PChar(Name), PChar(Key)) then // check the registration information
  begin
    MessageBox(0, 'The Registration Information is valid for this project!', 'Application', 0);
    if EP_RegSaveKey(PChar(Name), PChar(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;
}

可以在安装文件夹下的 Examples 子文件夹查看函数实例。


EP_RegSaveKeyA

EP_RegSaveKeyA 函数功能同样为存储注册信息，请参看 EP_RegSaveKey 函数。

参数

  • Name - 注册名称 - 指向以 \0 结尾的字符串指针；
  • Key - 注册密匙 - 指向以 \0 结尾的字符串指针。

返回值

如果函数成功执行，返回值为 1 ，否则为 0 。

备注

此函数仅保存注册信息。如果要确认保存的注册名称/密匙是正确的，您必须通过函数 EP_RegCheckKey 函数来验证，或使用联合函数 EP_RegCheckAndSaveKey 。

定义

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);
}

可以在安装文件夹下的 Examples 子文件夹查看函数实例。


EP_RegSaveKeyW

EP_RegSaveKeyA 函数功能同样为存储注册信息，请参看 EP_RegSaveKey 函数。但其使用 unicode (wide) 字符加密。请注意，使用本函数需要激活UNICODE 注册信息，请参看 注册特性-注册信息存储 版块。

参数

  • Name - 注册名称 - 指向以 \0 结尾的unicode字符串指针；
  • Key - 注册密匙 - 指向以 \0 结尾的unicode字符串指针。

返回值

如果函数成功执行，返回值为 1 ，否则为 0 。

备注

此函数仅保存注册信息。如果要确认保存的注册名称/密匙是正确的，您必须通过函数EP_RegCheckKeyW 或者使用联合函数 EP_RegCheckAndSaveKeyW。

定义

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);
}

可以在安装文件夹下的 Examples\RegistrationUnicode 子文件夹查看函数实例。


EP_RegLoadAndCheckKey

EP_RegLoadAndCheckKey 用来读取和验证注册信息，包含两个函数 EP_RegLoadKey 和 EP_RegCheckKey 。

参数

此函数无参数。

返回值

如果函数成功执行，返回值为 1 ，否则为 0 。

备注

在以下情况函数不会执行成功：

  • 注册信息不存在；
  • 注册信息无效；
  • 未知错误。

定义

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();
}

实例

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;
}

可以在安装文件夹下的 Examples 子文件夹查看函数实例。


EP_RegKeyCreationDate

EP_RegKeyCreationDate 函数用来取得注册密钥的创建日期。参见 创建密钥 一节获取更多信息。或者查看函数 EP_RegKeyCreationDateEx。

参数

  • Year - 密钥创建的年份。
  • Month - 密钥创建的月份。
  • Day - 密钥创建的日期。

返回值

如果函数成功执行，返回值为 1 ，否则为 0 。

备注

在以下情况函数不会执行成功：

  • 缺少有效注册密钥；
  • 未知错误。

定义

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);
}

实例

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;

可以在安装目录下查看函数实例。


EP_RegKeyCreationDateEx

EP_RegKeyCreationDateEx 返回注册密钥建立的日期，参见创建密钥获取更多信息。

参数

此函数无参数。

返回值

如果函数成功执行，将返回32位年月日的值，失败则返回0。

备注

在以下情况函数不会执行成功：

  • 缺少有效注册密钥；
  • 未知错误。

定义

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();
}

可以在安装目录下查看函数实例。


EP_RegKeyExpirationDate

EP_RegKeyExpirationDate 函数用来取得注册密匙的过期日期，生成注册密匙时需要激活此选项。参见 创建密匙 一节获取更多信息。参见 EP_RegKeyExpirationDateEx函数获取更多信息。

参数

  • Year - 注册密匙过期的年份；
  • Month - 注册密匙过期的月份；
  • Day - 注册密匙过期的日期。

返回值

如果函数成功执行，返回值为 1 ，否则为 0 。

备注

在以下情况函数不会执行成功：

  • 注册密匙不正确；
  • 注册密匙没有时间限制；
  • 未知错误。

定义

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);
}

实例

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;

可以在安装目录下的 Examples\KeyExpiration 查看更多该函数使用实例。


EP_RegKeyExpirationDateEx

EP_RegKeyExpirationDateEx 返回注册密钥过期日期。该注册密钥必须包含有密钥过期日期，查看 创建密钥 获取更多信息。

参数

该函数无参数。

返回值

如果函数成功执行，将返回32位年月日的值，失败则返回0。

备注

在以下情况函数不会执行成功：

  • 注册密匙不正确；
  • 注册密匙没有时间限制；
  • 未知错误。

定义

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();
}

可以在安装目录下的 Examples\KeyExpiration 子文件夹查看函数实例。


EP_RegKeyExecutions

EP_RegKeyExecutions 函数返回注册密钥限制的总次数和剩余次数。参见注册密钥获取更多信息。或者参见 EP_RegKeyExecutionsLeft 和 EP_RegKeyExecutionsTotal版块。

参数

  • Total - 注册密钥限制的总次数。
  • Left - 剩余的使用次数。

返回值

如果函数成功执行，返回值为实际的使用次数和总次数 ，否则为 0 。

备注

在以下情况函数不会执行成功：

  • 注册密钥没有次数限制；
  • 注册密钥不正确；
  • 未知错误。

定义

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);
}

可以在安装文件夹下查看函数实例。


EP_RegKeyExecutionsLeft

EP_RegKeyExecutionsLeft 函数返回注册密钥限制的剩余使用次数，类似EP_RegKeyExecutions。参看 创建密钥 获取更多信息。

参数

函数没有参数。

返回值

如果函数成功执行，返回值为软件剩余使用次数，失败则返回0。

备注

在以下情况函数不会执行成功：

  • 注册密钥没有次数限制；
  • 注册密钥不正确；
  • 试用次数已满；
  • 未知错误。

定义

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();
}

可以在安装文件夹下查看函数实用实例。


EP_RegKeyExecutionsTotal

EP_RegKeyExecutionsTota 函数返回注册密钥限制的总使用次数，类似EP_RegKeyExecutions。参看 创建密钥 获取更多信息。

参数

函数没有参数。

返回值

如果函数执行成功，返回值为软件总使用次数，执行失败，则返回0。

备注

在以下情况函数不会执行成功：

  • 注册密匙不正确；
  • 注册密匙没有次数限制；
  • 未知错误。

定义

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();
}

可以在安装目录下查看函数使用实例。


EP_RegKeyDays

EP_RegKeyDays function 函数返回注册密钥里限制的总天数和剩余天数。参见 创建密钥 获取更多信息。或者参见 EP_RegKeyDaysLeft 和 EP_RegKeyDaysTotal函数。

参数

  • Total - 注册密钥里限制的总使用天数。
  • Left - 剩余的使用天数。

返回值

如果函数成功执行，返回值为 1 ，否则为 0 。

备注

在以下情况函数不会执行成功：

  • 注册密钥没有天数的限制；
  • 注册密钥不正确；
  • 未知错误。

定义

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);
}

可以在安装文件夹下查看函数使用实例。


EP_RegKeyDaysLeft

EP_RegKeyDaysLeft 函数获取注册密钥里限制的剩余天数。参考EP_RegKeyDays函数。更多信息请在创建密钥版块获取。

参数

函数无参数。

返回值

如果函数成功执行，将返回剩余天数，否则返回0。

备注

在以下情况函数不会执行成功：

  • 注册密钥里没有日期限制；
  • 注册密钥错误；
  • 限制已经到期；
  • 未知错误。

定义

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();
}

可以查看安装文件夹下函数更多实例。


EP_RegKeyDaysTotal

EP_RegKeyDaysTotal函数返回注册密钥中限制的总天数。参看EP_RegKeyDays。 更多信息请参看创建密钥 。

参数

函数无参数。

返回值

如果函数执行成功，将返回使用总天数。否则，返回0。

备注

在以下情况函数不会执行成功

The function fails in the following cases:

  • 注册密钥没有限制天数；
  • 注册密钥错误；
  • 未知错误。

定义

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();
}

可以在安装文件夹下查看函数使用实例。


EP_RegKeyRuntime

EP_RegKeyRuntime 函数返回注册密钥里限制的每次运行总时间和剩余运行时间。参看Creating Keys 获取更多信息。或者查看函数EP_RegKeyRuntimeLeft 和 EP_RegKeyRuntimeTotal 。

参数

  • Total - 注册密钥里限制的每次总运行时间。
  • Left - 剩余的运行时间。

返回值

如果函数成功执行，返回值为1，否则为0。

备注

在以下情况函数不会执行成功：

  • 注册密钥没有限制运行时间；
  • 注册密钥错误；
  • 未知错误。

定义

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);
}

可以在查看安装文件夹获取函数使用实例。


EP_RegKeyRuntimeLeft

EP_RegKeyRuntimeLeft 函数返回f注册密钥限制剩余的运行时间。参看 EP_RegKeyRuntime.函数和 Creating Keys 获取更多信息。

参数

函数无参数。

返回值

如果函数成功执行，返回值为剩余的使用次数，如果失败，返回值为0。

备注

在以下情况函数不会执行成功：

  • 注册密钥无运行时间的限制；
  • 注册密钥不正确；
  • 运行时间已到期；
  • 未知错误。

定义

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();
}

可以在安装文件夹下查看函数实例。


EP_RegKeyRuntimeTotal

EP_RegKeyRuntimeTotal 返回注册密钥限制的每次总运行时间值。参看 EP_RegKeyRuntime 和 Creating Keys 获取更多信息。

参数

函数无参数。

返回值

如果函数成功执行，返回值为总运行时间，否则返回0。

备注

在以下情况函数不会执行成功：

  • 注册密钥无运行时间限制；
  • 注册密钥错误；
  • 未知错误。

定义

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();
}

可以在安装文件夹下查看函数实例。


EP_RegKeyGlobalTime

EP_RegKeyGlobalTime函数返回注册密钥限制的总共运行时间和剩余总运行时间。 参考 创建密钥 获取更多信息。或者参看函数 EP_RegKeyGlobalTimeLeft 和 EP_RegKeyGlobalTimeTotal。

参数

  • Total - 注册密钥限制的总共运行时间。
  • Left - 剩余的总运行时间。

返回值

如果函数成功执行，返回值为1，否知为0。

备注

在以下情况函数不会执行成功：

  • 注册密钥没有限制总共运行时间；
  • 注册密钥不正确；
  • 未知错误。

定义

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);
}

可以在安装文件夹下查看函数实例。


EP_RegKeyGlobalTimeLeft

EP_RegKeyGlobalTimeLeft函数返回注册密钥里限制的剩下的总运行时间。 EP_RegKeyGlobalTimeLeft 类似 EP_RegKeyGlobalTime。参看 创建密钥 获取更多信息。

参数

函数无参数。

返回值

如果函数成功执行，返回值为剩余的总运行时间。否则返回0。

备注

在以下情况函数不会执行成功：

  • 注册密钥没有限制总运行时间；
  • 注册密钥错误；
  • 限制的总运行时间已到期；
  • 未知错误。

定义

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();
}

可以在安装文件夹下查看函数实例。


EP_RegKeyGlobalTimeTotal

EP_RegKeyGlobalTimeTotal函数返回注册密钥里限制的总运行时间，类似于 EP_RegKeyGlobalTime。参看 创建密钥 获取更多信息。

参数

函数无参数。

返回值

如果函数执行成功，返回值为总运行时间，否则为0。

备注

在以下情况函数不会执行成功：

  • 注册密钥里没有限制总运行时间；
  • 注册密钥错误；
  • 未知错误。

定义

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();
}

可以在安装目录下查看函数使用实例。


EP_RegKeyRegisterAfterDate

EP_RegKeyRegisterAfterDate 返回注册密钥里过期的日期。参看 创建密钥 获取更多信息。或者查看 EP_RegKeyRegisterAfterDateEx 函数。

参数

  • Year - 过期日期的年份。
  • Month - 过期日期的月份。
  • Day - 过期日期的日。
返回值

如果函数执行成功，返回值为1，否则为0。

备注

在以下情况函数不会执行成功：

  • 注册密钥没有限制过期的日期；
  • 注册密钥错数；
  • 未知错误。

定义

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);
}

可以在安装文件夹下查看函数使用实例。


EP_RegKeyRegisterAfterDateEx

EP_RegKeyRegisterAfterDateEx函数返回注册密钥里的过期年月日。参看 创建密钥 获取更多信息。

参数

函数无参数。

返回值

如果函数执行成功，将返回1个32位日期数字，否则返回0。

备注

在以下情况函数不会执行成功：

  • 注册密钥里没有限定过期日期；
  • 注册密钥错误；
  • 未知错误。

定义

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();
}

可以在安装目录下查看函数更多使用实例。


EP_RegKeyRegisterBeforeDate

EP_RegKeyRegisterBeforeDate函数返回注册密钥里限制的截止日期。参看 创建密钥 获取更多信息；或者参看函数 EP_RegKeyRegisterBeforeDateEx。

参数

  • Year - 截至日期的年份；
  • Month - 截止日期的月份；
  • Day - 截止日期的日。

返回值

如果函数执行成功，返回值为1，否则返回0。

备注

在以下情况函数不会执行成功：

  • 注册密钥没有限制截止日期；
  • 注册密钥错误；
  • 未知错误。

定义

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);
}

可以在安装文件夹下查看函数更多实例。


EP_RegKeyRegisterBeforeDateEx

EP_RegKeyRegisterBeforeDateEx返回注册密钥里限制的截止日期的年月日，参看创建密钥获取更多信息。

参数

函数无参数。

返回值

如果函数执行成功，返回一个32位日期数值，否则返回0。

备注

在以下情况函数不会执行成功：

  • 注册密钥里没有限制截止日期；
  • 注册密钥错误；
  • 未知错误。

定义

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();
}

可以在安装文件夹下查看函数使用实例。


EP_RegShowDialog

EP_RegShowDialog shows a registration dialog that is designed and enabled on the REGISTRATION FEATURES - Registration Dialog panel. Note, Registration Dialog feature should be enabled, otherwize dialog will not be shown. Also, any Exit application actions in the Registration Dialog will not exit the application, but just close dialog window.

Return Value

Function does not return any value.

Remark

The function fails in the following cases:

  • 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

试用函数 API

试用函数主要应用在检测被保护程序的试用是否到期情况。

  • 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

参见 如何使用 Enigma API 页面来了解更多调用 API 函数的方法。

注意：Enigma API 仅在您的程序被保护后生效！即在您开发的程序中使用后，别忘记使用Enigma对程序进行保护。


EP_TrialExecutions

函数用来取得试用运行的总次数和剩余次数。试运行的总次数需要在 试用控制 - 试用次数 面板中定义。或参看 EP_TrialExecutionsLeft 和 EP_TrialExecutionsTotal 函数。

参数

  • Total - 限制程序运行的总次数。
  • Left - 剩余的运行次数。

返回值

如果函数成功执行，返回值为 1 ，否则为 0 。

备注

在以下情况函数不会执行成功：

  • 未激活过期限制功能；
  • 未知错误。

如果用户的计算机有多个登录用户，试用信息对每个用户均不同。

定义

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);
}

实例

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);
  }
}

可以在安装文件夹下的 Examples 子文件夹查看函数实例。


EP_TrialExecutionsLeft

EP_TrialExecutionsLeft 函数用来取得程序剩余试用次数，参看 EP_TrialExecutions。

参赛

函数没有参数。

返回值

如果函数成功执行，返回值为剩余的使用次数，否则返回为0。

备注

在以下情况函数不会执行成功：

  • 未激活过期限制功能；
  • 未知错误。

定义

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();
}

可以在安装文件夹下的 Examples 子文件夹查看函数实例。


EP_TrialExecutionsTotal

EP_TrialExecutionsTotal 函数用来取得程序总试用次数，参看 EP_TrialExecutions。

参赛

函数无参数。

返回值

如果函数成功执行，返回值为程序的总试用次数，否则返回0。

备注

在以下情况函数不会执行成功：

  • 未激活过期限制功能；
  • 未知错误。

定义

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();
}

可以在安装文件夹下的 Examples 子文件夹查看函数实例。


EP_TrialDays

EP_TrialDays 用来取得试用期的总天数和剩余天数。试用期的总天数需要在 试用控制 - 试用天数 面板中定义。请参看 EP_TrialDaysLeft 和 EP_TrialDaysTotal 函数。

参数

  • Total - 试用期总天数。
  • Left - 试用期剩余天数。
返回值

如果函数成功执行，返回值为 1 ，否则为 0 。

备注

在以下情况函数不会执行成功：

  • 未激活过期限制功能；
  • 未知错误。

如果用户的计算机有多个登录用户，试用信息对每个用户均不同。

定义

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);
}

实例

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);
  }
}

可以在安装文件夹下的 Examples\Trial subfolder 查看函数实例。


EP_TrialDaysLeft

EP_TrialDaysLeft 函数用来获取剩余试用天数，参看 EP_TrialDays 函数。

参数

函数无参数。

返回值

如果函数成功执行，返回值为剩余的使用天数，否则返回0。

备注

在以下情况函数不会执行成功：

  • 未激活过期限制功能；
  • 未知错误。

定义

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();
}

可以在安装文件夹下的 Examples 子文件夹查看函数实例。


EP_TrialDaysTotal

EP_TrialDaysTotal 函数用来获取程序总试用天数。参看 EP_TrialDays 函数。

参数

函数无参数。

返回值

如果函数成功执行，返回值为总试用天数，否则返回0。

备注

在以下情况函数不会执行成功：

  • 未激活过期限制功能；
  • 未知错误。

定义

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();
}

可以在安装文件夹下的 Examples 子文件夹查看函数实例。


EP_TrialExpirationDate

EP_TrialExpirationDate 函数用来取得试用期的过期日期。试用期的过期日期需要在 试用控制 - 过期日期 面板中定义。参看 EP_TrialExpirationDateEx 函数。

参数

  • Year - 试用期过期的年份；
  • Month - 试用期过期的月份；
  • Day - 试用期过期的日期；

返回值

如果函数成功执行，返回值为 1 ，否则为 0 。

备注

在以下情况函数不会执行成功：

  • 未激活过期限制功能；
  • 未知错误。

如果用户的计算机有多个登录用户，试用信息对每个用户均不同。

定义

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);
}

实例

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;

可以在安装文件夹下 Examples\Trial 查看函数使用实例。


EP_TrialExpirationDateEx

EP_TrialExpirationDateEx 函数用来取得过期日期的年月日。参看 EP_TrialExpirationDate 函数。

参数

函数无参数。

返回值

如果函数成功执行，返回值为一个32位日期数值，否则返回0。

备注

在以下情况函数不会执行成功：

  • 未激活过期限制功能；
  • 未知错误。

定义

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();
}

可以在安装文件夹下查看函数使用实例。


EP_TrialDateTillDate

EP_TrialDateTillDate 函数用来取得试用期的开始日期和结束日期。试用期需要在 试用控制 - 从日期到日期 面板中定义。参看 EP_TrialDateTillDateStartEx 和 EP_TrialDateTillDateEndEx 函数。

参数

  • StartYear - 开始试用的年份；
  • StartMonth - 开始试用的月份；
  • StartDay - 开始试用的日期；
  • EndYear - 结束试用的年份；
  • EndMonth - 结束试用的月份；
  • EndDay - 结束试用的日期。
返回值

如果函数成功执行，返回值为 1 ，否则为 0 。

备注

在以下情况函数不会执行成功：

  • 过期日期定义错误；
  • 未知错误。

如果用户的计算机拥有多个帐户，每个用户的试用期均不一样。

定义

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);
}

可以在安装文件夹下 Examples\Trial 子文件夹里查看函数使用实例。


EP_TrialDateTillDateStartEx

EP_TrialDateTillDateStartEx 函数用来取得开始试用的日期，试用期需要在 试用控制 - 从日期到日期 面板中定义。参看函数 EP_TrialDateTillDate 。

参赛

函数无参数。

返回值

如果函数成功执行，返回值为一个32位日期数值，否则返回0。

备注

在以下情况函数不会执行成功：

  • 没有限制程序试用期；
  • 未知错误。

定义

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();
}

可以在安装文件夹下查看函数使用实例。


EP_TrialDateTillDateEndEx

EP_TrialDateTillDateEndEx函数用来取得程序试用结束的年月日。试用期需要在 试用控制 - 从日期到日期 面板中定义。参看 EP_TrialDateTillDate 函数。

参数

函数无参数。

返回值

如果函数成功执行，返回值为一个32位的日期数值，否则返回0。

备注

在以下情况函数不会执行成功：

  • 没有限制程序试用期；
  • 未知错误。

定义

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();
}

可以在安装文件夹下查看函数使用实例。


EP_TrialExecutionTime

EP_TrialExecutionTime 函数用来取得试用运行的总时间和剩余时间。试运行的总时间需要在 试用控制 - 运行时间 面板中定义。参看 EP_TrialExecutionTimeLeft 和 EP_TrialExecutionTimeTotal函数。

参数

  • Total - 试运行总时间（分钟）。
  • Left - 试运行剩余时间（分钟）。

返回值

如果函数执行成功，返回值为1，否则为0。

备注

在以下情况函数不会执行成功：

  • 未激活运行时间限制功能；
  • 未知错误。

定义

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);
}

实例

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;
  }
}

可以在安装文件夹下 Examples\TrialExecutionTime 子文件夹里查看函数实例。


EP_TrialExecutionTimeLeft

EP_TrialExecutionTimeLeft 函数用来取得试运行的剩余时间（分钟）。参看 EP_TrialExecutionTime。

参数

函数无参数。

返回值

如果函数执行成功，返回值为程序试运行的剩余时间，否则返回0。

备注

在以下情况函数不会执行成功：

  • 未激活运行时间限制功能；
  • 未知错误。

定义

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();
}

可以在安装文件夹下查看函数使用实例。


EP_TrialExecutionTimeTotal

EP_TrialExecutionTimeTotal 函数用来取得试运行总时间（分钟），参看 EP_TrialExecutionTime。

参数

函数无参数。

返回值

如果函数成功执行，返回试运行总时间（分钟），否则返回0。

备注

在以下情况函数不会执行成功：

  • 未激活运行时间限制功能；
  • 未知错误。

定义

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();
}

可以在安装文件夹下查看函数使用实例。


加解密函数API

Crypt API 是一个获取字符串哈希值的函数，支持加密/解密自定义文件。

  • EP_CryptHashBuffer
  • EP_CryptHashFileA
  • EP_CryptHashFileW
  • EP_CryptHashStringA
  • EP_CryptHashStringW
  • EP_CryptDecryptBuffer
  • EP_CryptDecryptBufferEx
  • EP_CryptEncryptBuffer
  • EP_CryptEncryptBufferEx

点击 如何使用 Enigma API 页面了解更多关于调用 API 的信息

警告: Enigma API 仅仅在程序被加壳保护后发生作用，请不要忘记加密您的程序。


EP_CryptDecryptBuffer

EP_CryptDecryptBuffer使用定义好的密钥解密内容。

参数

  • Buffer - 解密内存中的内容。
  • Size - 解密内容在内存中的大小。
  • Key - 转换成ANSI，空字符串也将作为密钥进行解密。

返回值

函数无返回值。

定义

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);
}

可以在安装文件夹下 Examples\CryptBuffer 子文件夹里查看函数实例。


EP_CryptDecryptBufferEx

EP_CryptDecryptBufferEx 使用定义好的密钥解密内容。

参数

  • InBuffer - 解密输入内存内容。
  • OutBuffer - 解密输出内存内容。
  • Size - 内容在内存中的大小。
  • Key - 用于解密内容的密钥。
  • KeySize - 密钥内容大小。

返回值

函数无返回值。

定义

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);
}

可以在安装文件夹下 Examples\CryptBuffer 子文件夹里查看函数实例。


EP_CryptEncryptBuffer

EP_CryptEncryptBuffer 使用定义好的密钥加密内容。

参数

  • Buffer - 加密内存中的内容。
  • Size - 内存中数据大小。
  • Key - 转换成ANSI，空字符串也将作为密钥进行加密。

返回值

函数无返回值。

定义

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);
}

可以在安装文件夹下 Examples\CryptBuffer 子文件夹里查看函数实例。


EP_CryptEncryptBufferEx

EP_CryptEncryptBufferEx 使用定义好的密钥加密内容。

参数

  • InBuffer - 加密输入内容。
  • OutBuffer - 输出加密后的内容。
  • Size - 内容在内存中的大小。
  • Key - 加密使用的密钥。
  • KeySize - 密钥内容在内存中的大小。

返回值

函数无返回值。

定义

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);
}

可以在安装文件夹下 Examples\CryptBuffer 子文件夹里查看函数使用实例。


EP_CryptHashBuffer

EP_CryptHashBuffer 函数使用用户定义好的内容进行hash(哈希)计算。

参数

  • Hash - 哈希计算形式。
    哈希值形式 | 参数 = 值
    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 - 计算内存内容哈希值。
  • Size - 内存内容的大小。
  • Digest - 得出内容的哈希值。

返回值

如果函数执行成功，返回值为对应的特定形式哈希值，否则返回为0。

哈希值形式 | 哈希值大小(字节)
XOR32 | 4
MD2 | 16
MD5 | 16
RipeMD160 | 20
SH1 | 20
SHA224 | 28
SHA256 | 32
SHA384 | 48
SHA512 | 64

备注

在以下情况函数不会被成功执行

  • 输入内容不相配；
  • 输入内容不可读；
  • 指定内容未分配；
  • 指定内容（缓冲区）写保护；
  • 未知错误。

定义

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);
}

可以在安装文件夹下 Examples\Hashes 子文件里查看函数实例。


EP_CryptHashFileA

EP_CryptHashFileA 使用用户定义文件计算哈希值。

参数

  • Hash - 计算哈希值的形式。
    哈希值形式 | 参数 = 值
    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- 文件名字符串。
  • Digest - 得出内容的哈希值。

备注

如果函数成功执行，返回值为对应哈希值，否则返回0。

哈希值形式 | 哈希值大小(字节)
XOR32 | 4
MD2 | 16
MD5 | 16
RipeMD160 | 20
SH1 | 20
SHA224 | 28
SHA256 | 32
SHA384 | 48
SHA512 | 64

备注

在以下情况函数不会成功执行

  • 文件名没有指定；
  • 文件名不可读；
  • 指定内容未分配；
  • 指定内容（缓冲区）只读；
  • 未知错误。

定义

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);
}

可以在安装文件夹下 Examples\Hashes 子文件夹里查看函数使用实例。


EP_CryptHashFileW

EP_CryptHashFileA 使用用户定义文件计算哈希值。

参数

  • Hash - 计算哈希值的形式。
    哈希值形式 | 参数 = 值
    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- 文件名，UNICODE字符串。
  • Digest - 得出的哈希值。

返回值

如果函数执行成功，返回值为对应形式的哈希值，否则返回为0。

哈希值形式 | 哈希值大小(字节)
XOR32 | 4
MD2 | 16
MD5 | 16
RipeMD160 | 20
SH1 | 20
SHA224 | 28
SHA256 | 32
SHA384 | 48
SHA512 | 64

备注

以下情况函数不会执行成功

  • 文件名没有指定；
  • 文件名不可读；
  • 指定内容未非配；
  • 指定内容（缓冲区）只读；
  • 未知错误。

定义

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);
}

可以在安装文件夹下 Examples\Hashes 查看函数使用实例。


EP_CryptHashStringA

EP_CryptHashStringA 使用用户定义的ANSI字符串进行哈希值计算。

参数

  • Hash - 计算哈希值的形式。
    哈希值形式 | 参数 = 值
    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 - 得出ANSI字符串。
  • Digest - 得出内容哈希值。

返回值

如果函数执行成功，返回值为对应形式的哈希值，否则返回0。

哈希值形式 | 哈希值大小(字节)
XOR32 | 4
MD2 | 16
MD5 | 16
RipeMD160 | 20
SH1 | 20
SHA224 | 28
SHA256 | 32
SHA384 | 48
SHA512 | 64

备注

在以下情况函数不会执行成功：

  • 未指定字符串；
  • 指定内容未分配；
  • 指定内容（缓冲区）早读；
  • 未知错误。

定义

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);
}

可以在安装文件夹下 Examples\Hashes 子文件夹里查看函数使用实例。


EP_CryptHashStringW

EP_CryptHashFileW 使用用户定义的UNICODE字符串进行哈希值计算。

参数

  • Hash - 计算哈希值的形式。
    哈希值形式 | 参数 = 值
    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 - 得出UNICODE字符串。
  • Digest - 得出内容哈希值。

返回值

如果函数执行成功，返回值为对应形式的哈希值，否则返回为0。

哈希值形式 | 大小 (字节)
XOR32 | 4
MD2 | 16
MD5 | 16
RipeMD160 | 20
SH1 | 20
SHA224 | 28
SHA256 | 32
SHA384 | 48
SHA512 | 64

备注

在以下情况函数不会执行成功：

  • 字符串未指定；
  • 指定内容未非配；
  • 指定内容只读；
  • 未知错误。

定义

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);
}

可以在安装文件夹下 Examples\Hashes 子文件夹里查看函数实例。


其他函数 API

其他函数包括有：字符串加密保护，检测程序进程、水印，获取Enigma版本等等。

  • EP_MiscCountryCode
  • EP_MiscGetWatermark
  • EP_ProtectedStringByID
  • EP_ProtectedStringByKey
  • EP_CheckupCopies
  • EP_CheckupCopiesCurrent
  • EP_CheckupCopiesTotal
  • EP_CheckupIsEnigmaOk
  • EP_CheckupIsProtected
  • EP_CheckupVirtualizationTools

参见 如何使用 Enigma API 页面来了解更多调用 API 函数的方法。

注意：Enigma API 仅在您的程序被保护后生效！即在您开发的程序中使用后，别忘记使用Enigma对程序进行保护。


EP_CheckupCopies

EP_CheckupCopies 函数返回程序的限制进程数。在 进程实例数量限制 页面设置，参看EP_CheckupCopiesCurrent 和 EP_CheckupCopiesTotal函数。

参数

  • Total - 允许程序运行的总进程数。
  • Current - 程序正运行的进程数。

返回值

如果函数成功执行，返回值为1，否则为0。

备注

函数在以下情况不会执行成功:

  • 程序没有设置进程数限制；
  • 未知错误。

定义

Show/Hide C++ function definition

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

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);
}

实例

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;

可以在安装文件夹下 Examples\ExecutedCopies 子文件夹里查看函数使用实例。


EP_CheckupCopiesCurrent

EP_CheckupCopiesCurrent 函数获取程序进程数，参看 EP_CheckupCopies。

参数

函数无参数。

返回值

如果函数执行成功，返回值为程序进程数，否则为0。

备注

在以下情况函数不会执行成功：

  • 程序进程数限制没有激活；
  • 未知错误。

定义

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();
}

可以在安装文件夹下查看函数使用实例。


EP_CheckupCopiesTotal

EP_CheckupCopiesTotal 函数返回允许程序进程数总数。参看 EP_CheckupCopies 。

参数

函数无参数。

返回值

如果函数执行成功，返回值为程序允许运行的进程数总数，否则为0。

备注

在以下情况函数不会执行成功：

  • 程序进程数限制没有激活；
  • 未知错误。

定义

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();
}

可以在安装文件夹下查看函数使用实例。


EP_CheckupIsEnigmaOk

EP_CheckupIsEnigmaOk 是一个非常有用的函数，它主要的功能是检测程序保护码是否被破坏，即有没有被破解或者被修改，如果被保护程序被修改或被破解，函数将返回空值。

返回值

如果检测保护码正常、程序也未被修改返回值为1，否则返回0。

定义

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();
}

实例

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;

可以在安装文件夹下 Examples\CheckEnigma 子文件夹里查看函数使用实例。


EP_CheckupIsProtected

EP_CheckupIsProtected 函数非常简单实用，功能为获取被保护文件是否仍然在Enigma保护下。

返回值

如果程序在保护中，返回值为1，否则为0。

定义

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();
}

实例

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;

可以在安装文件夹下 Examples\CheckEnigma 子文件夹里查看函数使用实例。


EP_EnigmaVersion

EP_EnigmaVersion 获取被保护程序使用的Enigma版本。

返回值

返回值为被保护程序使用的Enigma版本。如返回 0x014E (334) 意思为 1.78版本。

定义

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();
}

可以在安装文件夹下 Examples\CheckEnigma 子文件夹里查看函数使用实例。


EP_MiscCountryCode

EP_MiscCountryCode 函数获取用户区域，参看 创建密钥 。
区域名称 | 代码 | 值
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

参数

函数无参数

返回值

如果函数执行成功，返回值为用户区域代码，否则返回0

备注

函数在以下情况失效:

  • 程序没有进行保护。

定义

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();
}

在程序安装目录里可查看更多函数使用实例。


EP_MiscGetWatermark

EP_MiscGetWatermark 函数获取被保护程序水印。点击 水印 查看更多信息。

参数

  • ID - 返回水印数；
  • WM - 水印内容状态，如果为空则返回水印数；
  • WM.WMType - 返回水印形式；
  • WM.Name - 水印名；
  • WM.NameLen - 水印名长度；
  • WM.Text - 水印内容，如果空则返回内容长度；
  • WM.TextLen - 水印内容长度；
  • WM.FileName - 水印文件名，空则返回内容长度；
  • WM.FileNameLen - 水印文件长度；
  • WM.AFile - 返回水印文件，为空则返回内容长度；
  • WM.AFileLen - 水印文件内容长度；

返回值

如果函数执行成功，返回水印数。否则返回0。

备注

以下情况函数不能成功执行：

  • 被保护文件里没有水印；
  • 未知错误。

定义

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);
}

实例

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;

可以在安装文件夹下 Examples\Watermarks 子文件夹里查看函数使用实例。


EP_ProtectedStringByID

EP_ProtectedStringByID 使用字符串ID，函数返回被保护的字符串。参看 加密字符串。

参数

  • ID - 被保护字符串的ID，数值型。
  • Buffer - 被保护内容转换，如果为空，函数返回被保护内容大小。
  • Len - 被保护字符串大小（长度）。

返回值

如果函数成功执行，返回值为被保护内容大小（长度），否则返回0。

备注

以下情况函数不能成功执行：

  • 对应ID下无加密字符串；
  • 未知错误。

定义

Show/Hide C++ function definition

extern "C" __declspec( dllimport ) __stdcall int EP_ProtectedStringByID( int Total, char* Left, 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, StringBuilder Str, Int32 Len);
}

实例

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 := pchar(buf);
    end;
    FreeMem(buf);
  end;
end;

Show/Hide C# (.NET) function example

private void Form1_Shown(object sender, EventArgs e)
{
    Int32 len = Enigma_IDE.EP_ProtectedStringByKey("fyi6z02Y", null, 0);
    if (len > 0)
    {
        StringBuilder str = new StringBuilder(len);
        if (Enigma_IDE.EP_ProtectedStringByKey("fyi6z02Y", str, len) > 0)
        {
            textBox1.Text = str.ToString();
        }
    }

    len = Enigma_IDE.EP_ProtectedStringByID(1, null, 0);
    if (len > 0)
    {
        StringBuilder str = new StringBuilder(len);
        if (Enigma_IDE.EP_ProtectedStringByID(1, str, len) > 0)
        {
            textBox2.Text = str.ToString();
        }
    }

    len = Enigma_IDE.EP_ProtectedStringByKey("26Lu66Er", null, 0);
    if (len > 0)
    {
        StringBuilder str = new StringBuilder(len);
        if (Enigma_IDE.EP_ProtectedStringByKey("26Lu66Er", str, len) > 0)
        {
            textBox3.Text = str.ToString();
        }
    }
}

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

可以在安装文件夹下 Examples\ProtectedStrings 子文件夹里查看函数使用实例。


EP_ProtectedStringByKey

EP_ProtectedStringByKey 使用密钥，函数返回被保护字符串。参看 加密字符串。

参数

  • Key - 被保护字符串对应密钥。
  • Buffer - 被保护内容转换，如果为空，函数返回被保护内容大小。
  • Len - 被保护内容大小（长度）。

返回值

如果函数成功执行，返回值为被保护字符串，否则为0。

备注

在以下情况函数不能成功执行：

  • 对应密钥下无被保护字符串；
  • 未知错误。

定义

Show/Hide C++ function definition

extern "C" __declspec( dllimport ) __stdcall int EP_ProtectedStringByKey( char* Key, char* Left, int Len);

Show/Hide Delphi function definition

function EP_ProtectedStringByKey(Key : pchar; 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, StringBuilder Str, Int32 Len);
}

实例

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 := pchar(buf);
    end;
    FreeMem(buf);
  end;
end;

Show/Hide C# (.NET) function example

private void Form1_Shown(object sender, EventArgs e)
{
    Int32 len = Enigma_IDE.EP_ProtectedStringByKey("fyi6z02Y", null, 0);
    if (len > 0)
    {
        StringBuilder str = new StringBuilder(len);
        if (Enigma_IDE.EP_ProtectedStringByKey("fyi6z02Y", str, len) > 0)
        {
            textBox1.Text = str.ToString();
        }
    }

    len = Enigma_IDE.EP_ProtectedStringByID(1, null, 0);
    if (len > 0)
    {
        StringBuilder str = new StringBuilder(len);
        if (Enigma_IDE.EP_ProtectedStringByID(1, str, len) > 0)
        {
            textBox2.Text = str.ToString();
        }
    }

    len = Enigma_IDE.EP_ProtectedStringByKey("26Lu66Er", null, 0);
    if (len > 0)
    {
        StringBuilder str = new StringBuilder(len);
        if (Enigma_IDE.EP_ProtectedStringByKey("26Lu66Er", str, len) > 0)
        {
            textBox3.Text = str.ToString();
        }
    }
}

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

可以在安装文件夹下 Examples\ProtectedStrings 子文件夹里查看函数使用实例。


EP_SplashScreenShow

EP_SplashScreenShow 允许显示自定义闪屏。参看 闪屏设置.。

返回值

如果函数成功执行，返回值为闪屏句柄，否则返回空值。

定义

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();
}

实例

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.

可以在安装文件夹下 Examples\SplashScreen 里查看函数使用实例。


EP_SplashScreenHide

EP_SplashScreenHide 函数隐藏闪屏（如果闪屏是显示状态的）参看 闪屏设置 。

定义

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();
}

实例

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.

可以在安装文件夹下 Examples\SplashScreen 查看函数使用实例。


EP_CheckupVirtualizationTools

EP_CheckupVirtualizationTools allows to check if the file is started under any of the known Virtualization Tools like VMWare/VirtualBox/VirtualPC. Note, you have to enable CHECK-UP - Virtualization Tools feature, select necessary virtualization tools you would like to check and disable option Terminate Execution.

Return Value

Function returns 1 (true) if the file is started under any virtualization tool or 0 (false) if the function failed. See Remark section below to know the cases when the function fails.

Remark

The function fails in the following cases:

  • application is not protected;
  • CHECK-UP - Virtualization Tools feature is not enabled;
  • necessary Virtualization Tools for checking were not selected on 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.


如何使用 Enigma API

您可以通过输入表调用 enigma_ide.dll 里的函数来使用 Enigma Protector 的 API ，或者通过 GetModuleHandleA, LoadLibraryA 和 GetProcAddress 函数也可以。您可以在 Enigma Protector 的安装目录 Examples 文件夹里找到如何使用 Enigma API 的常用方法。下面显示了如何调用 Enigma API 的多个实例：

Delphi

var
  pEP_RegHardwareID : function : pchar;
  pEP_RegCheckKey : function(pcName, pcKey : pchar) : boolean;
  pcName : pchar;
  pcKey : pchar;

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;


常见问题

在本节您会找到很多常见问题的答案。

  • API 常见问题 - 使用 Enigma API 的常见问题；
  • 密匙生成器常见问题 - 使用内建的密匙生成器的常见问题；
  • Protector 常见问题 - 保护工具工作特性的常见问题；
  • 其它常见问题 - 没有包含在以上主题中的其它常见问题；
  • 注册管理器常见问题 - 关于 Enigma Protector 注册管理器的一些常见问题；
  • 邮件管理器常见问题 - 关于 Enigma Protector 邮件管理器的一些常见问题。


API 常见问题

问：我使用 Visual Basic 开发软件，我无法确定 Enigma API 为什么执行失败了，下面是我的一部分代码：

If EP_RegLoadAndCheckKey = TRUE Then
  ' ****************
End If
If - End If 间的代码不被执行。

答：您代码的第一句有错误，表达式 EP_RegLoadAndCheckKey = TRUE 在 Visual Basic 中不会被执行。这是因为在 Visual Basic 中 TRUE 的值代表 $FFFF， FALSE 的值是 0，但是 Enigma API 函数如果失败返回的是 0，成功返回的是 1 。使用下面的方法解决您的问题：

If EP_RegLoadAndCheckKey Then
  ' ****************
End If

问：我是否需要同被保护的文件一起发布 enigma_api.dll ？

答：您不需要，enigma_api.dll 只是个空链接库，用来导出空 Enigma API 函数。这个链接库只是开发过程中用来调试未保护的程序用的，所以您不必随同保护后的文件一同发布。

问：Enigma API 是否可以在 Visual Basic .NET 应用程序中使用？

答：是的，完全可以！Enigma API 在 Visual Basic .NET 中的定义与在 Visual Basic 类似，请参见 Example\ 目录下 API 函数的应用实例和 EnigmaSDK\VB\ 目录下 API 函数的定义。


密匙生成器常见问题

问：我这里有多个用户可以创建注册密匙，我需要一种多用户可以同时使用密匙生成器来访问密匙数据库的服务。我是否可以将自定义的密匙生成器放到共享文件夹？

答：我们推荐您使用微软的 Access 数据库来存储注册密匙，您可以查看帮助主题“自定义密匙生成器\共享文件夹的密匙生成器”来获取更多帮助。

问: 我使用UNICODE注册信息，我怎么计算出UNICODE注册信息呢？

答: A当您选择激活了UNICODE注册信息，算号器或导出的注册机会自动计算符合UNICODE的注册信息。

问: 我需要使用Enigma保护多个程序，但当我分发给用户一个KEY的时候，用户可以用这个KEY注册同一机器上的我开发的其他程序，怎么办呢？

答: 这是因为您保护程序时候，都使用了同一个项目文件，即保护密钥都是一样的，所以用户能使用一个注册码注册多个同保护项目的程序，要防止这种情况，请您在保护程序时候，每个程序单独新建一个项目，这样就防止了保护密钥的相同，每个保护的程序注册码自然也就不同了。


其它常见问题

问：我需要一份带有扩展选项的特别版的 Enigma Protector ，不知您能否开发？

答：是的，完全可能，但是您的意图必须是合法安全的，请通过 Email 联系我们。


Protector 常见问题

问：我遗失了 Enigma Protector 的项目文件，我无法再次保护我的程序并且无法为当前文件创建注册密匙，我该如何修复？

答：很抱歉，已经无法修复。Enigma Protector 的项目文件包含了多组用来创建密匙的唯一信息，由于这些信息是在项目文件创建时随机生成的，所以我们无法恢复它。请务必备份您的项目文件！

问：我的软件有两个拷贝，其中一个用 Enigma Protector 保护过了，另一个没有，我如何能知道哪一个是保护过的呢？

答：可以通过 Reg_Crypt 宏来解决，请看下面的 Delphi 实例：

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;


注册管理器常见问题

问：Enigma Protector 的注册信息数据库存放在哪里？

答：Enigma Protector 的注册信息数据库存放在当前目录下，文件名与项目文件相同，扩展名为 .enigmadb.


邮件管理器常见问题

问：Enigma Protector 的邮件管理器设置和数据库存放在哪里？

答：Enigma Protector 邮件管理器的设置和数据库存放在当前目录下，文件名与项目文件相同，扩展名为 .enigmamail.

问: 我无法使用gmail帐户发送邮件，提示错误。

答: 解决该问题需在邮箱设置处允许 SSL 选项。


开始使用

软件加密保护很重要的一点是实施正确的保护方案，如果您的保护方案有错误，即便再强的保护也有可能被破解。我们推荐您采纳以下建议，这样可以极大的增加软件的破解难道：

  • 如果您使用注册密匙功能，我们强烈建议您使用加密宏来限制软件的可使用性。加密宏是最强的保护特性，只有当软件正确注册后，宏里的代码才会被解密，并且解密用的密匙信息仅存储在注册密匙中，所以，如果没有正确的注册密匙，软件是不可能被破解的；
  • 软件开发者存在一个很大的误区是启用试用功能却没应用任何试用限制。请一定不要让试用版程序拥有全部功能，因为目前还没有绝对安全的方法可以确保试用限制不被破解，试用限制的保护只是增大软件破解的难度和成本，以减少您软件被破解的可能性；
  • 只有演示版可以让破解者失去破解您软件的兴趣。演示版只含有软件的基本功能，并不提供高级的特别功能，这种版本因为不含有特别功能的代码，所以永远也不会被破解成完整版。

让我们开始吧！

要实施保护方案请遵循下面的步骤：

  1. 创建唯一的 Enigma 项目；
  2. 选择必要的输入参数；
  3. 选择必要的保护参数；
  4. 选择试用保护参数（可选）；
  5. 选择注册密匙参数（可选）；
  6. 修改源代码（可选）；
  7. 实施保护方案。


选择输入参数

输入参数是开始保护前的重要步骤，下面是一些基本参数：

  1. 要保护的文件。请确保这些文件是 Enigma Protector 支持的文件类型。
  2. 产品名称和版本。这部分信息对每个项目文件都必须是唯一的，因为要用来创建一些唯一的保护参数。
  3. 要输出的文件。


选择保护参数

选择必要的保护参数

  • 检测选项
  • 保护特性
  • 模糊选项
  • 其它选项


创建项目文件

创建保护项目文件是实施保护前的重要步骤，项目文件含有一系列保护参数和一些用来创建和验证注册密匙唯一的常量信息。这种唯一的常量信息是在每次项目文件创建时随机生成的，每个项目文件均不一样。

注意：
  • 不要随同被 Enigma Protector 保护过的文件一起发布您的项目文件！项目文件可以可以被某些别有用心的人拿来创建注册密匙。
  • 尽量备份您的项目文件！如果项目文件遗失，您将无法修复唯一的常量信息，并且无法为当前项目创注册密匙！


注册密匙特性

选择注册密匙的一些参数。Enigma Protector 支持为被保护文件创建注册密匙，这样您可以方便的创建共享软件，以及为客户分发注册密匙。注册密匙基于用户信息、用户硬件锁定（可选）、密匙创建时间、密匙过期日期（可选）和加密区段的名称（可选），这样就可以为您的软件提供灵活的试用限制保护。计算注册密匙使用了 RSA 512 位不对称加密算法，该算法为您的软件提供了非常高的保护，可以有效阻止对注册密匙的重建和逆向。为要保护的软件定义注册密匙的存储位置和硬件锁定参数是很必要的。（参见 程序预览 一节）

注册保护可以由以下两种方式实现：

  1. 使用文件存储注册信息。这是由注册信息的存储位置决定的，您可以将注册文件（用户需要执行该注册文件，以便将注册信息导入到注册表）或密匙文件（该文件含有注册信息，需要复制到在“注册信息存储”面板中定义的文件夹）发送给用户。
  2. 使用 Enigma 内部 API 函数检查、读取、保存和删除注册信息。这种方式需要您修改一下源代码，为用户提供输入注册信息的对话框，为软件提供检查和保存注册信息的功能。


试用限制

选择试用期参数。试用限制特性用来为用户未注册的软件版本提供一段有功能限制的试用期。Enigma Protector 支持以下类型的试用限制：试用次数限制，试用天数限制以及过期日期。所有的试用限制都可以通过 Enigma API 手动控制，这样您就可以完全控制试用次数并且方便作成改变（例如，您可以在试用期结束前的几天/几次时提醒您的用户注册）。如果您不使用 Enigma API，您还可以在“试用控制”面板手动定义试用类型。同时，Enigma Protector 还支持提醒消息（提示屏幕），提醒消息可以在软件运行过程中每隔一段时间出现，时间间隔可以手动定义。有的用户希望通过回拨系统时钟来恢复软件的功能，我们拥有检查系统时钟回拨的特性来阻止这类情况的发生。系统时钟检查与试用限制无关，所以软件注册后该功能也不会失效。

注意：注册后上述的所有试用限制都会被移除。试用限制的细节特性请查阅 程序预览 一节。


密钥生成器

本节内容告诉您如何使用密钥生成器。点击以下链接获取详细信息：

  • 创建密钥
  • 检查密钥
  • 自定义密钥生成器
  • 导出注册机
  • 许可管理器
  • CGI 密钥生成器(网页形式)


检查密钥

检查密钥的操作是和创建密钥在同一窗口（参加 创建密钥 ）。填写“注册密钥”文本框并点击“验证”按钮来验证密钥的正确性。在“验证结果”一栏您就会看到密钥验证的结果。

例如：

注册密钥：

Vladimir

Registration key :

W3UH9K-L5EUT2-XUPUYJ-P8YYHR

Verifying results :

有效的注册密钥。
密钥信息：
注册信息：0x80DBC089
创建于：2007年4月17日
过期日期：2008年1月1日
已解锁加密的区段 #1
已解锁加密的区段 #7
已解锁加密的区段 #16

上述信息意味着该密钥对当前项目有效，包含有以下信息：

  • 密钥创建日期：2007年4月17日；
  • 密钥过期日期：2008年1月1日；
  • 密钥已经解密了以下区段 #1, #7, #16.


创建密钥

要为当前项目创建注册密钥，您可以使用 Enigma Protector 提供的服务组件 - 密钥生成器。密钥生成器可以使用 Enigma Protector 的内建菜单，也可以手动运行。

使用内置的“密钥生成器”来创建注册密钥。

请按以下步骤使用内置密钥生成器创建密钥：

  • 在 注册特性-常规选项 版设置好内容；
  • 打开The Enigma Protector选择主菜单-工具-密钥生成器。

  • 填写“注册名称”文本框。注册名称是指为用来生成注册密钥的用户名，注册名称会和注册密钥一起发布给用户，所以不能为空。
  • "添加连字符" - 注册密钥中将自动添加“-”连字符。
  • 密钥过期日期是指密钥不再有效的指定日期。要取得密钥过期日期，您可以使用 Enigma API 函数 EP_RegKeyExpirationDate 。该参数不是必需的。
  • 硬件 ID 是针对某一计算机创建注册密钥唯一的硬件指纹信息字符串。要取得硬件 ID 您必须使用 Enigma API 函数 EP_RegHardwareID ，该函数允许您在用户计算机上取得唯一的硬件信息字符串（参见 硬件锁定 ）。该参数不是必需的。
  • 选择密钥将解密的加密区段（参见 加密标识 ）。该参数不是必需的。
  • 点击“创建”按钮。如果计算成功，注册密钥会显示在“注册密钥”文本框。
  • 使用自定义注册机创建注册密钥

Enigma Protector 支持创建自定义的密钥生成器（参见 自定义密钥生成器 ）。


CGI 注册密钥

CGI 密钥生成

CGI 注册密钥生成可以用来在服务器上计算生成。CGI密钥生成系统应放置在服务器上（有2种服务器方式，Windows系统和Linux服务器，您可在EnigmaSDK\CGI Keygen文件夹里找到）cgi-bin 文件夹中，并且有管理员权限来生成密钥文件。当您使用CGI密钥生成器来生成Key时，密钥生成器则可以通过GET或者POST的方式提交或者获取。

如何使用CGI密钥生成器:
1. 把密钥生成器放在您服务器上的 cgi-bin 文件夹里（请确认您的服务器支持类型）
2. 有权限使程序能获取注册文件("keygen" for Linux系统， "keygen.exe" for Windows 系统)
3. 设置一个注册密钥生成器链接:

以下可以使用在CGI密钥生成器:

  • GenerateKey - 生成 ansi* 型注册密钥;
  • GenerateKeyA - 复制注册码;
  • GenerateKeyW - 生成 unicode* (长字符) 型注册密钥;
  • GenerateKeyFromProject - 生成 ansi* 注册密钥, 生成的注册密钥属性来自原工程文件;
  • GenerateKeyFromProjectA - 从工程复制生成注册密钥;
  • GenerateKeyFromProjectW - 生成 unicode* (长字符)注册密钥，生成的注册密钥属性来自原工程文件.

* 请注意您的项目文件是仅设定 ansi 或者 仅设定 unicode 方案的授权文件。如果您激活 常规选项 即 常规选项 - 常规 面板, 则密钥生成器将生成对应的UNICODE或ANSI形式。
** 生成器属性 - 密钥模式，密钥大小，加密，公钥，私钥。

CGI 密钥生成器有以下属性:
激活 - 有以下函数定义来激活使用:

  • GenerateKey
  • GenerateKeyA
  • GenerateKeyW
  • GenerateKeyFromProject
  • GenerateKeyFromProjectA
  • GenerateKeyFromProjectW

文件名 - 项目工程文件名字。
注册名 - 在这里输入注册密钥的用户名。请注意这里的字符串将被加密显示(如 空格 将被翻译成 %20 而不是 " ");
密钥长度 - 定义生成的密钥长度，在您的Enigma项目文件里的 注册特性 -- 常规选项 面板里设置;
密钥输出方式 - 定义输出的注册密钥，在您的Enigma项目文件里的 注册特性 -- 常规选项 面板里设置;
连字符 - 选择是否在注册密钥中增加连接字符，如果增加，则输入1，否则跳过设置该属性;
硬件 - 硬件ID将锁定注册密钥;
过期时间 - 注册密钥过期时间*;
指定时间后注册 - 在指定时间后需要注册*;
指定时间前注册 - 在指定时间前需要注册*;
运行次数 - 注册密钥里限定程序运行的次数;
限制天数 - 注册密钥里限定使用天数;
运行时间 - 注册密钥里限定运行时间;
运行总时间 - 注册密钥里限定运行总时间;
区域 - 注册密钥里锁定运行区域;
区间 - 如果原程序选择需要加密区间，则选择这里进行解密区间
加密点 - 使用记事本打开您的Enigma项目工程文件以获取加密点
私钥 和 公钥 - 对应的值请参看Enigma的常规选项 -- 常规面板, 有公钥私钥的相关信息生成。

* 日期值将被定义成特定格式：2字节（日）+2字节（月）+2字节（年）。如2010年12月1日将被写成01122010字符串

实例

Show/Hide HTML (GET method) example

Show/Hide HTML (GET method) getting parameters from project file example

Show/Hide HTML (POST method) example

Show/Hide HTML (POST method) getting parameters from project file example

Show/Hide PHP (POST method) example

Show/Hide PHP (GET method) example

我们建议使用POST提交信息进行注册密钥生成。


导出注册机

Enigma Protector 允许对现有项目文件导出专属注册机，点击主菜单-工具-导出注册机,有以下步骤：

步骤1. 注册密钥中是否添加“-”连字符，如果不允许用户修改，则激活"Do not allow to change hyphens value"选项。

步骤 2. 解码哪个区段，如禁止用户修改，请激活"Do not allow to change sections value"。

步骤 3. 注册密钥里限制过期日期，如禁止用户修改，请激活 "Do not allow to change expiration date value"。

步骤 4. 注册密钥中限制的需在某个时间后注册，如不允许用户修改，请激活"Do not allow to change Register After date"。

步骤5. 注册密钥中限制某一个时间前必须注册，如不允许用户修改，请激活"Do not allow to change Register Before date"。

步骤 6. 限制程序进程数。如不允许用户修改，请激活"Do not allow to change Executions "。

步骤 7. 限制使用天数，如不允许用户修改，请激活 "Do not allow to change Days "。

步骤 8. 限制每次运行的时间（分钟），如不允许用户修改，请激活"Do not allow to change Run-time "。

步骤9. 限制程序运行的总时间，如不允许用户修改，请激活"Do not allow to change Global Time "。

步骤10. 限制用户区域，如不允许用户修改，请激活"Do not allow to change Country Lock "。

步骤 11. 点击“Finish”按钮，输入程序名字，导出存盘即可生成自定义注册机。


自定义密钥生成

Enigma Protector 支持为私人项目工程文件自定义生成注册密钥服务。有特定的运行库 (有 Windows 和 Linux 系统版本) keygen.dll (支持Windows) 和 libkeygen.so (支持 Linux) 可以生成和验证注册密钥。Enigma Protector 有详细的例子供您参考,如 Examples\Keygen 文件夹和 Examples\KeygenUnicode 文件夹等。请浏览以下函数:

输出方式为 ansi 的注册信息:

  • KG_GenerateRegistrationKey
  • KG_GenerateRegistrationKeyFromProject
  • KG_GenerateRegistrationKeyA
  • KG_GenerateRegistrationKeyFromProjectA
  • KG_VerifyRegistrationInfo
  • KG_VerifyRegistrationInfoFromProject
  • KG_VerifyRegistrationInfoA
  • KG_VerifyRegistrationInfoFromProjectA

输出方式为 unicode 的注册信息:

  • KG_GenerateRegistrationKeyW
  • KG_GenerateRegistrationKeyFromProjectW
  • KG_VerifyRegistrationInfoW
  • KG_VerifyRegistrationInfoFromProjectW


TKeyGenParams 形式

TKeyGenParams 结构使用 KG_GenerateRegistrationKey 和 KG_GenerateRegistrationKeyFromProject 获取注册密钥.

结构描述

密钥长度

(输入参数) 注册密钥长度 (RSA 512/768/1024/2048/3072/4096), 有以下值 (请点击 常规选项 - 常规 获取注册密钥安全/长度值):

RM_512 = 0;
RM_768 = 1;
RM_1024 = 2;
RM_2048 = 3;
RM_3072 = 4;
RM_4096 = 5;
密钥输出方式

(输入参数) 注册密钥输出方式 (Base 2/8/16/32/64), 有以下值 (详情请点击 常规选项 - 常规 了解输出密钥方式值):

RB_2 = 0;
RB_8 = 1;
RB_16 = 2;
RB_32 = 3;
RB_64 = 4;
密钥连接线

(输入参数) 设置为1则添加密钥连接线，为0则不添加 (了解更多，请点击 创建密钥);
密钥

(输入参数) unicode形式值, 空值注册密钥将使程序停止运行, 我们建议至少设置为 2048 字节长度;

密钥长度 | (输入参数) 注册密钥字节长度;
注册信息

(输入参数) ansi形式值, 空值注册信息将使程序停止运行;

注册信息长度 | (输入参数) 注册信息长度;
程序过期 | (输入参数) 如果值为0则不激活，为1则限制程序有过期时间 (了解更多，请点击 创建密钥);
过期年份 | (输入参数) 密钥限制过期年份;
过期月份 | (输入参数) 密钥限制过期月份;
过期日期 | (输入参数) 密钥过期日期;
硬件锁定

(输入参数) 设置为1则锁定硬件，为0则不做限制 (了解更多，请点击 创建密钥);
硬件ID类型 | (输入参数) ansi形式值, 空值将使程序停止运行;
限制程序运行

(输入参数) 设置为1激活限制程序运行，为0则不限制 (了解更多，请点击 创建密钥);
运行总次数 | (输入参数) 注册密钥限制运行总次数;
日期限制

(输入参数) 设置为1激活日期限制，为0则不限制 (了解更多，请点击 创建密钥);
日期合计 | (输入参数) 注册密钥限制日期总数;
限制运行时间

(输入参数) 设置为1激活限制运行时间，为0则不限制 (了解更多，请点击 创建密钥);
运行时间分钟 | (输入参数) 注册密钥限制运行时间分钟数;
限制总时间

(输入参数) 设置为1激活限制总时间，为0则不做限制 (see 创建密钥);
总运行时间分钟 | (输入参数) 注册密钥限制总运行时间分钟数;
限制区域

(输入参数) 设置为1激活限制区域，为0则不限制 (了解更多，请点击 创建密钥);
区域代码 | (输入参数) 注册密钥限制区域代码 (点击 Enigma API EP_MiscCountryCode 了解更多区域代码);
指定时间后注册 | (输入参数) 设置为1激活指定时间后需注册，为0则不激活 (了解更多，请点击 创建密钥);
指定年份后注册 | (输入参数) 指定年份后注册;
指定月份后注册 | (输入参数) 指定月份后注册;
指定日期后注册 | (输入参数) 指定日期后注册;
指定时间前注册 | (输入参数) 设置为1激活指定时间需注册，为0则不激活 (了解更多，请点击 创建密钥);
指定年份前注册 | (输入参数) 指定年份前注册;
指定月份前注册 | (输入参数) 指定月份前注册;
指定日期前注册 | (输入参数) 指定日期前注册;
加密常数 | (输入参数) 从项目工程文件可以获取此常数 (详情请点击 常规选项 - 常规 获取信息);
加密区间 | (输入参数) 可设置16个加密区间 (详情请点击 创建密钥);
公钥 | (输入参数) 空值将导致程序停止运行，可在项目工程文件处获取 (详情请点击 常规选项 - 常规 获取信息);
私钥 | (输入参数) 空值将导致程序停止运行，可在项目工程文件处获取 (详情请点击 常规选项 - 常规 获取信息).

定义

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


KG_GenerateRegistrationKey 函数

函数用于获取 ansi 形式注册密钥。请注意，需要允许程序支持 ansi 形式密钥，请点击 常规选项 - 常规 面板。函数有一个属性为 PKeyGenParams TGenKeyParams 结构。(了解更多，请点击 常规选项 - 常规 面板)。

返回值

EP_NO_ERROR=0 | 函数执行成功
EP_ERROR_UNKNOWN=1 | 未知错误
EP_ERROR_KEYBUFFEREMPTY=2 | 注册密钥不允许分配内存
EP_ERROR_KEYBUFFERISLESS=3 | 注册密钥获取内存不足
EP_ERROR_REGINFOEMPTY=4 | 注册信息非特定的
EP_ERROR_REGINFOTOOLARGE=5 | 注册信息为空 (空值大小)
EP_ERROR_PRIVATEKEYISNOTSET=6 | 私钥没有设置
EP_ERROR_PUBLICKEYISNOTSET=7 | 公钥没有设置
EP_ERROR_PRIVATEKEYISINVALID=8 | 私钥不正确
EP_ERROR_PUBLICKEYISINVALID=9 | 公钥不正确
EP_ERROR_KEYMODEISINVALID=10 | 密钥长度不正确
EP_ERROR_KEYBASEISINVALID=11 | 密钥输出方式不正确
EP_ERROR_CURRENTDATEISINVALID=12 | 日期不正确
EP_ERROR_EXPIRATIONDATEISINVALID=13 | 过期时间不正确
EP_ERROR_KEYISINVALID=14 | 密钥不正确
EP_ERROR_HARDWAREID=15 | 硬件ID不正确
EP_ERROR_HARDWAREBUFFEREMPTY=16 | 硬件ID为空字节
EP_ERROR_HARDWAREIDINVALIDFORKEY=17 | 硬件ID与密钥不符
EP_ERROR_PROJECTFILENOTFOUND=18 | 项目文件没有找到
EP_ERROR_INVALIDPROJECTFILE=19 | 项目文件不正确
EP_ERROR_EXECUTIONSNUMBERINVALID=20 | 运行次数不正确
EP_ERROR_DAYSNUMBERINVALID=21 | 日期不正确
EP_ERROR_COUNTRYCODEINVALID=22 | 区域代码不正确
EP_ERROR_RUNTIMEINVALID=23 | 运行时间不正确
EP_ERROR_GLOBALTIMEINVALID=24 | 合计时间不正确
EP_ERROR_INSTALLBEFOREINVALID=25 | 指定注册前日期不正确
EP_ERROR_INSTALLAFTERINVALID=26 | 指定日期后注册不正确

定义

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

实例

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;
                    }
            }
            char[] keybuffer = new char[2048];
            keybuffer.Initialize();
            kg.Key = keybuffer.ToString();
            kg.KeyLen = keybuffer.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 byte[Enigma_KeyGen_IDE.NUMBER_OF_CRYPTED_SECTIONS];
            kg.EncryptedSections[0] = Convert.ToByte(cbSection1.Checked);
            kg.EncryptedSections[1] = Convert.ToByte(cbSection2.Checked);
            kg.EncryptedSections[2] = Convert.ToByte(cbSection3.Checked);
            kg.EncryptedSections[3] = Convert.ToByte(cbSection4.Checked);
            kg.EncryptedSections[4] = Convert.ToByte(cbSection5.Checked);
            kg.EncryptedSections[5] = Convert.ToByte(cbSection6.Checked);
            kg.EncryptedSections[6] = Convert.ToByte(cbSection7.Checked);
            kg.EncryptedSections[7] = Convert.ToByte(cbSection8.Checked);
            kg.EncryptedSections[8] = Convert.ToByte(cbSection9.Checked);
            kg.EncryptedSections[9] = Convert.ToByte(cbSection10.Checked);
            kg.EncryptedSections[10] = Convert.ToByte(cbSection11.Checked);
            kg.EncryptedSections[11] = Convert.ToByte(cbSection12.Checked);
            kg.EncryptedSections[12] = Convert.ToByte(cbSection13.Checked);
            kg.EncryptedSections[13] = Convert.ToByte(cbSection14.Checked);
            kg.EncryptedSections[14] = Convert.ToByte(cbSection15.Checked);
            kg.EncryptedSections[15] = Convert.ToByte(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

在程序安装目录可查看函数更多实例,如 Examples\Keygen 子文件夹。


KG_GenerateRegistrationKeyFromProject 函数

函数类似 KG_GenerateRegistrationKey。主要不同在于本函数将读取重要信息 (公钥，私钥，密钥长度，密钥输出方式以及加密常数) TGenKeyParam。 KG_GenerateRegistrationKeyFromProject 有一个属性为 ansi 形式, 空值将导致程序停止运行。

警告:项目文件为绝对路径文件。

返回值

EP_NO_ERROR=0 | 函数执行成功
EP_ERROR_UNKNOWN=1 | 未知错误
EP_ERROR_KEYBUFFEREMPTY=2 | 注册密钥不允许分配内存
EP_ERROR_KEYBUFFERISLESS=3 | 注册密钥获取内存不足
EP_ERROR_REGINFOEMPTY=4 | 注册信息非特定的
EP_ERROR_REGINFOTOOLARGE=5 | 注册信息为空 (空值大小)
EP_ERROR_PRIVATEKEYISNOTSET=6 | 私钥没有设置
EP_ERROR_PUBLICKEYISNOTSET=7 | 公钥没有设置
EP_ERROR_PRIVATEKEYISINVALID=8 | 私钥不正确
EP_ERROR_PUBLICKEYISINVALID=9 | 公钥不正确
EP_ERROR_KEYMODEISINVALID=10 | 密钥长度不正确
EP_ERROR_KEYBASEISINVALID=11 | 密钥输出方式不正确
EP_ERROR_CURRENTDATEISINVALID=12 | 日期不正确
EP_ERROR_EXPIRATIONDATEISINVALID=13 | 过期时间不正确
EP_ERROR_KEYISINVALID=14 | 密钥不正确
EP_ERROR_HARDWAREID=15 | 硬件ID不正确
EP_ERROR_HARDWAREBUFFEREMPTY=16 | 硬件ID为空字节
EP_ERROR_HARDWAREIDINVALIDFORKEY=17 | 硬件ID与密钥不符
EP_ERROR_PROJECTFILENOTFOUND=18 | 项目文件没有找到
EP_ERROR_INVALIDPROJECTFILE=19 | 项目文件不正确
EP_ERROR_EXECUTIONSNUMBERINVALID=20 | 运行次数不正确
EP_ERROR_DAYSNUMBERINVALID=21 | 日期不正确
EP_ERROR_COUNTRYCODEINVALID=22 | 区域代码不正确
EP_ERROR_RUNTIMEINVALID=23 | 运行时间不正确
EP_ERROR_GLOBALTIMEINVALID=24 | 合计时间不正确
EP_ERROR_INSTALLBEFOREINVALID=25 | 指定注册前日期不正确
EP_ERROR_INSTALLAFTERINVALID=26 | 指定日期后注册不正确

定义

Show/Hide Delphi function definition

function KG_GenerateRegistrationKeyFromProject(ProjectFile : PChar; 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

实例

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;

            char[] keybuffer = new char[2048];
            keybuffer.Initialize();
            kg.Key = keybuffer.ToString();
            kg.KeyLen = keybuffer.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 byte[Enigma_KeyGen_IDE.NUMBER_OF_CRYPTED_SECTIONS];
            kg.EncryptedSections[0] = Convert.ToByte(cbSection1.Checked);
            kg.EncryptedSections[1] = Convert.ToByte(cbSection2.Checked);
            kg.EncryptedSections[2] = Convert.ToByte(cbSection3.Checked);
            kg.EncryptedSections[3] = Convert.ToByte(cbSection4.Checked);
            kg.EncryptedSections[4] = Convert.ToByte(cbSection5.Checked);
            kg.EncryptedSections[5] = Convert.ToByte(cbSection6.Checked);
            kg.EncryptedSections[6] = Convert.ToByte(cbSection7.Checked);
            kg.EncryptedSections[7] = Convert.ToByte(cbSection8.Checked);
            kg.EncryptedSections[8] = Convert.ToByte(cbSection9.Checked);
            kg.EncryptedSections[9] = Convert.ToByte(cbSection10.Checked);
            kg.EncryptedSections[10] = Convert.ToByte(cbSection11.Checked);
            kg.EncryptedSections[11] = Convert.ToByte(cbSection12.Checked);
            kg.EncryptedSections[12] = Convert.ToByte(cbSection13.Checked);
            kg.EncryptedSections[13] = Convert.ToByte(cbSection14.Checked);
            kg.EncryptedSections[14] = Convert.ToByte(cbSection15.Checked);
            kg.EncryptedSections[15] = Convert.ToByte(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

在程序安装目录可查看函数更多实例,如 Examples\Keygen 子文件夹。


TKeyGenParamsA 形式

TKeyGenParamsA 结构使用 KG_GenerateRegistrationKeyA 和 KG_GenerateRegistrationKeyFromProjectA 获取注册密钥.

结构描述

密钥长度

(输入参数) 注册密钥长度 (RSA 512/768/1024/2048/3072/4096), 有以下形式值 (详情请点击 常规选项 - 常规 了解密钥安全/长度):

RM_512 = 0;
RM_768 = 1;
RM_1024 = 2;
RM_2048 = 3;
RM_3072 = 4;
RM_4096 = 5;
密钥输出方式

(输出参数) 注册密钥输出方式 (Base 2/8/16/32/64), 有以下值 (详情请点击 常规选项 - 常规 了解输出密钥方式值):

RB_2 = 0;
RB_8 = 1;
RB_16 = 2;
RB_32 = 3;
RB_64 = 4;
密钥连接线

(输入参数) 设置为1则添加密钥连接线，为0则不添加 (了解更多，请点击 创建密钥);
密钥

(输入参数) unicode形式值, 空值注册密钥将使程序停止运行, 我们建议至少设置为 2048 字节长度;

密钥长度 | (输入参数) 注册密钥字节长度;
注册信息

(输入参数) ansi形式值, 空值注册信息将使程序停止运行;
程序过期 | (输入参数) 如果值为0则不激活，为1则限制程序有过期时间 (了解更多，请点击 创建密钥);
过期年份 | (输入参数) 密钥限制过期年份;
过期月份 | (输入参数) 密钥限制过期月份;
过期日期 | (输入参数) 密钥限制过期日期;
硬件锁定

(输入参数) 设置为1则锁定硬件，为0则不做限制 (了解更多，请点击 创建密钥);
硬件ID类型 | (输入参数) ansi形式值, 空值将使程序停止运行;
限制程序运行

(输入参数) 设置为1激活限制程序运行，为0则不限制 (了解更多，请点击 创建密钥);
运行总次数 | (输入参数) 注册密钥限制运行总次数;
日期限制

(输入参数) 设置为1激活日期限制，为0则不限制 (了解更多，请点击 创建密钥);
日期合计 | (输入参数) 注册密钥限制日期总数;
限制运行时间

(输入参数) 设置为1激活限制运行时间，为0则不限制 (了解更多，请点击 创建密钥);
运行时间分钟 | (输入参数) 注册密钥限制运行时间分钟数;
限制总时间

(输入参数) 设置为1激活限制总时间，为0则不做限制 (了解更多，请点击 创建密钥);
总运行时间分钟 | (输入参数) 注册密钥限制总运行时间分钟数;
限制区域

(输入参数) 设置为1激活限制区域，为0则不限制 (了解更多，请点击 创建密钥);
区域代码 | (输入参数) 注册密钥限制区域代码 (点击 Enigma API EP_MiscCountryCode 了解更多区域代码);
指定时间后注册 | (输入参数) 设置为1激活指定时间后需注册，为0则不激活 (了解更多，请点击 创建密钥);
指定年份后注册 | (输入参数) 指定年份后注册;
指定月份后注册 | (输入参数) 指定月份后注册;
指定日期后注册 | (输入参数) 指定日期后注册;
指定时间前注册 | (输入参数) 设置为1激活指定时间需注册，为0则不激活 (了解更多，请点击 创建密钥);
指定年份前注册 | (输入参数) 指定年份前注册;
指定月份前注册 | (输入参数) 指定月份前注册;
指定日期前注册 | (输入参数) 指定日期前注册;
加密常数 | (输入参数) 从项目工程文件可以获取此常数 (详情请点击 常规选项 - 常规 获取信息);
加密区间 | (输入参数) 可设置16个加密区间 (详情请点击 创建密钥);
公钥 | (输入参数) 空值将导致程序停止运行，可在项目工程文件处获取 (详情请点击 常规选项 - 常规 获取信息);
私钥 | (输入参数) 空值将导致程序停止运行，可在项目工程文件处获取 (详情请点击 常规选项 - 常规 获取信息).

定义

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
    }


KG_GenerateRegistrationKeyA 函数

KG_GenerateRegistrationKeyA 与 KG_GenerateRegistrationKey 函数一致获取注册密钥信息。请注意，需允许程序使用 ansi 形式注册密钥，请点击 常规选项 - 常规 面板了解更多。函数有一个属性为 PKeyGenParamsA TGenKeyParamsA 结构。(详情请浏览 常规选项 - 常规 面板了解更多信息)。

Return Values

EP_NO_ERROR=0 | 函数执行成功
EP_ERROR_UNKNOWN=1 | 未知错误
EP_ERROR_KEYBUFFEREMPTY=2 | 注册密钥不允许分配内存
EP_ERROR_KEYBUFFERISLESS=3 | 注册密钥获取内存不足
EP_ERROR_REGINFOEMPTY=4 | 注册信息非特定的
EP_ERROR_REGINFOTOOLARGE=5 | 注册信息为空 (空值大小)
EP_ERROR_PRIVATEKEYISNOTSET=6 | 私钥没有设置
EP_ERROR_PUBLICKEYISNOTSET=7 | 公钥没有设置
EP_ERROR_PRIVATEKEYISINVALID=8 | 私钥不正确
EP_ERROR_PUBLICKEYISINVALID=9 | 公钥不正确
EP_ERROR_KEYMODEISINVALID=10 | 密钥长度不正确
EP_ERROR_KEYBASEISINVALID=11 | 密钥输出方式不正确
EP_ERROR_CURRENTDATEISINVALID=12 | 日期不正确
EP_ERROR_EXPIRATIONDATEISINVALID=13 | 过期时间不正确
EP_ERROR_KEYISINVALID=14 | 密钥不正确
EP_ERROR_HARDWAREID=15 | 硬件ID不正确
EP_ERROR_HARDWAREBUFFEREMPTY=16 | 硬件ID为空字节
EP_ERROR_HARDWAREIDINVALIDFORKEY=17 | 硬件ID与密钥不符
EP_ERROR_PROJECTFILENOTFOUND=18 | 项目文件没有找到
EP_ERROR_INVALIDPROJECTFILE=19 | 项目文件不正确
EP_ERROR_EXECUTIONSNUMBERINVALID=20 | 运行次数不正确
EP_ERROR_DAYSNUMBERINVALID=21 | 日期不正确
EP_ERROR_COUNTRYCODEINVALID=22 | 区域代码不正确
EP_ERROR_RUNTIMEINVALID=23 | 运行时间不正确
EP_ERROR_GLOBALTIMEINVALID=24 | 合计时间不正确
EP_ERROR_INSTALLBEFOREINVALID=25 | 指定注册前日期不正确
EP_ERROR_INSTALLAFTERINVALID=26 | 指定日期后注册不正确

定义

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);
}

在程序安装目录可查看函数更多实例,如 Examples\Keygen 子文件夹。


KG_GenerateRegistrationKeyFromProjectA 函数

KG_GenerateRegistrationKeyFromProjectA 返回内容与 KG_GenerateRegistrationKeyFromProject 函数类似获取注册密钥。最大的不同是这个函数将读取重要信息 (公钥，私钥，密钥长度，密钥输出方式和加密常数) ，你无需设置这个参数 TGenKeyParamA。 KG_GenerateRegistrationKeyFromProjectA 有两个属性，一个为 ansi 形式, 空值将使程序停止运行，另外一个为 TGenKeyParamA 结构。

警告: 项目文件为绝对路径文件。

返回值

EP_NO_ERROR=0 | 函数执行成功。
EP_ERROR_UNKNOWN=1 | 未知错误
EP_ERROR_KEYBUFFEREMPTY=2 | 注册密钥不允许分配内存
EP_ERROR_KEYBUFFERISLESS=3 | 注册密钥获取内存不足
EP_ERROR_REGINFOEMPTY=4 | 注册信息非特定的
EP_ERROR_REGINFOTOOLARGE=5 | 注册信息为空 (空值大小)
EP_ERROR_PRIVATEKEYISNOTSET=6 | 私钥没有设置
EP_ERROR_PUBLICKEYISNOTSET=7 | 公钥没有设置
EP_ERROR_PRIVATEKEYISINVALID=8 | 私钥不正确
EP_ERROR_PUBLICKEYISINVALID=9 | 公钥不正确
EP_ERROR_KEYMODEISINVALID=10 | 密钥长度不正确
EP_ERROR_KEYBASEISINVALID=11 | 密钥输出方式不正确
EP_ERROR_CURRENTDATEISINVALID=12 | 日期不正确
EP_ERROR_EXPIRATIONDATEISINVALID=13 | 过期时间不正确
EP_ERROR_KEYISINVALID=14 | 密钥不正确
EP_ERROR_HARDWAREID=15 | 硬件ID不正确
EP_ERROR_HARDWAREBUFFEREMPTY=16 | 硬件ID为空字节
EP_ERROR_HARDWAREIDINVALIDFORKEY=17 | 硬件ID与密钥不符
EP_ERROR_PROJECTFILENOTFOUND=18 | 项目文件没有找到
EP_ERROR_INVALIDPROJECTFILE=19 | 项目文件不正确
EP_ERROR_EXECUTIONSNUMBERINVALID=20 | 运行次数不正确
EP_ERROR_DAYSNUMBERINVALID=21 | 日期不正确
EP_ERROR_COUNTRYCODEINVALID=22 | 区域代码不正确
EP_ERROR_RUNTIMEINVALID=23 | 运行时间不正确
EP_ERROR_GLOBALTIMEINVALID=24 | 合计时间不正确
EP_ERROR_INSTALLBEFOREINVALID=25 | 指定注册前日期不正确
EP_ERROR_INSTALLAFTERINVALID=26 | 指定日期后注册不正确

定义

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);
}

在程序安装目录可查看函数更多实例,如 Examples\Keygen 子文件夹。


TKeyGenParamsW 形式

TKeyGenParamsW 是使用 KG_GenerateRegistrationKeyW 和 KG_GenerateRegistrationKeyFromProjectW 结构生成注册密钥。

结构描述

密钥长度

(输入属性) 注册密钥长度(RSA 512/768/1024/2048/3072/4096), 有以下值 (请参看 常规选项 - 常规 里注册密钥的安全/长度值):

RM_512 = 0;
RM_768 = 1;
RM_1024 = 2;
RM_2048 = 3;
RM_3072 = 4;
RM_4096 = 5;
密钥输出方式

(输入参数) 注册密钥的输出方式(Base 2/8/16/32/64), 有以下值(请参看 常规选项 - 常规 里注册密钥输出密钥方式值):

RB_2 = 0;
RB_8 = 1;
RB_16 = 2;
RB_32 = 3;
RB_64 = 4;
密钥连接线

(输入参数) 设置为1则添加密钥连接线，为0则不添加 (了解更多，请点击 创建密钥);
密钥

(输入参数) unicode形式值, 空值注册密钥将使程序停止运行,我们推荐设置至少4096字节长度密钥;

密钥长度 | (输入参数) 注册密钥字节长度;
注册信息

(输入参数) unicode形式值，空值注册信息将使程序停止运行;
密钥过期 | (输入参数) 如值为0则注册密钥不会过期，如值为1则有时间限制，比如日期、月份、日等属性 (了解更多请点击 创建密钥);
过期年份 | (输入参数ter) 密钥指定过期年份;
过期月份 | (输入参数) 密钥指定过期月份;
过期日期 | (输入参数) 密钥指定过期日期;
使用硬件锁定

(输入参数) 设置为1则激活硬件锁定，为0则不激活 (了解更多，请点击 创建密钥);
硬件ID类型 | (输入参数) 空硬件ID将使程序停止运行;
限制程序运行

(输入参数) 设置参数为1则激活限制程序运行，为0则不激活 (了解更多，请点击 创建密钥);
总运行次数 | (输入参数)密钥限制程序运行次数;
限制日期

(输入参数) 设置为1激活限制日期，为0则不做限制 (了解更多，请点击 创建密钥);
日期合计 | (输入参数) 密钥限制天数;
限制运行时间

(输入参数) 设置为1激活限制运行时间，为0则不限制 (了解更多，请点击 创建密钥);
运行时间分钟 | (输入参数) 密钥限制运行时间分钟数;
限制总运行时间

(输入参数) 设置为1激活限制总运行时间，为0则不做限制 (了解更多，请点击 创建密钥);
总运行时间分钟 | (输入参数) 密钥限制总运行时间分钟数;
限制区域

(输入参数) 设置为1激活限制区域，为0则不做限制 (了解更多，请点击 创建密钥);
区域代码 | (输入参数) 密钥限制区域代码 (请点击 Enigma API EP_MiscCountryCode 了解关于区域代码更多信息);
指定时间后注册 | (输入参数) 设置1激活在指定时间后注册，为0则不激活。(了解更多，请点击 创建密钥);
指定年份后注册 | (输入参数) 在指定年份后注册;
指定月份后注册 | (输入参数) 在指定月份后注册;
指定日期后注册 | (输入参数) 在指定日期后注册;
指定时间前注册 | (输入参数) 设置为1激活指定时间前注册，为0则不激活 (了解更多，请点击 创建密钥);
指定年份前注册 | (输入参数) 在指定年份前注册;
指定月份前注册 | (输入参数) 在指定月份前注册;
指定日期前注册 | (输入参数) 在指定日期前注册;
加密常数 | (输入参数) 从项目工程文件可以获取此常数 (详细请点击 常规选项 - 常规 获取信息);
加密区间 | (输入参数) 可设置16个加密区间 (详情请点击 创建密钥);
公钥 | (输入参数) 空值将导致程序停止运行，可在项目工程文件处获取 (详情请点击 常规选项 - 常规 获取信息);
私钥 | (输入参数) 空值将导致程序停止运行，可在项目工程文件处获取 (详情请点击 常规选项 - 常规 获取信息).

定义

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
    }


KG_GenerateRegistrationKeyW 函数

KG_GenerateRegistrationKeyW 类似 KG_GenerateRegistrationKey 获取注册密钥，但其使用 unicode 形式。注意，需允许程序接收univode 注册密钥，点击 常规选项 - 常规 面板。 函数有一个属性为 TGenKeyParamsW 结构。 (了解更多，请点击 常规选项 - 常规 面板).

返回值

EP_NO_ERROR=0 | 函数执行成功；
EP_ERROR_UNKNOWN=1 | 未知错误
EP_ERROR_KEYBUFFEREMPTY=2 | 注册密钥不允许分配内存
EP_ERROR_KEYBUFFERISLESS=3 | 注册密钥获取内存不足
EP_ERROR_REGINFOEMPTY=4 | 注册信息非特定的
EP_ERROR_REGINFOTOOLARGE=5 | 注册信息为空 (空值大小)
EP_ERROR_PRIVATEKEYISNOTSET=6 | 私钥没有设置
EP_ERROR_PUBLICKEYISNOTSET=7 | 公钥没有设置
EP_ERROR_PRIVATEKEYISINVALID=8 | 私钥不正确
EP_ERROR_PUBLICKEYISINVALID=9 | 公钥不正确
EP_ERROR_KEYMODEISINVALID=10 | 密钥长度不正确
EP_ERROR_KEYBASEISINVALID=11 | 密钥输出方式不正确
EP_ERROR_CURRENTDATEISINVALID=12 | 日期不正确
EP_ERROR_EXPIRATIONDATEISINVALID=13 | 过期时间不正确
EP_ERROR_KEYISINVALID=14 | 密钥不正确
EP_ERROR_HARDWAREID=15 | 硬件ID不正确
EP_ERROR_HARDWAREBUFFEREMPTY=16 | 硬件ID为空字节
EP_ERROR_HARDWAREIDINVALIDFORKEY=17 | 硬件ID与密钥不符
EP_ERROR_PROJECTFILENOTFOUND=18 | 项目文件没有找到
EP_ERROR_INVALIDPROJECTFILE=19 | 项目文件不正确
EP_ERROR_EXECUTIONSNUMBERINVALID=20 | 运行次数不正确
EP_ERROR_DAYSNUMBERINVALID=21 | 日期不正确
EP_ERROR_COUNTRYCODEINVALID=22 | 区域代码不正确
EP_ERROR_RUNTIMEINVALID=23 | 运行时间不正确
EP_ERROR_GLOBALTIMEINVALID=24 | 合计时间不正确
EP_ERROR_INSTALLBEFOREINVALID=25 | 指定注册前日期不正确
EP_ERROR_INSTALLAFTERINVALID=26 | 指定日期后注册不正确

定义

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);
}

实例

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;
                    }
            }
            char[] keybuffer = new char[2048];
            keybuffer.Initialize();
            kg.Key = keybuffer.ToString();
            kg.KeyLen = keybuffer.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 byte[Enigma_KeyGen_IDE.NUMBER_OF_CRYPTED_SECTIONS];
            kg.EncryptedSections[0] = Convert.ToByte(cbSection1.Checked);
            kg.EncryptedSections[1] = Convert.ToByte(cbSection2.Checked);
            kg.EncryptedSections[2] = Convert.ToByte(cbSection3.Checked);
            kg.EncryptedSections[3] = Convert.ToByte(cbSection4.Checked);
            kg.EncryptedSections[4] = Convert.ToByte(cbSection5.Checked);
            kg.EncryptedSections[5] = Convert.ToByte(cbSection6.Checked);
            kg.EncryptedSections[6] = Convert.ToByte(cbSection7.Checked);
            kg.EncryptedSections[7] = Convert.ToByte(cbSection8.Checked);
            kg.EncryptedSections[8] = Convert.ToByte(cbSection9.Checked);
            kg.EncryptedSections[9] = Convert.ToByte(cbSection10.Checked);
            kg.EncryptedSections[10] = Convert.ToByte(cbSection11.Checked);
            kg.EncryptedSections[11] = Convert.ToByte(cbSection12.Checked);
            kg.EncryptedSections[12] = Convert.ToByte(cbSection13.Checked);
            kg.EncryptedSections[13] = Convert.ToByte(cbSection14.Checked);
            kg.EncryptedSections[14] = Convert.ToByte(cbSection15.Checked);
            kg.EncryptedSections[15] = Convert.ToByte(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;
                }
            }
        }

在程序安装目录可查看函数更多实例,如 Examples\KeygenUnicode子文件夹。


KG_GenerateRegistrationKeyFromProjectW 函数

KG_GenerateRegistrationKeyFromProjectW 类似 KG_GenerateRegistrationKeyW 获取 unicode 形式注册密钥。请注意，需要允许程序获取 unicode 形式注册密钥，具体请点击 常规选项 - 常规 面板 (公钥，私钥，密钥长度，密钥输出方式以及加密常数 TGenKeyParamW。 KG_GenerateRegistrationKeyFromProjectW 有两个属性，一个为项目文件为 uicode 形式, 空值将导致程序停止运行, 另外一个属性为 TGenKeyParamW 结构。

Return Values

EP_NO_ERROR=0 | 函数执行成功。
EP_ERROR_UNKNOWN=1 | 未知错误
EP_ERROR_KEYBUFFEREMPTY=2 | 注册密钥不允许分配内存
EP_ERROR_KEYBUFFERISLESS=3 | 注册密钥获取内存不足
EP_ERROR_REGINFOEMPTY=4 | 注册信息非特定的
EP_ERROR_REGINFOTOOLARGE=5 | 注册信息为空 (空值大小)
EP_ERROR_PRIVATEKEYISNOTSET=6 | 私钥没有设置
EP_ERROR_PUBLICKEYISNOTSET=7 | 公钥没有设置
EP_ERROR_PRIVATEKEYISINVALID=8 | 私钥不正确
EP_ERROR_PUBLICKEYISINVALID=9 | 公钥不正确
EP_ERROR_KEYMODEISINVALID=10 | 密钥长度不正确
EP_ERROR_KEYBASEISINVALID=11 | 密钥输出方式不正确
EP_ERROR_CURRENTDATEISINVALID=12 | 日期不正确
EP_ERROR_EXPIRATIONDATEISINVALID=13 | 过期时间不正确
EP_ERROR_KEYISINVALID=14 | 密钥不正确
EP_ERROR_HARDWAREID=15 | 硬件ID不正确
EP_ERROR_HARDWAREBUFFEREMPTY=16 | 硬件ID为空字节
EP_ERROR_HARDWAREIDINVALIDFORKEY=17 | 硬件ID与密钥不符
EP_ERROR_PROJECTFILENOTFOUND=18 | 项目文件没有找到
EP_ERROR_INVALIDPROJECTFILE=19 | 项目文件不正确
EP_ERROR_EXECUTIONSNUMBERINVALID=20 | 运行次数不正确
EP_ERROR_DAYSNUMBERINVALID=21 | 日期不正确
EP_ERROR_COUNTRYCODEINVALID=22 | 区域代码不正确
EP_ERROR_RUNTIMEINVALID=23 | 运行时间不正确
EP_ERROR_GLOBALTIMEINVALID=24 | 合计时间不正确
EP_ERROR_INSTALLBEFOREINVALID=25 | 指定注册前日期不正确
EP_ERROR_INSTALLAFTERINVALID=26 | 指定日期后注册不正确

定义

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);
}

实例

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;

            char[] keybuffer = new char[2048];
            keybuffer.Initialize();
            kg.Key = keybuffer.ToString();
            kg.KeyLen = keybuffer.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 byte[Enigma_KeyGen_IDE.NUMBER_OF_CRYPTED_SECTIONS];
            kg.EncryptedSections[0] = Convert.ToByte(cbSection1.Checked);
            kg.EncryptedSections[1] = Convert.ToByte(cbSection2.Checked);
            kg.EncryptedSections[2] = Convert.ToByte(cbSection3.Checked);
            kg.EncryptedSections[3] = Convert.ToByte(cbSection4.Checked);
            kg.EncryptedSections[4] = Convert.ToByte(cbSection5.Checked);
            kg.EncryptedSections[5] = Convert.ToByte(cbSection6.Checked);
            kg.EncryptedSections[6] = Convert.ToByte(cbSection7.Checked);
            kg.EncryptedSections[7] = Convert.ToByte(cbSection8.Checked);
            kg.EncryptedSections[8] = Convert.ToByte(cbSection9.Checked);
            kg.EncryptedSections[9] = Convert.ToByte(cbSection10.Checked);
            kg.EncryptedSections[10] = Convert.ToByte(cbSection11.Checked);
            kg.EncryptedSections[11] = Convert.ToByte(cbSection12.Checked);
            kg.EncryptedSections[12] = Convert.ToByte(cbSection13.Checked);
            kg.EncryptedSections[13] = Convert.ToByte(cbSection14.Checked);
            kg.EncryptedSections[14] = Convert.ToByte(cbSection15.Checked);
            kg.EncryptedSections[15] = Convert.ToByte(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;
                }
            }
        }

在程序安装目录可查看函数更多实例,如 Examples\KeygenUnicode子文件夹。


TKeyVerifyParams 形式

TKeyVerifyParams 是使用 KG_VerifyRegistrationInfo 和 KG_VerifyRegistrationInfoFromProject 来验证注册信息的结构。

结构描述

密钥长度

(输入属性) 注册密钥的长度 (RSA 512/768/1024/2048/3072/4096), 有以下值 (点击 常规选项 - 常规 查看注册密钥安全性/长度值):

RM_512 = 0;
RM_768 = 1;
RM_1024 = 2;
RM_2048 = 3;
RM_3072 = 4;
RM_4096 = 5;
输出方式

(输入属性) 注册密钥输出方式 (Base 2/8/16/32/64), 有以下值 (点击 常规选项 - 常规 查看输出方式值):

RB_2 = 0;
RB_8 = 1;
RB_16 = 2;
RB_32 = 3;
RB_64 = 4;
密钥

(输入属性) 空注册密钥将导致程序停止运行，我们建议您至少选择 2048 长度密钥；

密钥长度 | (输入属性) 注册密钥字节长度；
注册信息

(输入属性) 注册用户信息将存储；

注册信息长度 | (输入属性) 注册信息大小；
建立年份 | (输出属性) 密钥建立年份
建立月份 | (输出属性) 密钥建立月份
建立日期 | (输出属性) 密钥建立日期
密钥过期 | (输出属性) 若值为0则密钥没有过期日期, 若值为1则密钥限制日期。密钥过期日期包括过期年份、月份、日期属性 (了解更多，请点击 创建密钥);
过期年份 | (输出属性) 密钥过期年份;
过期月份 | (输出属性) 密钥过期月份;
过期日期 | (输出属性) 密钥过期日期;
使用硬件锁定

(输入属性) 如果锁定硬件则设置属性为1，设置0则不锁定硬件 (了解更多，请点击 创建密钥);
硬件ID类型 | (输入属性) 空值将导致程序停止运行;
限制运行次数

(输出属性) 密钥限制运行次数, 属性为1则激活限制运行次数，为0则不限制 (了解更多，请点击 创建密钥);
运行合计 | (输出属性) 密钥限制运行合计次数;
天数限制

(输出属性) 密钥限制天数，属性为1激活限制，为0则不激活 (了解更多，请点击 创建密钥);
天数合计 | (输出属性) 密钥限制天数合计;
运行时间限制

(输出属性) 密钥限制运行时间, 属性为1则激活限制，为0则不激活 (了解更多，请点击 创建密钥);
运行时间分钟 | (输出属性) 密钥限制运行时间;
限制总时间

(输出属性) 密钥限制总运行时间, 属性为1则激活限制，为0则不做限制 (了解更多，请点击 创建密钥);
总时间分钟数 | (输出属性) 密钥限制总时间分钟数;
使用区域限制

(输出属性) 密钥限制区域, 属性为1激活，为0则不做限制 (了解更多，请点击 创建密钥);
区域代码 | (输出属性) 注册密钥限制区域代码 (请查看 Enigma API EP_MiscCountryCode 以了解更多区域代码);
在指定日期后注册 | (输出属性) 注册密钥需在指定日期后注册, 属性为1激活，为0则不做限制。属性包括指定年份、月份、日期后注册 (了解更多，请点击 创建密钥);
指定年份后注册 | (输出属性) 在指定年份后注册;
在指定月份后注册 | (输出属性) 在指定月份后注册;
在指定日期后注册 | (输出属性) 在指定日期后注册;
在指定时间前注册 | (输出属性) 注册密钥需在指定日期前注册, 属性为1激活，为0则不着限制。 包括在指定年份、月份、日期前注册属性 (了解更多，请点击 创建密钥);
在指定年份前注册 | (输出属性) 在指定年份前注册;
在指定月份前注册 | (输出属性) 在指定月份前注册;
在指定日期前注册 | (输出属性) 在指定日期前注册;
加密常数 | (输入属性) 从工程项目文件获取加密常数 (点击 常规选项 - 常规 了解更多信息);
加密区间 | (输出属性) 有16个可加密区间，使用正确密钥可解密被加密区间 (了解更多，请点击 创建密钥);
公钥 | (输入属性) 控制将导致程序停止运行，从项目工程文件处可获取 (请点击 常规选项 - 常规 了解更多信息);

定义

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


KG_VerifyRegistrationInfo 函数

KG_VerifyRegistrationInfo 提取注册密钥属性验证注册信息。有一个属性为 TKeyVerifyParams 结构，请注意 TKeyVerifyParams 结构将连接 the Enigma Protector 项目文件。包括公钥、密钥长度、密钥输出方式等 (点击 常规选项 - 常规 面板获取更多信息)。

返回值

EP_NO_ERROR=0 | 函数执行成功;
EP_ERROR_UNKNOWN=1 | 未知错误
EP_ERROR_KEYBUFFEREMPTY=2 | 注册密钥不允许分配内存
EP_ERROR_KEYBUFFERISLESS=3 | 注册密钥获取内存不足
EP_ERROR_REGINFOEMPTY=4 | 注册信息非特定的
EP_ERROR_REGINFOTOOLARGE=5 | 注册信息为空 (空值大小)
EP_ERROR_PRIVATEKEYISNOTSET=6 | 私钥没有设置
EP_ERROR_PUBLICKEYISNOTSET=7 | 公钥没有设置
EP_ERROR_PRIVATEKEYISINVALID=8 | 私钥不正确
EP_ERROR_PUBLICKEYISINVALID=9 | 公钥不正确
EP_ERROR_KEYMODEISINVALID=10 | 密钥长度不正确
EP_ERROR_KEYBASEISINVALID=11 | 密钥输出方式不正确
EP_ERROR_CURRENTDATEISINVALID=12 | 日期不正确
EP_ERROR_EXPIRATIONDATEISINVALID=13 | 过期时间不正确
EP_ERROR_KEYISINVALID=14 | 密钥不正确
EP_ERROR_HARDWAREID=15 | 硬件ID不正确
EP_ERROR_HARDWAREBUFFEREMPTY=16 | 硬件ID为空字节
EP_ERROR_HARDWAREIDINVALIDFORKEY=17 | 硬件ID与密钥不符
EP_ERROR_PROJECTFILENOTFOUND=18 | 项目文件没有找到
EP_ERROR_INVALIDPROJECTFILE=19 | 项目文件不正确
EP_ERROR_EXECUTIONSNUMBERINVALID=20 | 运行次数不正确
EP_ERROR_DAYSNUMBERINVALID=21 | 日期不正确
EP_ERROR_COUNTRYCODEINVALID=22 | 区域代码不正确
EP_ERROR_RUNTIMEINVALID=23 | 运行时间不正确
EP_ERROR_GLOBALTIMEINVALID=24 | 合计时间不正确
EP_ERROR_INSTALLBEFOREINVALID=25 | 指定注册前日期不正确
EP_ERROR_INSTALLAFTERINVALID=26 | 指定日期后注册不正确

定义

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

实例

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

在程序安装目录可查看函数更多实例,如 Examples\Keygen 子文件夹。


KG_VerifyRegistrationInfoFromProject 函数

KG_VerifyRegistrationInfoFromProject 提取注册密钥属性验证注册信息。有两个属性，一个为 TKeyVerifyParams 结构, 一个为 ansi 形式, 空值将使程序停止运行，点击 TKeyVerifyParams 结构。

返回值

EP_NO_ERROR=0 | 函数执行成功;
EP_ERROR_UNKNOWN=1 | 未知错误
EP_ERROR_KEYBUFFEREMPTY=2 | 注册密钥不允许分配内存
EP_ERROR_KEYBUFFERISLESS=3 | 注册密钥获取内存不足
EP_ERROR_REGINFOEMPTY=4 | 注册信息非特定的
EP_ERROR_REGINFOTOOLARGE=5 | 注册信息为空 (空值大小)
EP_ERROR_PRIVATEKEYISNOTSET=6 | 私钥没有设置
EP_ERROR_PUBLICKEYISNOTSET=7 | 公钥没有设置
EP_ERROR_PRIVATEKEYISINVALID=8 | 私钥不正确
EP_ERROR_PUBLICKEYISINVALID=9 | 公钥不正确
EP_ERROR_KEYMODEISINVALID=10 | 密钥长度不正确
EP_ERROR_KEYBASEISINVALID=11 | 密钥输出方式不正确
EP_ERROR_CURRENTDATEISINVALID=12 | 日期不正确
EP_ERROR_EXPIRATIONDATEISINVALID=13 | 过期时间不正确
EP_ERROR_KEYISINVALID=14 | 密钥不正确
EP_ERROR_HARDWAREID=15 | 硬件ID不正确
EP_ERROR_HARDWAREBUFFEREMPTY=16 | 硬件ID为空字节
EP_ERROR_HARDWAREIDINVALIDFORKEY=17 | 硬件ID与密钥不符
EP_ERROR_PROJECTFILENOTFOUND=18 | 项目文件没有找到
EP_ERROR_INVALIDPROJECTFILE=19 | 项目文件不正确
EP_ERROR_EXECUTIONSNUMBERINVALID=20 | 运行次数不正确
EP_ERROR_DAYSNUMBERINVALID=21 | 日期不正确
EP_ERROR_COUNTRYCODEINVALID=22 | 区域代码不正确
EP_ERROR_RUNTIMEINVALID=23 | 运行时间不正确
EP_ERROR_GLOBALTIMEINVALID=24 | 合计时间不正确
EP_ERROR_INSTALLBEFOREINVALID=25 | 指定注册前日期不正确
EP_ERROR_INSTALLAFTERINVALID=26 | 指定日期后注册不正确

定义

Show/Hide Delphi function definition

function KG_VerifyRegistrationInfoFromProject(ProjectFile : PChar; 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

实例

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

在程序安装目录可查看函数更多实例,如 Examples\Keygen 子文件夹。


TKeyVerifyParamsA 形式

TKeyVerifyParamsA 是使用 KG_VerifyRegistrationInfoA 和 KG_VerifyRegistrationInfoFromProjectA 来验证注册信息的结构。

结构描述

密钥长度

(输入属性) 注册密钥的长度 (RSA 512/768/1024/2048/3072/4096), 有以下值 (点击 常规选项-常规 查看注册密钥安全性/长度值):

RM_512 = 0;
RM_768 = 1;
RM_1024 = 2;
RM_2048 = 3;
RM_3072 = 4;
RM_4096 = 5;
输出方式

(输入属性) 注册密钥输出方式 (Base 2/8/16/32/64), 有以下值 (点击 常规选项-常规 查看输出方式值):

RB_2 = 0;
RB_8 = 1;
RB_16 = 2;
RB_32 = 3;
RB_64 = 4;
密钥 | (输入属性) 空注册密钥将导致程序停止运行;
密钥长度 | (输入属性) 注册密钥字节长度;
注册信息 | (输入属性) 空注册用户名将导致程序停止运行;
建立年份 | (输出属性) 密钥建立的年份
建立月份 | (输出属性) 密钥建立的月份
建立日期 | (输出属性) 密钥建立的日期
密钥过期 | (输出属性) 如果值为0则无过期日期，如果值为1则有时间限制。密钥将有过期年份、月份、日期 (查看更多，请点击 创建密钥);
过期年份 | (输出属性) 密钥过期的年份;
过期月份 | (输出属性) 密钥过期的月份;
过期日期 | (输出属性) 密钥过期日期;
硬件锁定

(输入属性) 如果值为1则锁定硬件，如果值为0则不锁定 (查看更多，请点击 创建密钥);
硬件ID类型 | (输入属性) 空值将导致程序停止运行;
限制运行

(输出属性) 密钥为限制运行类型,属性为1则限制运行，反之为0 (查看更多，请点击 创建密钥);
运行合计 | (输出属性) 注册密钥限制运行总次数;
天数限制

(输出属性) 密钥限制天数, 属性为1则限制天数，反之为0 (查看更多，请点击 创建密钥);
天数合计 | (输出属性) 注册密钥限制使用天数合计;
限制使用时间

(输出属性) 密钥限制运行时间,属性为1则限制，反之为0 (查看更多，请点击 创建密钥);
运行分钟数 | (输出属性) 注册密钥限制运行分钟数;
总运行时间限制

(输出属性) 密钥限制中运行时间, 属性为1则限制总运行时间，反之为0 (查看更多，请点击 创建密钥);
总运行分钟 | (输出属性) 注册密钥限制总运行分钟数;
限制区域

(输出属性) 密钥限制区域,属性为1则限制，反之为0 (查看更多，请点击 创建密钥);
区域代码 | (输出属性) 注册密钥限制区域代码 (请浏览 Enigma API EP_MiscCountryCode了解更多区域代码);
在指定时间后注册 | (输出属性) 在指定时间后必须注册，属性为1则激活，反之为0。包括在指定年份、月份、日期后属性 (查看更多，请点击 创建密钥);
在指定年份后注册 | (输出属性) 在指定年份后注册;
在指定月份后注册 | (输出属性) 在指定月份后注册;
在指定日期后注册 | (输出属性) 在指定日期后注册;
在指定时间前注册 | (输出属性) 注册密钥指定时间前需注册,属性为1则激活，反之为0。包括在指定年份、月份、日期前属性 (查看更多，请点击 创建密钥);
在指定年份前注册 | (输出属性) 在指定年份前注册;
在指定月份前注册 | (输出属性) 在指定月份前注册;
在指定日期前注册 | (输出属性) 在指定日期前注册;
加密常数 | (输入属性) 在工程项目文件中获取加密常数 (请点击 常规选项-常规了解更多);
加密区间 | (输出属性) 有16个可加密区间，使用正确密钥可解密被加密区间 (查看更多，请点击 创建密钥Creating Keys);
公钥 | (输入属性) 空值将导致程序停止运行，在工程项目文件处获取 (请浏览 常规选项-常规 获取更多公钥私钥的信息);

范例

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
    }


KG_VerifyRegistrationInfoA 函数

KG_VerifyRegistrationInfoA 类似 KG_VerifyRegistrationInfo 提取注册密钥属性验证注册信息，有一个属性为 TKeyVerifyParamsA 结构。 请注意 TKeyVerifyParamsA 机构将连接 the Enigma Protector 项目文件。包括公钥、私钥、加密常数等 (详情请点击 常规选项 - 常规 面板了解更多)。

返回值

EP_NO_ERROR=0 | 函数执行成功;
EP_ERROR_UNKNOWN=1 | 未知错误
EP_ERROR_KEYBUFFEREMPTY=2 | 注册密钥不允许分配内存
EP_ERROR_KEYBUFFERISLESS=3 | 注册密钥获取内存不足
EP_ERROR_REGINFOEMPTY=4 | 注册信息非特定的
EP_ERROR_REGINFOTOOLARGE=5 | 注册信息为空 (空值大小)
EP_ERROR_PRIVATEKEYISNOTSET=6 | 私钥没有设置
EP_ERROR_PUBLICKEYISNOTSET=7 | 公钥没有设置
EP_ERROR_PRIVATEKEYISINVALID=8 | 私钥不正确
EP_ERROR_PUBLICKEYISINVALID=9 | 公钥不正确
EP_ERROR_KEYMODEISINVALID=10 | 密钥长度不正确
EP_ERROR_KEYBASEISINVALID=11 | 密钥输出方式不正确
EP_ERROR_CURRENTDATEISINVALID=12 | 日期不正确
EP_ERROR_EXPIRATIONDATEISINVALID=13 | 过期时间不正确
EP_ERROR_KEYISINVALID=14 | 密钥不正确
EP_ERROR_HARDWAREID=15 | 硬件ID不正确
EP_ERROR_HARDWAREBUFFEREMPTY=16 | 硬件ID为空字节
EP_ERROR_HARDWAREIDINVALIDFORKEY=17 | 硬件ID与密钥不符
EP_ERROR_PROJECTFILENOTFOUND=18 | 项目文件没有找到
EP_ERROR_INVALIDPROJECTFILE=19 | 项目文件不正确
EP_ERROR_EXECUTIONSNUMBERINVALID=20 | 运行次数不正确
EP_ERROR_DAYSNUMBERINVALID=21 | 日期不正确
EP_ERROR_COUNTRYCODEINVALID=22 | 区域代码不正确
EP_ERROR_RUNTIMEINVALID=23 | 运行时间不正确
EP_ERROR_GLOBALTIMEINVALID=24 | 合计时间不正确
EP_ERROR_INSTALLBEFOREINVALID=25 | 指定注册前日期不正确
EP_ERROR_INSTALLAFTERINVALID=26 | 指定日期后注册不正确

定义

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);
}

在程序安装目录可查看函数更多实例,如 Examples\Keygen 子文件夹。


KG_VerifyRegistrationInfoFromProjectA 函数

KG_VerifyRegistrationInfoFromProjectA 提取注册密钥属性验证注册信息。有两个属性，一个为 TKeyVerifyParamsA 结构, 另外一个为ansi形式, 空值将使程序停止运行。点击 TKeyVerifyParamsA 查看。

返回值

EP_NO_ERROR=0 | 函数执行成功;
EP_ERROR_UNKNOWN=1 | 未知错误
EP_ERROR_KEYBUFFEREMPTY=2 | 注册密钥不允许分配内存
EP_ERROR_KEYBUFFERISLESS=3 | 注册密钥获取内存不足
EP_ERROR_REGINFOEMPTY=4 | 注册信息非特定的
EP_ERROR_REGINFOTOOLARGE=5 | 注册信息为空 (空值大小)
EP_ERROR_PRIVATEKEYISNOTSET=6 | 私钥没有设置
EP_ERROR_PUBLICKEYISNOTSET=7 | 公钥没有设置
EP_ERROR_PRIVATEKEYISINVALID=8 | 私钥不正确
EP_ERROR_PUBLICKEYISINVALID=9 | 公钥不正确
EP_ERROR_KEYMODEISINVALID=10 | 密钥长度不正确
EP_ERROR_KEYBASEISINVALID=11 | 密钥输出方式不正确
EP_ERROR_CURRENTDATEISINVALID=12 | 日期不正确
EP_ERROR_EXPIRATIONDATEISINVALID=13 | 过期时间不正确
EP_ERROR_KEYISINVALID=14 | 密钥不正确
EP_ERROR_HARDWAREID=15 | 硬件ID不正确
EP_ERROR_HARDWAREBUFFEREMPTY=16 | 硬件ID为空字节
EP_ERROR_HARDWAREIDINVALIDFORKEY=17 | 硬件ID与密钥不符
EP_ERROR_PROJECTFILENOTFOUND=18 | 项目文件没有找到
EP_ERROR_INVALIDPROJECTFILE=19 | 项目文件不正确
EP_ERROR_EXECUTIONSNUMBERINVALID=20 | 运行次数不正确
EP_ERROR_DAYSNUMBERINVALID=21 | 日期不正确
EP_ERROR_COUNTRYCODEINVALID=22 | 区域代码不正确
EP_ERROR_RUNTIMEINVALID=23 | 运行时间不正确
EP_ERROR_GLOBALTIMEINVALID=24 | 合计时间不正确
EP_ERROR_INSTALLBEFOREINVALID=25 | 指定注册前日期不正确
EP_ERROR_INSTALLAFTERINVALID=26 | 指定日期后注册不正确

定义

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);
}

在程序安装目录可查看函数更多实例,如 Examples\Keygen 子文件夹。


TKeyVerifyParamsW 类型

TKeyVerifyParamsW 结构是使用KG_VerifyRegistrationInfoW 和 KG_VerifyRegistrationInfoFromProjectW 来验证注册信息。

结构描述

密钥长度

(输入参数) 注册密钥长度(RSA 512/768/1024/2048/3072/4096), 有以下值 (请参看 常规选项 - 常规 里注册密钥的安全/长度值):

RM_512 = 0;
RM_768 = 1;
RM_1024 = 2;
RM_2048 = 3;
RM_3072 = 4;
RM_4096 = 5;
密钥输出方式

(输入参数) 注册密钥的输出方式(Base 2/8/16/32/64), 有以下值(请参看 常规选项 - 常规 里注册密钥输出密钥方式值):

RB_2 = 0;
RB_8 = 1;
RB_16 = 2;
RB_32 = 3;
RB_64 = 4;
密钥 | (输入参数)unicode形式值, 空值注册密钥将使程序停止运行;
密钥长度 | (输入参数) 注册密钥字节长度;
注册信息 | (输入参数)unicode形式值, 空值注册信息将使程序停止运行;
生成年份 | (输出参数) 注册密钥生成的年份
生成月份 | (输出参数) 注册密钥生成的月份
生成日期 | (输出参数) 注册密钥生成日期
密钥过期 | (输出参数) 如值为0则注册密钥不会过期，如值为1则有时间限制，比如日期、月份、日等属性 (了解更多请点击 创建密钥);
过期年份 | (输出参数) 过期日期的年份;
过期月份 | (输出参数) 过期日期的月份;
过期日期 | (输出参数) 过期日期的日;
硬件锁定

(输入参数) 如果注册密钥锁定硬件则此项为1，否则为0 (了解更多请点击 创建密钥);
硬件ID类型 | (输入参数) unicode形式值, 空值硬件ID会导致程序停止运行;
限制运行

(输出参数) 注册密钥限制运行次数，属性为1则限制，为0则不限制 (详细请点击 创建密钥);
总运行次数 | (输出参数) 注册密钥里限制的运行总次数;
日期限制

(输出参数) 密钥限制日期，属性为1则激活限制，为0则不做限制 (详细请点击 创建密钥);
总时间 | (输出参数) 注册密钥里限制总时间;
运行时间限制

(输出参数) 密钥限制运行时间, 属性为1则激活时间限制，为0则不做限制 (详细请点击 创建密钥);
运行时间（分钟） | (输出参数) 注册密钥里限制运行时间;
总时间限制

(输出参数) 注册密钥限制总时间，属性为1则激活，为0则不做限制 (请点击 创建密钥);
总时间（分钟） | (输出参数) 注册密钥限制总时间（分钟）;
区域限制

(输出参数) 密钥限制区域 ，属性为1则激活，为0则不做限制 (详细请点击 创建密钥);
区域代码 | (输出参数) 注册密钥限制区域代码 (详细请点击 Enigma API 函数 EP_MiscCountryCode 获取更多区域代码);
在指定时间后注册 | (输出参数) 需在指定日期后注册，属性为1则激活，为0则不做限制。 (详情请点击 创建密钥);
在指定年份后注册 | (输出参数) 在指定年份后注册;
在指定月份后注册 | (输出参数) 在指定月份后注册;
在指定日期后注册 | (输出参数) 在指定日期后注册;
在指定时间前注册 | (输出参数) 在指定时间前注册，属性为1激活，为0则不做限制。 (详细请点击 创建密钥);
在指定年份前注册 | (输出参数) 在指定年份前注册;
在指定月份前注册 | (输出参数) 在指定月份前注册;
在指定日期前注册 | (输出参数) 在指定日期前注册;
加密常数 | (输入参数) 从项目工程文件可以获取此常数 (详细请点击 常规选项 - 常规 获取信息）;
加密区间 | (输出参数) 可设置16个加密区间 (详情请点击 创建密钥);
公钥 | (输入参数) 空值将导致程序停止运行，可在项目工程文件处获取 (详细请点击 常规选项 - 常规 获取信息);

定义

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
    }


KG_VerifyRegistrationInfoW 函数

KG_VerifyRegistrationInfoW 用来验证注册信息并提取密钥属性，结构属性为 TKeyVerifyParamsW 。请注意， TKeyVerifyParamsW 结构将连接 the Enigma Protector 项目工程文件。包括公钥、密钥长度、输出方式、加密常数等 (请点击 常规选项 - 常规 版面了解更多信息)。

返回值

EP_NO_ERROR=0 | 函数执行成功;
EP_ERROR_UNKNOWN=1 | 未知错误
EP_ERROR_KEYBUFFEREMPTY=2 | 注册密钥不允许分配内存
EP_ERROR_KEYBUFFERISLESS=3 | 注册密钥分配内存不足
EP_ERROR_REGINFOEMPTY=4 | 注册信息非特定的
EP_ERROR_REGINFOTOOLARGE=5 | 注册信息为空 (空值大小)
EP_ERROR_PRIVATEKEYISNOTSET=6 | 私钥没有设置
EP_ERROR_PUBLICKEYISNOTSET=7 | 公钥没有设置
EP_ERROR_PRIVATEKEYISINVALID=8 | 私钥不正确
EP_ERROR_PUBLICKEYISINVALID=9 | 公钥不正确
EP_ERROR_KEYMODEISINVALID=10 | 密钥长度不正确
EP_ERROR_KEYBASEISINVALID=11 | 密钥输出方式不正确
EP_ERROR_CURRENTDATEISINVALID=12 | 日期不正确
EP_ERROR_EXPIRATIONDATEISINVALID=13 | 过期时间不正确
EP_ERROR_KEYISINVALID=14 | 密钥不正确
EP_ERROR_HARDWAREID=15 | 硬件ID不正确
EP_ERROR_HARDWAREBUFFEREMPTY=16 | 硬件ID为空字节
EP_ERROR_HARDWAREIDINVALIDFORKEY=17 | 硬件ID与密钥不符
EP_ERROR_PROJECTFILENOTFOUND=18 | 项目文件没找到
EP_ERROR_INVALIDPROJECTFILE=19 | 项目文件不正确
EP_ERROR_EXECUTIONSNUMBERINVALID=20 | 运行次数不正确
EP_ERROR_DAYSNUMBERINVALID=21 | 日期不正确
EP_ERROR_COUNTRYCODEINVALID=22 | 区域代码不正确
EP_ERROR_RUNTIMEINVALID=23 | 运行时间不正确
EP_ERROR_GLOBALTIMEINVALID=24 | 合计时间不正确
EP_ERROR_INSTALLBEFOREINVALID=25 | 指定注册前日期不正确
EP_ERROR_INSTALLAFTERINVALID=26 | 指定日期后注册不正确

定义

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);
}

实例

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);
        }

在程序安装目录可查看函数更多实例,如 Examples\KeygeUnicode 子文件夹。


KG_VerifyRegistrationInfoFromProjectW 函数

KG_VerifyRegistrationInfoFromProjectW 用于提取密钥属性验证注册信息，函数有两个属性, 一个为 TKeyVerifyParamsW 结构, 另外一个为unicode形式, 空值将导致程序停止运行。了解更多，点击 TKeyVerifyParamsW 结构。

返回值

EP_NO_ERROR=0 | 函数执行成功;
EP_ERROR_UNKNOWN=1 | 未知错误
EP_ERROR_KEYBUFFEREMPTY=2 | 注册密钥不允许分配内存
EP_ERROR_KEYBUFFERISLESS=3 | 注册密钥分配内存不足
EP_ERROR_REGINFOEMPTY=4 | 注册信息非特定的
EP_ERROR_REGINFOTOOLARGE=5 | 注册信息为空（空值大小）
EP_ERROR_PRIVATEKEYISNOTSET=6 | 私钥没有设置
EP_ERROR_PUBLICKEYISNOTSET=7 | 公钥没有设置
EP_ERROR_PRIVATEKEYISINVALID=8 | 私钥不正确
EP_ERROR_PUBLICKEYISINVALID=9 | 公钥不正确
EP_ERROR_KEYMODEISINVALID=10 | 密钥长度不正确
EP_ERROR_KEYBASEISINVALID=11 | 密钥输出方式不正确
EP_ERROR_CURRENTDATEISINVALID=12 | 日期不正确
EP_ERROR_EXPIRATIONDATEISINVALID=13 | 过期时间不正确
EP_ERROR_KEYISINVALID=14 | 密钥不正确
EP_ERROR_HARDWAREID=15 | 硬件ID不正确
EP_ERROR_HARDWAREBUFFEREMPTY=16 | 硬件ID为空字节
EP_ERROR_HARDWAREIDINVALIDFORKEY=17 | 硬件ID与密钥不符
EP_ERROR_PROJECTFILENOTFOUND=18 | 项目文件没找到
EP_ERROR_INVALIDPROJECTFILE=19 | 项目文件不正确
EP_ERROR_EXECUTIONSNUMBERINVALID=20 | 运行次数不正确
EP_ERROR_DAYSNUMBERINVALID=21 | 日期不正确
EP_ERROR_COUNTRYCODEINVALID=22 | 区域代码不正确
EP_ERROR_RUNTIMEINVALID=23 | 运行时间不正确
EP_ERROR_GLOBALTIMEINVALID=24 | 合计时间不正确
EP_ERROR_INSTALLBEFOREINVALID=25 | 指定注册前日期不正确
EP_ERROR_INSTALLAFTERINVALID=26 | 指定日期后注册不正确

定义

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);
}

实例

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);
        }

在程序安装目录可查看函数更多实例,如 Examples\KeygeUnicode 子文件夹。


加密标识

加密标识是添加到源代码中的可以大幅提高加密强度的特殊标记。未保护的文件不依赖此标识运行，如果要应用加密标识，您应该在使用前先保护您的程序。

Please Note:

  • Markers cannot be used in DOT NET applications;
  • Visual Basic 6 applications should be compiled in native mode (not pcode).

Enigma Protector 支持以下类型的加密标识：

  • VM 标识 - 运行您选择一部分代码用虚拟机保护起来，此标识是最为实用的保护方式。
  • Reg_Crypt 标识 - 允许您选择一部分只有在软件注册后才会被解密执行的代码（未注册版不会执行）；
  • UnReg_Crypt 标识 - 允许您选择一部分可以在未注册版中执行的代码；
  • Decrypt_On_Execute 标识 - 允许您选择一部分只在需要执行时才解密的代码；
  • Unprotected 标识 - 允许您选择一部分代码在运行时候不需要保护即可运行；
  • Check_Protection 标识 - 检测是否在保护中，标识内代码不会被执行；
  • Run_Once 标识 - 标识内代码只会运行一次便从内存中永远删除。


加密标识使用规范

加密标识是添加到源代码中的告诉 Enigma Protector 哪部分代码需要加密处理的特殊标记字节，加密标识包含两部分：开始标识和结束标识。您应该牢记下述的加密标识使用规范：

  • 结束标识不能直接放在开始标识后面，否则会引起错误导致所有标识被忽略。
    {WRONG}
{$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}
{$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}
  • 加密标识必须成对出现，也就是说开始标识和结束标识是一起出现的。如果您漏掉一个，所有标识都会被忽略。
    {WRONG}
{$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_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}

    {RIGHT}
{$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\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}
  • 加密标识不能再包含有其它类型的标识。
    {WRONG}
{$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}
{$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}
  • 加密标识必须于代码部分完全分离：
    {WRONG}
{$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}
{$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}
  • 像 If-Then-Else, For-To-Do, While-Do, Repeat-Until, Try-Except, Try-Finally 之类的语句必须完全分离：
    {WRONG}
  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}
{$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}
  • 像C 和 C++ 语言，标识内不应有放置 return：
    {WRONG}
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;
    {$I include\check_protection_begin.inc}
    if (bReg)
    {
        if (EP_RegLoadKey(&sName, &sKey))
        {
            SetDlgItemText(IDC_EDIT_USERINFO, sName);
            SetDlgItemText(IDC_EDIT_KEY, sKey);
            return;
        }
    }
    {$I include\check_protection_end.inc}
}

    {RIGHT}
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;
    {$I include\check_protection_begin.inc}
    if (bReg)
    {
        if (EP_RegLoadKey(&sName, &sKey))
        {
            SetDlgItemText(IDC_EDIT_USERINFO, sName);
            SetDlgItemText(IDC_EDIT_KEY, sKey);
        }
    }
    {$I include\check_protection_end.inc}
    return;
}
  • Free Pascal users should enable Intel Assembler Style in Compiler Options.


VM标识

查看安装文件夹下 Examples\MarkerVM 子文件夹里获取更多实例。

Content

Show/Hide Delphi marker content

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

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 Visual Basic marker content

Call VarPtr("VM_BEGIN")

Call VarPtr("VM_END")

Examples

Show/Hide Delphi marker example

begin
  {$I ..\..\..\EnigmaSDK\Delphi\vm_begin.inc}
  ShowMessage('This message is shown under virtualized code');
  {$I ..\..\..\EnigmaSDK\Delphi\vm_end.inc}
end;

可以在安装文件夹下 Examples\MarkerVM 子文件夹里查看更多实例


Reg_Crypt 标识

Reg_Crypt 标识可以让您选择一部分代码注册后运行或者可以使用注册密钥进行解码。Enigma可以支持加密16个区间，每个标识可以单独选择一部分代码进行加密，当注册密钥正确时候无需重启程序即开始解码。参看Registration Dialog 和 Creating Keys 版块。

Content

Show/Hide Delphi marker content

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

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 Visual Basic marker content

Call VarPtr("REG_CRYPT_BEGINXX")

Call VarPtr("REG_CRYPT_ENDXX")

Examples

Show/Hide Delphi marker example

uses enigma_ide; // Use the Enigma API module to call EP_RegLoadAndCheckKey function

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

  {$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

// Enigma API respondence ---------------------------------------------------
#include "include/enigma_api.h"
#pragma link "include/enigma_ide.lib"
// --------------------------------------------------------------------------

// user-defined constants of module type registration
#define rtUnregistered  0
#define rtSingle        1
#define rtSite          2
#define rtCompany       3
#define rtPrivate       4
//---------------------------------------------------------------------------

int GetRegistrationType () { // function returns the type of module registration

  #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
};

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!"

在安装文件夹下 Examples\MarkersRegCrypt 子文件夹里参看更多实例。


UnReg_Crypt 标识

UnReg_Crypt 标识可以让您选择一部分代码在仅在未注册时候运行，The Enigma Protector支持16个标识区间解密，每个标识可以单独选择部分代码，点击查看 reg_crypt 标识。

Content

Show/Hide Delphi marker content

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

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 Visual Basic marker content

Call VarPtr("UNREG_CRYPT_BEGINXX")

Call VarPtr("UNREG_CRYPT_ENDXX")

Examples

Show/Hide Delphi marker example

uses
  enigma_ide; // Use the Enigma API module to call EP_RegLoadAndCheckKey function

begin
  {$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

// Enigma API respondence ---------------------------------------------------
#include "include/enigma_api.h"
#pragma link "include/enigma_ide.lib"
// --------------------------------------------------------------------------

BOOL TestMarkers () {

  #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;

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!"

可以在安装目录下 Examples\UnRegCryptMarkers 子文件夹里查看更多实例


Decrypt_On_Execute 标识

Decrypt_On_Execute 标识支持选择加密一部分仅在运行时释放的代码，例如您可以使用该标识加密您的模块。

Content

Show/Hide Delphi marker content

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

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 Visual Basic marker content

Call VarPtr("DECRYPT_ON_EXECUTE_BEGIN")

Call VarPtr("DECRYPT_ON_EXECUTE_END")

Examples

Show/Hide Delphi marker example

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
  {$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

{
  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
  #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"
};

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")

可以在安装文件夹下 Examples\MarkersDecryptOnExecute 子文件夹里查看更多实例


Check_Protection 标识

Check_Protection 标识可以用在被保护代码的自检上，在此标识里的代码在运行时候将进行是否在保护状态的自检。

Content

Show/Hide Delphi marker content

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

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 Visual Basic marker content

Call VarPtr("CHECK_PROTECTION_BEGIN")

Call VarPtr("CHECK_PROTECTION_END")

Examples

Show/Hide Delphi marker example

begin
  {$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")

可以在安装文件夹下 Examples\CheckProtection 子文件夹里查看更多实例


Run_Once标识

Run_Once 标识允许加密一部分代码，使其仅运行一次即永久从内存删除。

Content

Show/Hide Delphi marker content

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

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 Visual Basic marker content

Call VarPtr("RUN_ONCE_BEGIN")

Call VarPtr("RUN_ONCE_END")

Examples

Show/Hide Delphi marker example

begin
  {$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;

可以在安装文件夹下 Examples\MarkerRunOnce 子文件夹里查看更多实例


Unprotected 标识

Unprotected 标识支持加密一部分代码，使其仅在未注册时运行。

Content

Show/Hide Delphi marker content

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

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 Visual Basic marker content

Call VarPtr("UNPROTECTED_BEGIN")

Call VarPtr("UNPROTECTED_END")

Examples

Show/Hide Delphi marker example

begin
  {$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!"

可以在安装文件夹下 Examples\MarkersUnprotect 子文件夹里查看更多实例


新手指南

新手指南主要用来帮助新用户可以在几分钟内应用必需的保护，选择您想要学习的保护类型：

  • 简单的封装保护
  • 试用保护 1
  • 试用保护 2


简单的封装保护

简单的封装保护意味着您不必修改源代码就可以实施的保护方案。这种保护仅使用 Enigma Protector 的内部功能来保护文件不被反汇编、逆向、应用补丁（文件和内存内容改变）和内存转储。项目的内置参数仅对可执行文件有效。

  • 创建唯一的保护方案项目文件，参见 创建项目文件 一节。项目文件用作在后期创建复杂的保护。
  • 配置输入参数和保护参数。注意：当前项目无法应用注册密匙和试用控制的相关选项，请保留默认参数。
  • 执行保护方案。点击“保护”按钮实施保护方案，并验证保护后的程序能否正常运行。


Delphi 实例

下方的代码帮助您创建一个显示 "Hello World" 的简单程序。注意：保护后不会改变程序的可用性。当前项目的完整代码放置在 "Tutorials\Simple envelope protection\Delphi\"文件夹。

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.


试用保护１（不改变源代码）

试用保护意味着使用 Enigma Protector 的试用选项为程序添加时间限制，并使用 Enigma 创建注册密匙。这种保护使用 Enigma Protector 的内部功能，所以您不必修改源代码。当前的输入参数仅限于可执行文件。

  1. 创建唯一的保护方案项目文件，参见 创建项目文件 一节。项目文件用作在后期创建复杂的保护。
  2. 配置输入参数和保护参数。
  3. 选择试用期参数，参见 试用限制 一节。
    1. Enigma Protector 支持以下类型的试用限制：试用次数限制，试用天数限制（以用户计算机上第一次运行的日期开始计数），过期日期限制。请激活必要的试用限制参数。
    2. 设置过期行为。试用期过期意味着用户计算机上无法再使用保护后的程序，所以您可以在“试用控制”面板激活“结束进程”选项（参见 程序预览 - 试用控制 ），并输入结束进程需要等待的时间。如果此参数设置为零，程序启动后会立即结束。
    3. 试用期计数器使用系统时钟来计算试用参数，破解者可能会回拨系统时钟来重设试用限制，以此来恢复程序功能，您可以激活时钟控制功能来阻止这种行为。
    4. 开发新版本的软件时，您需要重置用户的试用期。这样您需要使用某种功能来检测用户计算机上的是否是最新版，如果是最新版，试用期会被重新设置。要使用这项功能，请在“试用控制”面板激活“重设试用期”选项。注意：这项功能需要用到您在“输入参数”中定义的版本信息（参见 选择输入参数 ）。
  4. 设置注册密匙（参见 注册密匙特性 ）。用户如果要移除试用限制就必须注册您的软件。软件注册是指在用户计算机上保存注册信息，选择保存注册信息的存储方式和路径。Enigma Protector 支持两种方式的注册信息存储 - 注册信息存储在外部文件或 Windows 注册表（参见 程序预览 - 注册特性 ）。
  5. 执行保护方案。点击“保护”按钮执行保护方案，并验证保护后的文件能否正常运行。

综述:

用户首次运行后，Enigma 载入器开始为试用期计数。如果试用期过期，载入器按在 3.b 节定义的行为执行。如果这时您还想试用软件的功能，你必须注册。您需要使用内部密匙生成器来创建注册密匙（参见 创建密匙 ）。关于注册信息的存储方式（外部文件或 Windows 注册表），您需要创建带有注册信息的注册文件：

  • 注册信息存储在 Windows 注册表。

    创建任意文件名的 .reg 文件并加入以下字符串：

  • [HKEY_ROOT\HKEY_RELATIVE]
"Name"="User Information"
"Key"="XUCBSNJ9T642DCQP3FW8C6NJL75X7"

    这里：HKEY_ROOT - Windows 注册表根目录，可以是：

    HKEY_LOCAL_MACHINE 和 HKEY_CURRENT_USER - 这里是在 注册特性 - 注册信息存储 面板“注册表根目录”中输入。

    HKEY_RELATIVE - Windows 注册表中的相对路径，在“注册表相对路径”中输入。

    User Information - 使用软件产品的注册用户的信息。

    XUCBSNJ9T642DCQP3FW8C6NJL75X7 - 注册密匙。

    发送这个 .reg 文件给用户，用户双击后就可以将注册信息导入到 Windows 注册表。做完这些工作，软件就可以被正确注册。

  • 注册信息存储在外部文件。

    创建一个文件，使用您在 注册特性 - 注册信息存储 面板中“注册文件相对路径”文本框里填写的文件名，并加入以下信息：

  • [Registration information]
Name=UserInfo
Key=XUCBSNJ9T642DCQP3FW8C6NJL75X7

    这里 UserInfo - 使用软件产品的注册用户的信息；

    XUCBSNJ9T642DCQP3FW8C6NJL75X7 - 注册密匙。

    将这个文件发送给用户，并让用户复制此注册文件到“注册文件根目录”文本框里填写的文件夹下。做完这些工作，软件就可以被正确注册。


Delphi 实例

下方的代码帮助您创建一个显示 "Hello World" 的简单程序。注意：保护后不会改变程序的可用性。当前项目的完整代码放置在 "Tutorials\Trial protection part 1\Delphi\" 文件夹。

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.


试用保护２（试用 Enigma API 函数）

本节内容帮助您试用有时间限制的保护方式，我们使用 Enigma API 函数来获取试用期的相关参数。这里需要您修改您的一部分源代码来调用 API 函数添加保护。

修改源代码

能够控制试用期的有如下 Enigma 内部 API 函数：

  • EP_TrialExecutions
  • EP_TrialDays
  • EP_TrialExpirationDate

这里的实例演示了不同开发语言如何调用 Enigma API 函数，实例放置在 Tutorials\Trial protection part 2\ 文件夹下。

这种保护方式的优势在于您可以手动处理试用参数，您可以任意调整试用参数和试用期。

创建项目文件、设置保护参数和创建注册密匙与 试用保护１ 类似。


Delphi 实例

这个实例使用 Enigma API 函数 EP_TrialExecutions 来获取总运行次数和剩余次数。如果剩余次数少于总次数的一半，将会显示提示消息。

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, PChar(sMessage), 'Test application', 0);
    end;
  end;
  // You may also use EP_TrialDays and EP_TrialExpirationDate
  // functions to control trial period
end.


Enigma 注册管理器

Enigma Protector 注册管理器专为用户管理注册用户/注册密钥而设计，可以添加注册用户详细信息、注册密钥等，点击“Customer”-“新建”按钮或者选择记录后点击“编辑”按钮建立或者编辑记录。

  • Adding/Editing 新建/编辑 (主菜单 - Customer - 新建/编辑)
  • 密钥生成器属性 (主菜单- Manager - 密钥生成器属性)
  • 导入注册数据库 (主菜单- Manager - 导入数据库)


编辑客户

在这里，您可以输入注册用户的各种信息，输入信息可以用在 Enigma 邮件管理器 中，所以输入用户邮件是非常重要的，方便您使用 Enigma 邮件管理器 发送邮件。输入信息将在列表右边框显示。例图如下：

  • 新建/编辑注册信息

额外信息 - 设置用户额外信息记录。参看 License Manager Properties 。使用Enigma Mailer设置额外信息， 请点击此处。


导入注册信息数据库

此项功能可以从先前建立的项目里导入注册信息数据库，可以帮助您：

  • 如果您新建了项目想升级原来存在项目里的注册密钥
  • 如果您修改了硬件锁定的方式
  • 如果您想使用最新的Enigma保护您开发的程序
  • 如果您想结合以前的信息设置新的项目

步骤 1. 选择已经存在的数据库文件（*.enigmabd），点击“Next”按钮。

步骤 2. 选择导入

重新读入注册密钥 - 激活此项后将导入和原注册信息数据库一致的信息。

导入过期密钥 - 激活导入过期密钥选项。

导入失窃密钥 - 激活导入失窃密钥。

步骤 3. 下图展示了Enigma导入数据库的过程，点击Finish按钮完成导入。


注册授权编辑

非常简单易用的注册授权编辑器，类似 密钥生成器 窗口。

注册名称 - 输入注册用户名

添加连字符 - 在注册密钥中添加“-”连字符

注册密钥 - 注册密钥分项

复制/粘贴 - 点击复制/粘贴至剪贴板

硬件ID - 输入硬件ID编码

- 点击检测输入硬件ID是否合法

过期日期 - 输入注册密钥过期日期

许可数量 - 输入授权许可数量

许可价格 - 输入许可价格

参考序数 - 授权参考序数

已泄漏的许可 - 如果注册密钥已经过期（泄漏），请激活此项，被保护的程序使用这个注册密钥时候将会自动分辨

备注 - 授权备注信息

使用 Enigma Mailer 创建邮件

已续订的许可 - 激活此选项时，Enigma邮件管理器将生成对应邮件

续订过期日期 - 输入续订过期日期

创建邮件 - 点击按钮创建相应邮件，更多信息请点击 License Manager Properties

创建 - 创建注册密钥，更多信息请点击 License Manager Properties。邮件部分请点击 点击此处 。


密钥生成器属性

关于密钥生成器属性的设置：

过期日期 - 设置密钥过期日期属性

允许密钥过期 - 激活此选项，当授权管理器打开将生效；

固定值 - 该日期标识密钥过期时间；

自定义值 - 可以自定义设置密钥过期时间。

已加密的区间 - 设置已加密区间，当授权管理器打开生效。

泄漏的密钥

自动标记过期密钥为已泄漏 - 激活此项，Enigma在保护文件里将自动标记已过期密钥为已泄漏密钥。

订阅 - 输入续订日期。

创建邮件- 支持模板创建邮件。

邮件管理器只选中一个模板 - 邮件模板将只使用一个模板。

模板目录 - 选择后输入邮件模板所在目录。

选中的模板文件 - 添加模板文件至列表。

用户参数 - 支持设置无限制用户记录参数，此参数可存储于授权管理器中，或点击Enigma Mailer 。

Desciption(描述) - 输入参数描述。

Short Name(简称) - 参数简称。

Default Value - 参数默认值。

License Parameters - 允许设置无限制授权参数记录。

Desciption(描述) - 输入参数描述。

Short Name(简称) - 参数简称。

Default Value - 参数默认值。


Enigma 邮件管理器

邮件管理器是 Enigma Protector 附带的特殊工具，用来帮助您创建和发送电子邮件给您的注册客户。每一个软件都需要通知用户注册信息或升级信息，如果对每一个用户都单独创建通知邮件的话，将会非常困难。Enigma 邮件管理器就是为此设计的，可以自动创建和发送各种通知邮件，您只需使用 Enigma 注册管理器创建一个注册用户的数据库即可。模板 - 是 Enigma 邮件管理器发送给用户的通用文本。

  • 用户列表
  • 选项
  • 模板
  • 电子邮件


用户列表

用户列表 - 这里通过数据库显示所有的注册记录。创建数据库请使用 注册管理器 。

选择用户后单击鼠标邮件可以发送邮件。


邮件选项

这里显示的是 Enigma 邮件管理器用来连接到邮件服务器的常规选项。

EMail 地址

发送地址 - 您的 Email 发送地址；此地址需要和下面的用户名、密码相匹配。

帐户信息

用户名 - 连接到 SMTP 服务器的 Email 帐户用户名。

密码 - 连接到 SMTP 服务器的 Email 帐户密码。

邮件服务器

SMTP 服务器的地址和端口您可以咨询您的 Email 邮件服务商。

SMTP 服务器 - SMTP 服务器的地址。

端口 - 发送 Email 需要的端口。

发送延时

延时 - 如果服务器发生错误，则延时一段时间再次发送。


邮件模板

您可以在这里定义自动创建 Email 所需的模板。

模板包含 4 部分：发送地址、收件人地址、主题和正文，这些区域可以是静态文本，或表达式变量。下面的表格给出了表达式的含义：

表达式 | 描述
%CUSTOMERCOMPANY% | 客户公司名称
%CUSTOMERFIRSTNAME% | 客户的姓氏
%CUSTOMERLASTNAME% | 客户的名字
%CUSTOMERSTREET% | 客户的街道地址
%CUSTOMERSTATE% | 客户所在的省
%CUSTOMERZIP% | 客户所在地的邮政编码
%CUSTOMERCITY% | 客户所在的城市
%CUSTOMERCOUNTRY% | 客户所在的国家
%CUSTOMERLANGUAGE% | 客户所使用的语言
%CUSTOMERPHONE% | 客户的电话号码
%CUSTOMERFAX% | 客户的传真号码
%CUSTOMEREMAIL% | 客户的 Email
%REGNAME% | 注册用户名
%REGKEY% | 注册密钥
%REGKEYCREATEDATE% | 注册密钥创建日期
%REGKEYEXPIRATIONDATE% | 注册密钥过期日期
%REGKEYHARDWARE% | 注册密钥硬件 ID
%REGKEYLICNUM% | 注册密钥许可数量
%REGKEYPRICE% | 注册密钥价格
%REGKEYREFERENCE% | 注册密钥参考序数
%REGKEYCOMMENT% | 注册密钥备注

添加自定义邮件模板

添加自定义模板，在“Pattern”选项里填写，以%CUSTOMER开始，以%结尾。见例图。

添加自定义注册模板，在“Pattern”选项填写，以%REG开始，以%结尾。见例图。

打开 按钮 - 从文件打开一个邮件模板。

另存为 按钮 - 将当前模板存到文件。

模板文件类似于 xml 文件，您可以在 Enigma Protector 安装目录下的 Email Patterns 子目录找到更多模板样式。

创建 Emails 按钮 - 点击这个按钮可以按照模板样式自动生成电子邮件。

注意：Email 的创建需要使用 Enigma Protector 注册管理器的数据库。Email 只能在注册记录被标记为“已注册”而不是“已泄漏”的情况下才会被创建。


电子邮件

这里显示的是电子邮件数据库的内容。发件箱 - 准备发送的邮件。发件箱 - 已经发送的电子邮件。垃圾邮件 - 已经删除的邮件。如果需要在不同的目录中移动电子邮件，您可以使用右键菜单“移动到目录...”命令。删除命令会删除选定目录里的所有邮件。

发送 - 点击这个按钮来发送保存在发件箱里的邮件。


缺陷和使用限制

使用 Enigma Protector 有如下限制：

  1. 不支持无入口点的模块（用来存储资源的动态链接库）；
  2. 不支持有 CRC 校验功能的程序；
  3. 不支持多层保护，例如，Enigma Protector 无法与其它压缩/保护工具一起使用；

如果您发现 Enigma Protector 或其保护后的程序有错误，请您告诉我们！在您发送错误报告之前，麻烦您先将导致错误的行为描述清楚，这点对于我们很重要。同样，如果您能将项目文件连同未保护的程序一起发送过来，我们将会很感激您！


压缩选项

本节的主题会帮助您选择要保护文件的压缩类型。

  • 压缩类型 - 选择压缩类型（所有类型的压缩方式解压速度都很快，您不必担心您软件的启动速度）：
    • 快速 - 快速压缩。可以用作临时版本的压缩，这种压缩类型压缩速度快但是压缩率不高。
    • 最好 - 最好压缩。可以用作发布版本的压缩，这种压缩类型压缩速度稍慢但是压缩率很高。
  • 压缩方式 - 选择资源的压缩方式。注意， Enigma Protector 不压缩以下类型的资源：STRINGS, 24, 'TYPELIB', 'REGISTRY', 这些资源在保护后的程序中也可以看到。
    • 压缩除图标外的所有资源 - 只有图标不会被压缩
    • 压缩除图标、版本外的所有资源 - 只有图标和版本不会被压缩
    • 压缩所有资源 - 除了上面提到的资源类型，所有资源都会被压缩。