Show application at Windows Vista Login/Locked screen

W

willste

I am trying to develop a Windows service using C# 2.0, which will launch a
GUI application at the login and session locked screens on Windows Vista (and
eventually Windows 7).

Currently on Windows XP, we are using Winlogon Notification Packages to
achieve this. This will not work beyond XP though
(http://technet.microsoft.com/en-us/library/cc721961(WS.10).aspx), so I have
to figure out a new solution.

Here’s some code from my service:

const string lpDesktop = @"Winsta0\Winlogon";
const string lpApplicationName = @"C:\WINDOWS\system32\calc.exe";

[DllImport("kernel32.dll")]
static extern bool CreateProcess(string lpApplicationName,
string lpCommandLine,
IntPtr lpProcessAttributes,
IntPtr lpThreadAttributes,
bool bInheritHandles,
uint dwCreationFlags,
IntPtr lpEnvironment,
string lpCurrentDirectory,
ref STARTUPINFO lpStartupInfo,
out PROCESS_INFORMATION
lpProcessInformation);

void SensLogon_DisplayLock(string userName)
{
STARTUPINFO si = new STARTUPINFO();
si.lpDesktop = lpDesktop;
PROCESS_INFORMATION pi = new PROCESS_INFORMATION();
CreateProcess(lpApplicationName, null, IntPtr.Zero, IntPtr.Zero, false, 0,
IntPtr.Zero, null, ref si, out pi);
}

My service, which is configured to run under the SYSTEM account and allowed
to interact with the desktop, will successfully capture the
logon/logoff/lock/unlock events in my service using SENS.

When I run the service on Windows XP, setting the STARTUPINFO.lpDesktop to
"Winsta0\Winlogon", the CreateProcess function successfully displays the
Calculator when I lock/logoff my session. The same service does not work on
Vista. I can see the “calc.exe†process in Task Manager running under the
SYSTEM account, but it is not visible when I lock/logoff the session.

I have also tried following the steps in a similar post
(http://social.msdn.microsoft.com/Fo...y/thread/4aadadbd-fc3d-4239-ba0f-4d81f17ec938), without success.

Can anyone help?
 
W

willste

Ok, let’s make the conclusion that this can not be done from a service.

What about a scheduled task? I have tried this code in a standard Windows
application, and executed it from a schedule task under the SYSTEM account,
which also does not work.

Has anyone successfully got a GUI application to display at the login or
session locked screens on Vista?


Wilson said:
Services are isolated on Vista, so there is an issue with an architecture
that requires them to interact with the interactive user.

http://blogs.msdn.com/sripod/archiv...n-in-vista-and-application-compatibility.aspx

--
Phil Wilson
The Definitive Guide to Windows Installer
http://www.apress.com/book/view/1590592972


willste said:
I am trying to develop a Windows service using C# 2.0, which will launch a
GUI application at the login and session locked screens on Windows Vista
(and
eventually Windows 7).

Currently on Windows XP, we are using Winlogon Notification Packages to
achieve this. This will not work beyond XP though
(http://technet.microsoft.com/en-us/library/cc721961(WS.10).aspx), so I
have
to figure out a new solution.

Here’s some code from my service:

const string lpDesktop = @"Winsta0\Winlogon";
const string lpApplicationName = @"C:\WINDOWS\system32\calc.exe";

[DllImport("kernel32.dll")]
static extern bool CreateProcess(string lpApplicationName,
string lpCommandLine,
IntPtr lpProcessAttributes,
IntPtr lpThreadAttributes,
bool bInheritHandles,
uint dwCreationFlags,
IntPtr lpEnvironment,
string lpCurrentDirectory,
ref STARTUPINFO lpStartupInfo,
out PROCESS_INFORMATION
lpProcessInformation);

void SensLogon_DisplayLock(string userName)
{
STARTUPINFO si = new STARTUPINFO();
si.lpDesktop = lpDesktop;
PROCESS_INFORMATION pi = new PROCESS_INFORMATION();
CreateProcess(lpApplicationName, null, IntPtr.Zero, IntPtr.Zero, false, 0,
IntPtr.Zero, null, ref si, out pi);
}

My service, which is configured to run under the SYSTEM account and
allowed
to interact with the desktop, will successfully capture the
logon/logoff/lock/unlock events in my service using SENS.

When I run the service on Windows XP, setting the STARTUPINFO.lpDesktop to
"Winsta0\Winlogon", the CreateProcess function successfully displays the
Calculator when I lock/logoff my session. The same service does not work
on
Vista. I can see the “calc.exe†process in Task Manager running under the
SYSTEM account, but it is not visible when I lock/logoff the session.

I have also tried following the steps in a similar post
(http://social.msdn.microsoft.com/Fo...y/thread/4aadadbd-fc3d-4239-ba0f-4d81f17ec938),
without success.

Can anyone help?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top