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.

468 lines
11 KiB

  1. /*++ BUILD Version: 0001 // Increment this if a change has global effects
  2. Copyright (c) 1990-1999 Microsoft Corporation
  3. Module Name:
  4. lmshare.h
  5. Abstract:
  6. This module defines the API function prototypes and data structures
  7. for the following groups of NT API functions:
  8. NetShare
  9. NetSession
  10. NetFile
  11. NetConnection
  12. Environment:
  13. User Mode - Win32
  14. Notes:
  15. You must include <windef.h> and <lmcons.h> before this file.
  16. --*/
  17. //
  18. // SHARE API
  19. //
  20. #ifndef _LMSHARE_
  21. #define _LMSHARE_
  22. #if _MSC_VER > 1000
  23. #pragma once
  24. #endif
  25. #ifdef __cplusplus
  26. extern "C" {
  27. #endif
  28. #include <lmcons.h>
  29. //
  30. // Function Prototypes - Share
  31. //
  32. NET_API_STATUS NET_API_FUNCTION
  33. NetShareAdd (
  34. IN LMSTR servername,
  35. IN DWORD level,
  36. IN LPBYTE buf,
  37. OUT LPDWORD parm_err
  38. );
  39. NET_API_STATUS NET_API_FUNCTION
  40. NetShareEnum (
  41. IN LMSTR servername,
  42. IN DWORD level,
  43. OUT LPBYTE *bufptr,
  44. IN DWORD prefmaxlen,
  45. OUT LPDWORD entriesread,
  46. OUT LPDWORD totalentries,
  47. IN OUT LPDWORD resume_handle
  48. );
  49. NET_API_STATUS NET_API_FUNCTION
  50. NetShareEnumSticky (
  51. IN LMSTR servername,
  52. IN DWORD level,
  53. OUT LPBYTE *bufptr,
  54. IN DWORD prefmaxlen,
  55. OUT LPDWORD entriesread,
  56. OUT LPDWORD totalentries,
  57. IN OUT LPDWORD resume_handle
  58. );
  59. NET_API_STATUS NET_API_FUNCTION
  60. NetShareGetInfo (
  61. IN LMSTR servername,
  62. IN LMSTR netname,
  63. IN DWORD level,
  64. OUT LPBYTE *bufptr
  65. );
  66. NET_API_STATUS NET_API_FUNCTION
  67. NetShareSetInfo (
  68. IN LMSTR servername,
  69. IN LMSTR netname,
  70. IN DWORD level,
  71. IN LPBYTE buf,
  72. OUT LPDWORD parm_err
  73. );
  74. NET_API_STATUS NET_API_FUNCTION
  75. NetShareDel (
  76. IN LMSTR servername,
  77. IN LMSTR netname,
  78. IN DWORD reserved
  79. );
  80. NET_API_STATUS NET_API_FUNCTION
  81. NetShareDelSticky (
  82. IN LMSTR servername,
  83. IN LMSTR netname,
  84. IN DWORD reserved
  85. );
  86. NET_API_STATUS NET_API_FUNCTION
  87. NetShareCheck (
  88. IN LMSTR servername,
  89. IN LMSTR device,
  90. OUT LPDWORD type
  91. );
  92. //
  93. // Data Structures - Share
  94. //
  95. typedef struct _SHARE_INFO_0 {
  96. LMSTR shi0_netname;
  97. } SHARE_INFO_0, *PSHARE_INFO_0, *LPSHARE_INFO_0;
  98. typedef struct _SHARE_INFO_1 {
  99. LMSTR shi1_netname;
  100. DWORD shi1_type;
  101. LMSTR shi1_remark;
  102. } SHARE_INFO_1, *PSHARE_INFO_1, *LPSHARE_INFO_1;
  103. typedef struct _SHARE_INFO_2 {
  104. LMSTR shi2_netname;
  105. DWORD shi2_type;
  106. LMSTR shi2_remark;
  107. DWORD shi2_permissions;
  108. DWORD shi2_max_uses;
  109. DWORD shi2_current_uses;
  110. LMSTR shi2_path;
  111. LMSTR shi2_passwd;
  112. } SHARE_INFO_2, *PSHARE_INFO_2, *LPSHARE_INFO_2;
  113. typedef struct _SHARE_INFO_501 {
  114. LMSTR shi501_netname;
  115. DWORD shi501_type;
  116. LMSTR shi501_remark;
  117. DWORD shi501_flags;
  118. } SHARE_INFO_501, *PSHARE_INFO_501, *LPSHARE_INFO_501;
  119. typedef struct _SHARE_INFO_502 {
  120. LMSTR shi502_netname;
  121. DWORD shi502_type;
  122. LMSTR shi502_remark;
  123. DWORD shi502_permissions;
  124. DWORD shi502_max_uses;
  125. DWORD shi502_current_uses;
  126. LMSTR shi502_path;
  127. LMSTR shi502_passwd;
  128. DWORD shi502_reserved;
  129. PSECURITY_DESCRIPTOR shi502_security_descriptor;
  130. } SHARE_INFO_502, *PSHARE_INFO_502, *LPSHARE_INFO_502;
  131. typedef struct _SHARE_INFO_1004 {
  132. LMSTR shi1004_remark;
  133. } SHARE_INFO_1004, *PSHARE_INFO_1004, *LPSHARE_INFO_1004;
  134. typedef struct _SHARE_INFO_1005 {
  135. DWORD shi1005_flags;
  136. } SHARE_INFO_1005, *PSHARE_INFO_1005, *LPSHARE_INFO_1005;
  137. typedef struct _SHARE_INFO_1006 {
  138. DWORD shi1006_max_uses;
  139. } SHARE_INFO_1006, *PSHARE_INFO_1006, *LPSHARE_INFO_1006;
  140. typedef struct _SHARE_INFO_1501 {
  141. DWORD shi1501_reserved;
  142. PSECURITY_DESCRIPTOR shi1501_security_descriptor;
  143. } SHARE_INFO_1501, *PSHARE_INFO_1501, *LPSHARE_INFO_1501;
  144. //
  145. // Special Values and Constants - Share
  146. //
  147. //
  148. // Values for parm_err parameter.
  149. //
  150. #define SHARE_NETNAME_PARMNUM 1
  151. #define SHARE_TYPE_PARMNUM 3
  152. #define SHARE_REMARK_PARMNUM 4
  153. #define SHARE_PERMISSIONS_PARMNUM 5
  154. #define SHARE_MAX_USES_PARMNUM 6
  155. #define SHARE_CURRENT_USES_PARMNUM 7
  156. #define SHARE_PATH_PARMNUM 8
  157. #define SHARE_PASSWD_PARMNUM 9
  158. #define SHARE_FILE_SD_PARMNUM 501
  159. //
  160. // Single-field infolevels for NetShareSetInfo.
  161. //
  162. #define SHARE_REMARK_INFOLEVEL \
  163. (PARMNUM_BASE_INFOLEVEL + SHARE_REMARK_PARMNUM)
  164. #define SHARE_MAX_USES_INFOLEVEL \
  165. (PARMNUM_BASE_INFOLEVEL + SHARE_MAX_USES_PARMNUM)
  166. #define SHARE_FILE_SD_INFOLEVEL \
  167. (PARMNUM_BASE_INFOLEVEL + SHARE_FILE_SD_PARMNUM)
  168. #define SHI1_NUM_ELEMENTS 4
  169. #define SHI2_NUM_ELEMENTS 10
  170. //
  171. // Share types (shi1_type and shi2_type fields).
  172. //
  173. #define STYPE_DISKTREE 0
  174. #define STYPE_PRINTQ 1
  175. #define STYPE_DEVICE 2
  176. #define STYPE_IPC 3
  177. #define STYPE_TEMPORARY 0x40000000
  178. #define STYPE_SPECIAL 0x80000000
  179. #define SHI_USES_UNLIMITED (DWORD)-1
  180. //
  181. // Flags values for the 501 and 1005 levels
  182. //
  183. #define SHI1005_FLAGS_DFS 0x01 // Share is in the DFS
  184. #define SHI1005_FLAGS_DFS_ROOT 0x02 // Share is root of DFS
  185. #define CSC_MASK 0x30 // Used to mask off the following states
  186. #define CSC_CACHE_MANUAL_REINT 0x00 // No automatic file by file reintegration
  187. #define CSC_CACHE_AUTO_REINT 0x10 // File by file reintegration is OK
  188. #define CSC_CACHE_VDO 0x20 // no need to flow opens
  189. #define CSC_CACHE_NONE 0x30 // no CSC for this share
  190. //
  191. // The subset of 1005 infolevel flags that can be set via the API
  192. //
  193. #define SHI1005_VALID_FLAGS_SET CSC_MASK
  194. #endif // _LMSHARE_
  195. //
  196. // SESSION API
  197. //
  198. #ifndef _LMSESSION_
  199. #define _LMSESSION_
  200. //
  201. // Function Prototypes Session
  202. //
  203. NET_API_STATUS NET_API_FUNCTION
  204. NetSessionEnum (
  205. IN LMSTR servername OPTIONAL,
  206. IN LMSTR UncClientName OPTIONAL,
  207. IN LMSTR username OPTIONAL,
  208. IN DWORD level,
  209. OUT LPBYTE *bufptr,
  210. IN DWORD prefmaxlen,
  211. OUT LPDWORD entriesread,
  212. OUT LPDWORD totalentries,
  213. IN OUT LPDWORD resume_handle OPTIONAL
  214. );
  215. NET_API_STATUS NET_API_FUNCTION
  216. NetSessionDel (
  217. IN LMSTR servername OPTIONAL,
  218. IN LMSTR UncClientName,
  219. IN LMSTR username
  220. );
  221. NET_API_STATUS NET_API_FUNCTION
  222. NetSessionGetInfo (
  223. IN LMSTR servername OPTIONAL,
  224. IN LMSTR UncClientName,
  225. IN LMSTR username,
  226. IN DWORD level,
  227. OUT LPBYTE *bufptr
  228. );
  229. //
  230. // Data Structures - Session
  231. //
  232. typedef struct _SESSION_INFO_0 {
  233. LMSTR sesi0_cname; // client name (no backslashes)
  234. } SESSION_INFO_0, *PSESSION_INFO_0, *LPSESSION_INFO_0;
  235. typedef struct _SESSION_INFO_1 {
  236. LMSTR sesi1_cname; // client name (no backslashes)
  237. LMSTR sesi1_username;
  238. DWORD sesi1_num_opens;
  239. DWORD sesi1_time;
  240. DWORD sesi1_idle_time;
  241. DWORD sesi1_user_flags;
  242. } SESSION_INFO_1, *PSESSION_INFO_1, *LPSESSION_INFO_1;
  243. typedef struct _SESSION_INFO_2 {
  244. LMSTR sesi2_cname; // client name (no backslashes)
  245. LMSTR sesi2_username;
  246. DWORD sesi2_num_opens;
  247. DWORD sesi2_time;
  248. DWORD sesi2_idle_time;
  249. DWORD sesi2_user_flags;
  250. LMSTR sesi2_cltype_name;
  251. } SESSION_INFO_2, *PSESSION_INFO_2, *LPSESSION_INFO_2;
  252. typedef struct _SESSION_INFO_10 {
  253. LMSTR sesi10_cname; // client name (no backslashes)
  254. LMSTR sesi10_username;
  255. DWORD sesi10_time;
  256. DWORD sesi10_idle_time;
  257. } SESSION_INFO_10, *PSESSION_INFO_10, *LPSESSION_INFO_10;
  258. typedef struct _SESSION_INFO_502 {
  259. LMSTR sesi502_cname; // client name (no backslashes)
  260. LMSTR sesi502_username;
  261. DWORD sesi502_num_opens;
  262. DWORD sesi502_time;
  263. DWORD sesi502_idle_time;
  264. DWORD sesi502_user_flags;
  265. LMSTR sesi502_cltype_name;
  266. LMSTR sesi502_transport;
  267. } SESSION_INFO_502, *PSESSION_INFO_502, *LPSESSION_INFO_502;
  268. //
  269. // Special Values and Constants - Session
  270. //
  271. //
  272. // Bits defined in sesi1_user_flags.
  273. //
  274. #define SESS_GUEST 0x00000001 // session is logged on as a guest
  275. #define SESS_NOENCRYPTION 0x00000002 // session is not using encryption
  276. #define SESI1_NUM_ELEMENTS 8
  277. #define SESI2_NUM_ELEMENTS 9
  278. #endif // _LMSESSION_
  279. //
  280. // CONNECTION API
  281. //
  282. #ifndef _LMCONNECTION_
  283. #define _LMCONNECTION_
  284. //
  285. // Function Prototypes - CONNECTION
  286. //
  287. NET_API_STATUS NET_API_FUNCTION
  288. NetConnectionEnum (
  289. IN LMSTR servername OPTIONAL,
  290. IN LMSTR qualifier,
  291. IN DWORD level,
  292. OUT LPBYTE *bufptr,
  293. IN DWORD prefmaxlen,
  294. OUT LPDWORD entriesread,
  295. OUT LPDWORD totalentries,
  296. IN OUT LPDWORD resume_handle OPTIONAL
  297. );
  298. //
  299. // Data Structures - CONNECTION
  300. //
  301. typedef struct _CONNECTION_INFO_0 {
  302. DWORD coni0_id;
  303. } CONNECTION_INFO_0, *PCONNECTION_INFO_0, *LPCONNECTION_INFO_0;
  304. typedef struct _CONNECTION_INFO_1 {
  305. DWORD coni1_id;
  306. DWORD coni1_type;
  307. DWORD coni1_num_opens;
  308. DWORD coni1_num_users;
  309. DWORD coni1_time;
  310. LMSTR coni1_username;
  311. LMSTR coni1_netname;
  312. } CONNECTION_INFO_1, *PCONNECTION_INFO_1, *LPCONNECTION_INFO_1;
  313. #endif // _LMCONNECTION_
  314. //
  315. // FILE API
  316. //
  317. #ifndef _LMFILE_
  318. #define _LMFILE_
  319. //
  320. // Function Prototypes - FILE
  321. //
  322. NET_API_STATUS NET_API_FUNCTION
  323. NetFileClose (
  324. IN LMSTR servername OPTIONAL,
  325. IN DWORD fileid
  326. );
  327. NET_API_STATUS NET_API_FUNCTION
  328. NetFileEnum (
  329. IN LMSTR servername OPTIONAL,
  330. IN LMSTR basepath OPTIONAL,
  331. IN LMSTR username OPTIONAL,
  332. IN DWORD level,
  333. OUT LPBYTE *bufptr,
  334. IN DWORD prefmaxlen,
  335. OUT LPDWORD entriesread,
  336. OUT LPDWORD totalentries,
  337. IN OUT PDWORD_PTR resume_handle OPTIONAL
  338. );
  339. NET_API_STATUS NET_API_FUNCTION
  340. NetFileGetInfo (
  341. IN LMSTR servername OPTIONAL,
  342. IN DWORD fileid,
  343. IN DWORD level,
  344. OUT LPBYTE *bufptr
  345. );
  346. //
  347. // Data Structures - File
  348. //
  349. // File APIs are available at information levels 2 & 3 only. Levels 0 &
  350. // 1 are not supported.
  351. //
  352. typedef struct _FILE_INFO_2 {
  353. DWORD fi2_id;
  354. } FILE_INFO_2, *PFILE_INFO_2, *LPFILE_INFO_2;
  355. typedef struct _FILE_INFO_3 {
  356. DWORD fi3_id;
  357. DWORD fi3_permissions;
  358. DWORD fi3_num_locks;
  359. LMSTR fi3_pathname;
  360. LMSTR fi3_username;
  361. } FILE_INFO_3, *PFILE_INFO_3, *LPFILE_INFO_3;
  362. //
  363. // Special Values and Constants - File
  364. //
  365. //
  366. // bit values for permissions
  367. //
  368. #define PERM_FILE_READ 0x1 // user has read access
  369. #define PERM_FILE_WRITE 0x2 // user has write access
  370. #define PERM_FILE_CREATE 0x4 // user has create access
  371. #ifdef __cplusplus
  372. }
  373. #endif
  374. #endif // _LMFILE_