1 /**
2  * @file ddeml.h
3  * Copyright 2012, 2013 MinGW.org project
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a
6  * copy of this software and associated documentation files (the "Software"),
7  * to deal in the Software without restriction, including without limitation
8  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9  * and/or sell copies of the Software, and to permit persons to whom the
10  * Software is furnished to do so, subject to the following conditions:
11  *
12  * The above copyright notice and this permission notice (including the next
13  * paragraph) shall be included in all copies or substantial portions of the
14  * Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22  * DEALINGS IN THE SOFTWARE.
23  */
24 #ifndef _DDEML_H
25 #define _DDEML_H
26 #pragma GCC system_header
27 #include <_mingw.h>
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
33 #define EXPENTRY	CALLBACK
34 #define CP_WINANSI	1004
35 #define CP_WINUNICODE	1200
36 #define XTYPF_NOBLOCK	2
37 #define XTYPF_NODATA	4
38 #define XTYPF_ACKREQ	8
39 #define XCLASS_MASK	0xFC00
40 #define XCLASS_BOOL	0x1000
41 #define XCLASS_DATA	0x2000
42 #define XCLASS_FLAGS	0x4000
43 #define XCLASS_NOTIFICATION	0x8000
44 #define XST_NULL	0
45 #define XST_INCOMPLETE	1
46 #define XST_CONNECTED	2
47 #define XST_INIT1	3
48 #define XST_INIT2	4
49 #define XST_REQSENT	5
50 #define XST_DATARCVD	6
51 #define XST_POKESENT	7
52 #define XST_POKEACKRCVD	8
53 #define XST_EXECSENT	9
54 #define XST_EXECACKRCVD	10
55 #define XST_ADVSENT 11
56 #define XST_UNADVSENT 12
57 #define XST_ADVACKRCVD 13
58 #define XST_UNADVACKRCVD 14
59 #define XST_ADVDATASENT 15
60 #define XST_ADVDATAACKRCVD 16
61 #define XTYP_ERROR	(XCLASS_NOTIFICATION|XTYPF_NOBLOCK)
62 #define XTYP_ADVDATA	(16|XCLASS_FLAGS)
63 #define XTYP_ADVREQ	(32|XCLASS_DATA|XTYPF_NOBLOCK)
64 #define XTYP_ADVSTART	(0x30|XCLASS_BOOL)
65 #define XTYP_ADVSTOP	(0x0040|XCLASS_NOTIFICATION)
66 #define XTYP_EXECUTE	(0x0050|XCLASS_FLAGS)
67 #define XTYP_CONNECT	(0x0060|XCLASS_BOOL|XTYPF_NOBLOCK)
68 #define XTYP_CONNECT_CONFIRM	(0x0070|XCLASS_NOTIFICATION|XTYPF_NOBLOCK)
69 #define XTYP_XACT_COMPLETE	(0x0080|XCLASS_NOTIFICATION)
70 #define XTYP_POKE	(0x0090|XCLASS_FLAGS)
71 #define XTYP_REGISTER	(0x00A0|XCLASS_NOTIFICATION|XTYPF_NOBLOCK)
72 #define XTYP_REQUEST	(0x00B0|XCLASS_DATA)
73 #define XTYP_DISCONNECT	(0x00C0|XCLASS_NOTIFICATION|XTYPF_NOBLOCK)
74 #define XTYP_UNREGISTER	(0x00D0|XCLASS_NOTIFICATION|XTYPF_NOBLOCK)
75 #define XTYP_WILDCONNECT	(0x00E0|XCLASS_DATA|XTYPF_NOBLOCK)
76 #define XTYP_MASK	0xF0
77 #define XTYP_SHIFT	4
78 #define TIMEOUT_ASYNC	0xFFFFFFFF
79 #define QID_SYNC	0xFFFFFFFF
80 #define ST_CONNECTED	1
81 #define ST_ADVISE	2
82 #define ST_ISLOCAL	4
83 #define ST_BLOCKED	8
84 #define ST_CLIENT	16
85 #define ST_TERMINATED	32
86 #define ST_INLIST	64
87 #define ST_BLOCKNEXT	128
88 #define ST_ISSELF	256
89 #define CADV_LATEACK 0xFFFF
90 #define DMLERR_NO_ERROR	0
91 #define DMLERR_FIRST	0x4000
92 #define DMLERR_ADVACKTIMEOUT	0x4000
93 #define DMLERR_BUSY	0x4001
94 #define DMLERR_DATAACKTIMEOUT	0x4002
95 #define DMLERR_DLL_NOT_INITIALIZED	0x4003
96 #define	DMLERR_DLL_USAGE	0x4004
97 #define DMLERR_EXECACKTIMEOUT	0x4005
98 #define DMLERR_INVALIDPARAMETER	0x4006
99 #define DMLERR_LOW_MEMORY	0x4007
100 #define DMLERR_MEMORY_ERROR	0x4008
101 #define DMLERR_NOTPROCESSED	0x4009
102 #define DMLERR_NO_CONV_ESTABLISHED	0x400a
103 #define DMLERR_POKEACKTIMEOUT	0x400b
104 #define DMLERR_POSTMSG_FAILED	0x400c
105 #define DMLERR_REENTRANCY	0x400d
106 #define DMLERR_SERVER_DIED	0x400e
107 #define DMLERR_SYS_ERROR	0x400f
108 #define DMLERR_UNADVACKTIMEOUT	0x4010
109 #define DMLERR_UNFOUND_QUEUE_ID	0x4011
110 #define DMLERR_LAST	0x4011
111 #define DDE_FACK	0x8000
112 #define DDE_FBUSY	0x4000
113 #define DDE_FDEFERUPD	0x4000
114 #define DDE_FACKREQ	0x8000
115 #define DDE_FRELEASE	0x2000
116 #define DDE_FREQUESTED	0x1000
117 #define DDE_FAPPSTATUS	0x00ff
118 #define DDE_FNOTPROCESSED	0
119 #define DDE_FACKRESERVED	(~(DDE_FACK|DDE_FBUSY|DDE_FAPPSTATUS))
120 #define DDE_FADVRESERVED	(~(DDE_FACKREQ|DDE_FDEFERUPD))
121 #define DDE_FDATRESERVED	(~(DDE_FACKREQ|DDE_FRELEASE|DDE_FREQUESTED))
122 #define DDE_FPOKRESERVED	(~DDE_FRELEASE)
123 #define MSGF_DDEMGR	0x8001
124 #define CBR_BLOCK	((HDDEDATA)0xffffffff)
125 #define CBF_FAIL_SELFCONNECTIONS	0x1000
126 #define CBF_FAIL_CONNECTIONS	0x2000
127 #define CBF_FAIL_ADVISES	0x4000
128 #define CBF_FAIL_EXECUTES	0x8000
129 #define CBF_FAIL_POKES	0x10000
130 #define CBF_FAIL_REQUESTS	0x20000
131 #define CBF_FAIL_ALLSVRXACTIONS	0x3f000
132 #define CBF_SKIP_CONNECT_CONFIRMS	0x40000
133 #define CBF_SKIP_REGISTRATIONS	0x80000
134 #define CBF_SKIP_UNREGISTRATIONS	0x100000
135 #define CBF_SKIP_DISCONNECTS	0x200000
136 #define CBF_SKIP_ALLNOTIFICATIONS	0x3c0000
137 #define APPCMD_CLIENTONLY	0x10L
138 #define APPCMD_FILTERINITS	0x20L
139 #define APPCMD_MASK	0xFF0L
140 #define APPCLASS_STANDARD	0
141 #define APPCLASS_MASK	0xFL
142 #define EC_ENABLEALL	0
143 #define EC_ENABLEONE	ST_BLOCKNEXT
144 #define EC_DISABLE	ST_BLOCKED
145 #define EC_QUERYWAITING	2
146 #define DNS_REGISTER	1
147 #define DNS_UNREGISTER	2
148 #define DNS_FILTERON	4
149 #define DNS_FILTEROFF	8
150 #define HDATA_APPOWNED	1
151 #define MAX_MONITORS	4
152 #define APPCLASS_MONITOR	1L
153 #define XTYP_MONITOR	(XCLASS_NOTIFICATION|XTYPF_NOBLOCK|0xF0)
154 #define MF_HSZ_INFO	0x1000000
155 #define MF_SENDMSGS	0x2000000
156 #define MF_POSTMSGS	0x4000000
157 #define MF_CALLBACKS	0x8000000
158 #define MF_ERRORS	0x10000000
159 #define MF_LINKS	0x20000000
160 #define MF_CONV	0x40000000
161 #define MF_MASK 0xFF000000
162 #define MH_CREATE	1
163 #define MH_KEEP	2
164 #define MH_DELETE	3
165 #define MH_CLEANUP	4
166 
167 DECLARE_HANDLE(HCONVLIST);
168 DECLARE_HANDLE(HCONV);
169 DECLARE_HANDLE(HSZ);
170 DECLARE_HANDLE(HDDEDATA);
171 typedef HDDEDATA CALLBACK FNCALLBACK(UINT,UINT,HCONV,HSZ,HSZ,HDDEDATA,DWORD,DWORD);
172 typedef HDDEDATA(CALLBACK *PFNCALLBACK)(UINT,UINT,HCONV,HSZ,HSZ,HDDEDATA,DWORD,DWORD);
173 typedef struct tagHSZPAIR {
174 	HSZ	hszSvc;
175 	HSZ	hszTopic;
176 } HSZPAIR, *PHSZPAIR;
177 typedef struct tagCONVCONTEXT {
178 	UINT	cb;
179 	UINT	wFlags;
180 	UINT	wCountryID;
181 	int	iCodePage;
182 	DWORD	dwLangID;
183 	DWORD	dwSecurity;
184 	SECURITY_QUALITY_OF_SERVICE qos;
185 } CONVCONTEXT,*PCONVCONTEXT;
186 typedef struct tagCONVINFO {
187 	DWORD	cb;
188 	DWORD	hUser;
189 	HCONV	hConvPartner;
190 	HSZ	hszSvcPartner;
191 	HSZ	hszServiceReq;
192 	HSZ	hszTopic;
193 	HSZ	hszItem;
194 	UINT	wFmt;
195 	UINT	wType;
196 	UINT	wStatus;
197 	UINT	wConvst;
198 	UINT	wLastError;
199 	HCONVLIST	hConvList;
200 	CONVCONTEXT ConvCtxt;
201 	HWND	hwnd;
202 	HWND	hwndPartner;
203 } CONVINFO,*PCONVINFO;
204 typedef struct tagDDEML_MSG_HOOK_DATA {
205 	UINT	uiLo;
206 	UINT	uiHi;
207 	DWORD	cbData;
208 	DWORD	Data[8];
209 } DDEML_MSG_HOOK_DATA;
210 typedef struct tagMONHSZSTRUCT {
211 	UINT	cb;
212 	BOOL	fsAction;
213 	DWORD	dwTime;
214 	HSZ	hsz;
215 	HANDLE	hTask;
216 	TCHAR	str[1];
217 } MONHSZSTRUCT, *PMONHSZSTRUCT;
218 typedef struct tagMONLINKSTRUCT {
219 	UINT	cb;
220 	DWORD	dwTime;
221 	HANDLE	hTask;
222 	BOOL	fEstablished;
223 	BOOL	fNoData;
224 	HSZ	hszSvc;
225 	HSZ	hszTopic;
226 	HSZ	hszItem;
227 	UINT	wFmt;
228 	BOOL	fServer;
229 	HCONV	hConvServer;
230 	HCONV	hConvClient;
231 } MONLINKSTRUCT, *PMONLINKSTRUCT;
232 typedef struct tagMONCONVSTRUCT {
233 	UINT	cb;
234 	BOOL	fConnect;
235 	DWORD	dwTime;
236 	HANDLE	hTask;
237 	HSZ	hszSvc;
238 	HSZ	hszTopic;
239 	HCONV	hConvClient;
240 	HCONV	hConvServer;
241 } MONCONVSTRUCT, *PMONCONVSTRUCT;
242 typedef struct tagMONCBSTRUCT {
243 	UINT	cb;
244 	DWORD	dwTime;
245 	HANDLE	hTask;
246 	DWORD	dwRet;
247 	UINT	wType;
248 	UINT	wFmt;
249 	HCONV	hConv;
250 	HSZ	hsz1;
251 	HSZ	hsz2;
252 	HDDEDATA	hData;
253 	ULONG_PTR	dwData1;
254 	ULONG_PTR	dwData2;
255 	CONVCONTEXT	cc;
256 	DWORD	cbData;
257 	DWORD	Data[8];
258 } MONCBSTRUCT, *PMONCBSTRUCT;
259 typedef struct tagMONERRSTRUCT {
260 	UINT	cb;
261 	UINT	wLastError;
262 	DWORD	dwTime;
263 	HANDLE	hTask;
264 } MONERRSTRUCT, *PMONERRSTRUCT;
265 typedef struct tagMONMSGSTRUCT {
266 	UINT	cb;
267 	HWND	hwndTo;
268 	DWORD	dwTime;
269 	HANDLE	hTask;
270 	UINT	wMsg;
271 	WPARAM	wParam;
272 	LPARAM	lParam;
273 	DDEML_MSG_HOOK_DATA dmhd;
274 } MONMSGSTRUCT, *PMONMSGSTRUCT;
275 
276 BOOL WINAPI DdeAbandonTransaction(DWORD,HCONV,DWORD);
277 PBYTE WINAPI DdeAccessData(HDDEDATA,PDWORD);
278 HDDEDATA WINAPI DdeAddData(HDDEDATA,PBYTE,DWORD,DWORD);
279 HDDEDATA WINAPI DdeClientTransaction(PBYTE,DWORD,HCONV,HSZ,UINT,UINT,DWORD,PDWORD);
280 int WINAPI DdeCmpStringHandles(HSZ,HSZ);
281 HCONV WINAPI DdeConnect(DWORD,HSZ,HSZ,PCONVCONTEXT);
282 HCONVLIST WINAPI DdeConnectList(DWORD,HSZ,HSZ,HCONVLIST,PCONVCONTEXT);
283 HDDEDATA WINAPI DdeCreateDataHandle(DWORD,PBYTE,DWORD,DWORD,HSZ,UINT,UINT);
284 HSZ WINAPI DdeCreateStringHandleA(DWORD,LPCSTR,int);
285 HSZ WINAPI DdeCreateStringHandleW(DWORD,LPCWSTR,int);
286 BOOL WINAPI DdeDisconnect(HCONV);
287 BOOL WINAPI DdeDisconnectList(HCONVLIST);
288 BOOL WINAPI DdeEnableCallback(DWORD,HCONV,UINT);
289 BOOL WINAPI DdeFreeDataHandle(HDDEDATA);
290 BOOL WINAPI DdeFreeStringHandle(DWORD,HSZ);
291 DWORD WINAPI DdeGetData(HDDEDATA,PBYTE,DWORD,DWORD);
292 UINT WINAPI DdeGetLastError(DWORD);
293 BOOL WINAPI DdeImpersonateClient(HCONV);
294 UINT WINAPI DdeInitializeA(PDWORD,PFNCALLBACK,DWORD,DWORD);
295 UINT WINAPI DdeInitializeW(PDWORD,PFNCALLBACK,DWORD,DWORD);
296 BOOL WINAPI DdeKeepStringHandle(DWORD,HSZ);
297 HDDEDATA WINAPI DdeNameService(DWORD,HSZ,HSZ,UINT);
298 BOOL WINAPI DdePostAdvise(DWORD,HSZ,HSZ);
299 UINT WINAPI DdeQueryConvInfo(HCONV,DWORD,PCONVINFO);
300 HCONV WINAPI DdeQueryNextServer(HCONVLIST,HCONV);
301 DWORD WINAPI DdeQueryStringA(DWORD,HSZ,LPSTR,DWORD,int);
302 DWORD WINAPI DdeQueryStringW(DWORD,HSZ,LPWSTR,DWORD,int);
303 HCONV WINAPI DdeReconnect(HCONV);
304 BOOL WINAPI DdeSetUserHandle(HCONV,DWORD,DWORD);
305 BOOL WINAPI DdeUnaccessData(HDDEDATA);
306 BOOL WINAPI DdeUninitialize(DWORD);
307 
308 #define SZDDESYS_TOPIC	__STR("System")
309 #define SZDDESYS_ITEM_TOPICS	__STR("Topics")
310 #define SZDDESYS_ITEM_SYSITEMS	__STR("SysItems")
311 #define SZDDESYS_ITEM_RTNMSG	__STR("ReturnMessage")
312 #define SZDDESYS_ITEM_STATUS	__STR("Status")
313 #define SZDDESYS_ITEM_FORMATS	__STR("Formats")
314 #define SZDDESYS_ITEM_HELP	__STR("Help")
315 #define SZDDE_ITEM_ITEMLIST	__STR("TopicItemList")
316 #define DdeCreateStringHandle __AW(DdeCreateStringHandle)
317 #define DdeInitialize __AW(DdeInitialize)
318 #define DdeQueryString __AW(DdeQueryString)
319 
320 #ifdef __cplusplus
321 }
322 #endif
323 #endif /* _DDEML_H */
324