ImpersonateLoggedOnUser and starting a new process that uses ocx fails.

Posted by markus on Stack Overflow See other posts from Stack Overflow or by markus
Published on 2009-09-01T07:11:09Z Indexed on 2010/03/20 20:21 UTC
Read the original article Hit count: 340

Filed under:
|
|
|

I write a c++ windows application (A), that uses LogonUser, LoadUserProfile and ImpersonateLoggedOnUser to gain the rights of another user (Y). Meaning the A starts using the user that is logged on on the workstation (X). If the user wants to elevate his rights he can just press a button and logon as another user without having to log himself out of windows and back in.

The situation now is (according to the return values of the functions): LogonUser works, LoadUserProfile works and ImpersonateLoggedOnUser works as well.

After the impersonation I start another process. This process is an application (B) that needs an OCX control. This fails and the application tells me that the .oxc file is not properly installed.

The thing is, if I start B directly as the user that is logged on to the machine (X), it works. If I start B directly as the user (Y) to which I want to elevate my rights using A, it works.

If I am logged in as (X) and choose "run as" (Y) in the explorer, it works!

Do you know which steps I need to do to do the same as the "run as" dialog from windows?

© Stack Overflow or respective owner

Related posts about com

Related posts about ocx