Hi!!!
i have a user1 connect from WIN95 to WINNT and i have this code but always
return false, what is my error??
'Code in module
Declare Function LogonUser Lib "advapi32.dll" 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 ImpersonateLoggedOnUser Lib "advapi32.dll" (ByVal hToken
As Long) As Long
Declare Function RevertToSelf Lib "advapi32.dll" () As Long
Const LOGON32_LOGON_INTERACTIVE = 2
Const LOGON32_PROVIDER_DEFAULT = 0
Global blnResult As Boolean
Public Function Logon(ByVal strAdminUser As String, ByVal strAdminPassword
As String, ByVal strAdminDomain As String)
Dim lngTokenHandle, lngLogonType, lngLogonProvider As Long
lngLogonType = LOGON32_LOGON_INTERACTIVE
lngLogonProvider = LOGON32_PROVIDER_DEFAULT
blnResult = RevertToSelf()
blnResult = LogonUser(strAdminUser, strAdminDomain, strAdminPassword, _
lngLogonType, lngLogonProvider, _
lngTokenHandle)
blnResult = ImpersonateLoggedOnUser(lngTokenHandle)
Logon = blnResult
End Function
Public Sub Logoff()
blnResult = RevertToSelf()
End Sub