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.

452 lines
15 KiB

  1. /************************************************************************
  2. * Copyright (c) Wonderware Software Development Corp. 1991-1993. *
  3. * All Rights Reserved. *
  4. * Copyright (c) Microsoft Inc. 1995 *
  5. * All Rights Reserved. *
  6. ************************************************************************/
  7. #ifndef _INC_NDDEAPI
  8. #define _INC_NDDEAPI
  9. #include <pshpack1.h> /* Assume byte packing throughout */
  10. #ifdef __cplusplus
  11. extern "C" { /* Assume C declarations for C++ */
  12. #endif /* __cplusplus */
  13. #ifndef CNLEN /* If not included with netapi header */
  14. #define CNLEN 15 /* Computer name length */
  15. #define UNCLEN (CNLEN+2) /* UNC computer name length */
  16. #endif /* CNLEN */
  17. // the choice of this char affects legal share,topic, etc. names
  18. #define SEP_CHAR ','
  19. #define BAR_CHAR "|"
  20. #define SEP_WCHAR L','
  21. #define BAR_WCHAR L"|"
  22. /* API error codes */
  23. #define NDDE_NO_ERROR 0
  24. #define NDDE_ACCESS_DENIED 1
  25. #define NDDE_BUF_TOO_SMALL 2
  26. #define NDDE_ERROR_MORE_DATA 3
  27. #define NDDE_INVALID_SERVER 4
  28. #define NDDE_INVALID_SHARE 5
  29. #define NDDE_INVALID_PARAMETER 6
  30. #define NDDE_INVALID_LEVEL 7
  31. #define NDDE_INVALID_PASSWORD 8
  32. #define NDDE_INVALID_ITEMNAME 9
  33. #define NDDE_INVALID_TOPIC 10
  34. #define NDDE_INTERNAL_ERROR 11
  35. #define NDDE_OUT_OF_MEMORY 12
  36. #define NDDE_INVALID_APPNAME 13
  37. #define NDDE_NOT_IMPLEMENTED 14
  38. #define NDDE_SHARE_ALREADY_EXIST 15
  39. #define NDDE_SHARE_NOT_EXIST 16
  40. #define NDDE_INVALID_FILENAME 17
  41. #define NDDE_NOT_RUNNING 18
  42. #define NDDE_INVALID_WINDOW 19
  43. #define NDDE_INVALID_SESSION 20
  44. #define NDDE_INVALID_ITEM_LIST 21
  45. #define NDDE_SHARE_DATA_CORRUPTED 22
  46. #define NDDE_REGISTRY_ERROR 23
  47. #define NDDE_CANT_ACCESS_SERVER 24
  48. #define NDDE_INVALID_SPECIAL_COMMAND 25
  49. #define NDDE_INVALID_SECURITY_DESC 26
  50. #define NDDE_TRUST_SHARE_FAIL 27
  51. /* string size constants */
  52. #define MAX_NDDESHARENAME 256
  53. #define MAX_DOMAINNAME 15
  54. #define MAX_USERNAME 15
  55. #define MAX_APPNAME 255
  56. #define MAX_TOPICNAME 255
  57. #define MAX_ITEMNAME 255
  58. /* connectFlags bits for ndde service affix */
  59. #define NDDEF_NOPASSWORDPROMPT 0x0001
  60. #define NDDEF_NOCACHELOOKUP 0x0002
  61. #define NDDEF_STRIP_NDDE 0x0004
  62. /* NDDESHAREINFO - contains information about a NDDE share */
  63. struct NDdeShareInfo_tag {
  64. LONG lRevision;
  65. LPTSTR lpszShareName;
  66. LONG lShareType;
  67. LPTSTR lpszAppTopicList;
  68. LONG fSharedFlag;
  69. LONG fService;
  70. LONG fStartAppFlag;
  71. LONG nCmdShow;
  72. LONG qModifyId[2];
  73. LONG cNumItems;
  74. LPTSTR lpszItemList;
  75. };
  76. typedef struct NDdeShareInfo_tag NDDESHAREINFO;
  77. typedef struct NDdeShareInfo_tag * PNDDESHAREINFO;
  78. /* Share Types */
  79. #define SHARE_TYPE_OLD 0x01 // Excel|sheet1.xls
  80. #define SHARE_TYPE_NEW 0x02 // ExcelWorksheet|sheet1.xls
  81. #define SHARE_TYPE_STATIC 0x04 // ClipSrv|SalesData
  82. #ifndef UNICODE_ONLY
  83. /*
  84. Add new share
  85. */
  86. UINT WINAPI
  87. NDdeShareAddA (
  88. LPSTR lpszServer, // server to execute on ( must be NULL )
  89. UINT nLevel, // info level must be 2
  90. PSECURITY_DESCRIPTOR pSD, // initial security descriptor (optional)
  91. LPBYTE lpBuffer, // contains (NDDESHAREINFO) + data
  92. DWORD cBufSize // sizeof supplied buffer
  93. );
  94. #endif //!UNICODE_ONLY
  95. #ifndef ANSI_ONLY
  96. UINT WINAPI
  97. NDdeShareAddW (
  98. LPWSTR lpszServer, // server to execute on ( must be NULL )
  99. UINT nLevel, // info level must be 2
  100. PSECURITY_DESCRIPTOR pSD, // initial security descriptor (optional)
  101. LPBYTE lpBuffer, // contains (NDDESHAREINFO) + data
  102. DWORD cBufSize // sizeof supplied buffer
  103. );
  104. #endif //!ANSI_ONLY
  105. #ifndef UNICODE_ONLY
  106. /*
  107. Delete a share
  108. */
  109. UINT WINAPI
  110. NDdeShareDelA (
  111. LPSTR lpszServer, // server to execute on ( must be NULL )
  112. LPSTR lpszShareName, // name of share to delete
  113. UINT wReserved // reserved for force level (?) 0 for now
  114. );
  115. #endif //!UNICODE_ONLY
  116. #ifndef ANSI_ONLY
  117. UINT WINAPI
  118. NDdeShareDelW (
  119. LPWSTR lpszServer, // server to execute on ( must be NULL )
  120. LPWSTR lpszShareName, // name of share to delete
  121. UINT wReserved // reserved for force level (?) 0 for now
  122. );
  123. #endif //!ANSI_ONLY
  124. /*
  125. Get Share Security Descriptor
  126. */
  127. #ifndef UNICODE_ONLY
  128. UINT WINAPI
  129. NDdeGetShareSecurityA(
  130. LPSTR lpszServer, // server to execute on ( must be NULL )
  131. LPSTR lpszShareName, // name of share to delete
  132. SECURITY_INFORMATION si, // requested information
  133. PSECURITY_DESCRIPTOR pSD, // address of security descriptor
  134. DWORD cbSD, // size of buffer for security descriptor
  135. LPDWORD lpcbsdRequired // address of required size of buffer
  136. );
  137. #endif //!UNICODE_ONLY
  138. #ifndef ANSI_ONLY
  139. UINT WINAPI
  140. NDdeGetShareSecurityW(
  141. LPWSTR lpszServer, // server to execute on ( must be NULL )
  142. LPWSTR lpszShareName, // name of share to delete
  143. SECURITY_INFORMATION si, // requested information
  144. PSECURITY_DESCRIPTOR pSD, // address of security descriptor
  145. DWORD cbSD, // size of buffer for security descriptor
  146. LPDWORD lpcbsdRequired // address of required size of buffer
  147. );
  148. #endif //!ANSI_ONLY
  149. /*
  150. Set Share Security Descriptor
  151. */
  152. #ifndef UNICODE_ONLY
  153. UINT WINAPI
  154. NDdeSetShareSecurityA(
  155. LPSTR lpszServer, // server to execute on ( must be NULL )
  156. LPSTR lpszShareName, // name of share to delete
  157. SECURITY_INFORMATION si, // type of information to set
  158. PSECURITY_DESCRIPTOR pSD // address of security descriptor
  159. );
  160. #endif //!UNICODE_ONLY
  161. #ifndef ANSI_ONLY
  162. UINT WINAPI
  163. NDdeSetShareSecurityW(
  164. LPWSTR lpszServer, // server to execute on ( must be NULL )
  165. LPWSTR lpszShareName, // name of share to delete
  166. SECURITY_INFORMATION si, // type of information to set
  167. PSECURITY_DESCRIPTOR pSD // address of security descriptor
  168. );
  169. #endif //!ANSI_ONLY
  170. #ifndef UNICODE_ONLY
  171. /*
  172. Enumerate shares
  173. */
  174. UINT WINAPI
  175. NDdeShareEnumA (
  176. LPSTR lpszServer, // server to execute on ( NULL for local )
  177. UINT nLevel, // 0 for null separated 00 terminated list
  178. LPBYTE lpBuffer, // pointer to buffer
  179. DWORD cBufSize, // size of buffer
  180. LPDWORD lpnEntriesRead, // number of names returned
  181. LPDWORD lpcbTotalAvailable // number of bytes available
  182. );
  183. #endif //!UNICODE_ONLY
  184. #ifndef ANSI_ONLY
  185. UINT WINAPI
  186. NDdeShareEnumW (
  187. LPWSTR lpszServer, // server to execute on ( NULL for local )
  188. UINT nLevel, // 0 for null separated 00 terminated list
  189. LPBYTE lpBuffer, // pointer to buffer
  190. DWORD cBufSize, // size of buffer
  191. LPDWORD lpnEntriesRead, // number of names returned
  192. LPDWORD lpcbTotalAvailable // number of bytes available
  193. );
  194. #endif //!ANSI_ONLY
  195. #ifndef UNICODE_ONLY
  196. /*
  197. Get information on a share
  198. */
  199. UINT WINAPI
  200. NDdeShareGetInfoA (
  201. LPSTR lpszServer, // server to execute on ( must be NULL )
  202. LPSTR lpszShareName, // name of share
  203. UINT nLevel, // info level must be 2
  204. LPBYTE lpBuffer, // gets struct containing (NDDESHAREINFO) + data
  205. DWORD cBufSize, // sizeof buffer
  206. LPDWORD lpnTotalAvailable, // number of bytes available
  207. LPWORD lpnItems // item mask for partial getinfo (must be 0)
  208. );
  209. #endif //!UNICODE_ONLY
  210. #ifndef ANSI_ONLY
  211. UINT WINAPI
  212. NDdeShareGetInfoW (
  213. LPWSTR lpszServer, // server to execute on ( must be NULL )
  214. LPWSTR lpszShareName, // name of share
  215. UINT nLevel, // info level must be 2
  216. LPBYTE lpBuffer, // gets struct containing (NDDESHAREINFO) + data
  217. DWORD cBufSize, // sizeof buffer
  218. LPDWORD lpnTotalAvailable, // number of bytes available
  219. LPWORD lpnItems // item mask for partial getinfo (must be 0)
  220. );
  221. #endif //!ANSI_ONLY
  222. #ifndef UNICODE_ONLY
  223. /*
  224. Modify DDE share data
  225. */
  226. UINT WINAPI
  227. NDdeShareSetInfoA (
  228. LPSTR lpszServer, // server to execute on ( must be NULL )
  229. LPSTR lpszShareName, // name of share
  230. UINT nLevel, // info level must be 2
  231. LPBYTE lpBuffer, // points to struct with (NDDESHAREINFO) + data
  232. DWORD cBufSize, // sizeof buffer
  233. WORD sParmNum // Parameter index ( must be 0 - entire )
  234. );
  235. #endif //!UNICODE_ONLY
  236. #ifndef ANSI_ONLY
  237. UINT WINAPI
  238. NDdeShareSetInfoW (
  239. LPWSTR lpszServer, // server to execute on ( must be NULL )
  240. LPWSTR lpszShareName, // name of share
  241. UINT nLevel, // info level must be 2
  242. LPBYTE lpBuffer, // points to struct with (NDDESHAREINFO) + data
  243. DWORD cBufSize, // sizeof buffer
  244. WORD sParmNum // Parameter index ( must be 0 - entire )
  245. );
  246. #endif //!ANSI_ONLY
  247. /*
  248. Set/Create a trusted share
  249. */
  250. #ifndef UNICODE_ONLY
  251. UINT WINAPI
  252. NDdeSetTrustedShareA (
  253. LPSTR lpszServer, // server to execute on ( must be NULL )
  254. LPSTR lpszShareName, // name of share to delete
  255. DWORD dwTrustOptions // trust options to apply
  256. );
  257. #endif //!UNICODE_ONLY
  258. #ifndef ANSI_ONLY
  259. UINT WINAPI
  260. NDdeSetTrustedShareW (
  261. LPWSTR lpszServer, // server to execute on ( must be NULL )
  262. LPWSTR lpszShareName, // name of share to delete
  263. DWORD dwTrustOptions // trust options to apply
  264. );
  265. #endif //!ANSI_ONLY
  266. /* Trusted share options */
  267. #define NDDE_TRUST_SHARE_START 0x80000000L // Start App Allowed
  268. #define NDDE_TRUST_SHARE_INIT 0x40000000L // Init Conv Allowed
  269. #define NDDE_TRUST_SHARE_DEL 0x20000000L // Delete Trusted Share (on set)
  270. #define NDDE_TRUST_CMD_SHOW 0x10000000L // Use supplied cmd show
  271. #define NDDE_CMD_SHOW_MASK 0x0000FFFFL // Command Show mask
  272. /*
  273. Get a trusted share options
  274. */
  275. #ifndef UNICODE_ONLY
  276. UINT WINAPI
  277. NDdeGetTrustedShareA (
  278. LPSTR lpszServer, // server to execute on ( must be NULL )
  279. LPSTR lpszShareName, // name of share to query
  280. LPDWORD lpdwTrustOptions, // trust options in effect
  281. LPDWORD lpdwShareModId0, // first word of share mod id
  282. LPDWORD lpdwShareModId1 // second word of share mod id
  283. );
  284. #endif //!UNICODE_ONLY
  285. #ifndef ANSI_ONLY
  286. UINT WINAPI
  287. NDdeGetTrustedShareW (
  288. LPWSTR lpszServer, // server to execute on ( must be NULL )
  289. LPWSTR lpszShareName, // name of share to query
  290. LPDWORD lpdwTrustOptions, // trust options in effect
  291. LPDWORD lpdwShareModId0, // first word of share mod id
  292. LPDWORD lpdwShareModId1 // second word of share mod id
  293. );
  294. #endif //!ANSI_ONLY
  295. #ifndef UNICODE_ONLY
  296. /*
  297. Enumerate trusted shares
  298. */
  299. UINT WINAPI
  300. NDdeTrustedShareEnumA (
  301. LPSTR lpszServer, // server to execute on ( NULL for local )
  302. UINT nLevel, // 0 for null separated 00 terminated list
  303. LPBYTE lpBuffer, // pointer to buffer
  304. DWORD cBufSize, // size of buffer
  305. LPDWORD lpnEntriesRead, // number of names returned
  306. LPDWORD lpcbTotalAvailable // number of bytes available
  307. );
  308. #endif //!UNICODE_ONLY
  309. #ifndef ANSI_ONLY
  310. UINT WINAPI
  311. NDdeTrustedShareEnumW (
  312. LPWSTR lpszServer, // server to execute on ( NULL for local )
  313. UINT nLevel, // 0 for null separated 00 terminated list
  314. LPBYTE lpBuffer, // pointer to buffer
  315. DWORD cBufSize, // size of buffer
  316. LPDWORD lpnEntriesRead, // number of names returned
  317. LPDWORD lpcbTotalAvailable // number of bytes available
  318. );
  319. #endif //!ANSI_ONLY
  320. #ifndef UNICODE_ONLY
  321. /*
  322. Convert error code to string value
  323. */
  324. UINT WINAPI
  325. NDdeGetErrorStringA (
  326. UINT uErrorCode, // Error code to get string for
  327. LPSTR lpszErrorString, // buffer to hold error string
  328. DWORD cBufSize // sizeof buffer
  329. );
  330. #endif //!UNICODE_ONLY
  331. #ifndef ANSI_ONLY
  332. UINT WINAPI
  333. NDdeGetErrorStringW (
  334. UINT uErrorCode, // Error code to get string for
  335. LPWSTR lpszErrorString, // buffer to hold error string
  336. DWORD cBufSize // sizeof buffer
  337. );
  338. #endif //!ANSI_ONLY
  339. #ifndef UNICODE_ONLY
  340. /*
  341. Validate share name format
  342. */
  343. BOOL WINAPI
  344. NDdeIsValidShareNameA (
  345. LPSTR shareName
  346. );
  347. #endif //!UNICODE_ONLY
  348. #ifndef ANSI_ONLY
  349. BOOL WINAPI
  350. NDdeIsValidShareNameW (
  351. LPWSTR shareName
  352. );
  353. #endif //!ANSI_ONLY
  354. #ifndef UNICODE_ONLY
  355. /*
  356. Validate application/topic list format
  357. */
  358. BOOL WINAPI
  359. NDdeIsValidAppTopicListA (
  360. LPSTR targetTopic
  361. );
  362. #endif //!UNICODE_ONLY
  363. #ifndef ANSI_ONLY
  364. BOOL WINAPI
  365. NDdeIsValidAppTopicListW (
  366. LPWSTR targetTopic
  367. );
  368. #endif //!ANSI_ONLY
  369. #ifdef UNICODE
  370. #define NDdeShareAdd NDdeShareAddW
  371. #define NDdeShareDel NDdeShareDelW
  372. #define NDdeSetShareSecurity NDdeSetShareSecurityW
  373. #define NDdeGetShareSecurity NDdeGetShareSecurityW
  374. #define NDdeShareEnum NDdeShareEnumW
  375. #define NDdeShareGetInfo NDdeShareGetInfoW
  376. #define NDdeShareSetInfo NDdeShareSetInfoW
  377. #define NDdeGetErrorString NDdeGetErrorStringW
  378. #define NDdeIsValidShareName NDdeIsValidShareNameW
  379. #define NDdeIsValidAppTopicList NDdeIsValidAppTopicListW
  380. #define NDdeSetTrustedShare NDdeSetTrustedShareW
  381. #define NDdeGetTrustedShare NDdeGetTrustedShareW
  382. #define NDdeTrustedShareEnum NDdeTrustedShareEnumW
  383. #else
  384. #define NDdeShareAdd NDdeShareAddA
  385. #define NDdeShareDel NDdeShareDelA
  386. #define NDdeSetShareSecurity NDdeSetShareSecurityA
  387. #define NDdeGetShareSecurity NDdeGetShareSecurityA
  388. #define NDdeShareEnum NDdeShareEnumA
  389. #define NDdeShareGetInfo NDdeShareGetInfoA
  390. #define NDdeShareSetInfo NDdeShareSetInfoA
  391. #define NDdeGetErrorString NDdeGetErrorStringA
  392. #define NDdeIsValidShareName NDdeIsValidShareNameA
  393. #define NDdeIsValidAppTopicList NDdeIsValidAppTopicListA
  394. #define NDdeSetTrustedShare NDdeSetTrustedShareA
  395. #define NDdeGetTrustedShare NDdeGetTrustedShareA
  396. #define NDdeTrustedShareEnum NDdeTrustedShareEnumA
  397. #endif
  398. #ifdef __cplusplus
  399. }
  400. #endif /* __cplusplus */
  401. #include <poppack.h>
  402. #endif /* _INC_NDDEAPI */