- Get DDE working halfway. Pass more tests but still missing other tests. See CORE-7447.

svn path=/trunk/; revision=65985
This commit is contained in:
James Tabor 2015-01-05 19:44:49 +00:00
parent e36f91e0de
commit 78a30834a2
3 changed files with 108 additions and 36 deletions

View file

@ -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

View file

@ -1008,8 +1008,15 @@ co_IntGetPeekMessage( PMSG pMsg,
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 @@ UserPostMessage( HWND Wnd,
LPARAM lParam )
{
PTHREADINFO pti;
MSG Message, KernelModeMsg;
MSG Message;
LARGE_INTEGER LargeTickCount;
Message.hwnd = Wnd;
@ -1130,38 +1137,6 @@ UserPostMessage( HWND Wnd,
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 @@ UserPostMessage( HWND Wnd,
{
PWND Window;
if (!Wnd)
{
return UserPostThreadMessage( gptiCurrent,
Msg,
wParam,
lParam);
}
Window = UserGetWindowObject(Wnd);
if ( !Window )
{
@ -1200,6 +1183,7 @@ UserPostMessage( HWND Wnd,
}
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);
@ -1213,6 +1197,15 @@ UserPostMessage( HWND Wnd,
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)
{
MsqPostQuitMessage(pti, wParam);
@ -1271,6 +1264,15 @@ co_IntSendMessageTimeoutSingle( HWND hWnd,
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 )
{
if (Win32Thread->TIF_flags & TIF_INCLEANUP)

View file

@ -40,6 +40,12 @@ FORCEINLINE PMENU UserGetMenuObject(HMENU hMenu)
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 ***************/
NTSTATUS NTAPI InitThreadCallback(PETHREAD Thread);