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
Download Visual Studio Add-In

Search Results for "LogonUser" in [All]

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

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.

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 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
.
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

 
Access PInvoke.net directly from VS: