mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 17:44:45 +00:00
When sending WM_WINDOWPOSCHANGING and WM_WINDOWPOSCHANGED messages from
Win32k, make sure the WINDOWPOS structure referenced by lParam is located in user space svn path=/trunk/; revision=4702
This commit is contained in:
parent
9ad263f04e
commit
b41ecb619a
6 changed files with 104 additions and 21 deletions
|
@ -1,13 +1,15 @@
|
|||
#ifndef __INCLUDE_USER32_CALLBACK_H
|
||||
#define __INCLUDE_USER32_CALLBACK_H
|
||||
|
||||
#define USER32_CALLBACK_WINDOWPROC (0)
|
||||
#define USER32_CALLBACK_SENDASYNCPROC (1)
|
||||
#define USER32_CALLBACK_SENDNCCREATE (2)
|
||||
#define USER32_CALLBACK_SENDNCCALCSIZE (3)
|
||||
#define USER32_CALLBACK_SENDCREATE (4)
|
||||
#define USER32_CALLBACK_SENDGETMINMAXINFO (5)
|
||||
#define USER32_CALLBACK_MAXIMUM (6)
|
||||
#define USER32_CALLBACK_WINDOWPROC (0)
|
||||
#define USER32_CALLBACK_SENDASYNCPROC (1)
|
||||
#define USER32_CALLBACK_SENDNCCREATE (2)
|
||||
#define USER32_CALLBACK_SENDNCCALCSIZE (3)
|
||||
#define USER32_CALLBACK_SENDCREATE (4)
|
||||
#define USER32_CALLBACK_SENDGETMINMAXINFO (5)
|
||||
#define USER32_CALLBACK_SENDWINDOWPOSCHANGING (6)
|
||||
#define USER32_CALLBACK_SENDWINDOWPOSCHANGED (7)
|
||||
#define USER32_CALLBACK_MAXIMUM (7)
|
||||
|
||||
typedef struct _WINDOWPROC_CALLBACK_ARGUMENTS
|
||||
{
|
||||
|
@ -69,6 +71,18 @@ typedef struct _SENDGETMINMAXINFO_CALLBACK_RESULT
|
|||
MINMAXINFO MinMaxInfo;
|
||||
} SENDGETMINMAXINFO_CALLBACK_RESULT, *PSENDGETMINMAXINFO_CALLBACK_RESULT;
|
||||
|
||||
typedef struct _SENDWINDOWPOSCHANGING_CALLBACK_ARGUMENTS
|
||||
{
|
||||
HWND Wnd;
|
||||
WINDOWPOS WindowPos;
|
||||
} SENDWINDOWPOSCHANGING_CALLBACK_ARGUMENTS, *PSENDWINDOWPOSCHANGING_CALLBACK_ARGUMENTS;
|
||||
|
||||
typedef struct _SENDWINDOWPOSCHANGED_CALLBACK_ARGUMENTS
|
||||
{
|
||||
HWND Wnd;
|
||||
WINDOWPOS WindowPos;
|
||||
} SENDWINDOWPOSCHANGED_CALLBACK_ARGUMENTS, *PSENDWINDOWPOSCHANGED_CALLBACK_ARGUMENTS;
|
||||
|
||||
NTSTATUS STDCALL
|
||||
User32CallWindowProcFromKernel(PVOID Arguments, ULONG ArgumentLength);
|
||||
NTSTATUS STDCALL
|
||||
|
@ -81,5 +95,9 @@ NTSTATUS STDCALL
|
|||
User32SendGETMINMAXINFOMessageForKernel(PVOID Arguments, ULONG ArgumentLength);
|
||||
NTSTATUS STDCALL
|
||||
User32SendNCCALCSIZEMessageForKernel(PVOID Arguments, ULONG ArgumentLength);
|
||||
NTSTATUS STDCALL
|
||||
User32SendWINDOWPOSCHANGINGMessageForKernel(PVOID Arguments, ULONG ArgumentLength);
|
||||
NTSTATUS STDCALL
|
||||
User32SendWINDOWPOSCHANGEDMessageForKernel(PVOID Arguments, ULONG ArgumentLength);
|
||||
|
||||
#endif /* __INCLUDE_USER32_CALLBACK_H */
|
||||
|
|
|
@ -33,6 +33,10 @@ Init(VOID)
|
|||
(PVOID)User32SendGETMINMAXINFOMessageForKernel;
|
||||
NtCurrentPeb()->KernelCallbackTable[USER32_CALLBACK_SENDNCCALCSIZE] =
|
||||
(PVOID)User32SendNCCALCSIZEMessageForKernel;
|
||||
NtCurrentPeb()->KernelCallbackTable[USER32_CALLBACK_SENDWINDOWPOSCHANGING] =
|
||||
(PVOID)User32SendWINDOWPOSCHANGINGMessageForKernel;
|
||||
NtCurrentPeb()->KernelCallbackTable[USER32_CALLBACK_SENDWINDOWPOSCHANGED] =
|
||||
(PVOID)User32SendWINDOWPOSCHANGEDMessageForKernel;
|
||||
|
||||
UserSetupInternalPos();
|
||||
|
||||
|
|
|
@ -29,4 +29,10 @@ W32kSendNCCALCSIZEMessage(HWND Wnd, BOOL Validate, PRECT Rect,
|
|||
LRESULT STDCALL
|
||||
W32kSendGETMINMAXINFOMessage(HWND Wnd, MINMAXINFO* MinMaxInfo);
|
||||
|
||||
LRESULT STDCALL
|
||||
W32kSendWINDOWPOSCHANGINGMessage(HWND Wnd, WINDOWPOS* WindowPos);
|
||||
|
||||
LRESULT STDCALL
|
||||
W32kSendWINDOWPOSCHANGEDMessage(HWND Wnd, WINDOWPOS* WindowPos);
|
||||
|
||||
#endif /* __SUBSYS_WIN32K_INCLUDE_CALLBACK_H */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: callback.c,v 1.7 2002/08/31 23:18:46 dwelch Exp $
|
||||
/* $Id: callback.c,v 1.8 2003/05/17 14:30:28 gvg Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -207,6 +207,56 @@ W32kSendGETMINMAXINFOMessage(HWND Wnd, MINMAXINFO* MinMaxInfo)
|
|||
return(Result.Result);
|
||||
}
|
||||
|
||||
LRESULT STDCALL
|
||||
W32kSendWINDOWPOSCHANGINGMessage(HWND Wnd, WINDOWPOS* WindowPos)
|
||||
{
|
||||
SENDWINDOWPOSCHANGING_CALLBACK_ARGUMENTS Arguments;
|
||||
LRESULT Result;
|
||||
NTSTATUS Status;
|
||||
PVOID ResultPointer;
|
||||
ULONG ResultLength;
|
||||
|
||||
Arguments.Wnd = Wnd;
|
||||
Arguments.WindowPos = *WindowPos;
|
||||
ResultPointer = &Result;
|
||||
ResultLength = sizeof(LRESULT);
|
||||
Status = NtW32Call(USER32_CALLBACK_SENDWINDOWPOSCHANGING,
|
||||
&Arguments,
|
||||
sizeof(SENDWINDOWPOSCHANGING_CALLBACK_ARGUMENTS),
|
||||
&ResultPointer,
|
||||
&ResultLength);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
return(Result);
|
||||
}
|
||||
|
||||
LRESULT STDCALL
|
||||
W32kSendWINDOWPOSCHANGEDMessage(HWND Wnd, WINDOWPOS* WindowPos)
|
||||
{
|
||||
SENDWINDOWPOSCHANGED_CALLBACK_ARGUMENTS Arguments;
|
||||
LRESULT Result;
|
||||
NTSTATUS Status;
|
||||
PVOID ResultPointer;
|
||||
ULONG ResultLength;
|
||||
|
||||
Arguments.Wnd = Wnd;
|
||||
Arguments.WindowPos = *WindowPos;
|
||||
ResultPointer = &Result;
|
||||
ResultLength = sizeof(LRESULT);
|
||||
Status = NtW32Call(USER32_CALLBACK_SENDWINDOWPOSCHANGED,
|
||||
&Arguments,
|
||||
sizeof(SENDWINDOWPOSCHANGED_CALLBACK_ARGUMENTS),
|
||||
&ResultPointer,
|
||||
&ResultLength);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
return(Result);
|
||||
}
|
||||
|
||||
LRESULT STDCALL
|
||||
W32kCallTrampolineWindowProc(WNDPROC Proc,
|
||||
HWND Wnd,
|
||||
|
@ -217,26 +267,32 @@ W32kCallTrampolineWindowProc(WNDPROC Proc,
|
|||
switch (Message)
|
||||
{
|
||||
case WM_NCCREATE:
|
||||
return(W32kSendNCCREATEMessage(Wnd, (CREATESTRUCTW*)lParam));
|
||||
return W32kSendNCCREATEMessage(Wnd, (CREATESTRUCTW*)lParam);
|
||||
|
||||
case WM_CREATE:
|
||||
return(W32kSendCREATEMessage(Wnd, (CREATESTRUCTW*)lParam));
|
||||
return W32kSendCREATEMessage(Wnd, (CREATESTRUCTW*)lParam);
|
||||
|
||||
case WM_GETMINMAXINFO:
|
||||
return(W32kSendGETMINMAXINFOMessage(Wnd, (MINMAXINFO*)lParam));
|
||||
return W32kSendGETMINMAXINFOMessage(Wnd, (MINMAXINFO*)lParam);
|
||||
|
||||
case WM_NCCALCSIZE:
|
||||
{
|
||||
if (wParam)
|
||||
{
|
||||
return(W32kSendNCCALCSIZEMessage(Wnd, TRUE, NULL,
|
||||
(NCCALCSIZE_PARAMS*)lParam));
|
||||
return W32kSendNCCALCSIZEMessage(Wnd, TRUE, NULL,
|
||||
(NCCALCSIZE_PARAMS*)lParam);
|
||||
}
|
||||
else
|
||||
{
|
||||
return(W32kSendNCCALCSIZEMessage(Wnd, FALSE, (RECT*)lParam, NULL));
|
||||
return W32kSendNCCALCSIZEMessage(Wnd, FALSE, (RECT*)lParam, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
case WM_WINDOWPOSCHANGING:
|
||||
return W32kSendWINDOWPOSCHANGINGMessage(Wnd, (WINDOWPOS*) lParam);
|
||||
|
||||
case WM_WINDOWPOSCHANGED:
|
||||
return W32kSendWINDOWPOSCHANGEDMessage(Wnd, (WINDOWPOS*) lParam);
|
||||
|
||||
default:
|
||||
return(W32kCallWindowProc(Proc, Wnd, Message, wParam, lParam));
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: window.c,v 1.43 2003/05/17 09:20:23 gvg Exp $
|
||||
/* $Id: window.c,v 1.44 2003/05/17 14:30:28 gvg Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -879,7 +879,7 @@ NtUserMoveWindow(
|
|||
pWinPos.cy = pWinPos.x + nHeight;
|
||||
else
|
||||
pWinPos.cy = pWinPos.y + NtUserGetSystemMetrics(SM_CYMIN);
|
||||
NtUserSendMessage(hWnd, WM_WINDOWPOSCHANGING, 0, (LPARAM)&pWinPos);
|
||||
W32kSendWINDOWPOSCHANGINGMessage(Window->Self, &pWinPos);
|
||||
|
||||
Window->WindowRect.top = Window->ClientRect.top = pWinPos.y;
|
||||
Window->WindowRect.left = Window->ClientRect.left = pWinPos.x;
|
||||
|
@ -908,7 +908,7 @@ NtUserMoveWindow(
|
|||
Window->ClientRect.top += NtUserGetSystemMetrics(SM_CYMENU);
|
||||
}
|
||||
|
||||
NtUserSendMessage(hWnd, WM_WINDOWPOSCHANGED, 0, (LPARAM)&pWinPos);
|
||||
W32kSendWINDOWPOSCHANGEDMessage(Window->Self, &pWinPos);
|
||||
|
||||
NtUserSendMessage(hWnd, WM_MOVE, 0, MAKEWORD(Window->ClientRect.left,
|
||||
Window->ClientRect.top));
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: winpos.c,v 1.7 2002/11/01 11:29:58 dwelch Exp $
|
||||
/* $Id: winpos.c,v 1.8 2003/05/17 14:30:28 gvg Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -339,8 +339,7 @@ WinPosDoWinPosChanging(PWINDOW_OBJECT WindowObject,
|
|||
{
|
||||
if (!(WinPos->flags & SWP_NOSENDCHANGING))
|
||||
{
|
||||
NtUserSendMessage(WindowObject->Self, WM_WINDOWPOSCHANGING, 0,
|
||||
(LPARAM)WinPos);
|
||||
W32kSendWINDOWPOSCHANGINGMessage(WindowObject->Self, WinPos);
|
||||
}
|
||||
|
||||
*WindowRect = WindowObject->WindowRect;
|
||||
|
@ -538,7 +537,7 @@ WinPosSetWindowPos(HWND Wnd, HWND WndInsertAfter, INT x, INT y, INT cx,
|
|||
}
|
||||
|
||||
/* FIXME: Check some conditions before doing this. */
|
||||
NtUserSendMessage(WinPos.hwnd, WM_WINDOWPOSCHANGED, 0, (LPARAM)&WinPos);
|
||||
W32kSendWINDOWPOSCHANGEDMessage(Window->Self, &WinPos);
|
||||
|
||||
ObmDereferenceObject(Window);
|
||||
return(TRUE);
|
||||
|
|
Loading…
Reference in a new issue