Solved

NT Security

Posted on 2000-04-08
4
195 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

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
to transfer string from C lanaguage to VBA 4 85
VBA Shell can't Find Word document 11 155
fso.FolderExists("\\server\HiddenFolder$") 4 98
Macro problems with Excel file 6 52
Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
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…
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…

751 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