This code demostrates how to validate a user in a VB application against the NT domain. The purpose of this application is to allow an
API Declarations
'To set this privilege:
'Load User Manager
'Choose "User Rights" from the "Policies" menu.
'Click "Show Advanced User Rights".
'Choose "Act as part of the operating system" from the "Right" combo box
'Grant this privilege to the user or group that will be used to run the application. (i.e. on my workstation, I gave my user Id this Right)
'Logoff and back into NT to obtain the new NT security token.
Option Explicit
Public Const LOGON32_LOGON_INTERACTIVE = 2
Public Const LOGON32_LOGON_BATCH = 4
Public Const LOGON32_LOGON_SERVICE = 5
Public Const LOGON32_PROVIDER_DEFAULT = 0
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
Declare Function CloseHandle Lib "kernel32" _
(ByVal hObject As Long) As Long