Hi Dominick,
I've found multiple posts on google from you, that state that we should
use
NEW_CREDENTIAL in order to log on cross domain... I tried it, and
LogonUser does not fail... that is true, but when I do
ImpersonateLoggedOnUser it doesn't seem to impersonate at all.
Can you tell us what the next step should be?
I am trying to impersonate a user from another domain, that is a domain
my computer is not a part of. All the credentials are ok. that is not a
problem. It just doesn't accept them. (error 1326)
Please advise,
Melle
Dominick wrote:
> try to use the NEW_CREDENTIAL logon type.
>
> ---------------------------------------
> Dominick Baier - DevelopMentor
> http://www.leastprivilege.com
>
> > i am trying to impersanate a remote user on a workgroup(NOT Domain)
> > account. This does not seem to work. Only works for domain or local
> > user. Anyone have any ideas.
> >
> > Thanks
> >
> > Dim tempWindowsIdentity As WindowsIdentity
> > Dim token As IntPtr = IntPtr.Zero
> > Dim tokenDuplicate As IntPtr = IntPtr.Zero
> > impersonateValidUser = False
> > If RevertToSelf() Then
> > If LogonUserA(userName, domain, password,
> > LOGON32_LOGON_INTERACTIVE, LOGON32_PROVIDER_DEFAULT, token) <> 0 Then
> > If DuplicateToken(token, 2, tokenDuplicate) <> 0 Then
> > tempWindowsIdentity = New
> > WindowsIdentity(tokenDuplicate)
> > impersonationContext =
> > tempWindowsIdentity.Impersonate()
> > If Not impersonationContext Is Nothing Then
> > impersonateValidUser = True
> > End If
> > End If
> > End If
> > End If
> > If Not tokenDuplicate.Equals(IntPtr.Zero) Then
> > CloseHandle(tokenDuplicate)
> > End If
> > If Not token.Equals(IntPtr.Zero) Then
> > CloseHandle(token)
> > End If