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