Защита от копирования с CD
Материал из DRKB
procedure craye_file_inc;
var
j: Int64;
buf: array[Word] of Byte;
st: TFileStream;
begin
for j:=0 to 32766 do
buf[j] := Byte(j); // ne pas craye un fichier de moins de 32k
st := TFileStream.Create('Protection.dat', fmCreate);
try
for j:=0 to 10 do
st.Write(Buf, Sizeof(Buf));
finally
st.Free;
end;
end;
// dans votre programme
function CheckIfOriginalCd: Boolean
var
f: THandle;
b: array[0..500] of Byte;
lus: Integer;
Totlus: Int64;
begin
Result := False;
Totlus := 0;
if not FileExist('Protection.dat') then exit;
f := FileCreate('Protection.dat', fmRead);
while true do
begin
try
FileRead(f, b, lus);
exept
break;
end;
totlus := totlus + lus;
if lus = 0 then
break;
end;
if FileSize('Protection.dat') <> Totlus then
if attributs, time etc etc... then
Result := True;
end;
ID: 04577