unit test; <br><br>interface <br><br>uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,<br> StdCtrls , shellApi;<br><br>type <br>PPASSWORD_CACHE_ENTRY=^TPASSWORD_CACHE_ENTRY; <br>TPASSWORD_CACHE_ENTRY=packed record <br>cbEntry: word; //password entry的字节长度 <br>cbResource: word; //resource name的字节长度 <br>cbPassword: word; //password的字节长度 <br>iEntry: byte; //entry index <br>nType: byte; //type of entry <br>abResource : array[0..200] of char; //start of resource name //password immediately follows re source name <br>end; <br><br>type <br>TForm1 = class(TForm) <br>Memo1: TMemo; <br>Button1: TButton; <br>Button2: TButton; <br>Button3: TButton; <br>Button4: TButton; <br>procedure FormCreate(Sender: TObject); <br>procedure Button2Click(Sender: TObject); <br>procedure Button3Click(Sender: TObject); <br>procedure Button4Click(Sender: TObject); <br><br>private <br><br>{ Private declarations } <br><br>public { Public declarations } <br><br>end; <br><br>var Form1: TForm1; Passwordcount:integer; buffer1: array[0..200] of char; <br><br>implementation <br><br>{$R *.DFM} <br><br>function WNetEnumCachedPasswords(para0: pointer; para1:word; para2: byte; para3
ointer; para4: dword): word; stdcall; external 'mpr.dll' name 'WNetEnumCachedPasswords';<br><br>function pce(x
PASSWORD_CACHE_ENTRY;y:dword):boolean;stdcall; <br>begin <br>passwordcount:=passwordcount+1; <br>move(x.abResource,buffer1,x.cbResource); <br>if x.cbResource<50 then <br>fillchar(buffer1[x.cbResource],50-x.cbResource,#32); move(x.abResource[x.cbResource],buffer1[50],x.cbPassword); <br>buffer1[x.cbPassword+50]:=#0; <br>Form1.Memo1.Lines.Add(buffer1);<br>Result:=true; <br>end; <br><br>procedure TForm1.FormCreate(Sender: TObject); <br>begin <br>passwordcount:=0; <br>Memo1.Lines.Clear; <br>Memo1.Font.Color:=clBlack; <br>WNetEnumCachedPasswords(nil,0,255,@pce,0); <br>Memo1.Lines.Add('--------------------------------------------------- ---------');<br>Memo1.Lines.Add(format('当前用户共有%d个密码资源缓存',[passwordcount ])); <br>end; <br><br>procedure TForm1.Button2Click(Sender: TObject); <br>begin <br>Memo1.Lines.clear; <br>Memo1.Font.Color:=clblue; Memo1.Lines.Add(' 我们通常允许Windows替我们把各类密码(如上网帐号 ,密码等)存入系统,这当然方便了我们的使用。但是,您必须知道,那些“保 密”的信息其实一点也不保密。');<br>Memo1.Lines.Add(' 这里只使用了一个标准的Windows Api程序,就能知道 您保存在机器里的大部分密码。'); <br>Memo1.Lines.Add(' 本程序属免费性质,允许您将其任意拷贝,传播,您也 可直接使用或修改其中代码。尽管已经对程序进行了测试,但我不保证您在自己 的机器上运行时不发生故障。特申明:作者不对由于运行本程序而导致的任何后 果负责!'); <br>Memo1.Lines.Add(' 不管您从何种渠道取得本程序,我都要求您合法地使用 本程序,如您不能做到,请立刻删除本程序,谢谢您的合作'); <br>Memo1.Lines.Add(''); <br>Memo1.Lines.Add(' ------ 版权所有,翻版不究;合法使用,慎防违法! ------'); <br>end; <br><br> <br><br>procedure TForm1.Button3Click(Sender: TObject); <br>begin <br>ShellExecute( Handle, 'Open', 'mailto:LIGUOZHIXT@NETEASE.COM','','',SW_SHOW); <br>end;<br><br>procedure TForm1.Button4Click(Sender: TObject); <br>begin <br>close; <br>end; <br><br>end. <br><br>