|
| Controls | |
| Properties | |
| Additional | |
|
|
|
Manual
Rules of markers usage
A Marker is a set of bytes placed into the source code and helping Enigma Protector find the code inside markers for processing. A marker consists of two parts: begin marker and end marker. You should remember the following rules of markers usage:
- The end marker can't be placed before the begin marker, otherwise it will cause an error and all markers will be ignored.
uses
enigma_ide;
EP_Marker('reg_crypt_end1');
MessageBox(0, #10#13'This message appears only if application is registered' +
#10#13'and section #1 unlocked by registration key' +
#10#13, 'Application', 0);
EP_Marker('reg_crypt_begin1');
{$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}
uses
enigma_ide;
EP_Marker('reg_crypt_begin1');
MessageBox(0, #10#13'This message appears only if application is registered' +
#10#13'and section #1 unlocked by registration key' +
#10#13, 'Application', 0);
EP_Marker('reg_crypt_end1');
{$I include\reg_crypt_begin1.inc}
MessageBox(0, #10#13'This message appears only if application is registered' +
#10#13'and section #1 unlocked by registration key' +
#10#13, 'Application', 0);
{$I include\reg_crypt_end1.inc}
- The markers should be placed in pairs, i.e. there should be both begin and end markers. In case you have lost one marker from the pair, all markers will be ignored.
uses
enigma_ide;
EP_Marker('reg_crypt_begin1');
MessageBox(0, #10#13'This message appears only if application is registered' +
#10#13'and section #1 unlocked by registration key' +
#10#13, 'Application', 0);
EP_Marker('vm_risc_begin');
MessageBox(0, #10#13'This message from RISC virtual machine'#10#13, 'Application', 0);
EP_Marker('vm_risc_end');
EP_Marker('reg_crypt_end1');
{$I include\reg_crypt_begin1.inc}
MessageBox(0, #10#13'This message appears only if application is registered' +
#10#13'and section #1 unlocked by registration key' +
#10#13, 'Application', 0);
{$I include\vm_risc_begin.inc}
MessageBox(0, #10#13'This message from RISC virtual machine'#10#13, 'Application', 0);
{$I include\vm_risc_end.inc}
{$I include\reg_crypt_end1.inc}
uses
enigma_ide;
EP_Marker('reg_crypt_begin1');
MessageBox(0, #10#13'This message appears only if application is registered' +
#10#13'and section #1 unlocked by registration key' +
#10#13, 'Application', 0);
EP_Marker('reg_crypt_end1');
EP_Marker('vm_risc_begin');
MessageBox(0, #10#13'This message from RISC virtual machineappears only if application is registered', 'Application', 0);
EP_Marker('vm_risc_end');
{$I include\reg_crypt_begin1.inc}
MessageBox(0, #10#13'This message appears only if application is registered' +
#10#13'and section #1 unlocked by registration key' +
#10#13, 'Application', 0);
{$I include\reg_crypt_end1.inc}
{$I include\vm_risc_begin.inc}
MessageBox(0, #10#13'This message from RISC virtual machineappears only if application is registered', 'Application', 0);
{$I include\vm_risc_end.inc}
- Markers should not contain any other kind of markers.
uses
enigma_ide;
EP_Marker('reg_crypt_begin1');
EP_Marker('reg_crypt_begin2');
MessageBox(0, #10#13'This message appears only if application is registered' +
#10#13'and section #1 unlocked by registration key' +
#10#13, 'Application', 0);
EP_Marker('reg_crypt_end2');
EP_Marker('reg_crypt_end1');
{$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}
uses
enigma_ide;
EP_Marker('reg_crypt_begin1');
MessageBox(0, #10#13'This message appears only if application is registered' +
#10#13'and section #1 unlocked by registration key' +
#10#13, 'Application', 0);
EP_Marker('reg_crypt_end1');
{$I include\reg_crypt_begin1.inc}
MessageBox(0, #10#13'This message appears only if application is registered' +
#10#13'and section #1 unlocked by registration key' +
#10#13, 'Application', 0);
{$I include\reg_crypt_end1.inc}
- Markers should separate completed parts of the code:
uses
enigma_ide;
EP_Marker('reg_crypt_begin1');
if EP_RegLoadKey(pcUserInfo, pcKey) then
begin
eName.Text := string(pcUserInfo);
EP_Marker('reg_crypt_end1');
eKey.Text := string(pcKey);
ShowMessage('Thanks for registration');
end;
{$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;
uses
enigma_ide;
EP_Marker('reg_crypt_begin1');
if EP_RegLoadKey(pcUserInfo, pcKey) then
begin
eName.Text := string(pcUserInfo);
eKey.Text := string(pcKey);
ShowMessage('Thanks for registration');
end;
EP_Marker('reg_crypt_end1');
{$I include\reg_crypt_begin1.inc}
if EP_RegLoadKey(pcUserInfo, pcKey) then
begin
eName.Text := string(pcUserInfo);
eKey.Text := string(pcKey);
ShowMessage('Thanks for registration');
end;
{$I include\reg_crypt_end1.inc}
- statements like If-Then-Else, For-To-Do, While-Do, Repeat-Until, Try-Except, Try-Finally etc. should be fully separated:
uses
enigma_ide;
if EP_RegLoadKey(pcUserInfo, pcKey) then
begin
EP_Marker('reg_crypt_begin1');
eName.Text := string(pcUserInfo);
eKey.Text := string(pcKey);
ShowMessage('Thanks for registration');
EP_Marker('reg_crypt_end1');
end;
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;
uses
enigma_ide;
EP_Marker('reg_crypt_begin1');
if EP_RegLoadKey(pcUserInfo, pcKey) then
begin
eName.Text := string(pcUserInfo);
eKey.Text := string(pcKey);
ShowMessage('Thanks for registration');
end;
EP_Marker('reg_crypt_end1');
{$I include\reg_crypt_begin1.inc}
if EP_RegLoadKey(pcUserInfo, pcKey) then
begin
eName.Text := string(pcUserInfo);
eKey.Text := string(pcKey);
ShowMessage('Thanks for registration');
end;
{$I include\reg_crypt_end1.inc}
- for C and C++ users: the return; keyword can't be placed inside the marker (except for the VM and VM_RISC markers):
{WRONG: return inside the marker}
#include "enigma_ide.h"
void CTestDlg::CheckRegistered(BOOL bReg)
{
CWnd* wnd;
wnd = GetDlgItem(IDC_BUTTON_UNREGISTER);
wnd->EnableWindow(bReg);
wnd = GetDlgItem(IDC_BUTTON_REGISTER);
wnd->EnableWindow(!bReg);
wnd = GetDlgItem(IDC_EDIT_USERINFO);
wnd->EnableWindow(!bReg);
wnd = GetDlgItem(IDC_EDIT_KEY);
wnd->EnableWindow(!bReg);
char* sName = NULL;
char* sKey = NULL;
EP_Marker('check_protection_begin');
if (bReg)
{
if (EP_RegLoadKey(&sName, &sKey))
{
SetDlgItemText(IDC_EDIT_USERINFO, sName);
SetDlgItemText(IDC_EDIT_KEY, sKey);
return;
}
}
EP_Marker('check_protection_end');
}
{RIGHT}
#include "enigma_ide.h"
void CTestDlg::CheckRegistered(BOOL bReg)
{
CWnd* wnd;
wnd = GetDlgItem(IDC_BUTTON_UNREGISTER);
wnd->EnableWindow(bReg);
wnd = GetDlgItem(IDC_BUTTON_REGISTER);
wnd->EnableWindow(!bReg);
wnd = GetDlgItem(IDC_EDIT_USERINFO);
wnd->EnableWindow(!bReg);
wnd = GetDlgItem(IDC_EDIT_KEY);
wnd->EnableWindow(!bReg);
char* sName = NULL;
char* sKey = NULL;
EP_Marker('check_protection_begin');
if (bReg)
{
if (EP_RegLoadKey(&sName, &sKey))
{
SetDlgItemText(IDC_EDIT_USERINFO, sName);
SetDlgItemText(IDC_EDIT_KEY, sKey);
}
}
EP_Marker('check_protection_end);
return;
}
- Free Pascal users should enable Intel Assembler Style in Compiler Options.
- For 64 bit applications the markers are being inserted using EP_Marker function (some x64 compilers do not support inline assembler, which is used to place markers for x86 applications)
uses
enigma_ide;
EP_Marker('vm_risc_begin');
if EP_RegLoadKey(pcUserInfo, pcKey) then
begin
eName.Text := string(pcUserInfo);
eKey.Text := string(pcKey);
ShowMessage('Thanks for registration');
end;
EP_Marker('vm_risc_end');
{$I include\vm_risc_begin.inc}
if EP_RegLoadKey(pcUserInfo, pcKey) then
begin
eName.Text := string(pcUserInfo);
eKey.Text := string(pcKey);
ShowMessage('Thanks for registration');
end;
{$I include\vm_risc_end.inc}
- C and C++ compilers often use code optimization, due to this some markers can be placed to the code chaotically, thus markers are being rejected by protection (the warning message will be shown in the protection log). If the problem exists, the optimization should be disabled for the code inside markers, including markers. See more about optimization https://msdn.microsoft.com/en-us/library/chh3fb0k.aspx
#include "enigma_ide.h"
void Test()
{
char* sName = NULL;
char* sKey = NULL;
#pragma optimize( "", off )
EP_Marker('check_protection_begin');
if (bReg)
{
if (EP_RegLoadKey(&sName, &sKey))
{
SetDlgItemText(IDC_EDIT_USERINFO, sName);
SetDlgItemText(IDC_EDIT_KEY, sKey);
}
}
EP_Marker('check_protection_end');
#pragma optimize( "", on )
return;
}
|