Author: hbelusca
Date: Sat Feb 7 01:18:40 2015
New Revision: 66186
URL:
http://svn.reactos.org/svn/reactos?rev=66186&view=rev
Log:
[WINLOGON][WIN32K]: Tend towards Win2k3-compatible winlogon logoff/shutdown messaging.
Something that needs to be fixed is that it is not winlogon that checks whether the app
requesting the shutdown has the correct rights, but it is win32k. I temporarily disable
this check in winlogon (it's not as if we introduced a security breach in ReactOS ^^)
Modified:
trunk/reactos/base/system/winlogon/sas.c
trunk/reactos/include/reactos/undocuser.h
trunk/reactos/include/reactos/winlogon.h
trunk/reactos/win32ss/user/ntuser/simplecall.c
Modified: trunk/reactos/base/system/winlogon/sas.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/winlogon/sas.c…
==============================================================================
--- trunk/reactos/base/system/winlogon/sas.c [iso-8859-1] (original)
+++ trunk/reactos/base/system/winlogon/sas.c [iso-8859-1] Sat Feb 7 01:18:40 2015
@@ -1148,6 +1148,7 @@
return TRUE;
}
+#if 0
static
NTSTATUS
CheckForShutdownPrivilege(
@@ -1206,6 +1207,7 @@
}
return STATUS_SUCCESS;
}
+#endif
BOOL
WINAPI
@@ -1329,6 +1331,38 @@
DoGenericAction(Session, WLX_SAS_ACTION_LOCK_WKSTA);
break;
}
+ case LN_LOGOFF:
+ {
+ UINT Flags = (UINT)lParam;
+ UINT Action = Flags & EWX_ACTION_MASK;
+ DWORD wlxAction;
+
+ /* Check parameters */
+ switch (Action)
+ {
+ case EWX_LOGOFF: wlxAction = WLX_SAS_ACTION_LOGOFF; break;
+ case EWX_SHUTDOWN: wlxAction = WLX_SAS_ACTION_SHUTDOWN; break;
+ case EWX_REBOOT: wlxAction = WLX_SAS_ACTION_SHUTDOWN_REBOOT;
break;
+ case EWX_POWEROFF: wlxAction = WLX_SAS_ACTION_SHUTDOWN_POWER_OFF;
break;
+ default:
+ {
+ ERR("Invalid ExitWindows action 0x%x\n", Action);
+ return STATUS_INVALID_PARAMETER;
+ }
+ }
+
+#if 0
+ // FIXME: This check must be done by Win32k, not by us!
+ if (WLX_SHUTTINGDOWN(wlxAction))
+ {
+ NTSTATUS Status = CheckForShutdownPrivilege(wParam);
+ if (!NT_SUCCESS(Status))
+ return Status;
+ }
+#endif
+ DoGenericAction(Session, wlxAction);
+ return 1;
+ }
default:
{
ERR("WM_LOGONNOTIFY case %d is unimplemented\n", wParam);
@@ -1349,35 +1383,6 @@
{
DispatchSAS(Session, (DWORD)wParam);
return TRUE;
- }
- case PM_WINLOGON_EXITWINDOWS:
- {
- UINT Flags = (UINT)lParam;
- UINT Action = Flags & EWX_ACTION_MASK;
- DWORD wlxAction;
-
- /* Check parameters */
- switch (Action)
- {
- case EWX_LOGOFF: wlxAction = WLX_SAS_ACTION_LOGOFF; break;
- case EWX_SHUTDOWN: wlxAction = WLX_SAS_ACTION_SHUTDOWN; break;
- case EWX_REBOOT: wlxAction = WLX_SAS_ACTION_SHUTDOWN_REBOOT; break;
- case EWX_POWEROFF: wlxAction = WLX_SAS_ACTION_SHUTDOWN_POWER_OFF; break;
- default:
- {
- ERR("Invalid ExitWindows action 0x%x\n", Action);
- return STATUS_INVALID_PARAMETER;
- }
- }
-
- if (WLX_SHUTTINGDOWN(wlxAction))
- {
- NTSTATUS Status = CheckForShutdownPrivilege((DWORD)wParam);
- if (!NT_SUCCESS(Status))
- return Status;
- }
- DoGenericAction(Session, wlxAction);
- return 1;
}
}
Modified: trunk/reactos/include/reactos/undocuser.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/undocuser.…
==============================================================================
--- trunk/reactos/include/reactos/undocuser.h [iso-8859-1] (original)
+++ trunk/reactos/include/reactos/undocuser.h [iso-8859-1] Sat Feb 7 01:18:40 2015
@@ -100,12 +100,14 @@
//
// Definitions used by WM_LOGONNOTIFY
//
+#define LN_LOGOFF 0x0
#define LN_SHELL_EXITED 0x2
#define LN_START_TASK_MANAGER 0x4
#define LN_LOCK_WORKSTATION 0x5
#define LN_UNLOCK_WORKSTATION 0x6
#define LN_MESSAGE_BEEP 0x9
#define LN_START_SCREENSAVE 0xA
+#define LN_LOGOFF_CANCELED 0xB
// From WinCE 6.0 Imm.h SDK
// Returns for ImmProcessHotKey
@@ -174,8 +176,8 @@
typedef struct _UAHOWP
{
- BYTE* MsgBitArray;
- DWORD Size;
+ BYTE* MsgBitArray;
+ DWORD Size;
} UAHOWP, *PUAHOWP;
#define UAH_HOOK_MESSAGE(uahowp, msg) uahowp.MsgBitArray[msg/8] |= (1 << (msg %
8));
@@ -184,47 +186,47 @@
typedef struct tagUSERAPIHOOK
{
- DWORD size;
- WNDPROC DefWindowProcA;
- WNDPROC DefWindowProcW;
- UAHOWP DefWndProcArray;
- FARPROC GetScrollInfo;
- FARPROC SetScrollInfo;
- FARPROC EnableScrollBar;
- FARPROC AdjustWindowRectEx;
- SETWINDOWRGN SetWindowRgn;
- WNDPROC_OWP PreWndProc;
- WNDPROC_OWP PostWndProc;
- UAHOWP WndProcArray;
- WNDPROC_OWP PreDefDlgProc;
- WNDPROC_OWP PostDefDlgProc;
- UAHOWP DlgProcArray;
- FARPROC GetSystemMetrics;
- FARPROC SystemParametersInfoA;
- FARPROC SystemParametersInfoW;
- FARPROC ForceResetUserApiHook;
- FARPROC DrawFrameControl;
- FARPROC DrawCaption;
- FARPROC MDIRedrawFrame;
- FARPROC GetRealWindowOwner;
+ DWORD size;
+ WNDPROC DefWindowProcA;
+ WNDPROC DefWindowProcW;
+ UAHOWP DefWndProcArray;
+ FARPROC GetScrollInfo;
+ FARPROC SetScrollInfo;
+ FARPROC EnableScrollBar;
+ FARPROC AdjustWindowRectEx;
+ SETWINDOWRGN SetWindowRgn;
+ WNDPROC_OWP PreWndProc;
+ WNDPROC_OWP PostWndProc;
+ UAHOWP WndProcArray;
+ WNDPROC_OWP PreDefDlgProc;
+ WNDPROC_OWP PostDefDlgProc;
+ UAHOWP DlgProcArray;
+ FARPROC GetSystemMetrics;
+ FARPROC SystemParametersInfoA;
+ FARPROC SystemParametersInfoW;
+ FARPROC ForceResetUserApiHook;
+ FARPROC DrawFrameControl;
+ FARPROC DrawCaption;
+ FARPROC MDIRedrawFrame;
+ FARPROC GetRealWindowOwner;
} USERAPIHOOK, *PUSERAPIHOOK;
typedef enum _UAPIHK
{
- uahLoadInit,
- uahStop,
- uahShutdown
+ uahLoadInit,
+ uahStop,
+ uahShutdown
} UAPIHK, *PUAPIHK;
typedef BOOL(CALLBACK *USERAPIHOOKPROC)(UAPIHK State, PUSERAPIHOOK puah);
typedef struct _USERAPIHOOKINFO
{
- DWORD m_size;
- LPCWSTR m_dllname1;
- LPCWSTR m_funname1;
- LPCWSTR m_dllname2;
- LPCWSTR m_funname2;
+ DWORD m_size;
+ LPCWSTR m_dllname1;
+ LPCWSTR m_funname1;
+ LPCWSTR m_dllname2;
+ LPCWSTR m_funname2;
} USERAPIHOOKINFO,*PUSERAPIHOOKINFO;
#if (WINVER == _WIN32_WINNT_WINXP)
Modified: trunk/reactos/include/reactos/winlogon.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/winlogon.h…
==============================================================================
--- trunk/reactos/include/reactos/winlogon.h [iso-8859-1] (original)
+++ trunk/reactos/include/reactos/winlogon.h [iso-8859-1] Sat Feb 7 01:18:40 2015
@@ -9,8 +9,6 @@
#ifndef REACTOS_WINLOGON_H_INCLUDED
#define REACTOS_WINLOGON_H_INCLUDED
-#define PM_WINLOGON_EXITWINDOWS WM_APP
-
#define EWX_INTERNAL_FLAG 0x10000
#define EWX_INTERNAL_KILL_USER_APPS (EWX_INTERNAL_FLAG | 0x100)
#define EWX_INTERNAL_KILL_ALL_APPS (EWX_INTERNAL_FLAG | 0x200)
Modified: trunk/reactos/win32ss/user/ntuser/simplecall.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/simple…
==============================================================================
--- trunk/reactos/win32ss/user/ntuser/simplecall.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/ntuser/simplecall.c [iso-8859-1] Sat Feb 7 01:18:40 2015
@@ -449,13 +449,18 @@
case TWOPARAM_ROUTINE_UNHOOKWINDOWSHOOK:
RETURN( IntUnhookWindowsHook((int)Param1, (HOOKPROC)Param2));
+
case TWOPARAM_ROUTINE_EXITREACTOS:
+ {
+ UNREFERENCED_PARAMETER(Param1 /* ProcessId */);
+
if(hwndSAS == NULL)
{
ASSERT(hwndSAS);
RETURN(STATUS_NOT_FOUND);
}
- RETURN( co_IntSendMessage (hwndSAS, PM_WINLOGON_EXITWINDOWS, (WPARAM) Param1,
(LPARAM)Param2));
+ RETURN(co_IntSendMessage(hwndSAS, WM_LOGONNOTIFY, LN_LOGOFF, Param2 /* Flags
*/));
+ }
}
ERR("Calling invalid routine number 0x%x in NtUserCallTwoParam(), Param1=0x%x
Parm2=0x%x\n",
Routine, Param1, Param2);