ReactOS 0.4.17-dev-1321-g5c122a9
dde_private.h
Go to the documentation of this file.
1/*
2 * DDEML library
3 *
4 * Copyright 1997 Alexandre Julliard
5 * Copyright 1997 Len White
6 * Copyright 1999 Keith Matthews
7 * Copyright 2000 Corel
8 * Copyright 2001 Eric Pouech
9 *
10 * This library is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Lesser General Public
12 * License as published by the Free Software Foundation; either
13 * version 2.1 of the License, or (at your option) any later version.
14 *
15 * This library is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public
21 * License along with this library; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
23 */
24
25#ifndef __WINE_DDEML_PRIVATE_H
26#define __WINE_DDEML_PRIVATE_H
27
28#include "dde.h"
29#include "ddeml.h"
30
31/* defined in atom.c file.
32 */
33#define MAX_ATOM_LEN 255
34
35/* Maximum buffer size ( including the '\0' ).
36 */
37#define MAX_BUFFER_LEN (MAX_ATOM_LEN + 1)
38
39/* The internal structures (prefixed by WDML) are used as follows:
40 * + a WDML_INSTANCE is created for each instance creation (DdeInitialize)
41 * - a popup window (InstanceClass) is created for each instance.
42 * - this window is used to receive all the DDEML events (server registration,
43 * conversation confirmation...). See the WM_WDML_???? messages for details
44 * + when registering a server (DdeNameService) a WDML_SERVER is created
45 * - a popup window (ServerNameClass) is created
46 * + a conversation is represented by two WDML_CONV structures:
47 * - one on the client side, the other one on the server side
48 * - this is needed because the address spaces may be different
49 * - therefore, two lists of links are kept for each instance
50 * - two windows are created for a conversation:
51 * o a popup window on client side (ClientConvClass)
52 * o a child window (of the ServerName) on the server side
53 * (ServerConvClass)
54 * - all the exchanges then take place between those two windows
55 * - windows for the conversation exist in two forms (Ansi & Unicode). This
56 * is only needed when a partner in a conv is not handled by DDEML. The
57 * type (A/W) of the window is used to handle the ansi <=> unicode
58 * transformations
59 * - two handles are created for a conversation (on each side). Each handle
60 * is linked to a structure. To help differentiate those handles, the
61 * local one has an even value, whereas the remote one has an odd value.
62 * + a (warm or link) is represented by two WDML_LINK structures:
63 * - one on client side, the other one on server side
64 * - therefore, two lists of links are kept for each instance
65 *
66 * To help getting back to data, WDML windows store information:
67 * - offset 0: the DDE instance
68 * - offset 4: the current conversation (for ClientConv and ServerConv only)
69 *
70 * All the implementation (client & server) makes the assumption that the other side
71 * is not always a DDEML partner. However, if it's the case, supplementary services
72 * are available (most notably the REGISTER/UNREGISTER and CONNECT_CONFIRM messages
73 * to the callback function). To be correct in every situation, all the basic
74 * exchanges are made using the 'pure' DDE protocol. A (future !) enhancement would
75 * be to provide a new protocol in the case where both partners are handled by DDEML.
76 *
77 * The StringHandles are in fact stored as local atoms. So an HSZ and a (local) atom
78 * can be used interchangeably. However, in order to keep track of the allocated HSZ,
79 * and to free them upon instance termination, all HSZ are stored in a link list.
80 * When the HSZ need to be passed through DDE messages, we need to convert them back and
81 * forth to global atoms.
82 */
83
84/* this struct has the same mapping as all the DDE??? structures */
85typedef struct {
86 unsigned short unused:12,
91 short cfFormat;
93
94typedef struct tagHSZNode
95{
97 HSZ hsz;
98 unsigned refCount;
100
101typedef struct tagWDML_SERVER
102{
111
112typedef struct tagWDML_XACT {
113 struct tagWDML_XACT* next; /* list of transactions in conversation */
116 HDDEDATA hDdeData;
122 ATOM atom; /* as converted from or to hszItem */
124 LPARAM lParam; /* useful for reusing */
126
127typedef struct tagWDML_CONV
128{
129 struct tagWDML_CONV* next; /* to link all the conversations */
131 HSZ hszService; /* pmt used for connection */
132 HSZ hszTopic; /* pmt used for connection */
133 UINT magic; /* magic number to check validity */
134 UINT afCmd; /* service name flag */
136 HWND hwndClient; /* source of conversation (ClientConvClass) */
137 HWND hwndServer; /* destination of conversation (ServerConvClass) */
138 WDML_XACT* transactions; /* pending transactions */
139 DWORD hUser; /* user defined value */
140 DWORD wStatus; /* same bits as convinfo.wStatus */
141 DWORD wConvst; /* same values as convinfo.wConvst */
143
144#define WDML_CONV_MAGIC 0xbabe1234
145
146/* DDE_LINK struct defines hot, warm, and cold links */
147typedef struct tagWDML_LINK {
148 struct tagWDML_LINK* next; /* to link all the active links */
149 HCONV hConv; /* to get back to the conversation */
150 UINT transactionType;/* 0 for no link */
151 HSZ hszItem; /* item targeted for (hot/warm) link */
152 UINT uFmt; /* format for data */
154
155typedef struct tagWDML_INSTANCE
156{
158 DWORD instanceID; /* needed to track monitor usage */
159 DWORD threadID; /* needed to keep instance linked to a unique thread */
160 BOOL monitor; /* have these two as full Booleans cos they'll be tested frequently */
161 BOOL clientOnly; /* bit wasteful of space but it will be faster */
162 BOOL unicode; /* Flag to indicate Win32 API used to initialise */
163 HSZNode* nodeList; /* for cleaning upon exit */
169 DWORD wStatus; /* global instance status */
170 WDML_SERVER* servers; /* list of registered servers */
171 WDML_CONV* convs[2]; /* active conversations for this instance (client and server) */
172 WDML_LINK* links[2]; /* active links for this instance (client and server) */
174
175/* header for the DDE Data objects */
177{
181
182typedef enum tagWDML_SIDE
183{
186
187typedef enum {
190
191extern HDDEDATA WDML_InvokeCallback(WDML_INSTANCE* pInst, UINT uType, UINT uFmt, HCONV hConv,
192 HSZ hsz1, HSZ hsz2, HDDEDATA hdata,
193 ULONG_PTR dwData1, ULONG_PTR dwData2);
194extern WDML_SERVER* WDML_AddServer(WDML_INSTANCE* pInstance, HSZ hszService, HSZ hszTopic);
195extern void WDML_RemoveServer(WDML_INSTANCE* pInstance, HSZ hszService, HSZ hszTopic);
196extern WDML_SERVER* WDML_FindServer(WDML_INSTANCE* pInstance, HSZ hszService, HSZ hszTopic);
197/* transaction handler on the server side */
199/* transaction handler on the client side */
200HDDEDATA WDML_ClientHandle(WDML_CONV *pConv, WDML_XACT *pXAct, DWORD dwTimeout, LPDWORD pdwResult);
201/* called both in DdeClientTransaction and server side. */
203 HSZ hszService, HSZ hszTopic, HWND hwndClient, HWND hwndServer);
204extern void WDML_RemoveConv(WDML_CONV* pConv, WDML_SIDE side);
205extern WDML_CONV* WDML_GetConv(HCONV hConv, BOOL checkConnected);
208 HSZ hszService, HSZ hszTopic);
209extern BOOL WDML_PostAck(WDML_CONV* pConv, WDML_SIDE side, WORD appRetCode,
210 BOOL fBusy, BOOL fAck, UINT_PTR pmt, LPARAM lParam, UINT oldMsg);
211extern void WDML_AddLink(WDML_INSTANCE* pInstance, HCONV hConv, WDML_SIDE side,
212 UINT wType, HSZ hszItem, UINT wFmt);
213extern WDML_LINK* WDML_FindLink(WDML_INSTANCE* pInstance, HCONV hConv, WDML_SIDE side,
214 HSZ hszItem, BOOL use_fmt, UINT uFmt);
215extern void WDML_RemoveLink(WDML_INSTANCE* pInstance, HCONV hConv, WDML_SIDE side,
216 HSZ hszItem, UINT wFmt);
217/* string internals */
218extern BOOL WDML_DecHSZ(WDML_INSTANCE* pInstance, HSZ hsz);
219extern BOOL WDML_IncHSZ(WDML_INSTANCE* pInstance, HSZ hsz);
220extern ATOM WDML_MakeAtomFromHsz(HSZ hsz);
221extern HSZ WDML_MakeHszFromAtom(const WDML_INSTANCE* pInstance, ATOM atom);
222/* client calls these */
223extern WDML_XACT* WDML_AllocTransaction(WDML_INSTANCE* pInstance, UINT ddeMsg, UINT wFmt, HSZ hszItem);
224extern void WDML_QueueTransaction(WDML_CONV* pConv, WDML_XACT* pXAct);
225extern BOOL WDML_UnQueueTransaction(WDML_CONV* pConv, WDML_XACT* pXAct);
226extern void WDML_FreeTransaction(WDML_INSTANCE* pInstance, WDML_XACT* pXAct, BOOL doFreePmt);
227extern HGLOBAL WDML_DataHandle2Global(HDDEDATA hDdeData, BOOL fResponse, BOOL fRelease,
228 BOOL fDeferUpd, BOOL dAckReq);
229extern HDDEDATA WDML_Global2DataHandle(WDML_CONV* pConv, HGLOBAL hMem, WINE_DDEHEAD* da);
230extern BOOL WDML_IsAppOwned(HDDEDATA hDdeData);
231extern WDML_INSTANCE* WDML_GetInstance(DWORD InstId);
233/* broadcasting to DDE windows */
234extern void WDML_BroadcastDDEWindows(LPCWSTR clsName, UINT uMsg,
237extern void WDML_NotifyThreadDetach(void);
238
239
241{
242 *da = *((DDEACK*)&status);
243}
244
245extern const WCHAR WDML_szEventClass[]; /* class of window for events (aka instance) */
246extern const char WDML_szServerConvClassA[]; /* ANSI class of window for server side conv */
247extern const WCHAR WDML_szServerConvClassW[]; /* unicode class of window for server side conv */
248extern const char WDML_szClientConvClassA[]; /* ANSI class of window for client side conv */
249extern const WCHAR WDML_szClientConvClassW[]; /* unicode class of window for client side conv */
250
251#define WM_WDML_REGISTER (WM_USER + 0x200)
252#define WM_WDML_UNREGISTER (WM_USER + 0x201)
253#define WM_WDML_CONNECT_CONFIRM (WM_USER + 0x202)
254
255/* parameters for messages:
256 * wParam lParam
257 * Register atom for service name atom for service spec
258 * Unregister atom for service name atom for service spec
259 * ConnectConfirm client window handle server window handle
260 */
261
262#define GWL_WDML_INSTANCE (0)
263#define GWL_WDML_CONVERSATION (sizeof(ULONG_PTR))
264#define GWL_WDML_SERVER (sizeof(ULONG_PTR))
265
266#endif /* __WINE_DDEML_PRIVATE_H */
#define __inline
Definition: _wctype.cpp:15
HWND hWnd
Definition: settings.c:17
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
void WDML_QueueTransaction(WDML_CONV *pConv, WDML_XACT *pXAct)
Definition: ddemisc.c:1941
WDML_INSTANCE * WDML_GetInstanceFromWnd(HWND hWnd)
Definition: ddemisc.c:1265
void WDML_NotifyThreadExit(DWORD tid)
BOOL WDML_IsAppOwned(HDDEDATA hDdeData)
Definition: ddemisc.c:1482
WDML_QUEUE_STATE WDML_ServerHandle(WDML_CONV *pConv, WDML_XACT *pXAct)
Definition: ddeserver.c:978
const WCHAR WDML_szEventClass[]
Definition: ddemisc.c:41
WDML_CONV * WDML_AddConv(WDML_INSTANCE *pInstance, WDML_SIDE side, HSZ hszService, HSZ hszTopic, HWND hwndClient, HWND hwndServer)
Definition: ddemisc.c:2016
HGLOBAL WDML_DataHandle2Global(HDDEDATA hDdeData, BOOL fResponse, BOOL fRelease, BOOL fDeferUpd, BOOL dAckReq)
Definition: ddemisc.c:1568
enum tagWDML_SIDE WDML_SIDE
const WCHAR WDML_szClientConvClassW[]
Definition: ddeclient.c:36
static __inline void WDML_ExtractAck(WORD status, DDEACK *da)
Definition: dde_private.h:240
WDML_CONV * WDML_GetConv(HCONV hConv, BOOL checkConnected)
Definition: ddemisc.c:2239
BOOL WDML_PostAck(WDML_CONV *pConv, WDML_SIDE side, WORD appRetCode, BOOL fBusy, BOOL fAck, UINT_PTR pmt, LPARAM lParam, UINT oldMsg)
Definition: ddemisc.c:2284
struct tagWDML_CONV WDML_CONV
HSZ WDML_MakeHszFromAtom(const WDML_INSTANCE *pInstance, ATOM atom)
Definition: ddemisc.c:346
void WDML_FreeTransaction(WDML_INSTANCE *pInstance, WDML_XACT *pXAct, BOOL doFreePmt)
Definition: ddemisc.c:1975
struct tagDDE_DATAHANDLE_HEAD DDE_DATAHANDLE_HEAD
BOOL WDML_IncHSZ(WDML_INSTANCE *pInstance, HSZ hsz)
Definition: ddemisc.c:366
void WDML_RemoveLink(WDML_INSTANCE *pInstance, HCONV hConv, WDML_SIDE side, HSZ hszItem, UINT wFmt)
Definition: ddemisc.c:1788
WDML_SERVER * WDML_AddServer(WDML_INSTANCE *pInstance, HSZ hszService, HSZ hszTopic)
Definition: ddemisc.c:1643
BOOL WDML_DecHSZ(WDML_INSTANCE *pInstance, HSZ hsz)
Definition: ddemisc.c:384
void WDML_RemoveConv(WDML_CONV *pConv, WDML_SIDE side)
Definition: ddemisc.c:2078
struct tagWDML_LINK WDML_LINK
HDDEDATA WDML_InvokeCallback(WDML_INSTANCE *pInst, UINT uType, UINT uFmt, HCONV hConv, HSZ hsz1, HSZ hsz2, HDDEDATA hdata, ULONG_PTR dwData1, ULONG_PTR dwData2)
Definition: ddemisc.c:1210
WDML_XACT * WDML_AllocTransaction(WDML_INSTANCE *pInstance, UINT ddeMsg, UINT wFmt, HSZ hszItem)
Definition: ddemisc.c:1908
void WDML_RemoveServer(WDML_INSTANCE *pInstance, HSZ hszService, HSZ hszTopic)
Definition: ddemisc.c:1678
ATOM WDML_MakeAtomFromHsz(HSZ hsz)
Definition: ddemisc.c:329
HDDEDATA WDML_ClientHandle(WDML_CONV *pConv, WDML_XACT *pXAct, DWORD dwTimeout, LPDWORD pdwResult)
Definition: ddeclient.c:1095
void WDML_NotifyThreadDetach(void)
Definition: ddemisc.c:1185
struct tagWDML_SERVER WDML_SERVER
const char WDML_szClientConvClassA[]
Definition: ddeclient.c:35
struct tagWDML_XACT WDML_XACT
WDML_LINK * WDML_FindLink(WDML_INSTANCE *pInstance, HCONV hConv, WDML_SIDE side, HSZ hszItem, BOOL use_fmt, UINT uFmt)
Definition: ddemisc.c:1876
struct tagWDML_INSTANCE WDML_INSTANCE
WDML_CONV * WDML_FindConv(WDML_INSTANCE *pInstance, WDML_SIDE side, HSZ hszService, HSZ hszTopic)
Definition: ddemisc.c:2056
const char WDML_szServerConvClassA[]
Definition: ddeserver.c:35
BOOL WDML_UnQueueTransaction(WDML_CONV *pConv, WDML_XACT *pXAct)
Definition: ddemisc.c:1955
tagWDML_SIDE
Definition: dde_private.h:183
@ WDML_SERVER_SIDE
Definition: dde_private.h:184
@ WDML_CLIENT_SIDE
Definition: dde_private.h:184
WDML_INSTANCE * WDML_GetInstance(DWORD InstId)
Definition: ddemisc.c:1234
HDDEDATA WDML_Global2DataHandle(WDML_CONV *pConv, HGLOBAL hMem, WINE_DDEHEAD *da)
Definition: ddemisc.c:1509
WDML_QUEUE_STATE
Definition: dde_private.h:187
@ WDML_QS_PASS
Definition: dde_private.h:188
@ WDML_QS_BLOCK
Definition: dde_private.h:188
@ WDML_QS_HANDLED
Definition: dde_private.h:188
@ WDML_QS_SWALLOWED
Definition: dde_private.h:188
@ WDML_QS_ERROR
Definition: dde_private.h:188
WDML_SERVER * WDML_FindServer(WDML_INSTANCE *pInstance, HSZ hszService, HSZ hszTopic)
Definition: ddemisc.c:1737
WDML_CONV * WDML_GetConvFromWnd(HWND hWnd)
Definition: ddemisc.c:2274
void WDML_AddLink(WDML_INSTANCE *pInstance, HCONV hConv, WDML_SIDE side, UINT wType, HSZ hszItem, UINT wFmt)
Definition: ddemisc.c:1763
struct tagHSZNode HSZNode
void WDML_BroadcastDDEWindows(LPCWSTR clsName, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: ddemisc.c:2511
const WCHAR WDML_szServerConvClassW[]
Definition: ddeserver.c:36
HDDEDATA(CALLBACK * PFNCALLBACK)(UINT, UINT, HCONV, HSZ, HSZ, HDDEDATA, ULONG_PTR, ULONG_PTR)
Definition: ddeml.h:290
WORD ATOM
Definition: dimm.idl:113
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
FxWmiInstanceExternal * pInstance
Definition: fxwmiapi.cpp:117
unsigned int UINT
Definition: sysinfo.c:13
static TfClientId tid
LONG_PTR LPARAM
Definition: minwindef.h:175
UINT_PTR WPARAM
Definition: minwindef.h:174
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
short WCHAR
Definition: pedump.c:58
_In_ UINT _In_ DWORD _Out_ DWORD * pdwResult
Definition: ntgdi.h:270
static HSZ hszTopic
Definition: shlexec.c:148
Definition: dde.h:51
unsigned short unused
Definition: dde_private.h:86
unsigned short fRelease
Definition: dde_private.h:88
unsigned short fResponse
Definition: dde_private.h:87
unsigned short fAckReq
Definition: dde_private.h:90
unsigned short fDeferUpd
Definition: dde_private.h:89
short cfFormat
Definition: dde_private.h:91
Definition: ps.c:97
struct tagHSZNode * next
Definition: dde_private.h:96
unsigned refCount
Definition: dde_private.h:98
struct tagWDML_CONV * next
Definition: dde_private.h:129
CONVCONTEXT convContext
Definition: dde_private.h:135
WDML_XACT * transactions
Definition: dde_private.h:138
struct tagWDML_INSTANCE * instance
Definition: dde_private.h:130
HSZNode * nodeList
Definition: dde_private.h:163
struct tagWDML_INSTANCE * next
Definition: dde_private.h:157
WDML_LINK * links[2]
Definition: dde_private.h:172
WDML_CONV * convs[2]
Definition: dde_private.h:171
PFNCALLBACK callback
Definition: dde_private.h:164
WDML_SERVER * servers
Definition: dde_private.h:170
struct tagWDML_SERVER * next
Definition: dde_private.h:103
ATOM atomServiceSpec
Definition: dde_private.h:107
HDDEDATA hDdeData
Definition: dde_private.h:116
struct tagWDML_XACT * next
Definition: dde_private.h:113
DWORD dwTimeout
Definition: dde_private.h:117
LPARAM lParam
Definition: dde_private.h:124
HGLOBAL hMem
Definition: dde_private.h:123
const uint16_t * LPCWSTR
Definition: typedefs.h:57
uint32_t * LPDWORD
Definition: typedefs.h:59
uint32_t ULONG_PTR
Definition: typedefs.h:65