2001-06-23 01:02:48 +02:00
|
|
|
/*
|
|
|
|
* DDEML library
|
|
|
|
*
|
|
|
|
* Copyright 1997 Alexandre Julliard
|
|
|
|
* Copyright 1997 Len White
|
|
|
|
* Copyright 1999 Keith Matthews
|
|
|
|
* Copyright 2000 Corel
|
|
|
|
* Copyright 2001 Eric Pouech
|
2005-02-14 12:53:15 +01:00
|
|
|
* Copyright 2003, 2004, 2005 Dmitry Timoshkov
|
2002-03-10 00:29:33 +01:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library 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
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2001-06-23 01:02:48 +02:00
|
|
|
*/
|
|
|
|
|
2003-09-06 01:08:26 +02:00
|
|
|
#include <stdarg.h>
|
2001-06-23 01:02:48 +02:00
|
|
|
#include <string.h>
|
|
|
|
#include "windef.h"
|
2003-09-06 01:08:26 +02:00
|
|
|
#include "winbase.h"
|
2001-06-23 01:02:48 +02:00
|
|
|
#include "wingdi.h"
|
|
|
|
#include "winuser.h"
|
|
|
|
#include "dde.h"
|
|
|
|
#include "ddeml.h"
|
2001-09-14 02:24:39 +02:00
|
|
|
#include "win.h"
|
2002-03-10 00:29:33 +01:00
|
|
|
#include "wine/debug.h"
|
2005-06-09 12:21:31 +02:00
|
|
|
#include "dde_private.h"
|
2001-06-23 01:02:48 +02:00
|
|
|
|
2002-03-10 00:29:33 +01:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(ddeml);
|
2001-06-23 01:02:48 +02:00
|
|
|
|
2005-02-14 12:53:15 +01:00
|
|
|
static const WCHAR szServerNameClass[] = {'W','i','n','e','D','d','e','S','e','r','v','e','r','N','a','m','e',0};
|
2005-07-08 13:33:09 +02:00
|
|
|
const char WDML_szServerConvClassA[] = "WineDdeServerConvA";
|
|
|
|
const WCHAR WDML_szServerConvClassW[] = {'W','i','n','e','D','d','e','S','e','r','v','e','r','C','o','n','v','W',0};
|
2001-06-23 01:02:48 +02:00
|
|
|
|
|
|
|
static LRESULT CALLBACK WDML_ServerNameProc(HWND, UINT, WPARAM, LPARAM);
|
|
|
|
static LRESULT CALLBACK WDML_ServerConvProc(HWND, UINT, WPARAM, LPARAM);
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* DdePostAdvise [USER32.@] Send transaction to DDE callback function.
|
|
|
|
*
|
2001-08-10 00:07:22 +02:00
|
|
|
* PARAMS
|
|
|
|
* idInst [I] Instance identifier
|
|
|
|
* hszTopic [I] Handle to topic name string
|
|
|
|
* hszItem [I] Handle to item name string
|
|
|
|
*
|
2001-06-23 01:02:48 +02:00
|
|
|
* RETURNS
|
|
|
|
* Success: TRUE
|
|
|
|
* Failure: FALSE
|
|
|
|
*/
|
2001-08-10 00:07:22 +02:00
|
|
|
BOOL WINAPI DdePostAdvise(DWORD idInst, HSZ hszTopic, HSZ hszItem)
|
2001-06-23 01:02:48 +02:00
|
|
|
{
|
2001-08-10 00:07:22 +02:00
|
|
|
WDML_INSTANCE* pInstance = NULL;
|
2001-06-23 01:02:48 +02:00
|
|
|
WDML_LINK* pLink = NULL;
|
2002-01-18 20:30:15 +01:00
|
|
|
HDDEDATA hDdeData = 0;
|
|
|
|
HGLOBAL hItemData = 0;
|
2001-06-23 01:02:48 +02:00
|
|
|
WDML_CONV* pConv = NULL;
|
2001-08-10 00:07:22 +02:00
|
|
|
ATOM atom = 0;
|
|
|
|
UINT count;
|
|
|
|
|
2006-09-30 00:25:15 +02:00
|
|
|
TRACE("(%d,%p,%p)\n", idInst, hszTopic, hszItem);
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2001-08-10 00:07:22 +02:00
|
|
|
pInstance = WDML_GetInstance(idInst);
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2001-08-10 00:07:22 +02:00
|
|
|
if (pInstance == NULL || pInstance->links == NULL)
|
2006-11-15 14:22:35 +01:00
|
|
|
return FALSE;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2001-08-10 00:07:22 +02:00
|
|
|
atom = WDML_MakeAtomFromHsz(hszItem);
|
2006-11-15 14:22:35 +01:00
|
|
|
if (!atom) return FALSE;
|
2001-08-10 00:07:22 +02:00
|
|
|
|
|
|
|
/* first compute the number of links which will trigger a message */
|
|
|
|
count = 0;
|
|
|
|
for (pLink = pInstance->links[WDML_SERVER_SIDE]; pLink != NULL; pLink = pLink->next)
|
|
|
|
{
|
|
|
|
if (DdeCmpStringHandles(hszItem, pLink->hszItem) == 0)
|
|
|
|
{
|
|
|
|
count++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (count >= CADV_LATEACK)
|
2001-06-23 01:02:48 +02:00
|
|
|
{
|
2001-08-10 00:07:22 +02:00
|
|
|
FIXME("too high value for count\n");
|
|
|
|
count &= 0xFFFF;
|
2001-06-23 01:02:48 +02:00
|
|
|
}
|
2001-08-10 00:07:22 +02:00
|
|
|
|
|
|
|
for (pLink = pInstance->links[WDML_SERVER_SIDE]; pLink != NULL; pLink = pLink->next)
|
2001-06-23 01:02:48 +02:00
|
|
|
{
|
|
|
|
if (DdeCmpStringHandles(hszItem, pLink->hszItem) == 0)
|
|
|
|
{
|
2001-08-10 00:07:22 +02:00
|
|
|
hDdeData = WDML_InvokeCallback(pInstance, XTYP_ADVREQ, pLink->uFmt, pLink->hConv,
|
2003-06-04 22:16:17 +02:00
|
|
|
hszTopic, hszItem, 0, --count, 0);
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2008-01-21 21:06:56 +01:00
|
|
|
if (hDdeData == CBR_BLOCK)
|
2001-08-10 00:07:22 +02:00
|
|
|
{
|
|
|
|
/* MS doc is not consistent here */
|
|
|
|
FIXME("CBR_BLOCK returned for ADVREQ\n");
|
|
|
|
continue;
|
2001-06-23 01:02:48 +02:00
|
|
|
}
|
|
|
|
if (hDdeData)
|
|
|
|
{
|
|
|
|
if (pLink->transactionType & XTYPF_NODATA)
|
|
|
|
{
|
|
|
|
TRACE("no data\n");
|
|
|
|
hItemData = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
TRACE("with data\n");
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2001-06-23 01:02:48 +02:00
|
|
|
hItemData = WDML_DataHandle2Global(hDdeData, FALSE, FALSE, FALSE, FALSE);
|
|
|
|
}
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2001-08-10 00:07:22 +02:00
|
|
|
pConv = WDML_GetConv(pLink->hConv, TRUE);
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2001-08-10 00:07:22 +02:00
|
|
|
if (pConv == NULL)
|
|
|
|
{
|
2002-01-18 20:30:15 +01:00
|
|
|
if (!WDML_IsAppOwned(hDdeData)) DdeFreeDataHandle(hDdeData);
|
2001-08-10 00:07:22 +02:00
|
|
|
goto theError;
|
|
|
|
}
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2005-02-14 12:53:15 +01:00
|
|
|
if (!PostMessageW(pConv->hwndClient, WM_DDE_DATA, (WPARAM)pConv->hwndServer,
|
2003-05-20 01:27:16 +02:00
|
|
|
PackDDElParam(WM_DDE_DATA, (UINT_PTR)hItemData, atom)))
|
2001-06-23 01:02:48 +02:00
|
|
|
{
|
|
|
|
ERR("post message failed\n");
|
2002-01-18 20:30:15 +01:00
|
|
|
pConv->wStatus &= ~ST_CONNECTED;
|
2006-11-15 14:21:44 +01:00
|
|
|
pConv->instance->lastError = DMLERR_POSTMSG_FAILED;
|
2002-01-18 20:30:15 +01:00
|
|
|
if (!WDML_IsAppOwned(hDdeData)) DdeFreeDataHandle(hDdeData);
|
2001-08-10 00:07:22 +02:00
|
|
|
GlobalFree(hItemData);
|
|
|
|
goto theError;
|
2002-06-01 01:06:46 +02:00
|
|
|
}
|
2002-01-18 20:30:15 +01:00
|
|
|
if (!WDML_IsAppOwned(hDdeData)) DdeFreeDataHandle(hDdeData);
|
2001-06-23 01:02:48 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return TRUE;
|
2006-11-15 14:22:35 +01:00
|
|
|
|
2001-08-10 00:07:22 +02:00
|
|
|
theError:
|
|
|
|
if (atom) GlobalDeleteAtom(atom);
|
|
|
|
return FALSE;
|
2001-06-23 01:02:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* DdeNameService [USER32.@] {Un}registers service name of DDE server
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* idInst [I] Instance identifier
|
|
|
|
* hsz1 [I] Handle to service name string
|
|
|
|
* hsz2 [I] Reserved
|
|
|
|
* afCmd [I] Service name flags
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Success: Non-zero
|
|
|
|
* Failure: 0
|
|
|
|
*/
|
|
|
|
HDDEDATA WINAPI DdeNameService(DWORD idInst, HSZ hsz1, HSZ hsz2, UINT afCmd)
|
|
|
|
{
|
|
|
|
WDML_SERVER* pServer;
|
2001-08-10 00:07:22 +02:00
|
|
|
WDML_INSTANCE* pInstance;
|
2001-06-23 01:02:48 +02:00
|
|
|
HWND hwndServer;
|
2005-02-14 12:53:15 +01:00
|
|
|
WNDCLASSEXW wndclass;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2006-09-30 00:25:15 +02:00
|
|
|
TRACE("(%d,%p,%p,%x)\n", idInst, hsz1, hsz2, afCmd);
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2001-06-23 01:02:48 +02:00
|
|
|
/* First check instance
|
|
|
|
*/
|
2001-08-10 00:07:22 +02:00
|
|
|
pInstance = WDML_GetInstance(idInst);
|
|
|
|
if (pInstance == NULL)
|
2001-06-23 01:02:48 +02:00
|
|
|
{
|
|
|
|
TRACE("Instance not found as initialised\n");
|
|
|
|
/* Nothing has been initialised - exit now ! can return TRUE since effect is the same */
|
2006-11-15 14:22:35 +01:00
|
|
|
return NULL;
|
2001-06-23 01:02:48 +02:00
|
|
|
}
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2001-06-23 01:02:48 +02:00
|
|
|
if (hsz2 != 0L)
|
|
|
|
{
|
|
|
|
/* Illegal, reserved parameter
|
|
|
|
*/
|
2001-08-10 00:07:22 +02:00
|
|
|
pInstance->lastError = DMLERR_INVALIDPARAMETER;
|
|
|
|
WARN("Reserved parameter no-zero !!\n");
|
2006-11-15 14:22:35 +01:00
|
|
|
return NULL;
|
2001-06-23 01:02:48 +02:00
|
|
|
}
|
2003-05-20 01:27:16 +02:00
|
|
|
if (hsz1 == 0 && !(afCmd & DNS_UNREGISTER))
|
2001-06-23 01:02:48 +02:00
|
|
|
{
|
2001-08-10 00:07:22 +02:00
|
|
|
/* don't know if we should check this but it makes sense
|
|
|
|
* why supply REGISTER or filter flags if de-registering all
|
2001-06-23 01:02:48 +02:00
|
|
|
*/
|
2001-08-10 00:07:22 +02:00
|
|
|
TRACE("General unregister unexpected flags\n");
|
|
|
|
pInstance->lastError = DMLERR_INVALIDPARAMETER;
|
2006-11-15 14:22:35 +01:00
|
|
|
return NULL;
|
2001-06-23 01:02:48 +02:00
|
|
|
}
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2003-05-20 01:27:16 +02:00
|
|
|
switch (afCmd & (DNS_REGISTER | DNS_UNREGISTER))
|
2001-06-23 01:02:48 +02:00
|
|
|
{
|
2001-08-10 00:07:22 +02:00
|
|
|
case DNS_REGISTER:
|
|
|
|
pServer = WDML_FindServer(pInstance, hsz1, 0);
|
2001-06-23 01:02:48 +02:00
|
|
|
if (pServer)
|
|
|
|
{
|
2001-08-10 00:07:22 +02:00
|
|
|
ERR("Trying to register already registered service!\n");
|
|
|
|
pInstance->lastError = DMLERR_DLL_USAGE;
|
2006-11-15 14:22:35 +01:00
|
|
|
return NULL;
|
2002-06-01 01:06:46 +02:00
|
|
|
}
|
2001-08-10 00:07:22 +02:00
|
|
|
|
|
|
|
TRACE("Adding service name\n");
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2001-08-10 00:07:22 +02:00
|
|
|
WDML_IncHSZ(pInstance, hsz1);
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2001-08-10 00:07:22 +02:00
|
|
|
pServer = WDML_AddServer(pInstance, hsz1, 0);
|
2002-06-01 01:06:46 +02:00
|
|
|
|
|
|
|
WDML_BroadcastDDEWindows(WDML_szEventClass, WM_WDML_REGISTER,
|
2001-08-10 00:07:22 +02:00
|
|
|
pServer->atomService, pServer->atomServiceSpec);
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2001-06-23 01:02:48 +02:00
|
|
|
wndclass.cbSize = sizeof(wndclass);
|
|
|
|
wndclass.style = 0;
|
|
|
|
wndclass.lpfnWndProc = WDML_ServerNameProc;
|
|
|
|
wndclass.cbClsExtra = 0;
|
2005-02-14 12:53:15 +01:00
|
|
|
wndclass.cbWndExtra = 2 * sizeof(ULONG_PTR);
|
2001-06-23 01:02:48 +02:00
|
|
|
wndclass.hInstance = 0;
|
|
|
|
wndclass.hIcon = 0;
|
|
|
|
wndclass.hCursor = 0;
|
|
|
|
wndclass.hbrBackground = 0;
|
|
|
|
wndclass.lpszMenuName = NULL;
|
2005-02-14 12:53:15 +01:00
|
|
|
wndclass.lpszClassName = szServerNameClass;
|
2001-06-23 01:02:48 +02:00
|
|
|
wndclass.hIconSm = 0;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2005-02-14 12:53:15 +01:00
|
|
|
RegisterClassExW(&wndclass);
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2005-02-14 12:53:15 +01:00
|
|
|
hwndServer = CreateWindowW(szServerNameClass, NULL,
|
2001-06-23 01:02:48 +02:00
|
|
|
WS_POPUP, 0, 0, 0, 0,
|
|
|
|
0, 0, 0, 0);
|
2001-08-10 00:07:22 +02:00
|
|
|
|
2005-02-14 12:53:15 +01:00
|
|
|
SetWindowLongPtrW(hwndServer, GWL_WDML_INSTANCE, (ULONG_PTR)pInstance);
|
|
|
|
SetWindowLongPtrW(hwndServer, GWL_WDML_SERVER, (ULONG_PTR)pServer);
|
2006-09-30 00:25:15 +02:00
|
|
|
TRACE("Created nameServer=%p for instance=%08x\n", hwndServer, idInst);
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2001-06-23 01:02:48 +02:00
|
|
|
pServer->hwndServer = hwndServer;
|
2001-08-10 00:07:22 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case DNS_UNREGISTER:
|
|
|
|
if (hsz1 == 0L)
|
2001-06-23 01:02:48 +02:00
|
|
|
{
|
2001-08-10 00:07:22 +02:00
|
|
|
/* General unregister situation
|
2002-06-01 01:06:46 +02:00
|
|
|
* terminate all server side pending conversations
|
2001-06-23 01:02:48 +02:00
|
|
|
*/
|
2001-08-10 00:07:22 +02:00
|
|
|
while (pInstance->servers)
|
|
|
|
WDML_RemoveServer(pInstance, pInstance->servers->hszService, 0);
|
|
|
|
pInstance->servers = NULL;
|
|
|
|
TRACE("General de-register - finished\n");
|
|
|
|
}
|
|
|
|
else
|
2001-06-23 01:02:48 +02:00
|
|
|
{
|
2001-08-10 00:07:22 +02:00
|
|
|
WDML_RemoveServer(pInstance, hsz1, 0L);
|
2001-06-23 01:02:48 +02:00
|
|
|
}
|
2001-08-10 00:07:22 +02:00
|
|
|
break;
|
2003-05-20 01:27:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (afCmd & (DNS_FILTERON | DNS_FILTEROFF))
|
|
|
|
{
|
2001-06-23 01:02:48 +02:00
|
|
|
/* Set filter flags on to hold notifications of connection
|
|
|
|
*/
|
2001-08-10 00:07:22 +02:00
|
|
|
pServer = WDML_FindServer(pInstance, hsz1, 0);
|
2001-06-23 01:02:48 +02:00
|
|
|
if (!pServer)
|
|
|
|
{
|
|
|
|
/* trying to filter where no service names !!
|
|
|
|
*/
|
2001-08-10 00:07:22 +02:00
|
|
|
pInstance->lastError = DMLERR_DLL_USAGE;
|
2006-11-15 14:22:35 +01:00
|
|
|
return NULL;
|
2002-06-01 01:06:46 +02:00
|
|
|
}
|
|
|
|
else
|
2001-06-23 01:02:48 +02:00
|
|
|
{
|
2003-05-20 01:27:16 +02:00
|
|
|
pServer->filterOn = (afCmd & DNS_FILTERON) != 0;
|
2001-06-23 01:02:48 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return (HDDEDATA)TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************
|
|
|
|
* WDML_CreateServerConv
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*/
|
2002-06-01 01:06:46 +02:00
|
|
|
static WDML_CONV* WDML_CreateServerConv(WDML_INSTANCE* pInstance, HWND hwndClient,
|
2001-08-10 00:07:22 +02:00
|
|
|
HWND hwndServerName, HSZ hszApp, HSZ hszTopic)
|
2001-06-23 01:02:48 +02:00
|
|
|
{
|
|
|
|
HWND hwndServerConv;
|
|
|
|
WDML_CONV* pConv;
|
2005-07-08 13:33:09 +02:00
|
|
|
|
|
|
|
if (pInstance->unicode)
|
|
|
|
{
|
|
|
|
WNDCLASSEXW wndclass;
|
|
|
|
|
|
|
|
wndclass.cbSize = sizeof(wndclass);
|
|
|
|
wndclass.style = 0;
|
|
|
|
wndclass.lpfnWndProc = WDML_ServerConvProc;
|
|
|
|
wndclass.cbClsExtra = 0;
|
|
|
|
wndclass.cbWndExtra = 2 * sizeof(ULONG_PTR);
|
|
|
|
wndclass.hInstance = 0;
|
|
|
|
wndclass.hIcon = 0;
|
|
|
|
wndclass.hCursor = 0;
|
|
|
|
wndclass.hbrBackground = 0;
|
|
|
|
wndclass.lpszMenuName = NULL;
|
|
|
|
wndclass.lpszClassName = WDML_szServerConvClassW;
|
|
|
|
wndclass.hIconSm = 0;
|
|
|
|
|
|
|
|
RegisterClassExW(&wndclass);
|
|
|
|
|
|
|
|
hwndServerConv = CreateWindowW(WDML_szServerConvClassW, 0,
|
2001-08-10 00:07:22 +02:00
|
|
|
WS_CHILD, 0, 0, 0, 0,
|
|
|
|
hwndServerName, 0, 0, 0);
|
2005-07-08 13:33:09 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
WNDCLASSEXA wndclass;
|
|
|
|
|
|
|
|
wndclass.cbSize = sizeof(wndclass);
|
|
|
|
wndclass.style = 0;
|
|
|
|
wndclass.lpfnWndProc = WDML_ServerConvProc;
|
|
|
|
wndclass.cbClsExtra = 0;
|
|
|
|
wndclass.cbWndExtra = 2 * sizeof(ULONG_PTR);
|
|
|
|
wndclass.hInstance = 0;
|
|
|
|
wndclass.hIcon = 0;
|
|
|
|
wndclass.hCursor = 0;
|
|
|
|
wndclass.hbrBackground = 0;
|
|
|
|
wndclass.lpszMenuName = NULL;
|
|
|
|
wndclass.lpszClassName = WDML_szServerConvClassA;
|
|
|
|
wndclass.hIconSm = 0;
|
|
|
|
|
|
|
|
RegisterClassExA(&wndclass);
|
|
|
|
|
|
|
|
hwndServerConv = CreateWindowA(WDML_szServerConvClassA, 0,
|
|
|
|
WS_CHILD, 0, 0, 0, 0,
|
|
|
|
hwndServerName, 0, 0, 0);
|
|
|
|
}
|
2001-08-10 00:07:22 +02:00
|
|
|
|
2006-09-30 00:25:15 +02:00
|
|
|
TRACE("Created convServer=%p (nameServer=%p) for instance=%08x\n",
|
2001-08-10 00:07:22 +02:00
|
|
|
hwndServerConv, hwndServerName, pInstance->instanceID);
|
2002-06-01 01:06:46 +02:00
|
|
|
|
|
|
|
pConv = WDML_AddConv(pInstance, WDML_SERVER_SIDE, hszApp, hszTopic,
|
2001-08-10 00:07:22 +02:00
|
|
|
hwndClient, hwndServerConv);
|
|
|
|
if (pConv)
|
2001-06-23 01:02:48 +02:00
|
|
|
{
|
2005-02-14 12:53:15 +01:00
|
|
|
SetWindowLongPtrW(hwndServerConv, GWL_WDML_INSTANCE, (ULONG_PTR)pInstance);
|
|
|
|
SetWindowLongPtrW(hwndServerConv, GWL_WDML_CONVERSATION, (ULONG_PTR)pConv);
|
2001-08-10 00:07:22 +02:00
|
|
|
|
|
|
|
/* this should be the only place using SendMessage for WM_DDE_ACK */
|
2002-01-18 20:30:15 +01:00
|
|
|
/* note: sent messages shall not use packing */
|
2005-02-14 12:53:15 +01:00
|
|
|
SendMessageW(hwndClient, WM_DDE_ACK, (WPARAM)hwndServerConv,
|
2002-01-18 20:30:15 +01:00
|
|
|
MAKELPARAM(WDML_MakeAtomFromHsz(hszApp), WDML_MakeAtomFromHsz(hszTopic)));
|
2002-06-01 01:06:46 +02:00
|
|
|
/* we assume we're connected since we've sent an answer...
|
2001-08-10 00:07:22 +02:00
|
|
|
* I'm not sure what we can do... it doesn't look like the return value
|
|
|
|
* of SendMessage is used... sigh...
|
2001-06-23 01:02:48 +02:00
|
|
|
*/
|
2001-08-10 00:07:22 +02:00
|
|
|
pConv->wStatus |= ST_CONNECTED;
|
2001-06-23 01:02:48 +02:00
|
|
|
}
|
2001-08-10 00:07:22 +02:00
|
|
|
else
|
|
|
|
{
|
|
|
|
DestroyWindow(hwndServerConv);
|
|
|
|
}
|
|
|
|
return pConv;
|
2001-06-23 01:02:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************
|
|
|
|
* WDML_ServerNameProc
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
static LRESULT CALLBACK WDML_ServerNameProc(HWND hwndServer, UINT iMsg, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
|
|
|
HWND hwndClient;
|
|
|
|
HSZ hszApp, hszTop;
|
|
|
|
HDDEDATA hDdeData = 0;
|
2001-08-10 00:07:22 +02:00
|
|
|
WDML_INSTANCE* pInstance;
|
2003-05-20 01:27:16 +02:00
|
|
|
UINT_PTR uiLo, uiHi;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2001-06-23 01:02:48 +02:00
|
|
|
switch (iMsg)
|
|
|
|
{
|
|
|
|
case WM_DDE_INITIATE:
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2001-06-23 01:02:48 +02:00
|
|
|
/* wParam -- sending window handle
|
|
|
|
LOWORD(lParam) -- application atom
|
|
|
|
HIWORD(lParam) -- topic atom */
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2001-08-10 00:07:22 +02:00
|
|
|
TRACE("WM_DDE_INITIATE message received!\n");
|
2001-06-23 01:02:48 +02:00
|
|
|
hwndClient = (HWND)wParam;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2001-08-10 00:07:22 +02:00
|
|
|
pInstance = WDML_GetInstanceFromWnd(hwndServer);
|
2006-09-30 00:25:15 +02:00
|
|
|
TRACE("idInst=%d, threadID=0x%x\n", pInstance->instanceID, GetCurrentThreadId());
|
2001-08-10 00:07:22 +02:00
|
|
|
if (!pInstance) return 0;
|
|
|
|
|
2001-06-23 01:02:48 +02:00
|
|
|
/* don't free DDEParams, since this is a broadcast */
|
2002-06-01 01:06:46 +02:00
|
|
|
UnpackDDElParam(WM_DDE_INITIATE, lParam, &uiLo, &uiHi);
|
|
|
|
|
2001-08-10 00:07:22 +02:00
|
|
|
hszApp = WDML_MakeHszFromAtom(pInstance, uiLo);
|
|
|
|
hszTop = WDML_MakeHszFromAtom(pInstance, uiHi);
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2001-08-10 00:07:22 +02:00
|
|
|
if (!(pInstance->CBFflags & CBF_FAIL_CONNECTIONS))
|
2001-06-23 01:02:48 +02:00
|
|
|
{
|
2001-08-10 00:07:22 +02:00
|
|
|
BOOL self = FALSE;
|
|
|
|
CONVCONTEXT cc;
|
|
|
|
CONVCONTEXT* pcc = NULL;
|
|
|
|
WDML_CONV* pConv;
|
2005-07-08 13:33:09 +02:00
|
|
|
char buf[256];
|
2001-08-10 00:07:22 +02:00
|
|
|
|
|
|
|
if (GetWindowThreadProcessId(hwndClient, NULL) == GetWindowThreadProcessId(hwndServer, NULL) &&
|
|
|
|
WDML_GetInstanceFromWnd(hwndClient) == WDML_GetInstanceFromWnd(hwndServer))
|
|
|
|
{
|
|
|
|
self = TRUE;
|
|
|
|
}
|
|
|
|
/* FIXME: so far, we don't grab distant convcontext, so only check if remote is
|
|
|
|
* handled under DDEML, and if so build a default context
|
|
|
|
*/
|
2005-07-08 13:33:09 +02:00
|
|
|
if ((GetClassNameA(hwndClient, buf, sizeof(buf)) &&
|
|
|
|
lstrcmpiA(buf, WDML_szClientConvClassA) == 0) ||
|
|
|
|
(GetClassNameW(hwndClient, (LPWSTR)buf, sizeof(buf)/sizeof(WCHAR)) &&
|
|
|
|
lstrcmpiW((LPWSTR)buf, WDML_szClientConvClassW) == 0))
|
2001-08-10 00:07:22 +02:00
|
|
|
{
|
|
|
|
pcc = &cc;
|
|
|
|
memset(pcc, 0, sizeof(*pcc));
|
|
|
|
pcc->cb = sizeof(*pcc);
|
2005-07-08 13:33:09 +02:00
|
|
|
pcc->iCodePage = IsWindowUnicode(hwndClient) ? CP_WINUNICODE : CP_WINANSI;
|
2001-08-10 00:07:22 +02:00
|
|
|
}
|
|
|
|
if ((pInstance->CBFflags & CBF_FAIL_SELFCONNECTIONS) && self)
|
|
|
|
{
|
|
|
|
TRACE("Don't do self connection as requested\n");
|
|
|
|
}
|
2002-06-01 01:06:46 +02:00
|
|
|
else if (hszApp && hszTop)
|
2001-06-23 01:02:48 +02:00
|
|
|
{
|
2005-02-14 12:53:15 +01:00
|
|
|
WDML_SERVER* pServer = (WDML_SERVER*)GetWindowLongPtrW(hwndServer, GWL_WDML_SERVER);
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2001-08-10 00:07:22 +02:00
|
|
|
/* check filters for name service */
|
|
|
|
if (!pServer->filterOn || DdeCmpStringHandles(pServer->hszService, hszApp) == 0)
|
2001-06-23 01:02:48 +02:00
|
|
|
{
|
2001-08-10 00:07:22 +02:00
|
|
|
/* pass on to the callback */
|
|
|
|
hDdeData = WDML_InvokeCallback(pInstance, XTYP_CONNECT,
|
2004-04-27 01:29:44 +02:00
|
|
|
0, 0, hszTop, hszApp, 0, (ULONG_PTR)pcc, self);
|
2005-02-14 12:53:15 +01:00
|
|
|
if ((ULONG_PTR)hDdeData)
|
2001-08-10 00:07:22 +02:00
|
|
|
{
|
2002-06-01 01:06:46 +02:00
|
|
|
pConv = WDML_CreateServerConv(pInstance, hwndClient, hwndServer,
|
2001-08-10 00:07:22 +02:00
|
|
|
hszApp, hszTop);
|
2003-05-20 01:27:16 +02:00
|
|
|
if (pConv)
|
|
|
|
{
|
|
|
|
if (pcc) pConv->wStatus |= ST_ISLOCAL;
|
|
|
|
WDML_InvokeCallback(pInstance, XTYP_CONNECT_CONFIRM, 0, (HCONV)pConv,
|
2004-04-27 01:29:44 +02:00
|
|
|
hszTop, hszApp, 0, (ULONG_PTR)pcc, self);
|
2003-05-20 01:27:16 +02:00
|
|
|
}
|
2001-08-10 00:07:22 +02:00
|
|
|
}
|
2001-06-23 01:02:48 +02:00
|
|
|
}
|
|
|
|
}
|
2001-08-10 00:07:22 +02:00
|
|
|
else if (pInstance->servers)
|
2001-06-23 01:02:48 +02:00
|
|
|
{
|
2001-08-10 00:07:22 +02:00
|
|
|
/* pass on to the callback */
|
|
|
|
hDdeData = WDML_InvokeCallback(pInstance, XTYP_WILDCONNECT,
|
2004-04-27 01:29:44 +02:00
|
|
|
0, 0, hszTop, hszApp, 0, (ULONG_PTR)pcc, self);
|
2001-08-10 00:07:22 +02:00
|
|
|
|
2008-01-21 21:06:56 +01:00
|
|
|
if (hDdeData == CBR_BLOCK)
|
2001-08-10 00:07:22 +02:00
|
|
|
{
|
|
|
|
/* MS doc is not consistent here */
|
|
|
|
FIXME("CBR_BLOCK returned for WILDCONNECT\n");
|
|
|
|
}
|
2005-02-14 12:53:15 +01:00
|
|
|
else if ((ULONG_PTR)hDdeData != 0)
|
2001-06-23 01:02:48 +02:00
|
|
|
{
|
|
|
|
HSZPAIR* hszp;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2001-06-23 01:02:48 +02:00
|
|
|
hszp = (HSZPAIR*)DdeAccessData(hDdeData, NULL);
|
|
|
|
if (hszp)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
for (i = 0; hszp[i].hszSvc && hszp[i].hszTopic; i++)
|
|
|
|
{
|
2002-06-01 01:06:46 +02:00
|
|
|
pConv = WDML_CreateServerConv(pInstance, hwndClient, hwndServer,
|
2001-08-10 00:07:22 +02:00
|
|
|
hszp[i].hszSvc, hszp[i].hszTopic);
|
2003-05-20 01:27:16 +02:00
|
|
|
if (pConv)
|
|
|
|
{
|
|
|
|
if (pcc) pConv->wStatus |= ST_ISLOCAL;
|
|
|
|
WDML_InvokeCallback(pInstance, XTYP_CONNECT_CONFIRM, 0, (HCONV)pConv,
|
2004-04-27 01:29:44 +02:00
|
|
|
hszp[i].hszTopic, hszp[i].hszSvc, 0, (ULONG_PTR)pcc, self);
|
2003-05-20 01:27:16 +02:00
|
|
|
}
|
2002-06-01 01:06:46 +02:00
|
|
|
}
|
2001-06-23 01:02:48 +02:00
|
|
|
DdeUnaccessData(hDdeData);
|
|
|
|
}
|
2002-01-18 20:30:15 +01:00
|
|
|
if (!WDML_IsAppOwned(hDdeData)) DdeFreeDataHandle(hDdeData);
|
2001-06-23 01:02:48 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2001-06-23 01:02:48 +02:00
|
|
|
return 0;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2001-06-23 01:02:48 +02:00
|
|
|
case WM_DDE_REQUEST:
|
|
|
|
FIXME("WM_DDE_REQUEST message received!\n");
|
|
|
|
return 0;
|
|
|
|
case WM_DDE_ADVISE:
|
|
|
|
FIXME("WM_DDE_ADVISE message received!\n");
|
|
|
|
return 0;
|
|
|
|
case WM_DDE_UNADVISE:
|
|
|
|
FIXME("WM_DDE_UNADVISE message received!\n");
|
|
|
|
return 0;
|
|
|
|
case WM_DDE_EXECUTE:
|
|
|
|
FIXME("WM_DDE_EXECUTE message received!\n");
|
|
|
|
return 0;
|
|
|
|
case WM_DDE_POKE:
|
|
|
|
FIXME("WM_DDE_POKE message received!\n");
|
|
|
|
return 0;
|
|
|
|
case WM_DDE_TERMINATE:
|
|
|
|
FIXME("WM_DDE_TERMINATE message received!\n");
|
|
|
|
return 0;
|
2005-02-14 12:53:15 +01:00
|
|
|
default:
|
|
|
|
break;
|
2001-06-23 01:02:48 +02:00
|
|
|
}
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2005-02-14 12:53:15 +01:00
|
|
|
return DefWindowProcW(hwndServer, iMsg, wParam, lParam);
|
2001-06-23 01:02:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************
|
2001-08-10 00:07:22 +02:00
|
|
|
* WDML_ServerQueueRequest
|
2001-06-23 01:02:48 +02:00
|
|
|
*
|
|
|
|
*
|
|
|
|
*/
|
2001-08-10 00:07:22 +02:00
|
|
|
static WDML_XACT* WDML_ServerQueueRequest(WDML_CONV* pConv, LPARAM lParam)
|
2001-06-23 01:02:48 +02:00
|
|
|
{
|
2003-05-20 01:27:16 +02:00
|
|
|
UINT_PTR uiLo, uiHi;
|
2001-08-10 00:07:22 +02:00
|
|
|
WDML_XACT* pXAct;
|
2001-06-23 01:02:48 +02:00
|
|
|
|
2001-08-10 00:07:22 +02:00
|
|
|
UnpackDDElParam(WM_DDE_REQUEST, lParam, &uiLo, &uiHi);
|
2001-06-23 01:02:48 +02:00
|
|
|
|
2002-06-01 01:06:46 +02:00
|
|
|
pXAct = WDML_AllocTransaction(pConv->instance, WM_DDE_REQUEST,
|
2001-08-10 00:07:22 +02:00
|
|
|
uiLo, WDML_MakeHszFromAtom(pConv->instance, uiHi));
|
|
|
|
if (pXAct) pXAct->atom = uiHi;
|
|
|
|
return pXAct;
|
|
|
|
}
|
2001-06-23 01:02:48 +02:00
|
|
|
|
2001-08-10 00:07:22 +02:00
|
|
|
/******************************************************************
|
|
|
|
* WDML_ServerHandleRequest
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
static WDML_QUEUE_STATE WDML_ServerHandleRequest(WDML_CONV* pConv, WDML_XACT* pXAct)
|
|
|
|
{
|
|
|
|
HDDEDATA hDdeData = 0;
|
2005-02-01 19:47:55 +01:00
|
|
|
BOOL fAck = TRUE;
|
2001-08-10 00:07:22 +02:00
|
|
|
|
|
|
|
if (!(pConv->instance->CBFflags & CBF_FAIL_REQUESTS))
|
2001-06-23 01:02:48 +02:00
|
|
|
{
|
2002-06-01 01:06:46 +02:00
|
|
|
|
|
|
|
hDdeData = WDML_InvokeCallback(pConv->instance, XTYP_REQUEST, pXAct->wFmt, (HCONV)pConv,
|
2001-08-10 00:07:22 +02:00
|
|
|
pConv->hszTopic, pXAct->hszItem, 0, 0, 0);
|
2001-06-23 01:02:48 +02:00
|
|
|
}
|
2001-08-10 00:07:22 +02:00
|
|
|
|
2003-05-20 01:27:16 +02:00
|
|
|
switch ((ULONG_PTR)hDdeData)
|
2001-06-23 01:02:48 +02:00
|
|
|
{
|
2001-08-10 00:07:22 +02:00
|
|
|
case 0:
|
2005-02-01 19:47:55 +01:00
|
|
|
TRACE("No data returned from the Callback\n");
|
|
|
|
fAck = FALSE;
|
2001-08-10 00:07:22 +02:00
|
|
|
break;
|
2005-02-01 19:47:55 +01:00
|
|
|
|
2004-06-14 21:35:14 +02:00
|
|
|
case (ULONG_PTR)CBR_BLOCK:
|
2005-02-01 19:47:55 +01:00
|
|
|
return WDML_QS_BLOCK;
|
|
|
|
|
2001-08-10 00:07:22 +02:00
|
|
|
default:
|
|
|
|
{
|
2003-06-04 22:16:17 +02:00
|
|
|
HGLOBAL hMem = WDML_DataHandle2Global(hDdeData, TRUE, FALSE, FALSE, FALSE);
|
2005-02-14 12:53:15 +01:00
|
|
|
if (!PostMessageW(pConv->hwndClient, WM_DDE_DATA, (WPARAM)pConv->hwndServer,
|
2002-06-01 01:06:46 +02:00
|
|
|
ReuseDDElParam(pXAct->lParam, WM_DDE_REQUEST, WM_DDE_DATA,
|
2003-06-04 22:16:17 +02:00
|
|
|
(UINT_PTR)hMem, (UINT_PTR)pXAct->atom)))
|
2001-08-10 00:07:22 +02:00
|
|
|
{
|
2006-11-15 14:21:44 +01:00
|
|
|
pConv->instance->lastError = DMLERR_POSTMSG_FAILED;
|
2001-08-10 00:07:22 +02:00
|
|
|
DdeFreeDataHandle(hDdeData);
|
|
|
|
GlobalFree(hMem);
|
2005-02-01 19:47:55 +01:00
|
|
|
fAck = FALSE;
|
2001-08-10 00:07:22 +02:00
|
|
|
}
|
2001-06-23 01:02:48 +02:00
|
|
|
}
|
2001-08-10 00:07:22 +02:00
|
|
|
break;
|
2001-06-23 01:02:48 +02:00
|
|
|
}
|
2005-02-01 19:47:55 +01:00
|
|
|
|
|
|
|
WDML_PostAck(pConv, WDML_SERVER_SIDE, 0, FALSE, fAck, pXAct->atom, pXAct->lParam, WM_DDE_REQUEST);
|
|
|
|
|
2001-08-10 00:07:22 +02:00
|
|
|
WDML_DecHSZ(pConv->instance, pXAct->hszItem);
|
2005-02-01 19:47:55 +01:00
|
|
|
|
|
|
|
return WDML_QS_HANDLED;
|
2001-06-23 01:02:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************
|
2001-08-10 00:07:22 +02:00
|
|
|
* WDML_ServerQueueAdvise
|
2001-06-23 01:02:48 +02:00
|
|
|
*
|
|
|
|
*
|
|
|
|
*/
|
2001-08-10 00:07:22 +02:00
|
|
|
static WDML_XACT* WDML_ServerQueueAdvise(WDML_CONV* pConv, LPARAM lParam)
|
2001-06-23 01:02:48 +02:00
|
|
|
{
|
2003-05-20 01:27:16 +02:00
|
|
|
UINT_PTR uiLo, uiHi;
|
2001-08-10 00:07:22 +02:00
|
|
|
WDML_XACT* pXAct;
|
2001-06-23 01:02:48 +02:00
|
|
|
|
2002-06-01 01:06:46 +02:00
|
|
|
/* XTYP_ADVSTART transaction:
|
2001-06-23 01:02:48 +02:00
|
|
|
establish link and save link info to InstanceInfoTable */
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2002-01-18 20:30:15 +01:00
|
|
|
if (!UnpackDDElParam(WM_DDE_ADVISE, lParam, &uiLo, &uiHi))
|
|
|
|
return NULL;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
|
|
|
pXAct = WDML_AllocTransaction(pConv->instance, WM_DDE_ADVISE,
|
2001-08-10 00:07:22 +02:00
|
|
|
0, WDML_MakeHszFromAtom(pConv->instance, uiHi));
|
|
|
|
if (pXAct)
|
2001-06-23 01:02:48 +02:00
|
|
|
{
|
2001-08-10 00:07:22 +02:00
|
|
|
pXAct->hMem = (HGLOBAL)uiLo;
|
|
|
|
pXAct->atom = uiHi;
|
2001-06-23 01:02:48 +02:00
|
|
|
}
|
2001-08-10 00:07:22 +02:00
|
|
|
return pXAct;
|
|
|
|
}
|
2001-06-23 01:02:48 +02:00
|
|
|
|
2001-08-10 00:07:22 +02:00
|
|
|
/******************************************************************
|
|
|
|
* WDML_ServerHandleAdvise
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
static WDML_QUEUE_STATE WDML_ServerHandleAdvise(WDML_CONV* pConv, WDML_XACT* pXAct)
|
|
|
|
{
|
|
|
|
UINT uType;
|
|
|
|
WDML_LINK* pLink;
|
|
|
|
DDEADVISE* pDdeAdvise;
|
2005-02-01 19:47:55 +01:00
|
|
|
HDDEDATA hDdeData = 0;
|
|
|
|
BOOL fAck = TRUE;
|
2001-08-10 00:07:22 +02:00
|
|
|
|
|
|
|
pDdeAdvise = (DDEADVISE*)GlobalLock(pXAct->hMem);
|
2002-06-01 01:06:46 +02:00
|
|
|
uType = XTYP_ADVSTART |
|
2001-06-23 01:02:48 +02:00
|
|
|
(pDdeAdvise->fDeferUpd ? XTYPF_NODATA : 0) |
|
|
|
|
(pDdeAdvise->fAckReq ? XTYPF_ACKREQ : 0);
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2001-08-10 00:07:22 +02:00
|
|
|
if (!(pConv->instance->CBFflags & CBF_FAIL_ADVISES))
|
2001-06-23 01:02:48 +02:00
|
|
|
{
|
2002-06-01 01:06:46 +02:00
|
|
|
hDdeData = WDML_InvokeCallback(pConv->instance, XTYP_ADVSTART, pDdeAdvise->cfFormat,
|
2001-08-10 00:07:22 +02:00
|
|
|
(HCONV)pConv, pConv->hszTopic, pXAct->hszItem, 0, 0, 0);
|
|
|
|
}
|
2001-06-23 01:02:48 +02:00
|
|
|
|
2005-02-01 19:47:55 +01:00
|
|
|
switch ((ULONG_PTR)hDdeData)
|
2001-06-23 01:02:48 +02:00
|
|
|
{
|
2005-02-01 19:47:55 +01:00
|
|
|
case 0:
|
|
|
|
TRACE("No data returned from the Callback\n");
|
|
|
|
fAck = FALSE;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case (ULONG_PTR)CBR_BLOCK:
|
|
|
|
return WDML_QS_BLOCK;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2005-02-01 19:47:55 +01:00
|
|
|
default:
|
2001-06-23 01:02:48 +02:00
|
|
|
/* billx: first to see if the link is already created. */
|
2002-06-01 01:06:46 +02:00
|
|
|
pLink = WDML_FindLink(pConv->instance, (HCONV)pConv, WDML_SERVER_SIDE,
|
2002-01-18 20:30:15 +01:00
|
|
|
pXAct->hszItem, TRUE, pDdeAdvise->cfFormat);
|
2001-06-23 01:02:48 +02:00
|
|
|
|
|
|
|
if (pLink != NULL)
|
|
|
|
{
|
|
|
|
/* we found a link, and only need to modify it in case it changes */
|
|
|
|
pLink->transactionType = uType;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2003-05-20 01:27:16 +02:00
|
|
|
TRACE("Adding Link with hConv %p\n", pConv);
|
2002-06-01 01:06:46 +02:00
|
|
|
WDML_AddLink(pConv->instance, (HCONV)pConv, WDML_SERVER_SIDE,
|
2001-08-10 00:07:22 +02:00
|
|
|
uType, pXAct->hszItem, pDdeAdvise->cfFormat);
|
2001-06-23 01:02:48 +02:00
|
|
|
}
|
2005-02-01 19:47:55 +01:00
|
|
|
break;
|
2001-06-23 01:02:48 +02:00
|
|
|
}
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2001-08-10 00:07:22 +02:00
|
|
|
GlobalUnlock(pXAct->hMem);
|
|
|
|
if (fAck)
|
2002-01-18 20:30:15 +01:00
|
|
|
{
|
2001-08-10 00:07:22 +02:00
|
|
|
GlobalFree(pXAct->hMem);
|
2002-01-18 20:30:15 +01:00
|
|
|
}
|
|
|
|
pXAct->hMem = 0;
|
2001-08-10 00:07:22 +02:00
|
|
|
|
|
|
|
WDML_PostAck(pConv, WDML_SERVER_SIDE, 0, FALSE, fAck, pXAct->atom, pXAct->lParam, WM_DDE_ADVISE);
|
|
|
|
|
|
|
|
WDML_DecHSZ(pConv->instance, pXAct->hszItem);
|
2001-06-23 01:02:48 +02:00
|
|
|
|
2001-08-10 00:07:22 +02:00
|
|
|
return WDML_QS_HANDLED;
|
2001-06-23 01:02:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************
|
2001-08-10 00:07:22 +02:00
|
|
|
* WDML_ServerQueueUnadvise
|
2001-06-23 01:02:48 +02:00
|
|
|
*
|
|
|
|
*
|
|
|
|
*/
|
2001-08-10 00:07:22 +02:00
|
|
|
static WDML_XACT* WDML_ServerQueueUnadvise(WDML_CONV* pConv, LPARAM lParam)
|
2001-06-23 01:02:48 +02:00
|
|
|
{
|
2003-05-20 01:27:16 +02:00
|
|
|
UINT_PTR uiLo, uiHi;
|
2001-08-10 00:07:22 +02:00
|
|
|
WDML_XACT* pXAct;
|
2001-06-23 01:02:48 +02:00
|
|
|
|
|
|
|
UnpackDDElParam(WM_DDE_UNADVISE, lParam, &uiLo, &uiHi);
|
2002-06-01 01:06:46 +02:00
|
|
|
|
|
|
|
pXAct = WDML_AllocTransaction(pConv->instance, WM_DDE_UNADVISE,
|
2001-08-10 00:07:22 +02:00
|
|
|
uiLo, WDML_MakeHszFromAtom(pConv->instance, uiHi));
|
|
|
|
if (pXAct) pXAct->atom = uiHi;
|
|
|
|
return pXAct;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************
|
|
|
|
* WDML_ServerHandleUnadvise
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
static WDML_QUEUE_STATE WDML_ServerHandleUnadvise(WDML_CONV* pConv, WDML_XACT* pXAct)
|
|
|
|
{
|
|
|
|
WDML_LINK* pLink;
|
2001-06-23 01:02:48 +02:00
|
|
|
|
2002-12-02 19:10:57 +01:00
|
|
|
if (pXAct->hszItem == NULL || pXAct->wFmt == 0)
|
2001-06-23 01:02:48 +02:00
|
|
|
{
|
2001-08-10 00:07:22 +02:00
|
|
|
ERR("Unsupported yet options (null item or clipboard format)\n");
|
|
|
|
return WDML_QS_ERROR;
|
2001-06-23 01:02:48 +02:00
|
|
|
}
|
|
|
|
|
2002-06-01 01:06:46 +02:00
|
|
|
pLink = WDML_FindLink(pConv->instance, (HCONV)pConv, WDML_SERVER_SIDE,
|
2002-01-18 20:30:15 +01:00
|
|
|
pXAct->hszItem, TRUE, pXAct->wFmt);
|
2001-06-23 01:02:48 +02:00
|
|
|
if (pLink == NULL)
|
|
|
|
{
|
2003-05-20 01:27:16 +02:00
|
|
|
ERR("Couln'd find link for %p, dropping request\n", pXAct->hszItem);
|
2001-08-10 00:07:22 +02:00
|
|
|
FreeDDElParam(WM_DDE_UNADVISE, pXAct->lParam);
|
|
|
|
return WDML_QS_ERROR;
|
2001-06-23 01:02:48 +02:00
|
|
|
}
|
|
|
|
|
2001-08-10 00:07:22 +02:00
|
|
|
if (!(pConv->instance->CBFflags & CBF_FAIL_ADVISES))
|
2001-06-23 01:02:48 +02:00
|
|
|
{
|
2002-06-01 01:06:46 +02:00
|
|
|
WDML_InvokeCallback(pConv->instance, XTYP_ADVSTOP, pXAct->wFmt, (HCONV)pConv,
|
2001-08-10 00:07:22 +02:00
|
|
|
pConv->hszTopic, pXAct->hszItem, 0, 0, 0);
|
2001-06-23 01:02:48 +02:00
|
|
|
}
|
2002-06-01 01:06:46 +02:00
|
|
|
|
|
|
|
WDML_RemoveLink(pConv->instance, (HCONV)pConv, WDML_SERVER_SIDE,
|
2001-08-10 00:07:22 +02:00
|
|
|
pXAct->hszItem, pXAct->wFmt);
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2001-06-23 01:02:48 +02:00
|
|
|
/* send back ack */
|
2002-06-01 01:06:46 +02:00
|
|
|
WDML_PostAck(pConv, WDML_SERVER_SIDE, 0, FALSE, TRUE, pXAct->atom,
|
2002-01-18 20:30:15 +01:00
|
|
|
pXAct->lParam, WM_DDE_UNADVISE);
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2001-08-10 00:07:22 +02:00
|
|
|
WDML_DecHSZ(pConv->instance, pXAct->hszItem);
|
|
|
|
|
|
|
|
return WDML_QS_HANDLED;
|
2001-06-23 01:02:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************
|
2001-08-10 00:07:22 +02:00
|
|
|
* WDML_QueueExecute
|
2001-06-23 01:02:48 +02:00
|
|
|
*
|
|
|
|
*
|
|
|
|
*/
|
2001-08-10 00:07:22 +02:00
|
|
|
static WDML_XACT* WDML_ServerQueueExecute(WDML_CONV* pConv, LPARAM lParam)
|
2001-06-23 01:02:48 +02:00
|
|
|
{
|
2001-08-10 00:07:22 +02:00
|
|
|
WDML_XACT* pXAct;
|
2001-06-23 01:02:48 +02:00
|
|
|
|
2001-08-10 00:07:22 +02:00
|
|
|
pXAct = WDML_AllocTransaction(pConv->instance, WM_DDE_EXECUTE, 0, 0);
|
|
|
|
if (pXAct)
|
|
|
|
{
|
|
|
|
pXAct->hMem = (HGLOBAL)lParam;
|
|
|
|
}
|
2002-06-01 01:06:46 +02:00
|
|
|
return pXAct;
|
2001-08-10 00:07:22 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************
|
|
|
|
* WDML_ServerHandleExecute
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
static WDML_QUEUE_STATE WDML_ServerHandleExecute(WDML_CONV* pConv, WDML_XACT* pXAct)
|
|
|
|
{
|
|
|
|
HDDEDATA hDdeData = DDE_FNOTPROCESSED;
|
|
|
|
BOOL fAck = FALSE, fBusy = FALSE;
|
2001-06-23 01:02:48 +02:00
|
|
|
|
2001-08-10 00:07:22 +02:00
|
|
|
if (!(pConv->instance->CBFflags & CBF_FAIL_EXECUTES))
|
2001-06-23 01:02:48 +02:00
|
|
|
{
|
2001-08-10 00:07:22 +02:00
|
|
|
LPVOID ptr = GlobalLock(pXAct->hMem);
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2001-06-23 01:02:48 +02:00
|
|
|
if (ptr)
|
|
|
|
{
|
2001-08-10 00:07:22 +02:00
|
|
|
hDdeData = DdeCreateDataHandle(0, ptr, GlobalSize(pXAct->hMem),
|
2001-06-23 01:02:48 +02:00
|
|
|
0, 0, CF_TEXT, 0);
|
2001-08-10 00:07:22 +02:00
|
|
|
GlobalUnlock(pXAct->hMem);
|
2002-06-01 01:06:46 +02:00
|
|
|
}
|
|
|
|
hDdeData = WDML_InvokeCallback(pConv->instance, XTYP_EXECUTE, 0, (HCONV)pConv,
|
2001-08-10 00:07:22 +02:00
|
|
|
pConv->hszTopic, 0, hDdeData, 0L, 0L);
|
2001-06-23 01:02:48 +02:00
|
|
|
}
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2005-02-01 19:47:55 +01:00
|
|
|
switch ((ULONG_PTR)hDdeData)
|
2001-06-23 01:02:48 +02:00
|
|
|
{
|
2005-02-01 19:47:55 +01:00
|
|
|
case (ULONG_PTR)CBR_BLOCK:
|
|
|
|
return WDML_QS_BLOCK;
|
|
|
|
|
2002-06-01 01:06:46 +02:00
|
|
|
case DDE_FACK:
|
|
|
|
fAck = TRUE;
|
2001-06-23 01:02:48 +02:00
|
|
|
break;
|
2002-06-01 01:06:46 +02:00
|
|
|
case DDE_FBUSY:
|
|
|
|
fBusy = TRUE;
|
2001-06-23 01:02:48 +02:00
|
|
|
break;
|
2002-06-01 01:06:46 +02:00
|
|
|
default:
|
2005-02-01 19:47:55 +01:00
|
|
|
FIXME("Unsupported returned value %p\n", hDdeData);
|
2001-08-21 19:07:17 +02:00
|
|
|
/* fall through */
|
2002-06-01 01:06:46 +02:00
|
|
|
case DDE_FNOTPROCESSED:
|
2001-06-23 01:02:48 +02:00
|
|
|
break;
|
2002-06-01 01:06:46 +02:00
|
|
|
}
|
2007-05-30 12:32:24 +02:00
|
|
|
WDML_PostAck(pConv, WDML_SERVER_SIDE, 0, fBusy, fAck, (UINT_PTR)pXAct->hMem, 0, 0);
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2001-08-10 00:07:22 +02:00
|
|
|
return WDML_QS_HANDLED;
|
2001-06-23 01:02:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************
|
2001-08-10 00:07:22 +02:00
|
|
|
* WDML_ServerQueuePoke
|
2001-06-23 01:02:48 +02:00
|
|
|
*
|
|
|
|
*
|
|
|
|
*/
|
2001-08-10 00:07:22 +02:00
|
|
|
static WDML_XACT* WDML_ServerQueuePoke(WDML_CONV* pConv, LPARAM lParam)
|
2001-06-23 01:02:48 +02:00
|
|
|
{
|
2003-05-20 01:27:16 +02:00
|
|
|
UINT_PTR uiLo, uiHi;
|
2001-08-10 00:07:22 +02:00
|
|
|
WDML_XACT* pXAct;
|
|
|
|
|
|
|
|
UnpackDDElParam(WM_DDE_POKE, lParam, &uiLo, &uiHi);
|
|
|
|
|
2002-06-01 01:06:46 +02:00
|
|
|
pXAct = WDML_AllocTransaction(pConv->instance, WM_DDE_POKE,
|
2001-08-10 00:07:22 +02:00
|
|
|
0, WDML_MakeHszFromAtom(pConv->instance, uiHi));
|
|
|
|
if (pXAct)
|
|
|
|
{
|
|
|
|
pXAct->atom = uiHi;
|
|
|
|
pXAct->hMem = (HGLOBAL)uiLo;
|
|
|
|
}
|
|
|
|
return pXAct;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************
|
|
|
|
* WDML_ServerHandlePoke
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
static WDML_QUEUE_STATE WDML_ServerHandlePoke(WDML_CONV* pConv, WDML_XACT* pXAct)
|
|
|
|
{
|
2001-06-23 01:02:48 +02:00
|
|
|
DDEPOKE* pDdePoke;
|
|
|
|
HDDEDATA hDdeData;
|
2001-08-10 00:07:22 +02:00
|
|
|
BOOL fBusy = FALSE, fAck = FALSE;
|
2001-06-23 01:02:48 +02:00
|
|
|
|
2001-08-10 00:07:22 +02:00
|
|
|
pDdePoke = (DDEPOKE*)GlobalLock(pXAct->hMem);
|
2001-06-23 01:02:48 +02:00
|
|
|
if (!pDdePoke)
|
|
|
|
{
|
2001-08-10 00:07:22 +02:00
|
|
|
return WDML_QS_ERROR;
|
2001-06-23 01:02:48 +02:00
|
|
|
}
|
|
|
|
|
2001-08-10 00:07:22 +02:00
|
|
|
if (!(pConv->instance->CBFflags & CBF_FAIL_POKES))
|
2001-06-23 01:02:48 +02:00
|
|
|
{
|
2002-06-01 01:06:46 +02:00
|
|
|
hDdeData = DdeCreateDataHandle(pConv->instance->instanceID, pDdePoke->Value,
|
2008-07-08 16:18:21 +02:00
|
|
|
GlobalSize(pXAct->hMem) - FIELD_OFFSET(DDEPOKE, Value),
|
2001-06-23 01:02:48 +02:00
|
|
|
0, 0, pDdePoke->cfFormat, 0);
|
2002-06-01 01:06:46 +02:00
|
|
|
if (hDdeData)
|
2001-06-23 01:02:48 +02:00
|
|
|
{
|
|
|
|
HDDEDATA hDdeDataOut;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
|
|
|
hDdeDataOut = WDML_InvokeCallback(pConv->instance, XTYP_POKE, pDdePoke->cfFormat,
|
|
|
|
(HCONV)pConv, pConv->hszTopic, pXAct->hszItem,
|
2001-08-10 00:07:22 +02:00
|
|
|
hDdeData, 0, 0);
|
2003-05-20 01:27:16 +02:00
|
|
|
switch ((ULONG_PTR)hDdeDataOut)
|
2001-06-23 01:02:48 +02:00
|
|
|
{
|
|
|
|
case DDE_FACK:
|
2002-06-01 01:06:46 +02:00
|
|
|
fAck = TRUE;
|
2001-06-23 01:02:48 +02:00
|
|
|
break;
|
|
|
|
case DDE_FBUSY:
|
2001-08-10 00:07:22 +02:00
|
|
|
fBusy = TRUE;
|
2001-06-23 01:02:48 +02:00
|
|
|
break;
|
|
|
|
default:
|
2003-05-20 01:27:16 +02:00
|
|
|
FIXME("Unsupported returned value %p\n", hDdeDataOut);
|
2001-08-21 19:07:17 +02:00
|
|
|
/* fal through */
|
2002-06-01 01:06:46 +02:00
|
|
|
case DDE_FNOTPROCESSED:
|
2001-06-23 01:02:48 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
DdeFreeDataHandle(hDdeData);
|
|
|
|
}
|
|
|
|
}
|
2001-08-10 00:07:22 +02:00
|
|
|
GlobalUnlock(pXAct->hMem);
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2001-08-10 00:07:22 +02:00
|
|
|
if (!fAck)
|
2002-01-18 20:30:15 +01:00
|
|
|
{
|
2001-08-10 00:07:22 +02:00
|
|
|
GlobalFree(pXAct->hMem);
|
2002-01-18 20:30:15 +01:00
|
|
|
}
|
2001-08-10 00:07:22 +02:00
|
|
|
WDML_PostAck(pConv, WDML_SERVER_SIDE, 0, fBusy, fAck, pXAct->atom, pXAct->lParam, WM_DDE_POKE);
|
|
|
|
|
|
|
|
WDML_DecHSZ(pConv->instance, pXAct->hszItem);
|
|
|
|
|
|
|
|
return WDML_QS_HANDLED;
|
|
|
|
}
|
2001-06-23 01:02:48 +02:00
|
|
|
|
2001-08-10 00:07:22 +02:00
|
|
|
/******************************************************************
|
|
|
|
* WDML_ServerQueueTerminate
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
static WDML_XACT* WDML_ServerQueueTerminate(WDML_CONV* pConv, LPARAM lParam)
|
|
|
|
{
|
|
|
|
WDML_XACT* pXAct;
|
|
|
|
|
|
|
|
pXAct = WDML_AllocTransaction(pConv->instance, WM_DDE_TERMINATE, 0, 0);
|
|
|
|
return pXAct;
|
2001-06-23 01:02:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************
|
|
|
|
* WDML_ServerHandleTerminate
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*/
|
2001-08-10 00:07:22 +02:00
|
|
|
static WDML_QUEUE_STATE WDML_ServerHandleTerminate(WDML_CONV* pConv, WDML_XACT* pXAct)
|
2001-06-23 01:02:48 +02:00
|
|
|
{
|
2001-08-10 00:07:22 +02:00
|
|
|
/* billx: two things to remove: the conv, and associated links.
|
|
|
|
* Respond with another WM_DDE_TERMINATE iMsg.
|
|
|
|
*/
|
|
|
|
if (!(pConv->instance->CBFflags & CBF_SKIP_DISCONNECTS))
|
|
|
|
{
|
2002-06-01 01:06:46 +02:00
|
|
|
WDML_InvokeCallback(pConv->instance, XTYP_DISCONNECT, 0, (HCONV)pConv, 0, 0,
|
2001-08-10 00:07:22 +02:00
|
|
|
0, 0, (pConv->wStatus & ST_ISSELF) ? 1 : 0);
|
|
|
|
}
|
2005-02-14 12:53:15 +01:00
|
|
|
PostMessageW(pConv->hwndClient, WM_DDE_TERMINATE, (WPARAM)pConv->hwndServer, 0);
|
2001-08-10 00:07:22 +02:00
|
|
|
WDML_RemoveConv(pConv, WDML_SERVER_SIDE);
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2001-08-10 00:07:22 +02:00
|
|
|
return WDML_QS_HANDLED;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************
|
|
|
|
* WDML_ServerHandle
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*/
|
2003-05-20 01:27:16 +02:00
|
|
|
WDML_QUEUE_STATE WDML_ServerHandle(WDML_CONV* pConv, WDML_XACT* pXAct)
|
2001-08-10 00:07:22 +02:00
|
|
|
{
|
|
|
|
WDML_QUEUE_STATE qs = WDML_QS_ERROR;
|
|
|
|
|
|
|
|
switch (pXAct->ddeMsg)
|
|
|
|
{
|
|
|
|
case WM_DDE_INITIATE:
|
|
|
|
FIXME("WM_DDE_INITIATE shouldn't be there!\n");
|
|
|
|
break;
|
|
|
|
case WM_DDE_REQUEST:
|
|
|
|
qs = WDML_ServerHandleRequest(pConv, pXAct);
|
|
|
|
break;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2001-08-10 00:07:22 +02:00
|
|
|
case WM_DDE_ADVISE:
|
|
|
|
qs = WDML_ServerHandleAdvise(pConv, pXAct);
|
|
|
|
break;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2001-08-10 00:07:22 +02:00
|
|
|
case WM_DDE_UNADVISE:
|
|
|
|
qs = WDML_ServerHandleUnadvise(pConv, pXAct);
|
|
|
|
break;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2001-08-10 00:07:22 +02:00
|
|
|
case WM_DDE_EXECUTE:
|
|
|
|
qs = WDML_ServerHandleExecute(pConv, pXAct);
|
|
|
|
break;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2001-08-10 00:07:22 +02:00
|
|
|
case WM_DDE_POKE:
|
|
|
|
qs = WDML_ServerHandlePoke(pConv, pXAct);
|
|
|
|
break;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2001-08-10 00:07:22 +02:00
|
|
|
case WM_DDE_TERMINATE:
|
|
|
|
qs = WDML_ServerHandleTerminate(pConv, pXAct);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WM_DDE_ACK:
|
|
|
|
WARN("Shouldn't receive a ACK message (never requests them). Ignoring it\n");
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
FIXME("Unsupported message %d\n", pXAct->ddeMsg);
|
|
|
|
}
|
|
|
|
return qs;
|
2001-06-23 01:02:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************
|
|
|
|
* WDML_ServerConvProc
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
static LRESULT CALLBACK WDML_ServerConvProc(HWND hwndServer, UINT iMsg, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
2001-08-10 00:07:22 +02:00
|
|
|
WDML_INSTANCE* pInstance;
|
2001-06-23 01:02:48 +02:00
|
|
|
WDML_CONV* pConv;
|
2001-08-10 00:07:22 +02:00
|
|
|
WDML_XACT* pXAct = NULL;
|
2001-06-23 01:02:48 +02:00
|
|
|
|
2007-05-24 16:41:17 +02:00
|
|
|
TRACE("%p %04x %08lx %08lx\n", hwndServer, iMsg, wParam, lParam);
|
2005-02-01 19:47:55 +01:00
|
|
|
|
2001-08-10 00:07:22 +02:00
|
|
|
if (iMsg == WM_DESTROY)
|
|
|
|
{
|
|
|
|
pConv = WDML_GetConvFromWnd(hwndServer);
|
|
|
|
if (pConv && !(pConv->wStatus & ST_TERMINATED))
|
|
|
|
{
|
|
|
|
WDML_ServerHandleTerminate(pConv, NULL);
|
|
|
|
}
|
|
|
|
}
|
2001-06-23 01:02:48 +02:00
|
|
|
if (iMsg < WM_DDE_FIRST || iMsg > WM_DDE_LAST)
|
|
|
|
{
|
2005-07-08 13:33:09 +02:00
|
|
|
return IsWindowUnicode(hwndServer) ? DefWindowProcW(hwndServer, iMsg, wParam, lParam) :
|
|
|
|
DefWindowProcA(hwndServer, iMsg, wParam, lParam);
|
2001-06-23 01:02:48 +02:00
|
|
|
}
|
|
|
|
|
2001-08-10 00:07:22 +02:00
|
|
|
pInstance = WDML_GetInstanceFromWnd(hwndServer);
|
|
|
|
pConv = WDML_GetConvFromWnd(hwndServer);
|
|
|
|
|
2002-06-01 01:06:46 +02:00
|
|
|
if (!pConv)
|
2001-06-23 01:02:48 +02:00
|
|
|
{
|
2003-05-20 01:27:16 +02:00
|
|
|
ERR("Got a message (%x) on a not known conversation, dropping request\n", iMsg);
|
2006-11-15 14:22:35 +01:00
|
|
|
return 0;
|
2001-08-10 00:07:22 +02:00
|
|
|
}
|
2001-09-14 02:24:39 +02:00
|
|
|
if (pConv->hwndClient != WIN_GetFullHandle( (HWND)wParam ) || pConv->hwndServer != hwndServer)
|
2001-08-10 00:07:22 +02:00
|
|
|
{
|
2007-12-29 22:17:43 +01:00
|
|
|
ERR("mismatch between C/S windows and conversation\n");
|
2006-11-15 14:22:35 +01:00
|
|
|
return 0;
|
2001-08-10 00:07:22 +02:00
|
|
|
}
|
|
|
|
if (pConv->instance != pInstance || pConv->instance == NULL)
|
|
|
|
{
|
|
|
|
ERR("mismatch in instances\n");
|
2006-11-15 14:22:35 +01:00
|
|
|
return 0;
|
2001-06-23 01:02:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
switch (iMsg)
|
|
|
|
{
|
|
|
|
case WM_DDE_INITIATE:
|
2001-08-10 00:07:22 +02:00
|
|
|
FIXME("WM_DDE_INITIATE message received!\n");
|
2001-06-23 01:02:48 +02:00
|
|
|
break;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2001-06-23 01:02:48 +02:00
|
|
|
case WM_DDE_REQUEST:
|
2001-08-10 00:07:22 +02:00
|
|
|
pXAct = WDML_ServerQueueRequest(pConv, lParam);
|
2001-06-23 01:02:48 +02:00
|
|
|
break;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2001-06-23 01:02:48 +02:00
|
|
|
case WM_DDE_ADVISE:
|
2001-08-10 00:07:22 +02:00
|
|
|
pXAct = WDML_ServerQueueAdvise(pConv, lParam);
|
2001-06-23 01:02:48 +02:00
|
|
|
break;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2001-06-23 01:02:48 +02:00
|
|
|
case WM_DDE_UNADVISE:
|
2001-08-10 00:07:22 +02:00
|
|
|
pXAct = WDML_ServerQueueUnadvise(pConv, lParam);
|
2001-06-23 01:02:48 +02:00
|
|
|
break;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2001-06-23 01:02:48 +02:00
|
|
|
case WM_DDE_EXECUTE:
|
2001-08-10 00:07:22 +02:00
|
|
|
pXAct = WDML_ServerQueueExecute(pConv, lParam);
|
2001-06-23 01:02:48 +02:00
|
|
|
break;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2001-06-23 01:02:48 +02:00
|
|
|
case WM_DDE_POKE:
|
2001-08-10 00:07:22 +02:00
|
|
|
pXAct = WDML_ServerQueuePoke(pConv, lParam);
|
2001-06-23 01:02:48 +02:00
|
|
|
break;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2001-06-23 01:02:48 +02:00
|
|
|
case WM_DDE_TERMINATE:
|
2001-08-10 00:07:22 +02:00
|
|
|
pXAct = WDML_ServerQueueTerminate(pConv, lParam);
|
2001-06-23 01:02:48 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WM_DDE_ACK:
|
|
|
|
WARN("Shouldn't receive a ACK message (never requests them). Ignoring it\n");
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2003-05-20 01:27:16 +02:00
|
|
|
FIXME("Unsupported message %x\n", iMsg);
|
2006-11-21 07:43:48 +01:00
|
|
|
break;
|
2001-06-23 01:02:48 +02:00
|
|
|
}
|
2002-06-01 01:06:46 +02:00
|
|
|
|
|
|
|
if (pXAct)
|
2001-08-10 00:07:22 +02:00
|
|
|
{
|
|
|
|
pXAct->lParam = lParam;
|
2006-11-21 07:43:48 +01:00
|
|
|
|
|
|
|
if ((pConv->wStatus & ST_BLOCKED) || WDML_ServerHandle(pConv, pXAct) == WDML_QS_BLOCK)
|
2001-08-10 00:07:22 +02:00
|
|
|
{
|
2006-11-21 07:43:48 +01:00
|
|
|
TRACE("Transactions are blocked, add to the queue and exit\n");
|
2001-08-10 00:07:22 +02:00
|
|
|
WDML_QueueTransaction(pConv, pXAct);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
WDML_FreeTransaction(pInstance, pXAct, TRUE);
|
|
|
|
}
|
|
|
|
}
|
2006-11-21 07:43:48 +01:00
|
|
|
else
|
|
|
|
pConv->instance->lastError = DMLERR_MEMORY_ERROR;
|
2006-11-15 14:22:35 +01:00
|
|
|
|
2001-06-23 01:02:48 +02:00
|
|
|
return 0;
|
|
|
|
}
|