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.

1633 lines
49 KiB

  1. /*++ BUILD Version: 0002 // Increment this if a change has global effects
  2. Copyright (c) 1991-1999 Microsoft Corporation
  3. Module Name:
  4. lmaccess.h
  5. Abstract:
  6. This file contains structures, function prototypes, and definitions
  7. for the NetUser, NetUserModals, NetGroup, NetAccess, and NetLogon API.
  8. Environment:
  9. User Mode - Win32
  10. Notes:
  11. You must include NETCONS.H before this file, since this file depends
  12. on values defined in NETCONS.H.
  13. --*/
  14. //
  15. // User Class
  16. //
  17. #ifndef _LMUSER_
  18. #define _LMUSER_
  19. #if _MSC_VER > 1000
  20. #pragma once
  21. #endif
  22. #ifdef __cplusplus
  23. extern "C" {
  24. #endif
  25. #include <lmcons.h> // unfortunately created a dependence on this
  26. //
  27. // Function Prototypes - User
  28. //
  29. NET_API_STATUS NET_API_FUNCTION
  30. NetUserAdd (
  31. IN LPCWSTR servername OPTIONAL,
  32. IN DWORD level,
  33. IN LPBYTE buf,
  34. OUT LPDWORD parm_err OPTIONAL
  35. );
  36. NET_API_STATUS NET_API_FUNCTION
  37. NetUserEnum (
  38. IN LPCWSTR servername OPTIONAL,
  39. IN DWORD level,
  40. IN DWORD filter,
  41. OUT LPBYTE *bufptr,
  42. IN DWORD prefmaxlen,
  43. OUT LPDWORD entriesread,
  44. OUT LPDWORD totalentries,
  45. IN OUT LPDWORD resume_handle OPTIONAL
  46. );
  47. NET_API_STATUS NET_API_FUNCTION
  48. NetUserGetInfo (
  49. IN LPCWSTR servername OPTIONAL,
  50. IN LPCWSTR username,
  51. IN DWORD level,
  52. OUT LPBYTE *bufptr
  53. );
  54. NET_API_STATUS NET_API_FUNCTION
  55. NetUserSetInfo (
  56. IN LPCWSTR servername OPTIONAL,
  57. IN LPCWSTR username,
  58. IN DWORD level,
  59. IN LPBYTE buf,
  60. OUT LPDWORD parm_err OPTIONAL
  61. );
  62. NET_API_STATUS NET_API_FUNCTION
  63. NetUserDel (
  64. IN LPCWSTR servername OPTIONAL,
  65. IN LPCWSTR username
  66. );
  67. NET_API_STATUS NET_API_FUNCTION
  68. NetUserGetGroups (
  69. IN LPCWSTR servername OPTIONAL,
  70. IN LPCWSTR username,
  71. IN DWORD level,
  72. OUT LPBYTE *bufptr,
  73. IN DWORD prefmaxlen,
  74. OUT LPDWORD entriesread,
  75. OUT LPDWORD totalentries
  76. );
  77. NET_API_STATUS NET_API_FUNCTION
  78. NetUserSetGroups (
  79. IN LPCWSTR servername OPTIONAL,
  80. IN LPCWSTR username,
  81. IN DWORD level,
  82. IN LPBYTE buf,
  83. IN DWORD num_entries
  84. );
  85. NET_API_STATUS NET_API_FUNCTION
  86. NetUserGetLocalGroups (
  87. IN LPCWSTR servername OPTIONAL,
  88. IN LPCWSTR username,
  89. IN DWORD level,
  90. IN DWORD flags,
  91. OUT LPBYTE *bufptr,
  92. IN DWORD prefmaxlen,
  93. OUT LPDWORD entriesread,
  94. OUT LPDWORD totalentries
  95. );
  96. NET_API_STATUS NET_API_FUNCTION
  97. NetUserModalsGet (
  98. IN LPCWSTR servername OPTIONAL,
  99. IN DWORD level,
  100. OUT LPBYTE *bufptr
  101. );
  102. NET_API_STATUS NET_API_FUNCTION
  103. NetUserModalsSet (
  104. IN LPCWSTR servername OPTIONAL,
  105. IN DWORD level,
  106. IN LPBYTE buf,
  107. OUT LPDWORD parm_err OPTIONAL
  108. );
  109. NET_API_STATUS NET_API_FUNCTION
  110. NetUserChangePassword (
  111. IN LPCWSTR domainname OPTIONAL,
  112. IN LPCWSTR username OPTIONAL,
  113. IN LPCWSTR oldpassword,
  114. IN LPCWSTR newpassword
  115. );
  116. //
  117. // Data Structures - User
  118. //
  119. typedef struct _USER_INFO_0 {
  120. LPWSTR usri0_name;
  121. }USER_INFO_0, *PUSER_INFO_0, *LPUSER_INFO_0;
  122. typedef struct _USER_INFO_1 {
  123. LPWSTR usri1_name;
  124. LPWSTR usri1_password;
  125. DWORD usri1_password_age;
  126. DWORD usri1_priv;
  127. LPWSTR usri1_home_dir;
  128. LPWSTR usri1_comment;
  129. DWORD usri1_flags;
  130. LPWSTR usri1_script_path;
  131. }USER_INFO_1, *PUSER_INFO_1, *LPUSER_INFO_1;
  132. typedef struct _USER_INFO_2 {
  133. LPWSTR usri2_name;
  134. LPWSTR usri2_password;
  135. DWORD usri2_password_age;
  136. DWORD usri2_priv;
  137. LPWSTR usri2_home_dir;
  138. LPWSTR usri2_comment;
  139. DWORD usri2_flags;
  140. LPWSTR usri2_script_path;
  141. DWORD usri2_auth_flags;
  142. LPWSTR usri2_full_name;
  143. LPWSTR usri2_usr_comment;
  144. LPWSTR usri2_parms;
  145. LPWSTR usri2_workstations;
  146. DWORD usri2_last_logon;
  147. DWORD usri2_last_logoff;
  148. DWORD usri2_acct_expires;
  149. DWORD usri2_max_storage;
  150. DWORD usri2_units_per_week;
  151. PBYTE usri2_logon_hours;
  152. DWORD usri2_bad_pw_count;
  153. DWORD usri2_num_logons;
  154. LPWSTR usri2_logon_server;
  155. DWORD usri2_country_code;
  156. DWORD usri2_code_page;
  157. }USER_INFO_2, *PUSER_INFO_2, *LPUSER_INFO_2;
  158. typedef struct _USER_INFO_3 {
  159. LPWSTR usri3_name;
  160. LPWSTR usri3_password;
  161. DWORD usri3_password_age;
  162. DWORD usri3_priv;
  163. LPWSTR usri3_home_dir;
  164. LPWSTR usri3_comment;
  165. DWORD usri3_flags;
  166. LPWSTR usri3_script_path;
  167. DWORD usri3_auth_flags;
  168. LPWSTR usri3_full_name;
  169. LPWSTR usri3_usr_comment;
  170. LPWSTR usri3_parms;
  171. LPWSTR usri3_workstations;
  172. DWORD usri3_last_logon;
  173. DWORD usri3_last_logoff;
  174. DWORD usri3_acct_expires;
  175. DWORD usri3_max_storage;
  176. DWORD usri3_units_per_week;
  177. PBYTE usri3_logon_hours;
  178. DWORD usri3_bad_pw_count;
  179. DWORD usri3_num_logons;
  180. LPWSTR usri3_logon_server;
  181. DWORD usri3_country_code;
  182. DWORD usri3_code_page;
  183. DWORD usri3_user_id;
  184. DWORD usri3_primary_group_id;
  185. LPWSTR usri3_profile;
  186. LPWSTR usri3_home_dir_drive;
  187. DWORD usri3_password_expired;
  188. }USER_INFO_3, *PUSER_INFO_3, *LPUSER_INFO_3;
  189. typedef struct _USER_INFO_4 {
  190. LPWSTR usri4_name;
  191. LPWSTR usri4_password;
  192. DWORD usri4_password_age;
  193. DWORD usri4_priv;
  194. LPWSTR usri4_home_dir;
  195. LPWSTR usri4_comment;
  196. DWORD usri4_flags;
  197. LPWSTR usri4_script_path;
  198. DWORD usri4_auth_flags;
  199. LPWSTR usri4_full_name;
  200. LPWSTR usri4_usr_comment;
  201. LPWSTR usri4_parms;
  202. LPWSTR usri4_workstations;
  203. DWORD usri4_last_logon;
  204. DWORD usri4_last_logoff;
  205. DWORD usri4_acct_expires;
  206. DWORD usri4_max_storage;
  207. DWORD usri4_units_per_week;
  208. PBYTE usri4_logon_hours;
  209. DWORD usri4_bad_pw_count;
  210. DWORD usri4_num_logons;
  211. LPWSTR usri4_logon_server;
  212. DWORD usri4_country_code;
  213. DWORD usri4_code_page;
  214. PSID usri4_user_sid;
  215. DWORD usri4_primary_group_id;
  216. LPWSTR usri4_profile;
  217. LPWSTR usri4_home_dir_drive;
  218. DWORD usri4_password_expired;
  219. }USER_INFO_4, *PUSER_INFO_4, *LPUSER_INFO_4;
  220. typedef struct _USER_INFO_10 {
  221. LPWSTR usri10_name;
  222. LPWSTR usri10_comment;
  223. LPWSTR usri10_usr_comment;
  224. LPWSTR usri10_full_name;
  225. }USER_INFO_10, *PUSER_INFO_10, *LPUSER_INFO_10;
  226. typedef struct _USER_INFO_11 {
  227. LPWSTR usri11_name;
  228. LPWSTR usri11_comment;
  229. LPWSTR usri11_usr_comment;
  230. LPWSTR usri11_full_name;
  231. DWORD usri11_priv;
  232. DWORD usri11_auth_flags;
  233. DWORD usri11_password_age;
  234. LPWSTR usri11_home_dir;
  235. LPWSTR usri11_parms;
  236. DWORD usri11_last_logon;
  237. DWORD usri11_last_logoff;
  238. DWORD usri11_bad_pw_count;
  239. DWORD usri11_num_logons;
  240. LPWSTR usri11_logon_server;
  241. DWORD usri11_country_code;
  242. LPWSTR usri11_workstations;
  243. DWORD usri11_max_storage;
  244. DWORD usri11_units_per_week;
  245. PBYTE usri11_logon_hours;
  246. DWORD usri11_code_page;
  247. }USER_INFO_11, *PUSER_INFO_11, *LPUSER_INFO_11;
  248. typedef struct _USER_INFO_20 {
  249. LPWSTR usri20_name;
  250. LPWSTR usri20_full_name;
  251. LPWSTR usri20_comment;
  252. DWORD usri20_flags;
  253. DWORD usri20_user_id;
  254. }USER_INFO_20, *PUSER_INFO_20, *LPUSER_INFO_20;
  255. typedef struct _USER_INFO_21 {
  256. BYTE usri21_password[ENCRYPTED_PWLEN];
  257. }USER_INFO_21, *PUSER_INFO_21, *LPUSER_INFO_21;
  258. typedef struct _USER_INFO_22 {
  259. LPWSTR usri22_name;
  260. BYTE usri22_password[ENCRYPTED_PWLEN];
  261. DWORD usri22_password_age;
  262. DWORD usri22_priv;
  263. LPWSTR usri22_home_dir;
  264. LPWSTR usri22_comment;
  265. DWORD usri22_flags;
  266. LPWSTR usri22_script_path;
  267. DWORD usri22_auth_flags;
  268. LPWSTR usri22_full_name;
  269. LPWSTR usri22_usr_comment;
  270. LPWSTR usri22_parms;
  271. LPWSTR usri22_workstations;
  272. DWORD usri22_last_logon;
  273. DWORD usri22_last_logoff;
  274. DWORD usri22_acct_expires;
  275. DWORD usri22_max_storage;
  276. DWORD usri22_units_per_week;
  277. PBYTE usri22_logon_hours;
  278. DWORD usri22_bad_pw_count;
  279. DWORD usri22_num_logons;
  280. LPWSTR usri22_logon_server;
  281. DWORD usri22_country_code;
  282. DWORD usri22_code_page;
  283. }USER_INFO_22, *PUSER_INFO_22, *LPUSER_INFO_22;
  284. typedef struct _USER_INFO_23 {
  285. LPWSTR usri23_name;
  286. LPWSTR usri23_full_name;
  287. LPWSTR usri23_comment;
  288. DWORD usri23_flags;
  289. PSID usri23_user_sid;
  290. }USER_INFO_23, *PUSER_INFO_23, *LPUSER_INFO_23;
  291. typedef struct _USER_INFO_1003 {
  292. LPWSTR usri1003_password;
  293. } USER_INFO_1003, *PUSER_INFO_1003, *LPUSER_INFO_1003;
  294. typedef struct _USER_INFO_1005 {
  295. DWORD usri1005_priv;
  296. } USER_INFO_1005, *PUSER_INFO_1005, *LPUSER_INFO_1005;
  297. typedef struct _USER_INFO_1006 {
  298. LPWSTR usri1006_home_dir;
  299. } USER_INFO_1006, *PUSER_INFO_1006, *LPUSER_INFO_1006;
  300. typedef struct _USER_INFO_1007 {
  301. LPWSTR usri1007_comment;
  302. } USER_INFO_1007, *PUSER_INFO_1007, *LPUSER_INFO_1007;
  303. typedef struct _USER_INFO_1008 {
  304. DWORD usri1008_flags;
  305. } USER_INFO_1008, *PUSER_INFO_1008, *LPUSER_INFO_1008;
  306. typedef struct _USER_INFO_1009 {
  307. LPWSTR usri1009_script_path;
  308. } USER_INFO_1009, *PUSER_INFO_1009, *LPUSER_INFO_1009;
  309. typedef struct _USER_INFO_1010 {
  310. DWORD usri1010_auth_flags;
  311. } USER_INFO_1010, *PUSER_INFO_1010, *LPUSER_INFO_1010;
  312. typedef struct _USER_INFO_1011 {
  313. LPWSTR usri1011_full_name;
  314. } USER_INFO_1011, *PUSER_INFO_1011, *LPUSER_INFO_1011;
  315. typedef struct _USER_INFO_1012 {
  316. LPWSTR usri1012_usr_comment;
  317. } USER_INFO_1012, *PUSER_INFO_1012, *LPUSER_INFO_1012;
  318. typedef struct _USER_INFO_1013 {
  319. LPWSTR usri1013_parms;
  320. } USER_INFO_1013, *PUSER_INFO_1013, *LPUSER_INFO_1013;
  321. typedef struct _USER_INFO_1014 {
  322. LPWSTR usri1014_workstations;
  323. } USER_INFO_1014, *PUSER_INFO_1014, *LPUSER_INFO_1014;
  324. typedef struct _USER_INFO_1017 {
  325. DWORD usri1017_acct_expires;
  326. } USER_INFO_1017, *PUSER_INFO_1017, *LPUSER_INFO_1017;
  327. typedef struct _USER_INFO_1018 {
  328. DWORD usri1018_max_storage;
  329. } USER_INFO_1018, *PUSER_INFO_1018, *LPUSER_INFO_1018;
  330. typedef struct _USER_INFO_1020 {
  331. DWORD usri1020_units_per_week;
  332. LPBYTE usri1020_logon_hours;
  333. } USER_INFO_1020, *PUSER_INFO_1020, *LPUSER_INFO_1020;
  334. typedef struct _USER_INFO_1023 {
  335. LPWSTR usri1023_logon_server;
  336. } USER_INFO_1023, *PUSER_INFO_1023, *LPUSER_INFO_1023;
  337. typedef struct _USER_INFO_1024 {
  338. DWORD usri1024_country_code;
  339. } USER_INFO_1024, *PUSER_INFO_1024, *LPUSER_INFO_1024;
  340. typedef struct _USER_INFO_1025 {
  341. DWORD usri1025_code_page;
  342. } USER_INFO_1025, *PUSER_INFO_1025, *LPUSER_INFO_1025;
  343. typedef struct _USER_INFO_1051 {
  344. DWORD usri1051_primary_group_id;
  345. } USER_INFO_1051, *PUSER_INFO_1051, *LPUSER_INFO_1051;
  346. typedef struct _USER_INFO_1052 {
  347. LPWSTR usri1052_profile;
  348. } USER_INFO_1052, *PUSER_INFO_1052, *LPUSER_INFO_1052;
  349. typedef struct _USER_INFO_1053 {
  350. LPWSTR usri1053_home_dir_drive;
  351. } USER_INFO_1053, *PUSER_INFO_1053, *LPUSER_INFO_1053;
  352. //
  353. // Data Structures - User Modals
  354. //
  355. typedef struct _USER_MODALS_INFO_0 {
  356. DWORD usrmod0_min_passwd_len;
  357. DWORD usrmod0_max_passwd_age;
  358. DWORD usrmod0_min_passwd_age;
  359. DWORD usrmod0_force_logoff;
  360. DWORD usrmod0_password_hist_len;
  361. }USER_MODALS_INFO_0, *PUSER_MODALS_INFO_0, *LPUSER_MODALS_INFO_0;
  362. typedef struct _USER_MODALS_INFO_1 {
  363. DWORD usrmod1_role;
  364. LPWSTR usrmod1_primary;
  365. }USER_MODALS_INFO_1, *PUSER_MODALS_INFO_1, *LPUSER_MODALS_INFO_1;
  366. typedef struct _USER_MODALS_INFO_2 {
  367. LPWSTR usrmod2_domain_name;
  368. PSID usrmod2_domain_id;
  369. }USER_MODALS_INFO_2, *PUSER_MODALS_INFO_2, *LPUSER_MODALS_INFO_2;
  370. typedef struct _USER_MODALS_INFO_3 {
  371. DWORD usrmod3_lockout_duration;
  372. DWORD usrmod3_lockout_observation_window;
  373. DWORD usrmod3_lockout_threshold;
  374. }USER_MODALS_INFO_3, *PUSER_MODALS_INFO_3, *LPUSER_MODALS_INFO_3;
  375. typedef struct _USER_MODALS_INFO_1001 {
  376. DWORD usrmod1001_min_passwd_len;
  377. } USER_MODALS_INFO_1001, *PUSER_MODALS_INFO_1001, *LPUSER_MODALS_INFO_1001;
  378. typedef struct _USER_MODALS_INFO_1002 {
  379. DWORD usrmod1002_max_passwd_age;
  380. } USER_MODALS_INFO_1002, *PUSER_MODALS_INFO_1002, *LPUSER_MODALS_INFO_1002;
  381. typedef struct _USER_MODALS_INFO_1003 {
  382. DWORD usrmod1003_min_passwd_age;
  383. } USER_MODALS_INFO_1003, *PUSER_MODALS_INFO_1003, *LPUSER_MODALS_INFO_1003;
  384. typedef struct _USER_MODALS_INFO_1004 {
  385. DWORD usrmod1004_force_logoff;
  386. } USER_MODALS_INFO_1004, *PUSER_MODALS_INFO_1004, *LPUSER_MODALS_INFO_1004;
  387. typedef struct _USER_MODALS_INFO_1005 {
  388. DWORD usrmod1005_password_hist_len;
  389. } USER_MODALS_INFO_1005, *PUSER_MODALS_INFO_1005, *LPUSER_MODALS_INFO_1005;
  390. typedef struct _USER_MODALS_INFO_1006 {
  391. DWORD usrmod1006_role;
  392. } USER_MODALS_INFO_1006, *PUSER_MODALS_INFO_1006, *LPUSER_MODALS_INFO_1006;
  393. typedef struct _USER_MODALS_INFO_1007 {
  394. LPWSTR usrmod1007_primary;
  395. } USER_MODALS_INFO_1007, *PUSER_MODALS_INFO_1007, *LPUSER_MODALS_INFO_1007;
  396. //
  397. // Special Values and Constants - User
  398. //
  399. //
  400. // Bit masks for field usriX_flags of USER_INFO_X (X = 0/1).
  401. //
  402. #define UF_SCRIPT 0x0001
  403. #define UF_ACCOUNTDISABLE 0x0002
  404. #define UF_HOMEDIR_REQUIRED 0x0008
  405. #define UF_LOCKOUT 0x0010
  406. #define UF_PASSWD_NOTREQD 0x0020
  407. #define UF_PASSWD_CANT_CHANGE 0x0040
  408. #define UF_ENCRYPTED_TEXT_PASSWORD_ALLOWED 0x0080
  409. //
  410. // Account type bits as part of usri_flags.
  411. //
  412. #define UF_TEMP_DUPLICATE_ACCOUNT 0x0100
  413. #define UF_NORMAL_ACCOUNT 0x0200
  414. #define UF_INTERDOMAIN_TRUST_ACCOUNT 0x0800
  415. #define UF_WORKSTATION_TRUST_ACCOUNT 0x1000
  416. #define UF_SERVER_TRUST_ACCOUNT 0x2000
  417. #define UF_MACHINE_ACCOUNT_MASK ( UF_INTERDOMAIN_TRUST_ACCOUNT | \
  418. UF_WORKSTATION_TRUST_ACCOUNT | \
  419. UF_SERVER_TRUST_ACCOUNT )
  420. #define UF_ACCOUNT_TYPE_MASK ( \
  421. UF_TEMP_DUPLICATE_ACCOUNT | \
  422. UF_NORMAL_ACCOUNT | \
  423. UF_INTERDOMAIN_TRUST_ACCOUNT | \
  424. UF_WORKSTATION_TRUST_ACCOUNT | \
  425. UF_SERVER_TRUST_ACCOUNT \
  426. )
  427. #define UF_DONT_EXPIRE_PASSWD 0x10000
  428. #define UF_MNS_LOGON_ACCOUNT 0x20000
  429. #define UF_SMARTCARD_REQUIRED 0x40000
  430. #define UF_TRUSTED_FOR_DELEGATION 0x80000
  431. #define UF_NOT_DELEGATED 0x100000
  432. #define UF_USE_DES_KEY_ONLY 0x200000
  433. #define UF_DONT_REQUIRE_PREAUTH 0x400000
  434. #define UF_PASSWORD_EXPIRED 0x800000
  435. #define UF_TRUSTED_TO_AUTHENTICATE_FOR_DELEGATION 0x1000000
  436. #define UF_SETTABLE_BITS ( \
  437. UF_SCRIPT | \
  438. UF_ACCOUNTDISABLE | \
  439. UF_LOCKOUT | \
  440. UF_HOMEDIR_REQUIRED | \
  441. UF_PASSWD_NOTREQD | \
  442. UF_PASSWD_CANT_CHANGE | \
  443. UF_ACCOUNT_TYPE_MASK | \
  444. UF_DONT_EXPIRE_PASSWD | \
  445. UF_MNS_LOGON_ACCOUNT |\
  446. UF_ENCRYPTED_TEXT_PASSWORD_ALLOWED |\
  447. UF_SMARTCARD_REQUIRED | \
  448. UF_TRUSTED_FOR_DELEGATION | \
  449. UF_NOT_DELEGATED | \
  450. UF_USE_DES_KEY_ONLY | \
  451. UF_DONT_REQUIRE_PREAUTH |\
  452. UF_PASSWORD_EXPIRED |\
  453. UF_TRUSTED_TO_AUTHENTICATE_FOR_DELEGATION\
  454. )
  455. //
  456. // bit masks for the NetUserEnum filter parameter.
  457. //
  458. #define FILTER_TEMP_DUPLICATE_ACCOUNT (0x0001)
  459. #define FILTER_NORMAL_ACCOUNT (0x0002)
  460. // #define FILTER_PROXY_ACCOUNT (0x0004)
  461. #define FILTER_INTERDOMAIN_TRUST_ACCOUNT (0x0008)
  462. #define FILTER_WORKSTATION_TRUST_ACCOUNT (0x0010)
  463. #define FILTER_SERVER_TRUST_ACCOUNT (0x0020)
  464. //
  465. // bit masks for the NetUserGetLocalGroups flags
  466. //
  467. #define LG_INCLUDE_INDIRECT (0x0001)
  468. //
  469. // Bit masks for field usri2_auth_flags of USER_INFO_2.
  470. //
  471. #define AF_OP_PRINT 0x1
  472. #define AF_OP_COMM 0x2
  473. #define AF_OP_SERVER 0x4
  474. #define AF_OP_ACCOUNTS 0x8
  475. #define AF_SETTABLE_BITS (AF_OP_PRINT | AF_OP_COMM | \
  476. AF_OP_SERVER | AF_OP_ACCOUNTS)
  477. //
  478. // UAS role manifests under NETLOGON
  479. //
  480. #define UAS_ROLE_STANDALONE 0
  481. #define UAS_ROLE_MEMBER 1
  482. #define UAS_ROLE_BACKUP 2
  483. #define UAS_ROLE_PRIMARY 3
  484. //
  485. // Values for ParmError for NetUserSetInfo.
  486. //
  487. #define USER_NAME_PARMNUM 1
  488. #define USER_PASSWORD_PARMNUM 3
  489. #define USER_PASSWORD_AGE_PARMNUM 4
  490. #define USER_PRIV_PARMNUM 5
  491. #define USER_HOME_DIR_PARMNUM 6
  492. #define USER_COMMENT_PARMNUM 7
  493. #define USER_FLAGS_PARMNUM 8
  494. #define USER_SCRIPT_PATH_PARMNUM 9
  495. #define USER_AUTH_FLAGS_PARMNUM 10
  496. #define USER_FULL_NAME_PARMNUM 11
  497. #define USER_USR_COMMENT_PARMNUM 12
  498. #define USER_PARMS_PARMNUM 13
  499. #define USER_WORKSTATIONS_PARMNUM 14
  500. #define USER_LAST_LOGON_PARMNUM 15
  501. #define USER_LAST_LOGOFF_PARMNUM 16
  502. #define USER_ACCT_EXPIRES_PARMNUM 17
  503. #define USER_MAX_STORAGE_PARMNUM 18
  504. #define USER_UNITS_PER_WEEK_PARMNUM 19
  505. #define USER_LOGON_HOURS_PARMNUM 20
  506. #define USER_PAD_PW_COUNT_PARMNUM 21
  507. #define USER_NUM_LOGONS_PARMNUM 22
  508. #define USER_LOGON_SERVER_PARMNUM 23
  509. #define USER_COUNTRY_CODE_PARMNUM 24
  510. #define USER_CODE_PAGE_PARMNUM 25
  511. #define USER_PRIMARY_GROUP_PARMNUM 51
  512. #define USER_PROFILE 52 // ?? Delete when convenient
  513. #define USER_PROFILE_PARMNUM 52
  514. #define USER_HOME_DIR_DRIVE_PARMNUM 53
  515. //
  516. // the new infolevel counterparts of the old info level + parmnum
  517. //
  518. #define USER_NAME_INFOLEVEL \
  519. (PARMNUM_BASE_INFOLEVEL + USER_NAME_PARMNUM)
  520. #define USER_PASSWORD_INFOLEVEL \
  521. (PARMNUM_BASE_INFOLEVEL + USER_PASSWORD_PARMNUM)
  522. #define USER_PASSWORD_AGE_INFOLEVEL \
  523. (PARMNUM_BASE_INFOLEVEL + USER_PASSWORD_AGE_PARMNUM)
  524. #define USER_PRIV_INFOLEVEL \
  525. (PARMNUM_BASE_INFOLEVEL + USER_PRIV_PARMNUM)
  526. #define USER_HOME_DIR_INFOLEVEL \
  527. (PARMNUM_BASE_INFOLEVEL + USER_HOME_DIR_PARMNUM)
  528. #define USER_COMMENT_INFOLEVEL \
  529. (PARMNUM_BASE_INFOLEVEL + USER_COMMENT_PARMNUM)
  530. #define USER_FLAGS_INFOLEVEL \
  531. (PARMNUM_BASE_INFOLEVEL + USER_FLAGS_PARMNUM)
  532. #define USER_SCRIPT_PATH_INFOLEVEL \
  533. (PARMNUM_BASE_INFOLEVEL + USER_SCRIPT_PATH_PARMNUM)
  534. #define USER_AUTH_FLAGS_INFOLEVEL \
  535. (PARMNUM_BASE_INFOLEVEL + USER_AUTH_FLAGS_PARMNUM)
  536. #define USER_FULL_NAME_INFOLEVEL \
  537. (PARMNUM_BASE_INFOLEVEL + USER_FULL_NAME_PARMNUM)
  538. #define USER_USR_COMMENT_INFOLEVEL \
  539. (PARMNUM_BASE_INFOLEVEL + USER_USR_COMMENT_PARMNUM)
  540. #define USER_PARMS_INFOLEVEL \
  541. (PARMNUM_BASE_INFOLEVEL + USER_PARMS_PARMNUM)
  542. #define USER_WORKSTATIONS_INFOLEVEL \
  543. (PARMNUM_BASE_INFOLEVEL + USER_WORKSTATIONS_PARMNUM)
  544. #define USER_LAST_LOGON_INFOLEVEL \
  545. (PARMNUM_BASE_INFOLEVEL + USER_LAST_LOGON_PARMNUM)
  546. #define USER_LAST_LOGOFF_INFOLEVEL \
  547. (PARMNUM_BASE_INFOLEVEL + USER_LAST_LOGOFF_PARMNUM)
  548. #define USER_ACCT_EXPIRES_INFOLEVEL \
  549. (PARMNUM_BASE_INFOLEVEL + USER_ACCT_EXPIRES_PARMNUM)
  550. #define USER_MAX_STORAGE_INFOLEVEL \
  551. (PARMNUM_BASE_INFOLEVEL + USER_MAX_STORAGE_PARMNUM)
  552. #define USER_UNITS_PER_WEEK_INFOLEVEL \
  553. (PARMNUM_BASE_INFOLEVEL + USER_UNITS_PER_WEEK_PARMNUM)
  554. #define USER_LOGON_HOURS_INFOLEVEL \
  555. (PARMNUM_BASE_INFOLEVEL + USER_LOGON_HOURS_PARMNUM)
  556. #define USER_PAD_PW_COUNT_INFOLEVEL \
  557. (PARMNUM_BASE_INFOLEVEL + USER_PAD_PW_COUNT_PARMNUM)
  558. #define USER_NUM_LOGONS_INFOLEVEL \
  559. (PARMNUM_BASE_INFOLEVEL + USER_NUM_LOGONS_PARMNUM)
  560. #define USER_LOGON_SERVER_INFOLEVEL \
  561. (PARMNUM_BASE_INFOLEVEL + USER_LOGON_SERVER_PARMNUM)
  562. #define USER_COUNTRY_CODE_INFOLEVEL \
  563. (PARMNUM_BASE_INFOLEVEL + USER_COUNTRY_CODE_PARMNUM)
  564. #define USER_CODE_PAGE_INFOLEVEL \
  565. (PARMNUM_BASE_INFOLEVEL + USER_CODE_PAGE_PARMNUM)
  566. #define USER_PRIMARY_GROUP_INFOLEVEL \
  567. (PARMNUM_BASE_INFOLEVEL + USER_PRIMARY_GROUP_PARMNUM)
  568. #define USER_POSIX_ID_INFOLEVEL \
  569. (PARMNUM_BASE_INFOLEVEL + USER_POSIX_ID_PARMNUM)
  570. #define USER_HOME_DIR_DRIVE_INFOLEVEL \
  571. (PARMNUM_BASE_INFOLEVEL + USER_HOME_DIR_DRIVE_PARMNUM)
  572. //
  573. // For SetInfo call (parmnum 0) when password change not required
  574. //
  575. #define NULL_USERSETINFO_PASSWD " "
  576. #define TIMEQ_FOREVER ((unsigned long) -1L)
  577. #define USER_MAXSTORAGE_UNLIMITED ((unsigned long) -1L)
  578. #define USER_NO_LOGOFF ((unsigned long) -1L)
  579. #define UNITS_PER_DAY 24
  580. #define UNITS_PER_WEEK UNITS_PER_DAY * 7
  581. //
  582. // Privilege levels (USER_INFO_X field usriX_priv (X = 0/1)).
  583. //
  584. #define USER_PRIV_MASK 0x3
  585. #define USER_PRIV_GUEST 0
  586. #define USER_PRIV_USER 1
  587. #define USER_PRIV_ADMIN 2
  588. //
  589. // user modals related defaults
  590. //
  591. #define MAX_PASSWD_LEN PWLEN
  592. #define DEF_MIN_PWLEN 6
  593. #define DEF_PWUNIQUENESS 5
  594. #define DEF_MAX_PWHIST 8
  595. #define DEF_MAX_PWAGE TIMEQ_FOREVER // forever
  596. #define DEF_MIN_PWAGE (unsigned long) 0L // 0 days
  597. #define DEF_FORCE_LOGOFF (unsigned long) 0xffffffff // never
  598. #define DEF_MAX_BADPW 0 // no limit
  599. #define ONE_DAY (unsigned long) 01*24*3600 // 01 day
  600. //
  601. // User Logon Validation (codes returned)
  602. //
  603. #define VALIDATED_LOGON 0
  604. #define PASSWORD_EXPIRED 2
  605. #define NON_VALIDATED_LOGON 3
  606. #define VALID_LOGOFF 1
  607. //
  608. // parmnum manifests for user modals
  609. //
  610. #define MODALS_MIN_PASSWD_LEN_PARMNUM 1
  611. #define MODALS_MAX_PASSWD_AGE_PARMNUM 2
  612. #define MODALS_MIN_PASSWD_AGE_PARMNUM 3
  613. #define MODALS_FORCE_LOGOFF_PARMNUM 4
  614. #define MODALS_PASSWD_HIST_LEN_PARMNUM 5
  615. #define MODALS_ROLE_PARMNUM 6
  616. #define MODALS_PRIMARY_PARMNUM 7
  617. #define MODALS_DOMAIN_NAME_PARMNUM 8
  618. #define MODALS_DOMAIN_ID_PARMNUM 9
  619. #define MODALS_LOCKOUT_DURATION_PARMNUM 10
  620. #define MODALS_LOCKOUT_OBSERVATION_WINDOW_PARMNUM 11
  621. #define MODALS_LOCKOUT_THRESHOLD_PARMNUM 12
  622. //
  623. // the new infolevel counterparts of the old info level + parmnum
  624. //
  625. #define MODALS_MIN_PASSWD_LEN_INFOLEVEL \
  626. (PARMNUM_BASE_INFOLEVEL + MODALS_MIN_PASSWD_LEN_PARMNUM)
  627. #define MODALS_MAX_PASSWD_AGE_INFOLEVEL \
  628. (PARMNUM_BASE_INFOLEVEL + MODALS_MAX_PASSWD_AGE_PARMNUM)
  629. #define MODALS_MIN_PASSWD_AGE_INFOLEVEL \
  630. (PARMNUM_BASE_INFOLEVEL + MODALS_MIN_PASSWD_AGE_PARMNUM)
  631. #define MODALS_FORCE_LOGOFF_INFOLEVEL \
  632. (PARMNUM_BASE_INFOLEVEL + MODALS_FORCE_LOGOFF_PARMNUM)
  633. #define MODALS_PASSWD_HIST_LEN_INFOLEVEL \
  634. (PARMNUM_BASE_INFOLEVEL + MODALS_PASSWD_HIST_LEN_PARMNUM)
  635. #define MODALS_ROLE_INFOLEVEL \
  636. (PARMNUM_BASE_INFOLEVEL + MODALS_ROLE_PARMNUM)
  637. #define MODALS_PRIMARY_INFOLEVEL \
  638. (PARMNUM_BASE_INFOLEVEL + MODALS_PRIMARY_PARMNUM)
  639. #define MODALS_DOMAIN_NAME_INFOLEVEL \
  640. (PARMNUM_BASE_INFOLEVEL + MODALS_DOMAIN_NAME_PARMNUM)
  641. #define MODALS_DOMAIN_ID_INFOLEVEL \
  642. (PARMNUM_BASE_INFOLEVEL + MODALS_DOMAIN_ID_PARMNUM)
  643. #endif // _LMUSER_
  644. //
  645. // Group Class
  646. //
  647. #ifndef _LMGROUP_
  648. #define _LMGROUP_
  649. //
  650. // Function Prototypes
  651. //
  652. NET_API_STATUS NET_API_FUNCTION
  653. NetGroupAdd (
  654. IN LPCWSTR servername OPTIONAL,
  655. IN DWORD level,
  656. IN LPBYTE buf,
  657. OUT LPDWORD parm_err OPTIONAL
  658. );
  659. NET_API_STATUS NET_API_FUNCTION
  660. NetGroupAddUser (
  661. IN LPCWSTR servername OPTIONAL,
  662. IN LPCWSTR GroupName,
  663. IN LPCWSTR username
  664. );
  665. NET_API_STATUS NET_API_FUNCTION
  666. NetGroupEnum (
  667. IN LPCWSTR servername OPTIONAL,
  668. IN DWORD level,
  669. OUT LPBYTE *bufptr,
  670. IN DWORD prefmaxlen,
  671. OUT LPDWORD entriesread,
  672. OUT LPDWORD totalentries,
  673. IN OUT PDWORD_PTR resume_handle OPTIONAL
  674. );
  675. NET_API_STATUS NET_API_FUNCTION
  676. NetGroupGetInfo (
  677. IN LPCWSTR servername OPTIONAL,
  678. IN LPCWSTR groupname,
  679. IN DWORD level,
  680. OUT LPBYTE *bufptr
  681. );
  682. NET_API_STATUS NET_API_FUNCTION
  683. NetGroupSetInfo (
  684. IN LPCWSTR servername OPTIONAL,
  685. IN LPCWSTR groupname,
  686. IN DWORD level,
  687. IN LPBYTE buf,
  688. OUT LPDWORD parm_err OPTIONAL
  689. );
  690. NET_API_STATUS NET_API_FUNCTION
  691. NetGroupDel (
  692. IN LPCWSTR servername OPTIONAL,
  693. IN LPCWSTR groupname
  694. );
  695. NET_API_STATUS NET_API_FUNCTION
  696. NetGroupDelUser (
  697. IN LPCWSTR servername OPTIONAL,
  698. IN LPCWSTR GroupName,
  699. IN LPCWSTR Username
  700. );
  701. NET_API_STATUS NET_API_FUNCTION
  702. NetGroupGetUsers (
  703. IN LPCWSTR servername OPTIONAL,
  704. IN LPCWSTR groupname,
  705. IN DWORD level,
  706. OUT LPBYTE *bufptr,
  707. IN DWORD prefmaxlen,
  708. OUT LPDWORD entriesread,
  709. OUT LPDWORD totalentries,
  710. IN OUT PDWORD_PTR ResumeHandle
  711. );
  712. NET_API_STATUS NET_API_FUNCTION
  713. NetGroupSetUsers (
  714. IN LPCWSTR servername OPTIONAL,
  715. IN LPCWSTR groupname,
  716. IN DWORD level,
  717. IN LPBYTE buf,
  718. IN DWORD totalentries
  719. );
  720. //
  721. // Data Structures - Group
  722. //
  723. typedef struct _GROUP_INFO_0 {
  724. LPWSTR grpi0_name;
  725. }GROUP_INFO_0, *PGROUP_INFO_0, *LPGROUP_INFO_0;
  726. typedef struct _GROUP_INFO_1 {
  727. LPWSTR grpi1_name;
  728. LPWSTR grpi1_comment;
  729. }GROUP_INFO_1, *PGROUP_INFO_1, *LPGROUP_INFO_1;
  730. typedef struct _GROUP_INFO_2 {
  731. LPWSTR grpi2_name;
  732. LPWSTR grpi2_comment;
  733. DWORD grpi2_group_id;
  734. DWORD grpi2_attributes;
  735. }GROUP_INFO_2, *PGROUP_INFO_2;
  736. typedef struct _GROUP_INFO_3 {
  737. LPWSTR grpi3_name;
  738. LPWSTR grpi3_comment;
  739. PSID grpi3_group_sid;
  740. DWORD grpi3_attributes;
  741. }GROUP_INFO_3, *PGROUP_INFO_3;
  742. typedef struct _GROUP_INFO_1002 {
  743. LPWSTR grpi1002_comment;
  744. } GROUP_INFO_1002, *PGROUP_INFO_1002, *LPGROUP_INFO_1002;
  745. typedef struct _GROUP_INFO_1005 {
  746. DWORD grpi1005_attributes;
  747. } GROUP_INFO_1005, *PGROUP_INFO_1005, *LPGROUP_INFO_1005;
  748. typedef struct _GROUP_USERS_INFO_0 {
  749. LPWSTR grui0_name;
  750. } GROUP_USERS_INFO_0, *PGROUP_USERS_INFO_0, *LPGROUP_USERS_INFO_0;
  751. typedef struct _GROUP_USERS_INFO_1 {
  752. LPWSTR grui1_name;
  753. DWORD grui1_attributes;
  754. } GROUP_USERS_INFO_1, *PGROUP_USERS_INFO_1, *LPGROUP_USERS_INFO_1;
  755. //
  756. // Special Values and Constants - Group
  757. //
  758. #define GROUPIDMASK 0x8000 // MSB set if uid refers
  759. // to a group
  760. //
  761. // Predefined group for all normal users, administrators and guests
  762. // LOCAL is a special group for pinball local security.
  763. //
  764. #define GROUP_SPECIALGRP_USERS L"USERS"
  765. #define GROUP_SPECIALGRP_ADMINS L"ADMINS"
  766. #define GROUP_SPECIALGRP_GUESTS L"GUESTS"
  767. #define GROUP_SPECIALGRP_LOCAL L"LOCAL"
  768. //
  769. // parmnum manifests for SetInfo calls (only comment is settable)
  770. //
  771. #define GROUP_ALL_PARMNUM 0
  772. #define GROUP_NAME_PARMNUM 1
  773. #define GROUP_COMMENT_PARMNUM 2
  774. #define GROUP_ATTRIBUTES_PARMNUM 3
  775. //
  776. // the new infolevel counterparts of the old info level + parmnum
  777. //
  778. #define GROUP_ALL_INFOLEVEL \
  779. (PARMNUM_BASE_INFOLEVEL + GROUP_ALL_PARMNUM)
  780. #define GROUP_NAME_INFOLEVEL \
  781. (PARMNUM_BASE_INFOLEVEL + GROUP_NAME_PARMNUM)
  782. #define GROUP_COMMENT_INFOLEVEL \
  783. (PARMNUM_BASE_INFOLEVEL + GROUP_COMMENT_PARMNUM)
  784. #define GROUP_ATTRIBUTES_INFOLEVEL \
  785. (PARMNUM_BASE_INFOLEVEL + GROUP_ATTRIBUTES_PARMNUM)
  786. #define GROUP_POSIX_ID_INFOLEVEL \
  787. (PARMNUM_BASE_INFOLEVEL + GROUP_POSIX_ID_PARMNUM)
  788. #endif // _LMGROUP_
  789. //
  790. // LocalGroup Class
  791. //
  792. #ifndef _LMLOCALGROUP_
  793. #define _LMLOCALGROUP_
  794. //
  795. // Function Prototypes
  796. //
  797. NET_API_STATUS NET_API_FUNCTION
  798. NetLocalGroupAdd (
  799. IN LPCWSTR servername OPTIONAL,
  800. IN DWORD level,
  801. IN LPBYTE buf,
  802. OUT LPDWORD parm_err OPTIONAL
  803. );
  804. NET_API_STATUS NET_API_FUNCTION
  805. NetLocalGroupAddMember (
  806. IN LPCWSTR servername OPTIONAL,
  807. IN LPCWSTR groupname,
  808. IN PSID membersid
  809. );
  810. NET_API_STATUS NET_API_FUNCTION
  811. NetLocalGroupEnum (
  812. IN LPCWSTR servername OPTIONAL,
  813. IN DWORD level,
  814. OUT LPBYTE *bufptr,
  815. IN DWORD prefmaxlen,
  816. OUT LPDWORD entriesread,
  817. OUT LPDWORD totalentries,
  818. IN OUT PDWORD_PTR resumehandle OPTIONAL
  819. );
  820. NET_API_STATUS NET_API_FUNCTION
  821. NetLocalGroupGetInfo (
  822. IN LPCWSTR servername OPTIONAL,
  823. IN LPCWSTR groupname,
  824. IN DWORD level,
  825. OUT LPBYTE *bufptr
  826. );
  827. NET_API_STATUS NET_API_FUNCTION
  828. NetLocalGroupSetInfo (
  829. IN LPCWSTR servername OPTIONAL,
  830. IN LPCWSTR groupname,
  831. IN DWORD level,
  832. IN LPBYTE buf,
  833. OUT LPDWORD parm_err OPTIONAL
  834. );
  835. NET_API_STATUS NET_API_FUNCTION
  836. NetLocalGroupDel (
  837. IN LPCWSTR servername OPTIONAL,
  838. IN LPCWSTR groupname
  839. );
  840. NET_API_STATUS NET_API_FUNCTION
  841. NetLocalGroupDelMember (
  842. IN LPCWSTR servername OPTIONAL,
  843. IN LPCWSTR groupname,
  844. IN PSID membersid
  845. );
  846. NET_API_STATUS NET_API_FUNCTION
  847. NetLocalGroupGetMembers (
  848. IN LPCWSTR servername OPTIONAL,
  849. IN LPCWSTR localgroupname,
  850. IN DWORD level,
  851. OUT LPBYTE *bufptr,
  852. IN DWORD prefmaxlen,
  853. OUT LPDWORD entriesread,
  854. OUT LPDWORD totalentries,
  855. IN OUT PDWORD_PTR resumehandle
  856. );
  857. NET_API_STATUS NET_API_FUNCTION
  858. NetLocalGroupSetMembers (
  859. IN LPCWSTR servername OPTIONAL,
  860. IN LPCWSTR groupname,
  861. IN DWORD level,
  862. IN LPBYTE buf,
  863. IN DWORD totalentries
  864. );
  865. NET_API_STATUS NET_API_FUNCTION
  866. NetLocalGroupAddMembers (
  867. IN LPCWSTR servername OPTIONAL,
  868. IN LPCWSTR groupname,
  869. IN DWORD level,
  870. IN LPBYTE buf,
  871. IN DWORD totalentries
  872. );
  873. NET_API_STATUS NET_API_FUNCTION
  874. NetLocalGroupDelMembers (
  875. IN LPCWSTR servername OPTIONAL,
  876. IN LPCWSTR groupname,
  877. IN DWORD level,
  878. IN LPBYTE buf,
  879. IN DWORD totalentries
  880. );
  881. //
  882. // Data Structures - LocalGroup
  883. //
  884. typedef struct _LOCALGROUP_INFO_0 {
  885. LPWSTR lgrpi0_name;
  886. }LOCALGROUP_INFO_0, *PLOCALGROUP_INFO_0, *LPLOCALGROUP_INFO_0;
  887. typedef struct _LOCALGROUP_INFO_1 {
  888. LPWSTR lgrpi1_name;
  889. LPWSTR lgrpi1_comment;
  890. }LOCALGROUP_INFO_1, *PLOCALGROUP_INFO_1, *LPLOCALGROUP_INFO_1;
  891. typedef struct _LOCALGROUP_INFO_1002 {
  892. LPWSTR lgrpi1002_comment;
  893. }LOCALGROUP_INFO_1002, *PLOCALGROUP_INFO_1002, *LPLOCALGROUP_INFO_1002;
  894. typedef struct _LOCALGROUP_MEMBERS_INFO_0 {
  895. PSID lgrmi0_sid;
  896. } LOCALGROUP_MEMBERS_INFO_0, *PLOCALGROUP_MEMBERS_INFO_0,
  897. *LPLOCALGROUP_MEMBERS_INFO_0;
  898. typedef struct _LOCALGROUP_MEMBERS_INFO_1 {
  899. PSID lgrmi1_sid;
  900. SID_NAME_USE lgrmi1_sidusage;
  901. LPWSTR lgrmi1_name;
  902. } LOCALGROUP_MEMBERS_INFO_1, *PLOCALGROUP_MEMBERS_INFO_1,
  903. *LPLOCALGROUP_MEMBERS_INFO_1;
  904. typedef struct _LOCALGROUP_MEMBERS_INFO_2 {
  905. PSID lgrmi2_sid;
  906. SID_NAME_USE lgrmi2_sidusage;
  907. LPWSTR lgrmi2_domainandname;
  908. } LOCALGROUP_MEMBERS_INFO_2, *PLOCALGROUP_MEMBERS_INFO_2,
  909. *LPLOCALGROUP_MEMBERS_INFO_2;
  910. typedef struct _LOCALGROUP_MEMBERS_INFO_3 {
  911. LPWSTR lgrmi3_domainandname;
  912. } LOCALGROUP_MEMBERS_INFO_3, *PLOCALGROUP_MEMBERS_INFO_3,
  913. *LPLOCALGROUP_MEMBERS_INFO_3;
  914. typedef struct _LOCALGROUP_USERS_INFO_0 {
  915. LPWSTR lgrui0_name;
  916. } LOCALGROUP_USERS_INFO_0, *PLOCALGROUP_USERS_INFO_0,
  917. *LPLOCALGROUP_USERS_INFO_0;
  918. #define LOCALGROUP_NAME_PARMNUM 1
  919. #define LOCALGROUP_COMMENT_PARMNUM 2
  920. //
  921. // Display Information APIs
  922. //
  923. NET_API_STATUS NET_API_FUNCTION
  924. NetQueryDisplayInformation(
  925. IN LPCWSTR ServerName OPTIONAL,
  926. IN DWORD Level,
  927. IN DWORD Index,
  928. IN DWORD EntriesRequested,
  929. IN DWORD PreferredMaximumLength,
  930. OUT LPDWORD ReturnedEntryCount,
  931. OUT PVOID *SortedBuffer );
  932. NET_API_STATUS NET_API_FUNCTION
  933. NetGetDisplayInformationIndex(
  934. IN LPCWSTR ServerName OPTIONAL,
  935. IN DWORD Level,
  936. IN LPCWSTR Prefix,
  937. OUT LPDWORD Index );
  938. //
  939. // QueryDisplayInformation levels
  940. typedef struct _NET_DISPLAY_USER {
  941. LPWSTR usri1_name;
  942. LPWSTR usri1_comment;
  943. DWORD usri1_flags;
  944. LPWSTR usri1_full_name;
  945. DWORD usri1_user_id;
  946. DWORD usri1_next_index;
  947. } NET_DISPLAY_USER, *PNET_DISPLAY_USER;
  948. typedef struct _NET_DISPLAY_MACHINE {
  949. LPWSTR usri2_name;
  950. LPWSTR usri2_comment;
  951. DWORD usri2_flags;
  952. DWORD usri2_user_id;
  953. DWORD usri2_next_index;
  954. } NET_DISPLAY_MACHINE, *PNET_DISPLAY_MACHINE;
  955. typedef struct _NET_DISPLAY_GROUP {
  956. LPWSTR grpi3_name;
  957. LPWSTR grpi3_comment;
  958. DWORD grpi3_group_id;
  959. DWORD grpi3_attributes;
  960. DWORD grpi3_next_index;
  961. } NET_DISPLAY_GROUP, *PNET_DISPLAY_GROUP;
  962. #endif // _LMLOCALGROUP_
  963. //
  964. // Access Class
  965. //
  966. #ifndef _LMACCESS_
  967. #define _LMACCESS_
  968. //
  969. // Function Prototypes - Access
  970. //
  971. //
  972. // The NetAccess APIs are only available to downlevel
  973. //
  974. #define NetAccessAdd RxNetAccessAdd
  975. NET_API_STATUS NET_API_FUNCTION
  976. NetAccessAdd (
  977. IN LPCWSTR servername OPTIONAL,
  978. IN DWORD level,
  979. IN LPBYTE buf,
  980. OUT LPDWORD parm_err OPTIONAL
  981. );
  982. #define NetAccessEnum RxNetAccessEnum
  983. NET_API_STATUS NET_API_FUNCTION
  984. NetAccessEnum (
  985. IN LPCWSTR servername OPTIONAL,
  986. IN LPCWSTR BasePath,
  987. IN DWORD Recursive,
  988. IN DWORD level,
  989. OUT LPBYTE *bufptr,
  990. IN DWORD prefmaxlen,
  991. OUT LPDWORD entriesread,
  992. OUT LPDWORD totalentries,
  993. IN OUT LPDWORD resume_handle OPTIONAL
  994. );
  995. #define NetAccessGetInfo RxNetAccessGetInfo
  996. NET_API_STATUS NET_API_FUNCTION
  997. NetAccessGetInfo (
  998. IN LPCWSTR servername OPTIONAL,
  999. IN LPCWSTR resource,
  1000. IN DWORD level,
  1001. OUT LPBYTE *bufptr
  1002. );
  1003. #define NetAccessSetInfo RxNetAccessSetInfo
  1004. NET_API_STATUS NET_API_FUNCTION
  1005. NetAccessSetInfo (
  1006. IN LPCWSTR servername OPTIONAL,
  1007. IN LPCWSTR resource,
  1008. IN DWORD level,
  1009. IN LPBYTE buf,
  1010. OUT LPDWORD parm_err OPTIONAL
  1011. );
  1012. #define NetAccessDel RxNetAccessDel
  1013. NET_API_STATUS NET_API_FUNCTION
  1014. NetAccessDel (
  1015. IN LPCWSTR servername OPTIONAL,
  1016. IN LPCWSTR resource
  1017. );
  1018. #define NetAccessGetUserPerms RxNetAccessGetUserPerms
  1019. NET_API_STATUS NET_API_FUNCTION
  1020. NetAccessGetUserPerms (
  1021. IN LPCWSTR servername OPTIONAL,
  1022. IN LPCWSTR UGname,
  1023. IN LPCWSTR resource,
  1024. OUT LPDWORD Perms
  1025. );
  1026. //
  1027. // Data Structures - Access
  1028. //
  1029. typedef struct _ACCESS_INFO_0 {
  1030. LPWSTR acc0_resource_name;
  1031. }ACCESS_INFO_0, *PACCESS_INFO_0, *LPACCESS_INFO_0;
  1032. typedef struct _ACCESS_INFO_1 {
  1033. LPWSTR acc1_resource_name;
  1034. DWORD acc1_attr;
  1035. DWORD acc1_count;
  1036. }ACCESS_INFO_1, *PACCESS_INFO_1, *LPACCESS_INFO_1;
  1037. typedef struct _ACCESS_INFO_1002 {
  1038. DWORD acc1002_attr;
  1039. } ACCESS_INFO_1002, *PACCESS_INFO_1002, *LPACCESS_INFO_1002;
  1040. typedef struct _ACCESS_LIST {
  1041. LPWSTR acl_ugname;
  1042. DWORD acl_access;
  1043. }ACCESS_LIST, *PACCESS_LIST, *LPACCESS_LIST;
  1044. //
  1045. // Special Values and Constants - Access
  1046. //
  1047. //
  1048. // Maximum number of permission entries for each resource.
  1049. //
  1050. #define MAXPERMENTRIES 64
  1051. //
  1052. // Bit values for the access permissions. ACCESS_ALL is a handy
  1053. // way to specify maximum permissions. These are used in
  1054. // acl_access field of access_list structures.
  1055. //
  1056. #define ACCESS_NONE 0
  1057. #define ACCESS_ALL ( ACCESS_READ | \
  1058. ACCESS_WRITE | \
  1059. ACCESS_CREATE | \
  1060. ACCESS_EXEC | \
  1061. ACCESS_DELETE | \
  1062. ACCESS_ATRIB | \
  1063. ACCESS_PERM \
  1064. )
  1065. #define ACCESS_READ 0x01
  1066. #define ACCESS_WRITE 0x02
  1067. #define ACCESS_CREATE 0x04
  1068. #define ACCESS_EXEC 0x08
  1069. #define ACCESS_DELETE 0x10
  1070. #define ACCESS_ATRIB 0x20
  1071. #define ACCESS_PERM 0x40
  1072. #define ACCESS_GROUP 0x8000
  1073. //
  1074. // Bit values for the acc1_attr field of the ACCESS_INFO_1 structure.
  1075. //
  1076. #define ACCESS_AUDIT 0x1
  1077. #define ACCESS_SUCCESS_OPEN 0x10
  1078. #define ACCESS_SUCCESS_WRITE 0x20
  1079. #define ACCESS_SUCCESS_DELETE 0x40
  1080. #define ACCESS_SUCCESS_ACL 0x80
  1081. #define ACCESS_SUCCESS_MASK 0xF0
  1082. #define ACCESS_FAIL_OPEN 0x100
  1083. #define ACCESS_FAIL_WRITE 0x200
  1084. #define ACCESS_FAIL_DELETE 0x400
  1085. #define ACCESS_FAIL_ACL 0x800
  1086. #define ACCESS_FAIL_MASK 0xF00
  1087. #define ACCESS_FAIL_SHIFT 4
  1088. //
  1089. // Parmnum value for NetAccessSetInfo.
  1090. //
  1091. #define ACCESS_RESOURCE_NAME_PARMNUM 1
  1092. #define ACCESS_ATTR_PARMNUM 2
  1093. #define ACCESS_COUNT_PARMNUM 3
  1094. #define ACCESS_ACCESS_LIST_PARMNUM 4
  1095. //
  1096. // the new infolevel counterparts of the old info level + parmnum
  1097. //
  1098. #define ACCESS_RESOURCE_NAME_INFOLEVEL \
  1099. (PARMNUM_BASE_INFOLEVEL + ACCESS_RESOURCE_NAME_PARMNUM)
  1100. #define ACCESS_ATTR_INFOLEVEL \
  1101. (PARMNUM_BASE_INFOLEVEL + ACCESS_ATTR_PARMNUM)
  1102. #define ACCESS_COUNT_INFOLEVEL \
  1103. (PARMNUM_BASE_INFOLEVEL + ACCESS_COUNT_PARMNUM)
  1104. #define ACCESS_ACCESS_LIST_INFOLEVEL \
  1105. (PARMNUM_BASE_INFOLEVEL + ACCESS_ACCESS_LIST_PARMNUM)
  1106. //
  1107. // ACCESS_LETTERS defines a letter for each bit position in
  1108. // the acl_access field of struct access_list. Note that some
  1109. // bits have a corresponding letter of ' ' (space).
  1110. //
  1111. #define ACCESS_LETTERS "RWCXDAP "
  1112. // ********************************
  1113. //
  1114. // Password Checking API structures
  1115. //
  1116. // ********************************
  1117. //
  1118. // What kind of password checking is to be performed?
  1119. // NetValidateAuthentication : Check if the authentication can be done
  1120. // NetValidatePasswordChange: Check if the password can be changed
  1121. // NetValidatePasswordReset: Reset the password to the given value
  1122. //
  1123. typedef enum _NET_VALIDATE_PASSWORD_TYPE{
  1124. NetValidateAuthentication = 1,
  1125. NetValidatePasswordChange,
  1126. NetValidatePasswordReset
  1127. } NET_VALIDATE_PASSWORD_TYPE, *PNET_VALIDATE_PASSWORD_TYPE;
  1128. //
  1129. // Structure to keep the password hash
  1130. //
  1131. typedef struct _NET_VALIDATE_PASSWORD_HASH{
  1132. ULONG Length;
  1133. LPBYTE Hash;
  1134. } NET_VALIDATE_PASSWORD_HASH, *PNET_VALIDATE_PASSWORD_HASH;
  1135. // To be used with PresentFields member of NET_VALIDATE_PERSISTED_FIELDS
  1136. #define NET_VALIDATE_PASSWORD_LAST_SET 0x00000001
  1137. #define NET_VALIDATE_BAD_PASSWORD_TIME 0x00000002
  1138. #define NET_VALIDATE_LOCKOUT_TIME 0x00000004
  1139. #define NET_VALIDATE_BAD_PASSWORD_COUNT 0x00000008
  1140. #define NET_VALIDATE_PASSWORD_HISTORY_LENGTH 0x00000010
  1141. #define NET_VALIDATE_PASSWORD_HISTORY 0x00000020
  1142. #if !defined(_WINBASE_) && !defined(_FILETIME_)
  1143. #define _FILETIME_
  1144. typedef struct _FILETIME
  1145. {
  1146. DWORD dwLowDateTime;
  1147. DWORD dwHighDateTime;
  1148. } FILETIME, FAR * LPFILETIME, *PFILETIME;
  1149. #endif
  1150. //
  1151. // Structure to keep information about the password and related things.
  1152. // Present Fields: (used only in output args) which fields are changed.
  1153. // See the constants above.
  1154. // PasswordLastSet: When the password is last set.
  1155. // BadPasswordTime: When the password was incorrect for the last time.
  1156. // LockoutTime: When the account is locked out. If the account is not locked out
  1157. // it is 0.
  1158. // BadPasswordCount: How many times the password has given incorrectly in the
  1159. // Observation Window.
  1160. // PasswordHistoryLength: How many passwords are kept in the history
  1161. // PasswordHistory: Password hashes that are in the history
  1162. //
  1163. typedef struct _NET_VALIDATE_PERSISTED_FIELDS{
  1164. ULONG PresentFields;
  1165. FILETIME PasswordLastSet;
  1166. FILETIME BadPasswordTime;
  1167. FILETIME LockoutTime;
  1168. ULONG BadPasswordCount;
  1169. ULONG PasswordHistoryLength;
  1170. PNET_VALIDATE_PASSWORD_HASH PasswordHistory;
  1171. } NET_VALIDATE_PERSISTED_FIELDS, *PNET_VALIDATE_PERSISTED_FIELDS;
  1172. //
  1173. // Output Arg
  1174. // ChangedPersistedFields: Any changes to the password related info
  1175. // ValidationStatus: Shows the result of the request
  1176. //
  1177. typedef struct _NET_VALIDATE_OUTPUT_ARG{
  1178. NET_VALIDATE_PERSISTED_FIELDS ChangedPersistedFields;
  1179. NET_API_STATUS ValidationStatus;
  1180. } NET_VALIDATE_OUTPUT_ARG, *PNET_VALIDATE_OUTPUT_ARG;
  1181. //
  1182. // If authentication type of password check is to be made,
  1183. // this kind of input must be used
  1184. //
  1185. // InputPersistedFields: Information about the account to be logged into
  1186. // PasswordMatched: Indicates the result of the application's authentication of the supplied password
  1187. //
  1188. typedef struct _NET_VALIDATE_AUTHENTICATION_INPUT_ARG{
  1189. NET_VALIDATE_PERSISTED_FIELDS InputPersistedFields;
  1190. BOOLEAN PasswordMatched;
  1191. } NET_VALIDATE_AUTHENTICATION_INPUT_ARG, *PNET_VALIDATE_AUTHENTICATION_INPUT_ARG;
  1192. //
  1193. // If password change type of check is to be made,
  1194. // this kind of input must be used
  1195. //
  1196. // InputPersistedFields: Information about the account to be logged into
  1197. // ClearPassword: The string which password is going to be
  1198. // UserAccountName: Name of the user account
  1199. // HashedPassword: Hash of the string that the password is going to be
  1200. // PasswordMatch: denotes if the old password supplied by user matched or not
  1201. //
  1202. typedef struct _NET_VALIDATE_PASSWORD_CHANGE_INPUT_ARG{
  1203. NET_VALIDATE_PERSISTED_FIELDS InputPersistedFields;
  1204. LPWSTR ClearPassword;
  1205. LPWSTR UserAccountName;
  1206. NET_VALIDATE_PASSWORD_HASH HashedPassword;
  1207. BOOLEAN PasswordMatch;
  1208. } NET_VALIDATE_PASSWORD_CHANGE_INPUT_ARG, *PNET_VALIDATE_PASSWORD_CHANGE_INPUT_ARG;
  1209. //
  1210. // If password reset type of check is to be made,
  1211. // this kind of input must be used
  1212. //
  1213. // InputPersistedFields: Information about the account to be logged into
  1214. // ClearPassword: The string which password is going to be
  1215. // UserAccountName: Name of the user account
  1216. // HashedPassword: Hash of the string that the password is going to be
  1217. // PasswordMustChangeAtNextLogon: Password must change for the user to be logged in
  1218. // ClearLockout: If the account was locked out, this field can be used to clear lockout
  1219. //
  1220. typedef struct _NET_VALIDATE_PASSWORD_RESET_INPUT_ARG{
  1221. NET_VALIDATE_PERSISTED_FIELDS InputPersistedFields;
  1222. LPWSTR ClearPassword;
  1223. LPWSTR UserAccountName;
  1224. NET_VALIDATE_PASSWORD_HASH HashedPassword;
  1225. BOOLEAN PasswordMustChangeAtNextLogon;
  1226. BOOLEAN ClearLockout;
  1227. } NET_VALIDATE_PASSWORD_RESET_INPUT_ARG, *PNET_VALIDATE_PASSWORD_RESET_INPUT_ARG;
  1228. //
  1229. // Password Checking API structures end here
  1230. //
  1231. NET_API_STATUS NET_API_FUNCTION
  1232. NetValidatePasswordPolicy(
  1233. IN LPCWSTR ServerName,
  1234. IN LPVOID Qualifier,
  1235. IN NET_VALIDATE_PASSWORD_TYPE ValidationType,
  1236. IN LPVOID InputArg,
  1237. OUT LPVOID *OutputArg
  1238. );
  1239. NET_API_STATUS NET_API_FUNCTION
  1240. NetValidatePasswordPolicyFree(
  1241. IN LPVOID *OutputArg
  1242. );
  1243. #endif // _LMACCESS_
  1244. //
  1245. // Domain Class
  1246. //
  1247. #ifndef _LMDOMAIN_
  1248. #define _LMDOMAIN_
  1249. //
  1250. // Function Prototypes - Domain
  1251. //
  1252. NET_API_STATUS NET_API_FUNCTION
  1253. NetGetDCName (
  1254. IN LPCWSTR servername OPTIONAL,
  1255. IN LPCWSTR domainname OPTIONAL,
  1256. OUT LPBYTE *bufptr
  1257. );
  1258. NET_API_STATUS NET_API_FUNCTION
  1259. NetGetAnyDCName (
  1260. IN LPCWSTR servername OPTIONAL,
  1261. IN LPCWSTR domainname OPTIONAL,
  1262. OUT LPBYTE *bufptr
  1263. );
  1264. NET_API_STATUS NET_API_FUNCTION
  1265. I_NetLogonControl(
  1266. IN LPCWSTR ServerName OPTIONAL,
  1267. IN DWORD FunctionCode,
  1268. IN DWORD QueryLevel,
  1269. OUT LPBYTE *Buffer
  1270. );
  1271. NET_API_STATUS NET_API_FUNCTION
  1272. I_NetLogonControl2(
  1273. IN LPCWSTR ServerName OPTIONAL,
  1274. IN DWORD FunctionCode,
  1275. IN DWORD QueryLevel,
  1276. IN LPBYTE Data,
  1277. OUT LPBYTE *Buffer
  1278. );
  1279. #ifndef _NTDEF_
  1280. typedef LONG NTSTATUS, *PNTSTATUS;
  1281. #endif
  1282. NTSTATUS NET_API_FUNCTION
  1283. NetEnumerateTrustedDomains (
  1284. IN LPWSTR ServerName OPTIONAL,
  1285. OUT LPWSTR *DomainNames
  1286. );
  1287. //
  1288. // Special Values and Constants - Domain
  1289. //
  1290. //
  1291. // FunctionCode values for I_NetLogonControl.
  1292. //
  1293. // NOTE : if you change the following NETLOGON_CONTROL_* values,
  1294. // change them in net\svcdlls\logonsrv\logon.idl file also.
  1295. //
  1296. #define NETLOGON_CONTROL_QUERY 1 // No-op: just query
  1297. #define NETLOGON_CONTROL_REPLICATE 2 // Force replicate on BDC
  1298. #define NETLOGON_CONTROL_SYNCHRONIZE 3 // Force synchronize on BDC
  1299. #define NETLOGON_CONTROL_PDC_REPLICATE 4 // Force PDC to broadcast change
  1300. #define NETLOGON_CONTROL_REDISCOVER 5 // Force to re-discover trusted domain DCs
  1301. #define NETLOGON_CONTROL_TC_QUERY 6 // Query status of specified trusted channel status
  1302. #define NETLOGON_CONTROL_TRANSPORT_NOTIFY 7 // Notify netlogon that a new transport has come online
  1303. #define NETLOGON_CONTROL_FIND_USER 8 // Find named user in a trusted domain
  1304. #define NETLOGON_CONTROL_CHANGE_PASSWORD 9 // Change machine password on a secure channel to a trusted domain
  1305. #define NETLOGON_CONTROL_TC_VERIFY 10 // Verify status of specified trusted channel
  1306. #define NETLOGON_CONTROL_FORCE_DNS_REG 11 // Force DNS re-registration of all registered records
  1307. #define NETLOGON_CONTROL_QUERY_DNS_REG 12 // Query the status of DNS updates
  1308. // Debug function codes
  1309. #define NETLOGON_CONTROL_UNLOAD_NETLOGON_DLL 0xFFFB
  1310. #define NETLOGON_CONTROL_BACKUP_CHANGE_LOG 0xFFFC
  1311. #define NETLOGON_CONTROL_TRUNCATE_LOG 0xFFFD
  1312. #define NETLOGON_CONTROL_SET_DBFLAG 0xFFFE
  1313. #define NETLOGON_CONTROL_BREAKPOINT 0xFFFF
  1314. //
  1315. // Query level 1 for I_NetLogonControl
  1316. //
  1317. typedef struct _NETLOGON_INFO_1 {
  1318. DWORD netlog1_flags;
  1319. NET_API_STATUS netlog1_pdc_connection_status;
  1320. } NETLOGON_INFO_1, *PNETLOGON_INFO_1;
  1321. typedef struct _NETLOGON_INFO_2 {
  1322. DWORD netlog2_flags;
  1323. //
  1324. // If NETLOGON_VERIFY_STATUS_RETURNED bit is set in
  1325. // netlog2_flags, the following field will return
  1326. // the status of trust verification. Otherwise,
  1327. // the field will return the status of the secure
  1328. // channel to the primary domain of the machine
  1329. // (useful for BDCs only).
  1330. //
  1331. NET_API_STATUS netlog2_pdc_connection_status;
  1332. #ifdef MIDL_PASS
  1333. [string] wchar_t * netlog2_trusted_dc_name;
  1334. #else
  1335. LPWSTR netlog2_trusted_dc_name;
  1336. #endif // MIDL_PASS
  1337. NET_API_STATUS netlog2_tc_connection_status;
  1338. } NETLOGON_INFO_2, *PNETLOGON_INFO_2;
  1339. typedef struct _NETLOGON_INFO_3 {
  1340. DWORD netlog3_flags;
  1341. DWORD netlog3_logon_attempts;
  1342. DWORD netlog3_reserved1;
  1343. DWORD netlog3_reserved2;
  1344. DWORD netlog3_reserved3;
  1345. DWORD netlog3_reserved4;
  1346. DWORD netlog3_reserved5;
  1347. } NETLOGON_INFO_3, *PNETLOGON_INFO_3;
  1348. typedef struct _NETLOGON_INFO_4 {
  1349. #ifdef MIDL_PASS
  1350. [string] wchar_t * netlog4_trusted_dc_name;
  1351. [string] wchar_t * netlog4_trusted_domain_name;
  1352. #else
  1353. LPWSTR netlog4_trusted_dc_name;
  1354. LPWSTR netlog4_trusted_domain_name;
  1355. #endif // MIDL_PASS
  1356. } NETLOGON_INFO_4, *PNETLOGON_INFO_4;
  1357. //
  1358. // Values of netlog1_flags
  1359. //
  1360. #define NETLOGON_REPLICATION_NEEDED 0x01 // Database is out of date
  1361. #define NETLOGON_REPLICATION_IN_PROGRESS 0x02 // Replication is happening now
  1362. #define NETLOGON_FULL_SYNC_REPLICATION 0x04 // full sync replication required/progress
  1363. #define NETLOGON_REDO_NEEDED 0x08 // Redo of previous replication needed
  1364. #define NETLOGON_HAS_IP 0x10 // The trusted domain DC has an IP address
  1365. #define NETLOGON_HAS_TIMESERV 0x20 // The trusted domain DC runs the Windows Time Service
  1366. #define NETLOGON_DNS_UPDATE_FAILURE 0x40 // There was a failure in the last update for one of the DNS records
  1367. #define NETLOGON_VERIFY_STATUS_RETURNED 0x80 // Trust verification status returned in netlog2_pdc_connection_status
  1368. #ifdef __cplusplus
  1369. }
  1370. #endif
  1371. #endif // _LMDOMAIN_