1 /**
2  * This file has no copyright assigned and is placed in the Public Domain.
3  * This file is part of the mingw-w64 runtime package.
4  * No warranty is given; refer to the file DISCLAIMER.PD within this package.
5  */
6 #ifndef _INC_DDEMLH
7 #define _INC_DDEMLH
8 
9 #include <_mingw_unicode.h>
10 
11 #ifdef __cplusplus
12 extern "C" {
13 #endif
14 
15   DECLARE_HANDLE(HCONVLIST);
16   DECLARE_HANDLE(HCONV);
17   DECLARE_HANDLE(HSZ);
18   DECLARE_HANDLE(HDDEDATA);
19 #define EXPENTRY CALLBACK
20 
21   typedef struct tagHSZPAIR {
22     HSZ hszSvc;
23     HSZ hszTopic;
24   } HSZPAIR, *PHSZPAIR;
25 
26   typedef struct tagCONVCONTEXT {
27     UINT cb;
28     UINT wFlags;
29     UINT wCountryID;
30     int iCodePage;
31     DWORD dwLangID;
32     DWORD dwSecurity;
33     SECURITY_QUALITY_OF_SERVICE qos;
34   } CONVCONTEXT, *PCONVCONTEXT;
35 
36   typedef struct tagCONVINFO {
37     DWORD cb;
38     DWORD_PTR hUser;
39     HCONV hConvPartner;
40     HSZ hszSvcPartner;
41     HSZ hszServiceReq;
42     HSZ hszTopic;
43     HSZ hszItem;
44     UINT wFmt;
45     UINT wType;
46     UINT wStatus;
47     UINT wConvst;
48     UINT wLastError;
49     HCONVLIST hConvList;
50     CONVCONTEXT ConvCtxt;
51     HWND hwnd;
52     HWND hwndPartner;
53   } CONVINFO, *PCONVINFO;
54 
55 #define XST_NULL 0
56 #define XST_INCOMPLETE 1
57 #define XST_CONNECTED 2
58 #define XST_INIT1 3
59 #define XST_INIT2 4
60 #define XST_REQSENT 5
61 #define XST_DATARCVD 6
62 #define XST_POKESENT 7
63 #define XST_POKEACKRCVD 8
64 #define XST_EXECSENT 9
65 #define XST_EXECACKRCVD 10
66 #define XST_ADVSENT 11
67 #define XST_UNADVSENT 12
68 #define XST_ADVACKRCVD 13
69 #define XST_UNADVACKRCVD 14
70 #define XST_ADVDATASENT 15
71 #define XST_ADVDATAACKRCVD 16
72 
73 #define CADV_LATEACK 0xFFFF
74 
75 #define ST_CONNECTED 0x0001
76 #define ST_ADVISE 0x0002
77 #define ST_ISLOCAL 0x0004
78 #define ST_BLOCKED 0x0008
79 #define ST_CLIENT 0x0010
80 #define ST_TERMINATED 0x0020
81 #define ST_INLIST 0x0040
82 #define ST_BLOCKNEXT 0x0080
83 #define ST_ISSELF 0x0100
84 
85 #define DDE_FACK 0x8000
86 #define DDE_FBUSY 0x4000
87 #define DDE_FDEFERUPD 0x4000
88 #define DDE_FACKREQ 0x8000
89 #define DDE_FRELEASE 0x2000
90 #define DDE_FREQUESTED 0x1000
91 #define DDE_FAPPSTATUS 0x00ff
92 #define DDE_FNOTPROCESSED 0x0000
93 
94 #define DDE_FACKRESERVED (~(DDE_FACK | DDE_FBUSY | DDE_FAPPSTATUS))
95 #define DDE_FADVRESERVED (~(DDE_FACKREQ | DDE_FDEFERUPD))
96 #define DDE_FDATRESERVED (~(DDE_FACKREQ | DDE_FRELEASE | DDE_FREQUESTED))
97 #define DDE_FPOKRESERVED (~(DDE_FRELEASE))
98 
99 #define MSGF_DDEMGR 0x8001
100 
101 #define CP_WINANSI 1004
102 #define CP_WINUNICODE 1200
103 
104 #define XTYPF_NOBLOCK 0x0002
105 #define XTYPF_NODATA 0x0004
106 #define XTYPF_ACKREQ 0x0008
107 
108 #define XCLASS_MASK 0xFC00
109 #define XCLASS_BOOL 0x1000
110 #define XCLASS_DATA 0x2000
111 #define XCLASS_FLAGS 0x4000
112 #define XCLASS_NOTIFICATION 0x8000
113 
114 #define XTYP_ERROR (0x0000 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK)
115 #define XTYP_ADVDATA (0x0010 | XCLASS_FLAGS)
116 #define XTYP_ADVREQ (0x0020 | XCLASS_DATA | XTYPF_NOBLOCK)
117 #define XTYP_ADVSTART (0x0030 | XCLASS_BOOL)
118 #define XTYP_ADVSTOP (0x0040 | XCLASS_NOTIFICATION)
119 #define XTYP_EXECUTE (0x0050 | XCLASS_FLAGS)
120 #define XTYP_CONNECT (0x0060 | XCLASS_BOOL | XTYPF_NOBLOCK)
121 #define XTYP_CONNECT_CONFIRM (0x0070 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK)
122 #define XTYP_XACT_COMPLETE (0x0080 | XCLASS_NOTIFICATION)
123 #define XTYP_POKE (0x0090 | XCLASS_FLAGS)
124 #define XTYP_REGISTER (0x00A0 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK)
125 #define XTYP_REQUEST (0x00B0 | XCLASS_DATA)
126 #define XTYP_DISCONNECT (0x00C0 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK)
127 #define XTYP_UNREGISTER (0x00D0 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK)
128 #define XTYP_WILDCONNECT (0x00E0 | XCLASS_DATA | XTYPF_NOBLOCK)
129 
130 #define XTYP_MASK 0x00F0
131 #define XTYP_SHIFT 4
132 
133 #define TIMEOUT_ASYNC 0xFFFFFFFF
134 
135 #define QID_SYNC 0xFFFFFFFF
136 
137 #if defined(UNICODE)
138 #define CP_WINNEUTRAL CP_WINUNICODE
139 #else
140 #define CP_WINNEUTRAL CP_WINANSI
141 #endif
142 
143 #define SZDDESYS_TOPIC __MINGW_STRING_AW("System")
144 #define SZDDESYS_ITEM_TOPICS __MINGW_STRING_AW("Topics")
145 #define SZDDESYS_ITEM_SYSITEMS __MINGW_STRING_AW("SysItems")
146 #define SZDDESYS_ITEM_RTNMSG __MINGW_STRING_AW("ReturnMessage")
147 #define SZDDESYS_ITEM_STATUS __MINGW_STRING_AW("Status")
148 #define SZDDESYS_ITEM_FORMATS __MINGW_STRING_AW("Formats")
149 #define SZDDESYS_ITEM_HELP __MINGW_STRING_AW("Help")
150 #define SZDDE_ITEM_ITEMLIST __MINGW_STRING_AW("TopicItemList")
151 
152 #define DdeInitialize __MINGW_NAME_AW(DdeInitialize)
153 
154   typedef HDDEDATA CALLBACK FNCALLBACK(UINT wType,UINT wFmt,HCONV hConv,HSZ hsz1,HSZ hsz2,HDDEDATA hData,ULONG_PTR dwData1,ULONG_PTR dwData2);
155   typedef HDDEDATA (CALLBACK *PFNCALLBACK)(UINT wType,UINT wFmt,HCONV hConv,HSZ hsz1,HSZ hsz2,HDDEDATA hData,ULONG_PTR dwData1,ULONG_PTR dwData2);
156 
157 #define CBR_BLOCK ((HDDEDATA)-1)
158 
159   UINT WINAPI DdeInitializeA(LPDWORD pidInst,PFNCALLBACK pfnCallback,DWORD afCmd,DWORD ulRes);
160   UINT WINAPI DdeInitializeW(LPDWORD pidInst,PFNCALLBACK pfnCallback,DWORD afCmd,DWORD ulRes);
161 
162 #define CBF_FAIL_SELFCONNECTIONS 0x00001000
163 #define CBF_FAIL_CONNECTIONS 0x00002000
164 #define CBF_FAIL_ADVISES 0x00004000
165 #define CBF_FAIL_EXECUTES 0x00008000
166 #define CBF_FAIL_POKES 0x00010000
167 #define CBF_FAIL_REQUESTS 0x00020000
168 #define CBF_FAIL_ALLSVRXACTIONS 0x0003f000
169 
170 #define CBF_SKIP_CONNECT_CONFIRMS 0x00040000
171 #define CBF_SKIP_REGISTRATIONS 0x00080000
172 #define CBF_SKIP_UNREGISTRATIONS 0x00100000
173 #define CBF_SKIP_DISCONNECTS 0x00200000
174 #define CBF_SKIP_ALLNOTIFICATIONS 0x003c0000
175 
176 #define APPCMD_CLIENTONLY __MSABI_LONG(0x00000010)
177 #define APPCMD_FILTERINITS __MSABI_LONG(0x00000020)
178 #define APPCMD_MASK __MSABI_LONG(0x00000FF0)
179 
180 #define APPCLASS_STANDARD __MSABI_LONG(0x00000000)
181 #define APPCLASS_MASK __MSABI_LONG(0x0000000F)
182 
183   WINBOOL WINAPI DdeUninitialize(DWORD idInst);
184   HCONVLIST WINAPI DdeConnectList(DWORD idInst,HSZ hszService,HSZ hszTopic,HCONVLIST hConvList,PCONVCONTEXT pCC);
185   HCONV WINAPI DdeQueryNextServer(HCONVLIST hConvList,HCONV hConvPrev);
186   WINBOOL WINAPI DdeDisconnectList(HCONVLIST hConvList);
187   HCONV WINAPI DdeConnect(DWORD idInst,HSZ hszService,HSZ hszTopic,PCONVCONTEXT pCC);
188   WINBOOL WINAPI DdeDisconnect(HCONV hConv);
189   HCONV WINAPI DdeReconnect(HCONV hConv);
190   UINT WINAPI DdeQueryConvInfo(HCONV hConv,DWORD idTransaction,PCONVINFO pConvInfo);
191   WINBOOL WINAPI DdeSetUserHandle(HCONV hConv,DWORD id,DWORD_PTR hUser);
192   WINBOOL WINAPI DdeAbandonTransaction(DWORD idInst,HCONV hConv,DWORD idTransaction);
193   WINBOOL WINAPI DdePostAdvise(DWORD idInst,HSZ hszTopic,HSZ hszItem);
194   WINBOOL WINAPI DdeEnableCallback(DWORD idInst,HCONV hConv,UINT wCmd);
195   WINBOOL WINAPI DdeImpersonateClient(HCONV hConv);
196 
197 #define EC_ENABLEALL 0
198 #define EC_ENABLEONE ST_BLOCKNEXT
199 #define EC_DISABLE ST_BLOCKED
200 #define EC_QUERYWAITING 2
201 
202 #define DNS_REGISTER 0x0001
203 #define DNS_UNREGISTER 0x0002
204 #define DNS_FILTERON 0x0004
205 #define DNS_FILTEROFF 0x0008
206 
207   HDDEDATA WINAPI DdeNameService(DWORD idInst,HSZ hsz1,HSZ hsz2,UINT afCmd);
208   HDDEDATA WINAPI DdeClientTransaction(LPBYTE pData,DWORD cbData,HCONV hConv,HSZ hszItem,UINT wFmt,UINT wType,DWORD dwTimeout,LPDWORD pdwResult);
209   HDDEDATA WINAPI DdeCreateDataHandle(DWORD idInst,LPBYTE pSrc,DWORD cb,DWORD cbOff,HSZ hszItem,UINT wFmt,UINT afCmd);
210   HDDEDATA WINAPI DdeAddData(HDDEDATA hData,LPBYTE pSrc,DWORD cb,DWORD cbOff);
211   DWORD WINAPI DdeGetData(HDDEDATA hData,LPBYTE pDst,DWORD cbMax,DWORD cbOff);
212   LPBYTE WINAPI DdeAccessData(HDDEDATA hData,LPDWORD pcbDataSize);
213   WINBOOL WINAPI DdeUnaccessData(HDDEDATA hData);
214   WINBOOL WINAPI DdeFreeDataHandle(HDDEDATA hData);
215 
216 #define HDATA_APPOWNED 0x0001
217 
218   UINT WINAPI DdeGetLastError(DWORD idInst);
219 
220 #define DMLERR_NO_ERROR 0
221 #define DMLERR_FIRST 0x4000
222 
223 #define DMLERR_ADVACKTIMEOUT 0x4000
224 #define DMLERR_BUSY 0x4001
225 #define DMLERR_DATAACKTIMEOUT 0x4002
226 #define DMLERR_DLL_NOT_INITIALIZED 0x4003
227 #define DMLERR_DLL_USAGE 0x4004
228 #define DMLERR_EXECACKTIMEOUT 0x4005
229 #define DMLERR_INVALIDPARAMETER 0x4006
230 #define DMLERR_LOW_MEMORY 0x4007
231 #define DMLERR_MEMORY_ERROR 0x4008
232 #define DMLERR_NOTPROCESSED 0x4009
233 #define DMLERR_NO_CONV_ESTABLISHED 0x400a
234 #define DMLERR_POKEACKTIMEOUT 0x400b
235 #define DMLERR_POSTMSG_FAILED 0x400c
236 #define DMLERR_REENTRANCY 0x400d
237 #define DMLERR_SERVER_DIED 0x400e
238 #define DMLERR_SYS_ERROR 0x400f
239 #define DMLERR_UNADVACKTIMEOUT 0x4010
240 #define DMLERR_UNFOUND_QUEUE_ID 0x4011
241 
242 #define DMLERR_LAST 0x4011
243 
244   HSZ WINAPI DdeCreateStringHandleA(DWORD idInst,LPCSTR psz,int iCodePage);
245   HSZ WINAPI DdeCreateStringHandleW(DWORD idInst,LPCWSTR psz,int iCodePage);
246   DWORD WINAPI DdeQueryStringA(DWORD idInst,HSZ hsz,LPSTR psz,DWORD cchMax,int iCodePage);
247   DWORD WINAPI DdeQueryStringW(DWORD idInst,HSZ hsz,LPWSTR psz,DWORD cchMax,int iCodePage);
248   WINBOOL WINAPI DdeFreeStringHandle(DWORD idInst,HSZ hsz);
249   WINBOOL WINAPI DdeKeepStringHandle(DWORD idInst,HSZ hsz);
250   int WINAPI DdeCmpStringHandles(HSZ hsz1,HSZ hsz2);
251 
252 #define DdeCreateStringHandle __MINGW_NAME_AW(DdeCreateStringHandle)
253 #define DdeQueryString __MINGW_NAME_AW(DdeQueryString)
254 
255 #ifndef NODDEMLSPY
256   typedef struct tagDDEML_MSG_HOOK_DATA {
257     UINT_PTR uiLo;
258     UINT_PTR uiHi;
259     DWORD cbData;
260     DWORD Data[8];
261   } DDEML_MSG_HOOK_DATA,*PDDEML_MSG_HOOK_DATA;
262 
263   typedef struct tagMONMSGSTRUCT {
264     UINT cb;
265     HWND hwndTo;
266     DWORD dwTime;
267     HANDLE hTask;
268     UINT wMsg;
269     WPARAM wParam;
270     LPARAM lParam;
271     DDEML_MSG_HOOK_DATA dmhd;
272   } MONMSGSTRUCT,*PMONMSGSTRUCT;
273 
274   typedef struct tagMONCBSTRUCT {
275     UINT cb;
276     DWORD dwTime;
277     HANDLE hTask;
278     DWORD dwRet;
279     UINT wType;
280     UINT wFmt;
281     HCONV hConv;
282     HSZ hsz1;
283     HSZ hsz2;
284     HDDEDATA hData;
285     ULONG_PTR dwData1;
286     ULONG_PTR dwData2;
287     CONVCONTEXT cc;
288     DWORD cbData;
289     DWORD Data[8];
290   } MONCBSTRUCT,*PMONCBSTRUCT;
291 
292   typedef struct tagMONHSZSTRUCTA {
293     UINT cb;
294     WINBOOL fsAction;
295     DWORD dwTime;
296     HSZ hsz;
297     HANDLE hTask;
298     CHAR str[1];
299   } MONHSZSTRUCTA,*PMONHSZSTRUCTA;
300 
301   typedef struct tagMONHSZSTRUCTW {
302     UINT cb;
303     WINBOOL fsAction;
304     DWORD dwTime;
305     HSZ hsz;
306     HANDLE hTask;
307     WCHAR str[1];
308   } MONHSZSTRUCTW,*PMONHSZSTRUCTW;
309 
310   __MINGW_TYPEDEF_AW(MONHSZSTRUCT)
311   __MINGW_TYPEDEF_AW(PMONHSZSTRUCT)
312 
313 #define MH_CREATE 1
314 #define MH_KEEP 2
315 #define MH_DELETE 3
316 #define MH_CLEANUP 4
317 
318   typedef struct tagMONERRSTRUCT {
319     UINT cb;
320     UINT wLastError;
321     DWORD dwTime;
322     HANDLE hTask;
323   } MONERRSTRUCT,*PMONERRSTRUCT;
324 
325   typedef struct tagMONLINKSTRUCT {
326     UINT cb;
327     DWORD dwTime;
328     HANDLE hTask;
329     WINBOOL fEstablished;
330     WINBOOL fNoData;
331     HSZ hszSvc;
332     HSZ hszTopic;
333     HSZ hszItem;
334     UINT wFmt;
335     WINBOOL fServer;
336     HCONV hConvServer;
337     HCONV hConvClient;
338   } MONLINKSTRUCT,*PMONLINKSTRUCT;
339 
340   typedef struct tagMONCONVSTRUCT {
341     UINT cb;
342     WINBOOL fConnect;
343     DWORD dwTime;
344     HANDLE hTask;
345     HSZ hszSvc;
346     HSZ hszTopic;
347     HCONV hConvClient;
348     HCONV hConvServer;
349   } MONCONVSTRUCT,*PMONCONVSTRUCT;
350 
351 #define MAX_MONITORS 4
352 #define APPCLASS_MONITOR __MSABI_LONG(0x00000001)
353 #define XTYP_MONITOR (0x00F0 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK)
354 
355 #define MF_HSZ_INFO 0x01000000
356 #define MF_SENDMSGS 0x02000000
357 #define MF_POSTMSGS 0x04000000
358 #define MF_CALLBACKS 0x08000000
359 #define MF_ERRORS 0x10000000
360 #define MF_LINKS 0x20000000
361 #define MF_CONV 0x40000000
362 
363 #define MF_MASK 0xFF000000
364 #endif
365 
366 #ifdef __cplusplus
367 }
368 #endif
369 #endif
370