Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

NT Security

Posted on 2000-04-08
4
Medium Priority
?
208 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
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 200 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

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
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.
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…
Suggested Courses

886 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