2 Identical Programs; Only 1 asks for elevation
I am having an interesting problem when compiling my programs on win32 (mingw). I have 2 identical projects, both created in C::B. When compiling one, it runs just fine without requiring elevated permissions, but the other prompts the user with the "All开发者_开发问答ow program to make changes to computer etc.." dialog. I would like the app to not prompt the user, as it does not need elevated privs.
This is under Win7 x64.
Could this be a Code::Blocks issue, or a compiler issue?
Thanks!
It turns out Win7 marks files with "update" (not case sensitive) in the name as needing elevated permissions. So yea, worth knowing for future
As you have already discovered, Windows detects certain application names that it thinks are setup programs, and tries to helpfully pre-elevate them to ensure they succeed.
However, this behaviour is only enabled for executables that are missing UAC information in their Win32 manifest. So if you have a program with one of the impacted names, simply give it a manifest with the relevant UAC information, and you won't get the unwanted prompts.
e.g. Aaron's blog http://brethorsting.com/blog/2007/02/meet_uac_-_creating_a_uac_manifest/
Martyn
精彩评论