Markers Reg_Crypt
Reg_Crypt markers allow selecting parts of the code that should be executed only in case the module is registered, and the registration key allows deciphering the crypted section. Enigma Protector supports 16 types of Reg_Crypt markers. Each marker can be used to select any number of the code parts. Note that the application has to be restarted after registration for the Reg_Crypt markers to work correctly. Restarting is not needed if you use the standard Registration Dialog.
The principle of work: after the module is protected, the code inside the begin/end markers will be encrypted and the execution of the code will be impossible. If you try to run the protected module, the code inside the markers will not be executed, but other functionality will stay the same. If a valid registration key is stored in the system, the loader checks what sections can be decrypted with this key, and if succeeds, the necessary encrypted section will be decrypted. I.e. if the registration key was generated with Section 1 unlocked, the reg_crypt_begin1/reg_crypt_end1 marker will be decrypted. To register the module, use internal Enigma API functions or perform registration by means of key files, or use the standard Registration Dialog. For detailed information on the registration key generator see Creating Keys.
Content
Show/Hide Delphi marker content
uses
enigma_ide;
procedure Test;
begin
EP_Marker('reg_crypt_beginXX');
EP_Marker('reg_crypt_endXX');
end;
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
#include "enigma_ide.h"
#pragma optimize("", off)
void test()
{
EP_Marker("reg_crypt_beginXX");
EP_Marker("reg_crypt_endXX");
}
#pragma optimize("", on)
reg_crypt_beginXX.inc
__asm
{
DB 0xEB, 0x08, 0x52, 0x47, 0x43, 0x52, 0x42, 0xXX, 0x00, 0x00
}
reg_crypt_endXX.inc
__asm
{
DB 0xEB, 0x08, 0x52, 0x47, 0x43, 0x52, 0x45, 0xXX, 0x00, 0x00
}
Show/Hide C++ x64 marker content
#include "enigma_ide.h"
#pragma optimize("", off)
void test()
{
EP_Marker("reg_crypt_begin1");
EP_Marker("reg_crypt_end1");
}
#pragma optimize("", on)
Show/Hide Visual Basic marker content
Call VarPtr("REG_CRYPT_BEGINXX")
Call VarPtr("REG_CRYPT_ENDXX")
Examples
Show/Hide Delphi marker example
uses
enigma_ide;
type
TRegType = (rtUnregistered, rtSingle, rtSite, rtCompany, rtPrivate);
function GetRegistrationType : TRegType;
begin
Result := rtUnregistered;
EP_Marker('reg_crypt_begin1');
if EP_RegLoadAndCheckKey then
begin
Result := rtSingle;
Exit;
end;
EP_Marker('reg_crypt_end1');
EP_Marker('reg_crypt_begin2');
if EP_RegLoadAndCheckKey then
begin
Result := rtSite;
Exit;
end;
EP_Marker('reg_crypt_end2');
EP_Marker('reg_crypt_begin3');
if EP_RegLoadAndCheckKey then
begin
Result := rtCompany;
Exit;
end;
EP_Marker('reg_crypt_end3');
EP_Marker('reg_crypt_begin4');
if EP_RegLoadAndCheckKey then
begin
Result := rtPrivate;
Exit;
end;
EP_Marker('reg_crypt_end4');
{$I include\reg_crypt_begin1.inc}
if EP_RegLoadAndCheckKey then
begin
Result := rtSingle;
Exit;
end;
{$I include\reg_crypt_end1.inc}
{$I include\reg_crypt_begin2.inc}
if EP_RegLoadAndCheckKey then
begin
Result := rtSite;
Exit;
end;
{$I include\reg_crypt_end2.inc}
{$I include\reg_crypt_begin3.inc}
if EP_RegLoadAndCheckKey then
begin
Result := rtCompany;
Exit;
end;
{$I include\reg_crypt_end3.inc}
{$I include\reg_crypt_begin4.inc}
if EP_RegLoadAndCheckKey then
begin
Result := rtPrivate;
Exit;
end;
{$I include\reg_crypt_end4.inc}
end;
Show/Hide C++ marker example
#include "enigma_ide.h"
#define rtUnregistered 0
#define rtSingle 1
#define rtSite 2
#define rtCompany 3
#define rtPrivate 4
#pragma optimize("", off)
int GetRegistrationType ()
{
EP_Marker('reg_crypt_begin1');
if (EP_RegLoadAndCheckKey()){
return rtSingle;
};
EP_Marker('reg_crypt_end1');
EP_Marker('reg_crypt_begin2');
if (EP_RegLoadAndCheckKey()){
return rtSite;
};
EP_Marker('reg_crypt_end2');
EP_Marker('reg_crypt_begin3');
if (EP_RegLoadAndCheckKey()){
return rtCompany;
};
EP_Marker('reg_crypt_end3');
EP_Marker('reg_crypt_begin4');
if (EP_RegLoadAndCheckKey()){
return rtPrivate;
};
EP_Marker('reg_crypt_end4');
#include "include\reg_crypt_begin1.inc"
if (EP_RegLoadAndCheckKey()){
return rtSingle;
};
#include "include\reg_crypt_end1.inc"
#include "include\reg_crypt_begin2.inc"
if (EP_RegLoadAndCheckKey()){
return rtSite;
};
#include "include\reg_crypt_end2.inc"
#include "include\reg_crypt_begin3.inc"
if (EP_RegLoadAndCheckKey()){
return rtCompany;
};
#include "include\reg_crypt_end3.inc"
#include "include\reg_crypt_begin4.inc"
if (EP_RegLoadAndCheckKey()){
return rtPrivate;
};
#include "include\reg_crypt_end4.inc"
return rtUnregistered;
};
#pragma optimize("", on)
Show/Hide Visual Basic marker example
Call VarPtr("REG_CRYPT_BEGIN1")
MsgBox "Section #1 is unlocked by key!"
Call VarPtr("REG_CRYPT_END1")
Call VarPtr("REG_CRYPT_BEGIN2")
MsgBox "Section #2 is unlocked by key!"
Call VarPtr("REG_CRYPT_END2")
Call VarPtr("REG_CRYPT_BEGIN3")
MsgBox "Section #3 is unlocked by key!"
Call VarPtr("REG_CRYPT_END3")
Call VarPtr("REG_CRYPT_BEGIN4")
MsgBox "Section #4 is unlocked by key!"
Call VarPtr("REG_CRYPT_END4")
Call VarPtr("REG_CRYPT_BEGIN5")
MsgBox "Section #5 is unlocked by key!"
Call VarPtr("REG_CRYPT_END5")
MsgBox "If you did not see any message then this application is not registered or key does not unlock any section!"
See markers examples in the installation folder, Examples\MarkersRegCrypt subfolder.