Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

508 lines
17 KiB

  1. /*++ BUILD Version: 0001 // Increment this if a change has global effects --*/
  2. /*****************************************************************************\
  3. * *
  4. * ddeml.h - DDEML API header file *
  5. * *
  6. * Version 3.10 *
  7. * *
  8. * Copyright (c) 1993-95, Microsoft Corp. All rights reserved. *
  9. * *
  10. \*****************************************************************************/
  11. #ifndef _INC_DDEMLH
  12. #define _INC_DDEMLH
  13. #ifdef __cplusplus
  14. extern "C" {
  15. #endif /* __cplusplus */
  16. /******** public types ********/
  17. DECLARE_HANDLE(HCONVLIST);
  18. DECLARE_HANDLE(HCONV);
  19. DECLARE_HANDLE(HSZ);
  20. DECLARE_HANDLE(HDDEDATA);
  21. #define EXPENTRY CALLBACK
  22. /* the following structure is for use with XTYP_WILDCONNECT processing. */
  23. typedef struct tagHSZPAIR {
  24. HSZ hszSvc;
  25. HSZ hszTopic;
  26. } HSZPAIR;
  27. typedef HSZPAIR FAR *PHSZPAIR;
  28. /* The following structure is used by DdeConnect() and DdeConnectList() and
  29. by XTYP_CONNECT and XTYP_WILDCONNECT callbacks. */
  30. typedef struct tagCONVCONTEXT {
  31. UINT cb; /* set to sizeof(CONVCONTEXT) */
  32. UINT wFlags; /* none currently defined. */
  33. UINT wCountryID; /* country code for topic/item strings used. */
  34. int iCodePage; /* codepage used for topic/item strings. */
  35. DWORD dwLangID; /* language ID for topic/item strings. */
  36. DWORD dwSecurity; /* Private security code. */
  37. SECURITY_QUALITY_OF_SERVICE qos; /* client side's quality of service */
  38. } CONVCONTEXT;
  39. typedef CONVCONTEXT FAR *PCONVCONTEXT;
  40. /* The following structure is used by DdeQueryConvInfo(): */
  41. typedef struct tagCONVINFO {
  42. DWORD cb; /* sizeof(CONVINFO) */
  43. DWORD hUser; /* user specified field */
  44. HCONV hConvPartner; /* hConv on other end or 0 if non-ddemgr partner */
  45. HSZ hszSvcPartner; /* app name of partner if obtainable */
  46. HSZ hszServiceReq; /* AppName requested for connection */
  47. HSZ hszTopic; /* Topic name for conversation */
  48. HSZ hszItem; /* transaction item name or NULL if quiescent */
  49. UINT wFmt; /* transaction format or NULL if quiescent */
  50. UINT wType; /* XTYP_ for current transaction */
  51. UINT wStatus; /* ST_ constant for current conversation */
  52. UINT wConvst; /* XST_ constant for current transaction */
  53. UINT wLastError; /* last transaction error. */
  54. HCONVLIST hConvList; /* parent hConvList if this conversation is in a list */
  55. CONVCONTEXT ConvCtxt; /* conversation context */
  56. HWND hwnd; /* window handle for this conversation */
  57. HWND hwndPartner; /* partner window handle for this conversation */
  58. } CONVINFO;
  59. typedef CONVINFO FAR *PCONVINFO;
  60. /***** conversation states (usState) *****/
  61. #define XST_NULL 0 /* quiescent states */
  62. #define XST_INCOMPLETE 1
  63. #define XST_CONNECTED 2
  64. #define XST_INIT1 3 /* mid-initiation states */
  65. #define XST_INIT2 4
  66. #define XST_REQSENT 5 /* active conversation states */
  67. #define XST_DATARCVD 6
  68. #define XST_POKESENT 7
  69. #define XST_POKEACKRCVD 8
  70. #define XST_EXECSENT 9
  71. #define XST_EXECACKRCVD 10
  72. #define XST_ADVSENT 11
  73. #define XST_UNADVSENT 12
  74. #define XST_ADVACKRCVD 13
  75. #define XST_UNADVACKRCVD 14
  76. #define XST_ADVDATASENT 15
  77. #define XST_ADVDATAACKRCVD 16
  78. /* used in LOWORD(dwData1) of XTYP_ADVREQ callbacks... */
  79. #define CADV_LATEACK 0xFFFF
  80. /***** conversation status bits (fsStatus) *****/
  81. #define ST_CONNECTED 0x0001
  82. #define ST_ADVISE 0x0002
  83. #define ST_ISLOCAL 0x0004
  84. #define ST_BLOCKED 0x0008
  85. #define ST_CLIENT 0x0010
  86. #define ST_TERMINATED 0x0020
  87. #define ST_INLIST 0x0040
  88. #define ST_BLOCKNEXT 0x0080
  89. #define ST_ISSELF 0x0100
  90. /* DDE constants for wStatus field */
  91. #define DDE_FACK 0x8000
  92. #define DDE_FBUSY 0x4000
  93. #define DDE_FDEFERUPD 0x4000
  94. #define DDE_FACKREQ 0x8000
  95. #define DDE_FRELEASE 0x2000
  96. #define DDE_FREQUESTED 0x1000
  97. #define DDE_FAPPSTATUS 0x00ff
  98. #define DDE_FNOTPROCESSED 0x0000
  99. #define DDE_FACKRESERVED (~(DDE_FACK | DDE_FBUSY | DDE_FAPPSTATUS))
  100. #define DDE_FADVRESERVED (~(DDE_FACKREQ | DDE_FDEFERUPD))
  101. #define DDE_FDATRESERVED (~(DDE_FACKREQ | DDE_FRELEASE | DDE_FREQUESTED))
  102. #define DDE_FPOKRESERVED (~(DDE_FRELEASE))
  103. /***** message filter hook types *****/
  104. #define MSGF_DDEMGR 0x8001
  105. /***** codepage constants ****/
  106. #define CP_WINANSI 1004 /* default codepage for windows & old DDE convs. */
  107. #define CP_WINUNICODE 1200
  108. /***** transaction types *****/
  109. #define XTYPF_NOBLOCK 0x0002 /* CBR_BLOCK will not work */
  110. #define XTYPF_NODATA 0x0004 /* DDE_FDEFERUPD */
  111. #define XTYPF_ACKREQ 0x0008 /* DDE_FACKREQ */
  112. #define XCLASS_MASK 0xFC00
  113. #define XCLASS_BOOL 0x1000
  114. #define XCLASS_DATA 0x2000
  115. #define XCLASS_FLAGS 0x4000
  116. #define XCLASS_NOTIFICATION 0x8000
  117. #define XTYP_ERROR (0x0000 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK )
  118. #define XTYP_ADVDATA (0x0010 | XCLASS_FLAGS )
  119. #define XTYP_ADVREQ (0x0020 | XCLASS_DATA | XTYPF_NOBLOCK )
  120. #define XTYP_ADVSTART (0x0030 | XCLASS_BOOL )
  121. #define XTYP_ADVSTOP (0x0040 | XCLASS_NOTIFICATION)
  122. #define XTYP_EXECUTE (0x0050 | XCLASS_FLAGS )
  123. #define XTYP_CONNECT (0x0060 | XCLASS_BOOL | XTYPF_NOBLOCK)
  124. #define XTYP_CONNECT_CONFIRM (0x0070 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK)
  125. #define XTYP_XACT_COMPLETE (0x0080 | XCLASS_NOTIFICATION )
  126. #define XTYP_POKE (0x0090 | XCLASS_FLAGS )
  127. #define XTYP_REGISTER (0x00A0 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK)
  128. #define XTYP_REQUEST (0x00B0 | XCLASS_DATA )
  129. #define XTYP_DISCONNECT (0x00C0 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK)
  130. #define XTYP_UNREGISTER (0x00D0 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK)
  131. #define XTYP_WILDCONNECT (0x00E0 | XCLASS_DATA | XTYPF_NOBLOCK)
  132. #define XTYP_MASK 0x00F0
  133. #define XTYP_SHIFT 4 /* shift to turn XTYP_ into an index */
  134. /***** Timeout constants *****/
  135. #define TIMEOUT_ASYNC 0xFFFFFFFF
  136. /***** Transaction ID constants *****/
  137. #define QID_SYNC 0xFFFFFFFF
  138. /****** public strings used in DDE ******/
  139. #ifdef UNICODE
  140. #define SZDDESYS_TOPIC L"System"
  141. #define SZDDESYS_ITEM_TOPICS L"Topics"
  142. #define SZDDESYS_ITEM_SYSITEMS L"SysItems"
  143. #define SZDDESYS_ITEM_RTNMSG L"ReturnMessage"
  144. #define SZDDESYS_ITEM_STATUS L"Status"
  145. #define SZDDESYS_ITEM_FORMATS L"Formats"
  146. #define SZDDESYS_ITEM_HELP L"Help"
  147. #define SZDDE_ITEM_ITEMLIST L"TopicItemList"
  148. #else
  149. #define SZDDESYS_TOPIC "System"
  150. #define SZDDESYS_ITEM_TOPICS "Topics"
  151. #define SZDDESYS_ITEM_SYSITEMS "SysItems"
  152. #define SZDDESYS_ITEM_RTNMSG "ReturnMessage"
  153. #define SZDDESYS_ITEM_STATUS "Status"
  154. #define SZDDESYS_ITEM_FORMATS "Formats"
  155. #define SZDDESYS_ITEM_HELP "Help"
  156. #define SZDDE_ITEM_ITEMLIST "TopicItemList"
  157. #endif
  158. /****** API entry points ******/
  159. typedef HDDEDATA CALLBACK FNCALLBACK(UINT wType, UINT wFmt, HCONV hConv,
  160. HSZ hsz1, HSZ hsz2, HDDEDATA hData, DWORD dwData1, DWORD dwData2);
  161. typedef HDDEDATA (CALLBACK *PFNCALLBACK)(UINT wType, UINT wFmt, HCONV hConv,
  162. HSZ hsz1, HSZ hsz2, HDDEDATA hData, DWORD dwData1, DWORD dwData2);
  163. #define CBR_BLOCK ((HDDEDATA)0xffffffffL)
  164. /* DLL registration functions */
  165. #ifndef UNICODE_ONLY
  166. UINT WINAPI DdeInitializeA(LPDWORD pidInst, PFNCALLBACK pfnCallback,
  167. DWORD afCmd, DWORD ulRes);
  168. #endif //!UNICODE_ONLY
  169. #ifndef ANSI_ONLY
  170. UINT WINAPI DdeInitializeW(LPDWORD pidInst, PFNCALLBACK pfnCallback,
  171. DWORD afCmd, DWORD ulRes);
  172. #endif //!ANSI_ONLY
  173. #ifdef UNICODE
  174. #define DdeInitialize DdeInitializeW
  175. #else
  176. #define DdeInitialize DdeInitializeA
  177. #endif // !UNICODE
  178. /*
  179. * Callback filter flags for use with standard apps.
  180. */
  181. #define CBF_FAIL_SELFCONNECTIONS 0x00001000
  182. #define CBF_FAIL_CONNECTIONS 0x00002000
  183. #define CBF_FAIL_ADVISES 0x00004000
  184. #define CBF_FAIL_EXECUTES 0x00008000
  185. #define CBF_FAIL_POKES 0x00010000
  186. #define CBF_FAIL_REQUESTS 0x00020000
  187. #define CBF_FAIL_ALLSVRXACTIONS 0x0003f000
  188. #define CBF_SKIP_CONNECT_CONFIRMS 0x00040000
  189. #define CBF_SKIP_REGISTRATIONS 0x00080000
  190. #define CBF_SKIP_UNREGISTRATIONS 0x00100000
  191. #define CBF_SKIP_DISCONNECTS 0x00200000
  192. #define CBF_SKIP_ALLNOTIFICATIONS 0x003c0000
  193. /*
  194. * Application command flags
  195. */
  196. #define APPCMD_CLIENTONLY 0x00000010L
  197. #define APPCMD_FILTERINITS 0x00000020L
  198. #define APPCMD_MASK 0x00000FF0L
  199. /*
  200. * Application classification flags
  201. */
  202. #define APPCLASS_STANDARD 0x00000000L
  203. #define APPCLASS_MASK 0x0000000FL
  204. BOOL WINAPI DdeUninitialize(DWORD idInst);
  205. /*
  206. * conversation enumeration functions
  207. */
  208. HCONVLIST WINAPI DdeConnectList(DWORD idInst, HSZ hszService, HSZ hszTopic,
  209. HCONVLIST hConvList, PCONVCONTEXT pCC);
  210. HCONV WINAPI DdeQueryNextServer(HCONVLIST hConvList, HCONV hConvPrev);
  211. BOOL WINAPI DdeDisconnectList(HCONVLIST hConvList);
  212. /*
  213. * conversation control functions
  214. */
  215. HCONV WINAPI DdeConnect(DWORD idInst, HSZ hszService, HSZ hszTopic,
  216. PCONVCONTEXT pCC);
  217. BOOL WINAPI DdeDisconnect(HCONV hConv);
  218. HCONV WINAPI DdeReconnect(HCONV hConv);
  219. UINT WINAPI DdeQueryConvInfo(HCONV hConv, DWORD idTransaction, PCONVINFO pConvInfo);
  220. BOOL WINAPI DdeSetUserHandle(HCONV hConv, DWORD id, DWORD hUser);
  221. BOOL WINAPI DdeAbandonTransaction(DWORD idInst, HCONV hConv, DWORD idTransaction);
  222. /*
  223. * app server interface functions
  224. */
  225. BOOL WINAPI DdePostAdvise(DWORD idInst, HSZ hszTopic, HSZ hszItem);
  226. BOOL WINAPI DdeEnableCallback(DWORD idInst, HCONV hConv, UINT wCmd);
  227. BOOL WINAPI DdeImpersonateClient(HCONV hConv);
  228. #define EC_ENABLEALL 0
  229. #define EC_ENABLEONE ST_BLOCKNEXT
  230. #define EC_DISABLE ST_BLOCKED
  231. #define EC_QUERYWAITING 2
  232. HDDEDATA WINAPI DdeNameService(DWORD idInst, HSZ hsz1, HSZ hsz2, UINT afCmd);
  233. #define DNS_REGISTER 0x0001
  234. #define DNS_UNREGISTER 0x0002
  235. #define DNS_FILTERON 0x0004
  236. #define DNS_FILTEROFF 0x0008
  237. /*
  238. * app client interface functions
  239. */
  240. HDDEDATA WINAPI DdeClientTransaction(LPBYTE pData, DWORD cbData,
  241. HCONV hConv, HSZ hszItem, UINT wFmt, UINT wType,
  242. DWORD dwTimeout, LPDWORD pdwResult);
  243. /*
  244. *data transfer functions
  245. */
  246. HDDEDATA WINAPI DdeCreateDataHandle(DWORD idInst, LPBYTE pSrc, DWORD cb,
  247. DWORD cbOff, HSZ hszItem, UINT wFmt, UINT afCmd);
  248. HDDEDATA WINAPI DdeAddData(HDDEDATA hData, LPBYTE pSrc, DWORD cb, DWORD cbOff);
  249. DWORD WINAPI DdeGetData(HDDEDATA hData, LPBYTE pDst, DWORD cbMax, DWORD cbOff);
  250. LPBYTE WINAPI DdeAccessData(HDDEDATA hData, LPDWORD pcbDataSize);
  251. BOOL WINAPI DdeUnaccessData(HDDEDATA hData);
  252. BOOL WINAPI DdeFreeDataHandle(HDDEDATA hData);
  253. #define HDATA_APPOWNED 0x0001
  254. UINT WINAPI DdeGetLastError(DWORD idInst);
  255. #define DMLERR_NO_ERROR 0 /* must be 0 */
  256. #define DMLERR_FIRST 0x4000
  257. #define DMLERR_ADVACKTIMEOUT 0x4000
  258. #define DMLERR_BUSY 0x4001
  259. #define DMLERR_DATAACKTIMEOUT 0x4002
  260. #define DMLERR_DLL_NOT_INITIALIZED 0x4003
  261. #define DMLERR_DLL_USAGE 0x4004
  262. #define DMLERR_EXECACKTIMEOUT 0x4005
  263. #define DMLERR_INVALIDPARAMETER 0x4006
  264. #define DMLERR_LOW_MEMORY 0x4007
  265. #define DMLERR_MEMORY_ERROR 0x4008
  266. #define DMLERR_NOTPROCESSED 0x4009
  267. #define DMLERR_NO_CONV_ESTABLISHED 0x400a
  268. #define DMLERR_POKEACKTIMEOUT 0x400b
  269. #define DMLERR_POSTMSG_FAILED 0x400c
  270. #define DMLERR_REENTRANCY 0x400d
  271. #define DMLERR_SERVER_DIED 0x400e
  272. #define DMLERR_SYS_ERROR 0x400f
  273. #define DMLERR_UNADVACKTIMEOUT 0x4010
  274. #define DMLERR_UNFOUND_QUEUE_ID 0x4011
  275. #define DMLERR_LAST 0x4011
  276. #ifndef UNICODE_ONLY
  277. HSZ WINAPI DdeCreateStringHandleA(DWORD idInst, LPCSTR psz, int iCodePage);
  278. #endif //!UNICODE_ONLY
  279. #ifndef ANSI_ONLY
  280. HSZ WINAPI DdeCreateStringHandleW(DWORD idInst, LPCWSTR psz, int iCodePage);
  281. #endif //!ANSI_ONLY
  282. #ifdef UNICODE
  283. #define DdeCreateStringHandle DdeCreateStringHandleW
  284. #else
  285. #define DdeCreateStringHandle DdeCreateStringHandleA
  286. #endif // !UNICODE
  287. #ifndef UNICODE_ONLY
  288. DWORD WINAPI DdeQueryStringA(DWORD idInst, HSZ hsz, LPSTR psz, DWORD cchMax, int iCodePage);
  289. #endif //!UNICODE_ONLY
  290. #ifndef ANSI_ONLY
  291. DWORD WINAPI DdeQueryStringW(DWORD idInst, HSZ hsz, LPWSTR psz, DWORD cchMax, int iCodePage);
  292. #endif //!ANSI_ONLY
  293. #ifdef UNICODE
  294. #define DdeQueryString DdeQueryStringW
  295. #else
  296. #define DdeQueryString DdeQueryStringA
  297. #endif // !UNICODE
  298. BOOL WINAPI DdeFreeStringHandle(DWORD idInst, HSZ hsz);
  299. BOOL WINAPI DdeKeepStringHandle(DWORD idInst, HSZ hsz);
  300. int WINAPI DdeCmpStringHandles(HSZ hsz1, HSZ hsz2);
  301. #ifndef NODDEMLSPY
  302. /*
  303. * DDEML public debugging header file info
  304. */
  305. typedef struct tagDDEML_MSG_HOOK_DATA { // new for NT
  306. UINT uiLo; // unpacked lo and hi parts of lParam
  307. UINT uiHi;
  308. DWORD cbData; // amount of data in message, if any. May be > than 32 bytes.
  309. DWORD Data[8]; // data peeking by DDESPY is limited to 32 bytes.
  310. } DDEML_MSG_HOOK_DATA, *PDDEML_MSG_HOOK_DATA;
  311. typedef struct tagMONMSGSTRUCT {
  312. UINT cb;
  313. HWND hwndTo;
  314. DWORD dwTime;
  315. HANDLE hTask;
  316. UINT wMsg;
  317. WPARAM wParam;
  318. LPARAM lParam;
  319. DDEML_MSG_HOOK_DATA dmhd; // new for NT
  320. } MONMSGSTRUCT, *PMONMSGSTRUCT;
  321. typedef struct tagMONCBSTRUCT {
  322. UINT cb;
  323. DWORD dwTime;
  324. HANDLE hTask;
  325. DWORD dwRet;
  326. UINT wType;
  327. UINT wFmt;
  328. HCONV hConv;
  329. HSZ hsz1;
  330. HSZ hsz2;
  331. HDDEDATA hData;
  332. DWORD dwData1;
  333. DWORD dwData2;
  334. CONVCONTEXT cc; // new for NT for XTYP_CONNECT callbacks
  335. DWORD cbData; // new for NT for data peeking
  336. DWORD Data[8]; // new for NT for data peeking
  337. } MONCBSTRUCT, *PMONCBSTRUCT;
  338. #ifndef UNICODE_ONLY
  339. typedef struct tagMONHSZSTRUCTA {
  340. UINT cb;
  341. BOOL fsAction; /* MH_ value */
  342. DWORD dwTime;
  343. HSZ hsz;
  344. HANDLE hTask;
  345. CHAR str[1];
  346. } MONHSZSTRUCTA, *PMONHSZSTRUCTA;
  347. #endif //!UNICODE_ONLY
  348. #ifndef ANSI_ONLY
  349. typedef struct tagMONHSZSTRUCTW {
  350. UINT cb;
  351. BOOL fsAction; /* MH_ value */
  352. DWORD dwTime;
  353. HSZ hsz;
  354. HANDLE hTask;
  355. WCHAR str[1];
  356. } MONHSZSTRUCTW, *PMONHSZSTRUCTW;
  357. #endif //!ANSI_ONLY
  358. #ifdef UNICODE
  359. typedef MONHSZSTRUCTW MONHSZSTRUCT;
  360. typedef PMONHSZSTRUCTW PMONHSZSTRUCT;
  361. #else
  362. typedef MONHSZSTRUCTA MONHSZSTRUCT;
  363. typedef PMONHSZSTRUCTA PMONHSZSTRUCT;
  364. #endif // UNICODE
  365. #define MH_CREATE 1
  366. #define MH_KEEP 2
  367. #define MH_DELETE 3
  368. #define MH_CLEANUP 4
  369. typedef struct tagMONERRSTRUCT {
  370. UINT cb;
  371. UINT wLastError;
  372. DWORD dwTime;
  373. HANDLE hTask;
  374. } MONERRSTRUCT, *PMONERRSTRUCT;
  375. typedef struct tagMONLINKSTRUCT {
  376. UINT cb;
  377. DWORD dwTime;
  378. HANDLE hTask;
  379. BOOL fEstablished;
  380. BOOL fNoData;
  381. HSZ hszSvc;
  382. HSZ hszTopic;
  383. HSZ hszItem;
  384. UINT wFmt;
  385. BOOL fServer;
  386. HCONV hConvServer;
  387. HCONV hConvClient;
  388. } MONLINKSTRUCT, *PMONLINKSTRUCT;
  389. typedef struct tagMONCONVSTRUCT {
  390. UINT cb;
  391. BOOL fConnect;
  392. DWORD dwTime;
  393. HANDLE hTask;
  394. HSZ hszSvc;
  395. HSZ hszTopic;
  396. HCONV hConvClient; // Globally unique value != apps local hConv
  397. HCONV hConvServer; // Globally unique value != apps local hConv
  398. } MONCONVSTRUCT, *PMONCONVSTRUCT;
  399. #define MAX_MONITORS 4
  400. #define APPCLASS_MONITOR 0x00000001L
  401. #define XTYP_MONITOR (0x00F0 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK)
  402. /*
  403. * Callback filter flags for use with MONITOR apps - 0 implies no monitor
  404. * callbacks.
  405. */
  406. #define MF_HSZ_INFO 0x01000000
  407. #define MF_SENDMSGS 0x02000000
  408. #define MF_POSTMSGS 0x04000000
  409. #define MF_CALLBACKS 0x08000000
  410. #define MF_ERRORS 0x10000000
  411. #define MF_LINKS 0x20000000
  412. #define MF_CONV 0x40000000
  413. #define MF_MASK 0xFF000000
  414. #endif /* NODDEMLSPY */
  415. #ifdef __cplusplus
  416. }
  417. #endif /* __cplusplus */
  418. #endif /* _INC_DDEMLH */