unit Unit1;
interface
uses
Windows, Messages,SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TForm1 = class(TForm)
passedit: TEdit;
Button1: TButton;
OpenDialog1: TOpenDialog;
Chk2000: TCheckBox;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
const
xorString:array[0..12]of byte=
( $86, $FB, $EC, $37,
$5D, $44, $9C, $FA,
$C6, $5E, $28, $E6,$13 );
xorString2:array[0..20]of byte=
( $D3, $EC, $08, $9C,
$93, $28, $46, $8A,
$01, $7B, $A0, $DF,
$22, $13, $9A, $B1,
$61, $79, $C7, $7C,$5B);
var
passBuf:array[0..14]of byte;
pass:array[0..14]of char;
passBuf2:array[0..40]of byte;
pass2:array[0..20]of char;
B:Byte;
F:TFileStream;
I,j:integer;
begin
if opendialog1.execute then begin
if not FileExists(opendialog1.filename) then
begin
Showmessage('文件不存在,或一般错误.');
Application.Terminate;
exit;
end;
F:=TFileStream.Create(opendialog1.filename,fmShareDenyNone);
if NOT chk2000.Checked then
try
F.Seek($42,soFromBeginning);
F.Read(passBuf,14);
for I:=0 to 13 do
begin
B := passBuf xor xorString;
pass:=char(B);
end;
pass[sizeof(pass) - 1] := #0;
passEdit.Text:=StrPas(Pass);
finally
F.Free;
end else
try
F.Seek($42,soFromBeginning);
F.Read(passBuf2,40);
I:=0;j:=0;
while I<40 do
begin
B := passBuf2 xor xorString2[j];
pass2[j]:=char(B);
inc(i,2);inc(j);
end;
pass2[sizeof(pass2) - 1] := #0;
passEdit.Text:=StrPas(Pass2);
finally
f.Free;
end;
end;
end;
end.//试试.