Solved

MSLogon in delphi?

Posted on 2001-07-16
4
215 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
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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

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…
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…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

706 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

20 Experts available now in Live!

Get 1:1 Help Now