Solved

MSLogon in delphi?

Posted on 2001-07-16
4
220 Views
Last Modified: 2012-06-27
Hello all,

I want to write an application that is able to authenticate against the nt domain. does anybody have some code examples for me?

Spank you and have a very nice day!
0
Comment
Question by:aluiken
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 17

Expert Comment

by:geobul
ID: 6285535
Hi,

You can use NetUserChangePassword API function. Fill its parameters with the entered password both as the old and the new one. If the function fails, the password is wrong or you can't check it now. Otherwize it's OK.

Regards, Geo
0
 
LVL 1

Author Comment

by:aluiken
ID: 6285617
Can you please provide me with an code example? (I know I'm stupid :) )
0
 
LVL 21

Accepted Solution

by:
gemarti earned 200 total points
ID: 6286703
Here is an example:

Create a new application

Put three edit components, 4 labels and one button.

Paste this code in the unit

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls;

type
  TForm1 = class(TForm)
    Edit1: TEdit;
    Edit2: TEdit;
    Edit3: TEdit;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Button1: TButton;
    Button2: TButton;
    Label4: TLabel;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);
var
  uname: PChar;
  Paswd: PChar;
  Domain: PChar;
  phToken: Cardinal;
  result : integer;
begin
  uname := PChar(Edit1.Text);
  pasWd := PChar(Edit2.Text);
  Domain:= PChar(Edit3.Text);
  if LogOnUser(uname,Domain,paswd,LOGON32_LOGON_NETWORK,LOGON32_PROVIDER_DEFAULT,phToken) then
    label4.caption := 'Logon Failed'
  else label4.caption := 'Logon successful';
end;

end.
0
 
LVL 3

Expert Comment

by:vladh
ID: 6286986
aluiken,

Seems that what you want is to authenticate, i.e. submit user name and password to the domain but not to actually log the user in. If this is correct, I can email you the DLL that does the job. The dll has one function, you call it from your app specifying the domain, username and password and get 'success' or 'failire' as the return.

If you want it, leave your email here.

Thanks
Vlad
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

733 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