dwrite: Add missing return value check (Coverity).
[wine.git] / include / ddeml.h
blobe769662988f2f2855d1ff6653162d8d4c12294ad
1 /*
2 * DDEML library definitions
4 * Copyright 1997 Alexandre Julliard
5 * Copyright 1997 Len White
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 #ifndef __WINE_DDEML_H
23 #define __WINE_DDEML_H
25 #ifdef __cplusplus
26 extern "C" {
27 #endif /* defined(__cplusplus) */
29 #ifdef _USER32_
30 #define WINUSERAPI
31 #else
32 #define WINUSERAPI DECLSPEC_IMPORT
33 #endif
35 /* Codepage Constants
38 #define CP_WINANSI 1004
39 #define CP_WINUNICODE 1200
41 /* DDE synchronisation constants
44 #define MSGF_DDEMGR 0x8001
46 #define QID_SYNC 0xFFFFFFFF
48 /* Type variation for MS deliberate departures from ANSI standards
51 #define EXPENTRY CALLBACK
53 #ifdef UNICODE
54 #if defined(_MSC_VER)
55 #define SZDDESYS_TOPIC L"System"
56 #define SZDDESYS_ITEM_TOPICS L"Topics"
57 #define SZDDESYS_ITEM_SYSITEMS L"SysItems"
58 #define SZDDESYS_ITEM_RTNMSG L"ReturnMessage"
59 #define SZDDESYS_ITEM_STATUS L"Status"
60 #define SZDDESYS_ITEM_FORMATS L"Formats"
61 #define SZDDESYS_ITEM_HELP L"Help"
62 #define SZDDE_ITEM_ITEMLIST L"TopicItemList"
63 #elif defined(__GNUC__)
64 #define SZDDESYS_TOPIC (const WCHAR []){'S','y','s','t','e','m',0}
65 #define SZDDESYS_ITEM_TOPICS (const WCHAR []){'T','o','p','i','c','s',0}
66 #define SZDDESYS_ITEM_SYSITEMS (const WCHAR []){'S','y','s','I','t','e','m','s',0}
67 #define SZDDESYS_ITEM_RTNMSG (const WCHAR []){'R','e','t','u','r','n','M','e','s','s','a','g','e',0}
68 #define SZDDESYS_ITEM_STATUS (const WCHAR []){'S','t','a','t','u','s',0}
69 #define SZDDESYS_ITEM_FORMATS (const WCHAR []){'F','o','r','m','a','t','s',0}
70 #define SZDDESYS_ITEM_HELP (const WCHAR []){'H','e','l','p',0}
71 #define SZDDE_ITEM_ITEMLIST (const WCHAR []){'T','o','p','i','c','I','t','e','m','L','i','s','t',0}
72 #else /* _MSC_VER/__GNUC__ */
73 static const WCHAR SZDDESYS_TOPIC[] = {'S','y','s','t','e','m',0};
74 static const WCHAR SZDDESYS_ITEM_TOPICS[] = {'T','o','p','i','c','s',0};
75 static const WCHAR SZDDESYS_ITEM_SYSITEMS[] = {'S','y','s','I','t','e','m','s',0};
76 static const WCHAR SZDDESYS_ITEM_RTNMSG[] = {'R','e','t','u','r','n','M','e','s','s','a','g','e',0};
77 static const WCHAR SZDDESYS_ITEM_STATUS[] = {'S','t','a','t','u','s',0};
78 static const WCHAR SZDDESYS_ITEM_FORMATS[] = {'F','o','r','m','a','t','s',0};
79 static const WCHAR SZDDESYS_ITEM_HELP[] = {'H','e','l','p',0};
80 static const WCHAR SZDDE_ITEM_ITEMLIST[] = {'T','o','p','i','c','I','t','e','m','L','i','s','t',0};
81 #endif
82 #else /* UNICODE */
83 #define SZDDESYS_TOPIC "System"
84 #define SZDDESYS_ITEM_TOPICS "Topics"
85 #define SZDDESYS_ITEM_SYSITEMS "SysItems"
86 #define SZDDESYS_ITEM_RTNMSG "ReturnMessage"
87 #define SZDDESYS_ITEM_STATUS "Status"
88 #define SZDDESYS_ITEM_FORMATS "Formats"
89 #define SZDDESYS_ITEM_HELP "Help"
90 #define SZDDE_ITEM_ITEMLIST "TopicItemList"
91 #endif
93 /***************************************************
95 FLAGS Section - copied from Microsoft SDK as must be standard, probably Copyright Microsoft Corporation
97 ***************************************************/
99 #define XST_NULL 0
100 #define XST_INCOMPLETE 1
101 #define XST_CONNECTED 2
102 #define XST_INIT1 3
103 #define XST_INIT2 4
104 #define XST_REQSENT 5
105 #define XST_DATARCVD 6
106 #define XST_POKESENT 7
107 #define XST_POKEACKRCVD 8
108 #define XST_EXECSENT 9
109 #define XST_EXECACKRCVD 10
110 #define XST_ADVSENT 11
111 #define XST_UNADVSENT 12
112 #define XST_ADVACKRCVD 13
113 #define XST_UNADVACKRCVD 14
114 #define XST_ADVDATASENT 15
115 #define XST_ADVDATAACKRCVD 16
117 #define ST_CONNECTED 0x0001
118 #define ST_ADVISE 0x0002
119 #define ST_ISLOCAL 0x0004
120 #define ST_BLOCKED 0x0008
121 #define ST_CLIENT 0x0010
122 #define ST_TERMINATED 0x0020
123 #define ST_INLIST 0x0040
124 #define ST_BLOCKNEXT 0x0080
125 #define ST_ISSELF 0x0100
128 * DdeEnableCallback function codes
131 #define EC_ENABLEALL 0
132 #define EC_ENABLEONE ST_BLOCKNEXT
133 #define EC_DISABLE ST_BLOCKED
134 #define EC_QUERYWAITING 2
137 * Callback filter flags for use with standard apps.
140 #define CBF_FAIL_SELFCONNECTIONS 0x00001000
141 #define CBF_FAIL_CONNECTIONS 0x00002000
142 #define CBF_FAIL_ADVISES 0x00004000
143 #define CBF_FAIL_EXECUTES 0x00008000
144 #define CBF_FAIL_POKES 0x00010000
145 #define CBF_FAIL_REQUESTS 0x00020000
146 #define CBF_FAIL_ALLSVRXACTIONS 0x0003f000
148 #define CBF_SKIP_CONNECT_CONFIRMS 0x00040000
149 #define CBF_SKIP_REGISTRATIONS 0x00080000
150 #define CBF_SKIP_UNREGISTRATIONS 0x00100000
151 #define CBF_SKIP_DISCONNECTS 0x00200000
152 #define CBF_SKIP_ALLNOTIFICATIONS 0x003c0000
154 #define CBR_BLOCK ((HDDEDATA)-1)
157 * Application command flags
159 #define APPCMD_CLIENTONLY __MSABI_LONG(0x00000010)
160 #define APPCMD_FILTERINITS __MSABI_LONG(0x00000020)
161 #define APPCMD_MASK __MSABI_LONG(0x00000FF0)
164 * Application classification flags
167 #define APPCLASS_STANDARD __MSABI_LONG(0x00000000)
168 #define APPCLASS_MONITOR __MSABI_LONG(0x00000001)
169 #define APPCLASS_MASK __MSABI_LONG(0x0000000F)
172 * Callback filter flags for use with MONITOR apps - 0 implies no monitor
173 * callbacks.
175 #define MF_HSZ_INFO 0x01000000
176 #define MF_SENDMSGS 0x02000000
177 #define MF_POSTMSGS 0x04000000
178 #define MF_CALLBACKS 0x08000000
179 #define MF_ERRORS 0x10000000
180 #define MF_LINKS 0x20000000
181 #define MF_CONV 0x40000000
183 #define MF_MASK 0xFF000000
186 * DdeNameService service name flags
189 #define DNS_REGISTER 0x0001
190 #define DNS_UNREGISTER 0x0002
191 #define DNS_FILTERON 0x0004
192 #define DNS_FILTEROFF 0x0008
195 /****************************************************
197 End of Flags section
199 ****************************************************/
201 /****************************************************
203 Message Types Section
205 ****************************************************/
207 #define XTYPF_NOBLOCK 0x0002 /* CBR_NOBLOCK will not work */
208 #define XTYPF_NODATA 0x0004 /* DDE_FDEFERUPD */
209 #define XTYPF_ACKREQ 0x0008 /* DDE_FACKREQ */
211 #define XCLASS_MASK 0xFC00
212 #define XCLASS_BOOL 0x1000
213 #define XCLASS_DATA 0x2000
214 #define XCLASS_FLAGS 0x4000
215 #define XCLASS_NOTIFICATION 0x8000
217 #define XTYP_ERROR (0x0000 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK)
218 #define XTYP_ADVDATA (0x0010 | XCLASS_FLAGS)
219 #define XTYP_ADVREQ (0x0020 | XCLASS_DATA | XTYPF_NOBLOCK)
220 #define XTYP_ADVSTART (0x0030 | XCLASS_BOOL)
221 #define XTYP_ADVSTOP (0x0040 | XCLASS_NOTIFICATION)
222 #define XTYP_EXECUTE (0x0050 | XCLASS_FLAGS)
223 #define XTYP_CONNECT (0x0060 | XCLASS_BOOL | XTYPF_NOBLOCK)
224 #define XTYP_CONNECT_CONFIRM (0x0070 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK)
225 #define XTYP_XACT_COMPLETE (0x0080 | XCLASS_NOTIFICATION )
226 #define XTYP_POKE (0x0090 | XCLASS_FLAGS)
227 #define XTYP_REGISTER (0x00A0 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK )
228 #define XTYP_REQUEST (0x00B0 | XCLASS_DATA )
229 #define XTYP_DISCONNECT (0x00C0 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK )
230 #define XTYP_UNREGISTER (0x00D0 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK )
231 #define XTYP_WILDCONNECT (0x00E0 | XCLASS_DATA | XTYPF_NOBLOCK)
232 #define XTYP_MONITOR (0x00F0 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK)
234 #define XTYP_MASK 0x00F0
235 #define XTYP_SHIFT 4
237 #define TIMEOUT_ASYNC 0xFFFFFFFF
239 #define CADV_LATEACK 0xFFFF
241 /**************************************************
243 End of Message Types Section
245 ****************************************************/
247 /*****************************************************
249 DDE Codes for wStatus field
251 *****************************************************/
253 #define DDE_FACK 0x8000
254 #define DDE_FBUSY 0x4000
255 #define DDE_FDEFERUPD 0x4000
256 #define DDE_FACKREQ 0x8000
257 #define DDE_FRELEASE 0x2000
258 #define DDE_FREQUESTED 0x1000
259 #define DDE_FAPPSTATUS 0x00FF
260 #define DDE_FNOTPROCESSED 0x0000
262 #define DDE_FACKRESERVED (~(DDE_FACK | DDE_FBUSY | DDE_FAPPSTATUS))
263 #define DDE_FADVRESERVED (~(DDE_FACKREQ | DDE_FDEFERUPD))
264 #define DDE_FDATRESERVED (~(DDE_FACKREQ | DDE_FRELEASE | DDE_FREQUESTED))
265 #define DDE_FPOKRESERVED (~(DDE_FRELEASE))
267 /*****************************************************
269 End of wStatus codes
271 *****************************************************/
273 /****************************************************
275 Return Codes section again copied from SDK as must be same
277 *****************************************************/
279 #define DMLERR_NO_ERROR 0 /* must be 0 */
281 #define DMLERR_FIRST 0x4000
283 #define DMLERR_ADVACKTIMEOUT 0x4000
284 #define DMLERR_BUSY 0x4001
285 #define DMLERR_DATAACKTIMEOUT 0x4002
286 #define DMLERR_DLL_NOT_INITIALIZED 0x4003
287 #define DMLERR_DLL_USAGE 0x4004
288 #define DMLERR_EXECACKTIMEOUT 0x4005
289 #define DMLERR_INVALIDPARAMETER 0x4006
290 #define DMLERR_LOW_MEMORY 0x4007
291 #define DMLERR_MEMORY_ERROR 0x4008
292 #define DMLERR_NOTPROCESSED 0x4009
293 #define DMLERR_NO_CONV_ESTABLISHED 0x400a
294 #define DMLERR_POKEACKTIMEOUT 0x400b
295 #define DMLERR_POSTMSG_FAILED 0x400c
296 #define DMLERR_REENTRANCY 0x400d
297 #define DMLERR_SERVER_DIED 0x400e
298 #define DMLERR_SYS_ERROR 0x400f
299 #define DMLERR_UNADVACKTIMEOUT 0x4010
300 #define DMLERR_UNFOUND_QUEUE_ID 0x4011
302 #define DMLERR_LAST 0x4011
304 #define HDATA_APPOWNED 0x0001
306 /*****************************************************
308 End of Return Codes and Microsoft section
310 ******************************************************/
314 DECLARE_HANDLE(HCONVLIST);
315 DECLARE_HANDLE(HCONV);
316 DECLARE_HANDLE(HSZ);
317 DECLARE_HANDLE(HDDEDATA);
321 /*******************************************************
323 API Entry Points
325 *******************************************************/
327 typedef HDDEDATA (CALLBACK *PFNCALLBACK)(UINT, UINT, HCONV, HSZ, HSZ,
328 HDDEDATA, ULONG_PTR, ULONG_PTR);
330 /***************************************************
332 Externally visible data structures
334 ***************************************************/
336 typedef struct tagHSZPAIR
338 HSZ hszSvc;
339 HSZ hszTopic;
340 } HSZPAIR, *PHSZPAIR;
342 typedef struct tagCONVCONTEXT
344 UINT cb;
345 UINT wFlags;
346 UINT wCountryID;
347 INT iCodePage;
348 DWORD dwLangID;
349 DWORD dwSecurity;
350 SECURITY_QUALITY_OF_SERVICE qos;
351 } CONVCONTEXT, *PCONVCONTEXT;
353 typedef struct tagCONVINFO
355 DWORD cb;
356 DWORD_PTR hUser;
357 HCONV hConvPartner;
358 HSZ hszSvcPartner;
359 HSZ hszServiceReq;
360 HSZ hszTopic;
361 HSZ hszItem;
362 UINT wFmt;
363 UINT wType;
364 UINT wStatus;
365 UINT wConvst;
366 UINT wLastError;
367 HCONVLIST hConvList;
368 CONVCONTEXT ConvCtxt;
369 HWND hwnd;
370 HWND hwndPartner;
371 } CONVINFO, *PCONVINFO;
373 /* Interface Definitions */
375 WINUSERAPI BOOL WINAPI DdeAbandonTransaction(DWORD idInst, HCONV hConv, DWORD idTransaction);
376 WINUSERAPI LPBYTE WINAPI DdeAccessData(HDDEDATA,LPDWORD);
377 WINUSERAPI HDDEDATA WINAPI DdeAddData(HDDEDATA,LPBYTE,DWORD,DWORD);
378 WINUSERAPI HDDEDATA WINAPI DdeClientTransaction(LPBYTE,DWORD,HCONV,HSZ,UINT,UINT,DWORD,LPDWORD);
379 WINUSERAPI INT WINAPI DdeCmpStringHandles(HSZ,HSZ);
380 WINUSERAPI HCONV WINAPI DdeConnect(DWORD,HSZ,HSZ,PCONVCONTEXT);
381 WINUSERAPI HCONVLIST WINAPI DdeConnectList(DWORD,HSZ,HSZ,HCONVLIST,PCONVCONTEXT);
382 WINUSERAPI HDDEDATA WINAPI DdeCreateDataHandle(DWORD,LPBYTE,DWORD,DWORD,HSZ,UINT,UINT);
383 WINUSERAPI HSZ WINAPI DdeCreateStringHandleA(DWORD,LPCSTR,INT);
384 WINUSERAPI HSZ WINAPI DdeCreateStringHandleW(DWORD,LPCWSTR,INT);
385 #define DdeCreateStringHandle WINELIB_NAME_AW(DdeCreateStringHandle)
386 WINUSERAPI BOOL WINAPI DdeDisconnect(HCONV);
387 WINUSERAPI BOOL WINAPI DdeDisconnectList(HCONVLIST);
388 WINUSERAPI BOOL WINAPI DdeEnableCallback(DWORD,HCONV,UINT);
389 WINUSERAPI BOOL WINAPI DdeFreeDataHandle(HDDEDATA);
390 WINUSERAPI BOOL WINAPI DdeFreeStringHandle(DWORD,HSZ);
391 WINUSERAPI DWORD WINAPI DdeGetData(HDDEDATA,LPBYTE,DWORD,DWORD);
392 WINUSERAPI UINT WINAPI DdeGetLastError(DWORD);
393 WINUSERAPI BOOL WINAPI DdeImpersonateClient(HCONV);
394 WINUSERAPI UINT WINAPI DdeInitializeA(LPDWORD,PFNCALLBACK,DWORD,DWORD);
395 WINUSERAPI UINT WINAPI DdeInitializeW(LPDWORD,PFNCALLBACK,DWORD,DWORD);
396 #define DdeInitialize WINELIB_NAME_AW(DdeInitialize)
397 WINUSERAPI BOOL WINAPI DdeKeepStringHandle(DWORD,HSZ);
398 WINUSERAPI HDDEDATA WINAPI DdeNameService(DWORD,HSZ,HSZ,UINT);
399 WINUSERAPI BOOL WINAPI DdePostAdvise(DWORD,HSZ,HSZ);
400 WINUSERAPI UINT WINAPI DdeQueryConvInfo(HCONV,DWORD,PCONVINFO);
401 WINUSERAPI HCONV WINAPI DdeQueryNextServer(HCONVLIST, HCONV);
402 WINUSERAPI DWORD WINAPI DdeQueryStringA(DWORD, HSZ, LPSTR, DWORD, INT);
403 WINUSERAPI DWORD WINAPI DdeQueryStringW(DWORD, HSZ, LPWSTR, DWORD, INT);
404 #define DdeQueryString WINELIB_NAME_AW(DdeQueryString)
405 WINUSERAPI HCONV WINAPI DdeReconnect(HCONV);
406 WINUSERAPI BOOL WINAPI DdeSetUserHandle(HCONV,DWORD,DWORD);
407 WINUSERAPI BOOL WINAPI DdeUnaccessData(HDDEDATA);
408 WINUSERAPI BOOL WINAPI DdeUninitialize(DWORD);
410 #ifdef __cplusplus
411 } /* extern "C" */
412 #endif /* defined(__cplusplus) */
414 #endif /* __WINE_DDEML_H */