Windows的EXE文件,何时自动添加盾牌(UAC)小图标

开启了UAC后,很多exe程序就给自动标识了UAC小盾牌图标。

到底Windows系统是如何判定呢?

参见:Windows Vista Application Development Requirements for User Account Control (UAC)

老应用程序,大致这么判断:

  • Filename includes keywords such as “install,” “setup,” and “update.”
  • Keywords in the following Versioning Resource fields: Vendor, Company Name, Product Name, File Description, Original Filename, Internal Name, and Export Name.
  • Keywords in the side-by-side application manifest embedded in the executable.
  • Keywords in specific **StringTable** entries linked in the executable.
  • Key attributes in the resource file data linked in the executable.
  • Targeted sequences of bytes within the executable.

说白了就是,对老程序,Windows既没有“沙盒”运行来判定程序所需权限,也不会静态反汇编分析程序权限,只是根据一些特征字判断……

新程序,大概需要:

When developing new installation programs, much like developing programs for Windows Vista, be sure to embed an application manifest with an appropriate requestedExecutionLevel element (see Step 6: Create and Embed an Application Manifest in downloadable Help file). When the requestedExecutionLevel is present in the embedded application manifest, it overrides Installer Detection.