2003-05-18 17:16:18 +00:00
|
|
|
/*
|
|
|
|
* ReactOS W32 Subsystem
|
|
|
|
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 ReactOS Team
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
*/
|
|
|
|
/* $Id: callback.c,v 1.9 2003/05/18 17:16:17 ea Exp $
|
2002-01-27 14:47:44 +00:00
|
|
|
*
|
|
|
|
* COPYRIGHT: See COPYING in the top level directory
|
|
|
|
* PROJECT: ReactOS kernel
|
|
|
|
* PURPOSE: Window classes
|
|
|
|
* FILE: subsys/win32k/ntuser/wndproc.c
|
|
|
|
* PROGRAMER: Casper S. Hornstrup (chorns@users.sourceforge.net)
|
|
|
|
* REVISION HISTORY:
|
|
|
|
* 06-06-2001 CSH Created
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* INCLUDES ******************************************************************/
|
|
|
|
|
|
|
|
#include <ddk/ntddk.h>
|
|
|
|
#include <win32k/win32k.h>
|
|
|
|
#include <win32k/userobj.h>
|
|
|
|
#include <include/class.h>
|
|
|
|
#include <include/error.h>
|
|
|
|
#include <include/winsta.h>
|
2003-05-18 17:16:18 +00:00
|
|
|
#include <include/window.h>
|
2002-01-27 14:47:44 +00:00
|
|
|
#include <include/msgqueue.h>
|
|
|
|
#include <user32/callback.h>
|
2002-08-31 23:18:47 +00:00
|
|
|
#include <include/callback.h>
|
2002-01-27 14:47:44 +00:00
|
|
|
|
|
|
|
#define NDEBUG
|
|
|
|
#include <debug.h>
|
|
|
|
|
|
|
|
/* FUNCTIONS *****************************************************************/
|
|
|
|
|
2002-05-06 22:20:32 +00:00
|
|
|
VOID STDCALL
|
|
|
|
W32kCallSentMessageCallback(SENDASYNCPROC CompletionCallback,
|
|
|
|
HWND hWnd,
|
|
|
|
UINT Msg,
|
|
|
|
ULONG_PTR CompletionCallbackContext,
|
|
|
|
LRESULT Result)
|
|
|
|
{
|
2002-07-04 19:56:38 +00:00
|
|
|
SENDASYNCPROC_CALLBACK_ARGUMENTS Arguments;
|
|
|
|
NTSTATUS Status;
|
|
|
|
|
|
|
|
Arguments.Callback = CompletionCallback;
|
|
|
|
Arguments.Wnd = hWnd;
|
|
|
|
Arguments.Msg = Msg;
|
|
|
|
Arguments.Context = CompletionCallbackContext;
|
|
|
|
Arguments.Result = Result;
|
|
|
|
Status = NtW32Call(USER32_CALLBACK_SENDASYNCPROC,
|
|
|
|
&Arguments,
|
|
|
|
sizeof(SENDASYNCPROC_CALLBACK_ARGUMENTS),
|
|
|
|
NULL,
|
|
|
|
NULL);
|
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
return;
|
2002-05-06 22:20:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
LRESULT STDCALL
|
2002-07-04 19:56:38 +00:00
|
|
|
W32kSendNCCALCSIZEMessage(HWND Wnd, BOOL Validate, PRECT Rect,
|
|
|
|
NCCALCSIZE_PARAMS* Params)
|
2002-05-06 22:20:32 +00:00
|
|
|
{
|
2002-07-04 19:56:38 +00:00
|
|
|
SENDNCCALCSIZEMESSAGE_CALLBACK_ARGUMENTS Arguments;
|
|
|
|
SENDNCCALCSIZEMESSAGE_CALLBACK_RESULT Result;
|
|
|
|
NTSTATUS Status;
|
|
|
|
PVOID ResultPointer;
|
|
|
|
ULONG ResultLength;
|
|
|
|
|
|
|
|
Arguments.Wnd = Wnd;
|
|
|
|
Arguments.Validate = Validate;
|
|
|
|
if (!Validate)
|
|
|
|
{
|
|
|
|
Arguments.Rect = *Rect;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Arguments.Params = *Params;
|
|
|
|
}
|
|
|
|
ResultPointer = &Result;
|
|
|
|
ResultLength = sizeof(SENDNCCALCSIZEMESSAGE_CALLBACK_RESULT);
|
|
|
|
Status = NtW32Call(USER32_CALLBACK_SENDNCCALCSIZE,
|
|
|
|
&Arguments,
|
|
|
|
sizeof(SENDNCCALCSIZEMESSAGE_CALLBACK_ARGUMENTS),
|
|
|
|
&ResultPointer,
|
|
|
|
&ResultLength);
|
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
return(0);
|
|
|
|
}
|
|
|
|
if (!Validate)
|
|
|
|
{
|
|
|
|
*Rect = Result.Rect;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
*Params = Result.Params;
|
|
|
|
}
|
|
|
|
return(Result.Result);
|
2002-05-06 22:20:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
LRESULT STDCALL
|
2002-07-17 21:04:57 +00:00
|
|
|
W32kSendCREATEMessage(HWND Wnd, CREATESTRUCTW* CreateStruct)
|
2002-05-06 22:20:32 +00:00
|
|
|
{
|
2002-06-18 21:51:11 +00:00
|
|
|
SENDCREATEMESSAGE_CALLBACK_ARGUMENTS Arguments;
|
|
|
|
LRESULT Result;
|
|
|
|
NTSTATUS Status;
|
|
|
|
PVOID ResultPointer;
|
2002-06-21 04:14:07 +00:00
|
|
|
ULONG ResultLength;
|
2002-06-18 21:51:11 +00:00
|
|
|
|
|
|
|
Arguments.Wnd = Wnd;
|
|
|
|
Arguments.CreateStruct = *CreateStruct;
|
|
|
|
ResultPointer = &Result;
|
|
|
|
ResultLength = sizeof(LRESULT);
|
|
|
|
Status = NtW32Call(USER32_CALLBACK_SENDCREATE,
|
|
|
|
&Arguments,
|
|
|
|
sizeof(SENDCREATEMESSAGE_CALLBACK_ARGUMENTS),
|
|
|
|
&ResultPointer,
|
|
|
|
&ResultLength);
|
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
return(0);
|
|
|
|
}
|
|
|
|
return(Result);
|
2002-05-06 22:20:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
LRESULT STDCALL
|
2002-07-17 21:04:57 +00:00
|
|
|
W32kSendNCCREATEMessage(HWND Wnd, CREATESTRUCTW* CreateStruct)
|
2002-05-06 22:20:32 +00:00
|
|
|
{
|
|
|
|
SENDNCCREATEMESSAGE_CALLBACK_ARGUMENTS Arguments;
|
|
|
|
LRESULT Result;
|
|
|
|
NTSTATUS Status;
|
|
|
|
PVOID ResultPointer;
|
2002-06-21 04:14:07 +00:00
|
|
|
ULONG ResultLength;
|
2002-05-06 22:20:32 +00:00
|
|
|
|
|
|
|
Arguments.Wnd = Wnd;
|
|
|
|
Arguments.CreateStruct = *CreateStruct;
|
|
|
|
ResultPointer = &Result;
|
|
|
|
ResultLength = sizeof(LRESULT);
|
2002-06-18 21:51:11 +00:00
|
|
|
Status = NtW32Call(USER32_CALLBACK_SENDNCCREATE,
|
2002-05-06 22:20:32 +00:00
|
|
|
&Arguments,
|
2002-06-18 21:51:11 +00:00
|
|
|
sizeof(SENDNCCREATEMESSAGE_CALLBACK_ARGUMENTS),
|
2002-05-06 22:20:32 +00:00
|
|
|
&ResultPointer,
|
|
|
|
&ResultLength);
|
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
return(0);
|
|
|
|
}
|
|
|
|
return(Result);
|
2002-06-21 04:14:07 +00:00
|
|
|
}
|
2002-05-06 22:20:32 +00:00
|
|
|
|
2002-01-27 14:47:44 +00:00
|
|
|
LRESULT STDCALL
|
|
|
|
W32kCallWindowProc(WNDPROC Proc,
|
|
|
|
HWND Wnd,
|
|
|
|
UINT Message,
|
|
|
|
WPARAM wParam,
|
|
|
|
LPARAM lParam)
|
|
|
|
{
|
|
|
|
WINDOWPROC_CALLBACK_ARGUMENTS Arguments;
|
|
|
|
LRESULT Result;
|
|
|
|
NTSTATUS Status;
|
|
|
|
PVOID ResultPointer;
|
2002-06-21 04:14:07 +00:00
|
|
|
ULONG ResultLength;
|
2002-01-27 14:47:44 +00:00
|
|
|
|
2002-07-17 21:04:57 +00:00
|
|
|
if (W32kIsDesktopWindow(Wnd))
|
|
|
|
{
|
|
|
|
return(W32kDesktopWindowProc(Wnd, Message, wParam, lParam));
|
|
|
|
}
|
|
|
|
|
2002-01-27 14:47:44 +00:00
|
|
|
Arguments.Proc = Proc;
|
|
|
|
Arguments.Wnd = Wnd;
|
|
|
|
Arguments.Msg = Message;
|
|
|
|
Arguments.wParam = wParam;
|
|
|
|
Arguments.lParam = lParam;
|
|
|
|
ResultPointer = &Result;
|
2002-06-21 04:14:07 +00:00
|
|
|
ResultLength = sizeof(LRESULT);
|
2002-01-27 14:47:44 +00:00
|
|
|
Status = NtW32Call(USER32_CALLBACK_WINDOWPROC,
|
|
|
|
&Arguments,
|
|
|
|
sizeof(WINDOWPROC_CALLBACK_ARGUMENTS),
|
|
|
|
&ResultPointer,
|
2002-07-04 19:56:38 +00:00
|
|
|
&ResultLength);
|
2002-01-27 14:47:44 +00:00
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
return(0xFFFFFFFF);
|
|
|
|
}
|
|
|
|
return(Result);
|
|
|
|
}
|
|
|
|
|
2002-07-17 21:04:57 +00:00
|
|
|
LRESULT STDCALL
|
|
|
|
W32kSendGETMINMAXINFOMessage(HWND Wnd, MINMAXINFO* MinMaxInfo)
|
|
|
|
{
|
|
|
|
SENDGETMINMAXINFO_CALLBACK_ARGUMENTS Arguments;
|
|
|
|
SENDGETMINMAXINFO_CALLBACK_RESULT Result;
|
|
|
|
NTSTATUS Status;
|
|
|
|
PVOID ResultPointer;
|
|
|
|
ULONG ResultLength;
|
|
|
|
|
|
|
|
Arguments.Wnd = Wnd;
|
|
|
|
Arguments.MinMaxInfo = *MinMaxInfo;
|
|
|
|
ResultPointer = &Result;
|
|
|
|
ResultLength = sizeof(Result);
|
|
|
|
Status = NtW32Call(USER32_CALLBACK_SENDGETMINMAXINFO,
|
|
|
|
&Arguments,
|
|
|
|
sizeof(SENDGETMINMAXINFO_CALLBACK_ARGUMENTS),
|
|
|
|
&ResultPointer,
|
|
|
|
&ResultLength);
|
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
return(0);
|
|
|
|
}
|
|
|
|
return(Result.Result);
|
|
|
|
}
|
|
|
|
|
2003-05-17 14:30:28 +00:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2002-07-17 21:04:57 +00:00
|
|
|
LRESULT STDCALL
|
|
|
|
W32kCallTrampolineWindowProc(WNDPROC Proc,
|
|
|
|
HWND Wnd,
|
|
|
|
UINT Message,
|
|
|
|
WPARAM wParam,
|
|
|
|
LPARAM lParam)
|
|
|
|
{
|
|
|
|
switch (Message)
|
|
|
|
{
|
|
|
|
case WM_NCCREATE:
|
2003-05-17 14:30:28 +00:00
|
|
|
return W32kSendNCCREATEMessage(Wnd, (CREATESTRUCTW*)lParam);
|
2002-07-17 21:04:57 +00:00
|
|
|
|
|
|
|
case WM_CREATE:
|
2003-05-17 14:30:28 +00:00
|
|
|
return W32kSendCREATEMessage(Wnd, (CREATESTRUCTW*)lParam);
|
2002-07-17 21:04:57 +00:00
|
|
|
|
|
|
|
case WM_GETMINMAXINFO:
|
2003-05-17 14:30:28 +00:00
|
|
|
return W32kSendGETMINMAXINFOMessage(Wnd, (MINMAXINFO*)lParam);
|
2002-07-17 21:04:57 +00:00
|
|
|
|
|
|
|
case WM_NCCALCSIZE:
|
|
|
|
{
|
|
|
|
if (wParam)
|
|
|
|
{
|
2003-05-17 14:30:28 +00:00
|
|
|
return W32kSendNCCALCSIZEMessage(Wnd, TRUE, NULL,
|
|
|
|
(NCCALCSIZE_PARAMS*)lParam);
|
2002-07-17 21:04:57 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2003-05-17 14:30:28 +00:00
|
|
|
return W32kSendNCCALCSIZEMessage(Wnd, FALSE, (RECT*)lParam, NULL);
|
2002-07-17 21:04:57 +00:00
|
|
|
}
|
|
|
|
}
|
2003-05-17 14:30:28 +00:00
|
|
|
|
|
|
|
case WM_WINDOWPOSCHANGING:
|
|
|
|
return W32kSendWINDOWPOSCHANGINGMessage(Wnd, (WINDOWPOS*) lParam);
|
|
|
|
|
|
|
|
case WM_WINDOWPOSCHANGED:
|
|
|
|
return W32kSendWINDOWPOSCHANGEDMessage(Wnd, (WINDOWPOS*) lParam);
|
2002-07-17 21:04:57 +00:00
|
|
|
|
|
|
|
default:
|
|
|
|
return(W32kCallWindowProc(Proc, Wnd, Message, wParam, lParam));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-01-27 14:47:44 +00:00
|
|
|
/* EOF */
|