views:

29

answers:

1

When launching my executable, Windows is prompting for elevation, when it shouldn't be.

How can i figure out why Windows is prompting me to elevate my executable on launch?

Notes:

  • there is no manifest resource (asking for asAdministrator, or otherwise)
  • there is no manifest file
  • the compatibilty tab (for all users and just me) has the "Run as administrator" not checked

How can i determine why my application is prompting for elevation?

+1  A: 

In the absence of a manifest, the usual reasons are name heuristics (eg your file is called setup.exe) and group policy (which you may have set accidentally after a "this program may not have run as expected" dialog.)

To prevent it, simply apply a manifest (embedded or external) with asInvoker. Then you will no longer care about these heuristic and you will not elevate.

I know I commented this above but I need to repeat it: What your code tries to do will NEVER cause elevation. NEVER. Stuff that won't work unless you're elevated fails when you're not elevated. It doesn't elevate you.

Kate Gregory
Damnest thing was that i created an external `MyApp.exe.manifest` file, declaring `asInvoker`, and it still prompts. Yet i rename the executable, and it no longer does. i'm still hoping to find a log somewhere of *why* Windows thinks the app needs elevation (manifested `requireAdministrator`, user compatibility request, all users compatibility request, setup heuristic detection, and "miscellaneous")
Ian Boyd
Probably compat request, associated with the name so that changing the name broke the request. I wouldn't be surprised if they outweighed manifests. You could play around with that a little to establish the "pecking order" - I haven't seen it written anywhere.
Kate Gregory

related questions