I think the only way CoCreateInstanceAsAdmin works is that you have registered the COM component in advance. This can be a problem if you plan to use the application in your XCopy setup.
For my own purposes in Gallio, I decided to create a small hosting process on the side with a manifest requiring administrator privileges. Then, when I need to perform an enhanced action, I deploy an instance of the hosting process and instruct it through .Net to execute a specific command registered in the Gallio Inversion of Control container.
This is fair work, but Gallio already had a way out of the hosting process, so adding height to the mix was not too difficult. Moreover, this mechanism ensures that Gallio can perform privilege escalation without having to install any other COM components in the registry first.
Jeff Brown May 26 '09 at 21:00 2009-05-26 21:00
source share