Leaked source code of windows server 2003
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.

494 lines
18 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) Microsoft Corporation. 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_PTR 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. #ifdef UNICODE
  109. #define CP_WINNEUTRAL CP_WINUNICODE
  110. #else // !UNICODE
  111. #define CP_WINNEUTRAL CP_WINANSI
  112. #endif // !UNICODE
  113. /***** transaction types *****/
  114. #define XTYPF_NOBLOCK 0x0002 /* CBR_BLOCK will not work */
  115. #define XTYPF_NODATA 0x0004 /* DDE_FDEFERUPD */
  116. #define XTYPF_ACKREQ 0x0008 /* DDE_FACKREQ */
  117. #define XCLASS_MASK 0xFC00
  118. #define XCLASS_BOOL 0x1000
  119. #define XCLASS_DATA 0x2000
  120. #define XCLASS_FLAGS 0x4000
  121. #define XCLASS_NOTIFICATION 0x8000
  122. #define XTYP_ERROR (0x0000 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK )
  123. #define XTYP_ADVDATA (0x0010 | XCLASS_FLAGS )
  124. #define XTYP_ADVREQ (0x0020 | XCLASS_DATA | XTYPF_NOBLOCK )
  125. #define XTYP_ADVSTART (0x0030 | XCLASS_BOOL )
  126. #define XTYP_ADVSTOP (0x0040 | XCLASS_NOTIFICATION)
  127. #define XTYP_EXECUTE (0x0050 | XCLASS_FLAGS )
  128. #define XTYP_CONNECT (0x0060 | XCLASS_BOOL | XTYPF_NOBLOCK)
  129. #define XTYP_CONNECT_CONFIRM (0x0070 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK)
  130. #define XTYP_XACT_COMPLETE (0x0080 | XCLASS_NOTIFICATION )
  131. #define XTYP_POKE (0x0090 | XCLASS_FLAGS )
  132. #define XTYP_REGISTER (0x00A0 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK)
  133. #define XTYP_REQUEST (0x00B0 | XCLASS_DATA )
  134. #define XTYP_DISCONNECT (0x00C0 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK)
  135. #define XTYP_UNREGISTER (0x00D0 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK)
  136. #define XTYP_WILDCONNECT (0x00E0 | XCLASS_DATA | XTYPF_NOBLOCK)
  137. #define XTYP_MASK 0x00F0
  138. #define XTYP_SHIFT 4 /* shift to turn XTYP_ into an index */
  139. /***** Timeout constants *****/
  140. #define TIMEOUT_ASYNC 0xFFFFFFFF
  141. /***** Transaction ID constants *****/
  142. #define QID_SYNC 0xFFFFFFFF
  143. /****** public strings used in DDE ******/
  144. #ifdef UNICODE
  145. #define SZDDESYS_TOPIC L"System"
  146. #define SZDDESYS_ITEM_TOPICS L"Topics"
  147. #define SZDDESYS_ITEM_SYSITEMS L"SysItems"
  148. #define SZDDESYS_ITEM_RTNMSG L"ReturnMessage"
  149. #define SZDDESYS_ITEM_STATUS L"Status"
  150. #define SZDDESYS_ITEM_FORMATS L"Formats"
  151. #define SZDDESYS_ITEM_HELP L"Help"
  152. #define SZDDE_ITEM_ITEMLIST L"TopicItemList"
  153. #else
  154. #define SZDDESYS_TOPIC "System"
  155. #define SZDDESYS_ITEM_TOPICS "Topics"
  156. #define SZDDESYS_ITEM_SYSITEMS "SysItems"
  157. #define SZDDESYS_ITEM_RTNMSG "ReturnMessage"
  158. #define SZDDESYS_ITEM_STATUS "Status"
  159. #define SZDDESYS_ITEM_FORMATS "Formats"
  160. #define SZDDESYS_ITEM_HELP "Help"
  161. #define SZDDE_ITEM_ITEMLIST "TopicItemList"
  162. #endif
  163. /****** API entry points ******/
  164. typedef HDDEDATA CALLBACK FNCALLBACK(UINT wType, UINT wFmt, HCONV hConv,
  165. HSZ hsz1, HSZ hsz2, HDDEDATA hData, ULONG_PTR dwData1, ULONG_PTR dwData2);
  166. typedef HDDEDATA (CALLBACK *PFNCALLBACK)(UINT wType, UINT wFmt, HCONV hConv,
  167. HSZ hsz1, HSZ hsz2, HDDEDATA hData, ULONG_PTR dwData1, ULONG_PTR dwData2);
  168. #define CBR_BLOCK ((HDDEDATA)-1)
  169. /* DLL registration functions */
  170. UINT WINAPI DdeInitializeA( IN OUT LPDWORD pidInst, IN PFNCALLBACK pfnCallback,
  171. IN DWORD afCmd, IN DWORD ulRes);
  172. UINT WINAPI DdeInitializeW( IN OUT LPDWORD pidInst, IN PFNCALLBACK pfnCallback,
  173. IN DWORD afCmd, IN DWORD ulRes);
  174. #ifdef UNICODE
  175. #define DdeInitialize DdeInitializeW
  176. #else
  177. #define DdeInitialize DdeInitializeA
  178. #endif // !UNICODE
  179. /*
  180. * Callback filter flags for use with standard apps.
  181. */
  182. #define CBF_FAIL_SELFCONNECTIONS 0x00001000
  183. #define CBF_FAIL_CONNECTIONS 0x00002000
  184. #define CBF_FAIL_ADVISES 0x00004000
  185. #define CBF_FAIL_EXECUTES 0x00008000
  186. #define CBF_FAIL_POKES 0x00010000
  187. #define CBF_FAIL_REQUESTS 0x00020000
  188. #define CBF_FAIL_ALLSVRXACTIONS 0x0003f000
  189. #define CBF_SKIP_CONNECT_CONFIRMS 0x00040000
  190. #define CBF_SKIP_REGISTRATIONS 0x00080000
  191. #define CBF_SKIP_UNREGISTRATIONS 0x00100000
  192. #define CBF_SKIP_DISCONNECTS 0x00200000
  193. #define CBF_SKIP_ALLNOTIFICATIONS 0x003c0000
  194. /*
  195. * Application command flags
  196. */
  197. #define APPCMD_CLIENTONLY 0x00000010L
  198. #define APPCMD_FILTERINITS 0x00000020L
  199. #define APPCMD_MASK 0x00000FF0L
  200. /*
  201. * Application classification flags
  202. */
  203. #define APPCLASS_STANDARD 0x00000000L
  204. #define APPCLASS_MASK 0x0000000FL
  205. BOOL WINAPI DdeUninitialize( IN DWORD idInst);
  206. /*
  207. * conversation enumeration functions
  208. */
  209. HCONVLIST WINAPI DdeConnectList( IN DWORD idInst, IN HSZ hszService, IN HSZ hszTopic,
  210. IN HCONVLIST hConvList, IN PCONVCONTEXT pCC);
  211. HCONV WINAPI DdeQueryNextServer( IN HCONVLIST hConvList, IN HCONV hConvPrev);
  212. BOOL WINAPI DdeDisconnectList( IN HCONVLIST hConvList);
  213. /*
  214. * conversation control functions
  215. */
  216. HCONV WINAPI DdeConnect( IN DWORD idInst, IN HSZ hszService, IN HSZ hszTopic,
  217. IN PCONVCONTEXT pCC);
  218. BOOL WINAPI DdeDisconnect( IN OUT HCONV hConv);
  219. HCONV WINAPI DdeReconnect( IN HCONV hConv);
  220. UINT WINAPI DdeQueryConvInfo( IN HCONV hConv, IN DWORD idTransaction, IN OUT PCONVINFO pConvInfo);
  221. BOOL WINAPI DdeSetUserHandle( IN HCONV hConv, IN DWORD id, IN DWORD_PTR hUser);
  222. BOOL WINAPI DdeAbandonTransaction( IN DWORD idInst, IN HCONV hConv, IN DWORD idTransaction);
  223. /*
  224. * app server interface functions
  225. */
  226. BOOL WINAPI DdePostAdvise( IN DWORD idInst, IN HSZ hszTopic, IN HSZ hszItem);
  227. BOOL WINAPI DdeEnableCallback( IN DWORD idInst, IN HCONV hConv, IN UINT wCmd);
  228. BOOL WINAPI DdeImpersonateClient( IN HCONV hConv);
  229. #define EC_ENABLEALL 0
  230. #define EC_ENABLEONE ST_BLOCKNEXT
  231. #define EC_DISABLE ST_BLOCKED
  232. #define EC_QUERYWAITING 2
  233. HDDEDATA WINAPI DdeNameService( IN DWORD idInst, IN HSZ hsz1, IN HSZ hsz2, IN UINT afCmd);
  234. #define DNS_REGISTER 0x0001
  235. #define DNS_UNREGISTER 0x0002
  236. #define DNS_FILTERON 0x0004
  237. #define DNS_FILTEROFF 0x0008
  238. /*
  239. * app client interface functions
  240. */
  241. HDDEDATA WINAPI DdeClientTransaction( IN LPBYTE pData, IN DWORD cbData,
  242. IN HCONV hConv, IN HSZ hszItem, IN UINT wFmt, IN UINT wType,
  243. IN DWORD dwTimeout, OUT LPDWORD pdwResult);
  244. /*
  245. *data transfer functions
  246. */
  247. HDDEDATA WINAPI DdeCreateDataHandle( IN DWORD idInst, IN LPBYTE pSrc, IN DWORD cb,
  248. IN DWORD cbOff, IN HSZ hszItem, IN UINT wFmt, IN UINT afCmd);
  249. HDDEDATA WINAPI DdeAddData( IN HDDEDATA hData, IN LPBYTE pSrc, IN DWORD cb, IN DWORD cbOff);
  250. DWORD WINAPI DdeGetData( IN HDDEDATA hData, OUT LPBYTE pDst, IN DWORD cbMax, IN DWORD cbOff);
  251. LPBYTE WINAPI DdeAccessData( IN HDDEDATA hData, OUT LPDWORD pcbDataSize);
  252. BOOL WINAPI DdeUnaccessData( IN HDDEDATA hData);
  253. BOOL WINAPI DdeFreeDataHandle( IN OUT HDDEDATA hData);
  254. #define HDATA_APPOWNED 0x0001
  255. UINT WINAPI DdeGetLastError( IN DWORD idInst);
  256. #define DMLERR_NO_ERROR 0 /* must be 0 */
  257. #define DMLERR_FIRST 0x4000
  258. #define DMLERR_ADVACKTIMEOUT 0x4000
  259. #define DMLERR_BUSY 0x4001
  260. #define DMLERR_DATAACKTIMEOUT 0x4002
  261. #define DMLERR_DLL_NOT_INITIALIZED 0x4003
  262. #define DMLERR_DLL_USAGE 0x4004
  263. #define DMLERR_EXECACKTIMEOUT 0x4005
  264. #define DMLERR_INVALIDPARAMETER 0x4006
  265. #define DMLERR_LOW_MEMORY 0x4007
  266. #define DMLERR_MEMORY_ERROR 0x4008
  267. #define DMLERR_NOTPROCESSED 0x4009
  268. #define DMLERR_NO_CONV_ESTABLISHED 0x400a
  269. #define DMLERR_POKEACKTIMEOUT 0x400b
  270. #define DMLERR_POSTMSG_FAILED 0x400c
  271. #define DMLERR_REENTRANCY 0x400d
  272. #define DMLERR_SERVER_DIED 0x400e
  273. #define DMLERR_SYS_ERROR 0x400f
  274. #define DMLERR_UNADVACKTIMEOUT 0x4010
  275. #define DMLERR_UNFOUND_QUEUE_ID 0x4011
  276. #define DMLERR_LAST 0x4011
  277. HSZ WINAPI DdeCreateStringHandleA( IN DWORD idInst, IN LPCSTR psz, IN int iCodePage);
  278. HSZ WINAPI DdeCreateStringHandleW( IN DWORD idInst, IN LPCWSTR psz, IN int iCodePage);
  279. #ifdef UNICODE
  280. #define DdeCreateStringHandle DdeCreateStringHandleW
  281. #else
  282. #define DdeCreateStringHandle DdeCreateStringHandleA
  283. #endif // !UNICODE
  284. DWORD WINAPI DdeQueryStringA( IN DWORD idInst, IN HSZ hsz, IN OUT LPSTR psz, IN DWORD cchMax, IN int iCodePage);
  285. DWORD WINAPI DdeQueryStringW( IN DWORD idInst, IN HSZ hsz, IN OUT LPWSTR psz, IN DWORD cchMax, IN int iCodePage);
  286. #ifdef UNICODE
  287. #define DdeQueryString DdeQueryStringW
  288. #else
  289. #define DdeQueryString DdeQueryStringA
  290. #endif // !UNICODE
  291. BOOL WINAPI DdeFreeStringHandle( IN DWORD idInst, IN OUT HSZ hsz);
  292. BOOL WINAPI DdeKeepStringHandle( IN DWORD idInst, IN OUT HSZ hsz);
  293. int WINAPI DdeCmpStringHandles( IN HSZ hsz1, IN HSZ hsz2);
  294. #ifndef NODDEMLSPY
  295. /*
  296. * DDEML public debugging header file info
  297. */
  298. typedef struct tagDDEML_MSG_HOOK_DATA { // new for NT
  299. UINT_PTR uiLo; // unpacked lo and hi parts of lParam
  300. UINT_PTR uiHi;
  301. DWORD cbData; // amount of data in message, if any. May be > than 32 bytes.
  302. DWORD Data[8]; // data peeking by DDESPY is limited to 32 bytes.
  303. } DDEML_MSG_HOOK_DATA, *PDDEML_MSG_HOOK_DATA;
  304. typedef struct tagMONMSGSTRUCT {
  305. UINT cb;
  306. HWND hwndTo;
  307. DWORD dwTime;
  308. HANDLE hTask;
  309. UINT wMsg;
  310. WPARAM wParam;
  311. LPARAM lParam;
  312. DDEML_MSG_HOOK_DATA dmhd; // new for NT
  313. } MONMSGSTRUCT, *PMONMSGSTRUCT;
  314. typedef struct tagMONCBSTRUCT {
  315. UINT cb;
  316. DWORD dwTime;
  317. HANDLE hTask;
  318. DWORD dwRet;
  319. UINT wType;
  320. UINT wFmt;
  321. HCONV hConv;
  322. HSZ hsz1;
  323. HSZ hsz2;
  324. HDDEDATA hData;
  325. ULONG_PTR dwData1;
  326. ULONG_PTR dwData2;
  327. CONVCONTEXT cc; // new for NT for XTYP_CONNECT callbacks
  328. DWORD cbData; // new for NT for data peeking
  329. DWORD Data[8]; // new for NT for data peeking
  330. } MONCBSTRUCT, *PMONCBSTRUCT;
  331. typedef struct tagMONHSZSTRUCTA {
  332. UINT cb;
  333. BOOL fsAction; /* MH_ value */
  334. DWORD dwTime;
  335. HSZ hsz;
  336. HANDLE hTask;
  337. CHAR str[1];
  338. } MONHSZSTRUCTA, *PMONHSZSTRUCTA;
  339. typedef struct tagMONHSZSTRUCTW {
  340. UINT cb;
  341. BOOL fsAction; /* MH_ value */
  342. DWORD dwTime;
  343. HSZ hsz;
  344. HANDLE hTask;
  345. WCHAR str[1];
  346. } MONHSZSTRUCTW, *PMONHSZSTRUCTW;
  347. #ifdef UNICODE
  348. typedef MONHSZSTRUCTW MONHSZSTRUCT;
  349. typedef PMONHSZSTRUCTW PMONHSZSTRUCT;
  350. #else
  351. typedef MONHSZSTRUCTA MONHSZSTRUCT;
  352. typedef PMONHSZSTRUCTA PMONHSZSTRUCT;
  353. #endif // UNICODE
  354. #define MH_CREATE 1
  355. #define MH_KEEP 2
  356. #define MH_DELETE 3
  357. #define MH_CLEANUP 4
  358. typedef struct tagMONERRSTRUCT {
  359. UINT cb;
  360. UINT wLastError;
  361. DWORD dwTime;
  362. HANDLE hTask;
  363. } MONERRSTRUCT, *PMONERRSTRUCT;
  364. typedef struct tagMONLINKSTRUCT {
  365. UINT cb;
  366. DWORD dwTime;
  367. HANDLE hTask;
  368. BOOL fEstablished;
  369. BOOL fNoData;
  370. HSZ hszSvc;
  371. HSZ hszTopic;
  372. HSZ hszItem;
  373. UINT wFmt;
  374. BOOL fServer;
  375. HCONV hConvServer;
  376. HCONV hConvClient;
  377. } MONLINKSTRUCT, *PMONLINKSTRUCT;
  378. typedef struct tagMONCONVSTRUCT {
  379. UINT cb;
  380. BOOL fConnect;
  381. DWORD dwTime;
  382. HANDLE hTask;
  383. HSZ hszSvc;
  384. HSZ hszTopic;
  385. HCONV hConvClient; // Globally unique value != apps local hConv
  386. HCONV hConvServer; // Globally unique value != apps local hConv
  387. } MONCONVSTRUCT, *PMONCONVSTRUCT;
  388. #define MAX_MONITORS 4
  389. #define APPCLASS_MONITOR 0x00000001L
  390. #define XTYP_MONITOR (0x00F0 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK)
  391. /*
  392. * Callback filter flags for use with MONITOR apps - 0 implies no monitor
  393. * callbacks.
  394. */
  395. #define MF_HSZ_INFO 0x01000000
  396. #define MF_SENDMSGS 0x02000000
  397. #define MF_POSTMSGS 0x04000000
  398. #define MF_CALLBACKS 0x08000000
  399. #define MF_ERRORS 0x10000000
  400. #define MF_LINKS 0x20000000
  401. #define MF_CONV 0x40000000
  402. #define MF_MASK 0xFF000000
  403. #endif /* NODDEMLSPY */
  404. #ifdef __cplusplus
  405. }
  406. #endif /* __cplusplus */
  407. #endif /* _INC_DDEMLH */