Home All Groups Group Topic Archive Search About

Imperonate Ignored?

Author
9 Jul 2009 10:02 PM
daja
I have an app that is impersonating an admin user to register COM dlls.

ALl the code is correct by all examples I have seen.

The LogonUser function returns trye and a check to the CurrentUser proves
that the user is being impersonated.

However, I get all bad exit codes from the Processes running the regsvr32
and regasm.

Has anyone else seen this?

If I log intot he computer as an admin account the code works fine.

Thanks
//daja

Author
10 Jul 2009 2:19 AM
Joe Kaplan
Did you use Process.Start when you were impersonating the admin user?  If
so, it is worth knowing that it doesn't use the impersonated token to start
the process but instead uses the process identity.

If you want to start a process as a different user, you need to call
CreateProcessAsUser or CreateProcessWithTokenW.

--
Joe Kaplan-MS MVP Directory Services Programming
Co-author of "The .NET Developer's Guide to Directory Services Programming"
http://www.directoryprogramming.net
Show quoteHide quote
"daja" <jautov***@cwsl.edu> wrote in message
news:uQmyqDOAKHA.3708@TK2MSFTNGP02.phx.gbl...
>I have an app that is impersonating an admin user to register COM dlls.
>
> ALl the code is correct by all examples I have seen.
>
> The LogonUser function returns trye and a check to the CurrentUser proves
> that the user is being impersonated.
>
> However, I get all bad exit codes from the Processes running the regsvr32
> and regasm.
>
> Has anyone else seen this?
>
> If I log intot he computer as an admin account the code works fine.
>
> Thanks
> //daja
>