Author: hpoussin
Date: Sun Jul 30 12:38:35 2006
New Revision: 23375
URL:
http://svn.reactos.org/svn/reactos?rev=23375&view=rev
Log:
- Create a window to receive the CTRL+ALT+DELETE event (not working yet)
- Remove support for console start (it is the role of msgina, not winlogon)
- Implement some simple functions
Modified:
trunk/reactos/base/system/winlogon/winlogon.c
trunk/reactos/base/system/winlogon/wlx.c
Modified: trunk/reactos/base/system/winlogon/winlogon.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/winlogon/winlo…
==============================================================================
--- trunk/reactos/base/system/winlogon/winlogon.c (original)
+++ trunk/reactos/base/system/winlogon/winlogon.c Sun Jul 30 12:38:35 2006
@@ -1,7 +1,6 @@
-/* $Id$
- *
+/*
* COPYRIGHT: See COPYING in the top level directory
- * PROJECT: ReactOS kernel
+ * PROJECT: ReactOS Winlogon
* FILE: services/winlogon/winlogon.c
* PURPOSE: Logon
* PROGRAMMER: David Welch (welch(a)cwcom.net)
@@ -14,9 +13,6 @@
#define NDEBUG
#include <debug.h>
-
-#define SUPPORT_CONSOLESTART 1
-#define START_LSASS 1
/* GLOBALS ******************************************************************/
@@ -33,10 +29,7 @@
HINSTANCE hAppInstance;
PWLSESSION WLSession = NULL;
-
-#if SUPPORT_CONSOLESTART
-BOOL StartConsole = TRUE;
-#endif
+HWND hwndSASWindow = NULL;
/* FUNCTIONS *****************************************************************/
@@ -153,7 +146,6 @@
return TRUE;
}
-#if START_LSASS
static BOOLEAN
StartLsass (VOID)
{
@@ -205,7 +197,6 @@
return(TRUE);
}
-#endif
static BOOLEAN
@@ -280,7 +271,7 @@
VOID STDCALL
RegisterHotKeys(VOID)
{
- RegisterHotKey(NULL, 0, MOD_ALT | MOD_CONTROL, VK_DELETE);
+ RegisterHotKey(hwndSASWindow, 0, MOD_ALT | MOD_CONTROL, VK_DELETE);
}
VOID STDCALL
@@ -324,34 +315,6 @@
CloseHandle (ProcessInformation.hThread);
}
}
-
-#if SUPPORT_CONSOLESTART
-static BOOL StartIntoGUI(VOID)
-{
- HKEY WinLogonKey;
- DWORD Type, Size, Value;
-
- if(OpenRegistryKey(&WinLogonKey))
- {
- Size = sizeof(DWORD);
- if(ERROR_SUCCESS == RegQueryValueEx(WinLogonKey,
- L"StartGUI",
- NULL,
- &Type,
- (LPBYTE)&Value,
- &Size))
- {
- if(Type == REG_DWORD)
- {
- RegCloseKey(WinLogonKey);
- return (Value != 0);
- }
- }
- RegCloseKey(WinLogonKey);
- }
- return FALSE;
-}
-
static PWCHAR
GetUserInit (WCHAR *CommandLine)
@@ -496,10 +459,8 @@
while (WaitForSingleObject (ProcessInformation.hProcess, 100) != WAIT_OBJECT_0)
{
- if (PeekMessage(&Msg, 0, 0, 0, PM_REMOVE))
- {
- if (Msg.message == WM_HOTKEY)
- HandleHotKey(&Msg);
+ if (PeekMessage(&Msg, hwndSASWindow, 0, 0, PM_REMOVE))
+ {
TranslateMessage(&Msg);
DispatchMessage(&Msg);
}
@@ -526,7 +487,32 @@
return TRUE;
}
-#endif
+
+static LRESULT CALLBACK
+SASWindowProc(
+ IN HWND hwndDlg,
+ IN UINT uMsg,
+ IN WPARAM wParam,
+ IN LPARAM lParam)
+{
+ DbgBreakPoint();
+ switch (uMsg)
+ {
+ case WM_HOTKEY:
+ {
+ switch (lParam)
+ {
+ case MAKELONG(MOD_CONTROL | MOD_ALT, VK_DELETE):
+ {
+ DispatchSAS(WLSession, WLX_SAS_TYPE_CTRL_ALT_DEL);
+ return TRUE;
+ }
+ }
+ }
+ }
+
+ return DefWindowProc(hwndDlg, uMsg, wParam, lParam);
+}
int STDCALL
WinMain(HINSTANCE hInstance,
@@ -535,10 +521,7 @@
int nShowCmd)
{
BOOLEAN Old;
-#if SUPPORT_CONSOLESTART
-// WCHAR LoginName[255];
-// WCHAR Password[255];
-#endif
+ WNDCLASS wndClass;
#if 0
LSA_STRING ProcessName, PackageName;
HANDLE LsaHandle;
@@ -559,7 +542,6 @@
/* Get privilege */
RtlAdjustPrivilege(SE_ASSIGNPRIMARYTOKEN_PRIVILEGE, TRUE, FALSE, &Old);
-#if START_LSASS
if (StartProcess(L"StartLsass"))
{
if (!StartLsass())
@@ -571,7 +553,6 @@
{
DPRINT1("WL: StartProcess() failed!\n");
}
-#endif
if(!(WLSession = MsGinaInit()))
{
@@ -615,9 +596,6 @@
return 0;
}
-#if SUPPORT_CONSOLESTART
- StartConsole = !StartIntoGUI();
-#endif
if(!InitializeSAS(WLSession))
{
DPRINT1("WL: Failed to initialize SAS\n");
@@ -663,6 +641,17 @@
* Register SAS with the window.
* Register for logoff notification
*/
+ /* Create a window class */
+ ZeroMemory(&wndClass, sizeof(WNDCLASS));
+ wndClass.style = CS_GLOBALCLASS;
+ wndClass.lpfnWndProc = SASWindowProc;
+ wndClass.hInstance = hInstance;
+ wndClass.lpszClassName = L"SAS Window class";
+ RegisterClass(&wndClass);
+ hwndSASWindow = CreateWindow(
+ L"SAS Window class", L"SAS window", 0,
+ 0, 0, 0, 0,
+ NULL, NULL, hInstance, NULL);
/* Main loop */
#if 0
@@ -701,21 +690,6 @@
i++;
} while (Password[i - 1] != '\n');
Password[i - 1] =0;
-#endif
-
-#if SUPPORT_CONSOLESTART
- if(StartConsole)
- {
-// if (! DoLogonUser(LoginName, Password))
- if (! DoLogonUser(L"Administrator", L"Secret"))
- {
- }
-
- NtShutdownSystem(ShutdownNoReboot);
- ExitProcess(0);
- }
- else
- {
#endif
RegisterHotKeys();
@@ -745,9 +719,6 @@
DPRINT1("WL: LogonStatus != LOGON_SHUTDOWN!!!\n");
ExitProcess(0);
}
-#if SUPPORT_CONSOLESTART
- }
-#endif
return 0;
}
@@ -759,17 +730,6 @@
{
return TRUE;
}
-
- #if SUPPORT_CONSOLESTART
- if(StartConsole)
- {
- if(pMessage)
- {
- DPRINT1("WL-Status: %ws\n", pMessage);
- }
- return TRUE;
- }
- #endif
return Session->MsGina.Functions.WlxDisplayStatusMessage(Session->MsGina.Context,
hDesktop, dwOptions, pTitle, pMessage);
}
@@ -848,9 +808,6 @@
WlxSetTimeout(Session->MsGina.Context, 0);
Session->SuppressStatus = TRUE;
/* tell msgina to show a window telling the user one can logon */
- #if SUPPORT_CONSOLESTART
- if(!StartConsole)
- #endif
DisplaySASNotice(Session);
Session->SuppressStatus = FALSE;
@@ -863,7 +820,11 @@
}
WlxAction = DoLogin(Session);
- if(WlxAction == WLX_SAS_ACTION_LOGOFF)
+ if (WlxAction == WLX_SAS_ACTION_LOGON)
+ {
+ DoLogonUser(L"Administrator", L"Secret");
+ }
+ else if(WlxAction == WLX_SAS_ACTION_LOGOFF)
{
/* the user doesn't want to login, instead pressed cancel
we should display the window again so one can logon again */
@@ -900,10 +861,8 @@
}
/* Message loop for the SAS window */
- while(GetMessage(&Msg, 0, 0, 0))
- {
- if (Msg.message == WM_HOTKEY)
- HandleHotKey(&Msg);
+ while(GetMessage(&Msg, hwndSASWindow, 0, 0))
+ {
TranslateMessage(&Msg);
DispatchMessage(&Msg);
}
Modified: trunk/reactos/base/system/winlogon/wlx.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/winlogon/wlx.c…
==============================================================================
--- trunk/reactos/base/system/winlogon/wlx.c (original)
+++ trunk/reactos/base/system/winlogon/wlx.c Sun Jul 30 12:38:35 2006
@@ -84,7 +84,7 @@
}
/*
- * @unimplemented
+ * @implemented
*/
int WINAPI
WlxMessageBox(
@@ -95,12 +95,11 @@
UINT fuStyle
)
{
- Unimplemented;
- return 0;
-}
-
-/*
- * @unimplemented
+ return MessageBoxW(hwndOwner, lpszText, lpszTitle, fuStyle);
+}
+
+/*
+ * @implemented
*/
int WINAPI
WlxDialogBox(
@@ -111,12 +110,11 @@
DLGPROC dlgprc
)
{
- Unimplemented;
- return 0;
-}
-
-/*
- * @unimplemented
+ return (int)DialogBox(hInst, lpszTemplate, hwndOwner, dlgprc);
+}
+
+/*
+ * @implemented
*/
int WINAPI
WlxDialogBoxParam(
@@ -128,8 +126,7 @@
LPARAM dwInitParam
)
{
- Unimplemented;
- return 0;
+ return (int)DialogBoxParam(hInst, lpszTemplate, hwndOwner, dlgprc, dwInitParam);
}
/*
@@ -144,12 +141,11 @@
DLGPROC dlgprc
)
{
- Unimplemented;
- return 0;
-}
-
-/*
- * @unimplemented
+ return (int)DialogBoxIndirect(hInst, hDialogTemplate, hwndOwner, dlgprc);
+}
+
+/*
+ * @implemented
*/
int WINAPI
WlxDialogBoxIndirectParam(
@@ -161,8 +157,7 @@
LPARAM dwInitParam
)
{
- Unimplemented;
- return 0;
+ return (int)DialogBoxIndirectParam(hInst, hDialogTemplate, hwndOwner, dlgprc,
dwInitParam);
}
/*