|
使用手册
加密标识使用规范
加密标识是添加到源代码中的告诉 Enigma Protector 哪部分代码需要加密处理的特殊标记字节,加密标识包含两部分:开始标识和结束标识。您应该牢记下述的加密标识使用规范:
- 结束标识不能直接放在开始标识后面,否则会引起错误导致所有标识被忽略。
{$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}
- 加密标识必须成对出现,也就是说开始标识和结束标识是一起出现的。如果您漏掉一个,所有标识都会被忽略。
{$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}
- 加密标识不能再包含有其它类型的标识。
{$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}
- 加密标识必须于代码部分完全分离:
{$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}
- 像 If-Then-Else, For-To-Do, While-Do, Repeat-Until, Try-Except, Try-Finally 之类的语句必须完全分离:
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}
- 像C 和 C++ 语言,标识内不应有放置 return:
{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.

|