About Terminal Server, Citrix, Delphi and other stuff
Win32 API provides only 1 function for locking workstation, named LockWorkstation. What does it do and how we can use it?
When a new session is started, smss.exe invokes winlogon.exe. It registers its process id in win32k.sys by calling RegisterLogonProcess. It has this prototype:
Functional code in win32k.sys for RegisterLogonProcess is very simple:
gpidLogon is a global variable in win32k.sys. So, only processes with SE_TCB_NAME can call it and only once per session (each session has its own instance of win32k.sys).
Later, when winlogon.exe continues its initialization, it creates a hidden window with ‘SAS window’ name and registers it handle using this function:
Its functional code is very simple again:
pWND = ValidateHwnd(Window);
if (pWND) {
return _SetLogonNotifyWindow(pWND);
}
else {
return FALSE;
}
}
BOOL __stdcall _SetLogonNotifyWindow(void * pWnd) {
if (PsGetCurrentProcessId() == gpidLogon) {
HMAssignmentLock(&gspwndLogonNotify, pWnd);
return TRUE;
}
else {
return FALSE;
}
}
So only a logon process is allowed to set logon notify window. Let’s look what does LockWorkstation does:
Hmm… maybe there are some more messages we can post?
In next part I’ll show how winlogon.exe registers keyboard shortcuts and how we can use them
Related posts:
Active Directory Altiris bug Citrix Dell Delphi Exchange Exchange2003 Exchange2010 Hewlett-Packard HP iOS Jailbreak Java LinkedIn Linux MSI MySQL Navigation Objects Office Outlook Passat PowerPoint PowerShell referall was returned RNS315 RNS510 SasLibEx script slow Terminal Server ThinApp TSAdmin TSAdminEx VBS VCDS Vista VMWare Volkswagen Windows PE WLAN Wordpress WTSWaitSystemEvent wts_event_flush
WP Cumulus Flash tag cloud by Roy Tanck requires Flash Player 9 or better.
2 Responses for "Locking a workstation – part 1"
[...] part 1 I showed how winlogon.exe registers it’s process and main window [...]
[...] code to simulate the Secure Attention Sequence (SAS),which most people refer to as control alt delete or [...]
Leave a reply