Solved

NT Security

Posted on 2000-04-08
4
182 Views
Last Modified: 2010-05-02
Does anyone know the API to check NT Security.
I want as input:
- UserID
- Password
- Domain

I want as return:
- True (if user has access)
- False (if user isn't allowed)
0
Comment
Question by:ndb
  • 2
4 Comments
 
LVL 28

Expert Comment

by:AzraSound
Comment Utility
http://support.microsoft.com/support/kb/articles/q151/7/74.asp?FR=0

The USER_INFO_3 structure that the above link references holds most of that info youre looking for.  Heres more about the structure itself:


http://msdn.microsoft.com/library/psdk/network/ntlmapi3_0a5u.htm

0
 
LVL 1

Author Comment

by:ndb
Comment Utility
An example would b nice ;0)
0
 

Accepted Solution

by:
bhuitema earned 50 total points
Comment Utility
Try this:

Private Declare Function LogonUser Lib "advapi32" Alias "LogonUserA" (ByVal lpszUsername As String, ByVal lpszDomain As String, ByVal lpszPassword As String, ByVal dwLogonType As Long, ByVal dwLogonProvider As Long, phToken As Long) As Long
Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Private Declare Function GetLastError Lib "kernel32" () As Long
Private Const LOGON32_PROVIDER_DEFAULT = 0
Private Const LOGON32_LOGON_BATCH = 4
Private Const LOGON32_LOGON_INTERACTIVE = 2
Private Const LOGON32_LOGON_SERVICE = 5

Function CheckPwd(FUserName As String, FPassword As String, _
                     FDomain As String) As Boolean

Dim token As Long, status As Long
token = 0
status = LogonUser(FUserName, FDomain, FPassword, _
         LOGON32_LOGON_INTERACTIVE, _
         LOGON32_PROVIDER_DEFAULT, token)
   
If status = 0 Then
 CheckPwd = False
Else
 CheckPwd = True
 CloseHandle token
End If

End Function

Note that the account running this program needs to have the "Act as part of the operating system" policy set for it.
0
 
LVL 1

Author Comment

by:ndb
Comment Utility
It seems that "Act as part of the operating system" is very important.
I had to relogon to get it working.
Thanx
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

728 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

11 Experts available now in Live!

Get 1:1 Help Now