开发者

In Windows 7, "Run as Administrator" does not run as Administrator when UAC is turned off

When I run my c# Windows Forms Application on Windows 7 with:

  • A user in the "Users" group that is not in the Administrators group
  • On a machine where User Account Control is turned off
  • By right-clicking the EXE and selecting "Run as Administrator"

This code:

WindowsPrincipal pricipal = new WindowsPrincipal(WindowsIdentity.GetCu开发者_开发技巧rrent()); bool hasAdministrativeRight = pricipal.IsInRole(WindowsBuiltInRole.Administrator);

still returns false. Is this expected behaviour?


I am pretty sure if the user is not an Administrator, Run As Administrator is not going to elevate that user's context for that application to that of Administrator. That would be a terrible security hole and end-run around enforced security of keeping users as normal users.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜