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.

433 lines
9.5 KiB

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