Unit unit1;
Interface
Uses
Windows, sysutils, classes, forms, shellapi, controls, stdctrls;
Type
Tform1 = Class (tform)
Groupbox1: tgroupbox;
ListBox: tlistbox;
Label1: tlabel;
Label2: tlabel;
Procedure label1click (Sender: tobject );
Procedure formshow (Sender: tobject );
Private
{Private Declarations}
Public
HMIP: thandle;
End;
VaR
Form1: tform1;
Const
Count: integer = 0;
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 MIP name 'wnetenumcachedpassword ';
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.label1click (Sender: tobject );
Begin
ShellExecute (getshorttopwindow, 'open', 'HTTP: // www.utilmind.com ', nil, nil, 0 );
End;
Procedure tform1.formshow (Sender: tobject );
Begin
If wnetenumcachedpasswords (nil, 0, $ ff, @ addpassword, 0) <> 0 then
Begin
Application. MessageBox ('can't load passwords: user is not logon. ', 'error', mb_ OK or mb_iconwarning );
Application. Terminate;
End
Else
If Count = 0 then
ListBox. Items. Add ('no passwords found ...');
End;
End.