What do I need to do to make sure my app launches as Admin?
- by John Gietzen
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.
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)
How do I build a manifest that will tell windows to "run as administrator"?
How do I embed this manifest into my app, if I'm strongly naming my assembly?
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.