Author: jimtabor
Date: Mon Jan 5 19:44:49 2015
New Revision: 65985
URL:
http://svn.reactos.org/svn/reactos?rev=65985&view=rev
Log:
[Win32k]
- Get DDE working halfway. Pass more tests but still missing other tests. See CORE-7447.
Modified:
trunk/reactos/win32ss/user/ntuser/dde.c
trunk/reactos/win32ss/user/ntuser/message.c
trunk/reactos/win32ss/user/ntuser/userfuncs.h
Modified: trunk/reactos/win32ss/user/ntuser/dde.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/dde.c?…
==============================================================================
--- trunk/reactos/win32ss/user/ntuser/dde.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/ntuser/dde.c [iso-8859-1] Mon Jan 5 19:44:49 2015
@@ -1,7 +1,71 @@
#include <win32k.h>
-//DBG_DEFAULT_CHANNEL(UserMisc);
+#include <dde.h>
+
+DBG_DEFAULT_CHANNEL(UserMisc);
+
+
+BOOL FASTCALL
+IntDdeSendMessageHook(PWND pWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
+{
+ PWND pWndServer;
+
+ if (pWnd->head.pti->ppi != gptiCurrent->ppi)
+ {
+ // Allow only Acknowledge and Initiate to be sent across borders.
+ if (Msg != WM_DDE_ACK )
+ {
+ if (Msg == WM_DDE_INITIATE) return TRUE;
+ return FALSE;
+ }
+
+ pWndServer = UserGetWindowObject((HWND)wParam);
+ if (pWndServer == NULL)
+ {
+ ERR("Invalid DDE Server Window handle\n");
+ return FALSE;
+ }
+ ERR("Sending DDE 0x%x\n",Msg);
+ }
+ return TRUE;
+}
+
+BOOL FASTCALL
+IntDdePostMessageHook(PWND pWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
+{
+ PWND pWndClient;
+
+ if (pWnd->head.pti->ppi != gptiCurrent->ppi)
+ {
+ // Initiate is sent only across borders.
+ if (Msg == WM_DDE_INITIATE)
+ {
+ return FALSE;
+ }
+
+ pWndClient = UserGetWindowObject((HWND)wParam);
+ if (pWndClient == NULL)
+ {
+ // This is terminating so post it.
+ if ( Msg == WM_DDE_TERMINATE) return TRUE;
+ ERR("Invalid DDE Client Window handle\n");
+ return FALSE;
+ }
+ ERR("Posting and do CB DDE 0x%x\n",Msg);
+ }
+ return TRUE;
+}
+
+VOID FASTCALL
+IntDdeGetMessageHook(PMSG pMsg)
+{
+ if (pMsg->message == WM_DDE_TERMINATE)
+ {
+ return;
+ }
+ ERR("Do Callback Msg 0x%x\n",pMsg->message);
+}
BOOL
APIENTRY
Modified: trunk/reactos/win32ss/user/ntuser/message.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/messag…
==============================================================================
--- trunk/reactos/win32ss/user/ntuser/message.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/ntuser/message.c [iso-8859-1] Mon Jan 5 19:44:49 2015
@@ -1008,8 +1008,15 @@
bGMSG );
if (Present)
{
- /* GetMessage or PostMessage must never get messages that contain pointers */
- ASSERT(FindMsgMemory(pMsg->message) == NULL);
+ if ( pMsg->message >= WM_DDE_FIRST && pMsg->message <=
WM_DDE_LAST )
+ {
+ IntDdeGetMessageHook(pMsg);
+ }
+ else
+ {
+ /* GetMessage or PostMessage must never get messages that contain pointers
*/
+ ASSERT(FindMsgMemory(pMsg->message) == NULL);
+ }
if (pMsg->message != WM_PAINT && pMsg->message != WM_QUIT)
{
@@ -1113,7 +1120,7 @@
LPARAM lParam )
{
PTHREADINFO pti;
- MSG Message, KernelModeMsg;
+ MSG Message;
LARGE_INTEGER LargeTickCount;
Message.hwnd = Wnd;
@@ -1130,38 +1137,6 @@
return FALSE;
}
- if( Msg >= WM_DDE_FIRST && Msg <= WM_DDE_LAST )
- {
- NTSTATUS Status;
- PMSGMEMORY MsgMemoryEntry;
-
- MsgMemoryEntry = FindMsgMemory(Message.message);
-
- Status = CopyMsgToKernelMem(&KernelModeMsg, &Message, MsgMemoryEntry);
- if (! NT_SUCCESS(Status))
- {
- EngSetLastError(ERROR_INVALID_PARAMETER);
- return FALSE;
- }
- co_IntSendMessageNoWait(KernelModeMsg.hwnd,
- KernelModeMsg.message,
- KernelModeMsg.wParam,
- KernelModeMsg.lParam);
-
- if (MsgMemoryEntry && KernelModeMsg.lParam)
- ExFreePool((PVOID) KernelModeMsg.lParam);
-
- return TRUE;
- }
-
- if (!Wnd)
- {
- pti = PsGetCurrentThreadWin32Thread();
- return UserPostThreadMessage( pti,
- Msg,
- wParam,
- lParam);
- }
if (Wnd == HWND_BROADCAST)
{
HWND *List;
@@ -1192,6 +1167,14 @@
{
PWND Window;
+ if (!Wnd)
+ {
+ return UserPostThreadMessage( gptiCurrent,
+ Msg,
+ wParam,
+ lParam);
+ }
+
Window = UserGetWindowObject(Wnd);
if ( !Window )
{
@@ -1200,6 +1183,7 @@
}
pti = Window->head.pti;
+
if ( pti->TIF_flags & TIF_INCLEANUP )
{
ERR("Attempted to post message to window %p when the thread is in
cleanup!\n", Wnd);
@@ -1211,6 +1195,15 @@
ERR("Attempted to post message to window %p that is being
destroyed!\n", Wnd);
/* FIXME: Last error code? */
return FALSE;
+ }
+
+ if ( Msg >= WM_DDE_FIRST && Msg <= WM_DDE_LAST )
+ {
+ if (!IntDdePostMessageHook(Window, Msg, wParam, lParam))
+ {
+ ERR("Posting Exit DDE 0x%x\n",Msg);
+ return FALSE;
+ }
}
if (WM_QUIT == Msg)
@@ -1270,6 +1263,15 @@
Win32Thread = PsGetCurrentThreadWin32Thread();
ptiSendTo = IntSendTo(Window, Win32Thread, Msg);
+
+ if ( Msg >= WM_DDE_FIRST && Msg <= WM_DDE_LAST )
+ {
+ if (!IntDdeSendMessageHook(Window, Msg, wParam, lParam))
+ {
+ ERR("Sending Exit DDE 0x%x\n",Msg);
+ RETURN( FALSE);
+ }
+ }
if ( !ptiSendTo )
{
Modified: trunk/reactos/win32ss/user/ntuser/userfuncs.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/userfu…
==============================================================================
--- trunk/reactos/win32ss/user/ntuser/userfuncs.h [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/ntuser/userfuncs.h [iso-8859-1] Mon Jan 5 19:44:49 2015
@@ -39,6 +39,12 @@
#define DUMP_REFS(obj) TRACE_CH(UserObj,"obj 0x%x, refs %i\n",obj,
((PHEAD)obj)->cLockObj)
PWND FASTCALL IntGetWindowObject(HWND hWnd);
+
+/*************** DDE.C ****************/
+
+BOOL FASTCALL IntDdeSendMessageHook(PWND,UINT,WPARAM,LPARAM);
+BOOL FASTCALL IntDdePostMessageHook(PWND,UINT,WPARAM,LPARAM);
+VOID FASTCALL IntDdeGetMessageHook(PMSG);
/*************** MAIN.C ***************/