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.

405 lines
14 KiB

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