?
Solved

MSLogon in delphi?

Posted on 2001-07-16
4
Medium Priority
?
229 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 800 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
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…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses

840 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