I want to launch an application with admin rights. If it runs with limited user, a popup will appear (same as “Run as” context menu) so that user will input an Administrator account (user & pass), & switch my application rights to this user. Because my application will need permissions to operate.
I want to implement this feature in XP, & Vista.
Thanks.
this can be solved with the Impersonator class:
http://www.codeproject.com/KB/cs/zetaimpersonator.aspx
or this ImpersonateUser function:
http://www.codeproject.com/KB/cs/cpimpersonation1.aspx
some other options are to execute
RunAs /user:administrator "program"or add this to your original app’s .manifest file (so privs are requested once at the start)