- Run Task Manager when CTRL-ALT-DEL is pressed.

svn path=/trunk/; revision=9489
This commit is contained in:
Filip Navara 2004-05-25 15:53:16 +00:00
parent 6368fbd7a8
commit 7a98b74d8b

View file

@ -1,4 +1,4 @@
/* $Id: winlogon.c,v 1.29 2004/03/28 12:21:41 weiden Exp $ /* $Id: winlogon.c,v 1.30 2004/05/25 15:53:16 navaraf Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -287,6 +287,54 @@ static BOOL RestartShell(void)
} }
*/ */
VOID STDCALL
RegisterHotKeys(VOID)
{
RegisterHotKey(NULL, 0, MOD_ALT | MOD_CONTROL, VK_DELETE);
}
VOID STDCALL
UnregisterHotKeys(VOID)
{
UnregisterHotKey(NULL, 0);
}
VOID STDCALL
HandleHotKey(MSG *Msg)
{
DbgPrint("HOTKEY: Got hot key (%d)\n", Msg->wParam);
/* CTRL-ALT-DEL */
if (Msg->wParam == 0)
{
STARTUPINFO StartupInfo;
PROCESS_INFORMATION ProcessInformation;
StartupInfo.cb = sizeof(StartupInfo);
StartupInfo.lpReserved = NULL;
StartupInfo.lpDesktop = NULL;
StartupInfo.lpTitle = NULL;
StartupInfo.dwFlags = 0;
StartupInfo.cbReserved2 = 0;
StartupInfo.lpReserved2 = 0;
CreateProcessW(
L"taskmgr.exe",
NULL,
NULL,
NULL,
FALSE,
CREATE_NEW_PROCESS_GROUP | DETACHED_PROCESS,
NULL,
NULL,
&StartupInfo,
&ProcessInformation);
CloseHandle (ProcessInformation.hProcess);
CloseHandle (ProcessInformation.hThread);
}
}
#if SUPPORT_CONSOLESTART #if SUPPORT_CONSOLESTART
static BOOL StartIntoGUI(VOID) static BOOL StartIntoGUI(VOID)
{ {
@ -371,6 +419,7 @@ DoLogonUser (PWCHAR Name,
PROFILEINFOW ProfileInfo; PROFILEINFOW ProfileInfo;
BOOL Result; BOOL Result;
LPVOID lpEnvironment = NULL; LPVOID lpEnvironment = NULL;
MSG Msg;
Result = LogonUserW (Name, Result = LogonUserW (Name,
NULL, NULL,
@ -443,7 +492,25 @@ DoLogonUser (PWCHAR Name,
return FALSE; return FALSE;
} }
/* Process the global hotkeys on #if 0 */
#if 0
WaitForSingleObject (ProcessInformation.hProcess, INFINITE); WaitForSingleObject (ProcessInformation.hProcess, INFINITE);
#else
RegisterHotKeys();
while (WaitForSingleObject (ProcessInformation.hProcess, 100) != WAIT_OBJECT_0)
{
if (PeekMessage(&Msg, 0, 0, 0, PM_REMOVE))
{
if (Msg.message == WM_HOTKEY)
HandleHotKey(&Msg);
TranslateMessage(&Msg);
DispatchMessage(&Msg);
}
}
UnregisterHotKeys();
#endif
CloseHandle (ProcessInformation.hProcess); CloseHandle (ProcessInformation.hProcess);
CloseHandle (ProcessInformation.hThread); CloseHandle (ProcessInformation.hThread);
@ -459,7 +526,6 @@ DoLogonUser (PWCHAR Name,
} }
#endif #endif
int STDCALL int STDCALL
WinMain(HINSTANCE hInstance, WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance, HINSTANCE hPrevInstance,
@ -657,7 +723,11 @@ WinMain(HINSTANCE hInstance,
{ {
#endif #endif
SessionLoop(WLSession); RegisterHotKeys();
SessionLoop(WLSession);
UnregisterHotKeys();
/* FIXME - Flush disks and registry, ... */ /* FIXME - Flush disks and registry, ... */
@ -833,6 +903,8 @@ SessionLoop(PWLSESSION Session)
/* Message loop for the SAS window */ /* Message loop for the SAS window */
while(GetMessage(&Msg, 0, 0, 0)) while(GetMessage(&Msg, 0, 0, 0))
{ {
if (Msg.message == WM_HOTKEY)
HandleHotKey(&Msg);
TranslateMessage(&Msg); TranslateMessage(&Msg);
DispatchMessage(&Msg); DispatchMessage(&Msg);
} }