?? unit1.pas
字號:
{*****************************************************************************}
{作者:許運乾,QQ:415270083, 或E-mail:CxLing03@163.com或qian0303@sohu.com }
{在軟件保護中,我們常常要用到機器的標識。根據作者的經驗,在好些服務器上無法取 }
{得硬盤序列號。特別是在那些使用了并列存儲技術或做了鏡象的硬盤。網卡也容易更換 }
{,因此作者建議使用CPU序列號。在這里,作者提供了獲得CPU序列號和網卡Mac地址的方}
{法。1.Delphi中可這個控件或這個動態庫。控件提供了兩個屬性,MacAddress和 }
{CPUSerialNumber。2.Delphi外的語言,請使用這個動態庫。動態庫提供了兩個函數, }
{GetCPUSerialNumber和GetMacAddress,這些函數和控件,在win2000和winXP中測試通過}
{,在多CPU、多硬盤、使用了并列存儲技術的大型服務器上,也測試通過。 }
{*****************************************************************************}
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Editid: TEdit;
Editcode: TEdit;
Label1: TLabel;
Label2: TLabel;
Button1: TButton;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
function Decrypt(const s: string; key: word): string;
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
function TForm1.Decrypt(const s: string; key: word): string;
var
i:byte;
R:String;
const
C1=50;
C2=50;
begin
SetLength(R,Length(s));
for i:=1 to Length(s) do
begin
R[i]:=char(byte(s[i]) xor (key shr 8));
key:=(byte(s[i])+key)+C1+C2
end;
Result:=R;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
if Trim(Editid.Text)='' then
begin
MessageBox(Handle,pchar('對不起,機器標識不能為空'),pchar('系統提示'),mb_ok or mb_iconwarning);
Editid.SetFocus;
Exit;
end;
Editcode.Text:=Decrypt(Trim(Editid.Text),100);
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
Close;
end;
end.
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -