Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1901 lines
60 KiB

  1. /*++ BUILD Version: 0006 // Increment this if a change has global effects
  2. Copyright (c) 1989-1999 Microsoft Corporation
  3. Module Name:
  4. ntsam.h
  5. Abstract:
  6. This module describes the data types and procedure prototypes
  7. that make up the NT Security Accounts Manager. This includes
  8. API's exported by SAM and related subsystems.
  9. Author:
  10. Edwin Hoogerbeets (w-edwinh) 3-May-1990
  11. Revision History:
  12. 30-Nov-1990 [w-mikep] Updated code to reflect changes in version 1.4
  13. of Sam Document.
  14. 20-May-1991 (JimK) Updated to version 1.8 of SAM spec.
  15. 10-Sep-1991 (JohnRo) PC-LINT found a portability problem.
  16. 23-Jan-1991 (ChadS) Udated to version 1.14 of SAM spec.
  17. --*/
  18. #ifndef _NTSAM_
  19. #define _NTSAM_
  20. #if _MSC_VER > 1000
  21. #pragma once
  22. #endif
  23. #ifdef __cplusplus
  24. extern "C" {
  25. #endif
  26. #ifndef PPULONG
  27. typedef PULONG *PPULONG;
  28. #endif //PPULONG
  29. //
  30. // An attempt to lookup more than this number of names or SIDs in
  31. // a single call will be rejected with an INSUFFICIENT_RESOURCES
  32. // status.
  33. //
  34. #define SAM_MAXIMUM_LOOKUP_COUNT (1000)
  35. //
  36. // An attempt to pass names totalling more than the following number
  37. // of bytes in length will be rejected with an INSUFFICIENT_RESOURCES
  38. // status.
  39. //
  40. #define SAM_MAXIMUM_LOOKUP_LENGTH (32000)
  41. //
  42. // An attempt to set a password longer than this number of characters
  43. // will fail.
  44. //
  45. #define SAM_MAX_PASSWORD_LENGTH (256)
  46. //
  47. // Length of the salt used in the clear password encryption
  48. //
  49. #define SAM_PASSWORD_ENCRYPTION_SALT_LEN (16)
  50. #ifndef _NTSAM_SAM_HANDLE_ // ntsubauth
  51. typedef PVOID SAM_HANDLE, *PSAM_HANDLE; // ntsubauth
  52. #define _NTSAM_SAM_HANDLE_ // ntsubauth
  53. #endif // ntsubauth
  54. typedef ULONG SAM_ENUMERATE_HANDLE, *PSAM_ENUMERATE_HANDLE;
  55. typedef struct _SAM_RID_ENUMERATION {
  56. ULONG RelativeId;
  57. UNICODE_STRING Name;
  58. } SAM_RID_ENUMERATION, *PSAM_RID_ENUMERATION;
  59. typedef struct _SAM_SID_ENUMERATION {
  60. PSID Sid;
  61. UNICODE_STRING Name;
  62. } SAM_SID_ENUMERATION, *PSAM_SID_ENUMERATION;
  63. /////////////////////////////////////////////////////////////////////////////
  64. // //
  65. // obsolete well-known account names. //
  66. // These became obsolete with the flexadmin model. //
  67. // These will be deleted shortly - DON'T USE THESE //
  68. // //
  69. /////////////////////////////////////////////////////////////////////////////
  70. #define DOMAIN_ADMIN_USER_NAME "ADMIN"
  71. #define DOMAIN_ADMIN_NAME "D_ADMIN"
  72. #define DOMAIN_ADMIN_NAMEW L"D_ADMIN"
  73. #define DOMAIN_USERS_NAME "D_USERS"
  74. #define DOMAIN_USERS_NAMEW L"D_USERS"
  75. #define DOMAIN_GUESTS_NAME "D_GUESTS"
  76. #define DOMAIN_ACCOUNT_OPERATORS_NAME "D_ACCOUN"
  77. #define DOMAIN_ACCOUNT_OPERATORS_NAMEW L"D_ACCOUN"
  78. #define DOMAIN_SERVER_OPERATORS_NAME "D_SERVER"
  79. #define DOMAIN_SERVER_OPERATORS_NAMEW L"D_SERVER"
  80. #define DOMAIN_PRINT_OPERATORS_NAME "D_PRINT"
  81. #define DOMAIN_PRINT_OPERATORS_NAMEW L"D_PRINT"
  82. #define DOMAIN_COMM_OPERATORS_NAME "D_COMM"
  83. #define DOMAIN_COMM_OPERATORS_NAMEW L"D_COMM"
  84. #define DOMAIN_BACKUP_OPERATORS_NAME "D_BACKUP"
  85. #define DOMAIN_RESTORE_OPERATORS_NAME "D_RESTOR"
  86. ///////////////////////////////////////////////////////////////////////////////
  87. // //
  88. // Server Object Related Definitions //
  89. // //
  90. ///////////////////////////////////////////////////////////////////////////////
  91. //
  92. // Access rights for server object
  93. //
  94. #define SAM_SERVER_CONNECT 0x0001
  95. #define SAM_SERVER_SHUTDOWN 0x0002
  96. #define SAM_SERVER_INITIALIZE 0x0004
  97. #define SAM_SERVER_CREATE_DOMAIN 0x0008
  98. #define SAM_SERVER_ENUMERATE_DOMAINS 0x0010
  99. #define SAM_SERVER_LOOKUP_DOMAIN 0x0020
  100. #define SAM_SERVER_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED |\
  101. SAM_SERVER_CONNECT |\
  102. SAM_SERVER_INITIALIZE |\
  103. SAM_SERVER_CREATE_DOMAIN |\
  104. SAM_SERVER_SHUTDOWN |\
  105. SAM_SERVER_ENUMERATE_DOMAINS |\
  106. SAM_SERVER_LOOKUP_DOMAIN)
  107. #define SAM_SERVER_READ (STANDARD_RIGHTS_READ |\
  108. SAM_SERVER_ENUMERATE_DOMAINS)
  109. #define SAM_SERVER_WRITE (STANDARD_RIGHTS_WRITE |\
  110. SAM_SERVER_INITIALIZE |\
  111. SAM_SERVER_CREATE_DOMAIN |\
  112. SAM_SERVER_SHUTDOWN)
  113. #define SAM_SERVER_EXECUTE (STANDARD_RIGHTS_EXECUTE |\
  114. SAM_SERVER_CONNECT |\
  115. SAM_SERVER_LOOKUP_DOMAIN)
  116. ///////////////////////////////////////////////////////////////////////////////
  117. // //
  118. // Domain Object Related Definitions //
  119. // //
  120. ///////////////////////////////////////////////////////////////////////////////
  121. //
  122. // Access rights for domain object
  123. //
  124. #define DOMAIN_READ_PASSWORD_PARAMETERS 0x0001
  125. #define DOMAIN_WRITE_PASSWORD_PARAMS 0x0002
  126. #define DOMAIN_READ_OTHER_PARAMETERS 0x0004
  127. #define DOMAIN_WRITE_OTHER_PARAMETERS 0x0008
  128. #define DOMAIN_CREATE_USER 0x0010
  129. #define DOMAIN_CREATE_GROUP 0x0020
  130. #define DOMAIN_CREATE_ALIAS 0x0040
  131. #define DOMAIN_GET_ALIAS_MEMBERSHIP 0x0080
  132. #define DOMAIN_LIST_ACCOUNTS 0x0100
  133. #define DOMAIN_LOOKUP 0x0200
  134. #define DOMAIN_ADMINISTER_SERVER 0x0400
  135. #define DOMAIN_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED |\
  136. DOMAIN_READ_OTHER_PARAMETERS |\
  137. DOMAIN_WRITE_OTHER_PARAMETERS |\
  138. DOMAIN_WRITE_PASSWORD_PARAMS |\
  139. DOMAIN_CREATE_USER |\
  140. DOMAIN_CREATE_GROUP |\
  141. DOMAIN_CREATE_ALIAS |\
  142. DOMAIN_GET_ALIAS_MEMBERSHIP |\
  143. DOMAIN_LIST_ACCOUNTS |\
  144. DOMAIN_READ_PASSWORD_PARAMETERS |\
  145. DOMAIN_LOOKUP |\
  146. DOMAIN_ADMINISTER_SERVER)
  147. #define DOMAIN_READ (STANDARD_RIGHTS_READ |\
  148. DOMAIN_GET_ALIAS_MEMBERSHIP |\
  149. DOMAIN_READ_OTHER_PARAMETERS)
  150. #define DOMAIN_WRITE (STANDARD_RIGHTS_WRITE |\
  151. DOMAIN_WRITE_OTHER_PARAMETERS |\
  152. DOMAIN_WRITE_PASSWORD_PARAMS |\
  153. DOMAIN_CREATE_USER |\
  154. DOMAIN_CREATE_GROUP |\
  155. DOMAIN_CREATE_ALIAS |\
  156. DOMAIN_ADMINISTER_SERVER)
  157. #define DOMAIN_EXECUTE (STANDARD_RIGHTS_EXECUTE |\
  158. DOMAIN_READ_PASSWORD_PARAMETERS |\
  159. DOMAIN_LIST_ACCOUNTS |\
  160. DOMAIN_LOOKUP)
  161. //
  162. // Normal modifications cause a domain's ModifiedCount to be
  163. // incremented by 1. Domain promotion to Primary domain controller
  164. // cause the ModifiedCount to be incremented by the following
  165. // amount. This causes the upper 24-bits of the ModifiedCount
  166. // to be a promotion count and the lower 40-bits as a modification
  167. // count.
  168. //
  169. #define DOMAIN_PROMOTION_INCREMENT {0x0,0x10}
  170. #define DOMAIN_PROMOTION_MASK {0x0,0xFFFFFFF0}
  171. //
  172. // Domain information classes and their corresponding data structures
  173. //
  174. typedef enum _DOMAIN_INFORMATION_CLASS {
  175. DomainPasswordInformation = 1,
  176. DomainGeneralInformation,
  177. DomainLogoffInformation,
  178. DomainOemInformation,
  179. DomainNameInformation,
  180. DomainReplicationInformation,
  181. DomainServerRoleInformation,
  182. DomainModifiedInformation,
  183. DomainStateInformation,
  184. DomainUasInformation,
  185. DomainGeneralInformation2,
  186. DomainLockoutInformation,
  187. DomainModifiedInformation2
  188. } DOMAIN_INFORMATION_CLASS;
  189. typedef enum _DOMAIN_SERVER_ENABLE_STATE {
  190. DomainServerEnabled = 1,
  191. DomainServerDisabled
  192. } DOMAIN_SERVER_ENABLE_STATE, *PDOMAIN_SERVER_ENABLE_STATE;
  193. typedef enum _DOMAIN_SERVER_ROLE {
  194. DomainServerRoleBackup = 2,
  195. DomainServerRolePrimary
  196. } DOMAIN_SERVER_ROLE, *PDOMAIN_SERVER_ROLE;
  197. #include "pshpack4.h"
  198. typedef struct _DOMAIN_GENERAL_INFORMATION {
  199. LARGE_INTEGER ForceLogoff;
  200. UNICODE_STRING OemInformation;
  201. UNICODE_STRING DomainName;
  202. UNICODE_STRING ReplicaSourceNodeName;
  203. LARGE_INTEGER DomainModifiedCount;
  204. DOMAIN_SERVER_ENABLE_STATE DomainServerState;
  205. DOMAIN_SERVER_ROLE DomainServerRole;
  206. BOOLEAN UasCompatibilityRequired;
  207. ULONG UserCount;
  208. ULONG GroupCount;
  209. ULONG AliasCount;
  210. } DOMAIN_GENERAL_INFORMATION, *PDOMAIN_GENERAL_INFORMATION;
  211. #include "poppack.h"
  212. #include "pshpack4.h"
  213. typedef struct _DOMAIN_GENERAL_INFORMATION2 {
  214. DOMAIN_GENERAL_INFORMATION I1;
  215. //
  216. // New fields added for this structure (NT1.0A).
  217. //
  218. LARGE_INTEGER LockoutDuration; //Must be a Delta time
  219. LARGE_INTEGER LockoutObservationWindow; //Must be a Delta time
  220. USHORT LockoutThreshold;
  221. } DOMAIN_GENERAL_INFORMATION2, *PDOMAIN_GENERAL_INFORMATION2;
  222. #include "poppack.h"
  223. typedef struct _DOMAIN_UAS_INFORMATION {
  224. BOOLEAN UasCompatibilityRequired;
  225. } DOMAIN_UAS_INFORMATION;
  226. //
  227. // This needs to be guarded, because ntsecapi.h is a generated
  228. // public file, and ntsam.h is an internal file, but people like
  229. // to mix and match them anyway.
  230. //
  231. // begin_ntsecapi
  232. #ifndef _DOMAIN_PASSWORD_INFORMATION_DEFINED
  233. #define _DOMAIN_PASSWORD_INFORMATION_DEFINED
  234. typedef struct _DOMAIN_PASSWORD_INFORMATION {
  235. USHORT MinPasswordLength;
  236. USHORT PasswordHistoryLength;
  237. ULONG PasswordProperties;
  238. #if defined(MIDL_PASS)
  239. OLD_LARGE_INTEGER MaxPasswordAge;
  240. OLD_LARGE_INTEGER MinPasswordAge;
  241. #else
  242. LARGE_INTEGER MaxPasswordAge;
  243. LARGE_INTEGER MinPasswordAge;
  244. #endif
  245. } DOMAIN_PASSWORD_INFORMATION, *PDOMAIN_PASSWORD_INFORMATION;
  246. #endif
  247. //
  248. // PasswordProperties flags
  249. //
  250. #define DOMAIN_PASSWORD_COMPLEX 0x00000001L
  251. #define DOMAIN_PASSWORD_NO_ANON_CHANGE 0x00000002L
  252. #define DOMAIN_PASSWORD_NO_CLEAR_CHANGE 0x00000004L
  253. #define DOMAIN_LOCKOUT_ADMINS 0x00000008L
  254. #define DOMAIN_PASSWORD_STORE_CLEARTEXT 0x00000010L
  255. #define DOMAIN_REFUSE_PASSWORD_CHANGE 0x00000020L
  256. #define DOMAIN_NO_LM_OWF_CHANGE 0x00000040L
  257. // end_ntsecapi
  258. typedef enum _DOMAIN_PASSWORD_CONSTRUCTION {
  259. DomainPasswordSimple = 1,
  260. DomainPasswordComplex
  261. } DOMAIN_PASSWORD_CONSTRUCTION;
  262. typedef struct _DOMAIN_LOGOFF_INFORMATION {
  263. #if defined(MIDL_PASS)
  264. OLD_LARGE_INTEGER ForceLogoff;
  265. #else
  266. LARGE_INTEGER ForceLogoff;
  267. #endif
  268. } DOMAIN_LOGOFF_INFORMATION, *PDOMAIN_LOGOFF_INFORMATION;
  269. typedef struct _DOMAIN_OEM_INFORMATION {
  270. UNICODE_STRING OemInformation;
  271. } DOMAIN_OEM_INFORMATION, *PDOMAIN_OEM_INFORMATION;
  272. typedef struct _DOMAIN_NAME_INFORMATION {
  273. UNICODE_STRING DomainName;
  274. } DOMAIN_NAME_INFORMATION, *PDOMAIN_NAME_INFORMATION;
  275. typedef struct _DOMAIN_SERVER_ROLE_INFORMATION {
  276. DOMAIN_SERVER_ROLE DomainServerRole;
  277. } DOMAIN_SERVER_ROLE_INFORMATION, *PDOMAIN_SERVER_ROLE_INFORMATION;
  278. typedef struct _DOMAIN_REPLICATION_INFORMATION {
  279. UNICODE_STRING ReplicaSourceNodeName;
  280. } DOMAIN_REPLICATION_INFORMATION, *PDOMAIN_REPLICATION_INFORMATION;
  281. typedef struct _DOMAIN_MODIFIED_INFORMATION {
  282. #if defined(MIDL_PASS)
  283. OLD_LARGE_INTEGER DomainModifiedCount;
  284. OLD_LARGE_INTEGER CreationTime;
  285. #else
  286. LARGE_INTEGER DomainModifiedCount;
  287. LARGE_INTEGER CreationTime;
  288. #endif
  289. } DOMAIN_MODIFIED_INFORMATION, *PDOMAIN_MODIFIED_INFORMATION;
  290. typedef struct _DOMAIN_MODIFIED_INFORMATION2 {
  291. #if defined(MIDL_PASS)
  292. OLD_LARGE_INTEGER DomainModifiedCount;
  293. OLD_LARGE_INTEGER CreationTime;
  294. OLD_LARGE_INTEGER ModifiedCountAtLastPromotion;
  295. #else
  296. LARGE_INTEGER DomainModifiedCount;
  297. LARGE_INTEGER CreationTime;
  298. LARGE_INTEGER ModifiedCountAtLastPromotion;
  299. #endif
  300. } DOMAIN_MODIFIED_INFORMATION2, *PDOMAIN_MODIFIED_INFORMATION2;
  301. typedef struct _DOMAIN_STATE_INFORMATION {
  302. DOMAIN_SERVER_ENABLE_STATE DomainServerState;
  303. } DOMAIN_STATE_INFORMATION, *PDOMAIN_STATE_INFORMATION;
  304. typedef struct _DOMAIN_LOCKOUT_INFORMATION {
  305. #if defined(MIDL_PASS)
  306. OLD_LARGE_INTEGER LockoutDuration; //Must be a Delta time
  307. OLD_LARGE_INTEGER LockoutObservationWindow; //Must be a Delta time
  308. #else
  309. LARGE_INTEGER LockoutDuration; //Must be a Delta time
  310. LARGE_INTEGER LockoutObservationWindow; //Must be a Delta time
  311. #endif
  312. USHORT LockoutThreshold; //Zero means no lockout
  313. } DOMAIN_LOCKOUT_INFORMATION, *PDOMAIN_LOCKOUT_INFORMATION;
  314. //
  315. // Types used by the SamQueryDisplayInformation API
  316. //
  317. typedef enum _DOMAIN_DISPLAY_INFORMATION {
  318. DomainDisplayUser = 1,
  319. DomainDisplayMachine,
  320. DomainDisplayGroup, // Added in NT1.0A
  321. DomainDisplayOemUser, // Added in NT1.0A
  322. DomainDisplayOemGroup, // Added in NT1.0A
  323. DomainDisplayServer // Added in NT5 to support query of servers
  324. } DOMAIN_DISPLAY_INFORMATION, *PDOMAIN_DISPLAY_INFORMATION;
  325. typedef struct _DOMAIN_DISPLAY_USER {
  326. ULONG Index;
  327. ULONG Rid;
  328. ULONG AccountControl;
  329. UNICODE_STRING LogonName;
  330. UNICODE_STRING AdminComment;
  331. UNICODE_STRING FullName;
  332. } DOMAIN_DISPLAY_USER, *PDOMAIN_DISPLAY_USER;
  333. typedef struct _DOMAIN_DISPLAY_MACHINE {
  334. ULONG Index;
  335. ULONG Rid;
  336. ULONG AccountControl;
  337. UNICODE_STRING Machine;
  338. UNICODE_STRING Comment;
  339. } DOMAIN_DISPLAY_MACHINE, *PDOMAIN_DISPLAY_MACHINE;
  340. typedef struct _DOMAIN_DISPLAY_GROUP { // Added in NT1.0A
  341. ULONG Index;
  342. ULONG Rid;
  343. ULONG Attributes;
  344. UNICODE_STRING Group;
  345. UNICODE_STRING Comment;
  346. } DOMAIN_DISPLAY_GROUP, *PDOMAIN_DISPLAY_GROUP;
  347. typedef struct _DOMAIN_DISPLAY_OEM_USER { // Added in NT1.0A
  348. ULONG Index;
  349. OEM_STRING User;
  350. } DOMAIN_DISPLAY_OEM_USER, *PDOMAIN_DISPLAY_OEM_USER;
  351. typedef struct _DOMAIN_DISPLAY_OEM_GROUP { // Added in NT1.0A
  352. ULONG Index;
  353. OEM_STRING Group;
  354. } DOMAIN_DISPLAY_OEM_GROUP, *PDOMAIN_DISPLAY_OEM_GROUP;
  355. ///////////////////////////////////////////////////////////////////////////////
  356. // //
  357. // Group Object Related Definitions //
  358. // //
  359. ///////////////////////////////////////////////////////////////////////////////
  360. //
  361. // Access rights for group object
  362. //
  363. #define GROUP_READ_INFORMATION 0x0001
  364. #define GROUP_WRITE_ACCOUNT 0x0002
  365. #define GROUP_ADD_MEMBER 0x0004
  366. #define GROUP_REMOVE_MEMBER 0x0008
  367. #define GROUP_LIST_MEMBERS 0x0010
  368. #define GROUP_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED |\
  369. GROUP_LIST_MEMBERS |\
  370. GROUP_WRITE_ACCOUNT |\
  371. GROUP_ADD_MEMBER |\
  372. GROUP_REMOVE_MEMBER |\
  373. GROUP_READ_INFORMATION)
  374. #define GROUP_READ (STANDARD_RIGHTS_READ |\
  375. GROUP_LIST_MEMBERS)
  376. #define GROUP_WRITE (STANDARD_RIGHTS_WRITE |\
  377. GROUP_WRITE_ACCOUNT |\
  378. GROUP_ADD_MEMBER |\
  379. GROUP_REMOVE_MEMBER)
  380. #define GROUP_EXECUTE (STANDARD_RIGHTS_EXECUTE |\
  381. GROUP_READ_INFORMATION)
  382. //
  383. // Group object types
  384. //
  385. typedef struct _GROUP_MEMBERSHIP {
  386. ULONG RelativeId;
  387. ULONG Attributes;
  388. } GROUP_MEMBERSHIP, *PGROUP_MEMBERSHIP;
  389. typedef enum _GROUP_INFORMATION_CLASS {
  390. GroupGeneralInformation = 1,
  391. GroupNameInformation,
  392. GroupAttributeInformation,
  393. GroupAdminCommentInformation,
  394. GroupReplicationInformation
  395. } GROUP_INFORMATION_CLASS;
  396. typedef struct _GROUP_GENERAL_INFORMATION {
  397. UNICODE_STRING Name;
  398. ULONG Attributes;
  399. ULONG MemberCount;
  400. UNICODE_STRING AdminComment;
  401. } GROUP_GENERAL_INFORMATION, *PGROUP_GENERAL_INFORMATION;
  402. typedef struct _GROUP_NAME_INFORMATION {
  403. UNICODE_STRING Name;
  404. } GROUP_NAME_INFORMATION, *PGROUP_NAME_INFORMATION;
  405. typedef struct _GROUP_ATTRIBUTE_INFORMATION {
  406. ULONG Attributes;
  407. } GROUP_ATTRIBUTE_INFORMATION, *PGROUP_ATTRIBUTE_INFORMATION;
  408. typedef struct _GROUP_ADM_COMMENT_INFORMATION {
  409. UNICODE_STRING AdminComment;
  410. } GROUP_ADM_COMMENT_INFORMATION, *PGROUP_ADM_COMMENT_INFORMATION;
  411. ///////////////////////////////////////////////////////////////////////////////
  412. // //
  413. // Alias Object Related Definitions //
  414. // //
  415. ///////////////////////////////////////////////////////////////////////////////
  416. //
  417. // Access rights for alias object
  418. //
  419. #define ALIAS_ADD_MEMBER 0x0001
  420. #define ALIAS_REMOVE_MEMBER 0x0002
  421. #define ALIAS_LIST_MEMBERS 0x0004
  422. #define ALIAS_READ_INFORMATION 0x0008
  423. #define ALIAS_WRITE_ACCOUNT 0x0010
  424. #define ALIAS_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED |\
  425. ALIAS_READ_INFORMATION |\
  426. ALIAS_WRITE_ACCOUNT |\
  427. ALIAS_LIST_MEMBERS |\
  428. ALIAS_ADD_MEMBER |\
  429. ALIAS_REMOVE_MEMBER)
  430. #define ALIAS_READ (STANDARD_RIGHTS_READ |\
  431. ALIAS_LIST_MEMBERS)
  432. #define ALIAS_WRITE (STANDARD_RIGHTS_WRITE |\
  433. ALIAS_WRITE_ACCOUNT |\
  434. ALIAS_ADD_MEMBER |\
  435. ALIAS_REMOVE_MEMBER)
  436. #define ALIAS_EXECUTE (STANDARD_RIGHTS_EXECUTE |\
  437. ALIAS_READ_INFORMATION)
  438. //
  439. // Alias object types
  440. //
  441. typedef enum _ALIAS_INFORMATION_CLASS {
  442. AliasGeneralInformation = 1,
  443. AliasNameInformation,
  444. AliasAdminCommentInformation,
  445. AliasReplicationInformation
  446. } ALIAS_INFORMATION_CLASS;
  447. typedef struct _ALIAS_GENERAL_INFORMATION {
  448. UNICODE_STRING Name;
  449. ULONG MemberCount;
  450. UNICODE_STRING AdminComment;
  451. } ALIAS_GENERAL_INFORMATION, *PALIAS_GENERAL_INFORMATION;
  452. typedef struct _ALIAS_NAME_INFORMATION {
  453. UNICODE_STRING Name;
  454. } ALIAS_NAME_INFORMATION, *PALIAS_NAME_INFORMATION;
  455. typedef struct _ALIAS_ADM_COMMENT_INFORMATION {
  456. UNICODE_STRING AdminComment;
  457. } ALIAS_ADM_COMMENT_INFORMATION, *PALIAS_ADM_COMMENT_INFORMATION;
  458. //////////////////////////////////////////////////////////////////////////////
  459. // //
  460. // NT5+ Limited Groups Related Definitions //
  461. // //
  462. //////////////////////////////////////////////////////////////////////////////
  463. //
  464. // Group Flag Definitions to determine Type of Group
  465. //
  466. #define GROUP_TYPE_BUILTIN_LOCAL_GROUP 0x00000001
  467. #define GROUP_TYPE_ACCOUNT_GROUP 0x00000002
  468. #define GROUP_TYPE_RESOURCE_GROUP 0x00000004
  469. #define GROUP_TYPE_UNIVERSAL_GROUP 0x00000008
  470. #define GROUP_TYPE_SECURITY_ENABLED 0x80000000
  471. ///////////////////////////////////////////////////////////////////////////////
  472. // //
  473. // User Object Related Definitions //
  474. // //
  475. ///////////////////////////////////////////////////////////////////////////////
  476. //
  477. // Access rights for user object
  478. //
  479. #define USER_READ_GENERAL 0x0001
  480. #define USER_READ_PREFERENCES 0x0002
  481. #define USER_WRITE_PREFERENCES 0x0004
  482. #define USER_READ_LOGON 0x0008
  483. #define USER_READ_ACCOUNT 0x0010
  484. #define USER_WRITE_ACCOUNT 0x0020
  485. #define USER_CHANGE_PASSWORD 0x0040
  486. #define USER_FORCE_PASSWORD_CHANGE 0x0080
  487. #define USER_LIST_GROUPS 0x0100
  488. #define USER_READ_GROUP_INFORMATION 0x0200
  489. #define USER_WRITE_GROUP_INFORMATION 0x0400
  490. #define USER_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED |\
  491. USER_READ_PREFERENCES |\
  492. USER_READ_LOGON |\
  493. USER_LIST_GROUPS |\
  494. USER_READ_GROUP_INFORMATION |\
  495. USER_WRITE_PREFERENCES |\
  496. USER_CHANGE_PASSWORD |\
  497. USER_FORCE_PASSWORD_CHANGE |\
  498. USER_READ_GENERAL |\
  499. USER_READ_ACCOUNT |\
  500. USER_WRITE_ACCOUNT |\
  501. USER_WRITE_GROUP_INFORMATION)
  502. #define USER_READ (STANDARD_RIGHTS_READ |\
  503. USER_READ_PREFERENCES |\
  504. USER_READ_LOGON |\
  505. USER_READ_ACCOUNT |\
  506. USER_LIST_GROUPS |\
  507. USER_READ_GROUP_INFORMATION)
  508. #define USER_WRITE (STANDARD_RIGHTS_WRITE |\
  509. USER_WRITE_PREFERENCES |\
  510. USER_CHANGE_PASSWORD)
  511. #define USER_EXECUTE (STANDARD_RIGHTS_EXECUTE |\
  512. USER_READ_GENERAL |\
  513. USER_CHANGE_PASSWORD)
  514. //
  515. // User object types
  516. //
  517. // begin_ntsubauth
  518. #ifndef _NTSAM_USER_ACCOUNT_FLAGS_
  519. //
  520. // User account control flags...
  521. //
  522. #define USER_ACCOUNT_DISABLED (0x00000001)
  523. #define USER_HOME_DIRECTORY_REQUIRED (0x00000002)
  524. #define USER_PASSWORD_NOT_REQUIRED (0x00000004)
  525. #define USER_TEMP_DUPLICATE_ACCOUNT (0x00000008)
  526. #define USER_NORMAL_ACCOUNT (0x00000010)
  527. #define USER_MNS_LOGON_ACCOUNT (0x00000020)
  528. #define USER_INTERDOMAIN_TRUST_ACCOUNT (0x00000040)
  529. #define USER_WORKSTATION_TRUST_ACCOUNT (0x00000080)
  530. #define USER_SERVER_TRUST_ACCOUNT (0x00000100)
  531. #define USER_DONT_EXPIRE_PASSWORD (0x00000200)
  532. #define USER_ACCOUNT_AUTO_LOCKED (0x00000400)
  533. #define USER_ENCRYPTED_TEXT_PASSWORD_ALLOWED (0x00000800)
  534. #define USER_SMARTCARD_REQUIRED (0x00001000)
  535. #define USER_TRUSTED_FOR_DELEGATION (0x00002000)
  536. #define USER_NOT_DELEGATED (0x00004000)
  537. #define USER_USE_DES_KEY_ONLY (0x00008000)
  538. #define USER_DONT_REQUIRE_PREAUTH (0x00010000)
  539. #define USER_PASSWORD_EXPIRED (0x00020000)
  540. #define USER_TRUSTED_TO_AUTHENTICATE_FOR_DELEGATION (0x00040000)
  541. #define NEXT_FREE_ACCOUNT_CONTROL_BIT (USER_TRUSTED_TO_AUTHENTICATE_FOR_DELEGATION << 1)
  542. #define USER_MACHINE_ACCOUNT_MASK \
  543. ( USER_INTERDOMAIN_TRUST_ACCOUNT |\
  544. USER_WORKSTATION_TRUST_ACCOUNT |\
  545. USER_SERVER_TRUST_ACCOUNT)
  546. #define USER_ACCOUNT_TYPE_MASK \
  547. ( USER_TEMP_DUPLICATE_ACCOUNT |\
  548. USER_NORMAL_ACCOUNT |\
  549. USER_MACHINE_ACCOUNT_MASK )
  550. //
  551. // Logon times may be expressed in day, hour, or minute granularity.
  552. //
  553. // Days per week = 7
  554. // Hours per week = 168
  555. // Minutes per week = 10080
  556. //
  557. #define SAM_DAYS_PER_WEEK (7)
  558. #define SAM_HOURS_PER_WEEK (24 * SAM_DAYS_PER_WEEK)
  559. #define SAM_MINUTES_PER_WEEK (60 * SAM_HOURS_PER_WEEK)
  560. typedef struct _LOGON_HOURS {
  561. USHORT UnitsPerWeek;
  562. //
  563. // UnitsPerWeek is the number of equal length time units the week is
  564. // divided into. This value is used to compute the length of the bit
  565. // string in logon_hours. Must be less than or equal to
  566. // SAM_UNITS_PER_WEEK (10080) for this release.
  567. //
  568. // LogonHours is a bit map of valid logon times. Each bit represents
  569. // a unique division in a week. The largest bit map supported is 1260
  570. // bytes (10080 bits), which represents minutes per week. In this case
  571. // the first bit (bit 0, byte 0) is Sunday, 00:00:00 - 00-00:59; bit 1,
  572. // byte 0 is Sunday, 00:01:00 - 00:01:59, etc. A NULL pointer means
  573. // DONT_CHANGE for SamSetInformationUser() calls.
  574. //
  575. PUCHAR LogonHours;
  576. } LOGON_HOURS, *PLOGON_HOURS;
  577. typedef struct _SR_SECURITY_DESCRIPTOR {
  578. ULONG Length;
  579. PUCHAR SecurityDescriptor;
  580. } SR_SECURITY_DESCRIPTOR, *PSR_SECURITY_DESCRIPTOR;
  581. #define _NTSAM_USER_ACCOUNT_FLAG_
  582. #endif
  583. // end_ntsubauth
  584. typedef enum _USER_INFORMATION_CLASS {
  585. UserGeneralInformation = 1,
  586. UserPreferencesInformation,
  587. UserLogonInformation,
  588. UserLogonHoursInformation,
  589. UserAccountInformation,
  590. UserNameInformation,
  591. UserAccountNameInformation,
  592. UserFullNameInformation,
  593. UserPrimaryGroupInformation,
  594. UserHomeInformation,
  595. UserScriptInformation,
  596. UserProfileInformation,
  597. UserAdminCommentInformation,
  598. UserWorkStationsInformation,
  599. UserSetPasswordInformation,
  600. UserControlInformation,
  601. UserExpiresInformation,
  602. UserInternal1Information,
  603. UserInternal2Information,
  604. UserParametersInformation,
  605. UserAllInformation,
  606. UserInternal3Information,
  607. UserInternal4Information,
  608. UserInternal5Information,
  609. UserInternal4InformationNew,
  610. UserInternal5InformationNew,
  611. UserInternal6Information
  612. } USER_INFORMATION_CLASS, *PUSER_INFORMATION_CLASS;
  613. // begin_ntsubauth
  614. #ifndef _NTSAM_USER_ALL_INFO_
  615. #include "pshpack4.h"
  616. typedef struct _USER_ALL_INFORMATION {
  617. LARGE_INTEGER LastLogon;
  618. LARGE_INTEGER LastLogoff;
  619. LARGE_INTEGER PasswordLastSet;
  620. LARGE_INTEGER AccountExpires;
  621. LARGE_INTEGER PasswordCanChange;
  622. LARGE_INTEGER PasswordMustChange;
  623. UNICODE_STRING UserName;
  624. UNICODE_STRING FullName;
  625. UNICODE_STRING HomeDirectory;
  626. UNICODE_STRING HomeDirectoryDrive;
  627. UNICODE_STRING ScriptPath;
  628. UNICODE_STRING ProfilePath;
  629. UNICODE_STRING AdminComment;
  630. UNICODE_STRING WorkStations;
  631. UNICODE_STRING UserComment;
  632. UNICODE_STRING Parameters;
  633. UNICODE_STRING LmPassword;
  634. UNICODE_STRING NtPassword;
  635. UNICODE_STRING PrivateData;
  636. SR_SECURITY_DESCRIPTOR SecurityDescriptor;
  637. ULONG UserId;
  638. ULONG PrimaryGroupId;
  639. ULONG UserAccountControl;
  640. ULONG WhichFields;
  641. LOGON_HOURS LogonHours;
  642. USHORT BadPasswordCount;
  643. USHORT LogonCount;
  644. USHORT CountryCode;
  645. USHORT CodePage;
  646. BOOLEAN LmPasswordPresent;
  647. BOOLEAN NtPasswordPresent;
  648. BOOLEAN PasswordExpired;
  649. BOOLEAN PrivateDataSensitive;
  650. } USER_ALL_INFORMATION, *PUSER_ALL_INFORMATION;
  651. #include "poppack.h"
  652. #define _NTSAM_USER_ALL_INFO_
  653. #endif
  654. // end_ntsubauth
  655. //
  656. // Bits to be used in UserAllInformation's WhichFields field (to indicate
  657. // which items were queried or set).
  658. //
  659. #define USER_ALL_USERNAME 0x00000001
  660. #define USER_ALL_FULLNAME 0x00000002
  661. #define USER_ALL_USERID 0x00000004
  662. #define USER_ALL_PRIMARYGROUPID 0x00000008
  663. #define USER_ALL_ADMINCOMMENT 0x00000010
  664. #define USER_ALL_USERCOMMENT 0x00000020
  665. #define USER_ALL_HOMEDIRECTORY 0x00000040
  666. #define USER_ALL_HOMEDIRECTORYDRIVE 0x00000080
  667. #define USER_ALL_SCRIPTPATH 0x00000100
  668. #define USER_ALL_PROFILEPATH 0x00000200
  669. #define USER_ALL_WORKSTATIONS 0x00000400
  670. #define USER_ALL_LASTLOGON 0x00000800
  671. #define USER_ALL_LASTLOGOFF 0x00001000
  672. #define USER_ALL_LOGONHOURS 0x00002000
  673. #define USER_ALL_BADPASSWORDCOUNT 0x00004000
  674. #define USER_ALL_LOGONCOUNT 0x00008000
  675. #define USER_ALL_PASSWORDCANCHANGE 0x00010000
  676. #define USER_ALL_PASSWORDMUSTCHANGE 0x00020000
  677. #define USER_ALL_PASSWORDLASTSET 0x00040000
  678. #define USER_ALL_ACCOUNTEXPIRES 0x00080000
  679. #define USER_ALL_USERACCOUNTCONTROL 0x00100000
  680. #ifndef _NTSAM_SAM_USER_PARMS_ // ntsubauth
  681. #define USER_ALL_PARAMETERS 0x00200000 // ntsubauth
  682. #define _NTSAM_SAM_USER_PARMS_ // ntsubauth
  683. #endif // ntsubauth
  684. #define USER_ALL_COUNTRYCODE 0x00400000
  685. #define USER_ALL_CODEPAGE 0x00800000
  686. #define USER_ALL_NTPASSWORDPRESENT 0x01000000 // field AND boolean
  687. #define USER_ALL_LMPASSWORDPRESENT 0x02000000 // field AND boolean
  688. #define USER_ALL_PRIVATEDATA 0x04000000 // field AND boolean
  689. #define USER_ALL_PASSWORDEXPIRED 0x08000000
  690. #define USER_ALL_SECURITYDESCRIPTOR 0x10000000
  691. #define USER_ALL_OWFPASSWORD 0x20000000 // boolean
  692. #define USER_ALL_UNDEFINED_MASK 0xC0000000
  693. //
  694. // Now define masks for fields that are accessed for read by the same
  695. // access type.
  696. //
  697. // Fields that require READ_GENERAL access to read.
  698. //
  699. #define USER_ALL_READ_GENERAL_MASK (USER_ALL_USERNAME | \
  700. USER_ALL_FULLNAME | \
  701. USER_ALL_USERID | \
  702. USER_ALL_PRIMARYGROUPID | \
  703. USER_ALL_ADMINCOMMENT | \
  704. USER_ALL_USERCOMMENT)
  705. //
  706. // Fields that require READ_LOGON access to read.
  707. //
  708. #define USER_ALL_READ_LOGON_MASK (USER_ALL_HOMEDIRECTORY | \
  709. USER_ALL_HOMEDIRECTORYDRIVE | \
  710. USER_ALL_SCRIPTPATH | \
  711. USER_ALL_PROFILEPATH | \
  712. USER_ALL_WORKSTATIONS | \
  713. USER_ALL_LASTLOGON | \
  714. USER_ALL_LASTLOGOFF | \
  715. USER_ALL_LOGONHOURS | \
  716. USER_ALL_BADPASSWORDCOUNT | \
  717. USER_ALL_LOGONCOUNT | \
  718. USER_ALL_PASSWORDCANCHANGE | \
  719. USER_ALL_PASSWORDMUSTCHANGE)
  720. //
  721. // Fields that require READ_ACCOUNT access to read.
  722. //
  723. #define USER_ALL_READ_ACCOUNT_MASK (USER_ALL_PASSWORDLASTSET | \
  724. USER_ALL_ACCOUNTEXPIRES | \
  725. USER_ALL_USERACCOUNTCONTROL | \
  726. USER_ALL_PARAMETERS)
  727. //
  728. // Fields that require READ_PREFERENCES access to read.
  729. //
  730. #define USER_ALL_READ_PREFERENCES_MASK (USER_ALL_COUNTRYCODE | \
  731. USER_ALL_CODEPAGE)
  732. //
  733. // Fields that can only be read by trusted clients.
  734. //
  735. #define USER_ALL_READ_TRUSTED_MASK (USER_ALL_NTPASSWORDPRESENT | \
  736. USER_ALL_LMPASSWORDPRESENT | \
  737. USER_ALL_PASSWORDEXPIRED | \
  738. USER_ALL_SECURITYDESCRIPTOR | \
  739. USER_ALL_PRIVATEDATA)
  740. //
  741. // Fields that can't be read.
  742. //
  743. #define USER_ALL_READ_CANT_MASK USER_ALL_UNDEFINED_MASK
  744. //
  745. // Now define masks for fields that are accessed for write by the same
  746. // access type.
  747. //
  748. // Fields that require WRITE_ACCOUNT access to write.
  749. //
  750. #define USER_ALL_WRITE_ACCOUNT_MASK (USER_ALL_USERNAME | \
  751. USER_ALL_FULLNAME | \
  752. USER_ALL_PRIMARYGROUPID | \
  753. USER_ALL_HOMEDIRECTORY | \
  754. USER_ALL_HOMEDIRECTORYDRIVE | \
  755. USER_ALL_SCRIPTPATH | \
  756. USER_ALL_PROFILEPATH | \
  757. USER_ALL_ADMINCOMMENT | \
  758. USER_ALL_WORKSTATIONS | \
  759. USER_ALL_LOGONHOURS | \
  760. USER_ALL_ACCOUNTEXPIRES | \
  761. USER_ALL_USERACCOUNTCONTROL | \
  762. USER_ALL_PARAMETERS)
  763. //
  764. // Fields that require WRITE_PREFERENCES access to write.
  765. //
  766. #define USER_ALL_WRITE_PREFERENCES_MASK (USER_ALL_USERCOMMENT | \
  767. USER_ALL_COUNTRYCODE | \
  768. USER_ALL_CODEPAGE)
  769. //
  770. // Fields that require FORCE_PASSWORD_CHANGE access to write.
  771. //
  772. // Note that non-trusted clients only set the NT password as a
  773. // UNICODE string. The wrapper will convert it to an LM password,
  774. // OWF and encrypt both versions. Trusted clients can pass in OWF
  775. // versions of either or both.
  776. //
  777. #define USER_ALL_WRITE_FORCE_PASSWORD_CHANGE_MASK \
  778. (USER_ALL_NTPASSWORDPRESENT | \
  779. USER_ALL_LMPASSWORDPRESENT | \
  780. USER_ALL_PASSWORDEXPIRED)
  781. //
  782. // Fields that can only be written by trusted clients.
  783. //
  784. #define USER_ALL_WRITE_TRUSTED_MASK (USER_ALL_LASTLOGON | \
  785. USER_ALL_LASTLOGOFF | \
  786. USER_ALL_BADPASSWORDCOUNT | \
  787. USER_ALL_LOGONCOUNT | \
  788. USER_ALL_PASSWORDLASTSET | \
  789. USER_ALL_SECURITYDESCRIPTOR | \
  790. USER_ALL_PRIVATEDATA)
  791. //
  792. // Fields that can't be written.
  793. //
  794. #define USER_ALL_WRITE_CANT_MASK (USER_ALL_USERID | \
  795. USER_ALL_PASSWORDCANCHANGE | \
  796. USER_ALL_PASSWORDMUSTCHANGE | \
  797. USER_ALL_UNDEFINED_MASK)
  798. typedef struct _USER_GENERAL_INFORMATION {
  799. UNICODE_STRING UserName;
  800. UNICODE_STRING FullName;
  801. ULONG PrimaryGroupId;
  802. UNICODE_STRING AdminComment;
  803. UNICODE_STRING UserComment;
  804. } USER_GENERAL_INFORMATION, *PUSER_GENERAL_INFORMATION;
  805. typedef struct _USER_PREFERENCES_INFORMATION {
  806. UNICODE_STRING UserComment;
  807. UNICODE_STRING Reserved1;
  808. USHORT CountryCode;
  809. USHORT CodePage;
  810. } USER_PREFERENCES_INFORMATION, *PUSER_PREFERENCES_INFORMATION;
  811. typedef struct _USER_PARAMETERS_INFORMATION {
  812. UNICODE_STRING Parameters;
  813. } USER_PARAMETERS_INFORMATION, *PUSER_PARAMETERS_INFORMATION;
  814. #include "pshpack4.h"
  815. typedef struct _USER_LOGON_INFORMATION {
  816. UNICODE_STRING UserName;
  817. UNICODE_STRING FullName;
  818. ULONG UserId;
  819. ULONG PrimaryGroupId;
  820. UNICODE_STRING HomeDirectory;
  821. UNICODE_STRING HomeDirectoryDrive;
  822. UNICODE_STRING ScriptPath;
  823. UNICODE_STRING ProfilePath;
  824. UNICODE_STRING WorkStations;
  825. LARGE_INTEGER LastLogon;
  826. LARGE_INTEGER LastLogoff;
  827. LARGE_INTEGER PasswordLastSet;
  828. LARGE_INTEGER PasswordCanChange;
  829. LARGE_INTEGER PasswordMustChange;
  830. LOGON_HOURS LogonHours;
  831. USHORT BadPasswordCount;
  832. USHORT LogonCount;
  833. ULONG UserAccountControl;
  834. } USER_LOGON_INFORMATION, *PUSER_LOGON_INFORMATION;
  835. #include "poppack.h"
  836. #include "pshpack4.h"
  837. typedef struct _USER_ACCOUNT_INFORMATION {
  838. UNICODE_STRING UserName;
  839. UNICODE_STRING FullName;
  840. ULONG UserId;
  841. ULONG PrimaryGroupId;
  842. UNICODE_STRING HomeDirectory;
  843. UNICODE_STRING HomeDirectoryDrive;
  844. UNICODE_STRING ScriptPath;
  845. UNICODE_STRING ProfilePath;
  846. UNICODE_STRING AdminComment;
  847. UNICODE_STRING WorkStations;
  848. LARGE_INTEGER LastLogon;
  849. LARGE_INTEGER LastLogoff;
  850. LOGON_HOURS LogonHours;
  851. USHORT BadPasswordCount;
  852. USHORT LogonCount;
  853. LARGE_INTEGER PasswordLastSet;
  854. LARGE_INTEGER AccountExpires;
  855. ULONG UserAccountControl;
  856. } USER_ACCOUNT_INFORMATION, *PUSER_ACCOUNT_INFORMATION;
  857. #include "poppack.h"
  858. typedef struct _USER_ACCOUNT_NAME_INFORMATION {
  859. UNICODE_STRING UserName;
  860. } USER_ACCOUNT_NAME_INFORMATION, *PUSER_ACCOUNT_NAME_INFORMATION;
  861. typedef struct _USER_FULL_NAME_INFORMATION {
  862. UNICODE_STRING FullName;
  863. } USER_FULL_NAME_INFORMATION, *PUSER_FULL_NAME_INFORMATION;
  864. typedef struct _USER_NAME_INFORMATION {
  865. UNICODE_STRING UserName;
  866. UNICODE_STRING FullName;
  867. } USER_NAME_INFORMATION, *PUSER_NAME_INFORMATION;
  868. typedef struct _USER_PRIMARY_GROUP_INFORMATION {
  869. ULONG PrimaryGroupId;
  870. } USER_PRIMARY_GROUP_INFORMATION, *PUSER_PRIMARY_GROUP_INFORMATION;
  871. typedef struct _USER_HOME_INFORMATION {
  872. UNICODE_STRING HomeDirectory;
  873. UNICODE_STRING HomeDirectoryDrive;
  874. } USER_HOME_INFORMATION, *PUSER_HOME_INFORMATION;
  875. typedef struct _USER_SCRIPT_INFORMATION {
  876. UNICODE_STRING ScriptPath;
  877. } USER_SCRIPT_INFORMATION, *PUSER_SCRIPT_INFORMATION;
  878. typedef struct _USER_PROFILE_INFORMATION {
  879. UNICODE_STRING ProfilePath;
  880. } USER_PROFILE_INFORMATION, *PUSER_PROFILE_INFORMATION;
  881. typedef struct _USER_ADMIN_COMMENT_INFORMATION {
  882. UNICODE_STRING AdminComment;
  883. } USER_ADMIN_COMMENT_INFORMATION, *PUSER_ADMIN_COMMENT_INFORMATION;
  884. typedef struct _USER_WORKSTATIONS_INFORMATION {
  885. UNICODE_STRING WorkStations;
  886. } USER_WORKSTATIONS_INFORMATION, *PUSER_WORKSTATIONS_INFORMATION;
  887. typedef struct _USER_SET_PASSWORD_INFORMATION {
  888. UNICODE_STRING Password;
  889. BOOLEAN PasswordExpired;
  890. } USER_SET_PASSWORD_INFORMATION, *PUSER_SET_PASSWORD_INFORMATION;
  891. typedef struct _USER_CONTROL_INFORMATION {
  892. ULONG UserAccountControl;
  893. } USER_CONTROL_INFORMATION, *PUSER_CONTROL_INFORMATION;
  894. typedef struct _USER_EXPIRES_INFORMATION {
  895. #if defined(MIDL_PASS)
  896. OLD_LARGE_INTEGER AccountExpires;
  897. #else
  898. LARGE_INTEGER AccountExpires;
  899. #endif
  900. } USER_EXPIRES_INFORMATION, *PUSER_EXPIRES_INFORMATION;
  901. typedef struct _USER_LOGON_HOURS_INFORMATION {
  902. LOGON_HOURS LogonHours;
  903. } USER_LOGON_HOURS_INFORMATION, *PUSER_LOGON_HOURS_INFORMATION;
  904. ///////////////////////////////////////////////////////////////////////////
  905. // //
  906. // Data type used by SamChangePasswordUser3 for better error //
  907. // reporting of password change change failures //
  908. // //
  909. // The field definitions are as follows: //
  910. // //
  911. // ExtendedFailureReason -- Indicates the reason //
  912. // why the new password was not //
  913. // accepted //
  914. // //
  915. // FilterModuleName -- If the password change was failed //
  916. // by a password filter , the name of //
  917. // of the filter DLL is returned in //
  918. // here //
  919. // //
  920. // The following error codes are defined //
  921. // //
  922. // SAM_PWD_CHANGE_NO_ERROR //
  923. // No error, cannot be returned alongwith a failure code for //
  924. // password change //
  925. // //
  926. // SAM_PWD_CHANGE_PASSWORD_TOO_SHORT //
  927. // //
  928. // Supplied password did not meet password length policy //
  929. // //
  930. // SAM_PWD_CHANGE_PWD_IN_HISTORY //
  931. // //
  932. // History restrictions were not met //
  933. // //
  934. // SAM_PWD_CHANGE_USERNAME_IN_PASSWORD //
  935. // Complexity check could not be met because the user //
  936. // name was part of the password //
  937. // //
  938. // SAM_PWD_CHANGE_FULLNAME_IN_PASSWORD //
  939. // //
  940. // Complexity check could not be met because the user's //
  941. // full name was part of the password //
  942. // //
  943. // SAM_PWD_CHANGE_MACHINE_PASSWORD_NOT_DEFAULT //
  944. // //
  945. // The domain has the refuse password change setting //
  946. // enabled. This disallows machine accounts from having //
  947. // anything other than the default password //
  948. // //
  949. // SAM_PWD_CHANGE_FAILED_BY_FILTER //
  950. // //
  951. // The supplied new password failed by a password filter //
  952. // the name of the filter DLL is indicated //
  953. // //
  954. // //
  955. ///////////////////////////////////////////////////////////////////////////
  956. typedef struct _USER_PWD_CHANGE_FAILURE_INFORMATION {
  957. ULONG ExtendedFailureReason;
  958. UNICODE_STRING FilterModuleName;
  959. } USER_PWD_CHANGE_FAILURE_INFORMATION,*PUSER_PWD_CHANGE_FAILURE_INFORMATION;
  960. //
  961. // Currently defined values for ExtendedFailureReason are as follows
  962. //
  963. #define SAM_PWD_CHANGE_NO_ERROR 0
  964. #define SAM_PWD_CHANGE_PASSWORD_TOO_SHORT 1
  965. #define SAM_PWD_CHANGE_PWD_IN_HISTORY 2
  966. #define SAM_PWD_CHANGE_USERNAME_IN_PASSWORD 3
  967. #define SAM_PWD_CHANGE_FULLNAME_IN_PASSWORD 4
  968. #define SAM_PWD_CHANGE_NOT_COMPLEX 5
  969. #define SAM_PWD_CHANGE_MACHINE_PASSWORD_NOT_DEFAULT 6
  970. #define SAM_PWD_CHANGE_FAILED_BY_FILTER 7
  971. #define SAM_PWD_CHANGE_PASSWORD_TOO_LONG 8
  972. #define SAM_PWD_CHANGE_FAILURE_REASON_MAX 8
  973. /////////////////////////////////////////////////////////////////////////////
  974. // //
  975. // Data types used by SAM and Netlogon for database replication //
  976. // //
  977. /////////////////////////////////////////////////////////////////////////////
  978. typedef enum _SECURITY_DB_DELTA_TYPE {
  979. SecurityDbNew = 1,
  980. SecurityDbRename,
  981. SecurityDbDelete,
  982. SecurityDbChangeMemberAdd,
  983. SecurityDbChangeMemberSet,
  984. SecurityDbChangeMemberDel,
  985. SecurityDbChange,
  986. SecurityDbChangePassword
  987. } SECURITY_DB_DELTA_TYPE, *PSECURITY_DB_DELTA_TYPE;
  988. typedef enum _SECURITY_DB_OBJECT_TYPE {
  989. SecurityDbObjectSamDomain = 1,
  990. SecurityDbObjectSamUser,
  991. SecurityDbObjectSamGroup,
  992. SecurityDbObjectSamAlias,
  993. SecurityDbObjectLsaPolicy,
  994. SecurityDbObjectLsaTDomain,
  995. SecurityDbObjectLsaAccount,
  996. SecurityDbObjectLsaSecret
  997. } SECURITY_DB_OBJECT_TYPE, *PSECURITY_DB_OBJECT_TYPE;
  998. //
  999. // Account types
  1000. //
  1001. // Both enumerated types and flag definitions are provided.
  1002. // The flag definitions are used in places where more than
  1003. // one type of account may be specified together.
  1004. //
  1005. typedef enum _SAM_ACCOUNT_TYPE {
  1006. SamObjectUser = 1,
  1007. SamObjectGroup ,
  1008. SamObjectAlias
  1009. } SAM_ACCOUNT_TYPE, *PSAM_ACCOUNT_TYPE;
  1010. #define SAM_USER_ACCOUNT (0x00000001)
  1011. #define SAM_GLOBAL_GROUP_ACCOUNT (0x00000002)
  1012. #define SAM_LOCAL_GROUP_ACCOUNT (0x00000004)
  1013. //
  1014. // Define the data type used to pass netlogon information on the account
  1015. // that was added or deleted from a group.
  1016. //
  1017. typedef struct _SAM_GROUP_MEMBER_ID {
  1018. ULONG MemberRid;
  1019. } SAM_GROUP_MEMBER_ID, *PSAM_GROUP_MEMBER_ID;
  1020. //
  1021. // Define the data type used to pass netlogon information on the account
  1022. // that was added or deleted from an alias.
  1023. //
  1024. typedef struct _SAM_ALIAS_MEMBER_ID {
  1025. PSID MemberSid;
  1026. } SAM_ALIAS_MEMBER_ID, *PSAM_ALIAS_MEMBER_ID;
  1027. //
  1028. // Define the data type used to pass netlogon information on a delta
  1029. //
  1030. typedef union _SAM_DELTA_DATA {
  1031. //
  1032. // Delta type ChangeMember{Add/Del/Set} and account type group
  1033. //
  1034. SAM_GROUP_MEMBER_ID GroupMemberId;
  1035. //
  1036. // Delta type ChangeMember{Add/Del/Set} and account type alias
  1037. //
  1038. SAM_ALIAS_MEMBER_ID AliasMemberId;
  1039. //
  1040. // Delta type AddOrChange and account type User
  1041. //
  1042. ULONG AccountControl;
  1043. } SAM_DELTA_DATA, *PSAM_DELTA_DATA;
  1044. //
  1045. // Prototype for delta notification routine.
  1046. //
  1047. typedef NTSTATUS (*PSAM_DELTA_NOTIFICATION_ROUTINE) (
  1048. IN PSID DomainSid,
  1049. IN SECURITY_DB_DELTA_TYPE DeltaType,
  1050. IN SECURITY_DB_OBJECT_TYPE ObjectType,
  1051. IN ULONG ObjectRid,
  1052. IN OPTIONAL PUNICODE_STRING ObjectName,
  1053. IN PLARGE_INTEGER ModifiedCount,
  1054. IN PSAM_DELTA_DATA DeltaData OPTIONAL
  1055. );
  1056. #define SAM_DELTA_NOTIFY_ROUTINE "DeltaNotify"
  1057. //////////////////////////////////////////////////////////////////
  1058. // //
  1059. // Structure and ProtoType for RAS User Parameters //
  1060. // //
  1061. //////////////////////////////////////////////////////////////////
  1062. // Flags used by SAM UserParms Migration
  1063. // indicate UserParmsConvert is called during upgrade.
  1064. #define SAM_USERPARMS_DURING_UPGRADE 0x00000001
  1065. typedef struct _SAM_USERPARMS_ATTRVALS {
  1066. ULONG length; // length of the attribute.
  1067. PVOID value; // pointer to the value.
  1068. } SAM_USERPARMS_ATTRVALS, *PSAM_USERPARMS_ATTRVALS; // describes one value of the attribute.
  1069. typedef enum _SAM_USERPARMS_ATTRSYNTAX {
  1070. Syntax_Attribute = 1,
  1071. Syntax_EncryptedAttribute
  1072. } SAM_USERPARMS_ATTRSYNTAX; // indicates whether attributes are encrypted or not.
  1073. typedef struct _SAM_USERPARMS_ATTR {
  1074. UNICODE_STRING AttributeIdentifier; // This will be the LDAP display name of the attribute.
  1075. // SAM will perform the translation to attribute ID.
  1076. // unless the specified syntax is type EncryptedAttribute,
  1077. // in which case it is packaged as part of supplemental
  1078. // credentials blob and the name identifes the package name.
  1079. // Encrypted attribute will be supplied in the clear ie decrypted.
  1080. SAM_USERPARMS_ATTRSYNTAX Syntax;
  1081. ULONG CountOfValues; // The count of values in the attribute.
  1082. SAM_USERPARMS_ATTRVALS * Values; // pointer to an array of values representing the data
  1083. // values of the attribute.
  1084. } SAM_USERPARMS_ATTR, *PSAM_USERPARMS_ATTR; // describes an attribute and the set of values associated with it.
  1085. typedef struct _SAM_USERPARMS_ATTRBLOCK {
  1086. ULONG attCount;
  1087. SAM_USERPARMS_ATTR * UserParmsAttr;
  1088. } SAM_USERPARMS_ATTRBLOCK, *PSAM_USERPARMS_ATTRBLOCK; // describes an array of attributes
  1089. typedef NTSTATUS (*PSAM_USERPARMS_CONVERT_NOTIFICATION_ROUTINE) (
  1090. IN ULONG Flags,
  1091. IN PSID DomainSid,
  1092. IN ULONG ObjectRid, // identifies the object
  1093. IN ULONG UserParmsLengthOrig,
  1094. IN PVOID UserParmsOrig,
  1095. IN ULONG UserParmsLengthNew,
  1096. IN PVOID UserParmsNew,
  1097. OUT PSAM_USERPARMS_ATTRBLOCK * UserParmsAttrBlock
  1098. );
  1099. #define SAM_USERPARMS_CONVERT_NOTIFICATION_ROUTINE "UserParmsConvert"
  1100. typedef VOID (*PSAM_USERPARMS_ATTRBLOCK_FREE_ROUTINE) (
  1101. IN PSAM_USERPARMS_ATTRBLOCK UserParmsAttrBlock
  1102. );
  1103. #define SAM_USERPARMS_ATTRBLOCK_FREE_ROUTINE "UserParmsFree"
  1104. //////////////////////////////////////////////////////////////////
  1105. // //
  1106. // Return Values for Compatiblity Mode //
  1107. // //
  1108. //////////////////////////////////////////////////////////////////
  1109. // All SAM attributes are accessible
  1110. #define SAM_SID_COMPATIBILITY_ALL 0
  1111. // Rid field can be returned to caller as 0
  1112. // No writes to PrimaryGroupId allowed
  1113. #define SAM_SID_COMPATIBILITY_LAX 1
  1114. // NET API Information levels that ask for RID are to failed
  1115. // No writes to PrimaryGroupId allowed
  1116. #define SAM_SID_COMPATIBILITY_STRICT 2
  1117. ///////////////////////////////////////////////////////////////////////////////
  1118. // //
  1119. // APIs Exported By SAM //
  1120. // //
  1121. ///////////////////////////////////////////////////////////////////////////////
  1122. NTSTATUS
  1123. SamFreeMemory(
  1124. IN PVOID Buffer
  1125. );
  1126. NTSTATUS
  1127. SamSetSecurityObject(
  1128. IN SAM_HANDLE ObjectHandle,
  1129. IN SECURITY_INFORMATION SecurityInformation,
  1130. IN PSECURITY_DESCRIPTOR SecurityDescriptor
  1131. );
  1132. NTSTATUS
  1133. SamQuerySecurityObject(
  1134. IN SAM_HANDLE ObjectHandle,
  1135. IN SECURITY_INFORMATION SecurityInformation,
  1136. OUT PSECURITY_DESCRIPTOR *SecurityDescriptor
  1137. );
  1138. NTSTATUS
  1139. SamCloseHandle(
  1140. IN SAM_HANDLE SamHandle
  1141. );
  1142. NTSTATUS
  1143. SamConnect(
  1144. IN PUNICODE_STRING ServerName,
  1145. OUT PSAM_HANDLE ServerHandle,
  1146. IN ACCESS_MASK DesiredAccess,
  1147. IN POBJECT_ATTRIBUTES ObjectAttributes
  1148. );
  1149. NTSTATUS
  1150. SamShutdownSamServer(
  1151. IN SAM_HANDLE ServerHandle
  1152. );
  1153. NTSTATUS
  1154. SamLookupDomainInSamServer(
  1155. IN SAM_HANDLE ServerHandle,
  1156. IN PUNICODE_STRING Name,
  1157. OUT PSID * DomainId
  1158. );
  1159. NTSTATUS
  1160. SamEnumerateDomainsInSamServer(
  1161. IN SAM_HANDLE ServerHandle,
  1162. IN OUT PSAM_ENUMERATE_HANDLE EnumerationContext,
  1163. OUT PVOID *Buffer,
  1164. IN ULONG PreferedMaximumLength,
  1165. OUT PULONG CountReturned
  1166. );
  1167. NTSTATUS
  1168. SamOpenDomain(
  1169. IN SAM_HANDLE ServerHandle,
  1170. IN ACCESS_MASK DesiredAccess,
  1171. IN PSID DomainId,
  1172. OUT PSAM_HANDLE DomainHandle
  1173. );
  1174. NTSTATUS
  1175. SamQueryInformationDomain(
  1176. IN SAM_HANDLE DomainHandle,
  1177. IN DOMAIN_INFORMATION_CLASS DomainInformationClass,
  1178. OUT PVOID *Buffer
  1179. );
  1180. NTSTATUS
  1181. SamSetInformationDomain(
  1182. IN SAM_HANDLE DomainHandle,
  1183. IN DOMAIN_INFORMATION_CLASS DomainInformationClass,
  1184. IN PVOID DomainInformation
  1185. );
  1186. NTSTATUS
  1187. SamCreateGroupInDomain(
  1188. IN SAM_HANDLE DomainHandle,
  1189. IN PUNICODE_STRING AccountName,
  1190. IN ACCESS_MASK DesiredAccess,
  1191. OUT PSAM_HANDLE GroupHandle,
  1192. OUT PULONG RelativeId
  1193. );
  1194. NTSTATUS
  1195. SamEnumerateGroupsInDomain(
  1196. IN SAM_HANDLE DomainHandle,
  1197. IN OUT PSAM_ENUMERATE_HANDLE EnumerationContext,
  1198. OUT PVOID *Buffer,
  1199. IN ULONG PreferedMaximumLength,
  1200. OUT PULONG CountReturned
  1201. );
  1202. NTSTATUS
  1203. SamCreateUser2InDomain(
  1204. IN SAM_HANDLE DomainHandle,
  1205. IN PUNICODE_STRING AccountName,
  1206. IN ULONG AccountType,
  1207. IN ACCESS_MASK DesiredAccess,
  1208. OUT PSAM_HANDLE UserHandle,
  1209. OUT PULONG GrantedAccess,
  1210. OUT PULONG RelativeId
  1211. );
  1212. NTSTATUS
  1213. SamCreateUserInDomain(
  1214. IN SAM_HANDLE DomainHandle,
  1215. IN PUNICODE_STRING AccountName,
  1216. IN ACCESS_MASK DesiredAccess,
  1217. OUT PSAM_HANDLE UserHandle,
  1218. OUT PULONG RelativeId
  1219. );
  1220. NTSTATUS
  1221. SamEnumerateUsersInDomain(
  1222. IN SAM_HANDLE DomainHandle,
  1223. IN OUT PSAM_ENUMERATE_HANDLE EnumerationContext,
  1224. IN ULONG UserAccountControl,
  1225. OUT PVOID *Buffer,
  1226. IN ULONG PreferedMaximumLength,
  1227. OUT PULONG CountReturned
  1228. );
  1229. NTSTATUS
  1230. SamCreateAliasInDomain(
  1231. IN SAM_HANDLE DomainHandle,
  1232. IN PUNICODE_STRING AccountName,
  1233. IN ACCESS_MASK DesiredAccess,
  1234. OUT PSAM_HANDLE AliasHandle,
  1235. OUT PULONG RelativeId
  1236. );
  1237. NTSTATUS
  1238. SamEnumerateAliasesInDomain(
  1239. IN SAM_HANDLE DomainHandle,
  1240. IN OUT PSAM_ENUMERATE_HANDLE EnumerationContext,
  1241. IN PVOID *Buffer,
  1242. IN ULONG PreferedMaximumLength,
  1243. OUT PULONG CountReturned
  1244. );
  1245. NTSTATUS
  1246. SamGetAliasMembership(
  1247. IN SAM_HANDLE DomainHandle,
  1248. IN ULONG PassedCount,
  1249. IN PSID *Sids,
  1250. OUT PULONG MembershipCount,
  1251. OUT PULONG *Aliases
  1252. );
  1253. NTSTATUS
  1254. SamLookupNamesInDomain(
  1255. IN SAM_HANDLE DomainHandle,
  1256. IN ULONG Count,
  1257. IN PUNICODE_STRING Names,
  1258. OUT PULONG *RelativeIds,
  1259. OUT PSID_NAME_USE *Use
  1260. );
  1261. NTSTATUS
  1262. SamLookupIdsInDomain(
  1263. IN SAM_HANDLE DomainHandle,
  1264. IN ULONG Count,
  1265. IN PULONG RelativeIds,
  1266. OUT PUNICODE_STRING *Names,
  1267. OUT PSID_NAME_USE *Use
  1268. );
  1269. NTSTATUS
  1270. SamOpenGroup(
  1271. IN SAM_HANDLE DomainHandle,
  1272. IN ACCESS_MASK DesiredAccess,
  1273. IN ULONG GroupId,
  1274. OUT PSAM_HANDLE GroupHandle
  1275. );
  1276. NTSTATUS
  1277. SamQueryInformationGroup(
  1278. IN SAM_HANDLE GroupHandle,
  1279. IN GROUP_INFORMATION_CLASS GroupInformationClass,
  1280. OUT PVOID *Buffer
  1281. );
  1282. NTSTATUS
  1283. SamSetInformationGroup(
  1284. IN SAM_HANDLE GroupHandle,
  1285. IN GROUP_INFORMATION_CLASS GroupInformationClass,
  1286. IN PVOID Buffer
  1287. );
  1288. NTSTATUS
  1289. SamAddMemberToGroup(
  1290. IN SAM_HANDLE GroupHandle,
  1291. IN ULONG MemberId,
  1292. IN ULONG Attributes
  1293. );
  1294. NTSTATUS
  1295. SamDeleteGroup(
  1296. IN SAM_HANDLE GroupHandle
  1297. );
  1298. NTSTATUS
  1299. SamRemoveMemberFromGroup(
  1300. IN SAM_HANDLE GroupHandle,
  1301. IN ULONG MemberId
  1302. );
  1303. NTSTATUS
  1304. SamGetMembersInGroup(
  1305. IN SAM_HANDLE GroupHandle,
  1306. OUT PULONG * MemberIds,
  1307. OUT PULONG * Attributes,
  1308. OUT PULONG MemberCount
  1309. );
  1310. NTSTATUS
  1311. SamSetMemberAttributesOfGroup(
  1312. IN SAM_HANDLE GroupHandle,
  1313. IN ULONG MemberId,
  1314. IN ULONG Attributes
  1315. );
  1316. NTSTATUS
  1317. SamOpenAlias(
  1318. IN SAM_HANDLE DomainHandle,
  1319. IN ACCESS_MASK DesiredAccess,
  1320. IN ULONG AliasId,
  1321. OUT PSAM_HANDLE AliasHandle
  1322. );
  1323. NTSTATUS
  1324. SamQueryInformationAlias(
  1325. IN SAM_HANDLE AliasHandle,
  1326. IN ALIAS_INFORMATION_CLASS AliasInformationClass,
  1327. OUT PVOID *Buffer
  1328. );
  1329. NTSTATUS
  1330. SamSetInformationAlias(
  1331. IN SAM_HANDLE AliasHandle,
  1332. IN ALIAS_INFORMATION_CLASS AliasInformationClass,
  1333. IN PVOID Buffer
  1334. );
  1335. NTSTATUS
  1336. SamDeleteAlias(
  1337. IN SAM_HANDLE AliasHandle
  1338. );
  1339. NTSTATUS
  1340. SamAddMemberToAlias(
  1341. IN SAM_HANDLE AliasHandle,
  1342. IN PSID MemberId
  1343. );
  1344. NTSTATUS
  1345. SamAddMultipleMembersToAlias(
  1346. IN SAM_HANDLE AliasHandle,
  1347. IN PSID *MemberIds,
  1348. IN ULONG MemberCount
  1349. );
  1350. NTSTATUS
  1351. SamRemoveMemberFromAlias(
  1352. IN SAM_HANDLE AliasHandle,
  1353. IN PSID MemberId
  1354. );
  1355. NTSTATUS
  1356. SamRemoveMultipleMembersFromAlias(
  1357. IN SAM_HANDLE AliasHandle,
  1358. IN PSID *MemberIds,
  1359. IN ULONG MemberCount
  1360. );
  1361. NTSTATUS
  1362. SamRemoveMemberFromForeignDomain(
  1363. IN SAM_HANDLE DomainHandle,
  1364. IN PSID MemberId
  1365. );
  1366. NTSTATUS
  1367. SamGetMembersInAlias(
  1368. IN SAM_HANDLE AliasHandle,
  1369. OUT PSID **MemberIds,
  1370. OUT PULONG MemberCount
  1371. );
  1372. NTSTATUS
  1373. SamOpenUser(
  1374. IN SAM_HANDLE DomainHandle,
  1375. IN ACCESS_MASK DesiredAccess,
  1376. IN ULONG UserId,
  1377. OUT PSAM_HANDLE UserHandle
  1378. );
  1379. NTSTATUS
  1380. SamDeleteUser(
  1381. IN SAM_HANDLE UserHandle
  1382. );
  1383. NTSTATUS
  1384. SamQueryInformationUser(
  1385. IN SAM_HANDLE UserHandle,
  1386. IN USER_INFORMATION_CLASS UserInformationClass,
  1387. OUT PVOID * Buffer
  1388. );
  1389. NTSTATUS
  1390. SamSetInformationUser(
  1391. IN SAM_HANDLE UserHandle,
  1392. IN USER_INFORMATION_CLASS UserInformationClass,
  1393. IN PVOID Buffer
  1394. );
  1395. NTSTATUS
  1396. SamChangePasswordUser(
  1397. IN SAM_HANDLE UserHandle,
  1398. IN PUNICODE_STRING OldPassword,
  1399. IN PUNICODE_STRING NewPassword
  1400. );
  1401. NTSTATUS
  1402. SamChangePasswordUser2(
  1403. IN PUNICODE_STRING ServerName,
  1404. IN PUNICODE_STRING UserName,
  1405. IN PUNICODE_STRING OldPassword,
  1406. IN PUNICODE_STRING NewPassword
  1407. );
  1408. NTSTATUS
  1409. SamChangePasswordUser3(
  1410. IN PUNICODE_STRING ServerName,
  1411. IN PUNICODE_STRING UserName,
  1412. IN PUNICODE_STRING OldPassword,
  1413. IN PUNICODE_STRING NewPassword,
  1414. OUT PDOMAIN_PASSWORD_INFORMATION * EffectivePasswordPolicy,
  1415. OUT PUSER_PWD_CHANGE_FAILURE_INFORMATION *PasswordChangeFailureInfo
  1416. );
  1417. NTSTATUS
  1418. SamGetGroupsForUser(
  1419. IN SAM_HANDLE UserHandle,
  1420. OUT PGROUP_MEMBERSHIP * Groups,
  1421. OUT PULONG MembershipCount
  1422. );
  1423. NTSTATUS
  1424. SamQueryDisplayInformation (
  1425. IN SAM_HANDLE DomainHandle,
  1426. IN DOMAIN_DISPLAY_INFORMATION DisplayInformation,
  1427. IN ULONG Index,
  1428. IN ULONG EntryCount,
  1429. IN ULONG PreferredMaximumLength,
  1430. OUT PULONG TotalAvailable,
  1431. OUT PULONG TotalReturned,
  1432. OUT PULONG ReturnedEntryCount,
  1433. OUT PVOID *SortedBuffer
  1434. );
  1435. NTSTATUS
  1436. SamGetDisplayEnumerationIndex (
  1437. IN SAM_HANDLE DomainHandle,
  1438. IN DOMAIN_DISPLAY_INFORMATION DisplayInformation,
  1439. IN PUNICODE_STRING Prefix,
  1440. OUT PULONG Index
  1441. );
  1442. NTSTATUS
  1443. SamRidToSid(
  1444. IN SAM_HANDLE ObjectHandle,
  1445. IN ULONG Rid,
  1446. OUT PSID* Sid
  1447. );
  1448. NTSTATUS
  1449. SamGetCompatibilityMode(
  1450. IN SAM_HANDLE ObjectHandle,
  1451. OUT ULONG* Mode
  1452. );
  1453. ////////////////////////////////////////////////////////////////////////////
  1454. // //
  1455. // Interface definitions of services provided by a password filter DLL //
  1456. // //
  1457. ////////////////////////////////////////////////////////////////////////////
  1458. //
  1459. // Routine names
  1460. //
  1461. // The routines provided by the DLL must be assigned the following names
  1462. // so that their addresses can be retrieved when the DLL is loaded.
  1463. //
  1464. //
  1465. // routine templates
  1466. //
  1467. //
  1468. // These guards are in place to allow ntsam.h and ntsecapi.h
  1469. // to be included in the same file.
  1470. //
  1471. // begin_ntsecapi
  1472. #ifndef _PASSWORD_NOTIFICATION_DEFINED
  1473. #define _PASSWORD_NOTIFICATION_DEFINED
  1474. typedef NTSTATUS (*PSAM_PASSWORD_NOTIFICATION_ROUTINE) (
  1475. PUNICODE_STRING UserName,
  1476. ULONG RelativeId,
  1477. PUNICODE_STRING NewPassword
  1478. );
  1479. #define SAM_PASSWORD_CHANGE_NOTIFY_ROUTINE "PasswordChangeNotify"
  1480. typedef BOOLEAN (*PSAM_INIT_NOTIFICATION_ROUTINE) (
  1481. );
  1482. #define SAM_INIT_NOTIFICATION_ROUTINE "InitializeChangeNotify"
  1483. #define SAM_PASSWORD_FILTER_ROUTINE "PasswordFilter"
  1484. typedef BOOLEAN (*PSAM_PASSWORD_FILTER_ROUTINE) (
  1485. IN PUNICODE_STRING AccountName,
  1486. IN PUNICODE_STRING FullName,
  1487. IN PUNICODE_STRING Password,
  1488. IN BOOLEAN SetOperation
  1489. );
  1490. #endif // _PASSWORD_NOTIFICATION_DEFINED
  1491. // end_ntsecapi
  1492. // begin_ntsecpkg
  1493. #ifndef _SAM_CREDENTIAL_UPDATE_DEFINED
  1494. #define _SAM_CREDENTIAL_UPDATE_DEFINED
  1495. typedef NTSTATUS (*PSAM_CREDENTIAL_UPDATE_NOTIFY_ROUTINE) (
  1496. IN PUNICODE_STRING ClearPassword,
  1497. IN PVOID OldCredentials,
  1498. IN ULONG OldCredentialSize,
  1499. IN ULONG UserAccountControl,
  1500. IN PUNICODE_STRING UPN, OPTIONAL
  1501. IN PUNICODE_STRING UserName,
  1502. IN PUNICODE_STRING NetbiosDomainName,
  1503. IN PUNICODE_STRING DnsDomainName,
  1504. OUT PVOID * NewCredentials,
  1505. OUT ULONG * NewCredentialSize
  1506. );
  1507. #define SAM_CREDENTIAL_UPDATE_NOTIFY_ROUTINE "CredentialUpdateNotify"
  1508. typedef BOOLEAN (*PSAM_CREDENTIAL_UPDATE_REGISTER_ROUTINE) (
  1509. OUT PUNICODE_STRING CredentialName
  1510. );
  1511. #define SAM_CREDENTIAL_UPDATE_REGISTER_ROUTINE "CredentialUpdateRegister"
  1512. typedef VOID (*PSAM_CREDENTIAL_UPDATE_FREE_ROUTINE) (
  1513. IN PVOID p
  1514. );
  1515. #define SAM_CREDENTIAL_UPDATE_FREE_ROUTINE "CredentialUpdateFree"
  1516. #endif // _SAM_CREDENTIAL_UPDATE_DEFINED
  1517. // end_ntsecpkg
  1518. #ifdef __cplusplus
  1519. }
  1520. #endif
  1521. #endif // _NTSAM_