本帖最后由 jjjjjj8889 于 2022-2-8 12:37 编辑
输入密码,点下面按钮,经过简单加密后判定,正确的话会在memo显示密码正确,错误不显示任何信息。
按钮就是如图的几种代码保护,非常简单,大家可以尝试每一种保护。代码也贴出来了,为lazarus编译,所以显得文件比较大。
序列号文件可按自己需求改名或删除。
下载:https://m01.lanzouq.com/igPY3zqtkwh
[Delphi] 纯文本查看 复制代码 unit vmptest;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, des, VMProtectSDK;
type
{ TForm1 }
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
Button3: TButton;
Button4: TButton;
Button6: TButton;
Button7: TButton;
Edit1: TEdit;
Label1: TLabel;
Label2: TLabel;
Memo1: TMemo;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
procedure Button6Click(Sender: TObject);
procedure Button7Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
public
end;
var
Form1: TForm1;
implementation
{$R *.lfm}
{ TForm1 }
procedure TForm1.Button6Click(Sender: TObject);
begin
VMProtectBeginVirtualizationLockByKey('Button6Click'); //虚拟化并锁定序列号
if EncryStrHex(edit1.Text,'key')=EncryStrHex('123456','key') then memo1.Lines.Add('密码正确!'+FormatdateTime('hh:mm:ss', now));
VMProtectEnd;
end;
procedure TForm1.Button7Click(Sender: TObject);
begin
VMProtectBeginUltraLockByKey('Button7Click'); //变异+虚拟化并锁定序列号
if EncryStrHex(edit1.Text,'key')=EncryStrHex('123456','key') then memo1.Lines.Add('密码正确!'+FormatdateTime('hh:mm:ss', now));
VMProtectEnd;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin //无保护
if EncryStrHex(edit1.Text,'key')=EncryStrHex('123456','key') then memo1.Lines.Add('密码正确!'+FormatdateTime('hh:mm:ss', now));
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
VMProtectBeginMutation('Button2Click'); //代码变异
if EncryStrHex(edit1.Text,'key')=EncryStrHex('123456','key') then memo1.Lines.Add('密码正确!'+FormatdateTime('hh:mm:ss', now));
VMProtectEnd;
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
VMProtectBeginVirtualization('Button3Click'); //代码虚拟化
if EncryStrHex(edit1.Text,'key')=EncryStrHex('123456','key') then memo1.Lines.Add('密码正确!'+FormatdateTime('hh:mm:ss', now));
VMProtectEnd;
end;
procedure TForm1.Button4Click(Sender: TObject);
begin
VMProtectBeginUltra('Button4Click'); //代码变异+虚拟化
if EncryStrHex(edit1.Text,'key')=EncryStrHex('123456','key') then memo1.Lines.Add('密码正确!'+FormatdateTime('hh:mm:ss', now));
VMProtectEnd;
end;
procedure TForm1.FormCreate(Sender: TObject);
var
load_xlh:Tstringlist;
begin
if FileExists('序列号.txt') then
begin
load_xlh:=Tstringlist.Create;
load_xlh.LoadFromFile(ExtractFilePath(Application.ExeName) + '序列号.txt');
if VMProtectSetSerialNumber(PAnsiChar(AnsiString(load_xlh.Text)))=0 then //将序列号载入vmp系统
begin
memo1.Lines.Add('序列号成功载入vmp系统');
end;
load_xlh.Free;
end;
end;
end.
|