Search
Module:
Directory

   Desktop Functions:

   Smart Device Functions:


Show Recent Changes
Subscribe (RSS)
Misc. Pages
Comments
FAQ
Helpful Tools
Playground
Suggested Reading
Website TODO List
Support Forum
Download Visual Studio Add-In

Terms of Use
Privacy Policy

Search Results for "LogonUser" in [All]

userenv

.

in Token for the user, which is returned by the LogonUser, CreateRestrictedToken, DuplicateToken, OpenProcessToken, or OpenThreadToken function. The token must have TOKEN_QUERY and TOKEN_IMPERSONATE and TOKEN_DUPLICATE access. For more information, see Access Rights for Access-Token Objects.

secur32

.

See LsaLogonUser

.

See LsaLogonUser

.

See LsaLogonUser

.
Summary
The LsaLogonUser function authenticates a security principal's logon data using stored credentials information.
.

public static extern WinStatusCodes LsaLogonUser(

.

Declare Function LsaLogonUser Lib "secur32.dll" (TODO) As TODO

.

                public static extern WinStatusCodes LsaLogonUser(

.

                                status = OSCalls.LsaLogonUser(

.
Documentation
[LsaLogonUser] on MSDN
.

See LsaLogonUser

advapi32

.

    If Not LogonUser(strUser, strDomain, strPassword, LogonType, LogonProvider, Token) Then

.
Summary
.

if (LogonUser(userPart, domainPart, password, LOGON_TYPE.LOGON32_LOGON_BATCH, LOGON_PROVIDER.LOGON32_PROVIDER_DEFAULT, hToken))

.

If LogonUser(userPart, domainPart, password, LOGON_TYPE.LOGON32_LOGON_BATCH, _

.
Summary
I've used this function to pass a certificate I've read from a smart card as an argument to LogonUser. That function cannot take a certificate so one has to pass the certificate's marshaled SHA-1 hash code in the lpszUsername parameter.
.

The last param in LogonUser (phToken) can be declared as Integer to work with the following VB.Net sample. The key is making sure it is ByRef vs ByVal.

.

    blnResult = LogonUser(strUser, strDomain, strPassword, _

.
Summary
The LogonUser function attempts to log a user on to the local computer. The local computer is the computer from which LogonUser was called. You cannot use LogonUser to log on to a remote computer.
.

internal static extern bool LogonUser(

.

Declare Auto Function LogonUser Lib "advapi32.dll" (ByVal lpszUsername As String, _

.

   Public Function LogonUser( ByVal lpszUsername as String, _

.

    'The LogonUser function does not cache credentials for this logon type.

.

    'The LogonUser function does not cache credentials for this logon type.

.

    'from a client, call LogonUser, verify that the user can access the system across the network, and still

.

        /// The LogonUser function does not cache credentials for this logon type.

.

        /// The LogonUser function does not cache credentials for this logon type.

.

        /// from a client, call LogonUser, verify that the user can access the system across the network, and still

.

if (LogonUser(username, domain, password,

.

    private static WindowsIdentity LogonUserTCPListen(string userName, string domain, string password)

.

    Private Function LogonUserTCPListen(ByVal userName As String, ByVal domain As String, ByVal password As String) As WindowsIdentity

.
Documentation
.
Summary
.

public static extern int LogonUserA(

.

Declare Function LogonUserA Lib "advapi32.dll" (ByVal lpszUsername As String, ByVal lpszDomain As String, ByVal lpszPassword As String, ByVal dwLogonType As Integer, ByVal dwLogonProvider As Integer, ByRef phToken As IntPtr) As Integer

.
Documentation
[LogonUserA] on MSDN
.
Summary
The LogonUserEx function attempts to log a user on to the local computer. The local computer is the computer from which LogonUserEx was called. You cannot use LogonUserEx to log on to a remote computer. You specify the user with a user name and domain, and authenticate the user with a plaintext password. If the function succeeds, you receive a handle to a token that represents the logged-on user. You can then use this token handle to impersonate the specified user or, in most cases, to create a process that runs in the context of the specified user.
.

public static extern bool LogonUserEx(

.

Private Shared Function LogonUserEx( _

.

Public Shared Function LogonUser(ByVal userName As String, ByVal domain As String, ByVal password As String) As IntPtr

.

  If LogonUserEx(userName, domain, password, Logon32Type.Batch, Logon32Provider.Default, token, Nothing, Nothing, Nothing, Nothing) = 0 Then

.
Documentation
[LogonUserEx] on MSDN
.

Once your call to LogonUser has gotten you a user token for the user you'd like to impersonate, you can then call WindowsIdentity.Impersonate() and have your thread take over the identity of the Windows user you just logged on.

.

    // Call LogonUser to get a token for the user

.

    bool loggedOn = LogonUser(


 
Access PInvoke.net directly from VS: