|
 | Controls | |
 | Properties | |
 | Additional | |
|
|
|
Руководство
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.
{$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}
{$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 marker. In case you have lost one marker from the pair, all markers will be ignored.
{$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}
{$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}
- Markers should not contain any other kind of markers.
{$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}
{$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:
{$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;
{$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:
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;
{$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:
{WRONG}
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;
{$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;
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;
{$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.

|