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.

472 lines
12 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. #define SHI1005_FLAGS_RESTRICT_EXCLUSIVE_OPENS 0x0100 // Used to disallow read-deny read behavior
  191. #define SHI1005_FLAGS_FORCE_SHARED_DELETE 0x0200 // Used to allows force shared delete
  192. #define SHI1005_FLAGS_ALLOW_NAMESPACE_CACHING 0x0400 // The clients may cache the namespace
  193. //
  194. // The subset of 1005 infolevel flags that can be set via the API
  195. //
  196. #define SHI1005_VALID_FLAGS_SET (CSC_MASK|SHI1005_FLAGS_RESTRICT_EXCLUSIVE_OPENS|SHI1005_FLAGS_FORCE_SHARED_DELETE|SHI1005_FLAGS_ALLOW_NAMESPACE_CACHING)
  197. #endif // _LMSHARE_
  198. //
  199. // SESSION API
  200. //
  201. #ifndef _LMSESSION_
  202. #define _LMSESSION_
  203. //
  204. // Function Prototypes Session
  205. //
  206. NET_API_STATUS NET_API_FUNCTION
  207. NetSessionEnum (
  208. IN LMSTR servername OPTIONAL,
  209. IN LMSTR UncClientName OPTIONAL,
  210. IN LMSTR username OPTIONAL,
  211. IN DWORD level,
  212. OUT LPBYTE *bufptr,
  213. IN DWORD prefmaxlen,
  214. OUT LPDWORD entriesread,
  215. OUT LPDWORD totalentries,
  216. IN OUT LPDWORD resume_handle OPTIONAL
  217. );
  218. NET_API_STATUS NET_API_FUNCTION
  219. NetSessionDel (
  220. IN LMSTR servername OPTIONAL,
  221. IN LMSTR UncClientName,
  222. IN LMSTR username
  223. );
  224. NET_API_STATUS NET_API_FUNCTION
  225. NetSessionGetInfo (
  226. IN LMSTR servername OPTIONAL,
  227. IN LMSTR UncClientName,
  228. IN LMSTR username,
  229. IN DWORD level,
  230. OUT LPBYTE *bufptr
  231. );
  232. //
  233. // Data Structures - Session
  234. //
  235. typedef struct _SESSION_INFO_0 {
  236. LMSTR sesi0_cname; // client name (no backslashes)
  237. } SESSION_INFO_0, *PSESSION_INFO_0, *LPSESSION_INFO_0;
  238. typedef struct _SESSION_INFO_1 {
  239. LMSTR sesi1_cname; // client name (no backslashes)
  240. LMSTR sesi1_username;
  241. DWORD sesi1_num_opens;
  242. DWORD sesi1_time;
  243. DWORD sesi1_idle_time;
  244. DWORD sesi1_user_flags;
  245. } SESSION_INFO_1, *PSESSION_INFO_1, *LPSESSION_INFO_1;
  246. typedef struct _SESSION_INFO_2 {
  247. LMSTR sesi2_cname; // client name (no backslashes)
  248. LMSTR sesi2_username;
  249. DWORD sesi2_num_opens;
  250. DWORD sesi2_time;
  251. DWORD sesi2_idle_time;
  252. DWORD sesi2_user_flags;
  253. LMSTR sesi2_cltype_name;
  254. } SESSION_INFO_2, *PSESSION_INFO_2, *LPSESSION_INFO_2;
  255. typedef struct _SESSION_INFO_10 {
  256. LMSTR sesi10_cname; // client name (no backslashes)
  257. LMSTR sesi10_username;
  258. DWORD sesi10_time;
  259. DWORD sesi10_idle_time;
  260. } SESSION_INFO_10, *PSESSION_INFO_10, *LPSESSION_INFO_10;
  261. typedef struct _SESSION_INFO_502 {
  262. LMSTR sesi502_cname; // client name (no backslashes)
  263. LMSTR sesi502_username;
  264. DWORD sesi502_num_opens;
  265. DWORD sesi502_time;
  266. DWORD sesi502_idle_time;
  267. DWORD sesi502_user_flags;
  268. LMSTR sesi502_cltype_name;
  269. LMSTR sesi502_transport;
  270. } SESSION_INFO_502, *PSESSION_INFO_502, *LPSESSION_INFO_502;
  271. //
  272. // Special Values and Constants - Session
  273. //
  274. //
  275. // Bits defined in sesi1_user_flags.
  276. //
  277. #define SESS_GUEST 0x00000001 // session is logged on as a guest
  278. #define SESS_NOENCRYPTION 0x00000002 // session is not using encryption
  279. #define SESI1_NUM_ELEMENTS 8
  280. #define SESI2_NUM_ELEMENTS 9
  281. #endif // _LMSESSION_
  282. //
  283. // CONNECTION API
  284. //
  285. #ifndef _LMCONNECTION_
  286. #define _LMCONNECTION_
  287. //
  288. // Function Prototypes - CONNECTION
  289. //
  290. NET_API_STATUS NET_API_FUNCTION
  291. NetConnectionEnum (
  292. IN LMSTR servername OPTIONAL,
  293. IN LMSTR qualifier,
  294. IN DWORD level,
  295. OUT LPBYTE *bufptr,
  296. IN DWORD prefmaxlen,
  297. OUT LPDWORD entriesread,
  298. OUT LPDWORD totalentries,
  299. IN OUT LPDWORD resume_handle OPTIONAL
  300. );
  301. //
  302. // Data Structures - CONNECTION
  303. //
  304. typedef struct _CONNECTION_INFO_0 {
  305. DWORD coni0_id;
  306. } CONNECTION_INFO_0, *PCONNECTION_INFO_0, *LPCONNECTION_INFO_0;
  307. typedef struct _CONNECTION_INFO_1 {
  308. DWORD coni1_id;
  309. DWORD coni1_type;
  310. DWORD coni1_num_opens;
  311. DWORD coni1_num_users;
  312. DWORD coni1_time;
  313. LMSTR coni1_username;
  314. LMSTR coni1_netname;
  315. } CONNECTION_INFO_1, *PCONNECTION_INFO_1, *LPCONNECTION_INFO_1;
  316. #endif // _LMCONNECTION_
  317. //
  318. // FILE API
  319. //
  320. #ifndef _LMFILE_
  321. #define _LMFILE_
  322. //
  323. // Function Prototypes - FILE
  324. //
  325. NET_API_STATUS NET_API_FUNCTION
  326. NetFileClose (
  327. IN LMSTR servername OPTIONAL,
  328. IN DWORD fileid
  329. );
  330. NET_API_STATUS NET_API_FUNCTION
  331. NetFileEnum (
  332. IN LMSTR servername OPTIONAL,
  333. IN LMSTR basepath OPTIONAL,
  334. IN LMSTR username OPTIONAL,
  335. IN DWORD level,
  336. OUT LPBYTE *bufptr,
  337. IN DWORD prefmaxlen,
  338. OUT LPDWORD entriesread,
  339. OUT LPDWORD totalentries,
  340. IN OUT PDWORD_PTR resume_handle OPTIONAL
  341. );
  342. NET_API_STATUS NET_API_FUNCTION
  343. NetFileGetInfo (
  344. IN LMSTR servername OPTIONAL,
  345. IN DWORD fileid,
  346. IN DWORD level,
  347. OUT LPBYTE *bufptr
  348. );
  349. //
  350. // Data Structures - File
  351. //
  352. // File APIs are available at information levels 2 & 3 only. Levels 0 &
  353. // 1 are not supported.
  354. //
  355. typedef struct _FILE_INFO_2 {
  356. DWORD fi2_id;
  357. } FILE_INFO_2, *PFILE_INFO_2, *LPFILE_INFO_2;
  358. typedef struct _FILE_INFO_3 {
  359. DWORD fi3_id;
  360. DWORD fi3_permissions;
  361. DWORD fi3_num_locks;
  362. LMSTR fi3_pathname;
  363. LMSTR fi3_username;
  364. } FILE_INFO_3, *PFILE_INFO_3, *LPFILE_INFO_3;
  365. //
  366. // Special Values and Constants - File
  367. //
  368. //
  369. // bit values for permissions
  370. //
  371. #define PERM_FILE_READ 0x1 // user has read access
  372. #define PERM_FILE_WRITE 0x2 // user has write access
  373. #define PERM_FILE_CREATE 0x4 // user has create access
  374. #ifdef __cplusplus
  375. }
  376. #endif
  377. #endif // _LMFILE_