WINDOWS Optimization Master Registrar Source Code Unit Unit1;
Interface
Useswindows, Messages, Sysutils, Variants, Classes, Graphics, Controls, Forms, Dialogs, Registry, Stdctrls, Buttons
typeTForm1 = 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} end;
Varform1: TForm1; Family, Model, Stepping: Byte
IMPLEMENTATION
{$ R * .dfm}
// The process of obtaining the CPU information, uses assembly code written by the procedure getcpuid; Asmpush Eaxmov Eax, 1DW $ A20F // Compilation CPUID machine code MOV Stepping, Aland Stepping, 0FH // Get the CPU Stepping number feed into the variable stepping And Al, 0F0HSHR Al, 4MOV MODEL, AL / / Number of CPU MODELs are sent to the variable model in SHR AX, 8and Al, 0FHMOV Family, AL // Get the number of cpu family to send to the variable Family Pop Eaxend;
// RSA encryption and decryption function, equivalent to (m ^ e) mod n (ie M ^ E) power to N: = :pPT_Decrypt (m: int64; E: int64 = $ 2c86f9; N: int64 = $ 69 AAA0E3): INT64; VARA, B, C: INT64; Begina: = m; B: = E; C: = 1; While B <> 0 DOIF (B MOD 2) = 0Then Beginb: = B Div 2; A: = (a * a) mod n; endelse beginb: = b - 1; c: = (a * c) mod n; end; result: = C; end;
Procedure TForm1.GetKeyspeedButtonClick (Sender: Tobject); Varid, UserName, CPUVER: String; S: Array [1..4] of cardinal; temp, num1, num2: cardinal; code1, code2: int64; i, ascii: byte; REG: Tregistry; beginif (edit1.text = ') and (checkbox1.checked = false) Then Application.MessageBox (' Please enter the registration application code! ',' Warning ', MB_OK); if (edit1.text =' ' ) and (checkbox1.checked = true) Then Application.MessageBox ('Please enter the registrar name!', 'warning', MB_OK); if (checkbox1.checked = true) and (edit1.text <> ') THEN BeginuserName : = Edit1.Text; // Name the username getcpuid; // call process getcpuidcpuver: = 'radostr (model) ' Rev. ' INTOSTR (MODEL) '. ' INTOSTR ( Stepping; Temp: = 1; i: = 1; While UserName [i] <> # 0 do beginascii: = ORD (UserName [i]); // Function ORD () role to get the ASCII code Temp: = (Temp * ASCII $ D0878) Mod $ F4240; Inc (i); end; i: = 1; While Cpuver [i] <> # 0 do beginascii: = ORD (CPUVER [i]); Temp: = (TEMP * ASCII $ 2597D) Mod $ F4240; INC (I); End; ID: = INTOSTR (TEMP); end; if (checkbox1.checked = false) and (edit1.text <> ') Then ID: = Edit1. Text; ID: = ID '1234567'; setlength (ID, 8); // turn the string ID length to 8, and cut the following character Fall out
// The following four line statement is to send the memory data of the string 'you are big pig.' S [1]: = $ 20756f59; s [2]: = $ 20657261; s [3]: = $ 20676962; s [4]: = $ 2e676970; Num1: = 0; for i: = 4 DOWNTO 2 DONUM1: = (Num1 ORD (ID [i])) SHL 8; Num1: = Num1 ORD (ID [1]) Num2: = 0; for i: = 8 DOWNTO 6 DONUM2: = (Num2 ORD (ID [i])) SHL 8; Num2: = Num2 ORD (ID [5]); TEMP: = 0; for i : = 1 to 32 do begintemp: = 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 $ 400000) 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 beginEdit2.Text: = INTTOHEX (CODE1, 8); Edit3.Text: = INTTOHEX (CODE2, 8); END; if (checkbox1.checked = true) and (edit1.text <> ') THEN BEGINREG: = Tregistry.create; reg.rootkey : = HKEY_LOCAL_MACHINE; if Reg.OpenKey ( 'Software / Wom', True) then beginReg.DeleteValue ( 'Masters'); Reg.WriteString ( 'Register', UserName); Reg.WriteString ( 'Register_1', IntToHex (Code1, 8)); Re G.WriteString ('register_2', INTTOHEX (CODE2, 8)); End; Reg.Free; Application.MessageBox ('Auto Registration Complete! ',' Information ', MB_OK; END;
procedure TForm1.CheckBox1Click (Sender: TObject); beginif CheckBox1.Checked = truethen beginGetKeySpeedButton.Caption: = 'automatic registration'; Label1.Caption: = 'name registrant'; Edit1.MaxLength: = 0; Label2.Visible: = false Label3.visible: = false; edit2.visible: = false; edit3.visible: = false; endelse beginning: = 'get registration code'; label1.caption: = 'Registration application code'; edit1.maxlength: = Label2.visible: = true; label3.visible: = true; ed2.visible: = true; Edit3.Visible: = true; End; end;