Solved

Stored Passwords

Posted on 2000-04-03
11
171 Views
Last Modified: 2010-05-18
Does any one know howto retrive stored passwords on my system useing delphi..I dont care what kinda passwords they are...Dial Up networking to Aol Instant messanger!..Thanks
0
Comment
Question by:nafa2221
11 Comments
 
LVL 17

Expert Comment

by:inthe
ID: 2681927
hello again ;-)

unit Unit1;

interface

uses
  Windows, SysUtils, Classes, Forms, ShellAPI, Controls, StdCtrls;

type
  TForm1 = class(TForm)
    ListBox: TListBox;
    procedure FormShow(Sender: TObject);
  private
    { Private declarations }
  public
    hMPR: 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 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.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(' ..Error.. ');
end;

end.



Regards Barry
0
 

Author Comment

by:nafa2221
ID: 2681930
inthe:

Hello again :-)...doesnt that only work under win98/95? Because I need it to work under Win95/98/2000/NT4 etc...Thanks
0
 
LVL 17

Expert Comment

by:inthe
ID: 2681968
winnt is more secure .
i dont believe you will get code for nt.
0
 

Author Comment

by:nafa2221
ID: 2681971
okay, well I am gonna reinstall win98 and I will try it out after I do that...I should accept your anwser within a few hours ;] Thanx
0
 
LVL 17

Expert Comment

by:inthe
ID: 2681983
reinstall huh- that always a pain

the code works fine on win9* pcs (it did work on earlier versions of nt depended what version of mpr.dll is install ,but most ms products overwrite mpr.dll with new versions so most likely wont work nowadays on any winnt type pcs and certainly not on win2k.

but that is the point in using winnt for networking etc type apps as its has good security ..


0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 17

Expert Comment

by:inthe
ID: 2682690
well i re-answer becuase i know you wont find any other code for delphi..
0
 

Expert Comment

by:HamidHossain
ID: 2683135
Listening...
0
 
LVL 3

Expert Comment

by:bryan7
ID: 2683755
listenning
0
 

Author Comment

by:nafa2221
ID: 2688352
Alright I tried it and I always get the error "User not logged in" or whatever it is...why is it doing this??? Helo!
0
 
LVL 17

Expert Comment

by:inthe
ID: 2691168
the only way to get  a password with delphi s if a user has loged in .
on most pcs you enter a password to login ytou your pc so you have a username etc ..
if you have no username (or not logged in)you will get that result,it is not an error it just has no cached passwords to read.

rejecting my answer is a bit pitiful as like i already said you wont find any other code for delphi .
you were lucky to get WNetEnumCachedPasswords function as it is certainly not documented anywhere.
other passwords are stored in the *.pwl files which are encrypted.


0
 
LVL 17

Accepted Solution

by:
inthe earned 200 total points
ID: 2736370



0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Activex loadlibrary and show parented form issue 6 286
Making delphi communicate with a c# service 16 89
Magic Software info 18 125
Find and Replace Stream with 0s 8 56
A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now