UAC 风格的提升提示

发布于 2024-12-10 07:17:28 字数 236 浏览 0 评论 0原文

我有兴趣在临时会话中启动一个窗口,就像 UAC 提示的显示方式一样。有些人对这个概念感兴趣,所以我想我应该在这里问。本质上,我们想要的是像 UAC 一样的高架窗口“您确定要<...>”提示,但带有任意窗口。最终目标是防止窗口事件挂钩以及密码输入期间可能发生的各种其他问题。

我快速浏览了 UAC API 和其他一些地方,但没有什么特别有用的。显然,UAC 提示不知何故被提升到自己的桌面会话,因此必须有一种方法以这种方式创建窗口。

I'm interested in launching a window in a temporary session, like how UAC prompts appear. There's been some interest in this concept from a few people, so I figured I'd ask here. Essentially what we're going for is an elevated window like the UAC "are you sure you want to <...>" prompts, but with an arbitrary window. The end goal is to prevent window event hooks and all sorts of other issues that might occur during password entry.

I've had a quick look at the UAC APIs and a few other places, but there's nothing particularly useful out there. Obviously the UAC prompts get elevated to their own desktop session somehow, so there must be a way to create windows in such a way.

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

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

发布评论

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

评论(1

时光倒影 2024-12-17 07:17:28

您可以使用 创建桌面创建桌面。您可以使用 SwitchDesktop 切换到新桌面。然后您可以调用 SetThreadDesktop< /a> 在你的主线程上并绘制你的窗口。要返回,请通过调用 OpenDesktop,“默认”为 lpszDesktop 并使用 SwitchDesktop 与此句柄。您还可以在特定桌面上运行进程。为此,您必须设置 STARTUPINFO 结构到应运行进程的桌面的名称。使用后关闭桌面的句柄 (关闭桌面)。

您可以通过这种方式在自己的桌面上显示自己的窗口。

UAC 和登录 UI 使用的安全桌面称为“Winlogon”。为了访问它,您需要系统权限。卢克在 他的答案之一

Brian R. Bondy 写了一篇

You can create a desktop using CreateDesktop. You can use SwitchDesktop to switch to the new desktop. Then you can call SetThreadDesktop on your main thread and draw your window. To get back get the handle of the default desktop by calling OpenDesktop with "Default" as lpszDesktop and use SwitchDesktop with this handle. You can also run Processes on a certain desktop. In order to do this you have to set lpDesktop member of the STARTUPINFO structure to the name of the desktop the process should be run on. Close the handles to the desktops after using them (CloseDesktop).

You can show your own window on an own desktop in this way.

The secure desktop used by UAC and by the Logon UI is called "Winlogon". In order to access it you need system rights. Luke provided an example in one of his answers.

Brian R. Bondy wrote a blog entry on desktops and window stations which is worth reading.

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