Author: jimtabor Date: Thu Jan 8 22:57:09 2015 New Revision: 66011
URL: http://svn.reactos.org/svn/reactos?rev=66011&view=rev Log: [Win32ss] - Fix remaining DDE issues, re-sync DDE code from wine. Add QOS startup. Moved error debug prints to traces. Over all improvement with test results.
Modified: trunk/reactos/win32ss/include/callback.h trunk/reactos/win32ss/user/ntuser/dde.c trunk/reactos/win32ss/user/ntuser/message.c trunk/reactos/win32ss/user/ntuser/userfuncs.h trunk/reactos/win32ss/user/user32/misc/dde.c trunk/reactos/win32ss/user/user32/misc/ddeclient.c trunk/reactos/win32ss/user/user32/misc/ddemisc.c trunk/reactos/win32ss/user/user32/misc/ddeserver.c
Modified: trunk/reactos/win32ss/include/callback.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/include/callback.h?... ============================================================================== --- trunk/reactos/win32ss/include/callback.h [iso-8859-1] (original) +++ trunk/reactos/win32ss/include/callback.h [iso-8859-1] Thu Jan 8 22:57:09 2015 @@ -122,6 +122,7 @@ INT Type; MSG; int size; + PVOID pvData; BYTE buffer[1]; } DDEPOSTGET_CALLBACK_ARGUMENTS, *PDDEPOSTGET_CALLBACK_ARGUMENTS;
Modified: trunk/reactos/win32ss/user/ntuser/dde.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/dde.c?r... ============================================================================== --- trunk/reactos/win32ss/user/ntuser/dde.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/dde.c [iso-8859-1] Thu Jan 8 22:57:09 2015 @@ -1,9 +1,29 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS Win32k subsystem + * PURPOSE: Dynamic Data Exchange + * FILE: win32ss/user/ntuser/dde.c + * PROGRAMER: + */
#include <win32k.h>
#include <dde.h>
DBG_DEFAULT_CHANNEL(UserMisc); + +// +// Default information used to support client impersonation. +// +SECURITY_QUALITY_OF_SERVICE gqosDefault = {sizeof(SECURITY_QUALITY_OF_SERVICE),SecurityImpersonation,SECURITY_STATIC_TRACKING,TRUE}; + +typedef struct _DDEIMP +{ + SECURITY_QUALITY_OF_SERVICE qos; + SECURITY_CLIENT_CONTEXT ClientContext; + WORD cRefInit; + WORD cRefConv; +} DDEIMP, *PDDEIMP;
typedef struct _DDE_DATA { @@ -16,10 +36,13 @@ { PWND spwnd; PWND spwndPartner; + PDDEIMP pddei; } DDE_PROP, *PDDE_PROP;
- +// +// DDE Posting message callback to user side. +// int APIENTRY IntDDEPostCallback( @@ -27,17 +50,15 @@ IN UINT Msg, IN WPARAM wParam, IN OUT LPARAM *lParam, - IN PVOID Buffer, - IN int size) + IN OUT PVOID *Buffer) { NTSTATUS Status; ULONG ArgumentLength, ResultLength; PVOID Argument, ResultPointer; PDDEPOSTGET_CALLBACK_ARGUMENTS Common; - int origSize = size; - + int size = 0; ResultPointer = NULL; - ResultLength = ArgumentLength = sizeof(DDEPOSTGET_CALLBACK_ARGUMENTS)+size; + ResultLength = ArgumentLength = sizeof(DDEPOSTGET_CALLBACK_ARGUMENTS);
Argument = IntCbAllocateMemory(ArgumentLength); if (NULL == Argument) @@ -47,12 +68,12 @@
Common = (PDDEPOSTGET_CALLBACK_ARGUMENTS) Argument;
- Common->size = size; + Common->pvData = 0; + Common->size = 0; Common->hwnd = UserHMGetHandle(pWnd); Common->message = Msg; Common->wParam = wParam; Common->lParam = *lParam; - RtlCopyMemory(&Common->buffer, Buffer, size);
UserLeaveCo();
@@ -73,19 +94,26 @@
RtlCopyMemory(Common, ResultPointer, ArgumentLength);
- if (Common->size != 0 && size <= origSize) - { - RtlCopyMemory(Buffer, &Common->buffer, size); // ResultLength); + ///// HAX! + if ( Common->size == 0xdeadbeef ) + { + ERR("DDE Post callback failed! 2 status %p\n",Status); + IntCbFreeMemory(Argument); + return 0; }
size = Common->size; *lParam = Common->lParam; + *Buffer = Common->pvData;
IntCbFreeMemory(Argument);
return size ? size : -1; }
+// +// DDE Get/Peek message callback to user side. +// BOOL APIENTRY IntDDEGetCallback( @@ -118,7 +146,6 @@
if (size && Buffer) RtlCopyMemory(&Common->buffer, Buffer, size);
- UserLeaveCo();
Status = KeUserModeCallback(USER32_CALLBACK_DDEGET, @@ -138,6 +165,14 @@
RtlMoveMemory(Common, ResultPointer, ArgumentLength);
+ ///// HAX! + if ( Common->size == 0xdeadbeef ) + { + ERR("DDE Get callback failed! 2 status %p\n",Status); + IntCbFreeMemory(Argument); + return FALSE; + } + pMsg->lParam = Common->lParam;
IntCbFreeMemory(Argument); @@ -145,8 +180,9 @@ return TRUE; }
- - +// +// DDE Post message hook, intercept DDE messages before going on to the target Processes Thread queue. +// BOOL APIENTRY IntDdePostMessageHook( @@ -158,14 +194,15 @@ { PWND pWndClient; PDDE_DATA pddeData; + int size; HGDIOBJ Object = NULL; + PVOID userBuf = NULL; PVOID Buffer = NULL; - int size = 128; LPARAM lp = *lParam;
if (pWnd->head.pti->ppi != gptiCurrent->ppi) { - ERR("Posting long DDE 0x%x\n",Msg); + TRACE("Posting long DDE 0x%x\n",Msg); // Initiate is sent only across borders. if (Msg == WM_DDE_INITIATE) { @@ -178,14 +215,14 @@ // This is terminating so post it. if ( Msg == WM_DDE_TERMINATE) { - ERR("DDE Posted WM_DDE_TERMINATE\n"); + TRACE("DDE Posted WM_DDE_TERMINATE\n"); return TRUE; } - ERR("Invalid DDE Client Window handle\n"); - return FALSE; - } - - if (Msg == WM_DDE_TERMINATE ) + TRACE("Invalid DDE Client Window handle\n"); + return FALSE; + } + + if ( Msg == WM_DDE_TERMINATE ) { //// FIXME Remove Stuff if any...
@@ -193,26 +230,34 @@ return TRUE; }
- Buffer = ExAllocatePoolWithTag(PagedPool, size, USERTAG_DDE); - - if ((size = IntDDEPostCallback(pWnd, Msg, wParam, &lp, Buffer, size)) == 0) + if ( Msg == WM_DDE_EXECUTE && *lParam == 0) + { + // Do not bother to do a callback. + TRACE("DDE Post EXECUTE lParam 0\n"); + return FALSE; + } + + // Callback. + if ((size = IntDDEPostCallback(pWnd, Msg, wParam, &lp, &userBuf)) == 0) { ERR("DDE Post Callback return 0 0x%x\n", Msg); - } - - if (size != -1 && size > 128) - { - ERR("FIXME: DDE Post need more bytes %d\n",size); - } - + return FALSE; + } + + // No error HACK. if (size == -1) { size = 0; - ExFreePoolWithTag(Buffer, USERTAG_DDE); - Buffer = NULL; - } - - ERR("DDE Post size %d 0x%x\n",size, Msg); + } + else + { + // Set buffer with users data size. + Buffer = ExAllocatePoolWithTag(PagedPool, size, USERTAG_DDE); + // No SEH? Yes, the user memory is freed after the Acknowledgment or at Termination. + RtlCopyMemory(Buffer, userBuf, size); + } + + TRACE("DDE Post size %d 0x%x\n",size, Msg);
switch(Msg) { @@ -245,8 +290,7 @@ break; } break; - - } + } default: break; } @@ -257,13 +301,13 @@ GreSetObjectOwner(Object, pWnd->head.pti->ppi->W32Pid); }
- pddeData = ExAllocatePoolWithTag(PagedPool, sizeof(DDE_DATA), USERTAG_DDE2); + pddeData = ExAllocatePoolWithTag(PagedPool, sizeof(DDE_DATA), USERTAG_DDE5);
pddeData->cbSize = size; pddeData->pvBuffer = Buffer; pddeData->lParam = lp;
- ERR("DDE Post lParam c=%08lx\n",lp); + TRACE("DDE Post lParam c=%08lx\n",lp); *lParam = lp;
// Attach this data packet to the user message. @@ -272,7 +316,10 @@ return TRUE; }
-VOID APIENTRY +// +// DDE Get/Peek message hook, take preprocessed information and recombined it for the current Process Thread. +// +BOOL APIENTRY IntDdeGetMessageHook(PMSG pMsg, LONG_PTR ExtraInfo) { PWND pWnd, pWndClient; @@ -284,7 +331,7 @@ if (pWnd == NULL) { ERR("DDE Get Window is dead. %p\n", pMsg->hwnd); - return; + return TRUE; }
if (pMsg->message == WM_DDE_TERMINATE) @@ -301,37 +348,37 @@ IntRemoveProp(pWnd, AtomDDETrack); ExFreePoolWithTag(pddeProp, USERTAG_DDE1); } - return; - } - - ERR("DDE Get Msg 0x%x\n",pMsg->message); + return TRUE; + } + + TRACE("DDE Get Msg 0x%x\n",pMsg->message);
pddeData = (PDDE_DATA)ExtraInfo;
if ( pddeData ) { - ERR("DDE Get 1 size %d lParam c=%08lx lp c=%08lx\n",pddeData->cbSize, pMsg->lParam, pddeData->lParam); - - pMsg->lParam = pddeData->lParam; // This might be a hack... Need to backtrace lParam from post queue. - + TRACE("DDE Get size %d lParam c=%08lx lp c=%08lx\n",pddeData->cbSize, pMsg->lParam, pddeData->lParam); + + // Callback. Ret = IntDDEGetCallback( pWnd, pMsg, pddeData->pvBuffer, pddeData->cbSize); if (!Ret) { ERR("DDE Get CB failed\n"); }
- ERR("DDE Get 2 size %d lParam c=%08lx\n",pddeData->cbSize, pMsg->lParam); - if (pddeData->pvBuffer) ExFreePoolWithTag(pddeData->pvBuffer, USERTAG_DDE);
- ExFreePoolWithTag(pddeData, USERTAG_DDE2); - - return; - } - ERR("DDE Get No DDE Data found!\n"); - return; -} - + ExFreePoolWithTag(pddeData, USERTAG_DDE5); + + return Ret; + } + TRACE("DDE Get No DDE Data found!\n"); + return TRUE; +} + +// +// DDE Send message hook, intercept DDE messages and associate them in a partnership with property. +// BOOL FASTCALL IntDdeSendMessageHook(PWND pWnd, UINT Msg, WPARAM wParam, LPARAM lParam) { @@ -340,12 +387,12 @@
if (Msg == WM_DDE_ACK) { - ERR("Sending WM_DDE_ACK Client hwnd %p\n",pWnd->head.h); + TRACE("Sending WM_DDE_ACK Client hwnd %p\n",pWnd->head.h); }
if (pWnd->head.pti->ppi != gptiCurrent->ppi) { - ERR("Sending long DDE 0x%x\n",Msg); + TRACE("Sending long DDE 0x%x\n",Msg);
// Allow only Acknowledge and Initiate to be sent across borders. if (Msg != WM_DDE_ACK ) @@ -354,7 +401,7 @@ return FALSE; }
- ERR("Sending long WM_DDE_ACK\n"); + TRACE("Sending long WM_DDE_ACK\n");
pWndServer = UserGetWindowObject((HWND)wParam); if (pWndServer == NULL) @@ -381,6 +428,29 @@ IN HWND hwndClient, IN HWND hWndServer, OUT PSECURITY_QUALITY_OF_SERVICE pqosPrev) +{ + STUB + + return 0; +} + +BOOL +APIENTRY +NtUserDdeSetQualityOfService( + IN HWND hwndClient, + IN PSECURITY_QUALITY_OF_SERVICE pqosNew, + OUT PSECURITY_QUALITY_OF_SERVICE pqosPrev) +{ + STUB + + return 0; +} + +BOOL +APIENTRY +NtUserImpersonateDdeClientWindow( + HWND hWndClient, + HWND hWndServer) { STUB
@@ -401,26 +471,3 @@ return 0; }
-BOOL -APIENTRY -NtUserDdeSetQualityOfService( - IN HWND hwndClient, - IN PSECURITY_QUALITY_OF_SERVICE pqosNew, - OUT PSECURITY_QUALITY_OF_SERVICE pqosPrev) -{ - STUB - - return 0; -} - -BOOL -APIENTRY -NtUserImpersonateDdeClientWindow( - HWND hWndClient, - HWND hWndServer) -{ - STUB - - return 0; -} -
Modified: trunk/reactos/win32ss/user/ntuser/message.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/message... ============================================================================== --- trunk/reactos/win32ss/user/ntuser/message.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/message.c [iso-8859-1] Thu Jan 8 22:57:09 2015 @@ -1017,7 +1017,11 @@
if ( pMsg->message >= WM_DDE_FIRST && pMsg->message <= WM_DDE_LAST ) { - IntDdeGetMessageHook(pMsg, ExtraInfo); + if (!IntDdeGetMessageHook(pMsg, ExtraInfo)) + { + TRACE("DDE Get return ERROR\n"); + continue; + } }
if (pMsg->message != WM_PAINT && pMsg->message != WM_QUIT) @@ -1204,10 +1208,10 @@ { if (!IntDdePostMessageHook(Window, Msg, wParam, &lParam, &ExtraInfo)) { - ERR("Posting Exit DDE 0x%x\n",Msg); + TRACE("Posting Exit DDE 0x%x\n",Msg); return FALSE; } - ERR("DDE Post lParam c=%08lx\n",lParam); + Message.lParam = lParam; }
if (WM_QUIT == Msg)
Modified: trunk/reactos/win32ss/user/ntuser/userfuncs.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/userfun... ============================================================================== --- trunk/reactos/win32ss/user/ntuser/userfuncs.h [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/userfuncs.h [iso-8859-1] Thu Jan 8 22:57:09 2015 @@ -44,7 +44,7 @@
BOOL FASTCALL IntDdeSendMessageHook(PWND,UINT,WPARAM,LPARAM); BOOL APIENTRY IntDdePostMessageHook(IN PWND,IN UINT,IN WPARAM,IN OUT LPARAM*,IN OUT LONG_PTR*); -VOID APIENTRY IntDdeGetMessageHook(PMSG,LONG_PTR); +BOOL APIENTRY IntDdeGetMessageHook(PMSG,LONG_PTR);
/*************** MAIN.C ***************/
Modified: trunk/reactos/win32ss/user/user32/misc/dde.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/user32/misc/dd... ============================================================================== --- trunk/reactos/win32ss/user/user32/misc/dde.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/user32/misc/dde.c [iso-8859-1] Thu Jan 8 22:57:09 2015 @@ -1,3 +1,10 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS user32.dll + * PURPOSE: Dynamic Data Exchange + * FILE: win32ss/user/user32/misc/dde.c + * PROGRAMER: + */
#include <user32.h> #include <wine/debug.h> @@ -13,9 +20,9 @@ struct packed_message { //union packed_structs ps; - int count; - const void *data; - int size; + int count; + const void *data; + int size; };
/* add a data field to a packed message */ @@ -79,13 +86,13 @@ /* send back the value of h on the other side */ push_data( data, &hpack, sizeof(hpack) ); *lp = uiLo; - ERR( "send dde-ack %lx %08lx => %p\n", uiLo, uiHi, h ); + TRACE( "send dde-ack %lx %08lx => %p\n", uiLo, uiHi, h ); } } else { /* uiHi should contain either an atom or 0 */ - ERR( "send dde-ack %lx atom=%lx\n", uiLo, uiHi ); + TRACE( "send dde-ack %lx atom=%lx\n", uiLo, uiHi ); *lp = MAKELONG( uiLo, uiHi ); } break; @@ -96,12 +103,17 @@ if (uiLo) { size = GlobalSize( (HGLOBAL)uiLo ) ; + TRACE("WM_DDE_A D P size %d\n",size); if ( (message == WM_DDE_ADVISE && size < sizeof(DDEADVISE)) || (message == WM_DDE_DATA && size < FIELD_OFFSET(DDEDATA, Value)) || (message == WM_DDE_POKE && size < FIELD_OFFSET(DDEPOKE, Value)) ) return FALSE; } - else if (message != WM_DDE_DATA) return FALSE; + else if (message != WM_DDE_DATA) + { + TRACE("WM_DDE uiLo 0\n"); + return FALSE; + }
*lp = uiHi; if (uiLo) @@ -109,14 +121,14 @@ if ((ptr = GlobalLock( (HGLOBAL)uiLo) )) { DDEDATA *dde_data = ptr; - ERR("unused %d, fResponse %d, fRelease %d, fDeferUpd %d, fAckReq %d, cfFormat %d\n", + TRACE("unused %d, fResponse %d, fRelease %d, fDeferUpd %d, fAckReq %d, cfFormat %d\n", dde_data->unused, dde_data->fResponse, dde_data->fRelease, dde_data->reserved, dde_data->fAckReq, dde_data->cfFormat); push_data( data, ptr, size ); hunlock = (HGLOBAL)uiLo; } } - ERR( "send ddepack %u %lx\n", size, uiHi ); + TRACE( "send ddepack %u %lx\n", size, uiHi ); break; case WM_DDE_EXECUTE: if (lParam) @@ -128,7 +140,7 @@ /* so that the other side can send it back on ACK */ *lp = lParam; hunlock = (HGLOBAL)lParam; - ERR("WM_DDE_EXECUTE text size %d\n",GlobalSize( (HGLOBAL)lParam )); + TRACE("WM_DDE_EXECUTE text size %d\n",GlobalSize( (HGLOBAL)lParam )); } } break; @@ -152,7 +164,7 @@ HGLOBAL hMem = 0; void* ptr;
- ERR("udm : Size %d\n",size); + TRACE("udm : Size %d\n",size);
switch (message) { @@ -167,13 +179,13 @@ memcpy( &hpack, buffer, size ); hMem = unpack_ptr( hpack ); uiHi = (UINT_PTR)hMem; - ERR("recv dde-ack %lx mem=%lx[%lx]\n", uiLo, uiHi, GlobalSize( hMem )); + TRACE("recv dde-ack %lx mem=%lx[%lx]\n", uiLo, uiHi, GlobalSize( hMem )); } else { uiLo = LOWORD( *lparam ); uiHi = HIWORD( *lparam ); - ERR("recv dde-ack %lx atom=%lx\n", uiLo, uiHi); + TRACE("recv dde-ack %lx atom=%lx\n", uiLo, uiHi); } *lparam = PackDDElParam( WM_DDE_ACK, uiLo, uiHi ); break; @@ -210,78 +222,90 @@ { memcpy( ptr, buffer, size ); GlobalUnlock( hMem ); - ERR( "exec: pairing c=%08lx s=%p\n", *lparam, hMem ); + TRACE( "exec: pairing c=%08lx s=%p\n", *lparam, hMem ); if (!DdeAddPair( (HGLOBAL)*lparam, hMem )) { GlobalFree( hMem ); - ERR("udm exec: GF 1\n"); + TRACE("udm exec: GF 1\n"); return FALSE; } } else { GlobalFree( hMem ); - ERR("udm exec: GF 2\n"); + TRACE("udm exec: GF 2\n"); return FALSE; } } else - { - ERR("udm exec: No Size\n"); + { + TRACE("udm exec: No Size\n"); return FALSE; }
- ERR( "exec: exit c=%08lx s=%p\n", *lparam, hMem ); + TRACE( "exec: exit c=%08lx s=%p\n", *lparam, hMem ); *lparam = (LPARAM)hMem; break; } return TRUE; }
+// +// DDE Post kernel callback. +// NTSTATUS WINAPI User32CallDDEPostFromKernel(PVOID Arguments, ULONG ArgumentLength) { struct packed_message data; BOOL Ret; + NTSTATUS Status = STATUS_SUCCESS; PDDEPOSTGET_CALLBACK_ARGUMENTS Common = Arguments;
data.data = 0; data.size = 0; - ERR("DDE Post CB\n"); + TRACE("DDE Post CB\n"); Ret = post_dde_message( &data, Common->message, Common->lParam, &Common->lParam);
if (Ret) { - if (Common->size >= data.size) - { - if (data.data) RtlCopyMemory(&Common->buffer, data.data, data.size); - } + Common->pvData = (PVOID)data.data; Common->size = data.size; - ERR("DDE Post CB size %d\n",data.size); + TRACE("DDE Post CB size %d\n",data.size); } else { - ERR("Return bad msg 0x%x Size %d\n",Common->message,Common->size); + ERR("DDE Post CB Return bad msg 0x%x Size %d\n",Common->message,Common->size); + Common->size = 0xdeadbeef; // HACKSSS!! Return status does not work! + Status = STATUS_UNSUCCESSFUL; }
- return ZwCallbackReturn(Arguments, ArgumentLength, Ret ? STATUS_SUCCESS : STATUS_UNSUCCESSFUL); -} - + return ZwCallbackReturn(Arguments, ArgumentLength, Status); +} + +// +// DDE Get/Peek kernel callback. +// NTSTATUS WINAPI User32CallDDEGetFromKernel(PVOID Arguments, ULONG ArgumentLength) { BOOL Ret; + NTSTATUS Status = STATUS_SUCCESS; PDDEPOSTGET_CALLBACK_ARGUMENTS Common = Arguments;
- ERR("DDE Get CB size %d\n",Common->size); + TRACE("DDE Get CB size %d\n",Common->size);
Ret = unpack_dde_message( Common->hwnd, Common->message, &Common->lParam, Common->buffer, Common->size );
- return ZwCallbackReturn(Arguments, ArgumentLength, Ret ? STATUS_SUCCESS : STATUS_UNSUCCESSFUL); -} - + if (!Ret) + { + ERR("DDE Get CB Return bad msg 0x%x\n",Common->message); + Common->size = 0xdeadbeef; // HACKSSS!! Return status does not work! + Status = STATUS_UNSUCCESSFUL; + } + return ZwCallbackReturn(Arguments, ArgumentLength, Status); +}
/*
Modified: trunk/reactos/win32ss/user/user32/misc/ddeclient.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/user32/misc/dd... ============================================================================== --- trunk/reactos/win32ss/user/user32/misc/ddeclient.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/user32/misc/ddeclient.c [iso-8859-1] Thu Jan 8 22:57:09 2015 @@ -31,7 +31,7 @@
static LRESULT CALLBACK WDML_ClientProc(HWND, UINT, WPARAM, LPARAM); /* only for one client, not conv list */ const char WDML_szClientConvClassA[] = "DDEMLAnsiClient"; -const WCHAR WDML_szClientConvClassW[] = {'D','D','E','M','L','U','n','i','c','o','d','e','C','l','i','e','n','t',0}; +const WCHAR WDML_szClientConvClassW[] = L"DDEMLUnicodeClient";
/****************************************************************************** * DdeConnectList [USER32.@] Establishes conversation with DDE servers @@ -91,7 +91,7 @@ WDML_CONV* pConv = NULL; ATOM aSrv = 0, aTpc = 0;
- ERR("(0x%x,%p,%p,%p)\n", idInst, hszService, hszTopic, pCC); + TRACE("(0x%x,%p,%p,%p)\n", idInst, hszService, hszTopic, pCC);
pInstance = WDML_GetInstance(idInst); if (!pInstance) @@ -180,12 +180,12 @@ pConv = WDML_GetConvFromWnd(hwndClient); if (pConv == NULL || pConv->hwndServer == 0) { - ERR("Done with INITIATE, but no Server window available %p\n", (pConv ? pConv->hwndServer : NULL)); + WARN("Done with INITIATE, but no Server window available\n"); pConv = NULL; pInstance->lastError = DMLERR_NO_CONV_ESTABLISHED; goto theEnd; } - ERR("Connected to Server window (%p)\n", pConv->hwndServer); + TRACE("Connected to Server window (%p)\n", pConv->hwndServer); pConv->wConvst = XST_CONNECTED;
/* finish init of pConv */ @@ -1012,7 +1012,7 @@ DWORD err; WDML_CONV* pConv;
- ERR("Starting wait for a timeout of %d ms\n", dwTimeout); + TRACE("Starting wait for a timeout of %d ms\n", dwTimeout);
start = GetTickCount(); while ((elapsed = GetTickCount() - start) < dwTimeout) @@ -1032,18 +1032,16 @@ pConv = WDML_GetConv(hConv, FALSE); if (pConv == NULL) { - ERR("conversation no longer available\n"); /* conversation no longer available... return failure */ return 0; } - ERR("Msg hWnd %p & Client %p\n",msg.hwnd,pConv->hwndClient); if (msg.hwnd == pConv->hwndClient) { /* check that either pXAct has been processed or no more xActions are pending */ BOOL ret = (pConv->transactions == pXAct); if (WDML_HandleReply(pConv, &msg, &hdd, ack) == WDML_QS_HANDLED) { - ERR("WDML_HandleReply returned WDML_QS_HANDLED\n"); + TRACE("WDML_HandleReply returned WDML_QS_HANDLED\n"); ret = TRUE; } else @@ -1057,14 +1055,13 @@ } else { - ERR("Dispatching message\n"); DispatchMessageW(&msg); } } } }
- ERR("Timeout !!\n"); + TRACE("Timeout !!\n");
pConv = WDML_GetConv(hConv, FALSE); if (pConv != NULL) @@ -1144,7 +1141,6 @@ if (pConv == NULL) { /* cannot set error... cannot get back to DDE instance */ - ERR("No Conv!\n"); return 0; }
@@ -1287,18 +1283,16 @@ UINT uiLo, uiHi; WDML_CONV* pConv = NULL; HSZ hszSrv, hszTpc; - char buf[256]; - WDML_INSTANCE* pInstance; - - ERR("%p %04x %08lx %08lx\n", hwnd, iMsg, wParam , lParam); - + + TRACE("%p %04x %08lx %08lx\n", hwnd, iMsg, wParam , lParam); + + if (iMsg == WM_DDE_ACK && /* in the initial WM_INITIATE sendmessage */ - if (iMsg == WM_DDE_ACK && - (!(pConv = WDML_GetConvFromWnd(hwnd)) || pConv->wStatus == XST_INIT1)) - { - - ERR("WM_DDE_ACK\n"); + ((pConv = WDML_GetConvFromWnd(hwnd)) == NULL || pConv->wStatus == XST_INIT1)) + { /* In response to WM_DDE_INITIATE, save server window */ + char buf[256]; + WDML_INSTANCE* pInstance;
/* note: sent messages do not need packing */ uiLo = LOWORD(lParam);
Modified: trunk/reactos/win32ss/user/user32/misc/ddemisc.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/user32/misc/dd... ============================================================================== --- trunk/reactos/win32ss/user/user32/misc/ddemisc.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/user32/misc/ddemisc.c [iso-8859-1] Thu Jan 8 22:57:09 2015 @@ -36,11 +36,11 @@
static WDML_INSTANCE* WDML_InstanceList = NULL; static LONG WDML_MaxInstanceID = 0; /* OK for present, have to worry about wrap-around later */ -const WCHAR WDML_szEventClass[] = {'D','D','E','M','L','E','v','e','n','t',0}; +const WCHAR WDML_szEventClass[] = L"DDEMLEvent";
/* protection for instance list */ CRITICAL_SECTION WDML_CritSect; -CRITICAL_SECTION_DEBUG critsect_debug = +static CRITICAL_SECTION_DEBUG critsect_debug = { 0, 0, &WDML_CritSect, { &critsect_debug.ProcessLocksList, &critsect_debug.ProcessLocksList }, @@ -797,8 +797,8 @@ /* confirm connection... * lookup for this conv handle */ - HWND client = (HWND)wParam; - HWND server = (HWND)lParam; + HWND client = WIN_GetFullHandle( (HWND)wParam ); + HWND server = WIN_GetFullHandle( (HWND)lParam ); for (pConv = pInstance->convs[WDML_SERVER_SIDE]; pConv != NULL; pConv = pConv->next) { if (pConv->hwndClient == client && pConv->hwndServer == server) @@ -840,7 +840,7 @@ { ERR("Reserved value not zero? What does this mean?\n"); /* trap this and no more until we know more */ - return DMLERR_INVALIDPARAMETER; + return DMLERR_NO_ERROR; }
/* grab enough heap for one control struct - not really necessary for re-initialise @@ -883,12 +883,12 @@ (pInstance->CBFflags & CBF_FAIL_ALLSVRXACTIONS) == CBF_FAIL_ALLSVRXACTIONS; }
- ERR("instance created - checking validity\n"); + TRACE("instance created - checking validity\n");
if (*pidInst == 0) { /* Initialisation of new Instance Identifier */ - ERR("new instance, callback %p flags %X\n",pfnCallback,afCmd); + TRACE("new instance, callback %p flags %X\n",pfnCallback,afCmd);
EnterCriticalSection(&WDML_CritSect);
@@ -907,7 +907,7 @@ */
pInstance->CBFflags = pInstance->CBFflags|APPCMD_FILTERINITS; - ERR("First application instance detected OK\n"); + TRACE("First application instance detected OK\n"); /* allocate new instance ID */ WDML_IncrementInstanceId(pInstance); } @@ -916,7 +916,7 @@ /* really need to chain the new one in to the latest here, but after checking conditions * such as trying to start a conversation from an application trying to monitor */ reference_inst = WDML_InstanceList; - ERR("Subsequent application instance - starting checks\n"); + TRACE("Subsequent application instance - starting checks\n"); while (reference_inst->next != NULL) { /* @@ -932,7 +932,6 @@
if (pInstance->clientOnly != reference_inst->clientOnly) { - ERR("WDML_Initialize Mustbe Client-only\n"); ret = DMLERR_DLL_USAGE; goto theError; } @@ -941,7 +940,6 @@
if (pInstance->monitor != reference_inst->monitor) { - ERR("WDML_Initialize cannot use monitor w/any modes\n"); ret = DMLERR_INVALIDPARAMETER; goto theError; } @@ -958,7 +956,7 @@ } /* All cleared, add to chain */
- ERR("Application Instance checks finished\n"); + TRACE("Application Instance checks finished\n"); WDML_IncrementInstanceId(pInstance); reference_inst->next = pInstance; } @@ -988,18 +986,17 @@
SetWindowLongPtrW(pInstance->hwndEvent, GWL_WDML_INSTANCE, (ULONG_PTR)pInstance);
- ERR("New application instance processing finished OK\n"); + TRACE("New application instance processing finished OK\n"); } else { /* Reinitialisation situation --- FIX */ - ERR("reinitialisation of (%p,%p,0x%x,%d): stub\n", pidInst, pfnCallback, afCmd, ulRes); + TRACE("reinitialisation of (%p,%p,0x%x,%d): stub\n", pidInst, pfnCallback, afCmd, ulRes);
EnterCriticalSection(&WDML_CritSect);
if (WDML_InstanceList == NULL) { - ERR("WDML_Initialize No instance list\n"); ret = DMLERR_INVALIDPARAMETER; goto theError; } @@ -1024,7 +1021,6 @@
if (!(afCmd & APPCMD_CLIENTONLY)) { - ERR("WDML_Initialize AppCmd Client-only 2\n"); ret = DMLERR_INVALIDPARAMETER; goto theError; } @@ -1034,7 +1030,6 @@
if (pInstance->monitor != reference_inst->monitor) { - ERR("WDML_Initialize cannot change monitor modes 2\n"); ret = DMLERR_INVALIDPARAMETER; goto theError; } @@ -1043,7 +1038,6 @@
if ((afCmd&APPCMD_CLIENTONLY) && !reference_inst->clientOnly) { - ERR("WDML_Initialize trying to set Client-only via APPCMD\n"); ret = DMLERR_INVALIDPARAMETER; goto theError; } @@ -1053,7 +1047,6 @@ } if (reference_inst->next == NULL) { - ERR("WDML_Initialize Nothing Next\n"); ret = DMLERR_INVALIDPARAMETER; goto theError; } @@ -1070,7 +1063,6 @@
return DMLERR_NO_ERROR; theError: - ERR("WDML_Initialize error %x\n",ret); HeapFree(GetProcessHeap(), 0, pInstance); LeaveCriticalSection(&WDML_CritSect); return ret;
Modified: trunk/reactos/win32ss/user/user32/misc/ddeserver.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/user32/misc/dd... ============================================================================== --- trunk/reactos/win32ss/user/user32/misc/ddeserver.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/user32/misc/ddeserver.c [iso-8859-1] Thu Jan 8 22:57:09 2015 @@ -380,12 +380,12 @@ LOWORD(lParam) -- application atom HIWORD(lParam) -- topic atom */
- ERR("WM_DDE_INITIATE message received!\n"); + TRACE("WM_DDE_INITIATE message received!\n"); hwndClient = (HWND)wParam;
pInstance = WDML_GetInstanceFromWnd(hwndServer); if (!pInstance) return 0; - ERR("idInst=%d, threadID=0x%x\n", pInstance->instanceID, GetCurrentThreadId()); + TRACE("idInst=%d, threadID=0x%x\n", pInstance->instanceID, GetCurrentThreadId());
/* don't free DDEParams, since this is a broadcast */ UnpackDDElParam(WM_DDE_INITIATE, lParam, &uiLo, &uiHi);