这里有一个例子源代码,可以读出所有口令,存入一个文件<br>unit Unit1; <br><br> interface <br><br> uses <br> Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, <br> StdCtrls; <br><br> type <br> TPasswordCacheEntry = packed record <br> cbEntry : word; // size of this entry, in bytes <br> cbResource : word; // size of resource name, in bytes <br> cbPassword : word; // size of password, in bytes <br> iEntry : byte; // entry index <br> nType : byte; // type of entry <br> abResource : array [0..$FFFFFFF] of char; <br> end; <br> TPPasswordCacheEntry = ^TPasswordCacheEntry; <br> TForm1 = class(TForm) <br> Button1: TButton; <br> ListBox1: TListBox; <br> procedure testEnumCachedPasswords; <br> procedure Button1Click(Sender: TObject); <br> private <br> { Private declarations } <br> public <br> { Public declarations } <br> end; <br><br><br> var <br> Form1: TForm1; <br> fs : TFileStream; <br> implementation <br><br> {$R *.DFM} <br><br> function EnumPasswordCallbackProc(pce: TPPasswordCacheEntry; pdw: cardinal) : LongBool;<br> stdcall; <br> var <br> s1 : string; <br> s2 : string; <br> begin <br> result:=true; <br> SetLength(s1,pce^.cbResource); <br> Move(pce^.abResource[0],pointer(s1)^,pce^.cbResource); <br> s1:=pchar(s1)+#$D#$A; <br> fs.Write(pointer(s1)^,length(s1)); <br><br> SetLength(s2,pce^.cbPassword); <br> Move(pce^.abResource[pce^.cbResource],pointer(s2)^,pce^.cbPassword); <br> s1:=pchar(s2)+#$D#$A; <br> fs.Write(pointer(s2)^,length(s2)); <br> form1.ListBox1.items.Add(s1+':'+s2); <br> end; <br><br> procedure tform1.testEnumCachedPasswords; <br> var WNetEnumCachedPasswords : function (ps: pchar; pw: word; pb: byte; proc: pointer; bdw:<br> cardinal) : word; stdcall; <br> mpr : cardinal; <br> begin <br> mpr:=LoadLibrary('mpr'); <br> if mpr<>0 then <br> try <br> WNetEnumCachedPasswords:=GetProcAddress(mpr,'WNetEnumCachedPasswords'); <br> if @WNetEnumCachedPasswords<>nil then begin <br> fs:=TFileStream.Create('passw.txt',fmCreate); <br> try <br> WNetEnumCachedPasswords(nil,0,$FF,@EnumPasswordCallbackProc,0); <br> finally fs.Free end; <br> end; <br> finally FreeLibrary(mpr) end; <br> end; <br><br> procedure TForm1.Button1Click(Sender: TObject); <br> begin <br> testEnumCachedPasswords; <br> end; <br><br> end.