2 added + 16 modified, total 18 files
reactos/subsys/csrss/win32csr
diff -N exitros.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ exitros.c 12 Jul 2004 20:09:34 -0000 1.1
@@ -0,0 +1,112 @@
+/* $Id: exitros.c,v 1.1 2004/07/12 20:09:34 gvg Exp $
+ *
+ * COPYRIGHT: See COPYING in the top level directory
+ * PROJECT: ReactOS CSRSS subsystem
+ * FILE: subsys/csrss/win32csr/exitros.c
+ * PURPOSE: Logout/shutdown
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <windows.h>
+#include <reactos/winlogon.h>
+#include "api.h"
+#include "win32csr.h"
+
+#define NDEBUG
+#include <debug.h>
+
+static HWND LogonNotifyWindow = NULL;
+static DWORD LogonProcess = 0;
+
+CSR_API(CsrRegisterLogonProcess)
+{
+ Reply->Header.MessageSize = sizeof(CSRSS_API_REPLY);
+ Reply->Header.DataSize = sizeof(CSRSS_API_REPLY) - LPC_MESSAGE_BASE_SIZE;
+
+ if (Request->Data.RegisterLogonProcessRequest.Register)
+ {
+ if (0 != LogonProcess)
+ {
+ Reply->Status = STATUS_LOGON_SESSION_EXISTS;
+ return Reply->Status;
+ }
+ LogonProcess = Request->Data.RegisterLogonProcessRequest.ProcessId;
+ }
+ else
+ {
+ if ((DWORD) Request->Header.ClientId.UniqueProcess != LogonProcess)
+ {
+ DPRINT1("Current logon process 0x%x, can't deregister from process 0x%x\n",
+ LogonProcess, Request->Header.ClientId.UniqueProcess);
+ Reply->Status = STATUS_NOT_LOGON_PROCESS;
+ return Reply->Status;
+ }
+ LogonProcess = 0;
+ }
+
+ Reply->Status = STATUS_SUCCESS;
+
+ return Reply->Status;
+}
+
+CSR_API(CsrSetLogonNotifyWindow)
+{
+ DWORD WindowCreator;
+
+ Reply->Header.MessageSize = sizeof(CSRSS_API_REPLY);
+ Reply->Header.DataSize = sizeof(CSRSS_API_REPLY) - LPC_MESSAGE_BASE_SIZE;
+
+ if (0 == GetWindowThreadProcessId(Request->Data.SetLogonNotifyWindowRequest.LogonNotifyWindow,
+ &WindowCreator))
+ {
+ DPRINT1("Can't get window creator\n");
+ Reply->Status = STATUS_INVALID_HANDLE;
+ return Reply->Status;
+ }
+ if (WindowCreator != LogonProcess)
+ {
+ DPRINT1("Trying to register window not created by winlogon as notify window\n");
+ Reply->Status = STATUS_ACCESS_DENIED;
+ return Reply->Status;
+ }
+
+ LogonNotifyWindow = Request->Data.SetLogonNotifyWindowRequest.LogonNotifyWindow;
+
+ Reply->Status = STATUS_SUCCESS;
+
+ return Reply->Status;
+}
+
+CSR_API(CsrExitReactos)
+{
+ Reply->Header.MessageSize = sizeof(CSRSS_API_REPLY);
+ Reply->Header.DataSize = sizeof(CSRSS_API_REPLY) - LPC_MESSAGE_BASE_SIZE;
+
+ if (NULL == LogonNotifyWindow)
+ {
+ DPRINT1("No LogonNotifyWindow registered\n");
+ Reply->Status = STATUS_NOT_FOUND;
+ return Reply->Status;
+ }
+
+ /* FIXME Inside 2000 says we should impersonate the caller here */
+ Reply->Status = SendMessageW(LogonNotifyWindow, PM_WINLOGON_EXITWINDOWS,
+ (WPARAM) Request->Header.ClientId.UniqueProcess,
+ (LPARAM) Request->Data.ExitReactosRequest.Flags);
+ /* If the message isn't handled, the return value is 0, so 0 doesn't indicate success.
+ Success is indicated by a 1 return value, if anything besides 0 or 1 it's a
+ NTSTATUS value */
+ if (1 == Reply->Status)
+ {
+ Reply->Status = STATUS_SUCCESS;
+ }
+ else if (0 == Reply->Status)
+ {
+ Reply->Status = STATUS_NOT_IMPLEMENTED;
+ }
+
+ return Reply->Status;
+}
+
+/* EOF */
reactos/subsys/csrss/win32csr
diff -u -r1.3 -r1.4
--- Makefile 11 Jan 2004 17:31:15 -0000 1.3
+++ Makefile 12 Jul 2004 20:09:34 -0000 1.4
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.3 2004/01/11 17:31:15 gvg Exp $
+# $Id: Makefile,v 1.4 2004/07/12 20:09:34 gvg Exp $
PATH_TO_TOP = ../../..
@@ -9,13 +9,13 @@
TARGET_BASE = 0x5ffb0000
# require os code to explicitly request A/W version of structs/functions
-TARGET_CFLAGS += -D_DISABLE_TIDENTS -Wall -Werror -I../include
+TARGET_CFLAGS += -D__USE_W32API -D_DISABLE_TIDENTS -Wall -Werror -I../include
TARGET_LFLAGS = -nostartfiles -nostdlib
TARGET_SDKLIBS = ntdll.a kernel32.a user32.a gdi32.a
-TARGET_OBJECTS = dllmain.o conio.o desktopbg.o guiconsole.o tuiconsole.o
+TARGET_OBJECTS = dllmain.o conio.o desktopbg.o exitros.o guiconsole.o tuiconsole.o
TARGET_ENTRY = _DllMain@12
reactos/subsys/csrss/win32csr
diff -u -r1.5 -r1.6
--- dllmain.c 28 May 2004 21:33:41 -0000 1.5
+++ dllmain.c 12 Jul 2004 20:09:34 -0000 1.6
@@ -1,4 +1,4 @@
-/* $Id: dllmain.c,v 1.5 2004/05/28 21:33:41 gvg Exp $
+/* $Id: dllmain.c,v 1.6 2004/07/12 20:09:34 gvg Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
@@ -55,6 +55,7 @@
CSRSS_DEFINE_API(CSRSS_READ_CONSOLE_OUTPUT_CHAR, CsrReadConsoleOutputChar),
CSRSS_DEFINE_API(CSRSS_READ_CONSOLE_OUTPUT_ATTRIB, CsrReadConsoleOutputAttrib),
CSRSS_DEFINE_API(CSRSS_GET_NUM_INPUT_EVENTS, CsrGetNumberOfConsoleInputEvents),
+ CSRSS_DEFINE_API(CSRSS_EXIT_REACTOS, CsrExitReactos),
CSRSS_DEFINE_API(CSRSS_PEEK_CONSOLE_INPUT, CsrPeekConsoleInput),
CSRSS_DEFINE_API(CSRSS_READ_CONSOLE_OUTPUT, CsrReadConsoleOutput),
CSRSS_DEFINE_API(CSRSS_WRITE_CONSOLE_INPUT, CsrWriteConsoleInput),
@@ -62,6 +63,8 @@
CSRSS_DEFINE_API(CSRSS_CREATE_DESKTOP, CsrCreateDesktop),
CSRSS_DEFINE_API(CSRSS_SHOW_DESKTOP, CsrShowDesktop),
CSRSS_DEFINE_API(CSRSS_HIDE_DESKTOP, CsrHideDesktop),
+ CSRSS_DEFINE_API(CSRSS_SET_LOGON_NOTIFY_WINDOW, CsrSetLogonNotifyWindow),
+ CSRSS_DEFINE_API(CSRSS_REGISTER_LOGON_PROCESS, CsrRegisterLogonProcess),
{ 0, 0, 0, NULL }
};
reactos/lib/user32/misc
diff -u -r1.4 -r1.5
--- exit.c 9 Apr 2004 20:03:14 -0000 1.4
+++ exit.c 12 Jul 2004 20:09:34 -0000 1.5
@@ -1,4 +1,4 @@
-/* $Id: exit.c,v 1.4 2004/04/09 20:03:14 navaraf Exp $
+/* $Id: exit.c,v 1.5 2004/07/12 20:09:34 gvg Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS user32.dll
@@ -14,6 +14,60 @@
#include <ntdll/csr.h>
/*
+ * Sequence of events:
+ *
+ * - App (usually explorer) calls ExitWindowsEx()
+ * - ExitWindowsEx() sends a message to CSRSS (note: investigation shows it
+ * doesn't transfer to kernel mode)
+ * - CSRSS impersonates the caller and sends a message to a hidden WinLogon window
+ * - WinLogon sends a SAS event to the GINA, asking for permission (e.g. if the
+ * required rights are granted) to proceed
+ * - WinLogon enters pending log-out state
+ * - WinLogon impersonates the interactive user and calls ExitWindowsEx() again,
+ * passing some special internal flags
+ * - CSRSS loops over all processes of the interactive user (sorted by their
+ * SetProcessShutdownParameters() level), sending WM_QUERYENDSESSION and
+ * WM_ENDSESSION messages to its top-level windows. If the messages aren't
+ * processed within the timeout period (registry key HKCU\Control Panel\Desktop\HungAppTimeout)
+ * CSRSS will put up a dialog box asking if the process should be terminated.
+ * Using the registry key HKCU\Control Panel\Desktop\AutoEndTask you can
+ * specify that the dialog box shouldn't be shown and CSRSS should just
+ * terminates the thread. If the the WM_ENDSESSION message is processed
+ * but the thread doesn't terminate within the timeout specified by
+ * HKCU\Control Panel\Desktop\WaitToKillAppTimeout CSRSS will terminate
+ * the thread. When all the top-level windows have been destroyed CSRSS
+ * will terminate the process.
+ * If the process is a console process, CSRSS will send a CTRL_LOGOFF_EVENT
+ * to the console control handler on logoff. No event is sent on shutdown.
+ * If the handler doesn't respond in time the same activities as for GUI
+ * apps (i.e. display dialog box etc) take place. This also happens if
+ * the handler returns TRUE.
+ * - This ends the processing for the first ExitWindowsEx() call from WinLogon.
+ * Execution continues in WinLogon, which calls ExitWindowsEx() again to
+ * terminate COM processes in the interactive user's session.
+ * - WinLogon stops impersonating the interactive user (whos processes are
+ * all dead by now). and enters log-out state
+ * - If the ExitWindowsEx() request was for a logoff, WinLogon sends a SAS
+ * event (to display the "press ctrl+alt+del") to the GINA. WinLogon then
+ * waits for the GINA to send a SAS event to login.
+ * - If the ExitWindowsEx() request was for shutdown/restart, WinLogon calls
+ * ExitWindowsEx() again in the system process context.
+ * - CSRSS goes through the motions of sending WM_QUERYENDSESSION/WM_ENDSESSION
+ * to GUI processes running in the system process context but won't display
+ * dialog boxes or kill threads/processes. Same for console processes,
+ * using the CTRL_SHUTDOWN_EVENT. The Service Control Manager is one of
+ * these console processes and has a special timeout value WaitToKillServiceTimeout.
+ * - WinLogon calls ADVAPI32.InitiateSystemShutdown()
+ * - ADVAPI32.InitiateSystemShutdown*() issues a "InitiateSystemShutdown" request
+ * to the SM (SMSS API # 1)
+ * - the SM propagates the shutdown request to every environment subsystem it
+ * started since bootstrap time (still active ones, of course)
+ * - each environment subsystem, on shutdown request, releases every resource
+ * it aquired during its life (processes, memory etc), then dies
+ * - when every environment subsystem has gone to bed, the SM actually initiates
+ * to shutdown the kernel and executive by calling NtShutdownSystem.
+ */
+/*
* @implemented
*/
BOOL STDCALL
reactos/lib/user32/misc
diff -u -r1.6 -r1.7
--- misc.c 8 Jul 2004 14:35:10 -0000 1.6
+++ misc.c 12 Jul 2004 20:09:34 -0000 1.7
@@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-/* $Id: misc.c,v 1.6 2004/07/08 14:35:10 ekohl Exp $
+/* $Id: misc.c,v 1.7 2004/07/12 20:09:34 gvg Exp $
*
* PROJECT: ReactOS user32.dll
* FILE: lib/user32/misc/misc.c
@@ -31,6 +31,7 @@
#include <windows.h>
#include <user32.h>
#include <debug.h>
+#include <ntdll/csr.h>
/* FUNCTIONS *****************************************************************/
@@ -76,3 +77,31 @@
(DWORD)bRegister,
TWOPARAM_ROUTINE_REGISTERLOGONPROC);
}
+
+/*
+ * @implemented
+ */
+BOOL
+STDCALL
+SetLogonNotifyWindow (HWND Wnd, HWINSTA WinSta)
+{
+ /* Maybe we should call NtUserSetLogonNotifyWindow and let that one inform CSRSS??? */
+ CSRSS_API_REQUEST Request;
+ CSRSS_API_REPLY Reply;
+ NTSTATUS Status;
+
+ Request.Type = CSRSS_SET_LOGON_NOTIFY_WINDOW;
+ Request.Data.SetLogonNotifyWindowRequest.LogonNotifyWindow = Wnd;
+
+ Status = CsrClientCallServer(&Request,
+ &Reply,
+ sizeof(CSRSS_API_REQUEST),
+ sizeof(CSRSS_API_REPLY));
+ if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Reply.Status))
+ {
+ SetLastError(RtlNtStatusToDosError(Status));
+ return(FALSE);
+ }
+
+ return(TRUE);
+}
reactos/subsys/csrss
diff -u -r1.28 -r1.29
--- init.c 3 Jul 2004 17:15:02 -0000 1.28
+++ init.c 12 Jul 2004 20:09:34 -0000 1.29
@@ -1,4 +1,4 @@
-/* $Id: init.c,v 1.28 2004/07/03 17:15:02 hbirr Exp $
+/* $Id: init.c,v 1.29 2004/07/12 20:09:34 gvg Exp $
*
* reactos/subsys/csrss/init.c
*
@@ -207,7 +207,6 @@
CSRSS_DEFINE_API(CSRSS_TERMINATE_PROCESS, CsrTerminateProcess),
CSRSS_DEFINE_API(CSRSS_CONNECT_PROCESS, CsrConnectProcess),
CSRSS_DEFINE_API(CSRSS_REGISTER_SERVICES_PROCESS, CsrRegisterServicesProcess),
- CSRSS_DEFINE_API(CSRSS_EXIT_REACTOS, CsrExitReactos),
CSRSS_DEFINE_API(CSRSS_GET_SHUTDOWN_PARAMETERS, CsrGetShutdownParameters),
CSRSS_DEFINE_API(CSRSS_SET_SHUTDOWN_PARAMETERS, CsrSetShutdownParameters),
CSRSS_DEFINE_API(CSRSS_GET_INPUT_HANDLE, CsrGetInputHandle),
reactos/subsys/csrss
diff -u -r1.29 -r1.30
--- makefile 28 May 2004 21:33:41 -0000 1.29
+++ makefile 12 Jul 2004 20:09:34 -0000 1.30
@@ -1,4 +1,4 @@
-# $Id: makefile,v 1.29 2004/05/28 21:33:41 gvg Exp $
+# $Id: makefile,v 1.30 2004/07/12 20:09:34 gvg Exp $
PATH_TO_TOP = ../..
@@ -13,7 +13,7 @@
TARGET_INSTALLDIR = system32
-TARGET_CFLAGS = -D__NTAPP__ -Wall -Werror -Iinclude
+TARGET_CFLAGS = -D__NTAPP__ -D__USE_W32API -Wall -Werror -Iinclude
TARGET_LFLAGS = -nostdlib
reactos/subsys/csrss/api
diff -u -r1.3 -r1.4
--- user.c 9 Apr 2004 20:03:15 -0000 1.3
+++ user.c 12 Jul 2004 20:09:34 -0000 1.4
@@ -1,4 +1,4 @@
-/* $Id: user.c,v 1.3 2004/04/09 20:03:15 navaraf Exp $
+/* $Id: user.c,v 1.4 2004/07/12 20:09:34 gvg Exp $
*
* reactos/subsys/csrss/api/user.c
*
@@ -51,15 +51,4 @@
return(Status);
}
-
-CSR_API(CsrExitReactos)
-{
- Reply->Header.MessageSize = sizeof(CSRSS_API_REPLY);
- Reply->Header.DataSize = sizeof(CSRSS_API_REPLY) - LPC_MESSAGE_BASE_SIZE;
-
- Reply->Status = STATUS_NOT_IMPLEMENTED;
-
- return(STATUS_NOT_IMPLEMENTED);
-}
-
/* EOF */
reactos/subsys/csrss/include
diff -u -r1.5 -r1.6
--- api.h 3 Jul 2004 17:15:02 -0000 1.5
+++ api.h 12 Jul 2004 20:09:34 -0000 1.6
@@ -1,4 +1,4 @@
-/* $Id: api.h,v 1.5 2004/07/03 17:15:02 hbirr Exp $
+/* $Id: api.h,v 1.6 2004/07/12 20:09:34 gvg Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
@@ -131,6 +131,9 @@
CSR_API(CsrGetShutdownParameters);
CSR_API(CsrSetShutdownParameters);
+CSR_API(CsrSetLogonNotifyWindow);
+CSR_API(CsrRegisterLogonProcess);
+
#endif /* ndef API_H_INCLUDED */
/* EOF */
reactos/subsys/system/winlogon
diff -u -r1.10 -r1.11
--- makefile 28 Mar 2004 12:21:41 -0000 1.10
+++ makefile 12 Jul 2004 20:09:35 -0000 1.11
@@ -1,4 +1,4 @@
-# $Id: makefile,v 1.10 2004/03/28 12:21:41 weiden Exp $
+# $Id: makefile,v 1.11 2004/07/12 20:09:35 gvg Exp $
PATH_TO_TOP = ../../..
@@ -14,10 +14,15 @@
TARGET_OBJECTS = setup.o winlogon.o wlx.o sas.o
-TARGET_CFLAGS = -Wall -Werror -DUNICODE -D_UNICODE -I./ -I../../../include
+TARGET_CFLAGS = -Wall -Werror -D__USE_W32API -DUNICODE -D_UNICODE -I./
include $(PATH_TO_TOP)/rules.mak
include $(TOOLS_PATH)/helper.mk
+# Automatic dependency tracking
+DEP_OBJECTS := $(TARGET_OBJECTS)
+
+include $(PATH_TO_TOP)/tools/depend.mk
+
# EOF
reactos/subsys/system/winlogon
diff -u -r1.1 -r1.2
--- sas.c 28 Mar 2004 12:21:41 -0000 1.1
+++ sas.c 12 Jul 2004 20:09:35 -0000 1.2
@@ -1,4 +1,4 @@
-/* $Id: sas.c,v 1.1 2004/03/28 12:21:41 weiden Exp $
+/* $Id: sas.c,v 1.2 2004/07/12 20:09:35 gvg Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@@ -16,15 +16,22 @@
#include <ntsecapi.h>
#include <wchar.h>
#include <userenv.h>
+#include <reactos/winlogon.h>
#include "setup.h"
#include "winlogon.h"
#include "resource.h"
-#define SAS_CLASS L"SAS window class"
+#define NDEBUG
+#include <debug.h>
+
#define HK_CTRL_ALT_DEL 0
#define HK_CTRL_SHIFT_ESC 1
+#ifdef __USE_W32API
+extern BOOL STDCALL SetLogonNotifyWindow(HWND Wnd, HWINSTA WinSta);
+#endif
+
void
DispatchSAS(PWLSESSION Session, DWORD dwSasType)
{
@@ -48,7 +55,7 @@
/* Register Ctrl+Alt+Del Hotkey */
if(!RegisterHotKey(hwndSAS, HK_CTRL_ALT_DEL, MOD_CONTROL | MOD_ALT, VK_DELETE))
{
- DbgPrint("WL-SAS: Unable to register Ctrl+Alt+Del hotkey!\n");
+ DPRINT1("WL-SAS: Unable to register Ctrl+Alt+Del hotkey!\n");
return FALSE;
}
@@ -56,7 +63,7 @@
Session->TaskManHotkey = RegisterHotKey(hwndSAS, HK_CTRL_SHIFT_ESC, MOD_CONTROL | MOD_SHIFT, VK_ESCAPE);
if(!Session->TaskManHotkey)
{
- DbgPrint("WL-SAS: Warning: Unable to register Ctrl+Alt+Esc hotkey!\n");
+ DPRINT1("WL-SAS: Warning: Unable to register Ctrl+Alt+Esc hotkey!\n");
}
return TRUE;
}
@@ -76,6 +83,78 @@
return TRUE;
}
+#define EWX_ACTION_MASK 0x0b
+static LRESULT
+HandleExitWindows(DWORD RequestingProcessId, UINT Flags)
+{
+ UINT Action;
+ HANDLE Process;
+ HANDLE Token;
+ BOOL CheckResult;
+ PPRIVILEGE_SET PrivSet;
+
+ /* Check parameters */
+ Action = Flags & EWX_ACTION_MASK;
+ if (EWX_LOGOFF != Action && EWX_SHUTDOWN != Action && EWX_REBOOT != Action
+ && EWX_POWEROFF != Action)
+ {
+ DPRINT1("Invalid ExitWindows action 0x%x\n", Action);
+ return STATUS_INVALID_PARAMETER;
+ }
+
+ /* Check privilege */
+ if (EWX_LOGOFF != Action)
+ {
+ Process = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, RequestingProcessId);
+ if (NULL == Process)
+ {
+ DPRINT1("OpenProcess failed with error %d\n", GetLastError());
+ return STATUS_INVALID_HANDLE;
+ }
+ if (! OpenProcessToken(Process, TOKEN_QUERY, &Token))
+ {
+ DPRINT1("OpenProcessToken failed with error %d\n", GetLastError());
+ CloseHandle(Process);
+ return STATUS_INVALID_HANDLE;
+ }
+ CloseHandle(Process);
+ PrivSet = HeapAlloc(GetProcessHeap(), 0, sizeof(PRIVILEGE_SET) + sizeof(LUID_AND_ATTRIBUTES));
+ if (NULL == PrivSet)
+ {
+ DPRINT1("Failed to allocate mem for privilege set\n");
+ CloseHandle(Token);
+ return STATUS_NO_MEMORY;
+ }
+ PrivSet->PrivilegeCount = 1;
+ PrivSet->Control = PRIVILEGE_SET_ALL_NECESSARY;
+ if (! LookupPrivilegeValue(NULL, SE_SHUTDOWN_NAME, &PrivSet->Privilege[0].Luid))
+ {
+ DPRINT1("LookupPrivilegeValue failed with error %d\n", GetLastError());
+ HeapFree(GetProcessHeap(), 0, PrivSet);
+ CloseHandle(Token);
+ return STATUS_UNSUCCESSFUL;
+ }
+ if (! PrivilegeCheck(Token, PrivSet, &CheckResult))
+ {
+ DPRINT1("PrivilegeCheck failed with error %d\n", GetLastError());
+ HeapFree(GetProcessHeap(), 0, PrivSet);
+ CloseHandle(Token);
+ return STATUS_ACCESS_DENIED;
+ }
+ HeapFree(GetProcessHeap(), 0, PrivSet);
+ CloseHandle(Token);
+ if (! CheckResult)
+ {
+ DPRINT1("SE_SHUTDOWN privilege not enabled\n");
+ return STATUS_ACCESS_DENIED;
+ }
+ }
+
+ /* FIXME actually start logoff/shutdown now */
+
+ return 1;
+}
+
LRESULT CALLBACK
SASProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
@@ -91,10 +170,10 @@
switch(wParam)
{
case HK_CTRL_ALT_DEL:
- DbgPrint("SAS: CTR+ALT+DEL\n");
+ DPRINT1("SAS: CTR+ALT+DEL\n");
break;
case HK_CTRL_SHIFT_ESC:
- DbgPrint("SAS: CTR+SHIFT+ESC\n");
+ DPRINT1("SAS: CTR+SHIFT+ESC\n");
break;
}
return 0;
@@ -108,6 +187,10 @@
}
return 0;
}
+ case PM_WINLOGON_EXITWINDOWS:
+ {
+ return HandleExitWindows((DWORD) wParam, (UINT) lParam);
+ }
case WM_DESTROY:
{
DestroySAS(Session, hwnd);
@@ -134,33 +217,29 @@
swc.hCursor = NULL;
swc.hbrBackground = NULL;
swc.lpszMenuName = NULL;
- swc.lpszClassName = SAS_CLASS;
+ swc.lpszClassName = WINLOGON_SAS_CLASS;
swc.hIconSm = NULL;
RegisterClassEx(&swc);
/* create invisible SAS window */
- Session->SASWindow = CreateWindowEx(0, SAS_CLASS, L"SAS", WS_OVERLAPPEDWINDOW,
+ Session->SASWindow = CreateWindowEx(0, WINLOGON_SAS_CLASS, WINLOGON_SAS_TITLE, WS_POPUP,
0, 0, 0, 0, 0, 0, hAppInstance, NULL);
if(!Session->SASWindow)
{
- DbgPrint("WL: Failed to create SAS window\n");
+ DPRINT1("WL: Failed to create SAS window\n");
return FALSE;
}
/* Save the Session pointer so the window proc can access it */
SetWindowLong(Session->SASWindow, GWL_USERDATA, (LONG)Session);
- #if 0
- /* Register SAS window to receive SAS notifications
- FIXME - SetLogonNotifyWindow() takes only one parameter,
- definition in funcs.h is wrong! */
- if(!SetLogonNotifyWindow(Session->SASWindow))
+ /* Register SAS window to receive SAS notifications */
+ if(!SetLogonNotifyWindow(Session->SASWindow, Session->InteractiveWindowStation))
{
UninitSAS(Session);
- DbgPrint("WL: Failed to register SAS window\n");
+ DPRINT1("WL: Failed to register SAS window\n");
return FALSE;
}
- #endif
return TRUE;
}
reactos/subsys/system/winlogon
diff -u -r1.3 -r1.4
--- setup.c 4 Jun 2004 23:46:02 -0000 1.3
+++ setup.c 12 Jul 2004 20:09:35 -0000 1.4
@@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-/* $Id: setup.c,v 1.3 2004/06/04 23:46:02 navaraf Exp $
+/* $Id: setup.c,v 1.4 2004/07/12 20:09:35 gvg Exp $
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS winlogon
* FILE: subsys/system/winlogon/setup.h
@@ -43,7 +43,7 @@
GetSetupType(VOID)
{
DWORD dwError;
- HANDLE hKey;
+ HKEY hKey;
DWORD dwType;
DWORD dwSize;
DWORD dwSetupType;
@@ -79,7 +79,7 @@
SetSetupType (DWORD dwSetupType)
{
DWORD dwError;
- HANDLE hKey;
+ HKEY hKey;
dwError = RegOpenKeyEx(HKEY_LOCAL_MACHINE,
L"SYSTEM\\Setup", //TEXT("SYSTEM\\Setup"),
@@ -116,7 +116,7 @@
WCHAR CommandLine[MAX_PATH];
BOOLEAN Result;
DWORD dwError;
- HANDLE hKey;
+ HKEY hKey;
DWORD dwType;
DWORD dwSize;
DWORD dwExitCode;
reactos/subsys/system/winlogon
diff -u -r1.33 -r1.34
--- winlogon.c 11 Jul 2004 13:31:28 -0000 1.33
+++ winlogon.c 12 Jul 2004 20:09:35 -0000 1.34
@@ -1,4 +1,4 @@
-/* $Id: winlogon.c,v 1.33 2004/07/11 13:31:28 weiden Exp $
+/* $Id: winlogon.c,v 1.34 2004/07/12 20:09:35 gvg Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@@ -219,7 +219,7 @@
static BOOLEAN
-OpenRegistryKey (HANDLE *WinLogonKey)
+OpenRegistryKey (HKEY *WinLogonKey)
{
return ERROR_SUCCESS == RegOpenKeyEx(HKEY_LOCAL_MACHINE,
L"SOFTWARE\\ReactOS\\Windows NT\\CurrentVersion\\WinLogon",
@@ -232,7 +232,7 @@
static BOOLEAN StartProcess(PWCHAR ValueName)
{
BOOL StartIt;
- HANDLE WinLogonKey;
+ HKEY WinLogonKey;
DWORD Type;
DWORD Size;
DWORD StartValue;
@@ -262,7 +262,7 @@
/*
static BOOL RestartShell(void)
{
- HANDLE WinLogonKey;
+ HKEY WinLogonKey;
DWORD Type, Size, Value;
if(OpenRegistryKey(&WinLogonKey))
@@ -338,7 +338,7 @@
#if SUPPORT_CONSOLESTART
static BOOL StartIntoGUI(VOID)
{
- HANDLE WinLogonKey;
+ HKEY WinLogonKey;
DWORD Type, Size, Value;
if(OpenRegistryKey(&WinLogonKey))
@@ -366,7 +366,7 @@
static PWCHAR
GetShell (WCHAR *CommandLine)
{
- HANDLE WinLogonKey;
+ HKEY WinLogonKey;
BOOL GotCommandLine;
DWORD Type;
DWORD Size;
@@ -492,10 +492,6 @@
return FALSE;
}
- /* Process the global hotkeys on #if 0 */
-#if 0
- WaitForSingleObject (ProcessInformation.hProcess, INFINITE);
-#else
RegisterHotKeys();
while (WaitForSingleObject (ProcessInformation.hProcess, 100) != WAIT_OBJECT_0)
@@ -510,7 +506,7 @@
}
UnregisterHotKeys();
-#endif
+
CloseHandle (ProcessInformation.hProcess);
CloseHandle (ProcessInformation.hThread);
@@ -543,7 +539,7 @@
ULONG AuthenticationPackage;
#endif
NTSTATUS Status;
-
+
hAppInstance = hInstance;
if(!RegisterLogonProcess(GetCurrentProcessId(), TRUE))
@@ -614,18 +610,13 @@
#if SUPPORT_CONSOLESTART
StartConsole = !StartIntoGUI();
- if(!StartConsole)
- {
#endif
- if(!InitializeSAS(WLSession))
+ if(!InitializeSAS(WLSession))
{
DbgPrint("WL: Failed to initialize SAS\n");
ExitProcess(2);
return 2;
}
-#if SUPPORT_CONSOLESTART
- }
-#endif
InitServices();
reactos/subsys/system/winlogon
diff -u -r1.3 -r1.4
--- winlogon.h 28 Mar 2004 12:21:41 -0000 1.3
+++ winlogon.h 12 Jul 2004 20:09:35 -0000 1.4
@@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-/* $Id: winlogon.h,v 1.3 2004/03/28 12:21:41 weiden Exp $
+/* $Id: winlogon.h,v 1.4 2004/07/12 20:09:35 gvg Exp $
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS winlogon
* FILE: subsys/system/winlogon/winlogon.h
@@ -110,7 +110,7 @@
typedef struct _MSGINAINSTANCE
{
- HANDLE hDllInstance;
+ HMODULE hDllInstance;
MSGINAFUNCTIONS Functions;
PVOID Context;
DWORD Version;
@@ -125,6 +125,7 @@
BOOL TaskManHotkey;
HWND SASWindow;
HWINSTA InteractiveWindowStation;
+ LPWSTR InteractiveWindowStationName;
HDESK ApplicationDesktop;
HDESK WinlogonDesktop;
HDESK ScreenSaverDesktop;
reactos/subsys/system/winlogon
diff -u -r1.4 -r1.5
--- wlx.c 28 Mar 2004 12:21:41 -0000 1.4
+++ wlx.c 12 Jul 2004 20:09:35 -0000 1.5
@@ -1,4 +1,4 @@
-/* $Id: wlx.c,v 1.4 2004/03/28 12:21:41 weiden Exp $
+/* $Id: wlx.c,v 1.5 2004/07/12 20:09:35 gvg Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@@ -16,6 +16,7 @@
#include <stdio.h>
#include <WinWlx.h>
#include <wchar.h>
+#include <reactos/winlogon.h>
#include "setup.h"
#include "winlogon.h"
@@ -493,7 +494,7 @@
GetMsGinaPath(WCHAR *path)
{
DWORD Status, Type, Size;
- HANDLE hKey;
+ HKEY hKey;
Status = RegOpenKeyEx(HKEY_LOCAL_MACHINE,
L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon",
@@ -652,7 +653,7 @@
WLSession->MsGina.Version = GinaDllVersion;
WLSession->SuppressStatus = FALSE;
- if(!WLSession->MsGina.Functions.WlxInitialize(WLSession->InteractiveWindowStation,
+ if(!WLSession->MsGina.Functions.WlxInitialize(WLSession->InteractiveWindowStationName,
(HANDLE)WLSession,
NULL,
(PVOID)&FunctionTable,
@@ -670,7 +671,9 @@
/*
* Create the interactive window station
*/
- Session->InteractiveWindowStation = CreateWindowStation(L"WinSta0", 0, GENERIC_ALL, NULL);
+ Session->InteractiveWindowStationName = L"WinSta0";
+ Session->InteractiveWindowStation = CreateWindowStation(Session->InteractiveWindowStationName,
+ 0, GENERIC_ALL, NULL);
if(!Session->InteractiveWindowStation)
{
DbgPrint("WL: Failed to create window station (0x%X)\n", GetLastError());
@@ -696,7 +699,7 @@
/*
* Create the winlogon desktop
*/
- Session->WinlogonDesktop = CreateDesktop(L"Winlogon",
+ Session->WinlogonDesktop = CreateDesktop(WINLOGON_DESKTOP,
NULL,
NULL,
0, /* FIXME: Set some flags */
reactos/include/reactos
diff -N winlogon.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ winlogon.h 12 Jul 2004 20:09:35 -0000 1.1
@@ -0,0 +1,28 @@
+/* $Id: winlogon.h,v 1.1 2004/07/12 20:09:35 gvg Exp $
+ *
+ * COPYRIGHT: See COPYING in the top level directory
+ * PROJECT: ReactOS kernel
+ * FILE: include/reactos/winlogon.h
+ * PURPOSE: Interface to winlogon
+ * PROGRAMMER: David Welch (welch@mcmail.com)
+ * REVISIONS:
+ * 1999-11-06 (ea)
+ * Moved from include/internal in include/reactos
+ * to be used by buildno.
+ * 2002-01-17 (ea)
+ * KERNEL_VERSION removed. Use
+ * reactos/buildno.h:KERNEL_VERSION_STR instead.
+ */
+
+#ifndef REACTOS_WINLOGON_H_INCLUDED
+#define REACTOS_WINLOGON_H_INCLUDED
+
+#define WINLOGON_DESKTOP L"Winlogon"
+#define WINLOGON_SAS_CLASS L"SAS window class"
+#define WINLOGON_SAS_TITLE L"SAS"
+
+#define PM_WINLOGON_EXITWINDOWS WM_APP
+
+#endif /* REACTOS_WINLOGON_H_INCLUDED */
+
+/* EOF */
reactos/subsys/win32k/ntuser
diff -u -r1.1 -r1.2
--- csr.c 28 May 2004 21:33:41 -0000 1.1
+++ csr.c 12 Jul 2004 20:09:35 -0000 1.2
@@ -1,4 +1,4 @@
-/* $Id: csr.c,v 1.1 2004/05/28 21:33:41 gvg Exp $
+/* $Id: csr.c,v 1.2 2004/07/12 20:09:35 gvg Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@@ -73,7 +73,7 @@
Status = Reply->Status;
}
- return STATUS_SUCCESS;
+ return Status;
}
/* EOF */
reactos/subsys/win32k/ntuser
diff -u -r1.82 -r1.83
--- misc.c 8 Jul 2004 14:36:18 -0000 1.82
+++ misc.c 12 Jul 2004 20:09:35 -0000 1.83
@@ -1,4 +1,4 @@
-/* $Id: misc.c,v 1.82 2004/07/08 14:36:18 ekohl Exp $
+/* $Id: misc.c,v 1.83 2004/07/12 20:09:35 gvg Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@@ -37,12 +37,14 @@
}
BOOL FASTCALL
-IntRegisterLogonProcess(DWORD dwProcessId, BOOL bRegister)
+IntRegisterLogonProcess(DWORD ProcessId, BOOL Register)
{
PEPROCESS Process;
NTSTATUS Status;
+ CSRSS_API_REQUEST Request;
+ CSRSS_API_REPLY Reply;
- Status = PsLookupProcessByProcessId((PVOID)dwProcessId,
+ Status = PsLookupProcessByProcessId((PVOID)ProcessId,
&Process);
if (!NT_SUCCESS(Status))
{
@@ -50,7 +52,7 @@
return FALSE;
}
- if (bRegister)
+ if (Register)
{
/* Register the logon process */
if (LogonProcess != NULL)
@@ -75,6 +77,17 @@
ObDereferenceObject(Process);
+ Request.Type = CSRSS_REGISTER_LOGON_PROCESS;
+ Request.Data.RegisterLogonProcessRequest.ProcessId = ProcessId;
+ Request.Data.RegisterLogonProcessRequest.Register = Register;
+
+ Status = CsrNotify(&Request, &Reply);
+ if (! NT_SUCCESS(Status))
+ {
+ DPRINT1("Failed to register logon process with CSRSS\n");
+ return FALSE;
+ }
+
return TRUE;
}
CVSspam 0.2.8