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.

1327 lines
45 KiB

  1. /********************************************************************/
  2. /** Microsoft Windows **/
  3. /** Copyright(c) Microsoft Corp., 1994 **/
  4. /********************************************************************/
  5. /********************************************************************
  6. * *
  7. * About this file ... SVRAPI.H *
  8. * *
  9. * This file contains information about the NetAccess, *
  10. * NetConnection, NetFile, NetServer, NetSession, NetShare and *
  11. * NetSecurity APIs. *
  12. * There is a section for each set of APIs. *
  13. * Each section contains: *
  14. * *
  15. * Function prototypes. *
  16. * *
  17. * Data structure templates. *
  18. * *
  19. * Definition of special values. *
  20. * *
  21. * Description of level of Win95 peer server support *
  22. *
  23. * For background information refer to the Lan Manager Programmer's
  24. * Reference.
  25. *
  26. * WARNING:
  27. * The APIs documented herein are not guaranteed to be supported
  28. * in future versions of Windows. Their primary purpose is to *
  29. * administer Win95 peer servers. *
  30. * *
  31. ********************************************************************/
  32. /*
  33. * NOTE: Lengths of ASCIIZ strings are given as the maximum
  34. * strlen() value. This does not include space for the
  35. * terminating 0-byte. When allocating space for such an item,
  36. * use the form:
  37. *
  38. * char username[LM20_UNLEN+1];
  39. *
  40. * An exception to this is the PATHLEN manifest, which does
  41. * include space for the terminating 0-byte.
  42. *
  43. * User names, computer names and share names should be
  44. * upper-cased by the caller and drawn from the ANSI
  45. * character set.
  46. *
  47. */
  48. /*NOINC*/
  49. #ifndef SVRAPI_INCLUDED
  50. #define SVRAPI_INCLUDED
  51. #include <lmcons.h>
  52. #include <lmerr.h>
  53. #ifndef RC_INVOKED
  54. #pragma pack(1) /* Assume byte packing throughout */
  55. #endif
  56. #ifdef __cplusplus
  57. extern "C" { /* Assume C declarations for C++ */
  58. #endif /* __cplusplus */
  59. #if !defined(_SVRAPI_)
  60. #define API_FUNCTION DECLSPEC_IMPORT API_RET_TYPE APIENTRY
  61. #else
  62. #define API_FUNCTION API_RET_TYPE APIENTRY
  63. #endif
  64. /*INC*/
  65. /****************************************************************
  66. * *
  67. * Access Class *
  68. * *
  69. ****************************************************************/
  70. /****************************************************************
  71. * *
  72. * Function prototypes - ACCESS *
  73. *
  74. * Requires User level security to be enabled
  75. * *
  76. * Peer Server Support:
  77. * Remote support of these APIs on NWSERVER is limited as
  78. * described below:
  79. *
  80. * NetAccessAdd -
  81. * local and remote VSERVER - level 2
  82. * remote NWSERVER - level 2
  83. * NetAccessCheck - local only
  84. * NetAccessDel -
  85. * local, remote NWSERVER and remote VSERVER
  86. * NetAccessEnum -
  87. * sLevel 0 on remote NWSERVER (fRecursive = 1),
  88. * slevel 0, 1, 2 on local and remote VSERVER
  89. * NetAccessGetInfo -
  90. * all sLevels on local and remote VSERVER,
  91. * sLevel 0, 12 on remote NWSERVER
  92. * NetAccessSetInfo -
  93. * sLevel 1, 12 on local and remote VSERVER,
  94. * sLevel 12 on remote NWSERVER
  95. * parmnum = PARMNUM_ALL only
  96. * NetAccessGetUserPerms - local and remote VSERVER only
  97. ****************************************************************/
  98. extern API_FUNCTION
  99. NetAccessAdd ( const char FAR * pszServer,
  100. short sLevel,
  101. char FAR * pbBuffer,
  102. unsigned short cbBuffer );
  103. extern API_FUNCTION
  104. NetAccessCheck ( char FAR * pszReserved,
  105. char FAR * pszUserName,
  106. char FAR * pszResource,
  107. unsigned short usOperation,
  108. unsigned short FAR * pusResult );
  109. extern API_FUNCTION
  110. NetAccessDel ( const char FAR * pszServer,
  111. char FAR * pszResource );
  112. extern API_FUNCTION
  113. NetAccessEnum ( const char FAR * pszServer,
  114. char FAR * pszBasePath,
  115. short fsRecursive,
  116. short sLevel,
  117. char FAR * pbBuffer,
  118. unsigned short cbBuffer,
  119. unsigned short FAR * pcEntriesRead,
  120. unsigned short FAR * pcTotalAvail );
  121. extern API_FUNCTION
  122. NetAccessGetInfo ( const char FAR * pszServer,
  123. char FAR * pszResource,
  124. short sLevel,
  125. char FAR * pbBuffer,
  126. unsigned short cbBuffer,
  127. unsigned short FAR * pcbTotalAvail );
  128. extern API_FUNCTION
  129. NetAccessSetInfo ( const char FAR * pszServer,
  130. char FAR * pszResource,
  131. short sLevel,
  132. char FAR * pbBuffer,
  133. unsigned short cbBuffer,
  134. short sParmNum );
  135. extern API_FUNCTION
  136. NetAccessGetUserPerms ( char FAR * pszServer,
  137. char FAR * pszUgName,
  138. char FAR * pszResource,
  139. unsigned short FAR * pusPerms );
  140. /****************************************************************
  141. * *
  142. * Data structure templates - ACCESS *
  143. * *
  144. ****************************************************************/
  145. struct access_list {
  146. char acl_ugname[LM20_UNLEN+1];
  147. char acl_ugname_pad_1;
  148. short acl_access;
  149. }; /* access_list */
  150. struct access_list_2
  151. {
  152. char FAR * acl2_ugname;
  153. unsigned short acl2_access;
  154. }; /* access_list_2 */
  155. struct access_list_12
  156. {
  157. char FAR * acl12_ugname;
  158. unsigned short acl12_access;
  159. }; /* access_list_12 */
  160. struct access_info_0 {
  161. char FAR * acc0_resource_name;
  162. }; /* access_info_0 */
  163. struct access_info_1 {
  164. char FAR * acc1_resource_name;
  165. short acc1_attr; /* See values below */
  166. short acc1_count;
  167. }; /* access_info_1 */
  168. struct access_info_2
  169. {
  170. char FAR * acc2_resource_name;
  171. short acc2_attr;
  172. short acc2_count;
  173. }; /* access_info_2 */
  174. struct access_info_10 {
  175. char FAR * acc10_resource_name;
  176. }; /* access_info_10 */
  177. struct access_info_12
  178. {
  179. char FAR * acc12_resource_name;
  180. short acc12_attr;
  181. short acc12_count;
  182. }; /* access_info_12 */
  183. /****************************************************************
  184. * *
  185. * Special values and constants - ACCESS *
  186. * *
  187. ****************************************************************/
  188. /*
  189. * Maximum number of permission entries for each resource.
  190. */
  191. #define MAXPERMENTRIES 64
  192. /*
  193. * Bit values for the access permissions. ACCESS_ALL is a handy
  194. * way to specify maximum permissions. These are used in
  195. * acl_access field of access_list structures.
  196. */
  197. /*NOINC*/
  198. #define ACCESS_NONE 0
  199. #define ACCESS_ALL (ACCESS_READ|ACCESS_WRITE|ACCESS_CREATE|ACCESS_EXEC|ACCESS_DELETE|ACCESS_ATRIB|ACCESS_PERM|ACCESS_FINDFIRST)
  200. /*INC*/
  201. #define ACCESS_READ 0x1
  202. #define ACCESS_WRITE 0x2
  203. #define ACCESS_CREATE 0x4
  204. #define ACCESS_EXEC 0x8
  205. #define ACCESS_DELETE 0x10
  206. #define ACCESS_ATRIB 0x20
  207. #define ACCESS_PERM 0x40
  208. #define ACCESS_FINDFIRST 0x80
  209. #define ACCESS_GROUP 0x8000
  210. /*
  211. * Bit values for the acc1_attr field of the access_info_1 structure.
  212. * Only one bit is currently defined.
  213. */
  214. #define ACCESS_AUDIT 0x1
  215. /*
  216. * Parmnum value for NetAccessSetInfo.
  217. */
  218. #define ACCESS_ATTR_PARMNUM 2
  219. /*
  220. * ACCESS_LETTERS defines a letter for each bit position in
  221. * the acl_access field of struct access_list. Note that some
  222. * bits have a corresponding letter of ' ' (space).
  223. */
  224. #define ACCESS_LETTERS "RWCXDAP "
  225. /****************************************************************
  226. * *
  227. * Share Class *
  228. * *
  229. ****************************************************************/
  230. /****************************************************************
  231. * *
  232. * Function prototypes - SHARE *
  233. * *
  234. * Peer Server Support
  235. * NetShareAdd() - sLevel 50 on VSERVER and NWSERVER
  236. * NetShareDel() - VSERVER and NWSERVER
  237. * NetShareEnum() - sLevel 1,50 on VSERVER; 50 on NWSERVER
  238. * NetShareGetInfo() - sLevel 50 on VSERVER, NWSERVER
  239. * NetShareSetInfo() - sLevel 50, sParmNum PARMNUM_ALL
  240. * on VSERVER, NWSERVER
  241. ****************************************************************/
  242. /*** NetShareAdd - add a new share to the server tables
  243. *
  244. * NetShareAdd( servername, level, buf, buflen )
  245. *
  246. * ENTRY: servername - asciz string containing name of server
  247. * or NULL if local
  248. * level- Must be 50 for Win95 peer servers.
  249. * buf - far ptr to struct share_info
  250. * buflen - unsigned int length of buffer
  251. *
  252. * EXIT: 0 = success
  253. * ERROR_INVALID_LEVEL
  254. * ERROR_BAD_NETPATH
  255. * ERROR_INVALID_PARAMETER
  256. * NERR_UnknownDevDir
  257. * NERR_ShareExists
  258. * NERR_UnknownServer
  259. * NERR_ServerNotStarted
  260. * NERR_RedirectedPath
  261. * NERR_DuplicateShare
  262. * NERR_BufTooSmall
  263. * ERROR_NOT_ENOUGH_MEMORY
  264. *
  265. */
  266. extern API_FUNCTION
  267. NetShareAdd ( const char FAR * pszServer,
  268. short sLevel,
  269. const char FAR * pbBuffer,
  270. unsigned short cbBuffer );
  271. /*** NetShareDel (Admin only)
  272. *
  273. * API_FUNCTION NetShareDel( servername, netname, reserved )
  274. *
  275. * ENTRY
  276. *
  277. * char FAR * servername; asciz remote srv name, NULL if local
  278. * char FAR * netname; asciz network name of share being deleted
  279. * unsigned short reserved; MBZ
  280. *
  281. * EXIT
  282. *
  283. * 0 = success
  284. * NERR_NetNotStarted
  285. * ERROR_BAD_NETPATH
  286. * NERR_ServerNotStarted
  287. * NERR_NetNameNotFound
  288. * ERROR_INVALID_PARAMETER
  289. *
  290. *
  291. * Note: Deleting a share will also delete any existing connections
  292. * to the shared resource, and close open files within the
  293. * connections.
  294. */
  295. extern API_FUNCTION
  296. NetShareDel ( const char FAR * pszServer,
  297. const char FAR * pszNetName,
  298. unsigned short usReserved );
  299. /* 2.1 NetShareEnum
  300. *
  301. * API_FUNCTION
  302. * NetShareEnum( servername, level, buf, buflen, entriesread, totalentries )
  303. * char FAR * servername; asciz remote server name or NULL if local
  304. * short sLevel; level of detail requested; 1 or 50
  305. * char FAR * pbBuffer; buffer to return entries in
  306. * unsigned short cbBuffer; size of buffer on call
  307. * unsigned short FAR *pcEntriesRead; # of entries supplied on return
  308. * unsigned short FAR *pcTotalAvail ; total # of entries available
  309. *
  310. * Supply information about existing shares at specified level.
  311. *
  312. * Buffer contents on response (format for a single entry):
  313. * Level 1 contains a "struct share_info_1".
  314. * Level 50 contains a "struct share_info_50".
  315. *
  316. * Returns 0 if successful. Possible error returns:
  317. * ERROR_INVALID_LEVEL
  318. * ERROR_BAD_NETPATH
  319. * NERR_NetNotStarted
  320. * NERR_ServerNotStarted
  321. * ERROR_MORE_DATA
  322. */
  323. extern API_FUNCTION
  324. NetShareEnum ( const char FAR * pszServer,
  325. short sLevel,
  326. char FAR * pbBuffer,
  327. unsigned short cbBuffer,
  328. unsigned short FAR * pcEntriesRead,
  329. unsigned short FAR * pcTotalAvail );
  330. /* 2.2 NetShareGetInfo
  331. *
  332. * Purpose: Read complete information about a single outstanding share.
  333. *
  334. * API_FUNCTION
  335. * NetShareGetInfo( servername, netname, level, buf, buflen, totalavail )
  336. * char FAR * servername; asciz remote server name or NULL if local
  337. * char FAR * netname; asciz network name of share being queried
  338. * short level; level of info requested (50 for Win95 peer servers)
  339. * char FAR * buf; for returned entry
  340. * unsigned short buflen; size of buffer
  341. * unsigned short FAR *totalavail; total size needed for buffer
  342. *
  343. * Buffer contents on response:
  344. * Level 50 contains a "struct share_info_50".
  345. *
  346. * Returns 0 if successful. Possible error returns:
  347. * ERROR_INVALID_LEVEL
  348. * ERROR_INVALID_PARAMETER
  349. * ERROR_BAD_NETPATH
  350. * NERR_NetNotStarted
  351. * NERR_ServerNotStarted
  352. * NERR_NetNameNotFound
  353. * NERR_MoreData
  354. * NERR_BufTooSmall
  355. */
  356. extern API_FUNCTION
  357. NetShareGetInfo ( const char FAR * pszServer,
  358. const char FAR * pszNetName,
  359. short sLevel,
  360. char FAR * pbBuffer,
  361. unsigned short cbBuffer,
  362. unsigned short FAR * pcbTotalAvail );
  363. /*** NetShareSetInfo (Admin only)
  364. *
  365. * API_FUNCTION NetShareSetInfo( servername,
  366. * netname,
  367. * level,
  368. * buf,
  369. * buflen,
  370. * parmnum )
  371. *
  372. * ENTRY
  373. *
  374. * servername; asciz remote srv name, NULL if local
  375. * netname; asciz network name of share being set
  376. * level; level of info provided (50 for Win95 peer servers)
  377. * buf; contents described below
  378. * buflen; size of buffer
  379. * parmnum; must be PARMNUM_ALL for Win95 peer servers
  380. *
  381. * Buffer contents on call if parmnum is zero:
  382. * Level 50 contains a "struct share_info_50".
  383. *
  384. * Settable fields are:
  385. * shi_remark
  386. * shi_passwd
  387. *
  388. * EXIT
  389. *
  390. * 0 = success
  391. * NERR_NetNotStarted
  392. * NERR_ServerNotStarted
  393. * NERR_NetNameNotFound
  394. * ERROR_INVALID_LEVEL
  395. * NERR_BufTooSmall
  396. * NERR_RemoteErr
  397. * ERROR_MORE_DATA
  398. * ERROR_INVALID_PARAMETER
  399. ***/
  400. extern API_FUNCTION
  401. NetShareSetInfo ( const char FAR * pszServer,
  402. const char FAR * pszNetName,
  403. short sLevel,
  404. const char FAR * pbBuffer,
  405. unsigned short cbBuffer,
  406. short sParmNum );
  407. /****************************************************************
  408. * *
  409. * Data structure templates - SHARE *
  410. *
  411. ****************************************************************/
  412. struct share_info_0 {
  413. char shi0_netname[LM20_NNLEN+1];
  414. }; /* share_info_0 */
  415. struct share_info_1 {
  416. char shi1_netname[LM20_NNLEN+1];
  417. char shi1_pad1;
  418. unsigned short shi1_type;
  419. char FAR * shi1_remark;
  420. }; /* share_info_1 */
  421. struct share_info_2 {
  422. char shi2_netname[LM20_NNLEN+1];
  423. char shi2_pad1;
  424. unsigned short shi2_type;
  425. char FAR * shi2_remark;
  426. unsigned short shi2_permissions;
  427. unsigned short shi2_max_uses;
  428. unsigned short shi2_current_uses;
  429. char FAR * shi2_path;
  430. char shi2_passwd[SHPWLEN+1];
  431. char shi2_pad2;
  432. }; /* share_info_2 */
  433. struct share_info_50 {
  434. char shi50_netname[LM20_NNLEN+1]; /* share name */
  435. unsigned char shi50_type; /* see below */
  436. unsigned short shi50_flags; /* see below */
  437. char FAR * shi50_remark; /* ANSI comment string */
  438. char FAR * shi50_path; /* shared resource */
  439. char shi50_rw_password[SHPWLEN+1]; /* read-write password (share-level security) */
  440. char shi50_ro_password[SHPWLEN+1]; /* read-only password (share-level security) */
  441. }; /* share_info_50 */
  442. /****************************************************************
  443. * *
  444. * Special values and constants - SHARE *
  445. * *
  446. ****************************************************************/
  447. /* Field values for shi50_flags; */
  448. /* These flags are relevant for share-level security on VSERVER
  449. * When operating with user-level security, use SHI50F_FULL - the actual
  450. * access rights are determined by the NetAccess APIs.
  451. */
  452. #define SHI50F_RDONLY 0x0001
  453. #define SHI50F_FULL 0x0002
  454. #define SHI50F_DEPENDSON (SHI50F_RDONLY|SHI50F_FULL)
  455. #define SHI50F_ACCESSMASK (SHI50F_RDONLY|SHI50F_FULL)
  456. //
  457. // Attn: Those defines are needed to build MSSHRUI. Still need to confirm
  458. // with BSD SMB team validity of those
  459. //
  460. #define SHI50F_HTTP_READ_ONLY 0x0010
  461. #define SHI50F_HTTP_EXECUTE 0x0020
  462. #define SHI50F_HTTP_SECURE 0x0040
  463. #define SHI50F_HTTP_SHARED 0x0080
  464. #define SHI50F_FTP_READ_ONLY 0x1000
  465. #define SHI50F_FTP_WRITE 0x2000
  466. #define SHI50F_FTP_SHARED 0x4000
  467. /* The share is restored on system startup */
  468. #define SHI50F_PERSIST 0x0100
  469. /* The share is not normally visible */
  470. #define SHI50F_SYSTEM 0x0200
  471. /*
  472. * Values for parmnum parameter to NetShareSetInfo.
  473. */
  474. #ifndef PARMNUM_ALL
  475. #define PARMNUM_ALL 0
  476. #endif
  477. #define SHI_REMARK_PARMNUM 4
  478. #define SHI_PERMISSIONS_PARMNUM 5
  479. #define SHI_MAX_USES_PARMNUM 6
  480. #define SHI_PASSWD_PARMNUM 9
  481. #define SHI1_NUM_ELEMENTS 4
  482. #define SHI2_NUM_ELEMENTS 10
  483. /*
  484. * Share types .
  485. *
  486. * STYPE_DISKTREE and STYPE_PRINTQ are recognized on peer servers
  487. */
  488. #define STYPE_DISKTREE 0 /* disk share */
  489. #define STYPE_PRINTQ 1 /* printer share */
  490. #define STYPE_DEVICE 2
  491. #define STYPE_IPC 3
  492. #define SHI_USES_UNLIMITED -1
  493. /****************************************************************
  494. * *
  495. * Session Class *
  496. * *
  497. ****************************************************************/
  498. /****************************************************************
  499. * *
  500. * Function prototypes - SESSION *
  501. *
  502. * Peer Server Support *
  503. * NetSessionDel() - NWSERVER and VSERVER *
  504. * NetSessionEnum() - sLevel 50 on NWSERVER and VSERVER *
  505. * NetSessionGetInfo() - not supported on peer servers *
  506. ****************************************************************/
  507. /*** NetSessionDel (Admin only)
  508. *
  509. *
  510. * API_FUNCTION NetSessionDel( servername, clientname, reserved )
  511. *
  512. * ENTRY
  513. *
  514. * servername; asciz remote srv name, NULL if local
  515. * clientname; asciz remote computer name (returned by NetSessionEnum)
  516. * of session being deleted
  517. * In the case of a Win95 NWSERVER, the clientname should be the
  518. * ascii connection number
  519. * reserved; session key returned by NetSessionEnum
  520. *
  521. * EXIT
  522. *
  523. * 0 = success
  524. * NERR_NetNotStarted
  525. * ERROR_BAD_NETPATH
  526. * NERR_ServerNotStarted
  527. * ERROR_INVALID_LEVEL
  528. * NERR_RemoteErr
  529. * NERR_RemoteOnly
  530. * ERROR_ACCESS_DENIED
  531. * NERR_BufTooSmall
  532. * NERR_ClientNameNotFound
  533. *
  534. ***/
  535. extern API_FUNCTION
  536. NetSessionDel ( const char FAR * pszServer,
  537. const char FAR * pszClientName,
  538. short sReserved );
  539. /*** NetSessionEnum
  540. *
  541. * API_FUNCTION NetSessionEnum( servername,
  542. * level,
  543. * buf,
  544. * buflen,
  545. * entriesread,
  546. * totalentries )
  547. * ENTRY
  548. *
  549. * servername; asciz remote srv name, NULL if local
  550. * level; level of detail requested; (50 for Win95 peer servers)
  551. * buf; for returned entries
  552. * buflen; size of buffer on call;
  553. * entriesread; # of entries supplied on return
  554. * totalentries; total # of entries available
  555. *
  556. * EXIT
  557. *
  558. * 0 = success
  559. * NERR_NetNotStarted
  560. * NERR_ServerNotStarted
  561. * ERROR_BAD_NETPATH
  562. * ERROR_INVALID_LEVEL
  563. * NERR_RemoteErr
  564. * ERROR_MORE_DATA
  565. * ERROR_ACCESS_DENIED
  566. *
  567. * Buffer contains an array of session_info structures.
  568. *
  569. ***/
  570. extern API_FUNCTION
  571. NetSessionEnum ( const char FAR * pszServer,
  572. short sLevel,
  573. char FAR * pbBuffer,
  574. unsigned short cbBuffer,
  575. unsigned short FAR * pcEntriesRead,
  576. unsigned short FAR * pcTotalAvail );
  577. extern API_FUNCTION
  578. NetSessionGetInfo ( const char FAR * pszServer,
  579. const char FAR * pszClientName,
  580. short sLevel,
  581. char FAR * pbBuffer,
  582. unsigned short cbBuffer,
  583. unsigned short FAR * pcbTotalAvail );
  584. /****************************************************************
  585. * *
  586. * Data structure templates - SESSION *
  587. * *
  588. ****************************************************************/
  589. struct session_info_0 {
  590. char FAR * sesi0_cname;
  591. }; /* session_info_0 */
  592. struct session_info_1 {
  593. char FAR * sesi1_cname;
  594. char FAR * sesi1_username;
  595. unsigned short sesi1_num_conns;
  596. unsigned short sesi1_num_opens;
  597. unsigned short sesi1_num_users;
  598. unsigned long sesi1_time;
  599. unsigned long sesi1_idle_time;
  600. unsigned long sesi1_user_flags;
  601. }; /* session_info_1 */
  602. struct session_info_2 {
  603. char FAR * sesi2_cname;
  604. char FAR * sesi2_username;
  605. unsigned short sesi2_num_conns;
  606. unsigned short sesi2_num_opens;
  607. unsigned short sesi2_num_users;
  608. unsigned long sesi2_time;
  609. unsigned long sesi2_idle_time;
  610. unsigned long sesi2_user_flags;
  611. char FAR * sesi2_cltype_name;
  612. }; /* session_info_2 */
  613. struct session_info_10 {
  614. char FAR * sesi10_cname;
  615. char FAR * sesi10_username;
  616. unsigned long sesi10_time;
  617. unsigned long sesi10_idle_time;
  618. }; /* session_info_10 */
  619. struct session_info_50 {
  620. char FAR * sesi50_cname; //remote computer name (connection id in Netware)
  621. char FAR * sesi50_username;
  622. unsigned long sesi50_key; // used to delete session (not used in Netware)
  623. unsigned short sesi50_num_conns;
  624. unsigned short sesi50_num_opens; //not available in Netware
  625. unsigned long sesi50_time;
  626. unsigned long sesi50_idle_time; //not available in Netware
  627. unsigned char sesi50_protocol;
  628. unsigned char pad1;
  629. }; /* session_info_50 */
  630. /****************************************************************
  631. * *
  632. * Special values and constants - SESSION *
  633. * *
  634. ****************************************************************/
  635. /*
  636. * Bits defined in sesi1_user_flags.
  637. */
  638. #define SESS_GUEST 1 /* session is logged on as a guest */
  639. #define SESS_NOENCRYPTION 2 /* session is not using encryption */
  640. #define SESI1_NUM_ELEMENTS 8
  641. #define SESI2_NUM_ELEMENTS 9
  642. /****************************************************************
  643. * *
  644. * Connection Class *
  645. * *
  646. ****************************************************************/
  647. /****************************************************************
  648. * *
  649. * Function prototypes - CONNECTION *
  650. * *
  651. * Peer Server Support
  652. * NetConnectionEnum -
  653. * sLevel 50 on VSERVER and NWSERVER *
  654. * On NWSERVER, this API doesnt provide more *
  655. * information than NetSessionEnum
  656. ****************************************************************/
  657. /*** NetConnectionEnum (Admin only)
  658. *
  659. * API_FUNCTION NetConnectionEnum( servername,
  660. * qualifier,
  661. * level,
  662. * buf,
  663. * buflen,
  664. * totalavail )
  665. *
  666. * ENTRY
  667. *
  668. * servername; asciz remote srv name, NULL if local
  669. * qualifier; netname or client computer name.
  670. * computer name should be prefaced by '\\'.
  671. * level; level of info requested
  672. * buf; for returned entry
  673. * buflen; size of buffer
  674. * totalavail; total size needed for buffer
  675. *
  676. * EXIT
  677. *
  678. * 0 = success
  679. * NERR_NetNotStarted
  680. * NERR_ServerNotStarted
  681. * ERROR_INVALID_LEVEL
  682. * NERR_RemoteErr
  683. * NERR_RemoteOnly (DOS)
  684. * ERROR_MORE_DATA
  685. * ERROR_ACCESS_DENIED
  686. * NERR_ClientNameNotFound
  687. * NERR_NetNameNotFound
  688. *
  689. * Buffer contents on response (format for a single entry):
  690. * Level 50 contains a "struct connection_info_50".
  691. ***/
  692. extern API_FUNCTION
  693. NetConnectionEnum ( const char FAR * pszServer,
  694. const char FAR * pszQualifier, /* upper case */
  695. short sLevel,
  696. char FAR * pbBuffer,
  697. unsigned short cbBuffer,
  698. unsigned short FAR * pcEntriesRead,
  699. unsigned short FAR * pcTotalAvail );
  700. /****************************************************************
  701. * *
  702. * Data structure templates - CONNECTION *
  703. * *
  704. ****************************************************************/
  705. struct connection_info_0 {
  706. unsigned short coni0_id;
  707. }; /* connection_info_0 */
  708. struct connection_info_1 {
  709. unsigned short coni1_id;
  710. unsigned short coni1_type;
  711. unsigned short coni1_num_opens;
  712. unsigned short coni1_num_users;
  713. unsigned long coni1_time;
  714. char FAR * coni1_username;
  715. char FAR * coni1_netname;
  716. }; /* connection_info_1 */
  717. struct connection_info_50 {
  718. unsigned short coni50_type; // share type
  719. unsigned short coni50_num_opens; //not used in Netware
  720. unsigned long coni50_time;
  721. char FAR * coni50_netname; // share name
  722. char FAR * coni50_username; // user connected to share
  723. }; /* connection_info_50 */
  724. /****************************************************************
  725. * *
  726. * File Class *
  727. * *
  728. ****************************************************************/
  729. /****************************************************************
  730. * *
  731. * Function prototypes - FILE *
  732. * *
  733. * Peer Server Support
  734. * NetFileEnum - sLevel 50 on VSERVER and NWSERVER *
  735. * NetFileClose2 - VSERVER only
  736. ****************************************************************/
  737. /*** NetFileClose2
  738. *
  739. * int FAR PASCAL NetFileClose2( servername, fileid )
  740. *
  741. * ENTRY
  742. *
  743. * servername; asciz remote srv name, NULL if local
  744. * fileid; file id supplied by NetFileEnum
  745. *
  746. * EXIT
  747. *
  748. * 0 = success
  749. * NERR_NetNotStarted
  750. * NERR_ServerNotStarted
  751. * NERR_RemoteErr
  752. * ERROR_ACCESS_DENIED
  753. * NERR_FileIdNotFound
  754. *
  755. ***/
  756. extern API_FUNCTION
  757. NetFileClose2 ( const char FAR * pszServer,
  758. unsigned long ulFileId );
  759. /*** NetFileEnum (Admin Only)
  760. *
  761. * int FAR PASCAL NetFileEnum( servername,
  762. * level,
  763. * buf,
  764. * buflen,
  765. * entriesread,
  766. * totalentries )
  767. *
  768. * ENTRY
  769. *
  770. * servername; asciz remote srv name, NULL if local
  771. * basepath; path qualifier for file matching
  772. * (not used for Win95 NWSERVER)
  773. * level; level of detail requested; (50 for Win95 peer servers)
  774. * buf; for returned entries
  775. * buflen; size of buffer on call;
  776. * entriesread; # of entries supplied on return
  777. * totalentries; total # of entries available
  778. *
  779. * EXIT
  780. *
  781. * 0 = success
  782. * NERR_RemoteOnly
  783. * NERR_NetNotStarted
  784. * NERR_ServerNotStarted
  785. * ERROR_INVALID_LEVEL
  786. * NERR_RemoteErr
  787. * ERROR_MORE_DATA
  788. * ERROR_ACCESS_DENIED
  789. *
  790. *
  791. * Buffer contents on response (format for a single entry):
  792. * Level 0 contains a "struct file_info_0".
  793. * Level 50 contains a "struct file_info_50".
  794. *
  795. ***/
  796. extern API_FUNCTION
  797. NetFileEnum ( const char FAR * pszServer,
  798. const char FAR * pszBasePath,
  799. short sLevel,
  800. char FAR * pbBuffer,
  801. unsigned short cbBuffer,
  802. unsigned short FAR * pcEntriesRead,
  803. unsigned short FAR * pcTotalAvail );
  804. /****************************************************************
  805. * *
  806. * Data structure templates - FILE *
  807. * *
  808. ****************************************************************/
  809. struct file_info_0 {
  810. unsigned short fi0_id;
  811. }; /* file_info_0 */
  812. struct file_info_1 {
  813. unsigned short fi1_id;
  814. unsigned short fi1_permissions;
  815. unsigned short fi1_num_locks;
  816. char FAR * fi1_pathname;
  817. char FAR * fi1_username;
  818. }; /* file_info_1 */
  819. struct file_info_2 {
  820. unsigned long fi2_id;
  821. }; /* file_info_2 */
  822. struct file_info_3 {
  823. unsigned long fi3_id;
  824. unsigned short fi3_permissions;
  825. unsigned short fi3_num_locks;
  826. char FAR * fi3_pathname;
  827. char FAR * fi3_username;
  828. }; /* file_info_3 */
  829. struct file_info_50 {
  830. unsigned long fi50_id; // not used on NWSERVER
  831. unsigned short fi50_permissions; // not available on NWSERVER
  832. unsigned short fi50_num_locks; // not available on NWSERVER
  833. char FAR * fi50_pathname;
  834. char FAR * fi50_username;
  835. char FAR * fi50_sharename;
  836. }; /* file_info_50 */
  837. struct res_file_enum_2 {
  838. unsigned short res_pad; /* not used now */
  839. unsigned short res_fs; /* server type */
  840. unsigned long res_pro; /* progressive */
  841. }; /* res_file_enum_2 */
  842. /****************************************************************
  843. * *
  844. * Special values and constants - FILE *
  845. * *
  846. ****************************************************************/
  847. /* bit values for permissions */
  848. #define PERM_FILE_READ 0x1 /* user has read access */
  849. #define PERM_FILE_WRITE 0x2 /* user has write access */
  850. #define PERM_FILE_CREATE 0x4 /* user has create access */
  851. typedef struct res_file_enum_2 FRK;
  852. /*NOINC*/
  853. #define FRK_INIT( f ) \
  854. { \
  855. (f).res_pad = 0L; \
  856. (f).res_fs = 0; \
  857. (f).res_pro = 0; \
  858. }
  859. /*INC*/
  860. /****************************************************************
  861. * *
  862. * Server Class *
  863. * *
  864. ****************************************************************/
  865. /****************************************************************
  866. * *
  867. * Function prototypes - SERVER *
  868. * *
  869. * Peer Server Support
  870. * NetServerGetInfo - sLevel 1,50 on NWSERVER, VSERVER
  871. ****************************************************************/
  872. /* 6.2 NetServerGetInfo
  873. *
  874. * Purpose: Read the current configuration parameters of the server.
  875. *
  876. * int FAR PASCAL
  877. * NetServerGetInfo( servername, level, buf, buflen, totalavail )
  878. * char FAR * servername; asciz remote server name or NULL if local
  879. * short level; level of information to be returned
  880. * char FAR * buf; for returned data
  881. * unsigned short buflen; size of buffer
  882. * unsigned short FAR *totalavail; total size needed for buffer
  883. *
  884. * Buffer contents on response (format for a single entry):
  885. * Level 1 contains a "struct server_info_1".
  886. * Level 50 contains a "struct server_info_50".
  887. *
  888. * If the buflen is not large enough for all of the information, the call
  889. * will return as much as will fit in the buffer.
  890. *
  891. * Returns 0 if successful. Error return information:
  892. *
  893. * - ERROR_INVALID_LEVEL - Level parameter specified is invalid
  894. * - ERROR_INVALID_PARAMETER - An invalid input parameter was detected.
  895. * - NERR_NetNotStarted - Network not installed on local machine
  896. * - NERR_ServerNotStarted - Server is not started
  897. * - NERR_BufTooSmall - The buffer supplied was to small to
  898. * return the fixed length structure
  899. * requested.
  900. * - NERR_MoreData - The buffer supplied was too small to
  901. * return all the information available
  902. * for this server.
  903. *
  904. */
  905. extern API_FUNCTION
  906. NetServerGetInfo ( const char FAR * pszServer,
  907. short sLevel,
  908. char FAR * pbBuffer,
  909. unsigned short cbBuffer,
  910. unsigned short FAR * pcbTotalAvail );
  911. /****************************************************************
  912. * *
  913. * Data structure templates - SERVER *
  914. * *
  915. ****************************************************************/
  916. struct server_info_0 {
  917. char sv0_name[CNLEN + 1]; /* Server name */
  918. }; /* server_info_0 */
  919. struct server_info_1 {
  920. char sv1_name[CNLEN + 1];
  921. unsigned char sv1_version_major; /* Major version # of net */
  922. unsigned char sv1_version_minor; /* Minor version # of net */
  923. unsigned long sv1_type; /* Server type */
  924. char FAR * sv1_comment; /* Exported server comment */
  925. }; /* server_info_1 */
  926. /* NOTE struct prefix must equal server_info_1 like below! */
  927. struct server_info_50 {
  928. char sv50_name[CNLEN + 1];
  929. unsigned char sv50_version_major; /* Major version # of net */
  930. unsigned char sv50_version_minor; /* Minor version # of net */
  931. unsigned long sv50_type; /* Server type */
  932. char FAR * sv50_comment; /* Exported server comment */
  933. unsigned short sv50_security; /* SV_SECURITY_* (see below) */
  934. unsigned short sv50_auditing; /* 0 = no auditing; nonzero = auditing */
  935. char FAR * sv50_container; /* Security server/domain */
  936. char FAR * sv50_ab_server; /* Address book server */
  937. char FAR * sv50_ab_dll; /* Address book provider DLL */
  938. }; /* server_info_50 */
  939. struct server_info_2 {
  940. char sv2_name[CNLEN + 1];
  941. unsigned char sv2_version_major;
  942. unsigned char sv2_version_minor;
  943. unsigned long sv2_type;
  944. char FAR * sv2_comment;
  945. unsigned long sv2_ulist_mtime; /* User list, last modification time */
  946. unsigned long sv2_glist_mtime; /* Group list, last modification time */
  947. unsigned long sv2_alist_mtime; /* Access list, last modification time */
  948. unsigned short sv2_users; /* max number of users allowed */
  949. unsigned short sv2_disc; /* auto-disconnect timeout(in minutes) */
  950. char FAR * sv2_alerts; /* alert names (semicolon separated) */
  951. unsigned short sv2_security; /* SV_USERSECURITY or SV_SHARESECURITY */
  952. unsigned short sv2_auditing; /* 0 = no auditing; nonzero = auditing */
  953. unsigned short sv2_numadmin; /* max number of administrators allowed */
  954. unsigned short sv2_lanmask; /* bit mask representing the srv'd nets */
  955. unsigned short sv2_hidden; /* 0 = visible; nonzero = hidden */
  956. unsigned short sv2_announce; /* visible server announce rate (sec) */
  957. unsigned short sv2_anndelta; /* announce randomize interval (sec) */
  958. /* name of guest account */
  959. char sv2_guestacct[LM20_UNLEN + 1];
  960. unsigned char sv2_pad1; /* Word alignment pad byte */
  961. char FAR * sv2_userpath; /* ASCIIZ path to user directories */
  962. unsigned short sv2_chdevs; /* max # shared character devices */
  963. unsigned short sv2_chdevq; /* max # character device queues */
  964. unsigned short sv2_chdevjobs; /* max # character device jobs */
  965. unsigned short sv2_connections; /* max # of connections */
  966. unsigned short sv2_shares; /* max # of shares */
  967. unsigned short sv2_openfiles; /* max # of open files */
  968. unsigned short sv2_sessopens; /* max # of open files per session */
  969. unsigned short sv2_sessvcs; /* max # of virtual circuits per client */
  970. unsigned short sv2_sessreqs; /* max # of simul. reqs. from a client */
  971. unsigned short sv2_opensearch; /* max # of open searches */
  972. unsigned short sv2_activelocks; /* max # of active file locks */
  973. unsigned short sv2_numreqbuf; /* number of server (standard) buffers */
  974. unsigned short sv2_sizreqbuf; /* size of svr (standard) bufs (bytes) */
  975. unsigned short sv2_numbigbuf; /* number of big (64K) buffers */
  976. unsigned short sv2_numfiletasks;/* number of file worker processes */
  977. unsigned short sv2_alertsched; /* alert counting interval (minutes) */
  978. unsigned short sv2_erroralert; /* error log alerting threshold */
  979. unsigned short sv2_logonalert; /* logon violation alerting threshold */
  980. unsigned short sv2_accessalert; /* access violation alerting threshold */
  981. unsigned short sv2_diskalert; /* low disk space alert threshold (KB) */
  982. unsigned short sv2_netioalert; /* net I/O error ratio alert threshold */
  983. /* (tenths of a percent) */
  984. unsigned short sv2_maxauditsz; /* Maximum audit file size (KB) */
  985. char FAR * sv2_srvheuristics; /* performance related server switches*/
  986. }; /* server_info_2 */
  987. struct server_info_3 {
  988. char sv3_name[CNLEN + 1];
  989. unsigned char sv3_version_major;
  990. unsigned char sv3_version_minor;
  991. unsigned long sv3_type;
  992. char FAR * sv3_comment;
  993. unsigned long sv3_ulist_mtime; /* User list, last modification time */
  994. unsigned long sv3_glist_mtime; /* Group list, last modification time */
  995. unsigned long sv3_alist_mtime; /* Access list, last modification time */
  996. unsigned short sv3_users; /* max number of users allowed */
  997. unsigned short sv3_disc; /* auto-disconnect timeout(in minutes) */
  998. char FAR * sv3_alerts; /* alert names (semicolon separated) */
  999. unsigned short sv3_security; /* SV_USERSECURITY or SV_SHARESECURITY */
  1000. unsigned short sv3_auditing; /* 0 = no auditing; nonzero = auditing */
  1001. unsigned short sv3_numadmin; /* max number of administrators allowed */
  1002. unsigned short sv3_lanmask; /* bit mask representing the srv'd nets */
  1003. unsigned short sv3_hidden; /* 0 = visible; nonzero = hidden */
  1004. unsigned short sv3_announce; /* visible server announce rate (sec) */
  1005. unsigned short sv3_anndelta; /* announce randomize interval (sec) */
  1006. /* name of guest account */
  1007. char sv3_guestacct[LM20_UNLEN + 1];
  1008. unsigned char sv3_pad1; /* Word alignment pad byte */
  1009. char FAR * sv3_userpath; /* ASCIIZ path to user directories */
  1010. unsigned short sv3_chdevs; /* max # shared character devices */
  1011. unsigned short sv3_chdevq; /* max # character device queues */
  1012. unsigned short sv3_chdevjobs; /* max # character device jobs */
  1013. unsigned short sv3_connections; /* max # of connections */
  1014. unsigned short sv3_shares; /* max # of shares */
  1015. unsigned short sv3_openfiles; /* max # of open files */
  1016. unsigned short sv3_sessopens; /* max # of open files per session */
  1017. unsigned short sv3_sessvcs; /* max # of virtual circuits per client */
  1018. unsigned short sv3_sessreqs; /* max # of simul. reqs. from a client */
  1019. unsigned short sv3_opensearch; /* max # of open searches */
  1020. unsigned short sv3_activelocks; /* max # of active file locks */
  1021. unsigned short sv3_numreqbuf; /* number of server (standard) buffers */
  1022. unsigned short sv3_sizreqbuf; /* size of svr (standard) bufs (bytes) */
  1023. unsigned short sv3_numbigbuf; /* number of big (64K) buffers */
  1024. unsigned short sv3_numfiletasks;/* number of file worker processes */
  1025. unsigned short sv3_alertsched; /* alert counting interval (minutes) */
  1026. unsigned short sv3_erroralert; /* error log alerting threshold */
  1027. unsigned short sv3_logonalert; /* logon violation alerting threshold */
  1028. unsigned short sv3_accessalert; /* access violation alerting threshold */
  1029. unsigned short sv3_diskalert; /* low disk space alert threshold (KB) */
  1030. unsigned short sv3_netioalert; /* net I/O error ratio alert threshold */
  1031. /* (tenths of a percent) */
  1032. unsigned short sv3_maxauditsz; /* Maximum audit file size (KB) */
  1033. char FAR * sv3_srvheuristics; /* performance related server switches*/
  1034. unsigned long sv3_auditedevents; /* Audit event control mask */
  1035. unsigned short sv3_autoprofile; /* (0,1,2,3) = (NONE,LOAD,SAVE,or BOTH) */
  1036. char FAR * sv3_autopath; /* file pathname (where to load & save) */
  1037. }; /* server_info_3 */
  1038. /****************************************************************
  1039. * *
  1040. * Special values and constants - SERVER *
  1041. * *
  1042. ****************************************************************/
  1043. /*
  1044. * Mask to be applied to svX_version_major in order to obtain
  1045. * the major version number.
  1046. */
  1047. #define MAJOR_VERSION_MASK 0x0F
  1048. /*
  1049. * Bit-mapped values for svX_type fields. X = 1, 2 or 3.
  1050. */
  1051. #define SV_TYPE_WORKSTATION 0x00000001
  1052. #define SV_TYPE_SERVER 0x00000002
  1053. #define SV_TYPE_SQLSERVER 0x00000004
  1054. #define SV_TYPE_DOMAIN_CTRL 0x00000008
  1055. #define SV_TYPE_DOMAIN_BAKCTRL 0x00000010
  1056. #define SV_TYPE_TIME_SOURCE 0x00000020
  1057. #define SV_TYPE_AFP 0x00000040
  1058. #define SV_TYPE_NOVELL 0x00000080 /* This flag is also set by Win95 NWSERVER */
  1059. #define SV_TYPE_DOMAIN_MEMBER 0x00000100
  1060. #define SV_TYPE_PRINTQ_SERVER 0x00000200
  1061. #define SV_TYPE_DIALIN_SERVER 0x00000400
  1062. #define SV_TYPE_ALL 0xFFFFFFFF /* handy for NetServerEnum2 */
  1063. /*
  1064. * Special value for svX_disc that specifies infinite disconnect
  1065. * time. X = 2 or 3.
  1066. */
  1067. #define SV_NODISC 0xFFFF /* No autodisconnect timeout enforced */
  1068. /*
  1069. * Values of svX_security field. X = 2 or 3.
  1070. */
  1071. #define SV_USERSECURITY 1
  1072. #define SV_SHARESECURITY 0
  1073. /*
  1074. * Values of svX_security field. X = 50.
  1075. * For Win95 NWSERVER, the only possible returned value is SV_SECURITY_NETWARE.
  1076. */
  1077. #define SV_SECURITY_SHARE 0 /* Share-level */
  1078. #define SV_SECURITY_WINNT 1 /* User-level - Windows NT workst'n */
  1079. #define SV_SECURITY_WINNTAS 2 /* User-level - Windows NT domain */
  1080. #define SV_SECURITY_NETWARE 3 /* User-level - NetWare 3.x bindery */
  1081. /*
  1082. * Values of svX_hidden field. X = 2 or 3.
  1083. */
  1084. #define SV_HIDDEN 1
  1085. #define SV_VISIBLE 0
  1086. #define SVI1_NUM_ELEMENTS 5
  1087. #define SVI2_NUM_ELEMENTS 44
  1088. #define SVI3_NUM_ELEMENTS 45
  1089. /*
  1090. * Masks describing AUTOPROFILE parameters
  1091. */
  1092. #define SW_AUTOPROF_LOAD_MASK 0x1
  1093. #define SW_AUTOPROF_SAVE_MASK 0x2
  1094. /****************************************************************
  1095. * *
  1096. * Security Class *
  1097. * *
  1098. ****************************************************************/
  1099. /****************************************************************
  1100. * *
  1101. * Function prototypes - SECURITY *
  1102. * *
  1103. ****************************************************************/
  1104. extern API_FUNCTION
  1105. NetSecurityGetInfo ( const char FAR * pszServer,
  1106. short sLevel,
  1107. char FAR * pbBuffer,
  1108. unsigned short cbBuffer,
  1109. unsigned short FAR * pcbTotalAvail );
  1110. /****************************************************************
  1111. * *
  1112. * Data structure templates - SECURITY *
  1113. * *
  1114. ****************************************************************/
  1115. struct security_info_1 {
  1116. unsigned long sec1_security; /* SEC_SECURITY_* (see below) */
  1117. char FAR * sec1_container; /* Security server/domain */
  1118. char FAR * sec1_ab_server; /* Address book server */
  1119. char FAR * sec1_ab_dll; /* Address book provider DLL */
  1120. }; /* security_info_1 */
  1121. /****************************************************************
  1122. * *
  1123. * Special values and constants - SECURITY *
  1124. * *
  1125. ****************************************************************/
  1126. /*
  1127. /*
  1128. * Values of secX_security field. X = 1.
  1129. */
  1130. #define SEC_SECURITY_SHARE SV_SECURITY_SHARE
  1131. #define SEC_SECURITY_WINNT SV_SECURITY_WINNT
  1132. #define SEC_SECURITY_WINNTAS SV_SECURITY_WINNTAS
  1133. #define SEC_SECURITY_NETWARE SV_SECURITY_NETWARE
  1134. /*NOINC*/
  1135. #ifdef __cplusplus
  1136. }
  1137. #endif /* __cplusplus */
  1138. #ifndef RC_INVOKED
  1139. #pragma pack() /* Revert to default packing */
  1140. #endif
  1141. #endif /* SVRAPI_INCLUDED */
  1142. /*INC*/