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.

453 lines
10 KiB

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