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?
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?