Benim delphi 2005 de bir lisanslama algoritmam vardı ve ben bunu şimdi delphi 2010 da kullanmak istiyorum fakat bazı hatalar veriyor yardımcı olabilirmisiniz?
Kod: Tümünü seç
var
Form1: TForm1;
Kalan :Integer;
implementation
uses EMANETGIRIS, EMANETCIKIS, EMANETRAPOR, Unit5, Unit8, Unit9, EMANETANA,
Lisanslama;
{$R *.dfm}
//Lisanslama Basla
const
C1 = 52845;
C2 = 22719;
function Decode(const S: AnsiString): AnsiString;
const
Map: array[Char] of Byte = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 62, 0, 0, 0, 63, 52, 53,
54, 55, 56, 57, 58, 59, 60, 61, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2,
3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
20, 21, 22, 23, 24, 25, 0, 0, 0, 0, 0, 0, 26, 27, 28, 29, 30,
31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45,
46, 47, 48, 49, 50, 51, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0);
[color=#FF0000]// tam burda "[DCC Error] EMANETMENU.pas(74): E2072 Number of elements (256) differs from declaration (65536)" bu hatayı veriyor[/color]
var
I: LongInt;
begin
case Length(S) of
2:
begin
I := Map[S[1]] + (Map[S[2]] shl 6);
SetLength(Result, 1);
Move(I, Result[1], Length(Result))
end;
3:
begin
I := Map[S[1]] + (Map[S[2]] shl 6) + (Map[S[3]] shl 12);
SetLength(Result, 2);
Move(I, Result[1], Length(Result))
end;
4:
begin
I := Map[S[1]] + (Map[S[2]] shl 6) + (Map[S[3]] shl 12) +
(Map[S[4]] shl 18);
SetLength(Result, 3);
Move(I, Result[1], Length(Result))
end
end
end;
function PreProcess(const S: AnsiString): AnsiString;
var
SS: AnsiString;
begin
SS := S;
Result := '';
while SS <> '' do
begin
Result := Result + Decode(Copy(SS, 1, 4));
Delete(SS, 1, 4)
end
end;
function InternalDecrypt(const S: AnsiString; Key: Word): AnsiString;
var
I: Word;
Seed: Word;
begin
Result := S;
Seed := Key;
for I := 1 to Length(Result) do
begin
Result[I] := Char(Byte(Result[I]) xor (Seed shr 8));
[color=#FF0000]//Tam burda "[DCC Error] EMANETMENU.pas(123): E2010 Incompatible types: 'AnsiChar' and 'Char'"[/color] " hata veriyor
Seed := (Byte(S[I]) + Seed) * Word(C1) + Word(C2)
end
end;
function Decrypt(const S: AnsiString; Key: Word): AnsiString;
begin
Result := InternalDecrypt(PreProcess(S), Key)
end;
function Encode(const S: AnsiString): AnsiString;
const
Map: array[0..63] of Char = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' +
'abcdefghijklmnopqrstuvwxyz0123456789+/';
var
I: LongInt;
begin
I := 0;
Move(S[1], I, Length(S));
case Length(S) of
1:
Result := Map[I mod 64] + Map[(I shr 6) mod 64];
[color=#FF0000]// Tam burda "[DCC Warning] EMANETMENU.pas(144): W1058 Implicit string cast with potential data loss from 'string' to 'AnsiString'" hata veriyor[/color]
2:
Result := Map[I mod 64] + Map[(I shr 6) mod 64] +
Map[(I shr 12) mod 64];
[color=#FF0000]// Tam Burda "[DCC Warning] EMANETMENU.pas(147): W1058 Implicit string cast with potential data loss from 'string' to 'AnsiString'[/color] " hata veriyor
3:
Result := Map[I mod 64] + Map[(I shr 6) mod 64] +
Map[(I shr 12) mod 64] + Map[(I shr 18) mod 64]
end
[color=#FF0000]//Tam burda "[DCC Warning] EMANETMENU.pas(151): W1058 Implicit string cast with potential data loss from 'string' to 'AnsiString'" hatayı veriyor[/color]
end;
function PostProcess(const S: AnsiString): AnsiString;
var
SS: AnsiString;
begin
SS := S;
Result := '';
while SS <> '' do
begin
Result := Result + Encode(Copy(SS, 1, 3));
Delete(SS, 1, 3)
end
end;
function InternalEncrypt(const S: AnsiString; Key: Word): AnsiString;
var
I: Word;
Seed: Word;
begin
Result := S;
Seed := Key;
for I := 1 to Length(Result) do
begin
Result[I] := Char(Byte(Result[I]) xor (Seed shr 8));
[color=#FF0000]//Tam burda "[DCC Error] EMANETMENU.pas(176): E2010 Incompatible types: 'AnsiChar' and 'Char' " hatayı veriyor[/color]
Seed := (Byte(Result[I]) + Seed) * Word(C1) + Word(C2)
end
end;
function Encrypt(const S: AnsiString; Key: Word): AnsiString;
begin
Result := PostProcess(InternalEncrypt(S, Key))
end;
{ TForm2 }
procedure TForm1.RegKayit;
[color=#FF0000]//Tam burda " [DCC Error] EMANETMENU.pas(188): E2003 Undeclared identifier: 'RegKayit' " hata veriyor[/color]
var
Reg:TRegistry;
Expired:Integer;
Tarih:Tdate;
begin
try
reg:=TRegistry.create;
reg.RootKey:=HKEY_LOCAL_MACHINE;
if reg.KeyExists('software\Emanet') then
begin
reg.OpenKey('software\Emanet',false);
Tarih:=reg.ReadDate('sdate');
Kalan:=round(tarih-date);
Expired:=Reg.ReadInteger('expired');
ProgressBar1.Position:=30-kalan;
label1.Caption:=Format('DEMO Kalan Süre %d gün.',[kalan]);
if Kalan>Expired then
begin
Application.MessageBox('Kaçak Kullanım..!','HATA',mb_ok+MB_ICONERROR);
Application.Terminate;
end else
begin
reg.WriteInteger('expired',kalan);
reg.CloseKey;
if kalan<0 then
begin
Application.MessageBox('DEMO için Kullanım süresi doldu..!','DEMO',mb_ok+MB_ICONWARNING);
Application.Terminate;
end;
end;
end else
begin
reg.CreateKey('software\emanet');
reg.OpenKey('software\Emanet',false);
reg.WriteDate('sdate',date+30);
reg.WriteInteger('expired',30);
reg.WriteInteger('MachineID',12291238);
reg.WriteDate('ActivationDate',date);
reg.WriteTime('ActivationTime',time);
reg.WriteString('VolumeSerial','NONE54312');
reg.WriteString('UnlockKey','NONEDEFAULT');
reg.CloseKey;
end;
finally
reg.free;
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
RegKontrol;
end;
function TForm1.RegKontrol: Boolean;
var
r:TRegistry;
uzunluk:integer;
i:integer;
rakam:integer;
karekter:string;
tek:string;
bilgi:string;
hdd:integer;
sayi:Double;
tarih:TDate;
Saat:Ttime;
Anahtar:String;
Kalan,Expired:Integer;
Sahip:String;
begin
try
r:=TRegistry.create;
r.RootKey:=HKEY_LOCAL_MACHINE;
if r.KeyExists('Software\Emanet') then
begin
r.OpenKey('Software\Emanet',false);
tarih:=r.ReadDate('ActivationDate');
Saat:=r.ReadTime('ActivationTime');
Anahtar:=r.ReadString('UnLockKey');
Sahip:=r.ReadString('RegistereDowner');
r.CloseKey;
end else
begin
r.CreateKey('software\Emanet');
r.OpenKey('software\Emanet',false);
r.WriteDate('sdate',date+30);
r.WriteInteger('expired',30);
r.WriteInteger('MachineID',12291238);
r.WriteDate('ActivationDate',date);
r.WriteTime('ActivationTime',time);
r.WriteString('UnlockKey','NONEDEFAULT');
r.WriteString('RegisreteDowner','UNKNOWN');
r.CloseKey;
end;
ctl3d:=False;
uzunluk:=Length(SysInfo.VolumeSerialNo);
karekter:=SysInfo.VolumeSerialNo;
for i:=1 to uzunluk do
begin
tek:=copy(karekter,i,1);
if (tek<'A') and (tek>'0') then bilgi:=bilgi+tek;
end;
hdd:=StrToInt(bilgi);
sayi:=Round((hdd*tarih/5431)*tarih);
if Anahtar<>Encrypt(CurrToStr(sayi),1238) then
begin
form1.Button9.Visible:=true;
r.OpenKey('software\Emanet',false);
Tarih:=r.ReadDate('sdate');
Kalan:=round(tarih-date);
Expired:=R.ReadInteger('expired');
ProgressBar1.Position:=30-kalan;
label1.Caption:=Format('DEMO Kalan Süre %d gün.',[kalan]);
if Kalan>Expired then
begin
Application.MessageBox('Kaçak Kullanım..!','HATA',mb_ok+MB_ICONERROR);
Application.Terminate;
end else
begin
r.WriteInteger('expired',kalan);
r.CloseKey;
if kalan<0 then
begin
Application.MessageBox('DEMO için Kullanım süresi doldu..!','DEMO',mb_ok+MB_ICONWARNING);
Application.Terminate;
end;
end;
end else
begin
ProgressBar1.Visible:=false;
label1.Caption:='Lisans Sahibi :'+Sahip;
end;
finally
r.free;
end;
end;
end.
// Lisanslama Son