得到Win9X里缓存中的密码_Delphi

  • 内容
  • 评论
  • 相关

program getpass;
........
type
...
ListBox: TListBox;
procedure getpasswords;
.......
end;

const Count: Integer = 0;

http://www.gaodaima.com/?p=65765得到Win9X里缓存中的密码_Delphi

function WNetEnumCachedPasswords(lp: lpStr; w: Word; b: Byte; PC: PChar;
    dw: DWord): Word; stdcall;

implementation

{$R *.DFM}
function WNetEnumCachedPasswords(lp: lpStr; w: Word; b: Byte; PC: PChar;
    dw: DWord): Word; external mpr name 'WNetEnumCachedPasswords';

type
PWinPassword = ^TWinPassword;
TWinPassword = record
   EntrySize: Word;
   ResourceSize: Word;
   PasswordSize: Word;
   EntryIndex: Byte;
   EntryType: Byte;
   PasswordC: Char;
  end;
var
  WinPassword: TWinPassword;

function AddPassword(WinPassword: PWinPassword; dw: DWord): LongBool; stdcall;
var
  Password: String;
  PC: Array[0..$FF] of Char;
begin
  inc(Count);

  Move(WinPassword.PasswordC, PC, WinPassword.ResourceSize);
  PC[WinPassword.ResourceSize] := #0;
  CharToOem(PC, PC);
  Password := StrPas(PC);

  Move(WinPassword.PasswordC, PC, WinPassword.PasswordSize +
       WinPassword.ResourceSize);
  Move(PC[WinPassword.ResourceSize], PC, WinPassword.PasswordSize);
  PC[WinPassword.PasswordSize] := #0;
  CharToOem(PC, PC);
  Password := Password + ': ' + StrPas(PC);

  Form1.ListBox.Items.Add(Password);
  Result := True;
end;

procedure tform1.getpasswords;
var error:string;
begin
  if WNetEnumCachedPasswords(nil, 0, $FF, @AddPassword, 0) <> 0 then
  begin
    error := '不能载入密码:用户未登录。';
  end
  else if Count = 0 then error := '未发现密码...'
end; 

欢迎大家阅读《得到Win9X里缓存中的密码_Delphi》,跪求各位点评,若觉得好的话请收藏本文,by 搞代码

原创文章,转载请注明: 转载自搞代码

本文链接地址: 得到Win9X里缓存中的密码_Delphi

微信支付二维码

微信 赏一包辣条吧~

支付宝支付二维码

支付宝 赏一听可乐吧~

评论

0条评论

发表评论

电子邮件地址不会被公开。 必填项已用*标注