破解ACCESS的数据库密码
来源:龙人计算机研究所 作者:站长 时间:2006-11-04 11:37:24
procedure TPassForm.CreateMDB(Sender: TObject);
var
Date0: TDate;
Date1: TDate;
Date2: TDate;
begin
{Date0 := EncodeDate(1978, 7, 01);
Date1 := EncodeDate(1989, 9, 17);
Date2 := EncodeDate(2079, 6, 05); }
//SetTime(Date0);
Make01('D:\DB01.MDB', '112233大');
//SetTime(Date1);
Make01('D:\DB02.MDB', '甚至于');
//SetTime(Date2);
Make01('D:\DB03.MDB', '');
end;
procedure SetFTime(const FileName: string; DTime: TDateTime);
var
Q: HFile;
ST: TSystemTime;
FT: TFileTime;
begin
DateTimeToSystemTime(DTime, ST);
SystemTimeToFileTime(ST, FT);
LocalFileTimeToFileTime(FT, FT);
Q := FileOpen(FileName, fmOpenWrite or fmShareDenyNone);
SetFileTime(Q, @FT, @FT, @FT);
end;
function TempPath(): string;
var
SPath, SFile: array[0..254] of char;
begin
GetTempPath(254, SPath);
GetTempFileName(SPath, '~SM', 0, SFile);
result := SFile;
DeleteFile(result);
end;
function TPassForm.Make01(F: string; P: string = ''): boolean;
var
Linker: string;
Access: OleVariant;
begin
if FileExists(F) then DeleteFile(F);
Linker :=
'Provider=Microsoft.Jet.OLEDB.4.0;Data ' +
'Source=%s;Jet OLEDB:Database Password=%s;';
Access := CreateOleObject('ADOX.Catalog');
Access.Create(format(Linker, [F, P]));
end;
function TPassForm.Make02(F: string): boolean;
var
Access: OleVariant;
begin
if FileExists(F) then DeleteFile(F);
Access := CreateOleObject('Access.Application');
Access.NewCurrentDatabase(F);
Access.Quit;
Access := null;
end;
procedure TPassForm.FormCreate(Sender: TObject);
begin
Pick1.DateTime := Now;
FileBox1 := TFileListBox.Create(nil);
FileBox1.Visible := false;
FileBox1.Parent := Self;
FileBox1.Mask := '*.MDB';
end;
procedure TPassForm.FormDestroy(Sender: TObject);
begin
FileBox1.Free;
end;
procedure TPassForm.ExecDirectory(S: string);
var
i: integer;
P: PassType;
begin
FileBox1.Directory := S;
ListView1.Items.BeginUpdate;
ListView1.Items.Clear;
for i := FileBox1.Count - 1 downto 0 do begin
S := FileBox1.Items[i];
P := ExecFile(S);
if P.PassCode = '' then Continue;
with ListView1.Items.Add do begin
Caption := S;
ImageIndex := 0;
SubItems.Add(P.FileType);
SubItems.Add(P.PassCode);
SubItems.Add(FormatDateTime(model, P.FileTime));
end;
ListView1.Items.EndUpdate;
end;
end;
var
Date0: TDate;
Date1: TDate;
Date2: TDate;
begin
{Date0 := EncodeDate(1978, 7, 01);
Date1 := EncodeDate(1989, 9, 17);
Date2 := EncodeDate(2079, 6, 05); }
//SetTime(Date0);
Make01('D:\DB01.MDB', '112233大');
//SetTime(Date1);
Make01('D:\DB02.MDB', '甚至于');
//SetTime(Date2);
Make01('D:\DB03.MDB', '');
end;
procedure SetFTime(const FileName: string; DTime: TDateTime);
var
Q: HFile;
ST: TSystemTime;
FT: TFileTime;
begin
DateTimeToSystemTime(DTime, ST);
SystemTimeToFileTime(ST, FT);
LocalFileTimeToFileTime(FT, FT);
Q := FileOpen(FileName, fmOpenWrite or fmShareDenyNone);
SetFileTime(Q, @FT, @FT, @FT);
end;
function TempPath(): string;
var
SPath, SFile: array[0..254] of char;
begin
GetTempPath(254, SPath);
GetTempFileName(SPath, '~SM', 0, SFile);
result := SFile;
DeleteFile(result);
end;
function TPassForm.Make01(F: string; P: string = ''): boolean;
var
Linker: string;
Access: OleVariant;
begin
if FileExists(F) then DeleteFile(F);
Linker :=
'Provider=Microsoft.Jet.OLEDB.4.0;Data ' +
'Source=%s;Jet OLEDB:Database Password=%s;';
Access := CreateOleObject('ADOX.Catalog');
Access.Create(format(Linker, [F, P]));
end;
function TPassForm.Make02(F: string): boolean;
var
Access: OleVariant;
begin
if FileExists(F) then DeleteFile(F);
Access := CreateOleObject('Access.Application');
Access.NewCurrentDatabase(F);
Access.Quit;
Access := null;
end;
procedure TPassForm.FormCreate(Sender: TObject);
begin
Pick1.DateTime := Now;
FileBox1 := TFileListBox.Create(nil);
FileBox1.Visible := false;
FileBox1.Parent := Self;
FileBox1.Mask := '*.MDB';
end;
procedure TPassForm.FormDestroy(Sender: TObject);
begin
FileBox1.Free;
end;
procedure TPassForm.ExecDirectory(S: string);
var
i: integer;
P: PassType;
begin
FileBox1.Directory := S;
ListView1.Items.BeginUpdate;
ListView1.Items.Clear;
for i := FileBox1.Count - 1 downto 0 do begin
S := FileBox1.Items[i];
P := ExecFile(S);
if P.PassCode = '' then Continue;
with ListView1.Items.Add do begin
Caption := S;
ImageIndex := 0;
SubItems.Add(P.FileType);
SubItems.Add(P.PassCode);
SubItems.Add(FormatDateTime(model, P.FileTime));
end;
ListView1.Items.EndUpdate;
end;
end;