home *** CD-ROM | disk | FTP | other *** search
/ PC Plus SuperCD (UK) 2000 May / PCP163A.iso / Runimage / Cbuilder4 / Include / NTSECAPI.H < prev    next >
Encoding:
C/C++ Source or Header  |  1999-01-26  |  44.0 KB  |  1,563 lines

  1. /*++ BUILD Version: 0006     Increment this if a change has global effects
  2.  
  3. Copyright 1990 - 1998 Microsoft Corporation
  4.  
  5. Module Name:
  6.  
  7.     ntsecapi.h
  8.  
  9. Abstract:
  10.  
  11.     This module defines the Local Security Authority APIs.
  12.  
  13. Revision History:
  14.  
  15. --*/
  16.  
  17. #ifndef _NTSECAPI_
  18. #pragma option push -b -a8 -pc -A- /*P_O_Push_S*/
  19. #define _NTSECAPI_
  20.  
  21. #ifdef __cplusplus
  22. extern "C" {
  23. #endif
  24.  
  25. #ifndef _NTDEF_
  26. typedef LONG NTSTATUS, *PNTSTATUS;
  27. #endif
  28.  
  29. #ifndef _NTLSA_IFS_
  30. // begin_ntifs
  31.  
  32.  
  33. //
  34. // Security operation mode of the system is held in a control
  35. // longword.
  36. //
  37.  
  38. typedef ULONG  LSA_OPERATIONAL_MODE, *PLSA_OPERATIONAL_MODE;
  39.  
  40. // end_ntifs
  41. #endif // _NTLSA_IFS_
  42.  
  43. //
  44. // The flags in the security operational mode are defined
  45. // as:
  46. //
  47. //    PasswordProtected - Some level of authentication (such as
  48. //        a password) must be provided by users before they are
  49. //        allowed to use the system.  Once set, this value will
  50. //        not be cleared without re-booting the system.
  51. //
  52. //    IndividualAccounts - Each user must identify an account to
  53. //        logon to.  This flag is only meaningful if the
  54. //        PasswordProtected flag is also set.  If this flag is
  55. //        not set and the PasswordProtected flag is set, then all
  56. //        users may logon to the same account.  Once set, this value
  57. //        will not be cleared without re-booting the system.
  58. //
  59. //    MandatoryAccess - Indicates the system is running in a mandatory
  60. //        access control mode (e.g., B-level as defined by the U.S.A's
  61. //        Department of Defense's "Orange Book").  This is not utilized
  62. //        in the current release of NT.  This flag is only meaningful
  63. //        if both the PasswordProtected and IndividualAccounts flags are
  64. //        set.  Once set, this value will not be cleared without
  65. //        re-booting the system.
  66. //
  67. //    LogFull - Indicates the system has been brought up in a mode in
  68. //        which if must perform security auditing, but its audit log
  69. //        is full.  This may (should) restrict the operations that
  70. //        can occur until the audit log is made not-full again.  THIS
  71. //        VALUE MAY BE CLEARED WHILE THE SYSTEM IS RUNNING (I.E., WITHOUT
  72. //        REBOOTING).
  73. //
  74. // If the PasswordProtected flag is not set, then the system is running
  75. // without security, and user interface should be adjusted appropriately.
  76. //
  77.  
  78. #define LSA_MODE_PASSWORD_PROTECTED     (0x00000001L)
  79. #define LSA_MODE_INDIVIDUAL_ACCOUNTS    (0x00000002L)
  80. #define LSA_MODE_MANDATORY_ACCESS       (0x00000004L)
  81. #define LSA_MODE_LOG_FULL               (0x00000008L)
  82.  
  83. #ifndef _NTLSA_IFS_
  84. // begin_ntifs
  85. //
  86. // Used by a logon process to indicate what type of logon is being
  87. // requested.
  88. //
  89.  
  90. typedef enum _SECURITY_LOGON_TYPE {
  91.     Interactive = 2,    // Interactively logged on (locally or remotely)
  92.     Network,            // Accessing system via network
  93.     Batch,              // Started via a batch queue
  94.     Service,            // Service started by service controller
  95.     Proxy,              // Proxy logon
  96.     Unlock              // Unlock workstation
  97. } SECURITY_LOGON_TYPE, *PSECURITY_LOGON_TYPE;
  98.  
  99. // end_ntifs
  100. #endif // _NTLSA_IFS_
  101.  
  102.  
  103. //
  104. // Audit Event Categories
  105. //
  106. // The following are the built-in types or Categories of audit event.
  107. // WARNING!  This structure is subject to expansion.  The user should not
  108. // compute the number of elements of this type directly, but instead
  109. // should obtain the count of elements by calling LsaQueryInformationPolicy()
  110. // for the PolicyAuditEventsInformation class and extracting the count from
  111. // the MaximumAuditEventCount field of the returned structure.
  112. //
  113.  
  114. typedef enum _POLICY_AUDIT_EVENT_TYPE {
  115.  
  116.     AuditCategorySystem,
  117.     AuditCategoryLogon,
  118.     AuditCategoryObjectAccess,
  119.     AuditCategoryPrivilegeUse,
  120.     AuditCategoryDetailedTracking,
  121.     AuditCategoryPolicyChange,
  122.     AuditCategoryAccountManagement,
  123.     AuditCategoryDirectoryServiceAccess,
  124.     AuditCategoryAccountLogon
  125.  
  126. } POLICY_AUDIT_EVENT_TYPE, *PPOLICY_AUDIT_EVENT_TYPE;
  127.  
  128.  
  129. //
  130. // The following defines describe the auditing options for each
  131. // event type
  132. //
  133.  
  134. // Leave options specified for this event unchanged
  135.  
  136. #define POLICY_AUDIT_EVENT_UNCHANGED       (0x00000000L)
  137.  
  138. // Audit successful occurrences of events of this type
  139.  
  140. #define POLICY_AUDIT_EVENT_SUCCESS         (0x00000001L)
  141.  
  142. // Audit failed attempts to cause an event of this type to occur
  143.  
  144. #define POLICY_AUDIT_EVENT_FAILURE         (0x00000002L)
  145.  
  146. #define POLICY_AUDIT_EVENT_NONE            (0x00000004L)
  147.  
  148. // Mask of valid event auditing options
  149.  
  150. #define POLICY_AUDIT_EVENT_MASK \
  151.     (POLICY_AUDIT_EVENT_SUCCESS | \
  152.      POLICY_AUDIT_EVENT_FAILURE | \
  153.      POLICY_AUDIT_EVENT_UNCHANGED | \
  154.      POLICY_AUDIT_EVENT_NONE)
  155.  
  156.  
  157. #ifdef _NTDEF_
  158. // begin_ntifs
  159. typedef UNICODE_STRING LSA_UNICODE_STRING, *PLSA_UNICODE_STRING;
  160. typedef STRING LSA_STRING, *PLSA_STRING;
  161. typedef OBJECT_ATTRIBUTES LSA_OBJECT_ATTRIBUTES, *PLSA_OBJECT_ATTRIBUTES;
  162. // end_ntifs
  163. #else // _NTDEF_
  164.  
  165. #ifndef IN
  166. #define IN
  167. #endif
  168.  
  169. #ifndef OUT
  170. #define OUT
  171. #endif
  172.  
  173. #ifndef OPTIONAL
  174. #define OPTIONAL
  175. #endif
  176.  
  177.  
  178. typedef struct _LSA_UNICODE_STRING {
  179.     USHORT Length;
  180.     USHORT MaximumLength;
  181.     PWSTR  Buffer;
  182. } LSA_UNICODE_STRING, *PLSA_UNICODE_STRING;
  183.  
  184. typedef struct _LSA_STRING {
  185.     USHORT Length;
  186.     USHORT MaximumLength;
  187.     PCHAR Buffer;
  188. } LSA_STRING, *PLSA_STRING;
  189.  
  190. typedef struct _LSA_OBJECT_ATTRIBUTES {
  191.     ULONG Length;
  192.     HANDLE RootDirectory;
  193.     PLSA_UNICODE_STRING ObjectName;
  194.     ULONG Attributes;
  195.     PVOID SecurityDescriptor;        // Points to type SECURITY_DESCRIPTOR
  196.     PVOID SecurityQualityOfService;  // Points to type SECURITY_QUALITY_OF_SERVICE
  197. } LSA_OBJECT_ATTRIBUTES, *PLSA_OBJECT_ATTRIBUTES;
  198.  
  199.  
  200.  
  201. #endif // _NTDEF_
  202.  
  203. //
  204. // Macro for determining whether an API succeeded.
  205. //
  206.  
  207. #define LSA_SUCCESS(Error) ((LONG)(Error) >= 0)
  208.  
  209. #ifndef _NTLSA_IFS_
  210. // begin_ntifs
  211.  
  212. NTSTATUS
  213. NTAPI
  214. LsaRegisterLogonProcess (
  215.     IN PLSA_STRING LogonProcessName,
  216.     OUT PHANDLE LsaHandle,
  217.     OUT PLSA_OPERATIONAL_MODE SecurityMode
  218.     );
  219.  
  220. // end_ntifs
  221. // begin_ntsrv
  222.  
  223. NTSTATUS
  224. NTAPI
  225. LsaLogonUser (
  226.     IN HANDLE LsaHandle,
  227.     IN PLSA_STRING OriginName,
  228.     IN SECURITY_LOGON_TYPE LogonType,
  229.     IN ULONG AuthenticationPackage,
  230.     IN PVOID AuthenticationInformation,
  231.     IN ULONG AuthenticationInformationLength,
  232.     IN PTOKEN_GROUPS LocalGroups OPTIONAL,
  233.     IN PTOKEN_SOURCE SourceContext,
  234.     OUT PVOID *ProfileBuffer,
  235.     OUT PULONG ProfileBufferLength,
  236.     OUT PLUID LogonId,
  237.     OUT PHANDLE Token,
  238.     OUT PQUOTA_LIMITS Quotas,
  239.     OUT PNTSTATUS SubStatus
  240.     );
  241.  
  242.  
  243. // end_ntsrv
  244. // begin_ntifs
  245.  
  246. NTSTATUS
  247. NTAPI
  248. LsaLookupAuthenticationPackage (
  249.     IN HANDLE LsaHandle,
  250.     IN PLSA_STRING PackageName,
  251.     OUT PULONG AuthenticationPackage
  252.     );
  253.  
  254. NTSTATUS
  255. NTAPI
  256. LsaFreeReturnBuffer (
  257.     IN PVOID Buffer
  258.     );
  259.  
  260. NTSTATUS
  261. NTAPI
  262. LsaCallAuthenticationPackage (
  263.     IN HANDLE LsaHandle,
  264.     IN ULONG AuthenticationPackage,
  265.     IN PVOID ProtocolSubmitBuffer,
  266.     IN ULONG SubmitBufferLength,
  267.     OUT PVOID *ProtocolReturnBuffer,
  268.     OUT PULONG ReturnBufferLength,
  269.     OUT PNTSTATUS ProtocolStatus
  270.     );
  271.  
  272.  
  273. NTSTATUS
  274. NTAPI
  275. LsaDeregisterLogonProcess (
  276.     IN HANDLE LsaHandle
  277.     );
  278.  
  279. NTSTATUS
  280. NTAPI
  281. LsaConnectUntrusted (
  282.     OUT PHANDLE LsaHandle
  283.     );
  284.  
  285.  
  286. // end_ntifs
  287. #endif // _NTLSA_IFS_
  288.  
  289. ////////////////////////////////////////////////////////////////////////////
  290. //                                                                        //
  291. // Local Security Policy Administration API datatypes and defines         //
  292. //                                                                        //
  293. ////////////////////////////////////////////////////////////////////////////
  294.  
  295. //
  296. // Possible locations for the Ds policy
  297. //
  298. #define POLICY_MACHINE_POLICY_LOCAL                 0x0
  299. #define POLICY_MACHINE_POLICY_DEFAULTED             0x1
  300. #define POLICY_MACHINE_POLICY_EXPLICIT              0x2
  301. #define POLICY_MACHINE_POLICY_UNKNOWN               0xFFFFFFFF      // Internal flag only
  302.  
  303. //
  304. // Access types for the Policy object
  305. //
  306.  
  307. #define POLICY_VIEW_LOCAL_INFORMATION              0x00000001L
  308. #define POLICY_VIEW_AUDIT_INFORMATION              0x00000002L
  309. #define POLICY_GET_PRIVATE_INFORMATION             0x00000004L
  310. #define POLICY_TRUST_ADMIN                         0x00000008L
  311. #define POLICY_CREATE_ACCOUNT                      0x00000010L
  312. #define POLICY_CREATE_SECRET                       0x00000020L
  313. #define POLICY_CREATE_PRIVILEGE                    0x00000040L
  314. #define POLICY_SET_DEFAULT_QUOTA_LIMITS            0x00000080L
  315. #define POLICY_SET_AUDIT_REQUIREMENTS              0x00000100L
  316. #define POLICY_AUDIT_LOG_ADMIN                     0x00000200L
  317. #define POLICY_SERVER_ADMIN                        0x00000400L
  318. #define POLICY_LOOKUP_NAMES                        0x00000800L
  319.  
  320. #define POLICY_ALL_ACCESS     (STANDARD_RIGHTS_REQUIRED         |\
  321.                                POLICY_VIEW_LOCAL_INFORMATION    |\
  322.                                POLICY_VIEW_AUDIT_INFORMATION    |\
  323.                                POLICY_GET_PRIVATE_INFORMATION   |\
  324.                                POLICY_TRUST_ADMIN               |\
  325.                                POLICY_CREATE_ACCOUNT            |\
  326.                                POLICY_CREATE_SECRET             |\
  327.                                POLICY_CREATE_PRIVILEGE          |\
  328.                                POLICY_SET_DEFAULT_QUOTA_LIMITS  |\
  329.                                POLICY_SET_AUDIT_REQUIREMENTS    |\
  330.                                POLICY_AUDIT_LOG_ADMIN           |\
  331.                                POLICY_SERVER_ADMIN              |\
  332.                                POLICY_LOOKUP_NAMES )
  333.  
  334.  
  335. #define POLICY_READ           (STANDARD_RIGHTS_READ             |\
  336.                                POLICY_VIEW_AUDIT_INFORMATION    |\
  337.                                POLICY_GET_PRIVATE_INFORMATION)
  338.  
  339. #define POLICY_WRITE          (STANDARD_RIGHTS_WRITE            |\
  340.                                POLICY_TRUST_ADMIN               |\
  341.                                POLICY_CREATE_ACCOUNT            |\
  342.                                POLICY_CREATE_SECRET             |\
  343.                                POLICY_CREATE_PRIVILEGE          |\
  344.                                POLICY_SET_DEFAULT_QUOTA_LIMITS  |\
  345.                                POLICY_SET_AUDIT_REQUIREMENTS    |\
  346.                                POLICY_AUDIT_LOG_ADMIN           |\
  347.                                POLICY_SERVER_ADMIN)
  348.  
  349. #define POLICY_EXECUTE        (STANDARD_RIGHTS_EXECUTE          |\
  350.                                POLICY_VIEW_LOCAL_INFORMATION    |\
  351.                                POLICY_LOOKUP_NAMES )
  352.  
  353.  
  354. //
  355. // Policy object specific data types.
  356. //
  357.  
  358. //
  359. // The following data type is used to identify a domain
  360. //
  361.  
  362. typedef struct _LSA_TRUST_INFORMATION {
  363.  
  364.     LSA_UNICODE_STRING Name;
  365.     PSID Sid;
  366.  
  367. } LSA_TRUST_INFORMATION, *PLSA_TRUST_INFORMATION;
  368.  
  369. // where members have the following usage:
  370. //
  371. //     Name - The name of the domain.
  372. //
  373. //     Sid - A pointer to the Sid of the Domain
  374. //
  375.  
  376. //
  377. // The following data type is used in name and SID lookup services to
  378. // describe the domains referenced in the lookup operation.
  379. //
  380.  
  381. typedef struct _LSA_REFERENCED_DOMAIN_LIST {
  382.  
  383.     ULONG Entries;
  384.     PLSA_TRUST_INFORMATION Domains;
  385.  
  386. } LSA_REFERENCED_DOMAIN_LIST, *PLSA_REFERENCED_DOMAIN_LIST;
  387.  
  388. // where members have the following usage:
  389. //
  390. //     Entries - Is a count of the number of domains described in the
  391. //         Domains array.
  392. //
  393. //     Domains - Is a pointer to an array of Entries LSA_TRUST_INFORMATION data
  394. //         structures.
  395. //
  396.  
  397.  
  398. //
  399. // The following data type is used in name to SID lookup services to describe
  400. // the domains referenced in the lookup operation.
  401. //
  402.  
  403. typedef struct _LSA_TRANSLATED_SID {
  404.  
  405.     SID_NAME_USE Use;
  406.     ULONG RelativeId;
  407.     LONG DomainIndex;
  408.  
  409. } LSA_TRANSLATED_SID, *PLSA_TRANSLATED_SID;
  410.  
  411. // where members have the following usage:
  412. //
  413. //     Use - identifies the use of the SID.  If this value is SidUnknown or
  414. //         SidInvalid, then the remainder of the record is not set and
  415. //         should be ignored.
  416. //
  417. //     RelativeId - Contains the relative ID of the translated SID.  The
  418. //         remainder of the SID (the prefix) is obtained using the
  419. //         DomainIndex field.
  420. //
  421. //     DomainIndex - Is the index of an entry in a related
  422. //         LSA_REFERENCED_DOMAIN_LIST data structure describing the
  423. //         domain in which the account was found.
  424. //
  425. //         If there is no corresponding reference domain for an entry, then
  426. //         this field will contain a negative value.
  427. //
  428.  
  429.  
  430. //
  431. // The following data type is used in SID to name lookup services to
  432. // describe the domains referenced in the lookup operation.
  433. //
  434.  
  435. typedef struct _LSA_TRANSLATED_NAME {
  436.  
  437.     SID_NAME_USE Use;
  438.     LSA_UNICODE_STRING Name;
  439.     LONG DomainIndex;
  440.  
  441. } LSA_TRANSLATED_NAME, *PLSA_TRANSLATED_NAME;
  442.  
  443. // where the members have the following usage:
  444. //
  445. //     Use - Identifies the use of the name.  If this value is SidUnknown
  446. //         or SidInvalid, then the remainder of the record is not set and
  447. //         should be ignored.  If this value is SidWellKnownGroup then the
  448. //         Name field is invalid, but the DomainIndex field is not.
  449. //
  450. //     Name - Contains the isolated name of the translated SID.
  451. //
  452. //     DomainIndex - Is the index of an entry in a related
  453. //         LSA_REFERENCED_DOMAIN_LIST data structure describing the domain
  454. //         in which the account was found.
  455. //
  456. //         If there is no corresponding reference domain for an entry, then
  457. //         this field will contain a negative value.
  458. //
  459.  
  460.  
  461. //
  462. // The following data type is used to represent the role of the LSA
  463. // server (primary or backup).
  464. //
  465.  
  466. typedef enum _POLICY_LSA_SERVER_ROLE {
  467.  
  468.     PolicyServerRoleBackup = 2,
  469.     PolicyServerRolePrimary
  470.  
  471. } POLICY_LSA_SERVER_ROLE, *PPOLICY_LSA_SERVER_ROLE;
  472.  
  473.  
  474. //
  475. // The following data type is used to represent the state of the LSA
  476. // server (enabled or disabled).  Some operations may only be performed on
  477. // an enabled LSA server.
  478. //
  479.  
  480. typedef enum _POLICY_SERVER_ENABLE_STATE {
  481.  
  482.     PolicyServerEnabled = 2,
  483.     PolicyServerDisabled
  484.  
  485. } POLICY_SERVER_ENABLE_STATE, *PPOLICY_SERVER_ENABLE_STATE;
  486.  
  487.  
  488. //
  489. // The following data type is used to specify the auditing options for
  490. // an Audit Event Type.
  491. //
  492.  
  493. typedef ULONG POLICY_AUDIT_EVENT_OPTIONS, *PPOLICY_AUDIT_EVENT_OPTIONS;
  494.  
  495. // where the following flags can be set:
  496. //
  497. //     POLICY_AUDIT_EVENT_UNCHANGED - Leave existing auditing options
  498. //         unchanged for events of this type.  This flag is only used for
  499. //         set operations.  If this flag is set, then all other flags
  500. //         are ignored.
  501. //
  502. //     POLICY_AUDIT_EVENT_NONE - Cancel all auditing options for events
  503. //         of this type.  If this flag is set, the success/failure flags
  504. //         are ignored.
  505. //
  506. //     POLICY_AUDIT_EVENT_SUCCESS - When auditing is enabled, audit all
  507. //         successful occurrences of events of the given type.
  508. //
  509. //     POLICY_AUDIT_EVENT_FAILURE - When auditing is enabled, audit all
  510. //         unsuccessful occurrences of events of the given type.
  511. //
  512.  
  513.  
  514.  
  515. //
  516. // The following data type is used to return information about privileges
  517. // defined on a system.
  518. //
  519.  
  520. typedef struct _POLICY_PRIVILEGE_DEFINITION {
  521.  
  522.     LSA_UNICODE_STRING Name;
  523.     LUID LocalValue;
  524.  
  525. } POLICY_PRIVILEGE_DEFINITION, *PPOLICY_PRIVILEGE_DEFINITION;
  526.  
  527. // where the members have the following usage:
  528. //
  529. //     Name - Is the architected name of the privilege.  This is the
  530. //         primary key of the privilege and the only value that is
  531. //         transportable between systems.
  532. //
  533. //     Luid - is a LUID value assigned locally for efficient representation
  534. //         of the privilege.  Ths value is meaningful only on the system it
  535. //         was assigned on and is not transportable in any way.
  536. //
  537.  
  538.  
  539. //
  540. // The following data type defines the classes of Policy Information
  541. // that may be queried/set.
  542. //
  543.  
  544. typedef enum _POLICY_INFORMATION_CLASS {
  545.  
  546.     PolicyAuditLogInformation = 1,
  547.     PolicyAuditEventsInformation,
  548.     PolicyPrimaryDomainInformation,
  549.     PolicyPdAccountInformation,
  550.     PolicyAccountDomainInformation,
  551.     PolicyLsaServerRoleInformation,
  552.     PolicyReplicaSourceInformation,
  553.     PolicyDefaultQuotaInformation,
  554.     PolicyModificationInformation,
  555.     PolicyAuditFullSetInformation,
  556.     PolicyAuditFullQueryInformation,
  557.     PolicyDnsDomainInformation,
  558.     PolicyEfsInformation
  559.  
  560. } POLICY_INFORMATION_CLASS, *PPOLICY_INFORMATION_CLASS;
  561.  
  562.  
  563. //
  564. // The following data type corresponds to the PolicyAuditLogInformation
  565. // information class.  It is used to represent information relating to
  566. // the Audit Log.
  567. //
  568. // This structure may be used in both query and set operations.  However,
  569. // when used in set operations, some fields are ignored.
  570. //
  571.  
  572. typedef struct _POLICY_AUDIT_LOG_INFO {
  573.  
  574.     ULONG AuditLogPercentFull;
  575.     ULONG MaximumLogSize;
  576.     LARGE_INTEGER AuditRetentionPeriod;
  577.     BOOLEAN AuditLogFullShutdownInProgress;
  578.     LARGE_INTEGER TimeToShutdown;
  579.     ULONG NextAuditRecordId;
  580.  
  581. } POLICY_AUDIT_LOG_INFO, *PPOLICY_AUDIT_LOG_INFO;
  582.  
  583. // where the members have the following usage:
  584. //
  585. //     AuditLogPercentFull - Indicates the percentage of the Audit Log
  586. //         currently being used.
  587. //
  588. //     MaximumLogSize - Specifies the maximum size of the Audit Log in
  589. //         kilobytes.
  590. //
  591. //     AuditRetentionPeriod - Indicates the length of time that Audit
  592. //         Records are to be retained.  Audit Records are discardable
  593. //         if their timestamp predates the current time minus the
  594. //         retention period.
  595. //
  596. //     AuditLogFullShutdownInProgress - Indicates whether or not a system
  597. //         shutdown is being initiated due to the security Audit Log becoming
  598. //         full.  This condition will only occur if the system is configured
  599. //         to shutdown when the log becomes full.
  600. //
  601. //         TRUE indicates that a shutdown is in progress
  602. //         FALSE indicates that a shutdown is not in progress.
  603. //
  604. //         Once a shutdown has been initiated, this flag will be set to
  605. //         TRUE.  If an administrator is able to currect the situation
  606. //         before the shutdown becomes irreversible, then this flag will
  607. //         be reset to false.
  608. //
  609. //         This field is ignored for set operations.
  610. //
  611. //     TimeToShutdown - If the AuditLogFullShutdownInProgress flag is set,
  612. //         then this field contains the time left before the shutdown
  613. //         becomes irreversible.
  614. //
  615. //         This field is ignored for set operations.
  616. //
  617.  
  618.  
  619. //
  620. // The following data type corresponds to the PolicyAuditEventsInformation
  621. // information class.  It is used to represent information relating to
  622. // the audit requirements.
  623. //
  624.  
  625. typedef struct _POLICY_AUDIT_EVENTS_INFO {
  626.  
  627.     BOOLEAN AuditingMode;
  628.     PPOLICY_AUDIT_EVENT_OPTIONS EventAuditingOptions;
  629.     ULONG MaximumAuditEventCount;
  630.  
  631. } POLICY_AUDIT_EVENTS_INFO, *PPOLICY_AUDIT_EVENTS_INFO;
  632.  
  633. // where the members have the following usage:
  634. //
  635. //     AuditingMode - A Boolean variable specifying the Auditing Mode value.
  636. //         This value is interpreted as follows:
  637. //
  638. //         TRUE - Auditing is to be enabled (set operations) or is enabled
  639. //             (query operations).  Audit Records will be generated according
  640. //             to the Event Auditing Options in effect (see the
  641. //             EventAuditingOptions field.
  642. //
  643. //         FALSE - Auditing is to be disabled (set operations) or is
  644. //             disabled (query operations).  No Audit Records will be
  645. //             generated.  Note that for set operations the Event Auditing
  646. //             Options in effect will still be updated as specified by the
  647. //             EventAuditingOptions field whether Auditing is enabled or
  648. //             disabled.
  649. //
  650. //    EventAuditingOptions - Pointer to an array of Auditing Options
  651. //        indexed by Audit Event Type.
  652. //
  653. //    MaximumAuditEventCount - Specifiesa count of the number of Audit
  654. //        Event Types specified by the EventAuditingOptions parameter.  If
  655. //        this count is less than the number of Audit Event Types supported
  656. //        by the system, the Auditing Options for Event Types with IDs
  657. //        higher than (MaximumAuditEventCount + 1) are left unchanged.
  658. //
  659.  
  660.  
  661. //
  662. // The following structure corresponds to the PolicyAccountDomainInformation
  663. // information class.
  664. //
  665.  
  666. typedef struct _POLICY_ACCOUNT_DOMAIN_INFO {
  667.  
  668.     LSA_UNICODE_STRING DomainName;
  669.     PSID DomainSid;
  670.  
  671. } POLICY_ACCOUNT_DOMAIN_INFO, *PPOLICY_ACCOUNT_DOMAIN_INFO;
  672.  
  673. // where the members have the following usage:
  674. //
  675. //     DomainName - Is the name of the domain
  676. //
  677. //     DomainSid - Is the Sid of the domain
  678. //
  679.  
  680.  
  681. //
  682. // The following structure corresponds to the PolicyPrimaryDomainInformation
  683. // information class.
  684. //
  685.  
  686. typedef struct _POLICY_PRIMARY_DOMAIN_INFO {
  687.  
  688.     LSA_UNICODE_STRING Name;
  689.     PSID Sid;
  690.  
  691. } POLICY_PRIMARY_DOMAIN_INFO, *PPOLICY_PRIMARY_DOMAIN_INFO;
  692.  
  693. // where the members have the following usage:
  694. //
  695. //     Name - Is the name of the domain
  696. //
  697. //     Sid - Is the Sid of the domain
  698. //
  699.  
  700.  
  701. //
  702. // The following structure corresponds to the PolicyDnsDomainInformation
  703. // information class
  704. //
  705.  
  706. typedef struct _POLICY_DNS_DOMAIN_INFO
  707. {
  708.     LSA_UNICODE_STRING Name;
  709.     LSA_UNICODE_STRING DnsDomainName;
  710.     LSA_UNICODE_STRING DnsTreeName;
  711.     GUID DomainGuid;
  712.     PSID Sid;
  713.  
  714. } POLICY_DNS_DOMAIN_INFO, *PPOLICY_DNS_DOMAIN_INFO;
  715.  
  716. // where the members have the following usage:
  717. //
  718. //      Name - Is the name of the Domain
  719. //
  720. //      DnsDomainName - Is the DNS name of the domain
  721. //
  722. //      DnsTreeName - Is the DNS tree name of the domain
  723. //
  724. //      DomainGuid - Is the GUID of the domain
  725. //
  726. //      Sid - Is the Sid of the domain
  727.  
  728.  
  729. //
  730. // The following structure corresponds to the PolicyPdAccountInformation
  731. // information class.  This structure may be used in Query operations
  732. // only.
  733. //
  734.  
  735. typedef struct _POLICY_PD_ACCOUNT_INFO {
  736.  
  737.     LSA_UNICODE_STRING Name;
  738.  
  739. } POLICY_PD_ACCOUNT_INFO, *PPOLICY_PD_ACCOUNT_INFO;
  740.  
  741. // where the members have the following usage:
  742. //
  743. //     Name - Is the name of an account in the domain that should be used
  744. //         for authentication and name/ID lookup requests.
  745. //
  746.  
  747.  
  748. //
  749. // The following structure corresponds to the PolicyLsaServerRoleInformation
  750. // information class.
  751. //
  752.  
  753. typedef struct _POLICY_LSA_SERVER_ROLE_INFO {
  754.  
  755.     POLICY_LSA_SERVER_ROLE LsaServerRole;
  756.  
  757. } POLICY_LSA_SERVER_ROLE_INFO, *PPOLICY_LSA_SERVER_ROLE_INFO;
  758.  
  759. // where the fields have the following usage:
  760. //
  761. // TBS
  762. //
  763.  
  764.  
  765. //
  766. // The following structure corresponds to the PolicyReplicaSourceInformation
  767. // information class.
  768. //
  769.  
  770. typedef struct _POLICY_REPLICA_SOURCE_INFO {
  771.  
  772.     LSA_UNICODE_STRING ReplicaSource;
  773.     LSA_UNICODE_STRING ReplicaAccountName;
  774.  
  775. } POLICY_REPLICA_SOURCE_INFO, *PPOLICY_REPLICA_SOURCE_INFO;
  776.  
  777.  
  778. //
  779. // The following structure corresponds to the PolicyDefaultQuotaInformation
  780. // information class.
  781. //
  782.  
  783. typedef struct _POLICY_DEFAULT_QUOTA_INFO {
  784.  
  785.     QUOTA_LIMITS QuotaLimits;
  786.  
  787. } POLICY_DEFAULT_QUOTA_INFO, *PPOLICY_DEFAULT_QUOTA_INFO;
  788.  
  789.  
  790. //
  791. // The following structure corresponds to the PolicyModificationInformation
  792. // information class.
  793. //
  794.  
  795. typedef struct _POLICY_MODIFICATION_INFO {
  796.  
  797.     LARGE_INTEGER ModifiedId;
  798.     LARGE_INTEGER DatabaseCreationTime;
  799.  
  800. } POLICY_MODIFICATION_INFO, *PPOLICY_MODIFICATION_INFO;
  801.  
  802. // where the members have the following usage:
  803. //
  804. //     ModifiedId - Is a 64-bit unsigned integer that is incremented each
  805. //         time anything in the LSA database is modified.  This value is
  806. //         only modified on Primary Domain Controllers.
  807. //
  808. //     DatabaseCreationTime - Is the date/time that the LSA Database was
  809. //         created.  On Backup Domain Controllers, this value is replicated
  810. //         from the Primary Domain Controller.
  811. //
  812.  
  813. //
  814. // The following structure type corresponds to the PolicyAuditFullSetInformation
  815. // Information Class.
  816. //
  817.  
  818. typedef struct _POLICY_AUDIT_FULL_SET_INFO {
  819.  
  820.     BOOLEAN ShutDownOnFull;
  821.  
  822. } POLICY_AUDIT_FULL_SET_INFO, *PPOLICY_AUDIT_FULL_SET_INFO;
  823.  
  824. //
  825. // The following structure type corresponds to the PolicyAuditFullQueryInformation
  826. // Information Class.
  827. //
  828.  
  829. typedef struct _POLICY_AUDIT_FULL_QUERY_INFO {
  830.  
  831.     BOOLEAN ShutDownOnFull;
  832.     BOOLEAN LogIsFull;
  833.  
  834. } POLICY_AUDIT_FULL_QUERY_INFO, *PPOLICY_AUDIT_FULL_QUERY_INFO;
  835.  
  836. //
  837. // The following structure corresponds to the PolicyEfsInformation
  838. // information class
  839. //
  840.  
  841. typedef struct _POLICY_EFS_INFO {
  842.  
  843.     ULONG   InfoLength;
  844.     PUCHAR  EfsBlob;
  845.  
  846. } POLICY_EFS_INFO, *PPOLICY_EFS_INFO;
  847.  
  848. // where the members have the following usage:
  849. //
  850. //      InfoLength - Length of the EFS Information blob
  851. //
  852. //      EfsBlob - Efs blob data
  853. //
  854.  
  855.  
  856. //
  857. // The following data type defines the classes of Policy Information
  858. // that may be queried/set for the local machine.
  859. //
  860.  
  861. typedef enum _POLICY_LOCAL_INFORMATION_CLASS {
  862.  
  863.     PolicyLocalAuditEventsInformation = 1,
  864.     PolicyLocalPdAccountInformation,
  865.     PolicyLocalAccountDomainInformation,
  866.     PolicyLocalLsaServerRoleInformation,
  867.     PolicyLocalReplicaSourceInformation,
  868.     PolicyLocalModificationInformation,
  869.     PolicyLocalAuditFullSetInformation,
  870.     PolicyLocalAuditFullQueryInformation,
  871.     PolicyLocalDnsDomainInformation,
  872.     PolicyLocalIPSecReferenceInformation,
  873.     PolicyLocalMachinePasswordInformation,
  874.     PolicyLocalQualityOfServiceInformation,
  875.     PolicyLocalPolicyLocationInformation
  876.  
  877. } POLICY_LOCAL_INFORMATION_CLASS, *PPOLICY_LOCAL_INFORMATION_CLASS;
  878.  
  879.  
  880.  
  881. //
  882. // The following data type corresponds to the PolicyLocalIPSecReferenceInformation
  883. // information class.  It is used to represent information relating to
  884. // the IPSec object reference.
  885. //
  886. // This structure may be used in both query and set operations.  However,
  887. // when used in set operations, some fields are ignored.
  888. //
  889.  
  890. typedef struct _POLICY_LOCAL_IPSEC_REFERENCE_INFO {
  891.  
  892.     LSA_UNICODE_STRING ObjectPath;
  893.  
  894. } POLICY_LOCAL_IPSEC_REFERENCE_INFO, *PPOLICY_LOCAL_IPSEC_REFERENCE_INFO;
  895.  
  896. // where the members have the following usage:
  897. //
  898. //     ObjectPath - A unicode string giving the Ds path to the object
  899. //
  900. //     ObjectId - Specifies the GUID of the object
  901. //
  902.  
  903. //
  904. // Machine password information.  Corresponds to PolicyLocalMachinePasswordInformation
  905. //
  906. typedef struct _POLICY_LOCAL_MACHINE_PASSWORD_INFO {
  907.  
  908.     LARGE_INTEGER PasswordChangeInterval;
  909.  
  910. } POLICY_LOCAL_MACHINE_PASSWORD_INFO, *PPOLICY_LOCAL_MACHINE_PASSWORD_INFO;
  911.  
  912. //
  913. // where the members have the following usage:
  914. //
  915. //  PasswordChangeInterval - Duration between password changes
  916. //
  917.  
  918. //
  919. // Policy location information.  Corresponds to PolicyLocalPolicyLocationInformation
  920. //
  921. #define POLICY_LOCATION_LOCAL   1
  922. #define POLICY_LOCATION_DS      2
  923.  
  924. typedef struct _POLICY_LOCAL_POLICY_LOCATION_INFO {
  925.  
  926.     ULONG PolicyLocation;
  927.  
  928. } POLICY_LOCAL_POLICY_LOCATION_INFO, *PPOLICY_LOCAL_POLICY_LOCATION_INFO;
  929.  
  930. //
  931. // QualityOfService information.  Corresponds to PolicyLocalQualityOfServiceInformation
  932. //
  933.  
  934. #define POLICY_QOS_SCHANEL_REQUIRED             0x00000001
  935. #define POLICY_QOS_OUTBOUND_INTEGRITY           0x00000002
  936. #define POLICY_QOS_OUTBOUND_CONFIDENTIALITY     0x00000004
  937. #define POLICY_QOS_INBOUND_INTEGREITY           0x00000008
  938. #define POLICY_QOS_INBOUND_CONFIDENTIALITY      0x00000010
  939. #define POLICY_QOS_ALLOW_LOCAL_ROOT_CERT_STORE  0x00000020
  940. #define POLICY_QOS_RAS_SERVER_ALLOWED           0x00000040
  941. #define POLICY_QOS_DHCP_SERVER_ALLOWD           0x00000080
  942. //
  943. // Bits 0x00000100 through 0xFFFFFFFF are reserved for future use.
  944. //
  945. typedef struct _POLICY_LOCAL_QUALITY_OF_SERVICE_INFO {
  946.  
  947.     ULONG QualityOfService;
  948.  
  949. } POLICY_LOCAL_QUALITY_OF_SERVICE_INFO, *PPOLICY_LOCAL_QUALITY_OF_SERVICE_INFO;
  950. //
  951. // where the members have the following usage:
  952. //
  953. //  QualityOfService - Determines what specific QOS actions a machine should take
  954. //
  955.  
  956. //
  957. // The following data type defines the classes of Policy Information
  958. // that may be queried/set that has domain wide effect.
  959. //
  960.  
  961. typedef enum _POLICY_DOMAIN_INFORMATION_CLASS {
  962.  
  963.     PolicyDomainIPSecReferenceInformation = 1,
  964.     PolicyDomainQualityOfServiceInformation,
  965.     PolicyDomainEfsInformation,
  966.     PolicyDomainPublicKeyInformation,
  967.     PolicyDomainPasswordPolicyInformation,
  968.     PolicyDomainLockoutInformation,
  969.     PolicyDomainKerberosTicketInformation
  970.  
  971. } POLICY_DOMAIN_INFORMATION_CLASS, *PPOLICY_DOMAIN_INFORMATION_CLASS;
  972.  
  973. typedef struct _POLICY_LOCAL_QUALITY_OF_SERVICE_INFO POLICY_DOMAIN_QUALITY_OF_SERVICE_INFO;
  974. typedef struct _POLICY_LOCAL_QUALITY_OF_SERVICE_INFO *PPOLICY_DOMAIN_QUALITY_OF_SERVICE_INFO;
  975.  
  976. //
  977. // The following structure corresponds to the PolicyDomainPublicKeyInformation
  978. // information class
  979. //
  980.  
  981. typedef struct _POLICY_DOMAIN_PUBLIC_KEY_INFO {
  982.  
  983.     ULONG   InfoLength;
  984.     PUCHAR  PublicKeyInfo;
  985.  
  986. } POLICY_DOMAIN_PUBLIC_KEY_INFO, *PPOLICY_DOMAIN_PUBLIC_KEY_INFO;
  987.  
  988. // where the members have the following usage:
  989. //
  990. //      InfoLength - Length of the PublicKey Information blob
  991. //
  992. //      PublicKeyInfo - PublicKey information blob
  993. //
  994.  
  995. //
  996. // The following structure corresponds to the PolicyDomainLockoutInformation
  997. // information class
  998. //
  999.  
  1000. typedef struct _POLICY_DOMAIN_LOCKOUT_INFO {
  1001.  
  1002.     LARGE_INTEGER               LockoutDuration;          //Must be a Delta time
  1003.     LARGE_INTEGER               LockoutObservationWindow; //Must be a Delta time
  1004.     USHORT                      LockoutThreshold;         //Zero means no lockout
  1005.  
  1006. } POLICY_DOMAIN_LOCKOUT_INFO, *PPOLICY_DOMAIN_LOCKOUT_INFO;
  1007.  
  1008. //
  1009. // The following structure corresponds to the PolicyPasswordPolicyInformation
  1010. //
  1011.  
  1012. typedef struct _POLICY_DOMAIN_PASSWORD_INFO {
  1013.  
  1014.     USHORT MinPasswordLength;
  1015.     USHORT PasswordHistoryLength;
  1016.     ULONG PasswordProperties;
  1017.     LARGE_INTEGER MaxPasswordAge;
  1018.     LARGE_INTEGER MinPasswordAge;
  1019.  
  1020. } POLICY_DOMAIN_PASSWORD_INFO, *PPOLICY_DOMAIN_PASSWORD_INFO;
  1021.  
  1022. //
  1023. // The following structure corresponds to the PolicyDomainKerberosTicketInformation
  1024. // information class
  1025.  
  1026. #define POLICY_KERBEROS_FORWARDABLE     0x00000001
  1027. #define POLICY_KERBEROS_PROXYABLE       0x00000002
  1028. #define POLICY_KERBEROS_RENEWABLE       0x00000004
  1029. #define POLICY_KERBEROS_POSTDATEABLE    0x00000008
  1030. typedef struct _POLICY_DOMAIN_KERBEROS_TICKET_INFO {
  1031.  
  1032.     ULONG AuthenticationOptions;
  1033.     LARGE_INTEGER MinTicketAge;
  1034.     LARGE_INTEGER MaxTicketAge;
  1035.     LARGE_INTEGER MaxRenewAge;
  1036.     LARGE_INTEGER ProxyLifetime;
  1037.     LARGE_INTEGER ForceLogoff;
  1038. } POLICY_DOMAIN_KERBEROS_TICKET_INFO, *PPOLICY_DOMAIN_KERBEROS_TICKET_INFO;
  1039.  
  1040. //
  1041. // where the members have the following usage
  1042. //
  1043. //      AuthenticationOptions -- allowed ticket options (POLICY_KERBEROS_* flags )
  1044. //
  1045. //      MinTicketAge -- Minimum lifetime for a ticket
  1046. //
  1047. //      MaxTicketAge -- Maximum lifetime for a ticket
  1048. //
  1049. //      MaxRenewAge -- Maximum cumulative age a renewable ticket can be with
  1050. //                     requring authentication
  1051. //
  1052. //      ProxyLifetime -- Maximum lifetime for a proxy tickey
  1053. //
  1054. //      ForceLogoff -- Maximum duration before forcing a user to logoff whose ticket has
  1055. //                     expired.
  1056.  
  1057.  
  1058. //
  1059. // LSA RPC Context Handle (Opaque form).  Note that a Context Handle is
  1060. // always a pointer type unlike regular handles.
  1061. //
  1062.  
  1063. typedef PVOID LSA_HANDLE, *PLSA_HANDLE;
  1064.  
  1065.  
  1066. //
  1067. // Trusted Domain Object specific data types
  1068. //
  1069.  
  1070. //
  1071. // This data type defines the following information classes that may be
  1072. // queried or set.
  1073. //
  1074.  
  1075. typedef enum _TRUSTED_INFORMATION_CLASS {
  1076.  
  1077.     TrustedDomainNameInformation = 1,
  1078.     TrustedControllersInformation,
  1079.     TrustedPosixOffsetInformation,
  1080.     TrustedPasswordInformation,
  1081.     TrustedDomainInformationBasic,
  1082.     TrustedDomainInformationEx,
  1083.     TrustedDomainAuthInformation,
  1084.     TrustedDomainFullInformation
  1085.  
  1086. } TRUSTED_INFORMATION_CLASS, *PTRUSTED_INFORMATION_CLASS;
  1087.  
  1088. //
  1089. // The following data type corresponds to the TrustedDomainNameInformation
  1090. // information class.
  1091. //
  1092.  
  1093. typedef struct _TRUSTED_DOMAIN_NAME_INFO {
  1094.  
  1095.     LSA_UNICODE_STRING Name;
  1096.  
  1097. } TRUSTED_DOMAIN_NAME_INFO, *PTRUSTED_DOMAIN_NAME_INFO;
  1098.  
  1099. // where members have the following meaning:
  1100. //
  1101. // Name - The name of the Trusted Domain.
  1102. //
  1103.  
  1104. //
  1105. // The following data type corresponds to the TrustedControllersInformation
  1106. // information class.
  1107. //
  1108.  
  1109. typedef struct _TRUSTED_CONTROLLERS_INFO {
  1110.  
  1111.     ULONG Entries;
  1112.     PLSA_UNICODE_STRING Names;
  1113.  
  1114. } TRUSTED_CONTROLLERS_INFO, *PTRUSTED_CONTROLLERS_INFO;
  1115.  
  1116. // where members have the following meaning:
  1117. //
  1118. // Entries - Indicate how mamy entries there are in the Names array.
  1119. //
  1120. // Names - Pointer to an array of LSA_UNICODE_STRING structures containing the
  1121. //     names of domain controllers of the domain.  This information may not
  1122. //     be accurate and should be used only as a hint.  The order of this
  1123. //     list is considered significant and will be maintained.
  1124. //
  1125. //     By convention, the first name in this list is assumed to be the
  1126. //     Primary Domain Controller of the domain.  If the Primary Domain
  1127. //     Controller is not known, the first name should be set to the NULL
  1128. //     string.
  1129. //
  1130.  
  1131.  
  1132. //
  1133. // The following data type corresponds to the TrustedPosixOffsetInformation
  1134. // information class.
  1135. //
  1136.  
  1137. typedef struct _TRUSTED_POSIX_OFFSET_INFO {
  1138.  
  1139.     ULONG Offset;
  1140.  
  1141. } TRUSTED_POSIX_OFFSET_INFO, *PTRUSTED_POSIX_OFFSET_INFO;
  1142.  
  1143. // where members have the following meaning:
  1144. //
  1145. // Offset - Is an offset to use for the generation of Posix user and group
  1146. //     IDs from SIDs.  The Posix ID corresponding to any particular SID is
  1147. //     generated by adding the RID of that SID to the Offset of the SID's
  1148. //     corresponding TrustedDomain object.
  1149. //
  1150.  
  1151. //
  1152. // The following data type corresponds to the TrustedPasswordInformation
  1153. // information class.
  1154. //
  1155.  
  1156. typedef struct _TRUSTED_PASSWORD_INFO {
  1157.     LSA_UNICODE_STRING Password;
  1158.     LSA_UNICODE_STRING OldPassword;
  1159. } TRUSTED_PASSWORD_INFO, *PTRUSTED_PASSWORD_INFO;
  1160.  
  1161.  
  1162. typedef  LSA_TRUST_INFORMATION TRUSTED_DOMAIN_INFORMATION_BASIC;
  1163.  
  1164. typedef PLSA_TRUST_INFORMATION *PTRUSTED_DOMAIN_INFORMATION_BASIC;
  1165.  
  1166. //
  1167. // Direction of the trust
  1168. //
  1169. #define TRUST_DIRECTION_DISABLED        0x00000000
  1170. #define TRUST_DIRECTION_INBOUND         0x00000001
  1171. #define TRUST_DIRECTION_OUTBOUND        0x00000002
  1172. #define TRUST_DIRECTION_BIDIRECTIONAL   (TRUST_DIRECTION_INBOUND | TRUST_DIRECTION_OUTBOUND)
  1173.  
  1174. #define TRUST_TYPE_DOWNLEVEL            0x00000001  // NT4 and before
  1175. #define TRUST_TYPE_UPLEVEL              0x00000002  // NT5
  1176. #define TRUST_TYPE_MIT                  0x00000003  // Trust with a MIT Kerberos realm
  1177. #define TRUST_TYPE_DCE                  0x00000004  // Trust with a DCE realm
  1178. // Levels 0x5 - 0x000FFFFF reserved for future use
  1179. // Provider specific trust levels are from 0x00100000 to 0xFFF00000
  1180.  
  1181. #define TRUST_ATTRIBUTE_NON_TRANSITIVE  0x00000001  // Disallow transitivity
  1182. #define TRUST_ATTRIBUTE_UPLEVEL_ONLY    0x00000002  // Trust link only valid
  1183.                                                     // for uplevel client
  1184. #define TRUST_ATTRIBUTE_TREE_PARENT     0x00400000  // Denotes that we are setting the trust
  1185.                                                     // to our parent in the org tree...
  1186. // Trust attributes 0x00000004 through 0x004FFFFFFF reserved for future use
  1187. // Trust attributes 0x00F00000 through 0x00400000 are reserved for internal use
  1188. // Trust attributes 0x01000000 through 0xFF000000 are reserved for user
  1189. // defined values
  1190. #define TRUST_ATTRIBUTES_VALID  0xFF02FFFF
  1191.  
  1192.  
  1193. typedef struct _TRUSTED_DOMAIN_INFORMATION_EX {
  1194.  
  1195.     LSA_UNICODE_STRING Name;
  1196.     LSA_UNICODE_STRING FlatName;
  1197.     PSID  Sid;
  1198.     ULONG TrustDirection;
  1199.     ULONG TrustType;
  1200.     ULONG TrustAttributes;
  1201.  
  1202. } TRUSTED_DOMAIN_INFORMATION_EX, *PTRUSTED_DOMAIN_INFORMATION_EX;
  1203.  
  1204. //
  1205. // Type of authentication information
  1206. //
  1207. #define TRUST_AUTH_TYPE_NONE    0   // Ignore this entry
  1208. #define TRUST_AUTH_TYPE_NT4OWF  1   // NT4 OWF password
  1209. #define TRUST_AUTH_TYPE_CLEAR   2   // Cleartext password
  1210.  
  1211. typedef struct _LSA_AUTH_INFORMATION {
  1212.  
  1213.     LARGE_INTEGER LastUpdateTime;
  1214.     ULONG AuthType;
  1215.     ULONG AuthInfoLength;
  1216.     PUCHAR AuthInfo;
  1217. } LSA_AUTH_INFORMATION, *PLSA_AUTH_INFORMATION;
  1218.  
  1219. typedef struct _TRUSTED_DOMAIN_AUTH_INFORMATION {
  1220.  
  1221.     ULONG IncomingAuthInfos;
  1222.     PLSA_AUTH_INFORMATION   IncomingAuthenticationInformation;
  1223.     PLSA_AUTH_INFORMATION   IncomingPreviousAuthenticationInformation;
  1224.     ULONG OutgoingAuthInfos;
  1225.     PLSA_AUTH_INFORMATION   OutgoingAuthenticationInformation;
  1226.     PLSA_AUTH_INFORMATION   OutgoingPreviousAuthenticationInformation;
  1227.  
  1228. } TRUSTED_DOMAIN_AUTH_INFORMATION, *PTRUSTED_DOMAIN_AUTH_INFORMATION;
  1229.  
  1230. typedef struct _TRUSTED_DOMAIN_FULL_INFORMATION {
  1231.  
  1232.     TRUSTED_DOMAIN_INFORMATION_EX   Information;
  1233.     TRUSTED_POSIX_OFFSET_INFO       PosixOffset;
  1234.     TRUSTED_DOMAIN_AUTH_INFORMATION AuthInformation;
  1235.  
  1236. } TRUSTED_DOMAIN_FULL_INFORMATION, *PTRUSTED_DOMAIN_FULL_INFORMATION;
  1237.  
  1238.  
  1239.  
  1240. //
  1241. // LSA Enumeration Context
  1242. //
  1243.  
  1244. typedef ULONG LSA_ENUMERATION_HANDLE, *PLSA_ENUMERATION_HANDLE;
  1245.  
  1246. //
  1247. // LSA Enumeration Information
  1248. //
  1249.  
  1250. typedef struct _LSA_ENUMERATION_INFORMATION {
  1251.  
  1252.     PSID Sid;
  1253.  
  1254. } LSA_ENUMERATION_INFORMATION, *PLSA_ENUMERATION_INFORMATION;
  1255.  
  1256.  
  1257. ////////////////////////////////////////////////////////////////////////////
  1258. //                                                                        //
  1259. // Local Security Policy - Miscellaneous API function prototypes          //
  1260. //                                                                        //
  1261. ////////////////////////////////////////////////////////////////////////////
  1262.  
  1263.  
  1264. NTSTATUS
  1265. NTAPI
  1266. LsaFreeMemory(
  1267.     IN PVOID Buffer
  1268.     );
  1269.  
  1270. NTSTATUS
  1271. NTAPI
  1272. LsaClose(
  1273.     IN LSA_HANDLE ObjectHandle
  1274.     );
  1275.  
  1276. NTSTATUS
  1277. NTAPI
  1278. LsaOpenPolicy(
  1279.     IN PLSA_UNICODE_STRING SystemName OPTIONAL,
  1280.     IN PLSA_OBJECT_ATTRIBUTES ObjectAttributes,
  1281.     IN ACCESS_MASK DesiredAccess,
  1282.     IN OUT PLSA_HANDLE PolicyHandle
  1283.     );
  1284.  
  1285. NTSTATUS
  1286. NTAPI
  1287. LsaQueryInformationPolicy(
  1288.     IN LSA_HANDLE PolicyHandle,
  1289.     IN POLICY_INFORMATION_CLASS InformationClass,
  1290.     OUT PVOID *Buffer
  1291.     );
  1292.  
  1293. NTSTATUS
  1294. NTAPI
  1295. LsaSetInformationPolicy(
  1296.     IN LSA_HANDLE PolicyHandle,
  1297.     IN POLICY_INFORMATION_CLASS InformationClass,
  1298.     IN PVOID Buffer
  1299.     );
  1300.  
  1301. NTSTATUS
  1302. NTAPI
  1303. LsaQueryLocalInformationPolicy(
  1304.     IN LSA_HANDLE PolicyHandle,
  1305.     IN POLICY_LOCAL_INFORMATION_CLASS InformationClass,
  1306.     OUT PVOID *Buffer
  1307.     );
  1308.  
  1309. NTSTATUS
  1310. NTAPI
  1311. LsaSetLocalInformationPolicy(
  1312.     IN LSA_HANDLE PolicyHandle,
  1313.     IN POLICY_LOCAL_INFORMATION_CLASS InformationClass,
  1314.     IN PVOID Buffer
  1315.     );
  1316.  
  1317. NTSTATUS
  1318. NTAPI
  1319. LsaQueryDomainInformationPolicy(
  1320.     IN LSA_HANDLE PolicyHandle,
  1321.     IN POLICY_DOMAIN_INFORMATION_CLASS InformationClass,
  1322.     OUT PVOID *Buffer
  1323.     );
  1324.  
  1325. NTSTATUS
  1326. NTAPI
  1327. LsaSetDomainInformationPolicy(
  1328.     IN LSA_HANDLE PolicyHandle,
  1329.     IN POLICY_DOMAIN_INFORMATION_CLASS InformationClass,
  1330.     IN PVOID Buffer
  1331.     );
  1332.  
  1333.  
  1334. NTSTATUS
  1335. NTAPI
  1336. LsaEnumerateTrustedDomains(
  1337.     IN LSA_HANDLE PolicyHandle,
  1338.     IN OUT PLSA_ENUMERATION_HANDLE EnumerationContext,
  1339.     OUT PVOID *Buffer,
  1340.     IN ULONG PreferedMaximumLength,
  1341.     OUT PULONG CountReturned
  1342.     );
  1343.  
  1344.  
  1345. NTSTATUS
  1346. NTAPI
  1347. LsaLookupNames(
  1348.     IN LSA_HANDLE PolicyHandle,
  1349.     IN ULONG Count,
  1350.     IN PLSA_UNICODE_STRING Names,
  1351.     OUT PLSA_REFERENCED_DOMAIN_LIST *ReferencedDomains,
  1352.     OUT PLSA_TRANSLATED_SID *Sids
  1353.     );
  1354.  
  1355. NTSTATUS
  1356. NTAPI
  1357. LsaLookupSids(
  1358.     IN LSA_HANDLE PolicyHandle,
  1359.     IN ULONG Count,
  1360.     IN PSID *Sids,
  1361.     OUT PLSA_REFERENCED_DOMAIN_LIST *ReferencedDomains,
  1362.     OUT PLSA_TRANSLATED_NAME *Names
  1363.     );
  1364.  
  1365.  
  1366.  
  1367. #define SE_INTERACTIVE_LOGON_NAME       TEXT("SeInteractiveLogonRight")
  1368. #define SE_NETWORK_LOGON_NAME           TEXT("SeNetworkLogonRight")
  1369. #define SE_BATCH_LOGON_NAME             TEXT("SeBatchLogonRight")
  1370. #define SE_SERVICE_LOGON_NAME           TEXT("SeServiceLogonRight")
  1371.  
  1372. //
  1373. // This new API returns all the accounts with a certain privilege
  1374. //
  1375.  
  1376. NTSTATUS
  1377. NTAPI
  1378. LsaEnumerateAccountsWithUserRight(
  1379.     IN LSA_HANDLE PolicyHandle,
  1380.     IN OPTIONAL PLSA_UNICODE_STRING UserRights,
  1381.     OUT PVOID *EnumerationBuffer,
  1382.     OUT PULONG CountReturned
  1383.     );
  1384.  
  1385. //
  1386. // These new APIs differ by taking a SID instead of requiring the caller
  1387. // to open the account first and passing in an account handle
  1388. //
  1389.  
  1390. NTSTATUS
  1391. NTAPI
  1392. LsaEnumerateAccountRights(
  1393.     IN LSA_HANDLE PolicyHandle,
  1394.     IN PSID AccountSid,
  1395.     OUT PLSA_UNICODE_STRING *UserRights,
  1396.     OUT PULONG CountOfRights
  1397.     );
  1398.  
  1399. NTSTATUS
  1400. NTAPI
  1401. LsaAddAccountRights(
  1402.     IN LSA_HANDLE PolicyHandle,
  1403.     IN PSID AccountSid,
  1404.     IN PLSA_UNICODE_STRING UserRights,
  1405.     IN ULONG CountOfRights
  1406.     );
  1407.  
  1408. NTSTATUS
  1409. NTAPI
  1410. LsaRemoveAccountRights(
  1411.     IN LSA_HANDLE PolicyHandle,
  1412.     IN PSID AccountSid,
  1413.     IN BOOLEAN AllRights,
  1414.     IN PLSA_UNICODE_STRING UserRights,
  1415.     IN ULONG CountOfRights
  1416.     );
  1417.  
  1418.  
  1419. ///////////////////////////////////////////////////////////////////////////////
  1420. //                                                                           //
  1421. // Local Security Policy - Trusted Domain Object API function prototypes     //
  1422. //                                                                           //
  1423. ///////////////////////////////////////////////////////////////////////////////
  1424.  
  1425. NTSTATUS
  1426. NTAPI
  1427. LsaQueryTrustedDomainInfo(
  1428.     IN LSA_HANDLE PolicyHandle,
  1429.     IN PSID TrustedDomainSid,
  1430.     IN TRUSTED_INFORMATION_CLASS InformationClass,
  1431.     OUT PVOID *Buffer
  1432.     );
  1433.  
  1434. NTSTATUS
  1435. NTAPI
  1436. LsaSetTrustedDomainInformation(
  1437.     IN LSA_HANDLE PolicyHandle,
  1438.     IN PSID TrustedDomainSid,
  1439.     IN TRUSTED_INFORMATION_CLASS InformationClass,
  1440.     IN PVOID Buffer
  1441.     );
  1442.  
  1443. NTSTATUS
  1444. NTAPI
  1445. LsaDeleteTrustedDomain(
  1446.     IN LSA_HANDLE PolicyHandle,
  1447.     IN PSID TrustedDomainSid
  1448.     );
  1449.  
  1450. NTSTATUS
  1451. NTAPI
  1452. LsaQueryTrustedDomainInfoByName(
  1453.     IN LSA_HANDLE PolicyHandle,
  1454.     IN PLSA_UNICODE_STRING TrustedDomainName,
  1455.     IN TRUSTED_INFORMATION_CLASS InformationClass,
  1456.     OUT PVOID *Buffer
  1457.     );
  1458.  
  1459. NTSTATUS
  1460. NTAPI
  1461. LsaSetTrustedDomainInfoByName(
  1462.     IN LSA_HANDLE PolicyHandle,
  1463.     IN PLSA_UNICODE_STRING TrustedDomainName,
  1464.     IN TRUSTED_INFORMATION_CLASS InformationClass,
  1465.     IN PVOID Buffer
  1466.     );
  1467.  
  1468. NTSTATUS
  1469. NTAPI
  1470. LsaEnumerateTrustedDomainsEx(
  1471.     IN LSA_HANDLE PolicyHandle,
  1472.     IN OUT PLSA_ENUMERATION_HANDLE EnumerationContext,
  1473.     IN TRUSTED_INFORMATION_CLASS InformationClass,
  1474.     OUT PVOID *Buffer,
  1475.     IN ULONG PreferedMaximumLength,
  1476.     OUT PULONG CountReturned
  1477.     );
  1478.  
  1479. NTSTATUS
  1480. NTAPI
  1481. LsaCreateTrustedDomainEx(
  1482.     IN LSA_HANDLE PolicyHandle,
  1483.     IN PTRUSTED_DOMAIN_INFORMATION_EX TrustedDomainInformation,
  1484.     IN PTRUSTED_DOMAIN_AUTH_INFORMATION AuthenticationInformation,
  1485.     IN ACCESS_MASK DesiredAccess,
  1486.     OUT PLSA_HANDLE TrustedDomainHandle
  1487.     );
  1488.  
  1489.  
  1490. //
  1491. // This API sets the workstation password (equivalent of setting/getting
  1492. // the SSI_SECRET_NAME secret)
  1493. //
  1494.  
  1495. NTSTATUS
  1496. NTAPI
  1497. LsaStorePrivateData(
  1498.     IN LSA_HANDLE PolicyHandle,
  1499.     IN PLSA_UNICODE_STRING KeyName,
  1500.     IN PLSA_UNICODE_STRING PrivateData
  1501.     );
  1502.  
  1503. NTSTATUS
  1504. NTAPI
  1505. LsaRetrievePrivateData(
  1506.     IN LSA_HANDLE PolicyHandle,
  1507.     IN PLSA_UNICODE_STRING KeyName,
  1508.     OUT PLSA_UNICODE_STRING * PrivateData
  1509.     );
  1510.  
  1511.  
  1512. ULONG
  1513. NTAPI
  1514. LsaNtStatusToWinError(
  1515.     NTSTATUS Status
  1516.     );
  1517.  
  1518. //
  1519. // Define a symbol so we can tell if ntifs.h has been included.
  1520. //
  1521.  
  1522. // begin_ntifs
  1523. #ifndef _NTLSA_IFS_
  1524. #define _NTLSA_IFS_
  1525. #endif
  1526. // end_ntifs
  1527.  
  1528. #ifndef _NTDEF_
  1529. typedef LSA_UNICODE_STRING UNICODE_STRING, *PUNICODE_STRING;
  1530. #endif
  1531.  
  1532. typedef NTSTATUS (*PSAM_PASSWORD_NOTIFICATION_ROUTINE) (
  1533.     PUNICODE_STRING UserName,
  1534.     ULONG RelativeId,
  1535.     PUNICODE_STRING NewPassword
  1536. );
  1537.  
  1538. #define SAM_PASSWORD_CHANGE_NOTIFY_ROUTINE  "PasswordChangeNotify"
  1539.  
  1540. typedef BOOLEAN (*PSAM_INIT_NOTIFICATION_ROUTINE) (
  1541. );
  1542.  
  1543. #define SAM_INIT_NOTIFICATION_ROUTINE  "InitializeChangeNotify"
  1544.  
  1545.  
  1546. #define SAM_PASSWORD_FILTER_ROUTINE  "PasswordFilter"
  1547.  
  1548. typedef BOOLEAN (*PSAM_PASSWORD_FILTER_ROUTINE) (
  1549.     IN PUNICODE_STRING  AccountName,
  1550.     IN PUNICODE_STRING  FullName,
  1551.     IN PUNICODE_STRING Password,
  1552.     IN BOOLEAN SetOperation
  1553.     );
  1554.  
  1555.  
  1556. #ifdef __cplusplus
  1557. }
  1558. #endif
  1559.  
  1560. #pragma option pop /*P_O_Pop*/
  1561. #endif /* _NTSECAPI_ */
  1562.  
  1563.