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.

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