Implement DDE Execute:

- Do required translations (KernelMode -> UserMode format, ASCII/Unicode)
  in GetMessage
- Call window proc directly from DispatchMessage instead of via callback
- Apply message filter to WM_PAINT and WM_NCPAINT messages
- Implement marshalling of pointer lParams for PostMessage

svn path=/trunk/; revision=9247
This commit is contained in:
Gé van Geldorp 2004-04-29 21:13:16 +00:00
parent 0f0200e106
commit edbeb9c88b
14 changed files with 1483 additions and 626 deletions

View file

@ -384,9 +384,17 @@ NtUserDestroyCursorIcon(
BOOLEAN STDCALL
NtUserDestroyWindow(HWND Wnd);
typedef struct tagNTUSERDISPATCHMESSAGEINFO
{
BOOL HandledByKernel;
BOOL Ansi;
WNDPROC Proc;
MSG Msg;
} NTUSERDISPATCHMESSAGEINFO, *PNTUSERDISPATCHMESSAGEINFO;
LRESULT
STDCALL
NtUserDispatchMessage(CONST MSG* lpmsg);
NtUserDispatchMessage(PNTUSERDISPATCHMESSAGEINFO MsgInfo);
BOOL
STDCALL
@ -734,10 +742,16 @@ STDCALL
NtUserGetListBoxInfo(
DWORD Unknown0);
typedef struct tagNTUSERGETMESSAGEINFO
{
MSG Msg;
ULONG LParamSize;
} NTUSERGETMESSAGEINFO, *PNTUSERGETMESSAGEINFO;
BOOL
STDCALL
NtUserGetMessage(
LPMSG lpMsg,
PNTUSERGETMESSAGEINFO MsgInfo,
HWND hWnd,
UINT wMsgFilterMin,
UINT wMsgFilterMax);
@ -1036,7 +1050,7 @@ NtUserPaintDesktop(
BOOL
STDCALL
NtUserPeekMessage(
LPMSG lpMsg,
PNTUSERGETMESSAGEINFO MsgInfo,
HWND hWnd,
UINT wMsgFilterMin,
UINT wMsgFilterMax,
@ -1717,6 +1731,28 @@ NtUserSetScrollBarInfo(
LONG idObject,
SETSCROLLBARINFO *info);
/* lParam of DDE messages */
typedef struct tagKMDDEEXECUTEDATA
{
HWND Sender;
HGLOBAL ClientMem;
/* BYTE Data[DataSize] */
} KMDDEEXECUTEDATA, *PKMDDEEXECUTEDATA;
typedef struct tagKMDDELPARAM
{
BOOL Packed;
union
{
struct
{
UINT uiLo;
UINT uiHi;
} Packed;
LPARAM Unpacked;
} Value;
} KMDDELPARAM, *PKMDDELPARAM;
#endif /* __WIN32K_NTUSER_H */
/* EOF */

View file

@ -0,0 +1,14 @@
/* $Id: message.h,v 1.1 2004/04/29 21:13:16 gvg Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS user32.dll
* FILE: include/message.h
* PURPOSE: Message management definitions
*/
#ifndef LIB_USER32_INCLUDE_MESSAGE_H
#define LIB_USER32_INCLUDE_MESSAGE_H
BOOL FASTCALL MessageInit(VOID);
#endif /* LIB_USER32_INCLUDE_MESSAGE_H */

View file

@ -1340,7 +1340,7 @@ static LRESULT CALLBACK WDML_ClientProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPA
}
return (IsWindowUnicode(hwnd)) ?
DefWindowProcA(hwnd, iMsg, wParam, lParam) : DefWindowProcW(hwnd, iMsg, wParam, lParam);
DefWindowProcW(hwnd, iMsg, wParam, lParam) : DefWindowProcA(hwnd, iMsg, wParam, lParam);
}
/*****************************************************************

View file

@ -994,7 +994,8 @@ static LRESULT CALLBACK WDML_ServerConvProc(HWND hwndServer, UINT iMsg, WPARAM w
}
if (iMsg < WM_DDE_FIRST || iMsg > WM_DDE_LAST)
{
return DefWindowProcA(hwndServer, iMsg, wParam, lParam);
return IsWindowUnicode(hwndServer) ? DefWindowProcW(hwndServer, iMsg, wParam, lParam) :
DefWindowProcA(hwndServer, iMsg, wParam, lParam);
}
EnterCriticalSection(&WDML_CritSect);

View file

@ -6,6 +6,7 @@
#include <user32/accel.h>
#include <window.h>
#include <menu.h>
#include <message.h>
#define _WIN32K_KAPI_H
#include <user32.h>
#include <strpool.h>
@ -73,6 +74,7 @@ Init(VOID)
User32TlsIndex = TlsAlloc();
MenuInit();
MessageInit();
InitializeCriticalSection(&U32AccelCacheLock);
InitializeCriticalSection(&gcsMPH);

File diff suppressed because it is too large Load diff

View file

@ -1,4 +1,4 @@
/* $Id: window.c,v 1.112 2004/04/15 23:36:02 weiden Exp $
/* $Id: window.c,v 1.113 2004/04/29 21:13:16 gvg Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS user32.dll
@ -48,53 +48,6 @@ User32CallSendAsyncProcForKernel(PVOID Arguments, ULONG ArgumentLength)
}
NTSTATUS STDCALL
User32CallWindowProcFromKernel(PVOID Arguments, ULONG ArgumentLength)
{
PWINDOWPROC_CALLBACK_ARGUMENTS CallbackArgs;
LPARAM lParam;
/* Make sure we don't try to access mem beyond what we were given */
if (ArgumentLength < sizeof(WINDOWPROC_CALLBACK_ARGUMENTS))
{
return STATUS_INFO_LENGTH_MISMATCH;
}
CallbackArgs = (PWINDOWPROC_CALLBACK_ARGUMENTS) Arguments;
/* Check if lParam is really a pointer and adjust it if it is */
if (0 <= CallbackArgs->lParamBufferSize)
{
if (ArgumentLength != sizeof(WINDOWPROC_CALLBACK_ARGUMENTS)
+ CallbackArgs->lParamBufferSize)
{
return STATUS_INFO_LENGTH_MISMATCH;
}
lParam = (LPARAM) ((char *) CallbackArgs + sizeof(WINDOWPROC_CALLBACK_ARGUMENTS));
}
else
{
if (ArgumentLength != sizeof(WINDOWPROC_CALLBACK_ARGUMENTS))
{
return STATUS_INFO_LENGTH_MISMATCH;
}
lParam = CallbackArgs->lParam;
}
if (WM_NCCALCSIZE == CallbackArgs->Msg && CallbackArgs->wParam)
{
NCCALCSIZE_PARAMS *Params = (NCCALCSIZE_PARAMS *) lParam;
Params->lppos = (PWINDOWPOS) (Params + 1);
}
CallbackArgs->Result = IntCallWindowProcW(CallbackArgs->IsAnsiProc, CallbackArgs->Proc,
CallbackArgs->Wnd, CallbackArgs->Msg,
CallbackArgs->wParam, lParam);
return ZwCallbackReturn(CallbackArgs, ArgumentLength, STATUS_SUCCESS);
}
/*
* @unimplemented
*/

View file

@ -11,6 +11,7 @@
typedef struct _USER_MESSAGE
{
LIST_ENTRY ListEntry;
BOOLEAN FreeLParam;
MSG Msg;
} USER_MESSAGE, *PUSER_MESSAGE;
@ -103,12 +104,12 @@ MsqSendMessage(PUSER_MESSAGE_QUEUE MessageQueue,
HWND Wnd, UINT Msg, WPARAM wParam, LPARAM lParam,
UINT uTimeout, BOOL Block, ULONG_PTR *uResult);
PUSER_MESSAGE FASTCALL
MsqCreateMessage(LPMSG Msg);
MsqCreateMessage(LPMSG Msg, BOOLEAN FreeLParam);
VOID FASTCALL
MsqDestroyMessage(PUSER_MESSAGE Message);
VOID FASTCALL
MsqPostMessage(PUSER_MESSAGE_QUEUE MessageQueue,
MSG* Msg);
MSG* Msg, BOOLEAN FreeLParam);
VOID FASTCALL
MsqPostQuitMessage(PUSER_MESSAGE_QUEUE MessageQueue, ULONG ExitCode);
BOOLEAN STDCALL

View file

@ -12,7 +12,8 @@ IntValidateParent(PWINDOW_OBJECT Child, HRGN ValidRegion);
BOOL FASTCALL
IntRedrawWindow(PWINDOW_OBJECT Wnd, const RECT* UpdateRect, HRGN UpdateRgn, ULONG Flags);
BOOL FASTCALL
IntGetPaintMessage(HWND hWnd, PW32THREAD Thread, MSG *Message, BOOL Remove);
IntGetPaintMessage(HWND hWnd, UINT MsgFilterMin, UINT MsgFilterMax, PW32THREAD Thread,
MSG *Message, BOOL Remove);
BOOL STDCALL
NtUserValidateRgn(HWND hWnd, HRGN hRgn);

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: keyboard.c,v 1.27 2004/03/15 19:06:35 dwelch Exp $
/* $Id: keyboard.c,v 1.28 2004/04/29 21:13:16 gvg Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -659,14 +659,14 @@ IntTranslateKbdMessage(LPMSG lpMsg,
NewMsg.wParam = dead_char;
NewMsg.lParam = lpMsg->lParam;
dead_char = 0;
MsqPostMessage(PsGetWin32Thread()->MessageQueue, &NewMsg);
MsqPostMessage(PsGetWin32Thread()->MessageQueue, &NewMsg, FALSE);
}
NewMsg.hwnd = lpMsg->hwnd;
NewMsg.wParam = wp[0];
NewMsg.lParam = lpMsg->lParam;
DPRINT( "CHAR='%c' %04x %08x\n", wp[0], wp[0], lpMsg->lParam );
MsqPostMessage(PsGetWin32Thread()->MessageQueue, &NewMsg);
MsqPostMessage(PsGetWin32Thread()->MessageQueue, &NewMsg, FALSE);
Result = TRUE;
}
else if (UState == -1)
@ -677,7 +677,7 @@ IntTranslateKbdMessage(LPMSG lpMsg,
NewMsg.wParam = wp[0];
NewMsg.lParam = lpMsg->lParam;
dead_char = wp[0];
MsqPostMessage(PsGetWin32Thread()->MessageQueue, &NewMsg);
MsqPostMessage(PsGetWin32Thread()->MessageQueue, &NewMsg, FALSE);
Result = TRUE;
}

File diff suppressed because it is too large Load diff

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: msgqueue.c,v 1.90 2004/04/16 18:53:53 weiden Exp $
/* $Id: msgqueue.c,v 1.91 2004/04/29 21:13:16 gvg Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -493,6 +493,7 @@ MsqPeekHardwareMessage(PUSER_MESSAGE_QUEUE MessageQueue, HWND hWnd,
UserMsg = ExAllocateFromPagedLookasideList(&MessageLookasideList);
/* What to do if out of memory? For now we just panic a bit in debug */
ASSERT(UserMsg);
UserMsg->FreeLParam = FALSE;
UserMsg->Msg = Msg;
InsertTailList(&HardwareMessageQueueHead, &UserMsg->ListEntry);
IntLockSystemMessageQueue(OldIrql);
@ -597,7 +598,7 @@ MsqPostKeyboardMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
FocusMessageQueue = IntGetFocusMessageQueue();
if( !IntGetScreenDC() ) {
if( W32kGetPrimitiveMessageQueue() ) {
MsqPostMessage(W32kGetPrimitiveMessageQueue(), &Msg);
MsqPostMessage(W32kGetPrimitiveMessageQueue(), &Msg, FALSE);
}
} else {
if (FocusMessageQueue == NULL)
@ -610,7 +611,7 @@ MsqPostKeyboardMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
{
Msg.hwnd = FocusMessageQueue->FocusWindow;
DPRINT("Msg.hwnd = %x\n", Msg.hwnd);
MsqPostMessage(FocusMessageQueue, &Msg);
MsqPostMessage(FocusMessageQueue, &Msg, FALSE);
}
else
{
@ -665,7 +666,7 @@ MsqPostHotKeyMessage(PVOID Thread, HWND hWnd, WPARAM wParam, LPARAM lParam)
// Mesg.pt.y = PsGetWin32Process()->WindowStation->SystemCursor.y;
// KeQueryTickCount(&LargeTickCount);
// Mesg.time = LargeTickCount.u.LowPart;
MsqPostMessage(Window->MessageQueue, &Mesg);
MsqPostMessage(Window->MessageQueue, &Mesg, FALSE);
ObmDereferenceObject(Window);
ObDereferenceObject (Thread);
@ -678,7 +679,7 @@ MsqPostHotKeyMessage(PVOID Thread, HWND hWnd, WPARAM wParam, LPARAM lParam)
}
PUSER_MESSAGE FASTCALL
MsqCreateMessage(LPMSG Msg)
MsqCreateMessage(LPMSG Msg, BOOLEAN FreeLParam)
{
PUSER_MESSAGE Message;
@ -688,6 +689,7 @@ MsqCreateMessage(LPMSG Msg)
return NULL;
}
Message->FreeLParam = FreeLParam;
RtlMoveMemory(&Message->Msg, Msg, sizeof(MSG));
return Message;
@ -875,11 +877,11 @@ MsqSendMessage(PUSER_MESSAGE_QUEUE MessageQueue,
}
VOID FASTCALL
MsqPostMessage(PUSER_MESSAGE_QUEUE MessageQueue, MSG* Msg)
MsqPostMessage(PUSER_MESSAGE_QUEUE MessageQueue, MSG* Msg, BOOLEAN FreeLParam)
{
PUSER_MESSAGE Message;
if(!(Message = MsqCreateMessage(Msg)))
if(!(Message = MsqCreateMessage(Msg, FreeLParam)))
{
return;
}

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: painting.c,v 1.80 2004/04/09 20:03:19 navaraf Exp $
* $Id: painting.c,v 1.81 2004/04/29 21:13:16 gvg Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -609,8 +609,8 @@ IntFindWindowToRepaint(HWND hWnd, PW32THREAD Thread)
}
BOOL FASTCALL
IntGetPaintMessage(HWND hWnd, PW32THREAD Thread, MSG *Message,
BOOL Remove)
IntGetPaintMessage(HWND hWnd, UINT MsgFilterMin, UINT MsgFilterMax,
PW32THREAD Thread, MSG *Message, BOOL Remove)
{
PWINDOW_OBJECT Window;
PUSER_MESSAGE_QUEUE MessageQueue = (PUSER_MESSAGE_QUEUE)Thread->MessageQueue;
@ -625,13 +625,14 @@ IntGetPaintMessage(HWND hWnd, PW32THREAD Thread, MSG *Message,
if (Message->hwnd == NULL)
{
#if 0
DPRINT1("PAINTING BUG: Thread marked as containing dirty windows, but no dirty windows found!\n");
#endif
IntLockMessageQueue(MessageQueue);
MessageQueue->PaintPosted = 0;
MessageQueue->PaintCount = 0;
IntUnLockMessageQueue(MessageQueue);
if (NULL == hWnd)
{
DPRINT1("PAINTING BUG: Thread marked as containing dirty windows, but no dirty windows found!\n");
IntLockMessageQueue(MessageQueue);
MessageQueue->PaintPosted = 0;
MessageQueue->PaintCount = 0;
IntUnLockMessageQueue(MessageQueue);
}
return FALSE;
}
@ -639,7 +640,10 @@ IntGetPaintMessage(HWND hWnd, PW32THREAD Thread, MSG *Message,
if (Window != NULL)
{
IntLockWindowUpdate(Window);
if (Window->Flags & WINDOWOBJECT_NEED_NCPAINT)
if (0 != (Window->Flags & WINDOWOBJECT_NEED_NCPAINT)
&& ((0 == MsgFilterMin && 0 == MsgFilterMax) ||
(MsgFilterMin <= WM_NCPAINT &&
WM_NCPAINT <= MsgFilterMax)))
{
Message->message = WM_NCPAINT;
Message->wParam = (WPARAM)Window->NCUpdateRegion;
@ -651,7 +655,9 @@ IntGetPaintMessage(HWND hWnd, PW32THREAD Thread, MSG *Message,
Window->Flags &= ~WINDOWOBJECT_NEED_NCPAINT;
MsqDecPaintCountQueue(Window->MessageQueue);
}
} else
} else if ((0 == MsgFilterMin && 0 == MsgFilterMax) ||
(MsgFilterMin <= WM_PAINT &&
WM_PAINT <= MsgFilterMax))
{
Message->message = WM_PAINT;
Message->wParam = Message->lParam = 0;

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: timer.c,v 1.30 2004/04/09 20:03:19 navaraf Exp $
/* $Id: timer.c,v 1.31 2004/04/29 21:13:16 gvg Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -418,7 +418,7 @@ TimerThreadMain(PVOID StartContext)
continue;
}
MsqPostMessage(((PW32THREAD)Thread->Win32Thread)->MessageQueue, &MsgTimer->Msg);
MsqPostMessage(((PW32THREAD)Thread->Win32Thread)->MessageQueue, &MsgTimer->Msg, FALSE);
ThreadsToDereference[ThreadsToDereferencePos] = Thread;
++ThreadsToDereferencePos;