Does anyone have any clue how to validate the username and password against the network?? I am using windows 2000 prof, and for some reason api userlogonA wont work. Please does anyone have any idea how i would be able to do this? thank you for your time
Declare Function LogonUser _
Lib "advapi32" _
Alias "LogonUserA" ( _
ByVal lpszUser As String, _
ByVal lpszDomain As String, _
ByVal lpszPass As String, _
ByVal dwLogonType As Long, _
ByVal dwLogonProvider As Long, _
Handle As Long) As Long
Declare Function CloseHandle _
Lib "kernel32" (Handle As Long) As Long
Global Const LOGON32_LOGON_INTERACTIVE = 2
Global Const LOGON32_LOGON_NETWORK = 3
Global Const LOGON32_LOGON_BATCH = 4
Global Const LOGON32_LOGON_SERVICE = 5
Const NERR_BASE = 2100
Const MAX_NERR = NERR_BASE + 899 ' This is the last error in
' NERR range.
Const LOAD_LIBRARY_AS_DATAFILE = &H2
Declare Function LoadLibraryEx _
Lib "kernel32" _
Alias "LoadLibraryExA" ( _
ByVal lpLibFileName As String, _
ByVal hFile As Long, _
ByVal dwFlags As Long) As Long
Declare Function FreeLibrary Lib "kernel32" _
(ByVal hLibModule As Long) As Long
Declare Function FormatMessage _
Lib "Kernel32.dll" _
Alias "FormatMessageA" ( _
ByVal Flags As Long, _
ByVal Source As Long, _
ByVal MessageID As Long, _
ByVal LanguageID As Long, _
ByVal Buffer As String, _
ByVal Size As Long, _
args As Any) As Long
Declare Function LocalFree _
Lib "Kernel32.dll" _
( _
ByVal Handle As Long) As Long
Public Function Logon(strUser As String, _
strDomain As String, _
strPass As String, _
strError As String) As Long
Dim lngError As Long
Dim ptrBuffer As Long
Dim strMessage As String
Dim hModule As Long
Dim lngFlags As Long
Dim str As String
lngFlags = FORMAT_MESSAGE_FROM_SYSTEM
If (lCode >= NERR_BASE And lCode <= MAX_NERR) Then
hModule = LoadLibraryEx("netmsg.dll", 0&, _
LOAD_LIBRARY_AS_DATAFILE)
If (hModule <> 0) Then
lngFlags = lngFlags Or FORMAT_MESSAGE_FROM_HMODULE
End If
End If
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.