user1683517
user1683517

Reputation: 171

How to display UI on logon screen in Windows 7

I would like to display an UI that interacts with user on pre-logon screen (the screen where users usually enter their username/password)
I read that the architecture of Winlogon packages has changed and will not help me in Windows 7. I was referred to use WTS functions, however I am still not clear on how to use them or which ones.

I already created a Service which brings up a notepad.exe (for now), however I need to trigger this Service when user is in pre-logon screen. I am not sure what or how to implement that.

Upvotes: 7

Views: 6160

Answers (4)

Vivek
Vivek

Reputation: 428

From what I understand of your requirement, you want to display a custom user interface at the Credential Provider level. You can achieve this by one of the following approaches:

(1) Write a custom CP that includes your UI as a modal dialog in the SetSelected method of the credential : This approach will allow you to customize any UI. Once the modal window gets dismissed, the actual password CP gets built (assuming you wrap the default password CP).

(2) Launch the application from a Windows Service: This approach will not stop the providers from getting initialized. Basically, the Windows Service is used to launch a process in Winsta0\Winlogon desktop. You can access the process launched using Alt+TAB. Here's the basic steps you would need to use:

  1. WTSGetActiveConsoleSessionId to get the active session ID
  2. WTSQueryUserToken() to get the winlogon pid
  3. DuplicateTokenEx to duplicate the token
  4. Adjust the token privileges by calling AdjustTokenPrivileges
  5. CreateProcessAsUser with lpDesktop as Winsta0\Winlogon

I have used both approaches. The first one is used to introduce more secure login. The second is used to launch remote access tools, cmd prompt etc.

Upvotes: 0

Gabe
Gabe

Reputation: 86768

One way to get UI to show up without anybody logged in is to have a login screensaver. Your code (which could be .NET) would run after the timeout up until either you exit or somebody presses Ctrl-Alt-Del.

There are limits to what you can do as a login screensaver, but it may work for you.

Upvotes: 0

SeanC
SeanC

Reputation: 15923

what you are trying to do is use Windows Interactive Logon Architecture

Windows Vista examples here (Credential Providers)

Windows 7 technet article

Upvotes: 3

Sam Axe
Sam Axe

Reputation: 33738

There's a reason it's HARD to do this kind of thing. Programs are minions of users. Pre-logon, there's (typically) no user to be a minion of. Its a security thing.

Just have your service fire off when a user logs in.

Upvotes: 0

Related Questions