Author: fireball
Date: Sun Jun 25 14:38:48 2006
New Revision: 22608
URL:
http://svn.reactos.org/svn/reactos?rev=22608&view=rev
Log:
Sync DDE with Wine
Modified:
trunk/reactos/dll/win32/user32/include/dde_private.h
trunk/reactos/dll/win32/user32/misc/dde.c
trunk/reactos/dll/win32/user32/misc/ddeclient.c
trunk/reactos/dll/win32/user32/misc/ddeserver.c
trunk/reactos/include/dde.h
trunk/reactos/include/ddeml.h
Modified: trunk/reactos/dll/win32/user32/include/dde_private.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/include/d…
==============================================================================
--- trunk/reactos/dll/win32/user32/include/dde_private.h (original)
+++ trunk/reactos/dll/win32/user32/include/dde_private.h Sun Jun 25 14:38:48 2006
@@ -1,5 +1,3 @@
-/* -*- tab-width: 8; c-basic-offset: 4 -*- */
-
/*
* DDEML library
*
@@ -40,7 +38,7 @@
* - a popup window (InstanceClass) is created for each instance.
* - this window is used to receive all the DDEML events (server registration,
* conversation confirmation...). See the WM_WDML_???? messages for details
- * + when registring a server (DdeNameService) a WDML_SERVER is created
+ * + when registering a server (DdeNameService) a WDML_SERVER is created
* - a popup window (ServerNameClass) is created
* + a conversation is represented by two WDML_CONV structures:
* - one on the client side, the other one on the server side
@@ -129,6 +127,7 @@
struct tagWDML_INSTANCE* instance;
HSZ hszService; /* pmt used for connection */
HSZ hszTopic; /* pmt used for connection */
+ UINT magic; /* magic number to check validity */
UINT afCmd; /* service name flag */
CONVCONTEXT convContext;
HWND hwndClient; /* source of conversation (ClientConvClass) */
@@ -139,6 +138,8 @@
DWORD wConvst; /* same values as convinfo.wConvst */
} WDML_CONV;
+#define WDML_CONV_MAGIC 0xbabe1234
+
/* DDE_LINK struct defines hot, warm, and cold links */
typedef struct tagWDML_LINK {
struct tagWDML_LINK* next; /* to link all the active links */
@@ -155,7 +156,7 @@
DWORD threadID; /* needed to keep instance linked to a unique thread */
BOOL monitor; /* have these two as full Booleans cos they'll be tested
frequently */
BOOL clientOnly; /* bit wasteful of space but it will be faster */
- BOOL unicode; /* Flag to indicate Win32 API used to initialise */
+ BOOL unicode; /* Flag to indicate Win32 API used to initialise */
BOOL win16; /* flag to indicate Win16 API used to initialize */
HSZNode* nodeList; /* for cleaning upon exit */
PFNCALLBACK callback;
@@ -173,7 +174,7 @@
/* header for the DDE Data objects */
typedef struct tagDDE_DATAHANDLE_HEAD
{
- short cfFormat;
+ WORD cfFormat;
WORD bAppOwned;
} DDE_DATAHANDLE_HEAD;
@@ -188,7 +189,7 @@
extern HDDEDATA WDML_InvokeCallback(WDML_INSTANCE* pInst, UINT uType, UINT uFmt, HCONV
hConv,
HSZ hsz1, HSZ hsz2, HDDEDATA hdata,
- DWORD dwData1, DWORD dwData2);
+ ULONG_PTR dwData1, ULONG_PTR dwData2);
extern HDDEDATA WDML_InvokeCallback16(PFNCALLBACK pfn, UINT uType, UINT uFmt, HCONV
hConv,
HSZ hsz1, HSZ hsz2, HDDEDATA hdata,
DWORD dwData1, DWORD dwData2);
@@ -235,20 +236,20 @@
extern WDML_INSTANCE* WDML_GetInstance(DWORD InstId);
extern WDML_INSTANCE* WDML_GetInstanceFromWnd(HWND hWnd);
/* broadcasting to DDE windows */
-extern void WDML_BroadcastDDEWindows(const char* clsName, UINT uMsg,
+extern void WDML_BroadcastDDEWindows(LPCWSTR clsName, UINT uMsg,
WPARAM wParam, LPARAM lParam);
extern void WDML_NotifyThreadExit(DWORD tid);
-static __inline void WDML_ExtractAck(WORD status, DDEACK* da)
+static inline void WDML_ExtractAck(WORD status, DDEACK* da)
{
*da = *((DDEACK*)&status);
}
-extern const char WDML_szEventClass[]; /* class of window for events (aka instance)
*/
-extern const char WDML_szServerConvClassA[]; /* class of window for server side conv
(ansi) */
-extern const WCHAR WDML_szServerConvClassW[]; /* class of window for server side conv
(unicode) */
-extern const char WDML_szClientConvClassA[]; /* class of window for client side conv
(ansi) */
-extern const WCHAR WDML_szClientConvClassW[]; /* class of window for client side conv
(unicode) */
+extern const WCHAR WDML_szEventClass[]; /* class of window for events (aka instance) */
+extern const char WDML_szServerConvClassA[]; /* ANSI class of window for server side conv
*/
+extern const WCHAR WDML_szServerConvClassW[]; /* unicode class of window for server side
conv */
+extern const char WDML_szClientConvClassA[]; /* ANSI class of window for client side conv
*/
+extern const WCHAR WDML_szClientConvClassW[]; /* unicode class of window for client side
conv */
#define WM_WDML_REGISTER (WM_USER + 0x200)
#define WM_WDML_UNREGISTER (WM_USER + 0x201)
@@ -262,7 +263,7 @@
*/
#define GWL_WDML_INSTANCE (0)
-#define GWL_WDML_CONVERSATION (4)
-#define GWL_WDML_SERVER (4)
+#define GWL_WDML_CONVERSATION (sizeof(ULONG_PTR))
+#define GWL_WDML_SERVER (sizeof(ULONG_PTR))
#endif /* __WINE_DDEML_PRIVATE_H */
Modified: trunk/reactos/dll/win32/user32/misc/dde.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/misc/dde.…
==============================================================================
--- trunk/reactos/dll/win32/user32/misc/dde.c (original)
+++ trunk/reactos/dll/win32/user32/misc/dde.c Sun Jun 25 14:38:48 2006
@@ -6,6 +6,7 @@
* Copyright 1999 Keith Matthews
* Copyright 2000 Corel
* Copyright 2001 Eric Pouech
+ * Copyright 2003, 2004, 2005 Dmitry Timoshkov
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -33,14 +34,14 @@
#define HSZ2ATOM(hsz) ((ATOM) (ULONG_PTR)(hsz))
static WDML_INSTANCE* WDML_InstanceList = NULL;
-static DWORD WDML_MaxInstanceID = 0; /* OK for present, have to worry about wrap-around
later */
-const char WDML_szEventClass[] = "DdeEventClass";
+static LONG WDML_MaxInstanceID = 0; /* OK for present, have to worry about wrap-around
later */
+const WCHAR WDML_szEventClass[] =
{'D','d','e','E','v','e','n','t','C','l','a','s','s',0};
static CRITICAL_SECTION_DEBUG critsect_debug =
{
0, 0, &WDML_CritSect,
{ &critsect_debug.ProcessLocksList, &critsect_debug.ProcessLocksList },
- 0, 0, { 0, (DWORD)(__FILE__ ": WDML_CritSect") }
+ 0, 0, { (DWORD_PTR)(__FILE__ ": WDML_CritSect") }
};
CRITICAL_SECTION WDML_CritSect = { &critsect_debug, -1, 0, 0, 0, 0 };
@@ -192,7 +193,7 @@
params[0] = uiLo;
params[1] = uiHi;
TRACE("Reusing pack %08x %08x\n", uiLo, uiHi);
- GlobalLock( (HGLOBAL)lParam );
+ GlobalUnlock( (HGLOBAL)lParam );
return lParam;
case WM_DDE_EXECUTE:
@@ -246,7 +247,7 @@
*/
static void WDML_IncrementInstanceId(WDML_INSTANCE* pInstance)
{
- DWORD id = InterlockedIncrement((PLONG)&WDML_MaxInstanceID);
+ DWORD id = InterlockedIncrement(&WDML_MaxInstanceID);
pInstance->instanceID = id;
TRACE("New instance id %ld allocated\n", id);
@@ -315,7 +316,7 @@
}
break;
default:
- return DefWindowProcA(hwndEvent, uMsg, wParam, lParam);
+ return DefWindowProcW(hwndEvent, uMsg, wParam, lParam);
}
return 0;
}
@@ -331,7 +332,7 @@
WDML_INSTANCE* pInstance;
WDML_INSTANCE* reference_inst;
UINT ret;
- WNDCLASSEXA wndclass;
+ WNDCLASSEXW wndclass;
TRACE("(%p,%p,0x%lx,%ld)\n",
pidInst, pfnCallback, afCmd, ulRes);
@@ -382,7 +383,7 @@
(pInstance->CBFflags & CBF_FAIL_ALLSVRXACTIONS) == CBF_FAIL_ALLSVRXACTIONS;
}
- TRACE("instance created - checking validity \n");
+ TRACE("instance created - checking validity\n");
if (*pidInst == 0)
{
@@ -468,7 +469,7 @@
wndclass.style = 0;
wndclass.lpfnWndProc = WDML_EventProc;
wndclass.cbClsExtra = 0;
- wndclass.cbWndExtra = sizeof(DWORD);
+ wndclass.cbWndExtra = sizeof(ULONG_PTR);
wndclass.hInstance = 0;
wndclass.hIcon = 0;
wndclass.hCursor = 0;
@@ -477,13 +478,13 @@
wndclass.lpszClassName = WDML_szEventClass;
wndclass.hIconSm = 0;
- RegisterClassExA(&wndclass);
-
- pInstance->hwndEvent = CreateWindowA(WDML_szEventClass, NULL,
+ RegisterClassExW(&wndclass);
+
+ pInstance->hwndEvent = CreateWindowW(WDML_szEventClass, NULL,
WS_POPUP, 0, 0, 0, 0,
0, 0, 0, 0);
- SetWindowLongA(pInstance->hwndEvent, GWL_WDML_INSTANCE, (DWORD)pInstance);
+ SetWindowLongPtrW(pInstance->hwndEvent, GWL_WDML_INSTANCE, (ULONG_PTR)pInstance);
TRACE("New application instance processing finished OK\n");
}
@@ -567,6 +568,8 @@
/******************************************************************************
* DdeInitializeA (USER32.@)
+ *
+ * See DdeInitializeW.
*/
UINT WINAPI DdeInitializeA(LPDWORD pidInst, PFNCALLBACK pfnCallback,
DWORD afCmd, DWORD ulRes)
@@ -702,7 +705,7 @@
*/
HDDEDATA WDML_InvokeCallback(WDML_INSTANCE* pInstance, UINT uType, UINT uFmt, HCONV
hConv,
HSZ hsz1, HSZ hsz2, HDDEDATA hdata,
- DWORD dwData1, DWORD dwData2)
+ ULONG_PTR dwData1, ULONG_PTR dwData2)
{
HDDEDATA ret;
@@ -750,7 +753,7 @@
*/
WDML_INSTANCE* WDML_GetInstanceFromWnd(HWND hWnd)
{
- return (WDML_INSTANCE*)GetWindowLongA(hWnd, GWL_WDML_INSTANCE);
+ return (WDML_INSTANCE*)GetWindowLongPtrW(hWnd, GWL_WDML_INSTANCE);
}
/******************************************************************************
@@ -1049,11 +1052,11 @@
{
case CP_WINANSI:
hsz = ATOM2HSZ(AddAtomA(ptr));
- TRACE("added atom %s with HSZ %p, \n", debugstr_a(ptr), hsz);
+ TRACE("added atom %s with HSZ %p,\n", debugstr_a(ptr), hsz);
break;
case CP_WINUNICODE:
hsz = ATOM2HSZ(AddAtomW(ptr));
- TRACE("added atom %s with HSZ %p, \n", debugstr_w(ptr), hsz);
+ TRACE("added atom %s with HSZ %p,\n", debugstr_w(ptr), hsz);
break;
default:
ERR("Unknown code page %d\n", codepage);
@@ -1066,11 +1069,9 @@
/*****************************************************************
* DdeCreateStringHandleA [USER32.@]
*
- * RETURNS
- * Success: String handle
- * Failure: 0
- */
-HSZ WINAPI DdeCreateStringHandleA(DWORD idInst, LPSTR psz, INT codepage)
+ * See DdeCreateStringHandleW.
+ */
+HSZ WINAPI DdeCreateStringHandleA(DWORD idInst, LPCSTR psz, INT codepage)
{
HSZ hsz = 0;
WDML_INSTANCE* pInstance;
@@ -1102,7 +1103,7 @@
* Success: String handle
* Failure: 0
*/
-HSZ WINAPI DdeCreateStringHandleW(DWORD idInst, LPWSTR psz, INT codepage)
+HSZ WINAPI DdeCreateStringHandleW(DWORD idInst, LPCWSTR psz, INT codepage)
{
WDML_INSTANCE* pInstance;
HSZ hsz = 0;
@@ -1124,15 +1125,16 @@
/*****************************************************************
* DdeFreeStringHandle (USER32.@)
- * RETURNS: success: nonzero
- * fail: zero
+ * RETURNS
+ * success: nonzero
+ * fail: zero
*/
BOOL WINAPI DdeFreeStringHandle(DWORD idInst, HSZ hsz)
{
WDML_INSTANCE* pInstance;
BOOL ret = FALSE;
- TRACE("(%ld,%p): \n", idInst, hsz);
+ TRACE("(%ld,%p):\n", idInst, hsz);
EnterCriticalSection(&WDML_CritSect);
@@ -1150,15 +1152,16 @@
/*****************************************************************
* DdeKeepStringHandle (USER32.@)
*
- * RETURNS: success: nonzero
- * fail: zero
+ * RETURNS
+ * success: nonzero
+ * fail: zero
*/
BOOL WINAPI DdeKeepStringHandle(DWORD idInst, HSZ hsz)
{
WDML_INSTANCE* pInstance;
BOOL ret = FALSE;
- TRACE("(%ld,%p): \n", idInst, hsz);
+ TRACE("(%ld,%p):\n", idInst, hsz);
EnterCriticalSection(&WDML_CritSect);
@@ -1178,7 +1181,11 @@
* Compares the value of two string handles. This comparison is
* not case sensitive.
*
- * Returns:
+ * PARAMS
+ * hsz1 [I] Handle to the first string
+ * hsz2 [I] Handle to the second string
+ *
+ * RETURNS
* -1 The value of hsz1 is zero or less than hsz2
* 0 The values of hsz 1 and 2 are the same or both zero.
* 1 The value of hsz2 is zero of less than hsz1
@@ -1254,9 +1261,13 @@
DDE_DATAHANDLE_HEAD* pDdh;
WCHAR psz[MAX_BUFFER_LEN];
- GetAtomNameW(HSZ2ATOM(hszItem), psz, MAX_BUFFER_LEN);
-
- TRACE("(%ld,%p,cb %ld, cbOff %ld,%p <%s>,%x,%x)\n",
+ if (!GetAtomNameW(HSZ2ATOM(hszItem), psz, MAX_BUFFER_LEN))
+ {
+ psz[0] = HSZ2ATOM(hszItem);
+ psz[1] = 0;
+ }
+
+ TRACE("(%ld,%p,cb %ld, cbOff %ld,%p <%s>,fmt %04x,%x)\n",
idInst, pSrc, cb, cbOff, hszItem, debugstr_w(psz), wFmt, afCmd);
if (afCmd != 0 && afCmd != HDATA_APPOWNED)
@@ -1286,6 +1297,7 @@
}
GlobalUnlock(hMem);
+ TRACE("=> %p\n", hMem);
return (HDDEDATA)hMem;
}
@@ -1393,7 +1405,7 @@
{
*pcbDataSize = GlobalSize(hMem) - sizeof(DDE_DATAHANDLE_HEAD);
}
- TRACE("=> %p (%lu)\n", pDdh + 1, GlobalSize(hMem) -
sizeof(DDE_DATAHANDLE_HEAD));
+ TRACE("=> %p (%lu) fmt %04x\n", pDdh + 1, GlobalSize(hMem) -
sizeof(DDE_DATAHANDLE_HEAD), pDdh->cfFormat);
return (LPBYTE)(pDdh + 1);
}
@@ -1468,8 +1480,8 @@
switch (pDd->cfFormat)
{
default:
- FIXME("Unsupported format (%d) for data... assuming raw
information\n",
- pDd->cfFormat);
+ FIXME("Unsupported format (%04x) for data %p, passing raw
information\n",
+ pDd->cfFormat, hMem);
/* fall thru */
case 0:
case CF_TEXT:
@@ -1527,7 +1539,8 @@
switch (pDdh->cfFormat)
{
default:
- FIXME("Unsupported format (%d) for data... passing raw
information\n", pDdh->cfFormat);
+ FIXME("Unsupported format (%04x) for data %p, passing raw
information\n",
+ pDdh->cfFormat, hDdeData);
/* fall thru */
case 0:
case CF_TEXT:
@@ -1544,7 +1557,7 @@
DWORD count;
HBITMAP hbmp = *(HBITMAP*)(pDdh + 1);
- if (GetObjectA(hbmp, sizeof(bmp), &bmp))
+ if (GetObjectW(hbmp, sizeof(bmp), &bmp))
{
count = bmp.bmWidthBytes * bmp.bmHeight;
hMem = GlobalAlloc(GMEM_MOVEABLE | GMEM_DDESHARE,
@@ -1587,18 +1600,20 @@
*/
WDML_SERVER* WDML_AddServer(WDML_INSTANCE* pInstance, HSZ hszService, HSZ hszTopic)
{
+ static const WCHAR fmtW[] =
{'%','s','(','0','x','%','0','8','l','x',')',0};
WDML_SERVER* pServer;
- char buf1[256];
- char buf2[256];
+ WCHAR buf1[256];
+ WCHAR buf2[256];
pServer = (WDML_SERVER*)HeapAlloc(GetProcessHeap(), 0, sizeof(WDML_SERVER));
if (pServer == NULL) return NULL;
- WDML_IncHSZ(pInstance, pServer->hszService = hszService);
-
- DdeQueryStringA(pInstance->instanceID, hszService, buf1, sizeof(buf1),
CP_WINANSI);
- _snprintf(buf2, sizeof(buf2), "%s(0x%08lx)", buf1, GetCurrentProcessId());
- pServer->hszServiceSpec = DdeCreateStringHandleA(pInstance->instanceID, buf2,
CP_WINANSI);
+ pServer->hszService = hszService;
+ WDML_IncHSZ(pInstance, hszService);
+
+ DdeQueryStringW(pInstance->instanceID, hszService, buf1, 256, CP_WINUNICODE);
+ snprintfW(buf2, 256, fmtW, buf1, GetCurrentProcessId());
+ pServer->hszServiceSpec = DdeCreateStringHandleW(pInstance->instanceID, buf2,
CP_WINUNICODE);
pServer->atomService = WDML_MakeAtomFromHsz(pServer->hszService);
pServer->atomServiceSpec = WDML_MakeAtomFromHsz(pServer->hszServiceSpec);
@@ -1638,7 +1653,7 @@
{
WDML_RemoveConv(pConv, WDML_SERVER_SIDE);
/* don't care about return code (whether client window is present or not) */
- PostMessageA(pConv->hwndClient, WM_DDE_TERMINATE, (WPARAM)pConv->hwndServer,
0L);
+ PostMessageW(pConv->hwndClient, WM_DDE_TERMINATE, (WPARAM)pConv->hwndServer,
0);
}
}
if (pServer == pInstance->servers)
@@ -1711,6 +1726,7 @@
pConv->instance = pInstance;
WDML_IncHSZ(pInstance, pConv->hszService = hszService);
WDML_IncHSZ(pInstance, pConv->hszTopic = hszTopic);
+ pConv->magic = WDML_CONV_MAGIC;
pConv->hwndServer = hwndServer;
pConv->hwndClient = hwndClient;
pConv->transactions = NULL;
@@ -1785,7 +1801,7 @@
* this would help the wndProc do appropriate handling upon a WM_DESTROY message
*/
hWnd = (side == WDML_CLIENT_SIDE) ? pRef->hwndClient : pRef->hwndServer;
- SetWindowLongA(hWnd, GWL_WDML_CONVERSATION, 0);
+ SetWindowLongPtrW(hWnd, GWL_WDML_CONVERSATION, 0);
DestroyWindow((side == WDML_CLIENT_SIDE) ? pRef->hwndClient :
pRef->hwndServer);
@@ -1804,7 +1820,7 @@
{
pPrev->next = pCurrent->next;
}
-
+ pCurrent->magic = 0;
HeapFree(GetProcessHeap(), 0, pCurrent);
break;
}
@@ -1882,14 +1898,14 @@
WDML_CONV* pConv = (WDML_CONV*)hConv;
/* FIXME: should do better checking */
- if (pConv == NULL) return NULL;
+ if (pConv == NULL || pConv->magic != WDML_CONV_MAGIC) return NULL;
if (checkConnected && !(pConv->wStatus & ST_CONNECTED))
{
FIXME("found conv but ain't connected\n");
return NULL;
}
- if (GetCurrentThreadId() != pConv->instance->threadID)
+ if (!pConv->instance || GetCurrentThreadId() != pConv->instance->threadID)
{
FIXME("wrong thread ID\n");
return NULL;
@@ -1905,7 +1921,7 @@
*/
WDML_CONV* WDML_GetConvFromWnd(HWND hWnd)
{
- return (WDML_CONV*)GetWindowLongA(hWnd, GWL_WDML_CONVERSATION);
+ return (WDML_CONV*)GetWindowLongPtrW(hWnd, GWL_WDML_CONVERSATION);
}
/******************************************************************
@@ -1939,7 +1955,7 @@
lParam = (lParam) ? ReuseDDElParam(lParam, oldMsg, WM_DDE_ACK, *(WORD*)&ddeAck,
pmt) :
PackDDElParam(WM_DDE_ACK, *(WORD*)&ddeAck, pmt);
- if (!PostMessageA(to, WM_DDE_ACK, (WPARAM)from, lParam))
+ if (!PostMessageW(to, WM_DDE_ACK, (WPARAM)from, lParam))
{
pConv->wStatus &= ~ST_CONNECTED;
FreeDDElParam(WM_DDE_ACK, lParam);
@@ -2001,7 +2017,7 @@
WDML_LINK* pLink;
WDML_SIDE side;
- ci->hConvPartner = (pConv->wStatus & ST_ISLOCAL) ? (HCONV)((DWORD)pConv |
1) : 0;
+ ci->hConvPartner = (pConv->wStatus & ST_ISLOCAL) ? (HCONV)((ULONG_PTR)pConv
| 1) : 0;
ci->hszSvcPartner = pConv->hszService;
ci->hszServiceReq = pConv->hszService; /* FIXME: they shouldn't be the
same, should they ? */
ci->hszTopic = pConv->hszTopic;
@@ -2070,6 +2086,7 @@
/******************************************************************
* DdeQueryConvInfo (USER32.@)
*
+ * FIXME: Set last DDE error on failure.
*/
UINT WINAPI DdeQueryConvInfo(HCONV hConv, DWORD id, PCONVINFO lpConvInfo)
{
@@ -2088,18 +2105,20 @@
EnterCriticalSection(&WDML_CritSect);
pConv = WDML_GetConv(hConv, FALSE);
- if (pConv != NULL && !WDML_GetLocalConvInfo(pConv, &ci, id))
- {
- ret = 0;
- }
- else if ((DWORD)hConv & 1)
- {
- pConv = WDML_GetConv((HCONV)((DWORD)hConv & ~1), FALSE);
- if (pConv != NULL)
- {
- FIXME("Request on remote conversation information is not implemented
yet\n");
- ret = 0;
- }
+ if (pConv != NULL)
+ {
+ if (!WDML_GetLocalConvInfo(pConv, &ci, id))
+ ret = 0;
+ }
+ else
+ {
+ if ((ULONG_PTR)hConv & 1)
+ {
+ pConv = WDML_GetConv((HCONV)((ULONG_PTR)hConv & ~1), FALSE);
+ if (pConv != NULL)
+ FIXME("Request on remote conversation information is not implemented
yet\n");
+ }
+ ret = 0;
}
LeaveCriticalSection(&WDML_CritSect);
if (ret != 0)
@@ -2333,7 +2352,7 @@
void WDML_FreeTransaction(WDML_INSTANCE* pInstance, WDML_XACT* pXAct, BOOL doFreePmt)
{
/* free pmt(s) in pXAct too. check against one for not deleting TRUE return values
*/
- if (doFreePmt && (DWORD)pXAct->hMem > 1)
+ if (doFreePmt && (ULONG_PTR)pXAct->hMem > 1)
{
GlobalFree(pXAct->hMem);
}
@@ -2368,7 +2387,7 @@
struct tagWDML_BroadcastPmt
{
- LPCSTR clsName;
+ LPCWSTR clsName;
UINT uMsg;
WPARAM wParam;
LPARAM lParam;
@@ -2382,12 +2401,12 @@
static BOOL CALLBACK WDML_BroadcastEnumProc(HWND hWnd, LPARAM lParam)
{
struct tagWDML_BroadcastPmt* s = (struct tagWDML_BroadcastPmt*)lParam;
- char buffer[128];
-
- if (GetClassNameA(hWnd, buffer, sizeof(buffer)) > 0 &&
- strcmp(buffer, s->clsName) == 0)
- {
- PostMessageA(hWnd, s->uMsg, s->wParam, s->lParam);
+ WCHAR buffer[128];
+
+ if (GetClassNameW(hWnd, buffer, 128) > 0 &&
+ lstrcmpiW(buffer, s->clsName) == 0)
+ {
+ PostMessageW(hWnd, s->uMsg, s->wParam, s->lParam);
}
return TRUE;
}
@@ -2397,7 +2416,7 @@
*
*
*/
-void WDML_BroadcastDDEWindows(const char* clsName, UINT uMsg, WPARAM wParam, LPARAM
lParam)
+void WDML_BroadcastDDEWindows(LPCWSTR clsName, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
struct tagWDML_BroadcastPmt s;
Modified: trunk/reactos/dll/win32/user32/misc/ddeclient.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/misc/ddec…
==============================================================================
--- trunk/reactos/dll/win32/user32/misc/ddeclient.c (original)
+++ trunk/reactos/dll/win32/user32/misc/ddeclient.c Sun Jun 25 14:38:48 2006
@@ -6,6 +6,7 @@
* Copyright 1999 Keith Matthews
* Copyright 2000 Corel
* Copyright 2001 Eric Pouech
+ * Copyright 2004, 2005 Dmitry Timoshkov
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -113,48 +114,48 @@
if (pInstance->unicode)
{
- WNDCLASSEXW wndclass;
-
- wndclass.cbSize = sizeof(wndclass);
- wndclass.style = 0;
- wndclass.lpfnWndProc = WDML_ClientProc;
- wndclass.cbClsExtra = 0;
- wndclass.cbWndExtra = 2 * sizeof(DWORD);
- wndclass.hInstance = 0;
- wndclass.hIcon = 0;
- wndclass.hCursor = 0;
- wndclass.hbrBackground = 0;
- wndclass.lpszMenuName = NULL;
- wndclass.lpszClassName = WDML_szClientConvClassW;
- wndclass.hIconSm = 0;
-
- RegisterClassExW(&wndclass);
-
- hwndClient = CreateWindowW(WDML_szClientConvClassW, NULL, WS_POPUP, 0, 0, 0, 0, 0, 0, 0,
0);
+ WNDCLASSEXW wndclass;
+
+ wndclass.cbSize = sizeof(wndclass);
+ wndclass.style = 0;
+ wndclass.lpfnWndProc = WDML_ClientProc;
+ 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_szClientConvClassW;
+ wndclass.hIconSm = 0;
+
+ RegisterClassExW(&wndclass);
+
+ hwndClient = CreateWindowW(WDML_szClientConvClassW, NULL, WS_POPUP, 0, 0, 0, 0,
0, 0, 0, 0);
}
else
{
- WNDCLASSEXA wndclass;
-
- wndclass.cbSize = sizeof(wndclass);
- wndclass.style = 0;
- wndclass.lpfnWndProc = WDML_ClientProc;
- wndclass.cbClsExtra = 0;
- wndclass.cbWndExtra = 2 * sizeof(DWORD);
- wndclass.hInstance = 0;
- wndclass.hIcon = 0;
- wndclass.hCursor = 0;
- wndclass.hbrBackground = 0;
- wndclass.lpszMenuName = NULL;
- wndclass.lpszClassName = WDML_szClientConvClassA;
- wndclass.hIconSm = 0;
-
- RegisterClassExA(&wndclass);
-
- hwndClient = CreateWindowA(WDML_szClientConvClassA, NULL, WS_POPUP, 0, 0, 0, 0, 0, 0, 0,
0);
- }
-
- SetWindowLongA(hwndClient, GWL_WDML_INSTANCE, (DWORD)pInstance);
+ WNDCLASSEXA wndclass;
+
+ wndclass.cbSize = sizeof(wndclass);
+ wndclass.style = 0;
+ wndclass.lpfnWndProc = WDML_ClientProc;
+ 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_szClientConvClassA;
+ wndclass.hIconSm = 0;
+
+ RegisterClassExA(&wndclass);
+
+ hwndClient = CreateWindowA(WDML_szClientConvClassA, NULL, WS_POPUP, 0, 0, 0, 0,
0, 0, 0, 0);
+ }
+
+ SetWindowLongPtrW(hwndClient, GWL_WDML_INSTANCE, (ULONG_PTR)pInstance);
if (hszService)
{
@@ -187,7 +188,7 @@
pConv = WDML_GetConvFromWnd(hwndClient);
if (pConv == NULL || pConv->hwndServer == 0)
{
- ERR("Done with INITIATE, but no Server window available\n");
+ WARN("Done with INITIATE, but no Server window available\n");
pConv = NULL;
goto theEnd;
}
@@ -245,7 +246,7 @@
HWND hwndServer = pConv->hwndServer;
ATOM aSrv, aTpc;
- SetWindowLongA(pConv->hwndClient, GWL_WDML_CONVERSATION, 0);
+ SetWindowLongPtrW(pConv->hwndClient, GWL_WDML_CONVERSATION, 0);
aSrv = WDML_MakeAtomFromHsz(pConv->hszService);
aTpc = WDML_MakeAtomFromHsz(pConv->hszTopic);
@@ -254,7 +255,7 @@
LeaveCriticalSection(&WDML_CritSect);
/* note: sent messages shall not use packing */
- ret = SendMessageA(hwndServer, WM_DDE_INITIATE, (WPARAM)hwndClient,
+ ret = SendMessageW(hwndServer, WM_DDE_INITIATE, (WPARAM)hwndClient,
MAKELPARAM(aSrv, aTpc));
EnterCriticalSection(&WDML_CritSect);
@@ -284,7 +285,7 @@
else
{
/* reset the conversation as it was */
- SetWindowLongA(pConv->hwndClient, GWL_WDML_CONVERSATION, (DWORD)pConv);
+ SetWindowLongPtrW(pConv->hwndClient, GWL_WDML_CONVERSATION, (ULONG_PTR)pConv);
}
}
}
@@ -341,7 +342,7 @@
*
* handles the reply to an advise request
*/
-static WDML_QUEUE_STATE WDML_HandleAdviseReply(WDML_CONV* pConv, MSG* msg, WDML_XACT*
pXAct)
+static WDML_QUEUE_STATE WDML_HandleAdviseReply(WDML_CONV* pConv, MSG* msg, WDML_XACT*
pXAct, DWORD *ack)
{
DDEACK ddeAck;
UINT_PTR uiLo, uiHi;
@@ -361,6 +362,7 @@
GlobalDeleteAtom(uiHi);
FreeDDElParam(WM_DDE_ACK, msg->lParam);
+ if (ack) *ack = uiLo;
WDML_ExtractAck(uiLo, &ddeAck);
if (ddeAck.fAck)
@@ -426,7 +428,7 @@
*
*
*/
-static WDML_QUEUE_STATE WDML_HandleUnadviseReply(WDML_CONV* pConv, MSG* msg, WDML_XACT*
pXAct)
+static WDML_QUEUE_STATE WDML_HandleUnadviseReply(WDML_CONV* pConv, MSG* msg, WDML_XACT*
pXAct, DWORD *ack)
{
DDEACK ddeAck;
UINT_PTR uiLo, uiHi;
@@ -446,6 +448,7 @@
FreeDDElParam(WM_DDE_ACK, msg->lParam);
GlobalDeleteAtom(uiHi);
+ if (ack) *ack = uiLo;
WDML_ExtractAck(uiLo, &ddeAck);
TRACE("WM_DDE_ACK received while waiting for a timeout\n");
@@ -497,7 +500,7 @@
*
*
*/
-static WDML_QUEUE_STATE WDML_HandleRequestReply(WDML_CONV* pConv, MSG* msg, WDML_XACT*
pXAct)
+static WDML_QUEUE_STATE WDML_HandleRequestReply(WDML_CONV* pConv, MSG* msg, WDML_XACT*
pXAct, DWORD *ack)
{
DDEACK ddeAck;
WINE_DDEHEAD wdh;
@@ -513,6 +516,7 @@
UnpackDDElParam(WM_DDE_ACK, msg->lParam, &uiLo, &uiHi);
FreeDDElParam(WM_DDE_ACK, msg->lParam);
GlobalDeleteAtom(uiHi);
+ if (ack) *ack = uiLo;
WDML_ExtractAck(uiLo, &ddeAck);
pXAct->hDdeData = 0;
if (ddeAck.fAck)
@@ -565,8 +569,11 @@
BOOL clientUnicode, serverUnicode;
DWORD memSize;
- clientUnicode = IsWindowUnicode(pConv->hwndClient);
- serverUnicode = IsWindowUnicode(pConv->hwndServer);
+ clientUnicode = pConv->instance->unicode;
+ TRACE("client %p uses unicode = %d\n", pConv->hwndClient,
clientUnicode);
+ /* FIXME: how exactly Windows determines what to use for the server side? */
+ serverUnicode = IsWindowUnicode(pConv->hwndServer) &&
IsWindowUnicode(pConv->hwndClient);
+ TRACE("server %p uses unicode = %d\n", pConv->hwndServer,
serverUnicode);
if (clientUnicode == serverUnicode)
{
@@ -580,7 +587,7 @@
}
else
{
- memSize = MultiByteToWideChar( CP_ACP, 0, pData, cbData, NULL, 0);
+ memSize = MultiByteToWideChar( CP_ACP, 0, pData, cbData, NULL, 0) * sizeof(WCHAR);
}
}
@@ -588,7 +595,7 @@
if (hMem)
{
- PCHAR pDst;
+ LPSTR pDst;
pDst = GlobalLock(hMem);
if (pDst)
@@ -605,7 +612,7 @@
}
else
{
- MultiByteToWideChar( CP_ACP, 0, pData, cbData, (LPWSTR)pDst, memSize);
+ MultiByteToWideChar( CP_ACP, 0, pData, cbData, (LPWSTR)pDst,
memSize/sizeof(WCHAR));
}
}
@@ -661,7 +668,7 @@
*
*
*/
-static WDML_QUEUE_STATE WDML_HandleExecuteReply(WDML_CONV* pConv, MSG* msg, WDML_XACT*
pXAct)
+static WDML_QUEUE_STATE WDML_HandleExecuteReply(WDML_CONV* pConv, MSG* msg, WDML_XACT*
pXAct, DWORD *ack)
{
DDEACK ddeAck;
UINT_PTR uiLo, uiHi;
@@ -679,8 +686,12 @@
return WDML_QS_PASS;
}
+ if (ack) *ack = uiLo;
WDML_ExtractAck(uiLo, &ddeAck);
pXAct->hDdeData = (HDDEDATA)(UINT_PTR)ddeAck.fAck;
+
+ TRACE("hDdeData = %p\n", pXAct->hDdeData);
+ pConv->instance->lastError = (pXAct->hDdeData != 0) ? DMLERR_NO_ERROR :
DMLERR_NOTPROCESSED;
return WDML_QS_HANDLED;
}
@@ -737,9 +748,8 @@
*
*
*/
-static WDML_QUEUE_STATE WDML_HandlePokeReply(WDML_CONV* pConv, MSG* msg, WDML_XACT*
pXAct)
-{
- DDEACK ddeAck;
+static WDML_QUEUE_STATE WDML_HandlePokeReply(WDML_CONV* pConv, MSG* msg, WDML_XACT*
pXAct, DWORD *ack)
+{
UINT_PTR uiLo, uiHi;
HSZ hsz;
@@ -757,7 +767,7 @@
FreeDDElParam(WM_DDE_ACK, msg->lParam);
GlobalDeleteAtom(uiHi);
- WDML_ExtractAck(uiLo, &ddeAck);
+ if (ack) *ack = uiLo;
GlobalFree(pXAct->hMem);
pXAct->hDdeData = (HDDEDATA)TRUE;
@@ -892,7 +902,7 @@
if (pConv->wStatus & ST_CONNECTED)
{
/* don't care about result code (if server exists or not) */
- PostMessageA(pConv->hwndServer, WM_DDE_TERMINATE, (WPARAM)pConv->hwndClient, 0L);
+ PostMessageW(pConv->hwndServer, WM_DDE_TERMINATE, (WPARAM)pConv->hwndClient, 0L);
pConv->wStatus &= ~ST_CONNECTED;
}
/* have to keep connection around to allow reconnection */
@@ -904,7 +914,7 @@
*
* handles any incoming reply, and try to match to an already sent request
*/
-static WDML_QUEUE_STATE WDML_HandleReply(WDML_CONV* pConv, MSG* msg, HDDEDATA* hdd)
+static WDML_QUEUE_STATE WDML_HandleReply(WDML_CONV* pConv, MSG* msg, HDDEDATA* hdd, DWORD
*ack)
{
WDML_XACT* pXAct = pConv->transactions;
WDML_QUEUE_STATE qs;
@@ -915,19 +925,19 @@
switch (pXAct->ddeMsg)
{
case WM_DDE_ADVISE:
- qs = WDML_HandleAdviseReply(pConv, msg, pXAct);
+ qs = WDML_HandleAdviseReply(pConv, msg, pXAct, ack);
break;
case WM_DDE_UNADVISE:
- qs = WDML_HandleUnadviseReply(pConv, msg, pXAct);
+ qs = WDML_HandleUnadviseReply(pConv, msg, pXAct, ack);
break;
case WM_DDE_EXECUTE:
- qs = WDML_HandleExecuteReply(pConv, msg, pXAct);
+ qs = WDML_HandleExecuteReply(pConv, msg, pXAct, ack);
break;
case WM_DDE_REQUEST:
- qs = WDML_HandleRequestReply(pConv, msg, pXAct);
+ qs = WDML_HandleRequestReply(pConv, msg, pXAct, ack);
break;
case WM_DDE_POKE:
- qs = WDML_HandlePokeReply(pConv, msg, pXAct);
+ qs = WDML_HandlePokeReply(pConv, msg, pXAct, ack);
break;
case WM_DDE_TERMINATE:
qs = WDML_HandleTerminateReply(pConv, msg, pXAct);
@@ -993,7 +1003,7 @@
* waits until an answer for a sent request is received
* time out is also handled. only used for synchronous transactions
*/
-static HDDEDATA WDML_SyncWaitTransactionReply(HCONV hConv, DWORD dwTimeout, WDML_XACT*
pXAct)
+static HDDEDATA WDML_SyncWaitTransactionReply(HCONV hConv, DWORD dwTimeout, WDML_XACT*
pXAct, DWORD *ack)
{
DWORD dwTime;
DWORD err;
@@ -1012,33 +1022,47 @@
if (MsgWaitForMultipleObjects(0, NULL, FALSE,
dwTimeout - dwTime, QS_POSTMESSAGE) == WAIT_OBJECT_0)
{
- BOOL ret = FALSE;
MSG msg;
- WDML_CONV* pConv;
- HDDEDATA hdd;
-
- EnterCriticalSection(&WDML_CritSect);
-
- pConv = WDML_GetConv(hConv, FALSE);
- if (pConv == NULL)
+
+ while (PeekMessageW(&msg, 0, WM_DDE_FIRST, WM_DDE_LAST, PM_REMOVE))
{
- LeaveCriticalSection(&WDML_CritSect);
- /* conversation no longer available... return failure */
- break;
- }
- while (PeekMessageA(&msg, pConv->hwndClient, WM_DDE_FIRST, WM_DDE_LAST,
PM_REMOVE))
- {
- /* check that either pXAct has been processed or no more xActions are pending */
- ret = (pConv->transactions == pXAct);
- ret = WDML_HandleReply(pConv, &msg, &hdd) == WDML_QS_HANDLED &&
- (pConv->transactions == NULL || ret);
- if (ret) break;
- }
- LeaveCriticalSection(&WDML_CritSect);
- if (ret)
- {
- return hdd;
- }
+ WDML_CONV *pConv;
+ HDDEDATA hdd;
+
+ EnterCriticalSection(&WDML_CritSect);
+
+ pConv = WDML_GetConv(hConv, FALSE);
+ if (pConv == NULL)
+ {
+ LeaveCriticalSection(&WDML_CritSect);
+ /* conversation no longer available... return failure */
+ return 0;
+ }
+ 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)
+ {
+ TRACE("WDML_HandleReply returned WDML_QS_HANDLED\n");
+ ret = TRUE;
+ }
+ else
+ ret = (pConv->transactions == NULL || ret);
+
+ if (ret)
+ {
+ pConv->instance->lastError = hdd ? DMLERR_NO_ERROR :
DMLERR_NOTPROCESSED;
+ LeaveCriticalSection(&WDML_CritSect);
+ return hdd;
+ }
+ }
+ else
+ {
+ LeaveCriticalSection(&WDML_CritSect);
+ DispatchMessageW(&msg);
+ }
+ }
}
}
@@ -1084,7 +1108,7 @@
if (hConv == 0)
{
- ERR("Invalid conversation handle\n");
+ WARN("Invalid conversation handle NULL\n");
return 0;
}
@@ -1100,11 +1124,7 @@
switch (wType)
{
case XTYP_EXECUTE:
- if (hszItem != 0 || wFmt != 0)
- {
- pConv->instance->lastError = DMLERR_INVALIDPARAMETER;
- goto theError;
- }
+ /* Windows simply ignores hszItem and wFmt in this case */
pXAct = WDML_ClientQueueExecute(pConv, pData, cbData);
break;
case XTYP_POKE:
@@ -1152,7 +1172,7 @@
WDML_QueueTransaction(pConv, pXAct);
- if (!PostMessageA(pConv->hwndServer, pXAct->ddeMsg,
(WPARAM)pConv->hwndClient, pXAct->lParam))
+ if (!PostMessageW(pConv->hwndServer, pXAct->ddeMsg,
(WPARAM)pConv->hwndClient, pXAct->lParam))
{
WARN("Failed posting message %x to %p (error=0x%lx)\n",
pXAct->ddeMsg, pConv->hwndServer, GetLastError());
@@ -1176,14 +1196,10 @@
{
DWORD count, i;
- if (pdwResult)
- {
- *pdwResult = 0L;
- }
count = WDML_CritSect.RecursionCount;
for (i = 0; i < count; i++)
LeaveCriticalSection(&WDML_CritSect);
- hDdeData = WDML_SyncWaitTransactionReply((HCONV)pConv, dwTimeout, pXAct);
+ hDdeData = WDML_SyncWaitTransactionReply((HCONV)pConv, dwTimeout, pXAct, pdwResult);
for (i = 0; i < count; i++)
EnterCriticalSection(&WDML_CritSect);
}
@@ -1204,7 +1220,7 @@
WDML_CONV* pConv;
WDML_XACT* pXAct;
- TRACE("(%08lx,%p,%08ld);\n", idInst, hConv, idTransaction);
+ TRACE("(%08lx,%p,%08lx);\n", idInst, hConv, idTransaction);
EnterCriticalSection(&WDML_CritSect);
if ((pInstance = WDML_GetInstance(idInst)))
@@ -1256,6 +1272,8 @@
WDML_CONV* pConv = NULL;
HSZ hszSrv, hszTpc;
+ TRACE("%p %04x %08x %08lx\n", hwnd, iMsg, wParam , lParam);
+
if (iMsg == WM_DDE_ACK &&
/* in the initial WM_INITIATE sendmessage */
((pConv = WDML_GetConvFromWnd(hwnd)) == NULL || pConv->wStatus == XST_INIT1))
@@ -1274,7 +1292,7 @@
/* we already have started the conv with a server, drop other replies */
GlobalDeleteAtom(uiLo);
GlobalDeleteAtom(uiHi);
- PostMessageA((HWND)wParam, WM_DDE_TERMINATE, (WPARAM)hwnd, 0);
+ PostMessageW((HWND)wParam, WM_DDE_TERMINATE, (WPARAM)hwnd, 0);
return 0;
}
@@ -1285,15 +1303,15 @@
pConv = WDML_AddConv(pInstance, WDML_CLIENT_SIDE, hszSrv, hszTpc, hwnd, (HWND)wParam);
- SetWindowLongA(hwnd, GWL_WDML_CONVERSATION, (DWORD)pConv);
+ SetWindowLongPtrW(hwnd, GWL_WDML_CONVERSATION, (ULONG_PTR)pConv);
pConv->wStatus |= ST_CONNECTED;
pConv->wConvst = XST_INIT1;
/* check if server is handled by DDEML */
if ((GetClassNameA((HWND)wParam, buf, sizeof(buf)) &&
- strcmp(buf, WDML_szServerConvClassA) == 0) ||
+ lstrcmpiA(buf, WDML_szServerConvClassA) == 0) ||
(GetClassNameW((HWND)wParam, (LPWSTR)buf, sizeof(buf)/sizeof(WCHAR)) &&
- lstrcmpW((LPWSTR)buf, WDML_szServerConvClassW) == 0))
+ lstrcmpiW((LPWSTR)buf, WDML_szServerConvClassW) == 0))
{
pConv->wStatus |= ST_ISLOCAL;
}
@@ -1323,15 +1341,15 @@
msg.wParam = wParam;
msg.lParam = lParam;
- WDML_HandleReply(pConv, &msg, &hdd);
+ WDML_HandleReply(pConv, &msg, &hdd, NULL);
}
LeaveCriticalSection(&WDML_CritSect);
return 0;
}
- return (IsWindowUnicode(hwnd)) ?
- DefWindowProcW(hwnd, iMsg, wParam, lParam) : DefWindowProcA(hwnd, iMsg, wParam,
lParam);
+ return IsWindowUnicode(hwnd) ? DefWindowProcW(hwnd, iMsg, wParam, lParam) :
+ DefWindowProcA(hwnd, iMsg, wParam, lParam);
}
/*****************************************************************
@@ -1348,7 +1366,7 @@
if (hConv == 0)
{
- ERR("DdeDisconnect(): hConv = 0\n");
+ WARN("DdeDisconnect(): hConv = 0\n");
return FALSE;
}
@@ -1365,9 +1383,9 @@
count = WDML_CritSect.RecursionCount;
for (i = 0; i < count; i++)
LeaveCriticalSection(&WDML_CritSect);
- if (PostMessageA(pConv->hwndServer, pXAct->ddeMsg,
+ if (PostMessageW(pConv->hwndServer, pXAct->ddeMsg,
(WPARAM)pConv->hwndClient, pXAct->lParam))
- WDML_SyncWaitTransactionReply(hConv, 10000, pXAct);
+ WDML_SyncWaitTransactionReply(hConv, 10000, pXAct, NULL);
for (i = 0; i < count; i++)
EnterCriticalSection(&WDML_CritSect);
ret = TRUE;
Modified: trunk/reactos/dll/win32/user32/misc/ddeserver.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/misc/ddes…
==============================================================================
--- trunk/reactos/dll/win32/user32/misc/ddeserver.c (original)
+++ trunk/reactos/dll/win32/user32/misc/ddeserver.c Sun Jun 25 14:38:48 2006
@@ -6,6 +6,7 @@
* Copyright 1999 Keith Matthews
* Copyright 2000 Corel
* Copyright 2001 Eric Pouech
+ * Copyright 2003, 2004, 2005 Dmitry Timoshkov
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -28,7 +29,7 @@
WINE_DEFAULT_DEBUG_CHANNEL(ddeml);
-static const char szServerNameClassA[] = "DdeServerNameAnsi";
+static const WCHAR szServerNameClass[] =
{'D','d','e','S','e','r','v','e','r','N','a','m','e',0};
const char WDML_szServerConvClassA[] = "DdeServerConvAnsi";
const WCHAR WDML_szServerConvClassW[] =
{'D','d','e','S','e','r','v','e','r','C','o','n','v','U','n','i','c','o','d','e',0};
@@ -121,7 +122,7 @@
goto theError;
}
- if (!PostMessageA(pConv->hwndClient, WM_DDE_DATA, (WPARAM)pConv->hwndServer,
+ if (!PostMessageW(pConv->hwndClient, WM_DDE_DATA, (WPARAM)pConv->hwndServer,
PackDDElParam(WM_DDE_DATA, (UINT_PTR)hItemData, atom)))
{
ERR("post message failed\n");
@@ -162,7 +163,7 @@
WDML_INSTANCE* pInstance;
HDDEDATA hDdeData;
HWND hwndServer;
- WNDCLASSEXA wndclass;
+ WNDCLASSEXW wndclass;
hDdeData = NULL;
@@ -222,25 +223,25 @@
wndclass.style = 0;
wndclass.lpfnWndProc = WDML_ServerNameProc;
wndclass.cbClsExtra = 0;
- wndclass.cbWndExtra = 2 * sizeof(DWORD);
+ wndclass.cbWndExtra = 2 * sizeof(ULONG_PTR);
wndclass.hInstance = 0;
wndclass.hIcon = 0;
wndclass.hCursor = 0;
wndclass.hbrBackground = 0;
wndclass.lpszMenuName = NULL;
- wndclass.lpszClassName = szServerNameClassA;
+ wndclass.lpszClassName = szServerNameClass;
wndclass.hIconSm = 0;
- RegisterClassExA(&wndclass);
+ RegisterClassExW(&wndclass);
LeaveCriticalSection(&WDML_CritSect);
- hwndServer = CreateWindowA(szServerNameClassA, NULL,
+ hwndServer = CreateWindowW(szServerNameClass, NULL,
WS_POPUP, 0, 0, 0, 0,
0, 0, 0, 0);
EnterCriticalSection(&WDML_CritSect);
- SetWindowLongA(hwndServer, GWL_WDML_INSTANCE, (DWORD)pInstance);
- SetWindowLongA(hwndServer, GWL_WDML_SERVER, (DWORD)pServer);
+ SetWindowLongPtrW(hwndServer, GWL_WDML_INSTANCE, (ULONG_PTR)pInstance);
+ SetWindowLongPtrW(hwndServer, GWL_WDML_SERVER, (ULONG_PTR)pServer);
TRACE("Created nameServer=%p for instance=%08lx\n", hwndServer, idInst);
pServer->hwndServer = hwndServer;
@@ -308,7 +309,7 @@
wndclass.style = 0;
wndclass.lpfnWndProc = WDML_ServerConvProc;
wndclass.cbClsExtra = 0;
- wndclass.cbWndExtra = 2 * sizeof(DWORD);
+ wndclass.cbWndExtra = 2 * sizeof(ULONG_PTR);
wndclass.hInstance = 0;
wndclass.hIcon = 0;
wndclass.hCursor = 0;
@@ -331,7 +332,7 @@
wndclass.style = 0;
wndclass.lpfnWndProc = WDML_ServerConvProc;
wndclass.cbClsExtra = 0;
- wndclass.cbWndExtra = 2 * sizeof(DWORD);
+ wndclass.cbWndExtra = 2 * sizeof(ULONG_PTR);
wndclass.hInstance = 0;
wndclass.hIcon = 0;
wndclass.hCursor = 0;
@@ -354,12 +355,12 @@
hwndClient, hwndServerConv);
if (pConv)
{
- SetWindowLongA(hwndServerConv, GWL_WDML_INSTANCE, (DWORD)pInstance);
- SetWindowLongA(hwndServerConv, GWL_WDML_CONVERSATION, (DWORD)pConv);
+ SetWindowLongPtrW(hwndServerConv, GWL_WDML_INSTANCE, (ULONG_PTR)pInstance);
+ SetWindowLongPtrW(hwndServerConv, GWL_WDML_CONVERSATION, (ULONG_PTR)pConv);
/* this should be the only place using SendMessage for WM_DDE_ACK */
/* note: sent messages shall not use packing */
- SendMessageA(hwndClient, WM_DDE_ACK, (WPARAM)hwndServerConv,
+ SendMessageW(hwndClient, WM_DDE_ACK, (WPARAM)hwndServerConv,
MAKELPARAM(WDML_MakeAtomFromHsz(hszApp), WDML_MakeAtomFromHsz(hszTopic)));
/* we assume we're connected since we've sent an answer...
* I'm not sure what we can do... it doesn't look like the return value
@@ -425,9 +426,9 @@
* handled under DDEML, and if so build a default context
*/
if ((GetClassNameA(hwndClient, buf, sizeof(buf)) &&
- strcmp(buf, WDML_szClientConvClassA) == 0) ||
+ lstrcmpiA(buf, WDML_szClientConvClassA) == 0) ||
(GetClassNameW(hwndClient, (LPWSTR)buf, sizeof(buf)/sizeof(WCHAR)) &&
- lstrcmpW((LPWSTR)buf, WDML_szClientConvClassW) == 0))
+ lstrcmpiW((LPWSTR)buf, WDML_szClientConvClassW) == 0))
{
pcc = &cc;
memset(pcc, 0, sizeof(*pcc));
@@ -440,15 +441,15 @@
}
else if (hszApp && hszTop)
{
- WDML_SERVER* pServer = (WDML_SERVER*)GetWindowLongA(hwndServer, GWL_WDML_SERVER);
+ WDML_SERVER* pServer = (WDML_SERVER*)GetWindowLongPtrW(hwndServer, GWL_WDML_SERVER);
/* check filters for name service */
if (!pServer->filterOn || DdeCmpStringHandles(pServer->hszService, hszApp) == 0)
{
/* pass on to the callback */
hDdeData = WDML_InvokeCallback(pInstance, XTYP_CONNECT,
- 0, 0, hszTop, hszApp, 0, (DWORD)pcc, self);
- if ((UINT)hDdeData)
+ 0, 0, hszTop, hszApp, 0, (ULONG_PTR)pcc, self);
+ if ((ULONG_PTR)hDdeData)
{
pConv = WDML_CreateServerConv(pInstance, hwndClient, hwndServer,
hszApp, hszTop);
@@ -456,7 +457,7 @@
{
if (pcc) pConv->wStatus |= ST_ISLOCAL;
WDML_InvokeCallback(pInstance, XTYP_CONNECT_CONFIRM, 0,
(HCONV)pConv,
- hszTop, hszApp, 0, (DWORD)pcc, self);
+ hszTop, hszApp, 0, (ULONG_PTR)pcc,
self);
}
}
}
@@ -465,14 +466,14 @@
{
/* pass on to the callback */
hDdeData = WDML_InvokeCallback(pInstance, XTYP_WILDCONNECT,
- 0, 0, hszTop, hszApp, 0, (DWORD)pcc, self);
+ 0, 0, hszTop, hszApp, 0, (ULONG_PTR)pcc, self);
if (hDdeData == (HDDEDATA)CBR_BLOCK)
{
/* MS doc is not consistent here */
FIXME("CBR_BLOCK returned for WILDCONNECT\n");
}
- else if ((UINT)hDdeData != 0)
+ else if ((ULONG_PTR)hDdeData != 0)
{
HSZPAIR* hszp;
@@ -488,7 +489,7 @@
{
if (pcc) pConv->wStatus |= ST_ISLOCAL;
WDML_InvokeCallback(pInstance, XTYP_CONNECT_CONFIRM, 0,
(HCONV)pConv,
- hszp[i].hszTopic, hszp[i].hszSvc, 0,
(DWORD)pcc, self);
+ hszp[i].hszTopic, hszp[i].hszSvc, 0,
(ULONG_PTR)pcc, self);
}
}
DdeUnaccessData(hDdeData);
@@ -499,7 +500,6 @@
}
return 0;
-
case WM_DDE_REQUEST:
FIXME("WM_DDE_REQUEST message received!\n");
@@ -519,10 +519,11 @@
case WM_DDE_TERMINATE:
FIXME("WM_DDE_TERMINATE message received!\n");
return 0;
-
- }
-
- return DefWindowProcA(hwndServer, iMsg, wParam, lParam);
+ default:
+ break;
+ }
+
+ return DefWindowProcW(hwndServer, iMsg, wParam, lParam);
}
/******************************************************************
@@ -551,7 +552,7 @@
static WDML_QUEUE_STATE WDML_ServerHandleRequest(WDML_CONV* pConv, WDML_XACT* pXAct)
{
HDDEDATA hDdeData = 0;
- WDML_QUEUE_STATE ret = WDML_QS_HANDLED;
+ BOOL fAck = TRUE;
if (!(pConv->instance->CBFflags & CBF_FAIL_REQUESTS))
{
@@ -563,27 +564,33 @@
switch ((ULONG_PTR)hDdeData)
{
case 0:
- WDML_PostAck(pConv, WDML_SERVER_SIDE, 0, FALSE, FALSE, pXAct->atom,
- pXAct->lParam, WM_DDE_REQUEST);
- break;
+ TRACE("No data returned from the Callback\n");
+ fAck = FALSE;
+ break;
+
case (ULONG_PTR)CBR_BLOCK:
- ret = WDML_QS_BLOCK;
- break;
+ return WDML_QS_BLOCK;
+
default:
{
HGLOBAL hMem = WDML_DataHandle2Global(hDdeData, TRUE, FALSE, FALSE, FALSE);
- if (!PostMessageA(pConv->hwndClient, WM_DDE_DATA, (WPARAM)pConv->hwndServer,
+ if (!PostMessageW(pConv->hwndClient, WM_DDE_DATA, (WPARAM)pConv->hwndServer,
ReuseDDElParam(pXAct->lParam, WM_DDE_REQUEST, WM_DDE_DATA,
(UINT_PTR)hMem, (UINT_PTR)pXAct->atom)))
{
DdeFreeDataHandle(hDdeData);
GlobalFree(hMem);
+ fAck = FALSE;
}
}
break;
}
+
+ WDML_PostAck(pConv, WDML_SERVER_SIDE, 0, FALSE, fAck, pXAct->atom,
pXAct->lParam, WM_DDE_REQUEST);
+
WDML_DecHSZ(pConv->instance, pXAct->hszItem);
- return ret;
+
+ return WDML_QS_HANDLED;
}
/******************************************************************
@@ -622,8 +629,8 @@
UINT uType;
WDML_LINK* pLink;
DDEADVISE* pDdeAdvise;
- HDDEDATA hDdeData;
- BOOL fAck;
+ HDDEDATA hDdeData = 0;
+ BOOL fAck = TRUE;
pDdeAdvise = (DDEADVISE*)GlobalLock(pXAct->hMem);
uType = XTYP_ADVSTART |
@@ -635,15 +642,18 @@
hDdeData = WDML_InvokeCallback(pConv->instance, XTYP_ADVSTART,
pDdeAdvise->cfFormat,
(HCONV)pConv, pConv->hszTopic, pXAct->hszItem, 0, 0, 0);
}
- else
- {
- hDdeData = 0;
- }
-
- if ((UINT)hDdeData)
- {
- fAck = TRUE;
-
+
+ switch ((ULONG_PTR)hDdeData)
+ {
+ case 0:
+ TRACE("No data returned from the Callback\n");
+ fAck = FALSE;
+ break;
+
+ case (ULONG_PTR)CBR_BLOCK:
+ return WDML_QS_BLOCK;
+
+ default:
/* billx: first to see if the link is already created. */
pLink = WDML_FindLink(pConv->instance, (HCONV)pConv, WDML_SERVER_SIDE,
pXAct->hszItem, TRUE, pDdeAdvise->cfFormat);
@@ -659,11 +669,7 @@
WDML_AddLink(pConv->instance, (HCONV)pConv, WDML_SERVER_SIDE,
uType, pXAct->hszItem, pDdeAdvise->cfFormat);
}
- }
- else
- {
- TRACE("No data returned from the Callback\n");
- fAck = FALSE;
+ break;
}
GlobalUnlock(pXAct->hMem);
@@ -781,8 +787,11 @@
pConv->hszTopic, 0, hDdeData, 0L, 0L);
}
- switch ((UINT)hDdeData)
- {
+ switch ((ULONG_PTR)hDdeData)
+ {
+ case (ULONG_PTR)CBR_BLOCK:
+ return WDML_QS_BLOCK;
+
case DDE_FACK:
fAck = TRUE;
break;
@@ -790,7 +799,7 @@
fBusy = TRUE;
break;
default:
- WARN("Bad result code\n");
+ FIXME("Unsupported returned value %p\n", hDdeData);
/* fall through */
case DDE_FNOTPROCESSED:
break;
@@ -909,7 +918,7 @@
WDML_InvokeCallback(pConv->instance, XTYP_DISCONNECT, 0, (HCONV)pConv, 0, 0,
0, 0, (pConv->wStatus & ST_ISSELF) ? 1 : 0);
}
- PostMessageA(pConv->hwndClient, WM_DDE_TERMINATE, (WPARAM)pConv->hwndServer,
0);
+ PostMessageW(pConv->hwndClient, WM_DDE_TERMINATE, (WPARAM)pConv->hwndServer,
0);
WDML_RemoveConv(pConv, WDML_SERVER_SIDE);
return WDML_QS_HANDLED;
@@ -974,6 +983,8 @@
WDML_CONV* pConv;
WDML_XACT* pXAct = NULL;
+ TRACE("%p %04x %08x %08lx\n", hwndServer, iMsg, wParam , lParam);
+
if (iMsg == WM_DESTROY)
{
EnterCriticalSection(&WDML_CritSect);
Modified: trunk/reactos/include/dde.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/dde.h?rev=22608&am…
==============================================================================
--- trunk/reactos/include/dde.h (original)
+++ trunk/reactos/include/dde.h Sun Jun 25 14:38:48 2006
@@ -1,64 +1,90 @@
-#ifndef _DDE_H
-#define _DDE_H
-#if __GNUC__ >=3
-#pragma GCC system_header
-#endif
+/*****************************************************************************
+ * Copyright 1995, Technion, Israel Institute of Technology
+ * Electrical Eng, Software Lab.
+ * Author: Michael Veksler.
+ * Purpose: dde declarations
+ *
+ * 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
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *****************************************************************************
+ */
+#ifndef __WINE_DDE_H
+#define __WINE_DDE_H
+
+#include <windef.h>
#ifdef __cplusplus
extern "C" {
#endif
-#define WM_DDE_FIRST 0x03E0
-#define WM_DDE_INITIATE (WM_DDE_FIRST)
-#define WM_DDE_TERMINATE (WM_DDE_FIRST+1)
-#define WM_DDE_ADVISE (WM_DDE_FIRST+2)
-#define WM_DDE_UNADVISE (WM_DDE_FIRST+3)
-#define WM_DDE_ACK (WM_DDE_FIRST+4)
-#define WM_DDE_DATA (WM_DDE_FIRST+5)
-#define WM_DDE_REQUEST (WM_DDE_FIRST+6)
-#define WM_DDE_POKE (WM_DDE_FIRST+7)
-#define WM_DDE_EXECUTE (WM_DDE_FIRST+8)
-#define WM_DDE_LAST (WM_DDE_FIRST+8)
-#ifndef RC_INVOKED
-typedef struct {
- unsigned short bAppReturnCode:8,reserved:6,fBusy:1,fAck:1;
+#define WM_DDE_INITIATE 0x3E0
+#define WM_DDE_TERMINATE 0x3E1
+#define WM_DDE_ADVISE 0x3E2
+#define WM_DDE_UNADVISE 0x3E3
+#define WM_DDE_ACK 0x3E4
+#define WM_DDE_DATA 0x3E5
+#define WM_DDE_REQUEST 0x3E6
+#define WM_DDE_POKE 0x3E7
+#define WM_DDE_EXECUTE 0x3E8
+#define WM_DDE_LAST WM_DDE_EXECUTE
+#define WM_DDE_FIRST WM_DDE_INITIATE
+
+/* DDEACK: wStatus in WM_DDE_ACK message */
+typedef struct
+{
+ unsigned short bAppReturnCode:8, reserved:6, fBusy:1, fAck:1;
} DDEACK;
-typedef struct {
- unsigned short reserved:14,fDeferUpd:1,fAckReq:1;
- short cfFormat;
+
+/* DDEDATA: hData in WM_DDE_DATA message */
+typedef struct
+{
+ unsigned short unused:12, fResponse:1, fRelease:1, reserved:1, fAckReq:1;
+ short cfFormat;
+ BYTE Value[1]; /* undetermined array */
+} DDEDATA;
+
+/* DDEADVISE: hOptions in WM_DDE_ADVISE message */
+typedef struct
+{
+ unsigned short reserved:14, fDeferUpd:1, fAckReq:1;
+ short cfFormat;
} DDEADVISE;
-typedef struct {
- unsigned short unused:12,fResponse:1,fRelease:1,reserved:1,fAckReq:1;
- short cfFormat;
- BYTE Value[1];
-} DDEDATA;
-typedef struct {
- unsigned short unused:13,fRelease:1,fReserved:2;
- short cfFormat;
- BYTE Value[1];
+
+/* DDEPOKE: hData in WM_DDE_POKE message. */
+typedef struct
+{
+ unsigned short unused:13, fRelease:1, fReserved:2;
+ short cfFormat;
+ BYTE Value[1]; /* undetermined array */
} DDEPOKE;
-typedef struct {
- unsigned short unused:13,
- fRelease:1,
- fDeferUpd:1,
- fAckReq:1;
- short cfFormat;
-} DDELN;
-typedef struct {
- unsigned short unused:12,fAck:1,fRelease:1,fReserved:1,fAckReq:1;
- short cfFormat;
- BYTE rgb[1];
-} DDEUP;
-BOOL WINAPI DdeSetQualityOfService(HWND,const
SECURITY_QUALITY_OF_SERVICE*,PSECURITY_QUALITY_OF_SERVICE);
-BOOL WINAPI ImpersonateDdeClientWindow(HWND,HWND);
-LPARAM WINAPI PackDDElParam(UINT,UINT_PTR,UINT_PTR);
-BOOL WINAPI UnpackDDElParam(UINT,LPARAM,PUINT_PTR,PUINT_PTR);
-BOOL WINAPI FreeDDElParam(UINT,LPARAM);
-LPARAM WINAPI ReuseDDElParam(LPARAM,UINT,UINT,UINT_PTR,UINT_PTR);
-#endif
+BOOL WINAPI DdeSetQualityOfService(HWND hwndClient,
+ CONST SECURITY_QUALITY_OF_SERVICE *pqosNew,
+ PSECURITY_QUALITY_OF_SERVICE pqosPrev);
+
+BOOL WINAPI ImpersonateDdeClientWindow(HWND hWndClient, HWND hWndServer);
+
+/* lParam packing/unpacking API */
+
+LPARAM WINAPI PackDDElParam(UINT,UINT_PTR,UINT_PTR);
+BOOL WINAPI UnpackDDElParam(UINT,LPARAM,PUINT_PTR,PUINT_PTR);
+BOOL WINAPI FreeDDElParam(UINT,LPARAM);
+LPARAM WINAPI ReuseDDElParam(LPARAM,UINT,UINT,UINT_PTR,UINT_PTR);
+
#ifdef __cplusplus
}
#endif
-#endif
+
+#endif /* __WINE_DDE_H */
Modified: trunk/reactos/include/ddeml.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ddeml.h?rev=22608&…
==============================================================================
--- trunk/reactos/include/ddeml.h (original)
+++ trunk/reactos/include/ddeml.h Sun Jun 25 14:38:48 2006
@@ -1,326 +1,377 @@
-#ifndef _DDEML_H
-#define _DDEML_H
-#if __GNUC__ >=3
-#pragma GCC system_header
-#endif
+/*
+ * DDEML library definitions
+ *
+ * Copyright 1997 Alexandre Julliard
+ * Copyright 1997 Len White
+ *
+ * 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
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef __WINE_DDEML_H
+#define __WINE_DDEML_H
#ifdef __cplusplus
extern "C" {
-#endif
-
-#define EXPENTRY CALLBACK
-#define CP_WINANSI 1004
-#define CP_WINUNICODE 1200
-#define XTYPF_NOBLOCK 2
-#define XTYPF_NODATA 4
-#define XTYPF_ACKREQ 8
-#define XCLASS_MASK 0xFC00
-#define XCLASS_BOOL 0x1000
-#define XCLASS_DATA 0x2000
-#define XCLASS_FLAGS 0x4000
-#define XCLASS_NOTIFICATION 0x8000
-#define XST_NULL 0
-#define XST_INCOMPLETE 1
-#define XST_CONNECTED 2
-#define XST_INIT1 3
-#define XST_INIT2 4
-#define XST_REQSENT 5
-#define XST_DATARCVD 6
-#define XST_POKESENT 7
-#define XST_POKEACKRCVD 8
-#define XST_EXECSENT 9
-#define XST_EXECACKRCVD 10
-#define XST_ADVSENT 11
-#define XST_UNADVSENT 12
-#define XST_ADVACKRCVD 13
-#define XST_UNADVACKRCVD 14
-#define XST_ADVDATASENT 15
-#define XST_ADVDATAACKRCVD 16
-#define XTYP_ERROR (XCLASS_NOTIFICATION|XTYPF_NOBLOCK)
-#define XTYP_ADVDATA (16|XCLASS_FLAGS)
-#define XTYP_ADVREQ (32|XCLASS_DATA|XTYPF_NOBLOCK)
-#define XTYP_ADVSTART (0x30|XCLASS_BOOL)
-#define XTYP_ADVSTOP (0x0040|XCLASS_NOTIFICATION)
-#define XTYP_EXECUTE (0x0050|XCLASS_FLAGS)
-#define XTYP_CONNECT (0x0060|XCLASS_BOOL|XTYPF_NOBLOCK)
-#define XTYP_CONNECT_CONFIRM (0x0070|XCLASS_NOTIFICATION|XTYPF_NOBLOCK)
-#define XTYP_XACT_COMPLETE (0x0080|XCLASS_NOTIFICATION)
-#define XTYP_POKE (0x0090|XCLASS_FLAGS)
-#define XTYP_REGISTER (0x00A0|XCLASS_NOTIFICATION|XTYPF_NOBLOCK)
-#define XTYP_REQUEST (0x00B0|XCLASS_DATA)
-#define XTYP_DISCONNECT (0x00C0|XCLASS_NOTIFICATION|XTYPF_NOBLOCK)
-#define XTYP_UNREGISTER (0x00D0|XCLASS_NOTIFICATION|XTYPF_NOBLOCK)
-#define XTYP_WILDCONNECT (0x00E0|XCLASS_DATA|XTYPF_NOBLOCK)
-#define XTYP_MASK 0xF0
-#define XTYP_SHIFT 4
-#define TIMEOUT_ASYNC 0xFFFFFFFF
+#endif /* defined(__cplusplus) */
+
+/* Codepage Constants
+ */
+
+#define CP_WINANSI 1004
+#define CP_WINUNICODE 1200
+
+/* DDE synchronisation constants
+ */
+
+#define MSGF_DDEMGR 0x8001
+
#define QID_SYNC 0xFFFFFFFF
-#define ST_CONNECTED 1
-#define ST_ADVISE 2
-#define ST_ISLOCAL 4
-#define ST_BLOCKED 8
-#define ST_CLIENT 16
-#define ST_TERMINATED 32
-#define ST_INLIST 64
-#define ST_BLOCKNEXT 128
-#define ST_ISSELF 256
-#define CADV_LATEACK 0xFFFF
-#define DMLERR_NO_ERROR 0
-#define DMLERR_FIRST 0x4000
-#define DMLERR_ADVACKTIMEOUT 0x4000
-#define DMLERR_BUSY 0x4001
-#define DMLERR_DATAACKTIMEOUT 0x4002
-#define DMLERR_DLL_NOT_INITIALIZED 0x4003
-#define DMLERR_DLL_USAGE 0x4004
-#define DMLERR_EXECACKTIMEOUT 0x4005
-#define DMLERR_INVALIDPARAMETER 0x4006
-#define DMLERR_LOW_MEMORY 0x4007
-#define DMLERR_MEMORY_ERROR 0x4008
-#define DMLERR_NOTPROCESSED 0x4009
-#define DMLERR_NO_CONV_ESTABLISHED 0x400a
-#define DMLERR_POKEACKTIMEOUT 0x400b
-#define DMLERR_POSTMSG_FAILED 0x400c
-#define DMLERR_REENTRANCY 0x400d
-#define DMLERR_SERVER_DIED 0x400e
-#define DMLERR_SYS_ERROR 0x400f
-#define DMLERR_UNADVACKTIMEOUT 0x4010
-#define DMLERR_UNFOUND_QUEUE_ID 0x4011
-#define DMLERR_LAST 0x4011
-#define DDE_FACK 0x8000
-#define DDE_FBUSY 0x4000
-#define DDE_FDEFERUPD 0x4000
-#define DDE_FACKREQ 0x8000
-#define DDE_FRELEASE 0x2000
-#define DDE_FREQUESTED 0x1000
-#define DDE_FAPPSTATUS 0x00ff
-#define DDE_FNOTPROCESSED 0
-#define DDE_FACKRESERVED (~(DDE_FACK|DDE_FBUSY|DDE_FAPPSTATUS))
-#define DDE_FADVRESERVED (~(DDE_FACKREQ|DDE_FDEFERUPD))
-#define DDE_FDATRESERVED (~(DDE_FACKREQ|DDE_FRELEASE|DDE_FREQUESTED))
-#define DDE_FPOKRESERVED (~DDE_FRELEASE)
-#define MSGF_DDEMGR 0x8001
-#define CBR_BLOCK ((HDDEDATA)0xffffffff)
-#define CBF_FAIL_SELFCONNECTIONS 0x1000
-#define CBF_FAIL_CONNECTIONS 0x2000
-#define CBF_FAIL_ADVISES 0x4000
-#define CBF_FAIL_EXECUTES 0x8000
-#define CBF_FAIL_POKES 0x10000
-#define CBF_FAIL_REQUESTS 0x20000
-#define CBF_FAIL_ALLSVRXACTIONS 0x3f000
-#define CBF_SKIP_CONNECT_CONFIRMS 0x40000
-#define CBF_SKIP_REGISTRATIONS 0x80000
-#define CBF_SKIP_UNREGISTRATIONS 0x100000
-#define CBF_SKIP_DISCONNECTS 0x200000
-#define CBF_SKIP_ALLNOTIFICATIONS 0x3c0000
-#define APPCMD_CLIENTONLY 0x10L
-#define APPCMD_FILTERINITS 0x20L
-#define APPCMD_MASK 0xFF0L
-#define APPCLASS_STANDARD 0
-#define APPCLASS_MASK 0xFL
-#define EC_ENABLEALL 0
-#define EC_ENABLEONE ST_BLOCKNEXT
-#define EC_DISABLE ST_BLOCKED
-#define EC_QUERYWAITING 2
-#define DNS_REGISTER 1
-#define DNS_UNREGISTER 2
-#define DNS_FILTERON 4
-#define DNS_FILTEROFF 8
-#define HDATA_APPOWNED 1
-#define MAX_MONITORS 4
-#define APPCLASS_MONITOR 1L
-#define XTYP_MONITOR (XCLASS_NOTIFICATION|XTYPF_NOBLOCK|0xF0)
-#define MF_HSZ_INFO 0x1000000
-#define MF_SENDMSGS 0x2000000
-#define MF_POSTMSGS 0x4000000
-#define MF_CALLBACKS 0x8000000
-#define MF_ERRORS 0x10000000
-#define MF_LINKS 0x20000000
-#define MF_CONV 0x40000000
-#define MF_MASK 0xFF000000
-#define MH_CREATE 1
-#define MH_KEEP 2
-#define MH_DELETE 3
-#define MH_CLEANUP 4
+
+/* Type variation for MS deliberate departures from ANSI standards
+ */
+
+#define EXPENTRY CALLBACK
+
+#define SZDDESYS_TOPIC TEXT("System")
+#define SZDDESYS_ITEM_TOPICS TEXT("Topics")
+#define SZDDESYS_ITEM_SYSITEMS TEXT("SysItems")
+#define SZDDESYS_ITEM_RTNMSG TEXT("ReturnMessage")
+#define SZDDESYS_ITEM_STATUS TEXT("Status")
+#define SZDDESYS_ITEM_FORMATS TEXT("Formats")
+#define SZDDESYS_ITEM_HELP TEXT("Help")
+#define SZDDE_ITEM_ITEMLIST TEXT("TopicItemList")
+
+/***************************************************
+
+ FLAGS Section - copied from Microsoft SDK as must be standard, probably Copyright
Microsoft Corporation
+
+***************************************************/
+
+#define XST_NULL 0
+#define XST_INCOMPLETE 1
+#define XST_CONNECTED 2
+#define XST_INIT1 3
+#define XST_INIT2 4
+#define XST_REQSENT 5
+#define XST_DATARCVD 6
+#define XST_POKESENT 7
+#define XST_POKEACKRCVD 8
+#define XST_EXECSENT 9
+#define XST_EXECACKRCVD 10
+#define XST_ADVSENT 11
+#define XST_UNADVSENT 12
+#define XST_ADVACKRCVD 13
+#define XST_UNADVACKRCVD 14
+#define XST_ADVDATASENT 15
+#define XST_ADVDATAACKRCVD 16
+
+#define ST_CONNECTED 0x0001
+#define ST_ADVISE 0x0002
+#define ST_ISLOCAL 0x0004
+#define ST_BLOCKED 0x0008
+#define ST_CLIENT 0x0010
+#define ST_TERMINATED 0x0020
+#define ST_INLIST 0x0040
+#define ST_BLOCKNEXT 0x0080
+#define ST_ISSELF 0x0100
+
+/*
+ * DdeEnableCallback function codes
+ */
+
+#define EC_ENABLEALL 0
+#define EC_ENABLEONE ST_BLOCKNEXT
+#define EC_DISABLE ST_BLOCKED
+#define EC_QUERYWAITING 2
+
+/*
+ * Callback filter flags for use with standard apps.
+ */
+
+#define CBF_FAIL_SELFCONNECTIONS 0x00001000
+#define CBF_FAIL_CONNECTIONS 0x00002000
+#define CBF_FAIL_ADVISES 0x00004000
+#define CBF_FAIL_EXECUTES 0x00008000
+#define CBF_FAIL_POKES 0x00010000
+#define CBF_FAIL_REQUESTS 0x00020000
+#define CBF_FAIL_ALLSVRXACTIONS 0x0003f000
+
+#define CBF_SKIP_CONNECT_CONFIRMS 0x00040000
+#define CBF_SKIP_REGISTRATIONS 0x00080000
+#define CBF_SKIP_UNREGISTRATIONS 0x00100000
+#define CBF_SKIP_DISCONNECTS 0x00200000
+#define CBF_SKIP_ALLNOTIFICATIONS 0x003c0000
+
+#define CBR_BLOCK ((HDDEDATA)~0UL)
+
+/*
+ * Application command flags
+ */
+#define APPCMD_CLIENTONLY 0x00000010L
+#define APPCMD_FILTERINITS 0x00000020L
+#define APPCMD_MASK 0x00000FF0L
+
+/*
+ * Application classification flags
+ */
+
+#define APPCLASS_STANDARD 0x00000000L
+#define APPCLASS_MONITOR 0x00000001L
+#define APPCLASS_MASK 0x0000000FL
+
+/*
+ * Callback filter flags for use with MONITOR apps - 0 implies no monitor
+ * callbacks.
+ */
+#define MF_HSZ_INFO 0x01000000
+#define MF_SENDMSGS 0x02000000
+#define MF_POSTMSGS 0x04000000
+#define MF_CALLBACKS 0x08000000
+#define MF_ERRORS 0x10000000
+#define MF_LINKS 0x20000000
+#define MF_CONV 0x40000000
+
+#define MF_MASK 0xFF000000
+
+/*
+ * DdeNameService service name flags
+ */
+
+#define DNS_REGISTER 0x0001
+#define DNS_UNREGISTER 0x0002
+#define DNS_FILTERON 0x0004
+#define DNS_FILTEROFF 0x0008
+
+
+/****************************************************
+
+ End of Flags section
+
+****************************************************/
+
+/****************************************************
+
+ Message Types Section
+
+****************************************************/
+
+#define XTYPF_NOBLOCK 0x0002 /* CBR_NOBLOCK will not work */
+#define XTYPF_NODATA 0x0004 /* DDE_FDEFERUPD */
+#define XTYPF_ACKREQ 0x0008 /* DDE_FACKREQ */
+
+#define XCLASS_MASK 0xFC00
+#define XCLASS_BOOL 0x1000
+#define XCLASS_DATA 0x2000
+#define XCLASS_FLAGS 0x4000
+#define XCLASS_NOTIFICATION 0x8000
+
+#define XTYP_ERROR (0x0000 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK)
+#define XTYP_ADVDATA (0x0010 | XCLASS_FLAGS)
+#define XTYP_ADVREQ (0x0020 | XCLASS_DATA | XTYPF_NOBLOCK)
+#define XTYP_ADVSTART (0x0030 | XCLASS_BOOL)
+#define XTYP_ADVSTOP (0x0040 | XCLASS_NOTIFICATION)
+#define XTYP_EXECUTE (0x0050 | XCLASS_FLAGS)
+#define XTYP_CONNECT (0x0060 | XCLASS_BOOL | XTYPF_NOBLOCK)
+#define XTYP_CONNECT_CONFIRM (0x0070 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK)
+#define XTYP_XACT_COMPLETE (0x0080 | XCLASS_NOTIFICATION )
+#define XTYP_POKE (0x0090 | XCLASS_FLAGS)
+#define XTYP_REGISTER (0x00A0 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK )
+#define XTYP_REQUEST (0x00B0 | XCLASS_DATA )
+#define XTYP_DISCONNECT (0x00C0 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK )
+#define XTYP_UNREGISTER (0x00D0 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK )
+#define XTYP_WILDCONNECT (0x00E0 | XCLASS_DATA | XTYPF_NOBLOCK)
+
+#define XTYP_MASK 0x00F0
+#define XTYP_SHIFT 4
+
+#define TIMEOUT_ASYNC 0xFFFFFFFF
+
+#define CADV_LATEACK 0xFFFF
+
+/**************************************************
+
+ End of Message Types Section
+
+****************************************************/
+
+/*****************************************************
+
+ DDE Codes for wStatus field
+
+*****************************************************/
+
+#define DDE_FACK 0x8000
+#define DDE_FBUSY 0x4000
+#define DDE_FDEFERUPD 0x4000
+#define DDE_FACKREQ 0x8000
+#define DDE_FRELEASE 0x2000
+#define DDE_FREQUESTED 0x1000
+#define DDE_FAPPSTATUS 0x00FF
+#define DDE_FNOTPROCESSED 0x0000
+
+#define DDE_FACKRESERVED (~(DDE_FACK | DDE_FBUSY | DDE_FAPPSTATUS))
+#define DDE_FADVRESERVED (~(DDE_FACKREQ | DDE_FDEFERUPD))
+#define DDE_FDATRESERVED (~(DDE_FACKREQ | DDE_FRELEASE | DDE_FREQUESTED))
+#define DDE_FPOKRESERVED (~(DDE_FRELEASE))
+
+/*****************************************************
+
+ End of wStatus codes
+
+*****************************************************/
+
+/****************************************************
+
+ Return Codes section again copied from SDK as must be same
+
+*****************************************************/
+
+#define DMLERR_NO_ERROR 0 /* must be 0 */
+
+#define DMLERR_FIRST 0x4000
+
+#define DMLERR_ADVACKTIMEOUT 0x4000
+#define DMLERR_BUSY 0x4001
+#define DMLERR_DATAACKTIMEOUT 0x4002
+#define DMLERR_DLL_NOT_INITIALIZED 0x4003
+#define DMLERR_DLL_USAGE 0x4004
+#define DMLERR_EXECACKTIMEOUT 0x4005
+#define DMLERR_INVALIDPARAMETER 0x4006
+#define DMLERR_LOW_MEMORY 0x4007
+#define DMLERR_MEMORY_ERROR 0x4008
+#define DMLERR_NOTPROCESSED 0x4009
+#define DMLERR_NO_CONV_ESTABLISHED 0x400a
+#define DMLERR_POKEACKTIMEOUT 0x400b
+#define DMLERR_POSTMSG_FAILED 0x400c
+#define DMLERR_REENTRANCY 0x400d
+#define DMLERR_SERVER_DIED 0x400e
+#define DMLERR_SYS_ERROR 0x400f
+#define DMLERR_UNADVACKTIMEOUT 0x4010
+#define DMLERR_UNFOUND_QUEUE_ID 0x4011
+
+#define DMLERR_LAST 0x4011
+
+#define HDATA_APPOWNED 0x0001
+
+/*****************************************************
+
+ End of Return Codes and Microsoft section
+
+******************************************************/
+
+
DECLARE_HANDLE(HCONVLIST);
DECLARE_HANDLE(HCONV);
DECLARE_HANDLE(HSZ);
DECLARE_HANDLE(HDDEDATA);
-typedef HDDEDATA CALLBACK FNCALLBACK(UINT,UINT,HCONV,HSZ,HSZ,HDDEDATA,DWORD,DWORD);
-typedef HDDEDATA(CALLBACK *PFNCALLBACK)(UINT,UINT,HCONV,HSZ,HSZ,HDDEDATA,DWORD,DWORD);
-typedef struct tagHSZPAIR {
- HSZ hszSvc;
- HSZ hszTopic;
+
+
+
+/*******************************************************
+
+ API Entry Points
+
+*******************************************************/
+
+typedef HDDEDATA (CALLBACK *PFNCALLBACK)(UINT, UINT, HCONV, HSZ, HSZ,
+ HDDEDATA, ULONG_PTR, ULONG_PTR);
+
+/***************************************************
+
+ Externally visible data structures
+
+***************************************************/
+
+typedef struct tagHSZPAIR
+{
+ HSZ hszSvc;
+ HSZ hszTopic;
} HSZPAIR, *PHSZPAIR;
-typedef struct tagCONVCONTEXT {
- UINT cb;
- UINT wFlags;
- UINT wCountryID;
- int iCodePage;
- DWORD dwLangID;
- DWORD dwSecurity;
- SECURITY_QUALITY_OF_SERVICE qos;
-} CONVCONTEXT,*PCONVCONTEXT;
-typedef struct tagCONVINFO {
- DWORD cb;
- DWORD hUser;
- HCONV hConvPartner;
- HSZ hszSvcPartner;
- HSZ hszServiceReq;
- HSZ hszTopic;
- HSZ hszItem;
- UINT wFmt;
- UINT wType;
- UINT wStatus;
- UINT wConvst;
- UINT wLastError;
- HCONVLIST hConvList;
- CONVCONTEXT ConvCtxt;
- HWND hwnd;
- HWND hwndPartner;
-} CONVINFO,*PCONVINFO;
-typedef struct tagDDEML_MSG_HOOK_DATA {
- UINT uiLo;
- UINT uiHi;
- DWORD cbData;
- DWORD Data[8];
-} DDEML_MSG_HOOK_DATA;
-typedef struct tagMONHSZSTRUCTA {
- UINT cb;
- BOOL fsAction;
- DWORD dwTime;
- HSZ hsz;
- HANDLE hTask;
- CHAR str[1];
-} MONHSZSTRUCTA, *PMONHSZSTRUCTA;
-typedef struct tagMONHSZSTRUCTW {
- UINT cb;
- BOOL fsAction;
- DWORD dwTime;
- HSZ hsz;
- HANDLE hTask;
- WCHAR str[1];
-} MONHSZSTRUCTW, *PMONHSZSTRUCTW;
-typedef struct tagMONLINKSTRUCT {
- UINT cb;
- DWORD dwTime;
- HANDLE hTask;
- BOOL fEstablished;
- BOOL fNoData;
- HSZ hszSvc;
- HSZ hszTopic;
- HSZ hszItem;
- UINT wFmt;
- BOOL fServer;
- HCONV hConvServer;
- HCONV hConvClient;
-} MONLINKSTRUCT, *PMONLINKSTRUCT;
-typedef struct tagMONCONVSTRUCT {
- UINT cb;
- BOOL fConnect;
- DWORD dwTime;
- HANDLE hTask;
- HSZ hszSvc;
- HSZ hszTopic;
- HCONV hConvClient;
- HCONV hConvServer;
-} MONCONVSTRUCT, *PMONCONVSTRUCT;
-typedef struct tagMONCBSTRUCT {
- UINT cb;
- DWORD dwTime;
- HANDLE hTask;
- DWORD dwRet;
- UINT wType;
- UINT wFmt;
- HCONV hConv;
- HSZ hsz1;
- HSZ hsz2;
- HDDEDATA hData;
- ULONG_PTR dwData1;
- ULONG_PTR dwData2;
- CONVCONTEXT cc;
- DWORD cbData;
- DWORD Data[8];
-} MONCBSTRUCT, *PMONCBSTRUCT;
-typedef struct tagMONERRSTRUCT {
- UINT cb;
- UINT wLastError;
- DWORD dwTime;
- HANDLE hTask;
-} MONERRSTRUCT, *PMONERRSTRUCT;
-typedef struct tagMONMSGSTRUCT {
- UINT cb;
- HWND hwndTo;
- DWORD dwTime;
- HANDLE hTask;
- UINT wMsg;
- WPARAM wParam;
- LPARAM lParam;
- DDEML_MSG_HOOK_DATA dmhd;
-} MONMSGSTRUCT, *PMONMSGSTRUCT;
-
-BOOL WINAPI DdeAbandonTransaction(DWORD,HCONV,DWORD);
-PBYTE WINAPI DdeAccessData(HDDEDATA,PDWORD);
-HDDEDATA WINAPI DdeAddData(HDDEDATA,PBYTE,DWORD,DWORD);
-HDDEDATA WINAPI DdeClientTransaction(PBYTE,DWORD,HCONV,HSZ,UINT,UINT,DWORD,PDWORD);
-int WINAPI DdeCmpStringHandles(HSZ,HSZ);
-HCONV WINAPI DdeConnect(DWORD,HSZ,HSZ,PCONVCONTEXT);
+
+typedef struct tagCONVCONTEXT
+{
+ UINT cb;
+ UINT wFlags;
+ UINT wCountryID;
+ INT iCodePage;
+ DWORD dwLangID;
+ DWORD dwSecurity;
+} CONVCONTEXT, *PCONVCONTEXT;
+
+typedef struct tagCONVINFO
+{
+ DWORD cb;
+ DWORD hUser;
+ HCONV hConvPartner;
+ HSZ hszSvcPartner;
+ HSZ hszServiceReq;
+ HSZ hszTopic;
+ HSZ hszItem;
+ UINT wFmt;
+ UINT wType;
+ UINT wStatus;
+ UINT wConvst;
+ UINT wLastError;
+ HCONVLIST hConvList;
+ CONVCONTEXT ConvCtxt;
+ HWND hwnd;
+ HWND hwndPartner;
+} CONVINFO, *PCONVINFO;
+
+/* Interface Definitions */
+
+
+UINT WINAPI DdeInitializeA(LPDWORD,PFNCALLBACK,DWORD,DWORD);
+UINT WINAPI DdeInitializeW(LPDWORD,PFNCALLBACK,DWORD,DWORD);
+#define DdeInitialize WINELIB_NAME_AW(DdeInitialize)
+BOOL WINAPI DdeUninitialize(DWORD);
HCONVLIST WINAPI DdeConnectList(DWORD,HSZ,HSZ,HCONVLIST,PCONVCONTEXT);
-HDDEDATA WINAPI DdeCreateDataHandle(DWORD,PBYTE,DWORD,DWORD,HSZ,UINT,UINT);
-HSZ WINAPI DdeCreateStringHandleA(DWORD,LPSTR,int);
-HSZ WINAPI DdeCreateStringHandleW(DWORD,LPWSTR,int);
-BOOL WINAPI DdeDisconnect(HCONV);
-BOOL WINAPI DdeDisconnectList(HCONVLIST);
-BOOL WINAPI DdeEnableCallback(DWORD,HCONV,UINT);
-BOOL WINAPI DdeFreeDataHandle(HDDEDATA);
-BOOL WINAPI DdeFreeStringHandle(DWORD,HSZ);
-DWORD WINAPI DdeGetData(HDDEDATA,PBYTE,DWORD,DWORD);
-UINT WINAPI DdeGetLastError(DWORD);
-BOOL WINAPI DdeImpersonateClient(HCONV);
-UINT WINAPI DdeInitializeA(PDWORD,PFNCALLBACK,DWORD,DWORD);
-UINT WINAPI DdeInitializeW(PDWORD,PFNCALLBACK,DWORD,DWORD);
-BOOL WINAPI DdeKeepStringHandle(DWORD,HSZ);
-HDDEDATA WINAPI DdeNameService(DWORD,HSZ,HSZ,UINT);
-BOOL WINAPI DdePostAdvise(DWORD,HSZ,HSZ);
-UINT WINAPI DdeQueryConvInfo(HCONV,DWORD,PCONVINFO);
-HCONV WINAPI DdeQueryNextServer(HCONVLIST,HCONV);
-DWORD WINAPI DdeQueryStringA(DWORD,HSZ,LPSTR,DWORD,int);
-DWORD WINAPI DdeQueryStringW(DWORD,HSZ,LPWSTR,DWORD,int);
-HCONV WINAPI DdeReconnect(HCONV);
-BOOL WINAPI DdeSetUserHandle(HCONV,DWORD,DWORD);
-BOOL WINAPI DdeUnaccessData(HDDEDATA);
-BOOL WINAPI DdeUninitialize(DWORD);
-
-#ifdef UNICODE
-#define SZDDESYS_TOPIC L"System"
-#define SZDDESYS_ITEM_TOPICS L"Topics"
-#define SZDDESYS_ITEM_SYSITEMS L"SysItems"
-#define SZDDESYS_ITEM_RTNMSG L"ReturnMessage"
-#define SZDDESYS_ITEM_STATUS L"Status"
-#define SZDDESYS_ITEM_FORMATS L"Formats"
-#define SZDDESYS_ITEM_HELP L"Help"
-#define SZDDE_ITEM_ITEMLIST L"TopicItemList"
-#define MONHSZSTRUCT MONHSZSTRUCTA
-#define PMONHSZSTRUCT PMONHSZSTRUCTA
-#define DdeCreateStringHandle DdeCreateStringHandleW
-#define DdeInitialize DdeInitializeW
-#define DdeQueryString DdeQueryStringW
-#else
-#define SZDDESYS_TOPIC "System"
-#define SZDDESYS_ITEM_TOPICS "Topics"
-#define SZDDESYS_ITEM_SYSITEMS "SysItems"
-#define SZDDESYS_ITEM_RTNMSG "ReturnMessage"
-#define SZDDESYS_ITEM_STATUS "Status"
-#define SZDDESYS_ITEM_FORMATS "Formats"
-#define SZDDESYS_ITEM_HELP "Help"
-#define SZDDE_ITEM_ITEMLIST "TopicItemList"
-#define MONHSZSTRUCT MONHSZSTRUCTW
-#define PMONHSZSTRUCT PMONHSZSTRUCTW
-#define DdeCreateStringHandle DdeCreateStringHandleA
-#define DdeInitialize DdeInitializeA
-#define DdeQueryString DdeQueryStringA
-#endif
+HCONV WINAPI DdeQueryNextServer(HCONVLIST, HCONV);
+DWORD WINAPI DdeQueryStringA(DWORD, HSZ, LPSTR, DWORD, INT);
+DWORD WINAPI DdeQueryStringW(DWORD, HSZ, LPWSTR, DWORD, INT);
+#define DdeQueryString WINELIB_NAME_AW(DdeQueryString)
+BOOL WINAPI DdeDisconnectList(HCONVLIST);
+HCONV WINAPI DdeConnect(DWORD,HSZ,HSZ,PCONVCONTEXT);
+BOOL WINAPI DdeDisconnect(HCONV);
+HDDEDATA WINAPI DdeCreateDataHandle(DWORD,LPBYTE,DWORD,DWORD,HSZ,UINT,UINT);
+HCONV WINAPI DdeReconnect(HCONV);
+HSZ WINAPI DdeCreateStringHandleA(DWORD,LPCSTR,INT);
+HSZ WINAPI DdeCreateStringHandleW(DWORD,LPCWSTR,INT);
+#define DdeCreateStringHandle WINELIB_NAME_AW(DdeCreateStringHandle)
+BOOL WINAPI DdeFreeStringHandle(DWORD,HSZ);
+BOOL WINAPI DdeFreeDataHandle(HDDEDATA);
+BOOL WINAPI DdeKeepStringHandle(DWORD,HSZ);
+HDDEDATA WINAPI DdeClientTransaction(LPBYTE,DWORD,HCONV,HSZ,UINT,UINT,DWORD,LPDWORD);
+BOOL WINAPI DdeAbandonTransaction(DWORD idInst, HCONV hConv, DWORD idTransaction);
+BOOL WINAPI DdeImpersonateClient(HCONV);
+BOOL WINAPI DdePostAdvise(DWORD,HSZ,HSZ);
+HDDEDATA WINAPI DdeAddData(HDDEDATA,LPBYTE,DWORD,DWORD);
+DWORD WINAPI DdeGetData(HDDEDATA,LPBYTE,DWORD,DWORD);
+LPBYTE WINAPI DdeAccessData(HDDEDATA,LPDWORD);
+BOOL WINAPI DdeUnaccessData(HDDEDATA);
+BOOL WINAPI DdeEnableCallback(DWORD,HCONV,UINT);
+INT WINAPI DdeCmpStringHandles(HSZ,HSZ);
+BOOL WINAPI DdeSetUserHandle(HCONV,DWORD,DWORD);
+
+HDDEDATA WINAPI DdeNameService(DWORD,HSZ,HSZ,UINT);
+UINT WINAPI DdeGetLastError(DWORD);
+UINT WINAPI DdeQueryConvInfo(HCONV,DWORD,PCONVINFO);
+
#ifdef __cplusplus
-}
-#endif
-#endif /* _DDEML_H */
+} /* extern "C" */
+#endif /* defined(__cplusplus) */
+
+#endif /* __WINE_DDEML_H */