How to use LogonUser API Call? 
Author Message
 How to use LogonUser API Call?

How to use LogonUser API Call?

I'm using the fragment of code that follow to logon on NT Server from a Windows95 OS
but Nothing happens excepet the return of 0 from function! What's wrong?

And I have another question: Can I logon into a Win95 machinge in a peer-to-peer environment
 using LogonUser API Function? Case not. There's another API Call to acomplish this task?

Thanks for the help!
Reginaldo Csar Trindade
Babuch Corp.

Private Declare Function LogonUserA Lib "advapi32.dll" _
    (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

'Logon type
Const LOGON32_LOGON_INTERACTIVE = 2
Const LOGON32_NETWORK = 3
Const LOGON32_LOGON_BATCH = 4
Const LOGON32_LOGON_SERVICE = 5

'Provider
Const LOGON32_PROVIDER_WINNT35 = 1
Const LOGON32_PROVIDER_DEFAULT = 0

Function ValidateLogon(UserID As String, _
Pass As String, sDomainName As String) As Boolean

    Dim sUserID As String
    Dim sPass   As String
    Dim sDName  As String
    Dim hToken  As Long
    Dim lReturn As Long

    sUserID = Trim(UserID) & vbNullChar
    sPass = Trim(Pass) & vbNullChar
    sDomainName = Trim(sDomainName) & vbNullChar

    ValidateLogon = False

    lReturn = LogonUserA(sUserID, sDomainName, sPass, LOGON32_NETWORK, _
    LOGON32_PROVIDER_DEFAULT, hToken)

    If lReturn = 1 Then
        ValidateLogon = True
        Exit Function
    End If
End Function



Wed, 29 Nov 2000 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Repost: Help with LogonUser API call needed

2. LogonUser API call help needed

3. LogonUser API call help.

4. LogonUser API call in Windows 95/98 / How do you use Secur32.dll/Security.dll

5. NT LogonUser API call for Win95

6. How to use LogonUser API Call?

7. How to use LogonUser API Call?

8. LogonUser API call in Windows 95/98 / How do you use Secur32.dll/Security.dll

9. NT LogonUser API call for Win95

10. How to use LogonUser API Call?

11. NT User Name / Password (LogonUser API Call)

12. Using LogonUSer API fails

 

 
Powered by phpBB® Forum Software