ImpersonateLoggedOnUser (advapi32)
Last changed: -37.160.138.42

.
Summary
TODO - a short description

C# Signature:

[DllImport("advapi32.dll", SetLastError=true)]
static extern TODO ImpersonateLoggedOnUser(TODO);

VB Signature:

Declare Function ImpersonateLoggedOnUser Lib "advapi32.dll" (ByVal hToken As Integer) As Integer

None.

Notes:

None.

Tips & Tricks:

Please add some!

Sample Code:

    Dim lngLogonType, lngLogonProvider, lngTokenHandle As Integer
    Dim blnResult As Boolean

    lngLogonType = LOGON32_LOGON_INTERACTIVE
    lngLogonProvider = LOGON32_PROVIDER_DEFAULT

    blnResult = RevertToSelf()

    blnResult = LogonUser(strUser, strDomain, strPassword, _
                         lngLogonType, lngLogonProvider, _
                         lngTokenHandle)
    If blnResult Then
        blnResult = ImpersonateLoggedOnUser(lngTokenHandle)
        CloseHandle(lngTokenHandle)
    Else
        MsgBox("Error logging on")
    End If

Alternative Managed API:

Do you know one? Please contribute it!

Documentation