通过服务删除Windows登录界面 [英] Removing Windows Logon screen through a service
问题描述
我试图从服务启动一个可执行文件删除Windows登录屏幕(winlogon的)。该服务将随Windows自动启动,并等待来自另一台计算机的命令。当它接收到的命令,它将推出一个exe文件,将启动CMD.EXE一个特定的用户名下。
I am trying to remove the windows logon screen (winlogon) from an executable launched from a service. The service would start automatically with windows and wait for commands from another computer. When it receives a command, it will launch an exe which will start cmd.exe under a particular username.
该服务已经是present。我写这个可执行文件的工作。目前,我已经写它通过调用LogonUserW,ImpersonateUser和CreateProcessWithLogonW不同的用户下启动cmd.exe的可执行文件(CmdLogin)。我指定lpDesktop为WinSta0 \\默认。唯一的缺点是,该服务必须以管理员帐户下运行(但是这是一个不同的问题)。
The service is already present. I have the job of writing this executable. Currently, I have written the executable (CmdLogin) which starts cmd.exe under a different user through calls to LogonUserW, ImpersonateUser and CreateProcessWithLogonW. I specify lpDesktop as "WinSta0\Default". The only catch is that the service must run under an administrator account (but that is a different problem).
这个工作叫做从命令提示符(即使在Windows 7中),当完美的罚款。这也适用从服务调用时,当用户登录和查看他的桌面上(就像我在同一台机器上调试时做的)。然而,像我上面说的,我真正的要求是当Windows登录屏幕将会显示这甚至工作。目前,exe文件给出了一个适当的退出code,但窗口不会出现。但是,当用户登录时,他看到桌面上的cmd窗口。
This works perfectly fine when called from a command prompt (even on Windows 7). This also works when called from the service when a user has logged on and viewing his desktop (like I do when debugging on the same machine). However, like I said above, my real requirement is for this to work even when the windows logon screen is displayed. Currently, the exe gives a proper exit code but the window does not appear. However, when the user logs in, he sees the cmd window on the desktop.
一个解决方案,我发现是使用WinSta0 \\ WinLogon的为lpDesktop,而不是默认。我还没有尝试。然而,这看起来像它会显示在cmd窗口就在登录屏幕。我真正需要的是实际模拟用户登陆到Winlogon中,并显示他的实际桌面(和cmd窗口)。
One solution I found was to use "WinSta0\WinLogon" for lpDesktop instead of Default. I am yet to try this. However, this looks like it will show the cmd window right over the login screen. What I really need is to actually emulate the user login to winlogon and show his actual desktop (and the cmd window).
我环顾四周,发现GINA和Winlogon通知程序包。他们似乎是一个矫枉过正,我不知道这甚至会解决这里的目的。而且,这些都是在Windows Vista pcated德$ P $这让我觉得有一个更好的和巧妙的方法来解决这个问题。
I looked around and found GINA and Winlogon Notification Packages. They seem like an overkill and I am not sure if that will even solve the purpose here. Moreover, these are deprecated in Windows Vista which makes me think there is a better and neater method to solve this.
这是我应该怎么用,以实现这一目标有什么建议?根据记录,可执行文件是在C#与使用P / Invoke API调用。我愿意用C DLL,我可以从这个C#应用程序调用过
Any suggestions on what should I use to achieve this? For the record, the executable is in C# with API calls using P/Invoke. I am open to using a C dll that I can call from this C# application too.
感谢您,
侯赛因
Thank you,
Husain
推荐答案
GINA已经在Vista中/ 2008年通过认证供应商(在托管code不可用)取代。
GINA has been superceded in Vista/2008 by Credential Providers (not available in managed code).
我不知道该怎么做你需要什么,但也许这是一个线索,以进一步往下走的小道。
I don't know how to do what you need, but perhaps this is a clue to go further down the trail.
和备案,这似乎是错误的方式来解决这个问题。我只是不明白,你怎么会需要自动登录下运行命令提示符......为什么不写一个服务,做你的任务,并有它的一套特定服务的凭证?
And for the record, this seems like the wrong way to address the problem. I just don't see how you would need to run a command prompt under an auto login... Why not write a service to do your tasks, and have it run under a set of service specific credentials?
我没有对你的问题的背景,但这种描述让我不寒而栗。 : - )
I don't have the background on your problem, but this description makes me shudder. :-)
[更新]
那么,在回答您的评论。我要说的是写一个GINA的替代< = Windows 2003或为自定义凭据提供VISTA / 2008 +将看起来是你最好的选择。
[Update] Well, in response to your comment. I would say that writing a GINA replacement for <= Windows 2003, or a custom credential provider for Vista/2008+ would look to be your best option.
您可以针对自己的凭证存储提供自定义的身份验证,然后允许或拒绝登录,您认为合适。
You can provide custom authentication against his credential store, then allow or deny the login as you see fit.
这篇关于通过服务删除Windows登录界面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!