mirror of
https://github.com/reactos/reactos.git
synced 2025-04-22 13:10:39 +00:00
[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 ^^)
svn path=/trunk/; revision=66186
This commit is contained in:
parent
94c27d3aeb
commit
3e714d22fb
4 changed files with 75 additions and 65 deletions
|
@ -1148,6 +1148,7 @@ UnregisterHotKeys(
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
static
|
static
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
CheckForShutdownPrivilege(
|
CheckForShutdownPrivilege(
|
||||||
|
@ -1206,6 +1207,7 @@ CheckForShutdownPrivilege(
|
||||||
}
|
}
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
BOOL
|
BOOL
|
||||||
WINAPI
|
WINAPI
|
||||||
|
@ -1329,6 +1331,38 @@ SASWindowProc(
|
||||||
DoGenericAction(Session, WLX_SAS_ACTION_LOCK_WKSTA);
|
DoGenericAction(Session, WLX_SAS_ACTION_LOCK_WKSTA);
|
||||||
break;
|
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:
|
default:
|
||||||
{
|
{
|
||||||
ERR("WM_LOGONNOTIFY case %d is unimplemented\n", wParam);
|
ERR("WM_LOGONNOTIFY case %d is unimplemented\n", wParam);
|
||||||
|
@ -1350,35 +1384,6 @@ SASWindowProc(
|
||||||
DispatchSAS(Session, (DWORD)wParam);
|
DispatchSAS(Session, (DWORD)wParam);
|
||||||
return TRUE;
|
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return DefWindowProc(hwndDlg, uMsg, wParam, lParam);
|
return DefWindowProc(hwndDlg, uMsg, wParam, lParam);
|
||||||
|
|
|
@ -100,12 +100,14 @@ extern "C" {
|
||||||
//
|
//
|
||||||
// Definitions used by WM_LOGONNOTIFY
|
// Definitions used by WM_LOGONNOTIFY
|
||||||
//
|
//
|
||||||
|
#define LN_LOGOFF 0x0
|
||||||
#define LN_SHELL_EXITED 0x2
|
#define LN_SHELL_EXITED 0x2
|
||||||
#define LN_START_TASK_MANAGER 0x4
|
#define LN_START_TASK_MANAGER 0x4
|
||||||
#define LN_LOCK_WORKSTATION 0x5
|
#define LN_LOCK_WORKSTATION 0x5
|
||||||
#define LN_UNLOCK_WORKSTATION 0x6
|
#define LN_UNLOCK_WORKSTATION 0x6
|
||||||
#define LN_MESSAGE_BEEP 0x9
|
#define LN_MESSAGE_BEEP 0x9
|
||||||
#define LN_START_SCREENSAVE 0xA
|
#define LN_START_SCREENSAVE 0xA
|
||||||
|
#define LN_LOGOFF_CANCELED 0xB
|
||||||
|
|
||||||
// From WinCE 6.0 Imm.h SDK
|
// From WinCE 6.0 Imm.h SDK
|
||||||
// Returns for ImmProcessHotKey
|
// Returns for ImmProcessHotKey
|
||||||
|
@ -174,8 +176,8 @@ typedef int (WINAPI *SETWINDOWRGN)(HWND hWnd, HRGN hRgn, BOOL bRedraw);
|
||||||
|
|
||||||
typedef struct _UAHOWP
|
typedef struct _UAHOWP
|
||||||
{
|
{
|
||||||
BYTE* MsgBitArray;
|
BYTE* MsgBitArray;
|
||||||
DWORD Size;
|
DWORD Size;
|
||||||
} UAHOWP, *PUAHOWP;
|
} UAHOWP, *PUAHOWP;
|
||||||
|
|
||||||
#define UAH_HOOK_MESSAGE(uahowp, msg) uahowp.MsgBitArray[msg/8] |= (1 << (msg % 8));
|
#define UAH_HOOK_MESSAGE(uahowp, msg) uahowp.MsgBitArray[msg/8] |= (1 << (msg % 8));
|
||||||
|
@ -184,47 +186,47 @@ typedef struct _UAHOWP
|
||||||
|
|
||||||
typedef struct tagUSERAPIHOOK
|
typedef struct tagUSERAPIHOOK
|
||||||
{
|
{
|
||||||
DWORD size;
|
DWORD size;
|
||||||
WNDPROC DefWindowProcA;
|
WNDPROC DefWindowProcA;
|
||||||
WNDPROC DefWindowProcW;
|
WNDPROC DefWindowProcW;
|
||||||
UAHOWP DefWndProcArray;
|
UAHOWP DefWndProcArray;
|
||||||
FARPROC GetScrollInfo;
|
FARPROC GetScrollInfo;
|
||||||
FARPROC SetScrollInfo;
|
FARPROC SetScrollInfo;
|
||||||
FARPROC EnableScrollBar;
|
FARPROC EnableScrollBar;
|
||||||
FARPROC AdjustWindowRectEx;
|
FARPROC AdjustWindowRectEx;
|
||||||
SETWINDOWRGN SetWindowRgn;
|
SETWINDOWRGN SetWindowRgn;
|
||||||
WNDPROC_OWP PreWndProc;
|
WNDPROC_OWP PreWndProc;
|
||||||
WNDPROC_OWP PostWndProc;
|
WNDPROC_OWP PostWndProc;
|
||||||
UAHOWP WndProcArray;
|
UAHOWP WndProcArray;
|
||||||
WNDPROC_OWP PreDefDlgProc;
|
WNDPROC_OWP PreDefDlgProc;
|
||||||
WNDPROC_OWP PostDefDlgProc;
|
WNDPROC_OWP PostDefDlgProc;
|
||||||
UAHOWP DlgProcArray;
|
UAHOWP DlgProcArray;
|
||||||
FARPROC GetSystemMetrics;
|
FARPROC GetSystemMetrics;
|
||||||
FARPROC SystemParametersInfoA;
|
FARPROC SystemParametersInfoA;
|
||||||
FARPROC SystemParametersInfoW;
|
FARPROC SystemParametersInfoW;
|
||||||
FARPROC ForceResetUserApiHook;
|
FARPROC ForceResetUserApiHook;
|
||||||
FARPROC DrawFrameControl;
|
FARPROC DrawFrameControl;
|
||||||
FARPROC DrawCaption;
|
FARPROC DrawCaption;
|
||||||
FARPROC MDIRedrawFrame;
|
FARPROC MDIRedrawFrame;
|
||||||
FARPROC GetRealWindowOwner;
|
FARPROC GetRealWindowOwner;
|
||||||
} USERAPIHOOK, *PUSERAPIHOOK;
|
} USERAPIHOOK, *PUSERAPIHOOK;
|
||||||
|
|
||||||
typedef enum _UAPIHK
|
typedef enum _UAPIHK
|
||||||
{
|
{
|
||||||
uahLoadInit,
|
uahLoadInit,
|
||||||
uahStop,
|
uahStop,
|
||||||
uahShutdown
|
uahShutdown
|
||||||
} UAPIHK, *PUAPIHK;
|
} UAPIHK, *PUAPIHK;
|
||||||
|
|
||||||
typedef BOOL(CALLBACK *USERAPIHOOKPROC)(UAPIHK State, PUSERAPIHOOK puah);
|
typedef BOOL(CALLBACK *USERAPIHOOKPROC)(UAPIHK State, PUSERAPIHOOK puah);
|
||||||
|
|
||||||
typedef struct _USERAPIHOOKINFO
|
typedef struct _USERAPIHOOKINFO
|
||||||
{
|
{
|
||||||
DWORD m_size;
|
DWORD m_size;
|
||||||
LPCWSTR m_dllname1;
|
LPCWSTR m_dllname1;
|
||||||
LPCWSTR m_funname1;
|
LPCWSTR m_funname1;
|
||||||
LPCWSTR m_dllname2;
|
LPCWSTR m_dllname2;
|
||||||
LPCWSTR m_funname2;
|
LPCWSTR m_funname2;
|
||||||
} USERAPIHOOKINFO,*PUSERAPIHOOKINFO;
|
} USERAPIHOOKINFO,*PUSERAPIHOOKINFO;
|
||||||
|
|
||||||
#if (WINVER == _WIN32_WINNT_WINXP)
|
#if (WINVER == _WIN32_WINNT_WINXP)
|
||||||
|
|
|
@ -9,8 +9,6 @@
|
||||||
#ifndef REACTOS_WINLOGON_H_INCLUDED
|
#ifndef REACTOS_WINLOGON_H_INCLUDED
|
||||||
#define REACTOS_WINLOGON_H_INCLUDED
|
#define REACTOS_WINLOGON_H_INCLUDED
|
||||||
|
|
||||||
#define PM_WINLOGON_EXITWINDOWS WM_APP
|
|
||||||
|
|
||||||
#define EWX_INTERNAL_FLAG 0x10000
|
#define EWX_INTERNAL_FLAG 0x10000
|
||||||
#define EWX_INTERNAL_KILL_USER_APPS (EWX_INTERNAL_FLAG | 0x100)
|
#define EWX_INTERNAL_KILL_USER_APPS (EWX_INTERNAL_FLAG | 0x100)
|
||||||
#define EWX_INTERNAL_KILL_ALL_APPS (EWX_INTERNAL_FLAG | 0x200)
|
#define EWX_INTERNAL_KILL_ALL_APPS (EWX_INTERNAL_FLAG | 0x200)
|
||||||
|
|
|
@ -449,13 +449,18 @@ NtUserCallTwoParam(
|
||||||
|
|
||||||
case TWOPARAM_ROUTINE_UNHOOKWINDOWSHOOK:
|
case TWOPARAM_ROUTINE_UNHOOKWINDOWSHOOK:
|
||||||
RETURN( IntUnhookWindowsHook((int)Param1, (HOOKPROC)Param2));
|
RETURN( IntUnhookWindowsHook((int)Param1, (HOOKPROC)Param2));
|
||||||
|
|
||||||
case TWOPARAM_ROUTINE_EXITREACTOS:
|
case TWOPARAM_ROUTINE_EXITREACTOS:
|
||||||
|
{
|
||||||
|
UNREFERENCED_PARAMETER(Param1 /* ProcessId */);
|
||||||
|
|
||||||
if(hwndSAS == NULL)
|
if(hwndSAS == NULL)
|
||||||
{
|
{
|
||||||
ASSERT(hwndSAS);
|
ASSERT(hwndSAS);
|
||||||
RETURN(STATUS_NOT_FOUND);
|
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",
|
ERR("Calling invalid routine number 0x%x in NtUserCallTwoParam(), Param1=0x%x Parm2=0x%x\n",
|
||||||
Routine, Param1, Param2);
|
Routine, Param1, Param2);
|
||||||
|
|
Loading…
Reference in a new issue