mirror of
https://github.com/reactos/reactos.git
synced 2025-04-22 05:00:27 +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;
|
||||
}
|
||||
|
||||
#if 0
|
||||
static
|
||||
NTSTATUS
|
||||
CheckForShutdownPrivilege(
|
||||
|
@ -1206,6 +1207,7 @@ CheckForShutdownPrivilege(
|
|||
}
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
#endif
|
||||
|
||||
BOOL
|
||||
WINAPI
|
||||
|
@ -1329,6 +1331,38 @@ SASWindowProc(
|
|||
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);
|
||||
|
@ -1350,35 +1384,6 @@ SASWindowProc(
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
||||
return DefWindowProc(hwndDlg, uMsg, wParam, lParam);
|
||||
|
|
|
@ -100,12 +100,14 @@ extern "C" {
|
|||
//
|
||||
// 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 int (WINAPI *SETWINDOWRGN)(HWND hWnd, HRGN hRgn, BOOL bRedraw);
|
|||
|
||||
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 _UAHOWP
|
|||
|
||||
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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -449,13 +449,18 @@ NtUserCallTwoParam(
|
|||
|
||||
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);
|
||||
|
|
Loading…
Reference in a new issue