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.

1315 lines
46 KiB

  1. /********************************************************************/
  2. /** Microsoft Windows **/
  3. /** Copyright(c) Microsoft Corp., 1995-1996 **/
  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. /* The share is restored on system startup */
  457. #define SHI50F_PERSIST 0x0100
  458. /* The share is not normally visible */
  459. #define SHI50F_SYSTEM 0x0200
  460. /*
  461. * Values for parmnum parameter to NetShareSetInfo.
  462. */
  463. #ifndef PARMNUM_ALL
  464. #define PARMNUM_ALL 0
  465. #endif
  466. #define SHI_REMARK_PARMNUM 4
  467. #define SHI_PERMISSIONS_PARMNUM 5
  468. #define SHI_MAX_USES_PARMNUM 6
  469. #define SHI_PASSWD_PARMNUM 9
  470. #define SHI1_NUM_ELEMENTS 4
  471. #define SHI2_NUM_ELEMENTS 10
  472. /*
  473. * Share types .
  474. *
  475. * STYPE_DISKTREE and STYPE_PRINTQ are recognized on peer servers
  476. */
  477. #define STYPE_DISKTREE 0 /* disk share */
  478. #define STYPE_PRINTQ 1 /* printer share */
  479. #define STYPE_DEVICE 2
  480. #define STYPE_IPC 3
  481. #define SHI_USES_UNLIMITED -1
  482. /****************************************************************
  483. * *
  484. * Session Class *
  485. * *
  486. ****************************************************************/
  487. /****************************************************************
  488. * *
  489. * Function prototypes - SESSION *
  490. *
  491. * Peer Server Support *
  492. * NetSessionDel() - NWSERVER and VSERVER *
  493. * NetSessionEnum() - sLevel 50 on NWSERVER and VSERVER *
  494. * NetSessionGetInfo() - not supported on peer servers *
  495. ****************************************************************/
  496. /*** NetSessionDel (Admin only)
  497. *
  498. *
  499. * API_FUNCTION NetSessionDel( servername, clientname, reserved )
  500. *
  501. * ENTRY
  502. *
  503. * servername; asciz remote srv name, NULL if local
  504. * clientname; asciz remote computer name (returned by NetSessionEnum)
  505. * of session being deleted
  506. * In the case of a Win95 NWSERVER, the clientname should be the
  507. * ascii connection number
  508. * reserved; session key returned by NetSessionEnum
  509. *
  510. * EXIT
  511. *
  512. * 0 = success
  513. * NERR_NetNotStarted
  514. * ERROR_BAD_NETPATH
  515. * NERR_ServerNotStarted
  516. * ERROR_INVALID_LEVEL
  517. * NERR_RemoteErr
  518. * NERR_RemoteOnly
  519. * ERROR_ACCESS_DENIED
  520. * NERR_BufTooSmall
  521. * NERR_ClientNameNotFound
  522. *
  523. ***/
  524. extern API_FUNCTION
  525. NetSessionDel ( const char FAR * pszServer,
  526. const char FAR * pszClientName,
  527. short sReserved );
  528. /*** NetSessionEnum
  529. *
  530. * API_FUNCTION NetSessionEnum( servername,
  531. * level,
  532. * buf,
  533. * buflen,
  534. * entriesread,
  535. * totalentries )
  536. * ENTRY
  537. *
  538. * servername; asciz remote srv name, NULL if local
  539. * level; level of detail requested; (50 for Win95 peer servers)
  540. * buf; for returned entries
  541. * buflen; size of buffer on call;
  542. * entriesread; # of entries supplied on return
  543. * totalentries; total # of entries available
  544. *
  545. * EXIT
  546. *
  547. * 0 = success
  548. * NERR_NetNotStarted
  549. * NERR_ServerNotStarted
  550. * ERROR_BAD_NETPATH
  551. * ERROR_INVALID_LEVEL
  552. * NERR_RemoteErr
  553. * ERROR_MORE_DATA
  554. * ERROR_ACCESS_DENIED
  555. *
  556. * Buffer contains an array of session_info structures.
  557. *
  558. ***/
  559. extern API_FUNCTION
  560. NetSessionEnum ( const char FAR * pszServer,
  561. short sLevel,
  562. char FAR * pbBuffer,
  563. unsigned short cbBuffer,
  564. unsigned short FAR * pcEntriesRead,
  565. unsigned short FAR * pcTotalAvail );
  566. extern API_FUNCTION
  567. NetSessionGetInfo ( const char FAR * pszServer,
  568. const char FAR * pszClientName,
  569. short sLevel,
  570. char FAR * pbBuffer,
  571. unsigned short cbBuffer,
  572. unsigned short FAR * pcbTotalAvail );
  573. /****************************************************************
  574. * *
  575. * Data structure templates - SESSION *
  576. * *
  577. ****************************************************************/
  578. struct session_info_0 {
  579. char FAR * sesi0_cname;
  580. }; /* session_info_0 */
  581. struct session_info_1 {
  582. char FAR * sesi1_cname;
  583. char FAR * sesi1_username;
  584. unsigned short sesi1_num_conns;
  585. unsigned short sesi1_num_opens;
  586. unsigned short sesi1_num_users;
  587. unsigned long sesi1_time;
  588. unsigned long sesi1_idle_time;
  589. unsigned long sesi1_user_flags;
  590. }; /* session_info_1 */
  591. struct session_info_2 {
  592. char FAR * sesi2_cname;
  593. char FAR * sesi2_username;
  594. unsigned short sesi2_num_conns;
  595. unsigned short sesi2_num_opens;
  596. unsigned short sesi2_num_users;
  597. unsigned long sesi2_time;
  598. unsigned long sesi2_idle_time;
  599. unsigned long sesi2_user_flags;
  600. char FAR * sesi2_cltype_name;
  601. }; /* session_info_2 */
  602. struct session_info_10 {
  603. char FAR * sesi10_cname;
  604. char FAR * sesi10_username;
  605. unsigned long sesi10_time;
  606. unsigned long sesi10_idle_time;
  607. }; /* session_info_10 */
  608. struct session_info_50 {
  609. char FAR * sesi50_cname; //remote computer name (connection id in Netware)
  610. char FAR * sesi50_username;
  611. unsigned long sesi50_key; // used to delete session (not used in Netware)
  612. unsigned short sesi50_num_conns;
  613. unsigned short sesi50_num_opens; //not available in Netware
  614. unsigned long sesi50_time;
  615. unsigned long sesi50_idle_time; //not available in Netware
  616. unsigned char sesi50_protocol;
  617. unsigned char pad1;
  618. }; /* session_info_50 */
  619. /****************************************************************
  620. * *
  621. * Special values and constants - SESSION *
  622. * *
  623. ****************************************************************/
  624. /*
  625. * Bits defined in sesi1_user_flags.
  626. */
  627. #define SESS_GUEST 1 /* session is logged on as a guest */
  628. #define SESS_NOENCRYPTION 2 /* session is not using encryption */
  629. #define SESI1_NUM_ELEMENTS 8
  630. #define SESI2_NUM_ELEMENTS 9
  631. /****************************************************************
  632. * *
  633. * Connection Class *
  634. * *
  635. ****************************************************************/
  636. /****************************************************************
  637. * *
  638. * Function prototypes - CONNECTION *
  639. * *
  640. * Peer Server Support
  641. * NetConnectionEnum -
  642. * sLevel 50 on VSERVER and NWSERVER *
  643. * On NWSERVER, this API doesnt provide more *
  644. * information than NetSessionEnum
  645. ****************************************************************/
  646. /*** NetConnectionEnum (Admin only)
  647. *
  648. * API_FUNCTION NetConnectionEnum( servername,
  649. * qualifier,
  650. * level,
  651. * buf,
  652. * buflen,
  653. * totalavail )
  654. *
  655. * ENTRY
  656. *
  657. * servername; asciz remote srv name, NULL if local
  658. * qualifier; netname or client computer name.
  659. * computer name should be prefaced by '\\'.
  660. * level; level of info requested
  661. * buf; for returned entry
  662. * buflen; size of buffer
  663. * totalavail; total size needed for buffer
  664. *
  665. * EXIT
  666. *
  667. * 0 = success
  668. * NERR_NetNotStarted
  669. * NERR_ServerNotStarted
  670. * ERROR_INVALID_LEVEL
  671. * NERR_RemoteErr
  672. * NERR_RemoteOnly (DOS)
  673. * ERROR_MORE_DATA
  674. * ERROR_ACCESS_DENIED
  675. * NERR_ClientNameNotFound
  676. * NERR_NetNameNotFound
  677. *
  678. * Buffer contents on response (format for a single entry):
  679. * Level 50 contains a "struct connection_info_50".
  680. ***/
  681. extern API_FUNCTION
  682. NetConnectionEnum ( const char FAR * pszServer,
  683. const char FAR * pszQualifier, /* upper case */
  684. short sLevel,
  685. char FAR * pbBuffer,
  686. unsigned short cbBuffer,
  687. unsigned short FAR * pcEntriesRead,
  688. unsigned short FAR * pcTotalAvail );
  689. /****************************************************************
  690. * *
  691. * Data structure templates - CONNECTION *
  692. * *
  693. ****************************************************************/
  694. struct connection_info_0 {
  695. unsigned short coni0_id;
  696. }; /* connection_info_0 */
  697. struct connection_info_1 {
  698. unsigned short coni1_id;
  699. unsigned short coni1_type;
  700. unsigned short coni1_num_opens;
  701. unsigned short coni1_num_users;
  702. unsigned long coni1_time;
  703. char FAR * coni1_username;
  704. char FAR * coni1_netname;
  705. }; /* connection_info_1 */
  706. struct connection_info_50 {
  707. unsigned short coni50_type; // share type
  708. unsigned short coni50_num_opens; //not used in Netware
  709. unsigned long coni50_time;
  710. char FAR * coni50_netname; // share name
  711. char FAR * coni50_username; // user connected to share
  712. }; /* connection_info_50 */
  713. /****************************************************************
  714. * *
  715. * File Class *
  716. * *
  717. ****************************************************************/
  718. /****************************************************************
  719. * *
  720. * Function prototypes - FILE *
  721. * *
  722. * Peer Server Support
  723. * NetFileEnum - sLevel 50 on VSERVER and NWSERVER *
  724. * NetFileClose2 - VSERVER only
  725. ****************************************************************/
  726. /*** NetFileClose2
  727. *
  728. * int FAR PASCAL NetFileClose2( servername, fileid )
  729. *
  730. * ENTRY
  731. *
  732. * servername; asciz remote srv name, NULL if local
  733. * fileid; file id supplied by NetFileEnum
  734. *
  735. * EXIT
  736. *
  737. * 0 = success
  738. * NERR_NetNotStarted
  739. * NERR_ServerNotStarted
  740. * NERR_RemoteErr
  741. * ERROR_ACCESS_DENIED
  742. * NERR_FileIdNotFound
  743. *
  744. ***/
  745. extern API_FUNCTION
  746. NetFileClose2 ( const char FAR * pszServer,
  747. unsigned long ulFileId );
  748. /*** NetFileEnum (Admin Only)
  749. *
  750. * int FAR PASCAL NetFileEnum( servername,
  751. * level,
  752. * buf,
  753. * buflen,
  754. * entriesread,
  755. * totalentries )
  756. *
  757. * ENTRY
  758. *
  759. * servername; asciz remote srv name, NULL if local
  760. * basepath; path qualifier for file matching
  761. * (not used for Win95 NWSERVER)
  762. * level; level of detail requested; (50 for Win95 peer servers)
  763. * buf; for returned entries
  764. * buflen; size of buffer on call;
  765. * entriesread; # of entries supplied on return
  766. * totalentries; total # of entries available
  767. *
  768. * EXIT
  769. *
  770. * 0 = success
  771. * NERR_RemoteOnly
  772. * NERR_NetNotStarted
  773. * NERR_ServerNotStarted
  774. * ERROR_INVALID_LEVEL
  775. * NERR_RemoteErr
  776. * ERROR_MORE_DATA
  777. * ERROR_ACCESS_DENIED
  778. *
  779. *
  780. * Buffer contents on response (format for a single entry):
  781. * Level 0 contains a "struct file_info_0".
  782. * Level 50 contains a "struct file_info_50".
  783. *
  784. ***/
  785. extern API_FUNCTION
  786. NetFileEnum ( const char FAR * pszServer,
  787. const char FAR * pszBasePath,
  788. short sLevel,
  789. char FAR * pbBuffer,
  790. unsigned short cbBuffer,
  791. unsigned short FAR * pcEntriesRead,
  792. unsigned short FAR * pcTotalAvail );
  793. /****************************************************************
  794. * *
  795. * Data structure templates - FILE *
  796. * *
  797. ****************************************************************/
  798. struct file_info_0 {
  799. unsigned short fi0_id;
  800. }; /* file_info_0 */
  801. struct file_info_1 {
  802. unsigned short fi1_id;
  803. unsigned short fi1_permissions;
  804. unsigned short fi1_num_locks;
  805. char FAR * fi1_pathname;
  806. char FAR * fi1_username;
  807. }; /* file_info_1 */
  808. struct file_info_2 {
  809. unsigned long fi2_id;
  810. }; /* file_info_2 */
  811. struct file_info_3 {
  812. unsigned long fi3_id;
  813. unsigned short fi3_permissions;
  814. unsigned short fi3_num_locks;
  815. char FAR * fi3_pathname;
  816. char FAR * fi3_username;
  817. }; /* file_info_3 */
  818. struct file_info_50 {
  819. unsigned long fi50_id; // not used on NWSERVER
  820. unsigned short fi50_permissions; // not available on NWSERVER
  821. unsigned short fi50_num_locks; // not available on NWSERVER
  822. char FAR * fi50_pathname;
  823. char FAR * fi50_username;
  824. char FAR * fi50_sharename;
  825. }; /* file_info_50 */
  826. struct res_file_enum_2 {
  827. unsigned short res_pad; /* not used now */
  828. unsigned short res_fs; /* server type */
  829. unsigned long res_pro; /* progressive */
  830. }; /* res_file_enum_2 */
  831. /****************************************************************
  832. * *
  833. * Special values and constants - FILE *
  834. * *
  835. ****************************************************************/
  836. /* bit values for permissions */
  837. #define PERM_FILE_READ 0x1 /* user has read access */
  838. #define PERM_FILE_WRITE 0x2 /* user has write access */
  839. #define PERM_FILE_CREATE 0x4 /* user has create access */
  840. typedef struct res_file_enum_2 FRK;
  841. /*NOINC*/
  842. #define FRK_INIT( f ) \
  843. { \
  844. (f).res_pad = 0L; \
  845. (f).res_fs = 0; \
  846. (f).res_pro = 0; \
  847. }
  848. /*INC*/
  849. /****************************************************************
  850. * *
  851. * Server Class *
  852. * *
  853. ****************************************************************/
  854. /****************************************************************
  855. * *
  856. * Function prototypes - SERVER *
  857. * *
  858. * Peer Server Support
  859. * NetServerGetInfo - sLevel 1,50 on NWSERVER, VSERVER
  860. ****************************************************************/
  861. /* 6.2 NetServerGetInfo
  862. *
  863. * Purpose: Read the current configuration parameters of the server.
  864. *
  865. * int FAR PASCAL
  866. * NetServerGetInfo( servername, level, buf, buflen, totalavail )
  867. * char FAR * servername; asciz remote server name or NULL if local
  868. * short level; level of information to be returned
  869. * char FAR * buf; for returned data
  870. * unsigned short buflen; size of buffer
  871. * unsigned short FAR *totalavail; total size needed for buffer
  872. *
  873. * Buffer contents on response (format for a single entry):
  874. * Level 1 contains a "struct server_info_1".
  875. * Level 50 contains a "struct server_info_50".
  876. *
  877. * If the buflen is not large enough for all of the information, the call
  878. * will return as much as will fit in the buffer.
  879. *
  880. * Returns 0 if successful. Error return information:
  881. *
  882. * - ERROR_INVALID_LEVEL - Level parameter specified is invalid
  883. * - ERROR_INVALID_PARAMETER - An invalid input parameter was detected.
  884. * - NERR_NetNotStarted - Network not installed on local machine
  885. * - NERR_ServerNotStarted - Server is not started
  886. * - NERR_BufTooSmall - The buffer supplied was to small to
  887. * return the fixed length structure
  888. * requested.
  889. * - NERR_MoreData - The buffer supplied was too small to
  890. * return all the information available
  891. * for this server.
  892. *
  893. */
  894. extern API_FUNCTION
  895. NetServerGetInfo ( const char FAR * pszServer,
  896. short sLevel,
  897. char FAR * pbBuffer,
  898. unsigned short cbBuffer,
  899. unsigned short FAR * pcbTotalAvail );
  900. /****************************************************************
  901. * *
  902. * Data structure templates - SERVER *
  903. * *
  904. ****************************************************************/
  905. struct server_info_0 {
  906. char sv0_name[CNLEN + 1]; /* Server name */
  907. }; /* server_info_0 */
  908. struct server_info_1 {
  909. char sv1_name[CNLEN + 1];
  910. unsigned char sv1_version_major; /* Major version # of net */
  911. unsigned char sv1_version_minor; /* Minor version # of net */
  912. unsigned long sv1_type; /* Server type */
  913. char FAR * sv1_comment; /* Exported server comment */
  914. }; /* server_info_1 */
  915. /* NOTE struct prefix must equal server_info_1 like below! */
  916. struct server_info_50 {
  917. char sv50_name[CNLEN + 1];
  918. unsigned char sv50_version_major; /* Major version # of net */
  919. unsigned char sv50_version_minor; /* Minor version # of net */
  920. unsigned long sv50_type; /* Server type */
  921. char FAR * sv50_comment; /* Exported server comment */
  922. unsigned short sv50_security; /* SV_SECURITY_* (see below) */
  923. unsigned short sv50_auditing; /* 0 = no auditing; nonzero = auditing */
  924. char FAR * sv50_container; /* Security server/domain */
  925. char FAR * sv50_ab_server; /* Address book server */
  926. char FAR * sv50_ab_dll; /* Address book provider DLL */
  927. }; /* server_info_50 */
  928. struct server_info_2 {
  929. char sv2_name[CNLEN + 1];
  930. unsigned char sv2_version_major;
  931. unsigned char sv2_version_minor;
  932. unsigned long sv2_type;
  933. char FAR * sv2_comment;
  934. unsigned long sv2_ulist_mtime; /* User list, last modification time */
  935. unsigned long sv2_glist_mtime; /* Group list, last modification time */
  936. unsigned long sv2_alist_mtime; /* Access list, last modification time */
  937. unsigned short sv2_users; /* max number of users allowed */
  938. unsigned short sv2_disc; /* auto-disconnect timeout(in minutes) */
  939. char FAR * sv2_alerts; /* alert names (semicolon separated) */
  940. unsigned short sv2_security; /* SV_USERSECURITY or SV_SHARESECURITY */
  941. unsigned short sv2_auditing; /* 0 = no auditing; nonzero = auditing */
  942. unsigned short sv2_numadmin; /* max number of administrators allowed */
  943. unsigned short sv2_lanmask; /* bit mask representing the srv'd nets */
  944. unsigned short sv2_hidden; /* 0 = visible; nonzero = hidden */
  945. unsigned short sv2_announce; /* visible server announce rate (sec) */
  946. unsigned short sv2_anndelta; /* announce randomize interval (sec) */
  947. /* name of guest account */
  948. char sv2_guestacct[LM20_UNLEN + 1];
  949. unsigned char sv2_pad1; /* Word alignment pad byte */
  950. char FAR * sv2_userpath; /* ASCIIZ path to user directories */
  951. unsigned short sv2_chdevs; /* max # shared character devices */
  952. unsigned short sv2_chdevq; /* max # character device queues */
  953. unsigned short sv2_chdevjobs; /* max # character device jobs */
  954. unsigned short sv2_connections; /* max # of connections */
  955. unsigned short sv2_shares; /* max # of shares */
  956. unsigned short sv2_openfiles; /* max # of open files */
  957. unsigned short sv2_sessopens; /* max # of open files per session */
  958. unsigned short sv2_sessvcs; /* max # of virtual circuits per client */
  959. unsigned short sv2_sessreqs; /* max # of simul. reqs. from a client */
  960. unsigned short sv2_opensearch; /* max # of open searches */
  961. unsigned short sv2_activelocks; /* max # of active file locks */
  962. unsigned short sv2_numreqbuf; /* number of server (standard) buffers */
  963. unsigned short sv2_sizreqbuf; /* size of svr (standard) bufs (bytes) */
  964. unsigned short sv2_numbigbuf; /* number of big (64K) buffers */
  965. unsigned short sv2_numfiletasks;/* number of file worker processes */
  966. unsigned short sv2_alertsched; /* alert counting interval (minutes) */
  967. unsigned short sv2_erroralert; /* error log alerting threshold */
  968. unsigned short sv2_logonalert; /* logon violation alerting threshold */
  969. unsigned short sv2_accessalert; /* access violation alerting threshold */
  970. unsigned short sv2_diskalert; /* low disk space alert threshold (KB) */
  971. unsigned short sv2_netioalert; /* net I/O error ratio alert threshold */
  972. /* (tenths of a percent) */
  973. unsigned short sv2_maxauditsz; /* Maximum audit file size (KB) */
  974. char FAR * sv2_srvheuristics; /* performance related server switches*/
  975. }; /* server_info_2 */
  976. struct server_info_3 {
  977. char sv3_name[CNLEN + 1];
  978. unsigned char sv3_version_major;
  979. unsigned char sv3_version_minor;
  980. unsigned long sv3_type;
  981. char FAR * sv3_comment;
  982. unsigned long sv3_ulist_mtime; /* User list, last modification time */
  983. unsigned long sv3_glist_mtime; /* Group list, last modification time */
  984. unsigned long sv3_alist_mtime; /* Access list, last modification time */
  985. unsigned short sv3_users; /* max number of users allowed */
  986. unsigned short sv3_disc; /* auto-disconnect timeout(in minutes) */
  987. char FAR * sv3_alerts; /* alert names (semicolon separated) */
  988. unsigned short sv3_security; /* SV_USERSECURITY or SV_SHARESECURITY */
  989. unsigned short sv3_auditing; /* 0 = no auditing; nonzero = auditing */
  990. unsigned short sv3_numadmin; /* max number of administrators allowed */
  991. unsigned short sv3_lanmask; /* bit mask representing the srv'd nets */
  992. unsigned short sv3_hidden; /* 0 = visible; nonzero = hidden */
  993. unsigned short sv3_announce; /* visible server announce rate (sec) */
  994. unsigned short sv3_anndelta; /* announce randomize interval (sec) */
  995. /* name of guest account */
  996. char sv3_guestacct[LM20_UNLEN + 1];
  997. unsigned char sv3_pad1; /* Word alignment pad byte */
  998. char FAR * sv3_userpath; /* ASCIIZ path to user directories */
  999. unsigned short sv3_chdevs; /* max # shared character devices */
  1000. unsigned short sv3_chdevq; /* max # character device queues */
  1001. unsigned short sv3_chdevjobs; /* max # character device jobs */
  1002. unsigned short sv3_connections; /* max # of connections */
  1003. unsigned short sv3_shares; /* max # of shares */
  1004. unsigned short sv3_openfiles; /* max # of open files */
  1005. unsigned short sv3_sessopens; /* max # of open files per session */
  1006. unsigned short sv3_sessvcs; /* max # of virtual circuits per client */
  1007. unsigned short sv3_sessreqs; /* max # of simul. reqs. from a client */
  1008. unsigned short sv3_opensearch; /* max # of open searches */
  1009. unsigned short sv3_activelocks; /* max # of active file locks */
  1010. unsigned short sv3_numreqbuf; /* number of server (standard) buffers */
  1011. unsigned short sv3_sizreqbuf; /* size of svr (standard) bufs (bytes) */
  1012. unsigned short sv3_numbigbuf; /* number of big (64K) buffers */
  1013. unsigned short sv3_numfiletasks;/* number of file worker processes */
  1014. unsigned short sv3_alertsched; /* alert counting interval (minutes) */
  1015. unsigned short sv3_erroralert; /* error log alerting threshold */
  1016. unsigned short sv3_logonalert; /* logon violation alerting threshold */
  1017. unsigned short sv3_accessalert; /* access violation alerting threshold */
  1018. unsigned short sv3_diskalert; /* low disk space alert threshold (KB) */
  1019. unsigned short sv3_netioalert; /* net I/O error ratio alert threshold */
  1020. /* (tenths of a percent) */
  1021. unsigned short sv3_maxauditsz; /* Maximum audit file size (KB) */
  1022. char FAR * sv3_srvheuristics; /* performance related server switches*/
  1023. unsigned long sv3_auditedevents; /* Audit event control mask */
  1024. unsigned short sv3_autoprofile; /* (0,1,2,3) = (NONE,LOAD,SAVE,or BOTH) */
  1025. char FAR * sv3_autopath; /* file pathname (where to load & save) */
  1026. }; /* server_info_3 */
  1027. /****************************************************************
  1028. * *
  1029. * Special values and constants - SERVER *
  1030. * *
  1031. ****************************************************************/
  1032. /*
  1033. * Mask to be applied to svX_version_major in order to obtain
  1034. * the major version number.
  1035. */
  1036. #define MAJOR_VERSION_MASK 0x0F
  1037. /*
  1038. * Bit-mapped values for svX_type fields. X = 1, 2 or 3.
  1039. */
  1040. #define SV_TYPE_WORKSTATION 0x00000001
  1041. #define SV_TYPE_SERVER 0x00000002
  1042. #define SV_TYPE_SQLSERVER 0x00000004
  1043. #define SV_TYPE_DOMAIN_CTRL 0x00000008
  1044. #define SV_TYPE_DOMAIN_BAKCTRL 0x00000010
  1045. #define SV_TYPE_TIME_SOURCE 0x00000020
  1046. #define SV_TYPE_AFP 0x00000040
  1047. #define SV_TYPE_NOVELL 0x00000080 /* This flag is also set by Win95 NWSERVER */
  1048. #define SV_TYPE_DOMAIN_MEMBER 0x00000100
  1049. #define SV_TYPE_PRINTQ_SERVER 0x00000200
  1050. #define SV_TYPE_DIALIN_SERVER 0x00000400
  1051. #define SV_TYPE_ALL 0xFFFFFFFF /* handy for NetServerEnum2 */
  1052. /*
  1053. * Special value for svX_disc that specifies infinite disconnect
  1054. * time. X = 2 or 3.
  1055. */
  1056. #define SV_NODISC 0xFFFF /* No autodisconnect timeout enforced */
  1057. /*
  1058. * Values of svX_security field. X = 2 or 3.
  1059. */
  1060. #define SV_USERSECURITY 1
  1061. #define SV_SHARESECURITY 0
  1062. /*
  1063. * Values of svX_security field. X = 50.
  1064. * For Win95 NWSERVER, the only possible returned value is SV_SECURITY_NETWARE.
  1065. */
  1066. #define SV_SECURITY_SHARE 0 /* Share-level */
  1067. #define SV_SECURITY_WINNT 1 /* User-level - Windows NT workst'n */
  1068. #define SV_SECURITY_WINNTAS 2 /* User-level - Windows NT domain */
  1069. #define SV_SECURITY_NETWARE 3 /* User-level - NetWare 3.x bindery */
  1070. /*
  1071. * Values of svX_hidden field. X = 2 or 3.
  1072. */
  1073. #define SV_HIDDEN 1
  1074. #define SV_VISIBLE 0
  1075. #define SVI1_NUM_ELEMENTS 5
  1076. #define SVI2_NUM_ELEMENTS 44
  1077. #define SVI3_NUM_ELEMENTS 45
  1078. /*
  1079. * Masks describing AUTOPROFILE parameters
  1080. */
  1081. #define SW_AUTOPROF_LOAD_MASK 0x1
  1082. #define SW_AUTOPROF_SAVE_MASK 0x2
  1083. /****************************************************************
  1084. * *
  1085. * Security Class *
  1086. * *
  1087. ****************************************************************/
  1088. /****************************************************************
  1089. * *
  1090. * Function prototypes - SECURITY *
  1091. * *
  1092. ****************************************************************/
  1093. extern API_FUNCTION
  1094. NetSecurityGetInfo ( const char FAR * pszServer,
  1095. short sLevel,
  1096. char FAR * pbBuffer,
  1097. unsigned short cbBuffer,
  1098. unsigned short FAR * pcbTotalAvail );
  1099. /****************************************************************
  1100. * *
  1101. * Data structure templates - SECURITY *
  1102. * *
  1103. ****************************************************************/
  1104. struct security_info_1 {
  1105. unsigned long sec1_security; /* SEC_SECURITY_* (see below) */
  1106. char FAR * sec1_container; /* Security server/domain */
  1107. char FAR * sec1_ab_server; /* Address book server */
  1108. char FAR * sec1_ab_dll; /* Address book provider DLL */
  1109. }; /* security_info_1 */
  1110. /****************************************************************
  1111. * *
  1112. * Special values and constants - SECURITY *
  1113. * *
  1114. ****************************************************************/
  1115. /*
  1116. /*
  1117. * Values of secX_security field. X = 1.
  1118. */
  1119. #define SEC_SECURITY_SHARE SV_SECURITY_SHARE
  1120. #define SEC_SECURITY_WINNT SV_SECURITY_WINNT
  1121. #define SEC_SECURITY_WINNTAS SV_SECURITY_WINNTAS
  1122. #define SEC_SECURITY_NETWARE SV_SECURITY_NETWARE
  1123. /*NOINC*/
  1124. #ifdef __cplusplus
  1125. }
  1126. #endif /* __cplusplus */
  1127. #ifndef RC_INVOKED
  1128. #pragma pack() /* Revert to default packing */
  1129. #endif
  1130. #endif /* SVRAPI_INCLUDED */
  1131. /*INC*/