设为首页收藏本站Access中国

Office中国论坛/Access中国论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

返回列表 发新帖
查看: 574|回复: 2
打印 上一主题 下一主题

[其它] ACCESS的数据库密码2

[复制链接]
跳转到指定楼层
1#
发表于 2006-7-20 17:21:00 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
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 OLEDBatabase 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;
? 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;

procedure TPassForm.GetMDBDir(Sender: TObject);
var
  S: string;
begin
  if not SelectDirectory('选择数据库目录', '', S) then Exit;
  Edit1.Text := S;
  ExecDirectory(S);
end;

procedure TPassForm.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
  if Key <> #13 then Exit;
  if Trim(Edit1.Text) = '' then Exit;
  ExecDirectory(Edit1.Text);
end;

procedure TPassForm.CloseForm(Sender: TObject);
begin
  Close;
end;

function TPassForm.ExecFile(FName: string): PassType;
  function CovTime(FD: _FileTime): TDateTime;
  var
? TCT: _SystemTime;
? Tmp: _FileTime;
  begin
? FileTimeToLocalFileTime(FD, Tmp);
? FileTimeToSystemTime(Tmp, TCT);
? Result := SystemTimeToDateTime(TCT);
  end;

var
  Stream: TFileStream;
  i, n: integer;
  TP: TSearchRec;
  WTime: TDateTime;
  WSec: DWord;
  M, S: string;
  Buf: array[0..200] of byte;
  Date0: TDateTime;
  Date1: TDateTime;
  Date2: TDateTime;
const
  XorStr = $823E6C94;
begin
  FindFirst(FName, faAnyFile, TP);
//?FT := CovTime(TP.FindData.ftCreationTime);

  Stream := TFileStream.Create(FName, fmOpenReadWrite);
  Stream.Seek($00, 00); Stream.Read(Buf[0], 200);
  if Buf[$14] = 0 then begin
? PassCode := '';
? Stream.Seek($42, 00); Stream.Read(Buf[0], 20);
? for i := 0 to 19 do
?? PassCode := PassCode + chr(Buf xor InCode97);
? Result.PassCode := PassCode;
? Result.FileType := 'ACCESS-97';
? Result.FileTime := Now;
? Exit; // 按Access97版本处理
  end;

  Date0 := EncodeDate(1978, 7, 01);
  Date1 := EncodeDate(1989, 9, 17);
  Date2 := EncodeDate(2079, 6, 05);

  Stream.Seek($42, 00); Stream.Read(ReaderArray[0], 40);
  Stream.Seek($75, 00); Stream.Read(DateStr, 4);
  Stream.Free;
  for i := $42 to $42 + 55 do begin
? if i = $72 then M := '-' else M := '';
? S := S + #32 + M + IntToHex(Buf, 2);
  end;
  Dele
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享分享 分享淘帖 订阅订阅
2#
发表于 2006-7-20 17:59:00 | 只看该作者
好贴

好贴





[em01][em01]
3#
发表于 2006-7-20 19:46:00 | 只看该作者
用DELPHI编制的,学习
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|站长邮箱|小黑屋|手机版|Office中国/Access中国 ( 粤ICP备10043721号-1 )  

GMT+8, 2024-11-26 03:34 , Processed in 0.087010 second(s), 26 queries .

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表