gpt4 book ai didi

c# - 查明应用程序是否需要管理员权限

转载 作者:太空狗 更新时间:2023-10-29 20:28:42 28 4
gpt4 key购买 nike

Windows 7 使用自动机制来检测应用程序是否需要提升的管理员权限。或者应用程序本身有一个 list 。

有没有办法以编程方式查明指定的应用程序是否需要提升管理员权限?我不想启动它来找出它。

谢谢 ;).

最佳答案

实际上只有一种方法可以告诉 Windows 某个程序需要升级,那就是通过 list 文件。 list 文件可以嵌入程序集 (exe/dll) 中,也可以存在于名为 <YOUR_APP>.exe.manifest 的单独文件中。 .这确实是您可以安全检查的唯一方法,也可能是唯一的方法。正式。

Windows 还包含一个用于应用程序兼容性的巨型数据库。如果 Microsoft 测试了某个应用程序并发现它在操作系统升级时崩溃,他们有时会在数据库中创建一个条目以从根本上破解该应用程序。有时他们对当前操作系统版本撒谎,有时他们自动以管理员身份运行,有时他们做一些其他事情。您可以使用 Application Compatibility Toolkit 查看数据库.不知道官方有没有代码查询数据库的方法。 This blog post谈论博主制作但显然从未发布的工具。

最后一个自动提升机制是尝试确定该应用程序是否为安装程序的算法。 According to MSDN检查这些属性:

  • Filename includes keywords like "install," "setup," "update," etc.
  • 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 manifest embedded in the executable.
  • Keywords in specific StringTable entries linked in the executable.
  • Key attributes in the RC data linked in the executable.
  • Targeted sequences of bytes within the executable.

The keywords and sequences of bytes were derived from common characteristics observed from various installer technologies.

最后,应用程序可以作为普通用户运行,但 spawn a child process that requires elevated privileges .我不知道是否真的有任何方法可以实际检测到反编译应用程序本身的不足。

关于c# - 查明应用程序是否需要管理员权限,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7696845/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com