Win7的登录屏幕上运行应用程序 [英] Run application on Win7 logon screen

查看:265
本文介绍了Win7的登录屏幕上运行应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从一个服务运行Windows 7的登录屏幕上的应用程序。

I'd like to run an application on the logon screen of Windows 7 from a service.

我已经做长期研究就这个问题和已经尝试了不同的方式,但遗憾的是并没有完全成功为止。我设法运行的锁屏当前登录的用户应用程序 - 起初看着我,因为它是什么,我基本上是试图实现。然而,我才明白,有针对每个用户和一般的(独立用户)不同的登录屏幕。

I've been doing long researches on this and trying out different ways already, but unfortunately wasn't fully successful so far. I managed to run the application on the lock screen of a currently logged on user - which at first looked to me as it was what I basically tried to achieve. However, I then realized that there are different logon screens for every user and a general one (user independent).

我的猜测是,该用户的独立登录画面,在会话1,用户运行在会话0时(多账户可点击锁定屏幕上的切换用户,当启动或后直接,来了),而用户1运行2会话2,依此类推。现在的问题是,如果我运行会话0的应用程序(以winsta0 \\ Winlogon中),这是不可见的;在会话1运行工作正常,但没有太多帮助作为一个用户必须已经登录了点。

My guess is that this user independent logon screen (that comes up directly after booting when multiple accounts are available or when clicking "switch user" on the lock screen) runs in session 0, while user 1 runs in session 1, user 2 in session 2 and so on. The problem is that if I run an application in session 0 (with "winsta0\winlogon") it's not visible; running in session 1 works fine but doesn't help much as a user has to be already logged in for that.

因此​​,如何运行用户登录独立/欢迎屏幕上的应用程序?什么是正确的参数和功能这一目的?是否有人有对演示一个工作的例子吗? (Delphi是pferred $ P $,但实际上任何其他语言,会做的!)

So how to run an application on the user independent logon/welcome screen? What are the correct parameters and functions for this purpose? Does anybody have a working example for demonstration? (Delphi is preferred but actually any other language will do as well!)

推荐答案

支持的唯一方式做,这是实现一个凭据提供程序,按照RRUZ的评论。

The only supported way to do this is to implement a credential provider, as per RRUZ's comment.

如果你不介意打破规则,运行在本地系统中的服务应该能够在您选择的会话启动子。使用 OpenProcessToken 以得到一个处理你的安全令牌,使用的 DuplicateTokenEx ,使用的 SetTokenInformation 来改变令牌会话标识符,然后调用 CreateProcessAsUser 启动子。 (刚开始,这将是最简单的用一个单独的可执行文件,但一旦你熨平了错误,你可以通过使用命令行参数或环境变量来区分滚动服务与子成一个可执行文件,例如这两种情况。)

If you don't mind breaking the rules, a service running as local system should be able to launch a subprocess in the session of your choice. Use OpenProcessToken to get a handle to your security token, duplicate it with DuplicateTokenEx, use SetTokenInformation to change the token session identifier, then call CreateProcessAsUser to launch the subprocess. (Initially, it would be simplest to use a separate executable, but once you've ironed out the bugs you could roll the service and the subprocess into a single executable, for example by using a command-line argument or an environment variable to distinguish the two cases.)

WTSGetActiveConsoleSessionId 功能会告诉你哪个会话当前连接到物理控制台。

The WTSGetActiveConsoleSessionId function will tell you which session is currently connected to the physical console.

这篇关于Win7的登录屏幕上运行应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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