问题
I am using Windows 7 and Microsoft Visual Studio 2010.
I created simple project with one MessageBox()
call in WinMain()
. The name of the project is "update"
, so name of EXE file is update.exe
. I have turned off manifest generation in Linker settings. But when I try to start debugging in Visual Studio, it says that my application requires elevation.
I decided to start application by clicking on it in Windows Explorer, but it still requires administrator privileges. I renamed it to update12345.exe
and to 12345update12345.exe
, but it still requires elevation.
But when I renamed it to 12345.exe
, it worked perfectly without requesting administrator privileges! I thought that Windows requires elevation for all files which name contains "update"
substring. So, I took another file (debugview.exe
from the SysInternals DebugView) and renamed it to update.exe
- but it works without elevation.
What can be the reason for this strange behaviour?
回答1:
If your app not contains a requestedExecutionLevel into its manifest, Installer Detection Technology, checks if its name includes "update", "install", etc, to detect if is an installer app. This explains because your app requires UAC when is renamed to "update", and other app than has a manifest not.
来源:https://stackoverflow.com/questions/31140051/windows-force-uac-elevation-for-files-if-their-names-contain-update