Windows优化大师注册机源码

[入库:2005年8月18日] [更新:2007年3月25日]

本文简介:选择自 drate 的 blog

windows优化大师注册机源码
unit unit1;

interface

uses
windows, messages, sysutils, variants, classes, graphics, controls, forms,
dialogs, registry, stdctrls, buttons;

type
tform1 = class(tform)
label1: tlabel;
label2: tlabel;
edit1: tedit;
edit2: tedit;
label3: tlabel;
edit3: tedit;
getkeyspeedbutton: tspeedbutton;
checkbox1: tcheckbox;
label4: tlabel;
procedure getkeyspeedbuttonclick(sender: tobject);
procedure checkbox1click(sender: tobject);
private
{ private declarations }
public
{ public declarations }
end;

var
form1: tform1;
family, model, stepping: byte;

implementation

{$r *.dfm}

//获得cpu信息的过程,用汇编代码写的
procedure getcpuid;
asm
push eax
mov eax, 1
dw $a20f //汇编指令cpuid的机器代码
mov stepping, al
and stepping, 0fh //取得cpu stepping数送入到变量stepping中
and al, 0f0h
shr al, 4
mov model, al //取得cpu model数送入到变量model中
shr ax, 8
and al, 0fh
mov family, al //取得cpu familyg数送入到变量family中
pop eax
end;

//rsa的加密和解密函数,等价于(m^e) mod n(即m的e次幂对n求余)
function encrypt_decrypt(m: int64; e: int64=$2c86f9; n: int64=$69aaa0e3): int64;
var
a, b, c: int64;
begin
a:=m;
b:=e;
c:=1;
while b<>0 do
if (b mod 2)=0
then begin
b:=b div 2;
a:=(a * a) mod n;
end
else begin
b:=b - 1;
c:=(a * c) mod n;
end;
result:=c;
end;

procedure tform1.getkeyspeedbuttonclick(sender: tobject);
var
id, username, cpuver: string;
s: array [1..4] of cardinal;
temp, num1, num2: cardinal;
code1, code2: int64;
i, ascii: byte;
reg: tregistry;
begin
if (edit1.text='') and (checkbox1.checked=false)
then application.messagebox('请输入注册申请码!', '警告', mb_ok);
if (edit1.text='') and (checkbox1.checked=true)
then application.messagebox('请输入注册者姓名!', '警告', mb_ok);
if (checkbox1.checked=true) and (edit1.text<>'')
then begin
username:=edit1.text; //从edit1.text中取得用户名
getcpuid; //调用过程getcpuid
cpuver:='level '+inttostr(family)+' rev. '+inttostr(model)+'.'+inttostr(stepping);
temp:=1;
i:=1;
while username[i]<>#0 do begin
ascii:=ord(username[i]); //函数ord()的作用为取得字符的ascii码
temp:=(temp*ascii+$d0878) mod $f4240;
inc(i);
end;
i:=1;
while cpuver[i]<>#0 do begin
ascii:=ord(cpuver[i]);
temp:=(temp*ascii+$2597d) mod $f4240;
inc(i);
end;
id:=inttostr(temp);
end;
if (checkbox1.checked=false) and (edit1.text<>'')
then id:=edit1.text;
id:=id+'1234567';
setlength(id, 8); //把字符串id长度变为8个,并把后面的字符截掉

//下面四行语句是把字符串'you are big pig.'的内存数据送到变量s中
s[1]:=$20756f59;
s[2]:=$20657261;
s[3]:=$20676962;
s[4]:=$2e676970;
num1:=0;
for i:=4 downto 2 do
num1:=(num1+ord(id[i])) shl 8;
num1:=num1+ord(id[1]);
num2:=0;
for i:=8 downto 6 do
num2:=(num2+ord(id[i])) shl 8;
num2:=num2+ord(id[5]);
temp:=0;
for i:=1 to 32 do begin
temp:=temp+$9e3779b9;
num1:=num1+(num2 shl 4)+(s[1] xor num2)+((num2 shr 5) xor temp)+s[2];
num2:=num2+(num1 shl 4)+(s[3] xor num1)+((num1 shr 5) xor temp)+s[4];
end;

code1:=(num1 mod $40000000) + 2;
code2:=($93e0014 shl 2)+ num1 div $40000000 + 2;
code1:=encrypt_decrypt(code1);
code2:=encrypt_decrypt(code2);
if (checkbox1.checked=false) and (edit1.text<>'')
then begin
edit2.text:=inttohex(code1, 8);
edit3.text:=inttohex(code2, 8);
end;
if (checkbox1.checked=true) and (edit1.text<>'')
then begin
reg:=tregistry.create;
reg.rootkey:=hkey_local_machine;
if reg.openkey('software\wom', true)
then begin
reg.deletevalue('masters');
reg.writestring('register', username);
reg.writestring('register_1', inttohex(code1, 8));
reg.writestring('register_2', inttohex(code2, 8));
end;
reg.free;
application.messagebox('自动注册完成!', '信息', mb_ok);
end;
end;

procedure tform1.checkbox1click(sender: tobject);
begin
if checkbox1.checked=true
then begin
getkeyspeedbutton.caption:='自动注册';
label1.caption:='注册者姓名';
edit1.maxlength:=0;
label2.visible:=false;
label3.visible:=false;
edit2.visible:=false;
edit3.visible:=false;
end
else begin
getkeyspeedbutton.caption:='取得注册码';
label1.caption:='注册申请码';
edit1.maxlength:=8;
label2.visible:=true;
label3.visible:=true;
edit2.visible:=true;
edit3.visible:=true;
end;
end;

end.

 

 

本文关键:优化大师 注册机 源码
  相关方案
Google
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top