What do I need to do to make sure my app launches as Admin?

Posted by John Gietzen on Stack Overflow See other posts from Stack Overflow or by John Gietzen
Published on 2010-02-22T17:13:32Z Indexed on 2010/03/25 17:23 UTC
Read the original article Hit count: 342

Filed under:
|

I'm writing an app that allows you to script the buttons from a wiimote into actions on your PC. It currently supports all of the features of the main remote control, except for the speaker.

Now, I'm running in to trouble when I run it on Vista with UAC turned on.

Any time a UAC'd window has focus, my app fails to move the mouse successfully. For instance, when an installer is run, I have to navigate it with the keyboard.

  1. Will running the app as administrator solve my problem? (At one point in time, I was able to successfully move the mouse over a UAC-password-entry box)

  2. How do I build a manifest that will tell windows to "run as administrator"?

  3. How do I embed this manifest into my app, if I'm strongly naming my assembly?

  4. How do I sign my application with an Authenticode cert?

EDIT:

Ok, so after some more extensive research, I have found:

http://msdn.microsoft.com/en-us/library/bb756929.aspx

<requestedExecutionLevel
    level="asInvoker|highestAvailable|requireAdministrator"
    uiAccess="true|false"/>

However, the article says:

Applications with the uiAccess flag set to true must be Authenticode signed to start properly. In addition, the application must reside in a protected location in the file system. \Program Files\ and \windows\system32\ are currently the two allowable protected locations.

I have edited the question to reflect the new developments.

© Stack Overflow or respective owner

Related posts about manifest

Related posts about uac