1 2 #ifndef _NTSAM_ 3 #define _NTSAM_ 4 5 #ifdef __cplusplus 6 extern "C" { 7 #endif 8 9 #define ALIAS_ADD_MEMBER 0x00000001 10 #define ALIAS_REMOVE_MEMBER 0x00000002 11 #define ALIAS_LIST_MEMBERS 0x00000004 12 #define ALIAS_READ_INFORMATION 0x00000008 13 #define ALIAS_WRITE_ACCOUNT 0x00000010 14 15 #define ALIAS_READ (STANDARD_RIGHTS_READ |\ 16 ALIAS_LIST_MEMBERS) 17 18 #define ALIAS_WRITE (STANDARD_RIGHTS_WRITE |\ 19 ALIAS_ADD_MEMBER |\ 20 ALIAS_REMOVE_MEMBER |\ 21 ALIAS_WRITE_ACCOUNT) 22 23 #define ALIAS_EXECUTE (STANDARD_RIGHTS_EXECUTE |\ 24 ALIAS_READ_INFORMATION) 25 26 #define ALIAS_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED |\ 27 ALIAS_ADD_MEMBER |\ 28 ALIAS_REMOVE_MEMBER |\ 29 ALIAS_LIST_MEMBERS |\ 30 ALIAS_READ_INFORMATION |\ 31 ALIAS_WRITE_ACCOUNT) 32 33 #define DOMAIN_READ_PASSWORD_PARAMETERS 0x00000001 34 #define DOMAIN_WRITE_PASSWORD_PARAMS 0x00000002 35 #define DOMAIN_READ_OTHER_PARAMETERS 0x00000004 36 #define DOMAIN_WRITE_OTHER_PARAMETERS 0x00000008 37 #define DOMAIN_CREATE_USER 0x00000010 38 #define DOMAIN_CREATE_GROUP 0x00000020 39 #define DOMAIN_CREATE_ALIAS 0x00000040 40 #define DOMAIN_GET_ALIAS_MEMBERSHIP 0x00000080 41 #define DOMAIN_LIST_ACCOUNTS 0x00000100 42 #define DOMAIN_LOOKUP 0x00000200 43 #define DOMAIN_ADMINISTER_SERVER 0x00000400 44 45 #define DOMAIN_READ (STANDARD_RIGHTS_READ |\ 46 DOMAIN_READ_OTHER_PARAMETERS |\ 47 DOMAIN_GET_ALIAS_MEMBERSHIP) 48 49 #define DOMAIN_WRITE (STANDARD_RIGHTS_WRITE |\ 50 DOMAIN_WRITE_PASSWORD_PARAMS |\ 51 DOMAIN_WRITE_OTHER_PARAMETERS |\ 52 DOMAIN_CREATE_USER |\ 53 DOMAIN_CREATE_GROUP |\ 54 DOMAIN_CREATE_ALIAS |\ 55 DOMAIN_ADMINISTER_SERVER) 56 57 #define DOMAIN_EXECUTE (STANDARD_RIGHTS_EXECUTE |\ 58 DOMAIN_READ_PASSWORD_PARAMETERS |\ 59 DOMAIN_LIST_ACCOUNTS |\ 60 DOMAIN_LOOKUP) 61 62 #define DOMAIN_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED |\ 63 DOMAIN_READ_PASSWORD_PARAMETERS |\ 64 DOMAIN_WRITE_PASSWORD_PARAMS |\ 65 DOMAIN_READ_OTHER_PARAMETERS |\ 66 DOMAIN_WRITE_OTHER_PARAMETERS |\ 67 DOMAIN_CREATE_USER |\ 68 DOMAIN_CREATE_GROUP |\ 69 DOMAIN_CREATE_ALIAS |\ 70 DOMAIN_GET_ALIAS_MEMBERSHIP |\ 71 DOMAIN_LIST_ACCOUNTS |\ 72 DOMAIN_LOOKUP |\ 73 DOMAIN_ADMINISTER_SERVER) 74 75 #define GROUP_READ_INFORMATION 0x00000001 76 #define GROUP_WRITE_ACCOUNT 0x00000002 77 #define GROUP_ADD_MEMBER 0x00000004 78 #define GROUP_REMOVE_MEMBER 0x00000008 79 #define GROUP_LIST_MEMBERS 0x00000010 80 81 #define GROUP_READ (STANDARD_RIGHTS_READ |\ 82 GROUP_LIST_MEMBERS) 83 84 #define GROUP_WRITE (STANDARD_RIGHTS_WRITE |\ 85 GROUP_WRITE_ACCOUNT |\ 86 GROUP_ADD_MEMBER |\ 87 GROUP_REMOVE_MEMBER) 88 89 #define GROUP_EXECUTE (STANDARD_RIGHTS_EXECUTE |\ 90 GROUP_READ_INFORMATION) 91 92 #define GROUP_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED |\ 93 GROUP_READ_INFORMATION |\ 94 GROUP_WRITE_ACCOUNT |\ 95 GROUP_ADD_MEMBER |\ 96 GROUP_REMOVE_MEMBER |\ 97 GROUP_LIST_MEMBERS) 98 99 #define SAM_SERVER_CONNECT 0x00000001 100 #define SAM_SERVER_SHUTDOWN 0x00000002 101 #define SAM_SERVER_INITIALIZE 0x00000004 102 #define SAM_SERVER_CREATE_DOMAIN 0x00000008 103 #define SAM_SERVER_ENUMERATE_DOMAINS 0x00000010 104 #define SAM_SERVER_LOOKUP_DOMAIN 0x00000020 105 106 #define SAM_SERVER_READ (STANDARD_RIGHTS_READ |\ 107 SAM_SERVER_ENUMERATE_DOMAINS) 108 109 #define SAM_SERVER_WRITE (STANDARD_RIGHTS_WRITE |\ 110 SAM_SERVER_SHUTDOWN |\ 111 SAM_SERVER_INITIALIZE |\ 112 SAM_SERVER_CREATE_DOMAIN) 113 114 #define SAM_SERVER_EXECUTE (STANDARD_RIGHTS_EXECUTE |\ 115 SAM_SERVER_CONNECT |\ 116 SAM_SERVER_LOOKUP_DOMAIN) 117 118 #define SAM_SERVER_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED |\ 119 SAM_SERVER_CONNECT |\ 120 SAM_SERVER_SHUTDOWN |\ 121 SAM_SERVER_INITIALIZE |\ 122 SAM_SERVER_CREATE_DOMAIN |\ 123 SAM_SERVER_ENUMERATE_DOMAINS |\ 124 SAM_SERVER_LOOKUP_DOMAIN) 125 126 #define USER_READ_GENERAL 0x00000001 127 #define USER_READ_PREFERENCES 0x00000002 128 #define USER_WRITE_PREFERENCES 0x00000004 129 #define USER_READ_LOGON 0x00000008 130 #define USER_READ_ACCOUNT 0x00000010 131 #define USER_WRITE_ACCOUNT 0x00000020 132 #define USER_CHANGE_PASSWORD 0x00000040 133 #define USER_FORCE_PASSWORD_CHANGE 0x00000080 134 #define USER_LIST_GROUPS 0x00000100 135 #define USER_READ_GROUP_INFORMATION 0x00000200 136 #define USER_WRITE_GROUP_INFORMATION 0x00000400 137 138 #define USER_READ (STANDARD_RIGHTS_READ |\ 139 USER_READ_PREFERENCES |\ 140 USER_READ_LOGON |\ 141 USER_READ_ACCOUNT |\ 142 USER_LIST_GROUPS |\ 143 USER_READ_GROUP_INFORMATION) 144 145 #define USER_WRITE (STANDARD_RIGHTS_WRITE |\ 146 USER_WRITE_PREFERENCES |\ 147 USER_CHANGE_PASSWORD) 148 149 #define USER_EXECUTE (STANDARD_RIGHTS_EXECUTE |\ 150 USER_READ_GENERAL |\ 151 USER_CHANGE_PASSWORD) 152 153 #define USER_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED |\ 154 USER_READ_GENERAL |\ 155 USER_READ_PREFERENCES |\ 156 USER_WRITE_PREFERENCES |\ 157 USER_READ_LOGON |\ 158 USER_READ_ACCOUNT |\ 159 USER_WRITE_ACCOUNT |\ 160 USER_CHANGE_PASSWORD |\ 161 USER_FORCE_PASSWORD_CHANGE |\ 162 USER_LIST_GROUPS |\ 163 USER_READ_GROUP_INFORMATION |\ 164 USER_WRITE_GROUP_INFORMATION) 165 166 /* User account control bits */ 167 #define USER_ACCOUNT_DISABLED 0x00000001 168 #define USER_HOME_DIRECTORY_REQUIRED 0x00000002 169 #define USER_PASSWORD_NOT_REQUIRED 0x00000004 170 #define USER_TEMP_DUPLICATE_ACCOUNT 0x00000008 171 #define USER_NORMAL_ACCOUNT 0x00000010 172 #define USER_MNS_LOGON_ACCOUNT 0x00000020 173 #define USER_INTERDOMAIN_TRUST_ACCOUNT 0x00000040 174 #define USER_WORKSTATION_TRUST_ACCOUNT 0x00000080 175 #define USER_SERVER_TRUST_ACCOUNT 0x00000100 176 #define USER_DONT_EXPIRE_PASSWORD 0x00000200 177 #define USER_ACCOUNT_AUTO_LOCKED 0x00000400 178 #define USER_ENCRYPTED_TEXT_PASSWORD_ALLOWED 0x00000800 179 #define USER_SMARTCARD_REQUIRED 0x00001000 180 #define USER_TRUSTED_FOR_DELEGATION 0x00002000 181 #define USER_NOT_DELEGATED 0x00004000 182 #define USER_USE_DES_KEY_ONLY 0x00008000 183 #define USER_DONT_REQUIRE_PREAUTH 0x00010000 184 #define USER_PASSWORD_EXPIRED 0x00020000 185 #define USER_TRUSTED_TO_AUTHENTICATE_FOR_DELEGATION 0x00040000 186 #define USER_NO_AUTH_DATA_REQUIRED 0x00080000 187 #define USER_PARTIAL_SECRETS_ACCOUNT 0x00100000 188 #define USER_USE_AES_KEYS 0x00200000 189 190 /* Constants used by LOGON_HOURS.UnitsPerWeek */ 191 #define SAM_DAYS_PER_WEEK (7) 192 #define SAM_HOURS_PER_WEEK (24 * SAM_DAYS_PER_WEEK) 193 #define SAM_MINUTES_PER_WEEK (60 * SAM_HOURS_PER_WEEK) 194 195 /* Flags used by USER_ALL_INFORMATION.WhichField */ 196 #define USER_ALL_USERNAME 0x00000001 197 #define USER_ALL_FULLNAME 0x00000002 198 #define USER_ALL_USERID 0x00000004 199 #define USER_ALL_PRIMARYGROUPID 0x00000008 200 #define USER_ALL_ADMINCOMMENT 0x00000010 201 #define USER_ALL_USERCOMMENT 0x00000020 202 #define USER_ALL_HOMEDIRECTORY 0x00000040 203 #define USER_ALL_HOMEDIRECTORYDRIVE 0x00000080 204 #define USER_ALL_SCRIPTPATH 0x00000100 205 #define USER_ALL_PROFILEPATH 0x00000200 206 #define USER_ALL_WORKSTATIONS 0x00000400 207 #define USER_ALL_LASTLOGON 0x00000800 208 #define USER_ALL_LASTLOGOFF 0x00001000 209 #define USER_ALL_LOGONHOURS 0x00002000 210 #define USER_ALL_BADPASSWORDCOUNT 0x00004000 211 #define USER_ALL_LOGONCOUNT 0x00008000 212 #define USER_ALL_PASSWORDCANCHANGE 0x00010000 213 #define USER_ALL_PASSWORDMUSTCHANGE 0x00020000 214 #define USER_ALL_PASSWORDLASTSET 0x00040000 215 #define USER_ALL_ACCOUNTEXPIRES 0x00080000 216 #define USER_ALL_USERACCOUNTCONTROL 0x00100000 217 #define USER_ALL_PARAMETERS 0x00200000 218 #define USER_ALL_COUNTRYCODE 0x00400000 219 #define USER_ALL_CODEPAGE 0x00800000 220 #define USER_ALL_NTPASSWORDPRESENT 0x01000000 221 #define USER_ALL_LMPASSWORDPRESENT 0x02000000 222 #define USER_ALL_PRIVATEDATA 0x04000000 223 #define USER_ALL_PASSWORDEXPIRED 0x08000000 224 #define USER_ALL_SECURITYDESCRIPTOR 0x10000000 225 #define USER_ALL_OWFPASSWORD 0x20000000 226 #define USER_ALL_UNDEFINED_MASK 0xC0000000 227 228 #define USER_ALL_READ_GENERAL_MASK 0x0000003F 229 #define USER_ALL_READ_LOGON_MASK 0x0003FFC0 230 #define USER_ALL_READ_ACCOUNT_MASK 0x003C0000 231 #define USER_ALL_READ_PREFERENCES_MASK 0x00C00000 232 #define USER_ALL_READ_TRUSTED_MASK 0x1F000000 233 #define USER_ALL_READ_CANT_MASK 0xC0000000 234 235 #define USER_ALL_WRITE_ACCOUNT_MASK 0x003827DB 236 #define USER_ALL_WRITE_PREFERENCES_MASK 0x00C00020 237 #define USER_ALL_WRITE_FORCE_PASSWORD_CHANGE_MASK 0x0B000000 238 #define USER_ALL_WRITE_TRUSTED_MASK 0x1404D800 239 #define USER_ALL_WRITE_CANT_MASK 0xC0030004 240 241 /* Values used by USER_PWD_CHANGE_FAILURE_INFORMATION.ExtendedFailureReason */ 242 #define SAM_PWD_CHANGE_NO_ERROR 0 243 #define SAM_PWD_CHANGE_PASSWORD_TOO_SHORT 1 244 #define SAM_PWD_CHANGE_PWD_IN_HISTORY 2 245 #define SAM_PWD_CHANGE_USERNAME_IN_PASSWORD 3 246 #define SAM_PWD_CHANGE_FULLNAME_IN_PASSWORD 4 247 #define SAM_PWD_CHANGE_NOT_COMPLEX 5 248 #define SAM_PWD_CHANGE_MACHINE_PASSWORD_NOT_DEFAULT 6 249 #define SAM_PWD_CHANGE_FAILED_BY_FILTER 7 250 #define SAM_PWD_CHANGE_PASSWORD_TOO_LONG 8 251 #define SAM_PWD_CHANGE_FAILURE_REASON_MAX 8 252 253 /* Flags used by DOMAIN_PASSWORD_INFORMATION.PasswordProperties */ 254 #define DOMAIN_PASSWORD_COMPLEX 0x00000001L 255 #define DOMAIN_PASSWORD_NO_ANON_CHANGE 0x00000002L 256 #define DOMAIN_PASSWORD_NO_CLEAR_CHANGE 0x00000004L 257 #define DOMAIN_LOCKOUT_ADMINS 0x00000008L 258 #define DOMAIN_PASSWORD_STORE_CLEARTEXT 0x00000010L 259 #define DOMAIN_REFUSE_PASSWORD_CHANGE 0x00000020L 260 #define DOMAIN_NO_LM_OWF_CHANGE 0x00000040L 261 262 typedef PVOID SAM_HANDLE, *PSAM_HANDLE; 263 typedef ULONG SAM_ENUMERATE_HANDLE, *PSAM_ENUMERATE_HANDLE; 264 265 typedef struct _SAM_RID_ENUMERATION 266 { 267 ULONG RelativeId; 268 UNICODE_STRING Name; 269 } SAM_RID_ENUMERATION, *PSAM_RID_ENUMERATION; 270 271 typedef struct _SAM_SID_ENUMERATION 272 { 273 PSID Sid; 274 UNICODE_STRING Name; 275 } SAM_SID_ENUMERATION, *PSAM_SID_ENUMERATION; 276 277 typedef enum _ALIAS_INFORMATION_CLASS 278 { 279 AliasGeneralInformation = 1, 280 AliasNameInformation, 281 AliasAdminCommentInformation 282 } ALIAS_INFORMATION_CLASS, *PALIAS_INFORMATION_CLASS; 283 284 typedef struct _ALIAS_GENERAL_INFORMATION 285 { 286 UNICODE_STRING Name; 287 ULONG MemberCount; 288 UNICODE_STRING AdminComment; 289 } ALIAS_GENERAL_INFORMATION, *PALIAS_GENERAL_INFORMATION; 290 291 typedef struct _ALIAS_NAME_INFORMATION 292 { 293 UNICODE_STRING Name; 294 } ALIAS_NAME_INFORMATION, *PALIAS_NAME_INFORMATION; 295 296 typedef struct _ALIAS_ADM_COMMENT_INFORMATION 297 { 298 UNICODE_STRING AdminComment; 299 } ALIAS_ADM_COMMENT_INFORMATION, *PALIAS_ADM_COMMENT_INFORMATION; 300 301 typedef enum _DOMAIN_DISPLAY_INFORMATION 302 { 303 DomainDisplayUser = 1, 304 DomainDisplayMachine, 305 DomainDisplayGroup, 306 DomainDisplayOemUser, 307 DomainDisplayOemGroup, 308 DomainDisplayServer 309 } DOMAIN_DISPLAY_INFORMATION, *PDOMAIN_DISPLAY_INFORMATION; 310 311 typedef struct _DOMAIN_DISPLAY_USER 312 { 313 ULONG Index; 314 ULONG Rid; 315 ULONG AccountControl; 316 UNICODE_STRING LogonName; 317 UNICODE_STRING AdminComment; 318 UNICODE_STRING FullName; 319 } DOMAIN_DISPLAY_USER, *PDOMAIN_DISPLAY_USER; 320 321 typedef struct _DOMAIN_DISPLAY_MACHINE 322 { 323 ULONG Index; 324 ULONG Rid; 325 ULONG AccountControl; 326 UNICODE_STRING Machine; 327 UNICODE_STRING Comment; 328 } DOMAIN_DISPLAY_MACHINE, *PDOMAIN_DISPLAY_MACHINE; 329 330 typedef struct _DOMAIN_DISPLAY_GROUP 331 { 332 ULONG Index; 333 ULONG Rid; 334 ULONG Attributes; 335 UNICODE_STRING Group; 336 UNICODE_STRING Comment; 337 } DOMAIN_DISPLAY_GROUP, *PDOMAIN_DISPLAY_GROUP; 338 339 typedef enum _DOMAIN_INFORMATION_CLASS 340 { 341 DomainPasswordInformation = 1, 342 DomainGeneralInformation, 343 DomainLogoffInformation, 344 DomainOemInformation, 345 DomainNameInformation, 346 DomainReplicationInformation, 347 DomainServerRoleInformation, 348 DomainModifiedInformation, 349 DomainStateInformation, 350 DomainUasInformation, 351 DomainGeneralInformation2, 352 DomainLockoutInformation, 353 DomainModifiedInformation2 354 } DOMAIN_INFORMATION_CLASS; 355 356 typedef enum _DOMAIN_SERVER_ENABLE_STATE 357 { 358 DomainServerEnabled = 1, 359 DomainServerDisabled 360 } DOMAIN_SERVER_ENABLE_STATE, *PDOMAIN_SERVER_ENABLE_STATE; 361 362 typedef enum _DOMAIN_SERVER_ROLE 363 { 364 DomainServerRoleBackup = 2, 365 DomainServerRolePrimary 366 } DOMAIN_SERVER_ROLE, *PDOMAIN_SERVER_ROLE; 367 368 #ifndef _DOMAIN_PASSWORD_INFORMATION_DEFINED 369 #define _DOMAIN_PASSWORD_INFORMATION_DEFINED 370 typedef struct _DOMAIN_PASSWORD_INFORMATION 371 { 372 USHORT MinPasswordLength; 373 USHORT PasswordHistoryLength; 374 ULONG PasswordProperties; 375 LARGE_INTEGER MaxPasswordAge; 376 LARGE_INTEGER MinPasswordAge; 377 } DOMAIN_PASSWORD_INFORMATION, *PDOMAIN_PASSWORD_INFORMATION; 378 #endif 379 380 #include "pshpack4.h" 381 typedef struct _DOMAIN_GENERAL_INFORMATION 382 { 383 LARGE_INTEGER ForceLogoff; 384 UNICODE_STRING OemInformation; 385 UNICODE_STRING DomainName; 386 UNICODE_STRING ReplicaSourceNodeName; 387 LARGE_INTEGER DomainModifiedCount; 388 DOMAIN_SERVER_ENABLE_STATE DomainServerState; 389 DOMAIN_SERVER_ROLE DomainServerRole; 390 BOOLEAN UasCompatibilityRequired; 391 ULONG UserCount; 392 ULONG GroupCount; 393 ULONG AliasCount; 394 } DOMAIN_GENERAL_INFORMATION, *PDOMAIN_GENERAL_INFORMATION; 395 #include "poppack.h" 396 397 typedef struct _DOMAIN_LOGOFF_INFORMATION 398 { 399 LARGE_INTEGER ForceLogoff; 400 } DOMAIN_LOGOFF_INFORMATION, *PDOMAIN_LOGOFF_INFORMATION; 401 402 typedef struct _DOMAIN_OEM_INFORMATION 403 { 404 UNICODE_STRING OemInformation; 405 } DOMAIN_OEM_INFORMATION, *PDOMAIN_OEM_INFORMATION; 406 407 typedef struct _DOMAIN_NAME_INFORMATION 408 { 409 UNICODE_STRING DomainName; 410 } DOMAIN_NAME_INFORMATION, *PDOMAIN_NAME_INFORMATION; 411 412 typedef struct _DOMAIN_REPLICATION_INFORMATION 413 { 414 UNICODE_STRING ReplicaSourceNodeName; 415 } DOMAIN_REPLICATION_INFORMATION, *PDOMAIN_REPLICATION_INFORMATION; 416 417 typedef struct _DOMAIN_SERVER_ROLE_INFORMATION 418 { 419 DOMAIN_SERVER_ROLE DomainServerRole; 420 } DOMAIN_SERVER_ROLE_INFORMATION, *PDOMAIN_SERVER_ROLE_INFORMATION; 421 422 typedef struct _DOMAIN_MODIFIED_INFORMATION 423 { 424 LARGE_INTEGER DomainModifiedCount; 425 LARGE_INTEGER CreationTime; 426 } DOMAIN_MODIFIED_INFORMATION, *PDOMAIN_MODIFIED_INFORMATION; 427 428 typedef struct _DOMAIN_STATE_INFORMATION 429 { 430 DOMAIN_SERVER_ENABLE_STATE DomainServerState; 431 } DOMAIN_STATE_INFORMATION, *PDOMAIN_STATE_INFORMATION; 432 433 typedef struct _DOMAIN_UAS_INFORMATION 434 { 435 BOOLEAN UasCompatibilityRequired; 436 } DOMAIN_UAS_INFORMATION; 437 438 #include "pshpack4.h" 439 typedef struct _DOMAIN_GENERAL_INFORMATION2 440 { 441 DOMAIN_GENERAL_INFORMATION I1; 442 LARGE_INTEGER LockoutDuration; 443 LARGE_INTEGER LockoutObservationWindow; 444 USHORT LockoutThreshold; 445 } DOMAIN_GENERAL_INFORMATION2, *PDOMAIN_GENERAL_INFORMATION2; 446 #include "poppack.h" 447 448 typedef struct _DOMAIN_LOCKOUT_INFORMATION 449 { 450 LARGE_INTEGER LockoutDuration; 451 LARGE_INTEGER LockoutObservationWindow; 452 USHORT LockoutThreshold; 453 } DOMAIN_LOCKOUT_INFORMATION, *PDOMAIN_LOCKOUT_INFORMATION; 454 455 typedef struct _DOMAIN_MODIFIED_INFORMATION2 456 { 457 LARGE_INTEGER DomainModifiedCount; 458 LARGE_INTEGER CreationTime; 459 LARGE_INTEGER ModifiedCountAtLastPromotion; 460 } DOMAIN_MODIFIED_INFORMATION2, *PDOMAIN_MODIFIED_INFORMATION2; 461 462 typedef enum _GROUP_INFORMATION_CLASS 463 { 464 GroupGeneralInformation = 1, 465 GroupNameInformation, 466 GroupAttributeInformation, 467 GroupAdminCommentInformation, 468 GroupReplicationInformation 469 } GROUP_INFORMATION_CLASS; 470 471 typedef struct _GROUP_GENERAL_INFORMATION 472 { 473 UNICODE_STRING Name; 474 ULONG Attributes; 475 ULONG MemberCount; 476 UNICODE_STRING AdminComment; 477 } GROUP_GENERAL_INFORMATION, *PGROUP_GENERAL_INFORMATION; 478 479 typedef struct _GROUP_NAME_INFORMATION 480 { 481 UNICODE_STRING Name; 482 } GROUP_NAME_INFORMATION, *PGROUP_NAME_INFORMATION; 483 484 typedef struct _GROUP_ATTRIBUTE_INFORMATION 485 { 486 ULONG Attributes; 487 } GROUP_ATTRIBUTE_INFORMATION, *PGROUP_ATTRIBUTE_INFORMATION; 488 489 typedef struct GROUP_ADM_COMMENT_INFORMATION 490 { 491 UNICODE_STRING AdminComment; 492 } GROUP_ADM_COMMENT_INFORMATION, *PGROUP_ADM_COMMENT_INFORMATION; 493 494 typedef struct _GROUP_MEMBERSHIP 495 { 496 ULONG RelativeId; 497 ULONG Attributes; 498 } GROUP_MEMBERSHIP, *PGROUP_MEMBERSHIP; 499 500 typedef struct _LOGON_HOURS 501 { 502 USHORT UnitsPerWeek; 503 PUCHAR LogonHours; 504 } LOGON_HOURS, *PLOGON_HOURS; 505 506 typedef struct _SR_SECURITY_DESCRIPTOR 507 { 508 ULONG Length; 509 PUCHAR SecurityDescriptor; 510 } SR_SECURITY_DESCRIPTOR, *PSR_SECURITY_DESCRIPTOR; 511 512 typedef enum _USER_INFORMATION_CLASS 513 { 514 UserGeneralInformation = 1, 515 UserPreferencesInformation, 516 UserLogonInformation, 517 UserLogonHoursInformation, 518 UserAccountInformation, 519 UserNameInformation, 520 UserAccountNameInformation, 521 UserFullNameInformation, 522 UserPrimaryGroupInformation, 523 UserHomeInformation, 524 UserScriptInformation, 525 UserProfileInformation, 526 UserAdminCommentInformation, 527 UserWorkStationsInformation, 528 UserSetPasswordInformation, 529 UserControlInformation, 530 UserExpiresInformation, 531 UserInternal1Information, 532 UserInternal2Information, 533 UserParametersInformation, 534 UserAllInformation, 535 UserInternal3Information, 536 UserInternal4Information, 537 UserInternal5Information, 538 UserInternal4InformationNew, 539 UserInternal5InformationNew, 540 UserInternal6Information, 541 UserExtendedInformation, 542 UserLogonUIInformation, 543 } USER_INFORMATION_CLASS, *PUSER_INFORMATION_CLASS; 544 545 typedef struct _USER_GENERAL_INFORMATION 546 { 547 UNICODE_STRING UserName; 548 UNICODE_STRING FullName; 549 ULONG PrimaryGroupId; 550 UNICODE_STRING AdminComment; 551 UNICODE_STRING UserComment; 552 } USER_GENERAL_INFORMATION, *PUSER_GENERAL_INFORMATION; 553 554 typedef struct _USER_PREFERENCES_INFORMATION 555 { 556 UNICODE_STRING UserComment; 557 UNICODE_STRING Reserved1; 558 USHORT CountryCode; 559 USHORT CodePage; 560 } USER_PREFERENCES_INFORMATION, *PUSER_PREFERENCES_INFORMATION; 561 562 #include "pshpack4.h" 563 typedef struct _USER_LOGON_INFORMATION 564 { 565 UNICODE_STRING UserName; 566 UNICODE_STRING FullName; 567 ULONG UserId; 568 ULONG PrimaryGroupId; 569 UNICODE_STRING HomeDirectory; 570 UNICODE_STRING HomeDirectoryDrive; 571 UNICODE_STRING ScriptPath; 572 UNICODE_STRING ProfilePath; 573 UNICODE_STRING WorkStations; 574 LARGE_INTEGER LastLogon; 575 LARGE_INTEGER LastLogoff; 576 LARGE_INTEGER PasswordLastSet; 577 LARGE_INTEGER PasswordCanChange; 578 LARGE_INTEGER PasswordMustChange; 579 LOGON_HOURS LogonHours; 580 USHORT BadPasswordCount; 581 USHORT LogonCount; 582 ULONG UserAccountControl; 583 } USER_LOGON_INFORMATION, *PUSER_LOGON_INFORMATION; 584 #include "poppack.h" 585 586 typedef struct _USER_LOGON_HOURS_INFORMATION 587 { 588 LOGON_HOURS LogonHours; 589 } USER_LOGON_HOURS_INFORMATION, *PUSER_LOGON_HOURS_INFORMATION; 590 591 #include "pshpack4.h" 592 typedef struct _USER_ACCOUNT_INFORMATION 593 { 594 UNICODE_STRING UserName; 595 UNICODE_STRING FullName; 596 ULONG UserId; 597 ULONG PrimaryGroupId; 598 UNICODE_STRING HomeDirectory; 599 UNICODE_STRING HomeDirectoryDrive; 600 UNICODE_STRING ScriptPath; 601 UNICODE_STRING ProfilePath; 602 UNICODE_STRING AdminComment; 603 UNICODE_STRING WorkStations; 604 LARGE_INTEGER LastLogon; 605 LARGE_INTEGER LastLogoff; 606 LOGON_HOURS LogonHours; 607 USHORT BadPasswordCount; 608 USHORT LogonCount; 609 LARGE_INTEGER PasswordLastSet; 610 LARGE_INTEGER AccountExpires; 611 ULONG UserAccountControl; 612 } USER_ACCOUNT_INFORMATION, *PUSER_ACCOUNT_INFORMATION; 613 #include "poppack.h" 614 615 typedef struct _USER_NAME_INFORMATION 616 { 617 UNICODE_STRING UserName; 618 UNICODE_STRING FullName; 619 } USER_NAME_INFORMATION, *PUSER_NAME_INFORMATION; 620 621 typedef struct _USER_ACCOUNT_NAME_INFORMATION 622 { 623 UNICODE_STRING UserName; 624 } USER_ACCOUNT_NAME_INFORMATION, *PUSER_ACCOUNT_NAME_INFORMATION; 625 626 typedef struct _USER_FULL_NAME_INFORMATION 627 { 628 UNICODE_STRING FullName; 629 } USER_FULL_NAME_INFORMATION, *PUSER_FULL_NAME_INFORMATION; 630 631 typedef struct _USER_PRIMARY_GROUP_INFORMATION 632 { 633 ULONG PrimaryGroupId; 634 } USER_PRIMARY_GROUP_INFORMATION, *PUSER_PRIMARY_GROUP_INFORMATION; 635 636 typedef struct _USER_HOME_INFORMATION 637 { 638 UNICODE_STRING HomeDirectory; 639 UNICODE_STRING HomeDirectoryDrive; 640 } USER_HOME_INFORMATION, *PUSER_HOME_INFORMATION; 641 642 typedef struct _USER_SCRIPT_INFORMATION 643 { 644 UNICODE_STRING ScriptPath; 645 } USER_SCRIPT_INFORMATION, *PUSER_SCRIPT_INFORMATION; 646 647 typedef struct _USER_PROFILE_INFORMATION 648 { 649 UNICODE_STRING ProfilePath; 650 } USER_PROFILE_INFORMATION, *PUSER_PROFILE_INFORMATION; 651 652 typedef struct _USER_ADMIN_COMMENT_INFORMATION 653 { 654 UNICODE_STRING AdminComment; 655 } USER_ADMIN_COMMENT_INFORMATION, *PUSER_ADMIN_COMMENT_INFORMATION; 656 657 typedef struct _USER_WORKSTATIONS_INFORMATION 658 { 659 UNICODE_STRING WorkStations; 660 } USER_WORKSTATIONS_INFORMATION, *PUSER_WORKSTATIONS_INFORMATION; 661 662 typedef struct _USER_SET_PASSWORD_INFORMATION 663 { 664 UNICODE_STRING Password; 665 BOOLEAN PasswordExpired; 666 } USER_SET_PASSWORD_INFORMATION, *PUSER_SET_PASSWORD_INFORMATION; 667 668 typedef struct _USER_CONTROL_INFORMATION 669 { 670 ULONG UserAccountControl; 671 } USER_CONTROL_INFORMATION, *PUSER_CONTROL_INFORMATION; 672 673 typedef struct _USER_EXPIRES_INFORMATION 674 { 675 LARGE_INTEGER AccountExpires; 676 } USER_EXPIRES_INFORMATION, *PUSER_EXPIRES_INFORMATION; 677 678 typedef struct _USER_PARAMETERS_INFORMATION 679 { 680 UNICODE_STRING Parameters; 681 } USER_PARAMETERS_INFORMATION, *PUSER_PARAMETERS_INFORMATION; 682 683 #include "pshpack4.h" 684 typedef struct _USER_ALL_INFORMATION 685 { 686 LARGE_INTEGER LastLogon; 687 LARGE_INTEGER LastLogoff; 688 LARGE_INTEGER PasswordLastSet; 689 LARGE_INTEGER AccountExpires; 690 LARGE_INTEGER PasswordCanChange; 691 LARGE_INTEGER PasswordMustChange; 692 UNICODE_STRING UserName; 693 UNICODE_STRING FullName; 694 UNICODE_STRING HomeDirectory; 695 UNICODE_STRING HomeDirectoryDrive; 696 UNICODE_STRING ScriptPath; 697 UNICODE_STRING ProfilePath; 698 UNICODE_STRING AdminComment; 699 UNICODE_STRING WorkStations; 700 UNICODE_STRING UserComment; 701 UNICODE_STRING Parameters; 702 UNICODE_STRING LmPassword; 703 UNICODE_STRING NtPassword; 704 UNICODE_STRING PrivateData; 705 SR_SECURITY_DESCRIPTOR SecurityDescriptor; 706 ULONG UserId; 707 ULONG PrimaryGroupId; 708 ULONG UserAccountControl; 709 ULONG WhichFields; 710 LOGON_HOURS LogonHours; 711 USHORT BadPasswordCount; 712 USHORT LogonCount; 713 USHORT CountryCode; 714 USHORT CodePage; 715 BOOLEAN LmPasswordPresent; 716 BOOLEAN NtPasswordPresent; 717 BOOLEAN PasswordExpired; 718 BOOLEAN PrivateDataSensitive; 719 } USER_ALL_INFORMATION, *PUSER_ALL_INFORMATION; 720 #include "poppack.h" 721 722 typedef struct _USER_PWD_CHANGE_FAILURE_INFORMATION 723 { 724 ULONG ExtendedFailureReason; 725 UNICODE_STRING FilterModuleName; 726 } USER_PWD_CHANGE_FAILURE_INFORMATION, *PUSER_PWD_CHANGE_FAILURE_INFORMATION; 727 728 #define SAM_SID_COMPATIBILITY_ALL 0 729 #define SAM_SID_COMPATIBILITY_LAX 1 730 #define SAM_SID_COMPATIBILITY_STRICT 2 731 732 733 NTSTATUS 734 NTAPI 735 SamAddMemberToAlias(IN SAM_HANDLE AliasHandle, 736 IN PSID MemberId); 737 738 NTSTATUS 739 NTAPI 740 SamAddMemberToGroup(IN SAM_HANDLE GroupHandle, 741 IN ULONG MemberId, 742 IN ULONG Attributes); 743 744 NTSTATUS 745 NTAPI 746 SamAddMultipleMembersToAlias(IN SAM_HANDLE AliasHandle, 747 IN PSID *MemberIds, 748 IN ULONG MemberCount); 749 750 NTSTATUS 751 NTAPI 752 SamChangePasswordUser(IN SAM_HANDLE UserHandle, 753 IN PUNICODE_STRING OldPassword, 754 IN PUNICODE_STRING NewPassword); 755 756 NTSTATUS 757 NTAPI 758 SamChangePasswordUser2(IN PUNICODE_STRING ServerName, 759 IN PUNICODE_STRING UserName, 760 IN PUNICODE_STRING OldPassword, 761 IN PUNICODE_STRING NewPassword); 762 763 NTSTATUS 764 NTAPI 765 SamChangePasswordUser3(IN PUNICODE_STRING ServerName, 766 IN PUNICODE_STRING UserName, 767 IN PUNICODE_STRING OldPassword, 768 IN PUNICODE_STRING NewPassword, 769 OUT PDOMAIN_PASSWORD_INFORMATION *EffectivePasswordPolicy, 770 OUT PUSER_PWD_CHANGE_FAILURE_INFORMATION *PasswordChangeFailureInfo); 771 772 NTSTATUS 773 NTAPI 774 SamCloseHandle(IN SAM_HANDLE SamHandle); 775 776 NTSTATUS 777 NTAPI 778 SamConnect(IN OUT PUNICODE_STRING ServerName OPTIONAL, 779 OUT PSAM_HANDLE ServerHandle, 780 IN ACCESS_MASK DesiredAccess, 781 IN POBJECT_ATTRIBUTES ObjectAttributes); 782 783 NTSTATUS 784 NTAPI 785 SamCreateAliasInDomain(IN SAM_HANDLE DomainHandle, 786 IN PUNICODE_STRING AccountName, 787 IN ACCESS_MASK DesiredAccess, 788 OUT PSAM_HANDLE AliasHandle, 789 OUT PULONG RelativeId); 790 791 NTSTATUS 792 NTAPI 793 SamCreateGroupInDomain(IN SAM_HANDLE DomainHandle, 794 IN PUNICODE_STRING AccountName, 795 IN ACCESS_MASK DesiredAccess, 796 OUT PSAM_HANDLE GroupHandle, 797 OUT PULONG RelativeId); 798 799 NTSTATUS 800 NTAPI 801 SamCreateUser2InDomain(IN SAM_HANDLE DomainHandle, 802 IN PUNICODE_STRING AccountName, 803 IN ULONG AccountType, 804 IN ACCESS_MASK DesiredAccess, 805 OUT PSAM_HANDLE UserHandle, 806 OUT PULONG GrantedAccess, 807 OUT PULONG RelativeId); 808 809 NTSTATUS 810 NTAPI 811 SamCreateUserInDomain(IN SAM_HANDLE DomainHandle, 812 IN PUNICODE_STRING AccountName, 813 IN ACCESS_MASK DesiredAccess, 814 OUT PSAM_HANDLE UserHandle, 815 OUT PULONG RelativeId); 816 817 NTSTATUS 818 NTAPI 819 SamDeleteAlias(IN SAM_HANDLE AliasHandle); 820 821 NTSTATUS 822 NTAPI 823 SamDeleteGroup(IN SAM_HANDLE GroupHandle); 824 825 NTSTATUS 826 NTAPI 827 SamDeleteUser(IN SAM_HANDLE UserHandle); 828 829 NTSTATUS 830 NTAPI 831 SamEnumerateAliasesInDomain(IN SAM_HANDLE DomainHandle, 832 IN OUT PSAM_ENUMERATE_HANDLE EnumerationContext, 833 OUT PVOID *Buffer, 834 IN ULONG PreferedMaximumLength, 835 OUT PULONG CountReturned); 836 837 NTSTATUS 838 NTAPI 839 SamEnumerateDomainsInSamServer(IN SAM_HANDLE ServerHandle, 840 IN OUT PSAM_ENUMERATE_HANDLE EnumerationContext, 841 OUT PVOID *Buffer, 842 IN ULONG PreferedMaximumLength, 843 OUT PULONG CountReturned); 844 845 NTSTATUS 846 NTAPI 847 SamEnumerateGroupsInDomain(IN SAM_HANDLE DomainHandle, 848 IN OUT PSAM_ENUMERATE_HANDLE EnumerationContext, 849 IN PVOID *Buffer, 850 IN ULONG PreferedMaximumLength, 851 OUT PULONG CountReturned); 852 853 NTSTATUS 854 NTAPI 855 SamEnumerateUsersInDomain(IN SAM_HANDLE DomainHandle, 856 IN OUT PSAM_ENUMERATE_HANDLE EnumerationContext, 857 IN ULONG UserAccountControl, 858 OUT PVOID *Buffer, 859 IN ULONG PreferedMaximumLength, 860 OUT PULONG CountReturned); 861 862 NTSTATUS 863 NTAPI 864 SamFreeMemory(IN PVOID Buffer); 865 866 NTSTATUS 867 NTAPI 868 SamGetAliasMembership(IN SAM_HANDLE DomainHandle, 869 IN ULONG PassedCount, 870 IN PSID *Sids, 871 OUT PULONG MembershipCount, 872 OUT PULONG *Aliases); 873 874 NTSTATUS 875 NTAPI 876 SamGetCompatibilityMode(IN SAM_HANDLE ObjectHandle, 877 OUT PULONG Mode); 878 879 NTSTATUS 880 NTAPI 881 SamGetDisplayEnumerationIndex(IN SAM_HANDLE DomainHandle, 882 IN DOMAIN_DISPLAY_INFORMATION DisplayInformation, 883 IN PUNICODE_STRING Prefix, 884 OUT PULONG Index); 885 886 NTSTATUS 887 NTAPI 888 SamGetGroupsForUser(IN SAM_HANDLE UserHandle, 889 OUT PGROUP_MEMBERSHIP *Groups, 890 OUT PULONG MembershipCount); 891 892 NTSTATUS 893 NTAPI 894 SamGetMembersInAlias(IN SAM_HANDLE AliasHandle, 895 OUT PSID **MemberIds, 896 OUT PULONG MemberCount); 897 898 NTSTATUS 899 NTAPI 900 SamGetMembersInGroup(IN SAM_HANDLE GroupHandle, 901 OUT PULONG *MemberIds, 902 OUT PULONG *Attributes, 903 OUT PULONG MemberCount); 904 905 NTSTATUS 906 NTAPI 907 SamLookupDomainInSamServer(IN SAM_HANDLE ServerHandle, 908 IN PUNICODE_STRING Name, 909 OUT PSID *DomainId); 910 911 NTSTATUS 912 NTAPI 913 SamLookupIdsInDomain(IN SAM_HANDLE DomainHandle, 914 IN ULONG Count, 915 IN PULONG RelativeIds, 916 OUT PUNICODE_STRING *Names, 917 OUT PSID_NAME_USE *Use OPTIONAL); 918 919 NTSTATUS 920 NTAPI 921 SamLookupNamesInDomain(IN SAM_HANDLE DomainHandle, 922 IN ULONG Count, 923 IN PUNICODE_STRING Names, 924 OUT PULONG *RelativeIds, 925 OUT PSID_NAME_USE *Use); 926 927 NTSTATUS 928 NTAPI 929 SamOpenAlias(IN SAM_HANDLE DomainHandle, 930 IN ACCESS_MASK DesiredAccess, 931 IN ULONG AliasId, 932 OUT PSAM_HANDLE AliasHandle); 933 934 NTSTATUS 935 NTAPI 936 SamOpenDomain(IN SAM_HANDLE ServerHandle, 937 IN ACCESS_MASK DesiredAccess, 938 IN PSID DomainId, 939 OUT PSAM_HANDLE DomainHandle); 940 941 NTSTATUS 942 NTAPI 943 SamOpenGroup(IN SAM_HANDLE DomainHandle, 944 IN ACCESS_MASK DesiredAccess, 945 IN ULONG GroupId, 946 OUT PSAM_HANDLE GroupHandle); 947 948 NTSTATUS 949 NTAPI 950 SamOpenUser(IN SAM_HANDLE DomainHandle, 951 IN ACCESS_MASK DesiredAccess, 952 IN ULONG UserId, 953 OUT PSAM_HANDLE UserHandle); 954 955 NTSTATUS 956 NTAPI 957 SamQueryDisplayInformation(IN SAM_HANDLE DomainHandle, 958 IN DOMAIN_DISPLAY_INFORMATION DisplayInformation, 959 IN ULONG Index, 960 IN ULONG EntryCount, 961 IN ULONG PreferredMaximumLength, 962 OUT PULONG TotalAvailable, 963 OUT PULONG TotalReturned, 964 OUT PULONG ReturnedEntryCount, 965 OUT PVOID *SortedBuffer); 966 967 NTSTATUS 968 NTAPI 969 SamQueryInformationAlias(IN SAM_HANDLE AliasHandle, 970 IN ALIAS_INFORMATION_CLASS AliasInformationClass, 971 OUT PVOID *Buffer); 972 973 NTSTATUS 974 NTAPI 975 SamQueryInformationDomain(IN SAM_HANDLE DomainHandle, 976 IN DOMAIN_INFORMATION_CLASS DomainInformationClass, 977 OUT PVOID *Buffer); 978 979 NTSTATUS 980 NTAPI 981 SamQueryInformationGroup(IN SAM_HANDLE GroupHandle, 982 IN GROUP_INFORMATION_CLASS GroupInformationClass, 983 OUT PVOID *Buffer); 984 985 NTSTATUS 986 NTAPI 987 SamQueryInformationUser(IN SAM_HANDLE UserHandle, 988 IN USER_INFORMATION_CLASS UserInformationClass, 989 OUT PVOID *Buffer); 990 991 NTSTATUS 992 NTAPI 993 SamQuerySecurityObject(IN SAM_HANDLE ObjectHandle, 994 IN SECURITY_INFORMATION SecurityInformation, 995 OUT PSECURITY_DESCRIPTOR *SecurityDescriptor); 996 997 NTSTATUS 998 NTAPI 999 SamRemoveMemberFromAlias(IN SAM_HANDLE AliasHandle, 1000 IN PSID MemberId); 1001 1002 NTSTATUS 1003 NTAPI 1004 SamRemoveMemberFromForeignDomain(IN SAM_HANDLE DomainHandle, 1005 IN PSID MemberId); 1006 1007 NTSTATUS 1008 NTAPI 1009 SamRemoveMemberFromGroup(IN SAM_HANDLE GroupHandle, 1010 IN ULONG MemberId); 1011 1012 NTSTATUS 1013 NTAPI 1014 SamRemoveMultipleMembersFromAlias(IN SAM_HANDLE AliasHandle, 1015 IN PSID *MemberIds, 1016 IN ULONG MemberCount); 1017 1018 NTSTATUS 1019 NTAPI 1020 SamRidToSid(IN SAM_HANDLE ObjectHandle, 1021 IN ULONG Rid, 1022 OUT PSID *Sid); 1023 1024 NTSTATUS 1025 NTAPI 1026 SamSetInformationAlias(IN SAM_HANDLE AliasHandle, 1027 IN ALIAS_INFORMATION_CLASS AliasInformationClass, 1028 IN PVOID Buffer); 1029 1030 NTSTATUS 1031 NTAPI 1032 SamSetInformationDomain(IN SAM_HANDLE DomainHandle, 1033 IN DOMAIN_INFORMATION_CLASS DomainInformationClass, 1034 IN PVOID Buffer); 1035 1036 NTSTATUS 1037 NTAPI 1038 SamSetInformationGroup(IN SAM_HANDLE GroupHandle, 1039 IN GROUP_INFORMATION_CLASS GroupInformationClass, 1040 IN PVOID Buffer); 1041 1042 NTSTATUS 1043 NTAPI 1044 SamSetInformationUser(IN SAM_HANDLE UserHandle, 1045 IN USER_INFORMATION_CLASS UserInformationClass, 1046 IN PVOID Buffer); 1047 1048 NTSTATUS 1049 NTAPI 1050 SamSetMemberAttributesOfGroup(IN SAM_HANDLE GroupHandle, 1051 IN ULONG MemberId, 1052 IN ULONG Attributes); 1053 1054 NTSTATUS 1055 NTAPI 1056 SamSetSecurityObject(IN SAM_HANDLE ObjectHandle, 1057 IN SECURITY_INFORMATION SecurityInformation, 1058 IN PSECURITY_DESCRIPTOR SecurityDescriptor); 1059 1060 NTSTATUS 1061 NTAPI 1062 SamShutdownSamServer(IN SAM_HANDLE ServerHandle); 1063 1064 #ifdef __cplusplus 1065 } 1066 #endif 1067 1068 #endif /* _NTSAM_ */ 1069