Delphi:在 Windows 7 中禁用 TaskManager

发布于 2024-09-02 16:54:54 字数 214 浏览 2 评论 0原文

我发现这段代码用于禁用Windows XP中的任务管理器。它可以工作 :)

但它也可以在 Windows 7 中工作吗?注册表路径是一样的,我已经检查过了。但也许有一些限制!?

提前致谢!

I found this code for disabling the task manager in Windows XP. It works :)

But does it work in Windows 7, too? The registry path is the same, I've checked this. But maybe there are some restrictions!?

Thanks in advance!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

栀子花开つ 2024-09-09 16:54:54

默认情况下,自 Windows 2000 起,以下键对标准用户具有“只读”访问权限(请参阅 这里)。

  • HKLM\Software\Policies
  • HKLM\Software\Microsoft\Windows\CurrentVersion\Policies
  • HKCU\Software\Policies
  • HKCU\Software\Microsoft\Windows\CurrentVersion\Policies

因此,您的应用程序需要具有管理权限才能写入这些项。

By default, the below keys have "readonly" access for standard users since Windows 2000 (See here).

  • HKLM\Software\Policies
  • HKLM\Software\Microsoft\Windows\CurrentVersion\Policies
  • HKCU\Software\Policies
  • HKCU\Software\Microsoft\Windows\CurrentVersion\Policies

So your application needs to have administrative privileges in order to write to these keys.

梦断已成空 2024-09-09 16:54:54

是的,它也适用于 Windows 7。我以提升的权限(Windows 7 Home Premium)运行该程序,之后任务管理器不再可用。

但是,作为旁注,我不得不说代码

case YesNo of
  False:
    begin
      WriteInteger('DisableTaskMgr',1) ;
    end;
  True:
    begin
      WriteInteger('DisableTaskMgr',0) ;
    end;
end;

相当糟糕。首先,根本不需要 beginend 部分,因为命令 WriteInteger... 是“一行代码” ”。其次,为什么不直接写而不是YesNo的值呢?

人们真的应该将代码写成这样,

WriteInteger('DisableTaskMgr', byte(not YesNo));

这不是更具可读性和简洁性吗?

Yes, it works in Windows 7 too. I ran the program with raised privileges (Windows 7 Home Premium), and after that the Task Manager is no longer available.

But, as a sidenote, I have to say that the code

case YesNo of
  False:
    begin
      WriteInteger('DisableTaskMgr',1) ;
    end;
  True:
    begin
      WriteInteger('DisableTaskMgr',0) ;
    end;
end;

is rather horrible. First of all, there is no need at all for the begin and end parts, because the commands WriteInteger... are "one-liners". Secondly, why not just write the value of not YesNo?

One really should write the code as

WriteInteger('DisableTaskMgr', byte(not YesNo));

Isn't that much more readable and brief?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文