Solved

NT Security

Posted on 2000-04-08
4
197 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
[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
  • 2
4 Comments
 
LVL 28

Expert Comment

by:AzraSound
ID: 2696515
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
ID: 2696658
An example would b nice ;0)
0
 

Accepted Solution

by:
bhuitema earned 50 total points
ID: 2697426
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
ID: 2697654
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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month6 days, 11 hours left to enroll

636 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