- use global atoms for the format ids
[wine] / include / ddeml.h
1 /*
2  * DDEML library definitions
3  *
4  * Copyright 1997 Alexandre Julliard
5  * Copyright 1997 Len White
6  *
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.
11  *
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.
16  *
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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20  */
21
22 #ifndef __WINE_DDEML_H
23 #define __WINE_DDEML_H
24
25 #include "windef.h"
26
27 #ifdef __cplusplus
28 extern "C" {
29 #endif /* defined(__cplusplus) */
30
31 /* Codepage Constants
32  */
33
34 #define CP_WINANSI      1004
35 #define CP_WINUNICODE   1200
36
37 /* DDE synchronisation constants
38  */
39
40 #define MSGF_DDEMGR 0x8001
41
42 #define QID_SYNC        0xFFFFFFFF
43
44 /*   Type variation for MS  deliberate departures from ANSI standards
45  */
46
47 #define EXPENTRY CALLBACK
48
49 #define SZDDESYS_TOPIC          TEXT("System")
50 #define SZDDESYS_ITEM_TOPICS    TEXT("Topics")
51 #define SZDDESYS_ITEM_SYSITEMS  TEXT("SysItems")
52 #define SZDDESYS_ITEM_RTNMSG    TEXT("ReturnMessage")
53 #define SZDDESYS_ITEM_STATUS    TEXT("Status")
54 #define SZDDESYS_ITEM_FORMATS   TEXT("Formats")
55 #define SZDDESYS_ITEM_HELP      TEXT("Help")
56 #define SZDDE_ITEM_ITEMLIST     TEXT("TopicItemList")
57
58 /***************************************************
59
60       FLAGS Section - copied from Microsoft SDK as must be standard, probably Copyright Microsoft Corporation
61
62 ***************************************************/
63
64 #define     XST_NULL              0
65 #define     XST_INCOMPLETE        1
66 #define     XST_CONNECTED         2
67 #define     XST_INIT1             3
68 #define     XST_INIT2             4
69 #define     XST_REQSENT           5
70 #define     XST_DATARCVD          6
71 #define     XST_POKESENT          7
72 #define     XST_POKEACKRCVD       8
73 #define     XST_EXECSENT          9
74 #define     XST_EXECACKRCVD      10
75 #define     XST_ADVSENT          11
76 #define     XST_UNADVSENT        12
77 #define     XST_ADVACKRCVD       13
78 #define     XST_UNADVACKRCVD     14
79 #define     XST_ADVDATASENT      15
80 #define     XST_ADVDATAACKRCVD   16
81
82 #define     ST_CONNECTED            0x0001
83 #define     ST_ADVISE               0x0002
84 #define     ST_ISLOCAL              0x0004
85 #define     ST_BLOCKED              0x0008
86 #define     ST_CLIENT               0x0010
87 #define     ST_TERMINATED           0x0020
88 #define     ST_INLIST               0x0040
89 #define     ST_BLOCKNEXT            0x0080
90 #define     ST_ISSELF               0x0100
91
92 /*
93  * DdeEnableCallback function codes
94  */
95
96 #define     EC_ENABLEALL                 0
97 #define     EC_ENABLEONE                 ST_BLOCKNEXT
98 #define     EC_DISABLE                   ST_BLOCKED
99 #define     EC_QUERYWAITING              2
100
101 /*
102  * Callback filter flags for use with standard apps.
103  */
104
105 #define     CBF_FAIL_SELFCONNECTIONS     0x00001000
106 #define     CBF_FAIL_CONNECTIONS         0x00002000
107 #define     CBF_FAIL_ADVISES             0x00004000
108 #define     CBF_FAIL_EXECUTES            0x00008000
109 #define     CBF_FAIL_POKES               0x00010000
110 #define     CBF_FAIL_REQUESTS            0x00020000
111 #define     CBF_FAIL_ALLSVRXACTIONS      0x0003f000
112
113 #define     CBF_SKIP_CONNECT_CONFIRMS    0x00040000
114 #define     CBF_SKIP_REGISTRATIONS       0x00080000
115 #define     CBF_SKIP_UNREGISTRATIONS     0x00100000
116 #define     CBF_SKIP_DISCONNECTS         0x00200000
117 #define     CBF_SKIP_ALLNOTIFICATIONS    0x003c0000
118
119 #define     CBR_BLOCK                    0xFFFFFFFFL
120
121 /*
122  * Application command flags
123  */
124 #define     APPCMD_CLIENTONLY            0x00000010L
125 #define     APPCMD_FILTERINITS           0x00000020L
126 #define     APPCMD_MASK                  0x00000FF0L
127
128 /*
129  * Application classification flags
130  */
131
132 #define     APPCLASS_STANDARD            0x00000000L
133 #define     APPCLASS_MONITOR             0x00000001L
134 #define     APPCLASS_MASK                0x0000000FL
135
136 /*
137  * Callback filter flags for use with MONITOR apps - 0 implies no monitor
138  * callbacks.
139  */
140 #define     MF_HSZ_INFO                  0x01000000
141 #define     MF_SENDMSGS                  0x02000000
142 #define     MF_POSTMSGS                  0x04000000
143 #define     MF_CALLBACKS                 0x08000000
144 #define     MF_ERRORS                    0x10000000
145 #define     MF_LINKS                     0x20000000
146 #define     MF_CONV                      0x40000000
147
148 #define     MF_MASK                      0xFF000000
149
150 /*
151  *      DdeNameService service name flags
152  */
153
154 #define     DNS_REGISTER                 0x0001
155 #define     DNS_UNREGISTER               0x0002
156 #define     DNS_FILTERON                 0x0004
157 #define     DNS_FILTEROFF                0x0008
158
159
160 /****************************************************
161
162       End of Flags section
163
164 ****************************************************/
165
166 /****************************************************
167
168         Message Types Section
169
170 ****************************************************/
171
172 #define XTYPF_NOBLOCK           0x0002          /* CBR_NOBLOCK will not work */
173 #define XTYPF_NODATA            0x0004          /* DDE_FDEFERUPD  */
174 #define XTYPF_ACKREQ            0x0008          /* DDE_FACKREQ */
175
176 #define XCLASS_MASK             0xFC00
177 #define XCLASS_BOOL             0x1000
178 #define XCLASS_DATA             0x2000
179 #define XCLASS_FLAGS            0x4000
180 #define XCLASS_NOTIFICATION     0x8000
181
182 #define XTYP_ERROR              (0x0000 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK)
183 #define XTYP_ADVDATA            (0x0010 | XCLASS_FLAGS)
184 #define XTYP_ADVREQ             (0x0020 | XCLASS_DATA | XTYPF_NOBLOCK)
185 #define XTYP_ADVSTART           (0x0030 | XCLASS_BOOL)
186 #define XTYP_ADVSTOP            (0x0040 | XCLASS_NOTIFICATION)
187 #define XTYP_EXECUTE            (0x0050 | XCLASS_FLAGS)
188 #define XTYP_CONNECT            (0x0060 | XCLASS_BOOL | XTYPF_NOBLOCK)
189 #define XTYP_CONNECT_CONFIRM    (0x0070 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK)
190 #define XTYP_XACT_COMPLETE      (0x0080 | XCLASS_NOTIFICATION )
191 #define XTYP_POKE               (0x0090 | XCLASS_FLAGS)
192 #define XTYP_REGISTER           (0x00A0 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK )
193 #define XTYP_REQUEST            (0x00B0 | XCLASS_DATA )
194 #define XTYP_DISCONNECT         (0x00C0 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK )
195 #define XTYP_UNREGISTER         (0x00D0 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK )
196 #define XTYP_WILDCONNECT        (0x00E0 | XCLASS_DATA | XTYPF_NOBLOCK)
197
198 #define XTYP_MASK               0x00F0
199 #define XTYP_SHIFT              4
200
201 #define TIMEOUT_ASYNC           0xFFFFFFFF
202
203 #define CADV_LATEACK            0xFFFF
204
205 /**************************************************
206
207         End of Message Types Section
208
209 ****************************************************/
210
211 /*****************************************************
212
213         DDE Codes for wStatus field
214
215 *****************************************************/
216
217 #define DDE_FACK                0x8000
218 #define DDE_FBUSY               0x4000
219 #define DDE_FDEFERUPD           0x4000
220 #define DDE_FACKREQ             0x8000
221 #define DDE_FRELEASE            0x2000
222 #define DDE_FREQUESTED          0x1000
223 #define DDE_FAPPSTATUS          0x00FF
224 #define DDE_FNOTPROCESSED       0x0000
225
226 #define DDE_FACKRESERVED        (~(DDE_FACK | DDE_FBUSY | DDE_FAPPSTATUS))
227 #define DDE_FADVRESERVED        (~(DDE_FACKREQ | DDE_FDEFERUPD))
228 #define DDE_FDATRESERVED        (~(DDE_FACKREQ | DDE_FRELEASE | DDE_FREQUESTED))
229 #define DDE_FPOKRESERVED        (~(DDE_FRELEASE))
230
231 /*****************************************************
232
233         End of wStatus codes
234
235 *****************************************************/
236
237 /****************************************************
238
239       Return Codes section again copied from SDK as must be same
240
241 *****************************************************/
242
243 #define     DMLERR_NO_ERROR                    0       /* must be 0 */
244
245 #define     DMLERR_FIRST                       0x4000
246
247 #define     DMLERR_ADVACKTIMEOUT               0x4000
248 #define     DMLERR_BUSY                        0x4001
249 #define     DMLERR_DATAACKTIMEOUT              0x4002
250 #define     DMLERR_DLL_NOT_INITIALIZED         0x4003
251 #define     DMLERR_DLL_USAGE                   0x4004
252 #define     DMLERR_EXECACKTIMEOUT              0x4005
253 #define     DMLERR_INVALIDPARAMETER            0x4006
254 #define     DMLERR_LOW_MEMORY                  0x4007
255 #define     DMLERR_MEMORY_ERROR                0x4008
256 #define     DMLERR_NOTPROCESSED                0x4009
257 #define     DMLERR_NO_CONV_ESTABLISHED         0x400a
258 #define     DMLERR_POKEACKTIMEOUT              0x400b
259 #define     DMLERR_POSTMSG_FAILED              0x400c
260 #define     DMLERR_REENTRANCY                  0x400d
261 #define     DMLERR_SERVER_DIED                 0x400e
262 #define     DMLERR_SYS_ERROR                   0x400f
263 #define     DMLERR_UNADVACKTIMEOUT             0x4010
264 #define     DMLERR_UNFOUND_QUEUE_ID            0x4011
265
266 #define     DMLERR_LAST                        0x4011
267
268 #define     HDATA_APPOWNED                     0x0001
269
270 /*****************************************************
271
272       End of Return Codes and Microsoft section
273
274 ******************************************************/
275
276
277
278 DECLARE_HANDLE(HCONVLIST);
279 DECLARE_HANDLE(HCONV);
280 DECLARE_HANDLE(HSZ);
281 DECLARE_HANDLE(HDDEDATA);
282
283
284
285 /*******************************************************
286
287         API Entry Points
288
289 *******************************************************/
290
291 typedef HDDEDATA (CALLBACK *PFNCALLBACK)(UINT, UINT, HCONV, HSZ, HSZ,
292                                          HDDEDATA, DWORD, DWORD);
293
294 /***************************************************
295
296         Externally visible data structures
297
298 ***************************************************/
299
300 typedef struct tagHSZPAIR
301 {
302     HSZ hszSvc;
303     HSZ hszTopic;
304 } HSZPAIR, *PHSZPAIR;
305
306 typedef struct tagCONVCONTEXT
307 {
308     UINT  cb;
309     UINT  wFlags;
310     UINT  wCountryID;
311     INT   iCodePage;
312     DWORD   dwLangID;
313     DWORD   dwSecurity;
314 } CONVCONTEXT, *PCONVCONTEXT;
315
316 typedef struct tagCONVINFO
317 {
318     DWORD               cb;
319     DWORD               hUser;
320     HCONV               hConvPartner;
321     HSZ                 hszSvcPartner;
322     HSZ                 hszServiceReq;
323     HSZ                 hszTopic;
324     HSZ                 hszItem;
325     UINT                wFmt;
326     UINT                wType;
327     UINT                wStatus;
328     UINT                wConvst;
329     UINT                wLastError;
330     HCONVLIST           hConvList;
331     CONVCONTEXT         ConvCtxt;
332     HWND                hwnd;
333     HWND                hwndPartner;
334 } CONVINFO, *PCONVINFO;
335
336 /*            Interface Definitions             */
337
338
339 UINT    WINAPI DdeInitializeA(LPDWORD,PFNCALLBACK,DWORD,DWORD);
340 UINT    WINAPI DdeInitializeW(LPDWORD,PFNCALLBACK,DWORD,DWORD);
341 #define   DdeInitialize WINELIB_NAME_AW(DdeInitialize)
342 BOOL    WINAPI DdeUninitialize(DWORD);
343 HCONVLIST WINAPI DdeConnectList(DWORD,HSZ,HSZ,HCONVLIST,PCONVCONTEXT);
344 HCONV     WINAPI DdeQueryNextServer(HCONVLIST, HCONV);
345 DWORD     WINAPI DdeQueryStringA(DWORD, HSZ, LPSTR, DWORD, INT);
346 DWORD     WINAPI DdeQueryStringW(DWORD, HSZ, LPWSTR, DWORD, INT);
347 #define   DdeQueryString WINELIB_NAME_AW(DdeQueryString)
348 BOOL      WINAPI DdeDisconnectList(HCONVLIST);
349 HCONV     WINAPI DdeConnect(DWORD,HSZ,HSZ,PCONVCONTEXT);
350 BOOL      WINAPI DdeDisconnect(HCONV);
351 HDDEDATA  WINAPI DdeCreateDataHandle(DWORD,LPBYTE,DWORD,DWORD,HSZ,UINT,UINT);
352 HCONV     WINAPI DdeReconnect(HCONV);
353 HSZ       WINAPI DdeCreateStringHandleA(DWORD,LPCSTR,INT);
354 HSZ       WINAPI DdeCreateStringHandleW(DWORD,LPCWSTR,INT);
355 #define   DdeCreateStringHandle WINELIB_NAME_AW(DdeCreateStringHandle)
356 BOOL      WINAPI DdeFreeStringHandle(DWORD,HSZ);
357 BOOL      WINAPI DdeFreeDataHandle(HDDEDATA);
358 BOOL      WINAPI DdeKeepStringHandle(DWORD,HSZ);
359 HDDEDATA  WINAPI DdeClientTransaction(LPBYTE,DWORD,HCONV,HSZ,UINT,UINT,DWORD,LPDWORD);
360 BOOL      WINAPI DdeAbandonTransaction(DWORD idInst, HCONV hConv, DWORD idTransaction);
361 BOOL      WINAPI DdeImpersonateClient(HCONV);
362 BOOL      WINAPI DdePostAdvise(DWORD,HSZ,HSZ);
363 HDDEDATA  WINAPI DdeAddData(HDDEDATA,LPBYTE,DWORD,DWORD);
364 DWORD     WINAPI DdeGetData(HDDEDATA,LPBYTE,DWORD,DWORD);
365 LPBYTE    WINAPI DdeAccessData(HDDEDATA,LPDWORD);
366 BOOL      WINAPI DdeUnaccessData(HDDEDATA);
367 BOOL      WINAPI DdeEnableCallback(DWORD,HCONV,UINT);
368 INT       WINAPI DdeCmpStringHandles(HSZ,HSZ);
369 BOOL      WINAPI DdeSetUserHandle(HCONV,DWORD,DWORD);
370
371 HDDEDATA  WINAPI DdeNameService(DWORD,HSZ,HSZ,UINT);
372 UINT      WINAPI DdeGetLastError(DWORD);
373 UINT      WINAPI DdeQueryConvInfo(HCONV,DWORD,PCONVINFO);
374
375 #ifdef __cplusplus
376 } /* extern "C" */
377 #endif /* defined(__cplusplus) */
378
379 #endif  /* __WINE_DDEML_H */