ImpersonateLoggedOnUser takes both primary tokens and impersonation
tokens, SetThreadToken wants impersonation tokens only. Note that
LogonUser usually returns a primary token which cannot be used with
SetThreadToken
--
With best wishes,
Igor Tandetnik
"For every complex problem, there is a solution that is simple, neat,
and wrong." H.L. Mencken
Thanks for the feedback. I'm really looking for the "standard" (i.e., most
appropriate) way to impersonate a user. If I pass LOGON32_LOGON_NETWORK to
"LogonUser()" it returns an impersonation token. From this point there seems
to be little difference between passing that to either "SetThreadToken()" or
"ImpersonateLoggedOnUser()". That is, the docs don't mention whether
"SetThreadToken()" requires any special privileges and
"ImpersonateLoggedOnUser()" certainly doesn't need any (so say the docs).
Thus, I can't see any difference between them as far as impersonation is
concerned other than the fact that "SetThreadToken()" allows you to target a
specific thread. If targetting the current thread however then they appear
to be identical. Can you confirm this? Thanks.
Jeff
"John Smith" <_nospam@_nospam.com> wrote in message
news:eeSeJoWp...@TK2MSFTNGP09.phx.gbl...
Thanks very much!