即使在 C# 中的登录屏幕期间也能运行的 gui/程序 [英] a gui/program that runs even during the login screen in C#

查看:30
本文介绍了即使在 C# 中的登录屏幕期间也能运行的 gui/程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想制作一个在用户登录之前运行的程序,并且 gui 显示在登录屏幕中,如下所示:

I want to make a program that runs before the user even logs on and the gui is shown in the login screen like this:

推荐答案

登录屏幕实际上就是所谓的安全桌面".这意味着它运行在不与普通用户桌面(运行 GUI 应用程序的地方)交互的不同桌面上.

The logon screen is infact a so called "Secure Desktop". This means that it runs in a different desktop which does not interact with the normal user desktop (where GUI applications are run).

在另一个桌面上启动进程的唯一方法是 P/Invoke CreateProcess() WinAPI函数,在STARTUPINFO 结构的 lpDesktop 字段.

The only way to start a process in another desktop is to P/Invoke the CreateProcess() WinAPI function, specifying the window station and desktop in the STARTUPINFO structure's lpDesktop field.

但是根据 有关桌面的 MSDN 文章 Winlogon 桌面的安全描述符允许访问一组非常限制的帐户,包括 LocalSystem 帐户.应用程序一般不要在其令牌中携带任何这些帐户的 SID,因此因此,当 Winlogon 桌面处于活动状态时,无法访问 Winlogon 桌面或切换到其他桌面.".这意味着您很可能无法在 Winlogon 桌面上运行 GUI 应用程序.

However according to the MSDN article about Desktops "The Winlogon desktop's security descriptor allows access to a very restricted set of accounts, including the LocalSystem account. Applications generally do not carry any of these accounts' SIDs in their tokens and therefore cannot access the Winlogon desktop or switch to a different desktop while the Winlogon desktop is active.". This meaning you will most likely not be able to run a GUI application on the Winlogon desktop.

虽然我建议你阅读一些关于 Window Stations 和桌面 以更好地了解其工作原理.

Though I suggest you read some about Window Stations and Desktops to get a better understanding of how it works.

这篇关于即使在 C# 中的登录屏幕期间也能运行的 gui/程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆