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

3021 lines
89 KiB

  1. /*++ BUILD Version: 0011 // Increment this if a change has global effects
  2. Copyright (c) 1989-1999 Microsoft Corporation
  3. Module Name:
  4. ntlsa.h
  5. Abstract:
  6. This module contains the public data structures and API definitions
  7. needed to utilize Local Security Authority (LSA) services.
  8. Author:
  9. Jim Kelly (JimK) 21-February-1991
  10. Revision History:
  11. --*/
  12. #ifndef _NTLSA_
  13. #define _NTLSA_
  14. #if _MSC_VER > 1000
  15. #pragma once
  16. #endif
  17. #ifdef __cplusplus
  18. extern "C" {
  19. #endif
  20. //
  21. // Generic negative values for unknown IDs, inapplicable indices etc.
  22. //
  23. #define LSA_UNKNOWN_ID ((ULONG) 0xFFFFFFFFL)
  24. #define LSA_UNKNOWN_INDEX ((LONG) -1)
  25. //
  26. // Each time a domain controller is promoted to primary domain
  27. // controller, its ModifiedId is incremented by this amount.
  28. //
  29. #define LSA_PROMOTION_INCREMENT {0x0,0x10}
  30. // begin_ntsecapi
  31. #ifndef _NTLSA_IFS_
  32. // begin_ntifs
  33. //
  34. // Security operation mode of the system is held in a control
  35. // longword.
  36. //
  37. typedef ULONG LSA_OPERATIONAL_MODE, *PLSA_OPERATIONAL_MODE;
  38. // end_ntifs
  39. #endif // _NTLSA_IFS_
  40. //
  41. // The flags in the security operational mode are defined
  42. // as:
  43. //
  44. // PasswordProtected - Some level of authentication (such as
  45. // a password) must be provided by users before they are
  46. // allowed to use the system. Once set, this value will
  47. // not be cleared without re-booting the system.
  48. //
  49. // IndividualAccounts - Each user must identify an account to
  50. // logon to. This flag is only meaningful if the
  51. // PasswordProtected flag is also set. If this flag is
  52. // not set and the PasswordProtected flag is set, then all
  53. // users may logon to the same account. Once set, this value
  54. // will not be cleared without re-booting the system.
  55. //
  56. // MandatoryAccess - Indicates the system is running in a mandatory
  57. // access control mode (e.g., B-level as defined by the U.S.A's
  58. // Department of Defense's "Orange Book"). This is not utilized
  59. // in the current release of NT. This flag is only meaningful
  60. // if both the PasswordProtected and IndividualAccounts flags are
  61. // set. Once set, this value will not be cleared without
  62. // re-booting the system.
  63. //
  64. // LogFull - Indicates the system has been brought up in a mode in
  65. // which if must perform security auditing, but its audit log
  66. // is full. This may (should) restrict the operations that
  67. // can occur until the audit log is made not-full again. THIS
  68. // VALUE MAY BE CLEARED WHILE THE SYSTEM IS RUNNING (I.E., WITHOUT
  69. // REBOOTING).
  70. //
  71. // If the PasswordProtected flag is not set, then the system is running
  72. // without security, and user interface should be adjusted appropriately.
  73. //
  74. #define LSA_MODE_PASSWORD_PROTECTED (0x00000001L)
  75. #define LSA_MODE_INDIVIDUAL_ACCOUNTS (0x00000002L)
  76. #define LSA_MODE_MANDATORY_ACCESS (0x00000004L)
  77. #define LSA_MODE_LOG_FULL (0x00000008L)
  78. // end_ntsecapi
  79. /////////////////////////////////////////////////////////////////////////
  80. // //
  81. // Widely used LSA defines //
  82. // //
  83. /////////////////////////////////////////////////////////////////////////
  84. //
  85. // Defines for Count Limits on LSA API
  86. //
  87. #define LSA_MAXIMUM_SID_COUNT (0x00000100L)
  88. #define LSA_MAXIMUM_ENUMERATION_LENGTH (32000)
  89. //
  90. // Defines used by ISVs or end-users defining their own privilege DLLs
  91. //
  92. #define LSA_PRIVILEGE_DLL_MAJOR_REV_1 (0x01)
  93. #define LSA_PRIVILEGE_DLL_MINOR_REV_0 (0x00)
  94. #define LSA_PRIVILEGE_DLL_INFO 1
  95. #define LSA_PRIVILEGE_PROGRAM_NAMES 2
  96. #define LSA_PRIVILEGE_DISPLAY_NAMES 3
  97. //
  98. // Flag OR'ed into AuthenticationPackage parameter of LsaLogonUser to
  99. // request that the license server be called upon successful logon.
  100. //
  101. #define LSA_CALL_LICENSE_SERVER 0x80000000
  102. /////////////////////////////////////////////////////////////////////////
  103. // //
  104. // Data types used by logon processes //
  105. // //
  106. /////////////////////////////////////////////////////////////////////////
  107. // begin_ntsecapi
  108. #ifndef _NTLSA_IFS_
  109. // begin_ntifs
  110. //
  111. // Used by a logon process to indicate what type of logon is being
  112. // requested.
  113. //
  114. typedef enum _SECURITY_LOGON_TYPE {
  115. Interactive = 2, // Interactively logged on (locally or remotely)
  116. Network, // Accessing system via network
  117. Batch, // Started via a batch queue
  118. Service, // Service started by service controller
  119. Proxy, // Proxy logon
  120. Unlock, // Unlock workstation
  121. NetworkCleartext, // Network logon with cleartext credentials
  122. NewCredentials, // Clone caller, new default credentials
  123. RemoteInteractive, // Remote, yet interactive. Terminal server
  124. CachedInteractive // Try cached credentials without hitting the net.
  125. } SECURITY_LOGON_TYPE, *PSECURITY_LOGON_TYPE;
  126. // end_ntifs
  127. #endif // _NTLSA_IFS_
  128. // end_ntsecapi
  129. //
  130. // Security System Access Flags. These correspond to the enumerated
  131. // type values in SECURITY_LOGON_TYPE.
  132. //
  133. // IF YOU ADD A NEW LOGON TYPE HERE, ALSO ADD IT TO THE POLICY_MODE_xxx
  134. // data definitions.
  135. //
  136. #define SECURITY_ACCESS_INTERACTIVE_LOGON ((ULONG) 0x00000001L)
  137. #define SECURITY_ACCESS_NETWORK_LOGON ((ULONG) 0x00000002L)
  138. #define SECURITY_ACCESS_BATCH_LOGON ((ULONG) 0x00000004L)
  139. #define SECURITY_ACCESS_SERVICE_LOGON ((ULONG) 0x00000010L)
  140. #define SECURITY_ACCESS_PROXY_LOGON ((ULONG) 0x00000020L)
  141. #define SECURITY_ACCESS_DENY_INTERACTIVE_LOGON ((ULONG) 0x00000040L)
  142. #define SECURITY_ACCESS_DENY_NETWORK_LOGON ((ULONG) 0x00000080L)
  143. #define SECURITY_ACCESS_DENY_BATCH_LOGON ((ULONG) 0x00000100L)
  144. #define SECURITY_ACCESS_DENY_SERVICE_LOGON ((ULONG) 0x00000200L)
  145. #define SECURITY_ACCESS_REMOTE_INTERACTIVE_LOGON ((ULONG) 0x00000400L)
  146. #define SECURITY_ACCESS_DENY_REMOTE_INTERACTIVE_LOGON ((ULONG) 0x00000800L)
  147. /////////////////////////////////////////////////////////////////////////
  148. // //
  149. // Data types related to Auditing //
  150. // //
  151. /////////////////////////////////////////////////////////////////////////
  152. //
  153. // The following enumerated type is used between the reference monitor and
  154. // LSA in the generation of audit messages. It is used to indicate the
  155. // type of data being passed as a parameter from the reference monitor
  156. // to LSA. LSA is responsible for transforming the specified data type
  157. // into a set of unicode strings that are added to the event record in
  158. // the audit log.
  159. //
  160. typedef enum _SE_ADT_PARAMETER_TYPE {
  161. SeAdtParmTypeNone = 0, //Produces 1 parameter
  162. //Received value:
  163. //
  164. // None.
  165. //
  166. //Results in:
  167. //
  168. // a unicode string containing "-".
  169. //
  170. //Note: This is typically used to
  171. // indicate that a parameter value
  172. // was not available.
  173. //
  174. SeAdtParmTypeString, //Produces 1 parameter.
  175. //Received Value:
  176. //
  177. // Unicode String (variable length)
  178. //
  179. //Results in:
  180. //
  181. // No transformation. The string
  182. // entered into the event record as
  183. // received.
  184. //
  185. // The Address value of the audit info
  186. // should be a pointer to a UNICODE_STRING
  187. // structure.
  188. SeAdtParmTypeFileSpec, //Produces 1 parameter.
  189. //Received value:
  190. //
  191. // Unicode string containing a file or
  192. // directory name.
  193. //
  194. //Results in:
  195. //
  196. // Unicode string with the prefix of the
  197. // file's path replaced by a drive letter
  198. // if possible.
  199. //
  200. SeAdtParmTypeUlong, //Produces 1 parameter
  201. //Received value:
  202. //
  203. // Ulong
  204. //
  205. //Results in:
  206. //
  207. // Unicode string representation of
  208. // unsigned integer value.
  209. SeAdtParmTypeSid, //Produces 1 parameter.
  210. //Received value:
  211. //
  212. // SID (variable length)
  213. //
  214. //Results in:
  215. //
  216. // String representation of SID
  217. //
  218. SeAdtParmTypeLogonId, //Produces 3 parameters.
  219. //Received Value:
  220. //
  221. // LUID (fixed length)
  222. //
  223. //Results in:
  224. //
  225. // param 1: Username string
  226. // param 2: domain name string
  227. // param 3: Logon ID (Luid) string
  228. SeAdtParmTypeNoLogonId, //Produces 3 parameters.
  229. //Received value:
  230. //
  231. // None.
  232. //
  233. //Results in:
  234. //
  235. // param 1: "-"
  236. // param 2: "-"
  237. // param 3: "-"
  238. //
  239. //Note:
  240. //
  241. // This type is used when a logon ID
  242. // is needed, but one is not available
  243. // to pass. For example, if an
  244. // impersonation logon ID is expected
  245. // but the subject is not impersonating
  246. // anyone.
  247. //
  248. SeAdtParmTypeAccessMask, //Produces 1 parameter with formatting.
  249. //Received value:
  250. //
  251. // ACCESS_MASK followed by
  252. // a Unicode string. The unicode
  253. // string contains the name of the
  254. // type of object the access mask
  255. // applies to. The event's source
  256. // further qualifies the object type.
  257. //
  258. //Results in:
  259. //
  260. // formatted unicode string built to
  261. // take advantage of the specified
  262. // source's parameter message file.
  263. //
  264. //Note:
  265. //
  266. // An access mask containing three
  267. // access types for a Widget object
  268. // type (defined by the Foozle source)
  269. // might end up looking like:
  270. //
  271. // %%1062\n\t\t%1066\n\t\t%%601
  272. //
  273. // The %%numbers are signals to the
  274. // event viewer to perform parameter
  275. // substitution before display.
  276. //
  277. SeAdtParmTypePrivs, //Produces 1 parameter with formatting.
  278. //Received value:
  279. //
  280. // ??? Check with RobertRe and ScottBi
  281. //
  282. //Results in:
  283. //
  284. // formatted unicode string similar to
  285. // that for access types. Each priv
  286. // will be formatted to be displayed
  287. // on its own line. E.g.,
  288. //
  289. // %%642\n\t\t%%651\n\t\t%%655
  290. //
  291. SeAdtParmTypeObjectTypes, //Produces 10 parameters with formatting.
  292. //Received value:
  293. //
  294. // Produces a list a stringized GUIDS along
  295. // with information similar to that for
  296. // an access mask.
  297. SeAdtParmTypeHexUlong, //Produces 1 parameter
  298. //Received value:
  299. //
  300. // Ulong
  301. //
  302. //Results in:
  303. //
  304. // Unicode string representation of
  305. // unsigned integer value in hexidecimal.
  306. SeAdtParmTypePtr, //Produces 1 parameter
  307. //Received value:
  308. //
  309. // pointer
  310. //
  311. //Results in:
  312. //
  313. // Unicode string representation of
  314. // unsigned integer value in hexidecimal.
  315. SeAdtParmTypeTime, //Produces 2 parameters
  316. //Recieved value:
  317. //
  318. // LARGE_INTEGER
  319. //
  320. //Results in:
  321. //
  322. // Unicode string representation of
  323. // date and time.
  324. //
  325. SeAdtParmTypeGuid //Produces 1 parameter
  326. //Recieved value:
  327. //
  328. // GUID pointer
  329. //
  330. //Results in:
  331. //
  332. // Unicode string representation of GUID
  333. // {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}
  334. //
  335. } SE_ADT_PARAMETER_TYPE, *PSE_ADT_PARAMETER_TYPE;
  336. #ifndef GUID_DEFINED
  337. #include <guiddef.h>
  338. #endif /* GUID_DEFINED */
  339. typedef struct _SE_ADT_OBJECT_TYPE {
  340. GUID ObjectType;
  341. USHORT Flags;
  342. #define SE_ADT_OBJECT_ONLY 0x1
  343. USHORT Level;
  344. ACCESS_MASK AccessMask;
  345. } SE_ADT_OBJECT_TYPE, *PSE_ADT_OBJECT_TYPE;
  346. typedef struct _SE_ADT_PARAMETER_ARRAY_ENTRY {
  347. SE_ADT_PARAMETER_TYPE Type;
  348. ULONG Length;
  349. ULONG_PTR Data[2];
  350. PVOID Address;
  351. } SE_ADT_PARAMETER_ARRAY_ENTRY, *PSE_ADT_PARAMETER_ARRAY_ENTRY;
  352. //
  353. // Structure that will be passed between the Reference Monitor and LSA
  354. // to transmit auditing information.
  355. //
  356. #define SE_MAX_AUDIT_PARAMETERS 24
  357. typedef struct _SE_ADT_PARAMETER_ARRAY {
  358. ULONG CategoryId;
  359. ULONG AuditId;
  360. ULONG ParameterCount;
  361. ULONG Length;
  362. USHORT Type;
  363. ULONG Flags;
  364. SE_ADT_PARAMETER_ARRAY_ENTRY Parameters[ SE_MAX_AUDIT_PARAMETERS ];
  365. } SE_ADT_PARAMETER_ARRAY, *PSE_ADT_PARAMETER_ARRAY;
  366. #define SE_ADT_PARAMETERS_SELF_RELATIVE 0x00000001
  367. // begin_ntsecapi
  368. //
  369. // Audit Event Categories
  370. //
  371. // The following are the built-in types or Categories of audit event.
  372. // WARNING! This structure is subject to expansion. The user should not
  373. // compute the number of elements of this type directly, but instead
  374. // should obtain the count of elements by calling LsaQueryInformationPolicy()
  375. // for the PolicyAuditEventsInformation class and extracting the count from
  376. // the MaximumAuditEventCount field of the returned structure.
  377. //
  378. typedef enum _POLICY_AUDIT_EVENT_TYPE {
  379. AuditCategorySystem,
  380. AuditCategoryLogon,
  381. AuditCategoryObjectAccess,
  382. AuditCategoryPrivilegeUse,
  383. AuditCategoryDetailedTracking,
  384. AuditCategoryPolicyChange,
  385. AuditCategoryAccountManagement,
  386. AuditCategoryDirectoryServiceAccess,
  387. AuditCategoryAccountLogon
  388. } POLICY_AUDIT_EVENT_TYPE, *PPOLICY_AUDIT_EVENT_TYPE;
  389. //
  390. // The following defines describe the auditing options for each
  391. // event type
  392. //
  393. // Leave options specified for this event unchanged
  394. #define POLICY_AUDIT_EVENT_UNCHANGED (0x00000000L)
  395. // Audit successful occurrences of events of this type
  396. #define POLICY_AUDIT_EVENT_SUCCESS (0x00000001L)
  397. // Audit failed attempts to cause an event of this type to occur
  398. #define POLICY_AUDIT_EVENT_FAILURE (0x00000002L)
  399. #define POLICY_AUDIT_EVENT_NONE (0x00000004L)
  400. // Mask of valid event auditing options
  401. #define POLICY_AUDIT_EVENT_MASK \
  402. (POLICY_AUDIT_EVENT_SUCCESS | \
  403. POLICY_AUDIT_EVENT_FAILURE | \
  404. POLICY_AUDIT_EVENT_UNCHANGED | \
  405. POLICY_AUDIT_EVENT_NONE)
  406. #ifdef _NTDEF_
  407. // begin_ntifs
  408. typedef UNICODE_STRING LSA_UNICODE_STRING, *PLSA_UNICODE_STRING;
  409. typedef STRING LSA_STRING, *PLSA_STRING;
  410. typedef OBJECT_ATTRIBUTES LSA_OBJECT_ATTRIBUTES, *PLSA_OBJECT_ATTRIBUTES;
  411. // end_ntifs
  412. #else // _NTDEF_
  413. #ifndef IN
  414. #define IN
  415. #endif
  416. #ifndef OUT
  417. #define OUT
  418. #endif
  419. #ifndef OPTIONAL
  420. #define OPTIONAL
  421. #endif
  422. typedef struct _LSA_UNICODE_STRING {
  423. USHORT Length;
  424. USHORT MaximumLength;
  425. #ifdef MIDL_PASS
  426. [size_is(MaximumLength/2), length_is(Length/2)]
  427. #endif // MIDL_PASS
  428. PWSTR Buffer;
  429. } LSA_UNICODE_STRING, *PLSA_UNICODE_STRING;
  430. typedef struct _LSA_STRING {
  431. USHORT Length;
  432. USHORT MaximumLength;
  433. PCHAR Buffer;
  434. } LSA_STRING, *PLSA_STRING;
  435. typedef struct _LSA_OBJECT_ATTRIBUTES {
  436. ULONG Length;
  437. HANDLE RootDirectory;
  438. PLSA_UNICODE_STRING ObjectName;
  439. ULONG Attributes;
  440. PVOID SecurityDescriptor; // Points to type SECURITY_DESCRIPTOR
  441. PVOID SecurityQualityOfService; // Points to type SECURITY_QUALITY_OF_SERVICE
  442. } LSA_OBJECT_ATTRIBUTES, *PLSA_OBJECT_ATTRIBUTES;
  443. #endif // _NTDEF_
  444. // end_ntsecapi
  445. // begin_ntsecapi
  446. //
  447. // Macro for determining whether an API succeeded.
  448. //
  449. #define LSA_SUCCESS(Error) ((LONG)(Error) >= 0)
  450. // end_ntsecapi
  451. /////////////////////////////////////////////////////////////////////////
  452. // //
  453. // Services provided for use by logon processes //
  454. // //
  455. /////////////////////////////////////////////////////////////////////////
  456. // begin_ntsecapi
  457. #ifndef _NTLSA_IFS_
  458. // begin_ntifs
  459. NTSTATUS
  460. NTAPI
  461. LsaRegisterLogonProcess (
  462. IN PLSA_STRING LogonProcessName,
  463. OUT PHANDLE LsaHandle,
  464. OUT PLSA_OPERATIONAL_MODE SecurityMode
  465. );
  466. NTSTATUS
  467. NTAPI
  468. LsaLogonUser (
  469. IN HANDLE LsaHandle,
  470. IN PLSA_STRING OriginName,
  471. IN SECURITY_LOGON_TYPE LogonType,
  472. IN ULONG AuthenticationPackage,
  473. IN PVOID AuthenticationInformation,
  474. IN ULONG AuthenticationInformationLength,
  475. IN PTOKEN_GROUPS LocalGroups OPTIONAL,
  476. IN PTOKEN_SOURCE SourceContext,
  477. OUT PVOID *ProfileBuffer,
  478. OUT PULONG ProfileBufferLength,
  479. OUT PLUID LogonId,
  480. OUT PHANDLE Token,
  481. OUT PQUOTA_LIMITS Quotas,
  482. OUT PNTSTATUS SubStatus
  483. );
  484. // end_ntifs
  485. NTSTATUS
  486. NTAPI
  487. LsaLookupAuthenticationPackage (
  488. IN HANDLE LsaHandle,
  489. IN PLSA_STRING PackageName,
  490. OUT PULONG AuthenticationPackage
  491. );
  492. // begin_ntifs
  493. NTSTATUS
  494. NTAPI
  495. LsaFreeReturnBuffer (
  496. IN PVOID Buffer
  497. );
  498. // end_ntifs
  499. NTSTATUS
  500. NTAPI
  501. LsaCallAuthenticationPackage (
  502. IN HANDLE LsaHandle,
  503. IN ULONG AuthenticationPackage,
  504. IN PVOID ProtocolSubmitBuffer,
  505. IN ULONG SubmitBufferLength,
  506. OUT PVOID *ProtocolReturnBuffer,
  507. OUT PULONG ReturnBufferLength,
  508. OUT PNTSTATUS ProtocolStatus
  509. );
  510. NTSTATUS
  511. NTAPI
  512. LsaDeregisterLogonProcess (
  513. IN HANDLE LsaHandle
  514. );
  515. NTSTATUS
  516. NTAPI
  517. LsaConnectUntrusted (
  518. OUT PHANDLE LsaHandle
  519. );
  520. #endif // _NTLSA_IFS_
  521. // end_ntsecapi
  522. // begin_ntsecpkg
  523. /////////////////////////////////////////////////////////////////////////
  524. // //
  525. // Data types used by authentication packages //
  526. // //
  527. /////////////////////////////////////////////////////////////////////////
  528. //
  529. // opaque data type which represents a client request
  530. //
  531. typedef PVOID *PLSA_CLIENT_REQUEST;
  532. //
  533. // When a logon of a user is requested, the authentication package
  534. // is expected to return one of the following structures indicating
  535. // the contents of a user's token.
  536. //
  537. typedef enum _LSA_TOKEN_INFORMATION_TYPE {
  538. LsaTokenInformationNull, // Implies LSA_TOKEN_INFORMATION_NULL data type
  539. LsaTokenInformationV1, // Implies LSA_TOKEN_INFORMATION_V1 data type
  540. LsaTokenInformationV2 // Implies LSA_TOKEN_INFORMATION_V2 data type
  541. } LSA_TOKEN_INFORMATION_TYPE, *PLSA_TOKEN_INFORMATION_TYPE;
  542. //
  543. // The NULL information is used in cases where a non-authenticated
  544. // system access is needed. For example, a non-authentication network
  545. // circuit (such as LAN Manager's null session) can be given NULL
  546. // information. This will result in an anonymous token being generated
  547. // for the logon that gives the user no ability to access protected system
  548. // resources, but does allow access to non-protected system resources.
  549. //
  550. typedef struct _LSA_TOKEN_INFORMATION_NULL {
  551. //
  552. // Time at which the security context becomes invalid.
  553. // Use a value in the distant future if the context
  554. // never expires.
  555. //
  556. LARGE_INTEGER ExpirationTime;
  557. //
  558. // The SID(s) of groups the user is to be made a member of. This should
  559. // not include WORLD or other system defined and assigned
  560. // SIDs. These will be added automatically by LSA.
  561. //
  562. // Each SID is expected to be in a separately allocated block
  563. // of memory. The TOKEN_GROUPS structure is also expected to
  564. // be in a separately allocated block of memory.
  565. //
  566. PTOKEN_GROUPS Groups;
  567. } LSA_TOKEN_INFORMATION_NULL, *PLSA_TOKEN_INFORMATION_NULL;
  568. //
  569. // The V1 token information structure is superceeded by the V2 token
  570. // information structure. The V1 strucure should only be used for
  571. // backwards compatability.
  572. // This structure contains information that an authentication package
  573. // can place in a Version 1 NT token object.
  574. //
  575. typedef struct _LSA_TOKEN_INFORMATION_V1 {
  576. //
  577. // Time at which the security context becomes invalid.
  578. // Use a value in the distant future if the context
  579. // never expires.
  580. //
  581. LARGE_INTEGER ExpirationTime;
  582. //
  583. // The SID of the user logging on. The SID value is in a
  584. // separately allocated block of memory.
  585. //
  586. TOKEN_USER User;
  587. //
  588. // The SID(s) of groups the user is a member of. This should
  589. // not include WORLD or other system defined and assigned
  590. // SIDs. These will be added automatically by LSA.
  591. //
  592. // Each SID is expected to be in a separately allocated block
  593. // of memory. The TOKEN_GROUPS structure is also expected to
  594. // be in a separately allocated block of memory.
  595. //
  596. PTOKEN_GROUPS Groups;
  597. //
  598. // This field is used to establish the primary group of the user.
  599. // This value does not have to correspond to one of the SIDs
  600. // assigned to the user.
  601. //
  602. // The SID pointed to by this structure is expected to be in
  603. // a separately allocated block of memory.
  604. //
  605. // This field is mandatory and must be filled in.
  606. //
  607. TOKEN_PRIMARY_GROUP PrimaryGroup;
  608. //
  609. // The privileges the user is assigned. This list of privileges
  610. // will be augmented or over-ridden by any local security policy
  611. // assigned privileges.
  612. //
  613. // Each privilege is expected to be in a separately allocated
  614. // block of memory. The TOKEN_PRIVILEGES structure is also
  615. // expected to be in a separately allocated block of memory.
  616. //
  617. // If there are no privileges to assign to the user, this field
  618. // may be set to NULL.
  619. //
  620. PTOKEN_PRIVILEGES Privileges;
  621. //
  622. // This field may be used to establish an explicit default
  623. // owner. Normally, the user ID is used as the default owner.
  624. // If another value is desired, it must be specified here.
  625. //
  626. // The Owner.Sid field may be set to NULL to indicate there is no
  627. // alternate default owner value.
  628. //
  629. TOKEN_OWNER Owner;
  630. //
  631. // This field may be used to establish a default
  632. // protection for the user. If no value is provided, then
  633. // a default protection that grants everyone all access will
  634. // be established.
  635. //
  636. // The DefaultDacl.DefaultDacl field may be set to NULL to indicate
  637. // there is no default protection.
  638. //
  639. TOKEN_DEFAULT_DACL DefaultDacl;
  640. } LSA_TOKEN_INFORMATION_V1, *PLSA_TOKEN_INFORMATION_V1;
  641. //
  642. // The V2 information is used in most cases of logon. The structure is identical
  643. // to the V1 token information structure, with the exception that the memory allocation
  644. // is handled differently. The LSA_TOKEN_INFORMATION_V2 structure is intended to be
  645. // allocated monolithiclly, with the privileges, DACL, sids, and group array either part of
  646. // same allocation, or allocated and freed externally.
  647. //
  648. typedef LSA_TOKEN_INFORMATION_V1 LSA_TOKEN_INFORMATION_V2, *PLSA_TOKEN_INFORMATION_V2;
  649. /////////////////////////////////////////////////////////////////////////
  650. // //
  651. // Interface definitions available for use by authentication packages //
  652. // //
  653. /////////////////////////////////////////////////////////////////////////
  654. typedef NTSTATUS
  655. (NTAPI LSA_CREATE_LOGON_SESSION) (
  656. IN PLUID LogonId
  657. );
  658. typedef NTSTATUS
  659. (NTAPI LSA_DELETE_LOGON_SESSION) (
  660. IN PLUID LogonId
  661. );
  662. typedef NTSTATUS
  663. (NTAPI LSA_ADD_CREDENTIAL) (
  664. IN PLUID LogonId,
  665. IN ULONG AuthenticationPackage,
  666. IN PLSA_STRING PrimaryKeyValue,
  667. IN PLSA_STRING Credentials
  668. );
  669. typedef NTSTATUS
  670. (NTAPI LSA_GET_CREDENTIALS) (
  671. IN PLUID LogonId,
  672. IN ULONG AuthenticationPackage,
  673. IN OUT PULONG QueryContext,
  674. IN BOOLEAN RetrieveAllCredentials,
  675. IN PLSA_STRING PrimaryKeyValue,
  676. OUT PULONG PrimaryKeyLength,
  677. IN PLSA_STRING Credentials
  678. );
  679. typedef NTSTATUS
  680. (NTAPI LSA_DELETE_CREDENTIAL) (
  681. IN PLUID LogonId,
  682. IN ULONG AuthenticationPackage,
  683. IN PLSA_STRING PrimaryKeyValue
  684. );
  685. typedef PVOID
  686. (NTAPI LSA_ALLOCATE_LSA_HEAP) (
  687. IN ULONG Length
  688. );
  689. typedef VOID
  690. (NTAPI LSA_FREE_LSA_HEAP) (
  691. IN PVOID Base
  692. );
  693. typedef PVOID
  694. (NTAPI LSA_ALLOCATE_PRIVATE_HEAP) (
  695. IN SIZE_T Length
  696. );
  697. typedef VOID
  698. (NTAPI LSA_FREE_PRIVATE_HEAP) (
  699. IN PVOID Base
  700. );
  701. typedef NTSTATUS
  702. (NTAPI LSA_ALLOCATE_CLIENT_BUFFER) (
  703. IN PLSA_CLIENT_REQUEST ClientRequest,
  704. IN ULONG LengthRequired,
  705. OUT PVOID *ClientBaseAddress
  706. );
  707. typedef NTSTATUS
  708. (NTAPI LSA_FREE_CLIENT_BUFFER) (
  709. IN PLSA_CLIENT_REQUEST ClientRequest,
  710. IN PVOID ClientBaseAddress
  711. );
  712. typedef NTSTATUS
  713. (NTAPI LSA_COPY_TO_CLIENT_BUFFER) (
  714. IN PLSA_CLIENT_REQUEST ClientRequest,
  715. IN ULONG Length,
  716. IN PVOID ClientBaseAddress,
  717. IN PVOID BufferToCopy
  718. );
  719. typedef NTSTATUS
  720. (NTAPI LSA_COPY_FROM_CLIENT_BUFFER) (
  721. IN PLSA_CLIENT_REQUEST ClientRequest,
  722. IN ULONG Length,
  723. IN PVOID BufferToCopy,
  724. IN PVOID ClientBaseAddress
  725. );
  726. typedef LSA_CREATE_LOGON_SESSION * PLSA_CREATE_LOGON_SESSION ;
  727. typedef LSA_DELETE_LOGON_SESSION * PLSA_DELETE_LOGON_SESSION ;
  728. typedef LSA_ADD_CREDENTIAL * PLSA_ADD_CREDENTIAL ;
  729. typedef LSA_GET_CREDENTIALS * PLSA_GET_CREDENTIALS ;
  730. typedef LSA_DELETE_CREDENTIAL * PLSA_DELETE_CREDENTIAL ;
  731. typedef LSA_ALLOCATE_LSA_HEAP * PLSA_ALLOCATE_LSA_HEAP ;
  732. typedef LSA_FREE_LSA_HEAP * PLSA_FREE_LSA_HEAP ;
  733. typedef LSA_ALLOCATE_PRIVATE_HEAP * PLSA_ALLOCATE_PRIVATE_HEAP ;
  734. typedef LSA_FREE_PRIVATE_HEAP * PLSA_FREE_PRIVATE_HEAP ;
  735. typedef LSA_ALLOCATE_CLIENT_BUFFER * PLSA_ALLOCATE_CLIENT_BUFFER ;
  736. typedef LSA_FREE_CLIENT_BUFFER * PLSA_FREE_CLIENT_BUFFER ;
  737. typedef LSA_COPY_TO_CLIENT_BUFFER * PLSA_COPY_TO_CLIENT_BUFFER ;
  738. typedef LSA_COPY_FROM_CLIENT_BUFFER * PLSA_COPY_FROM_CLIENT_BUFFER ;
  739. //
  740. // The dispatch table of LSA services which are available to
  741. // authentication packages.
  742. //
  743. typedef struct _LSA_DISPATCH_TABLE {
  744. PLSA_CREATE_LOGON_SESSION CreateLogonSession;
  745. PLSA_DELETE_LOGON_SESSION DeleteLogonSession;
  746. PLSA_ADD_CREDENTIAL AddCredential;
  747. PLSA_GET_CREDENTIALS GetCredentials;
  748. PLSA_DELETE_CREDENTIAL DeleteCredential;
  749. PLSA_ALLOCATE_LSA_HEAP AllocateLsaHeap;
  750. PLSA_FREE_LSA_HEAP FreeLsaHeap;
  751. PLSA_ALLOCATE_CLIENT_BUFFER AllocateClientBuffer;
  752. PLSA_FREE_CLIENT_BUFFER FreeClientBuffer;
  753. PLSA_COPY_TO_CLIENT_BUFFER CopyToClientBuffer;
  754. PLSA_COPY_FROM_CLIENT_BUFFER CopyFromClientBuffer;
  755. } LSA_DISPATCH_TABLE, *PLSA_DISPATCH_TABLE;
  756. ////////////////////////////////////////////////////////////////////////////
  757. // //
  758. // Interface definitions of services provided by authentication packages //
  759. // //
  760. ////////////////////////////////////////////////////////////////////////////
  761. //
  762. // Routine names
  763. //
  764. // The routines provided by the DLL must be assigned the following names
  765. // so that their addresses can be retrieved when the DLL is loaded.
  766. //
  767. #define LSA_AP_NAME_INITIALIZE_PACKAGE "LsaApInitializePackage\0"
  768. #define LSA_AP_NAME_LOGON_USER "LsaApLogonUser\0"
  769. #define LSA_AP_NAME_LOGON_USER_EX "LsaApLogonUserEx\0"
  770. #define LSA_AP_NAME_CALL_PACKAGE "LsaApCallPackage\0"
  771. #define LSA_AP_NAME_LOGON_TERMINATED "LsaApLogonTerminated\0"
  772. #define LSA_AP_NAME_CALL_PACKAGE_UNTRUSTED "LsaApCallPackageUntrusted\0"
  773. #define LSA_AP_NAME_CALL_PACKAGE_PASSTHROUGH "LsaApCallPackagePassthrough\0"
  774. //
  775. // Routine templates
  776. //
  777. typedef NTSTATUS
  778. (NTAPI LSA_AP_INITIALIZE_PACKAGE) (
  779. IN ULONG AuthenticationPackageId,
  780. IN PLSA_DISPATCH_TABLE LsaDispatchTable,
  781. IN PLSA_STRING Database OPTIONAL,
  782. IN PLSA_STRING Confidentiality OPTIONAL,
  783. OUT PLSA_STRING *AuthenticationPackageName
  784. );
  785. typedef NTSTATUS
  786. (NTAPI LSA_AP_LOGON_USER) (
  787. IN PLSA_CLIENT_REQUEST ClientRequest,
  788. IN SECURITY_LOGON_TYPE LogonType,
  789. IN PVOID AuthenticationInformation,
  790. IN PVOID ClientAuthenticationBase,
  791. IN ULONG AuthenticationInformationLength,
  792. OUT PVOID *ProfileBuffer,
  793. OUT PULONG ProfileBufferLength,
  794. OUT PLUID LogonId,
  795. OUT PNTSTATUS SubStatus,
  796. OUT PLSA_TOKEN_INFORMATION_TYPE TokenInformationType,
  797. OUT PVOID *TokenInformation,
  798. OUT PLSA_UNICODE_STRING *AccountName,
  799. OUT PLSA_UNICODE_STRING *AuthenticatingAuthority
  800. );
  801. typedef NTSTATUS
  802. (NTAPI LSA_AP_LOGON_USER_EX) (
  803. IN PLSA_CLIENT_REQUEST ClientRequest,
  804. IN SECURITY_LOGON_TYPE LogonType,
  805. IN PVOID AuthenticationInformation,
  806. IN PVOID ClientAuthenticationBase,
  807. IN ULONG AuthenticationInformationLength,
  808. OUT PVOID *ProfileBuffer,
  809. OUT PULONG ProfileBufferLength,
  810. OUT PLUID LogonId,
  811. OUT PNTSTATUS SubStatus,
  812. OUT PLSA_TOKEN_INFORMATION_TYPE TokenInformationType,
  813. OUT PVOID *TokenInformation,
  814. OUT PUNICODE_STRING *AccountName,
  815. OUT PUNICODE_STRING *AuthenticatingAuthority,
  816. OUT PUNICODE_STRING *MachineName
  817. );
  818. typedef NTSTATUS
  819. (NTAPI LSA_AP_CALL_PACKAGE) (
  820. IN PLSA_CLIENT_REQUEST ClientRequest,
  821. IN PVOID ProtocolSubmitBuffer,
  822. IN PVOID ClientBufferBase,
  823. IN ULONG SubmitBufferLength,
  824. OUT PVOID *ProtocolReturnBuffer,
  825. OUT PULONG ReturnBufferLength,
  826. OUT PNTSTATUS ProtocolStatus
  827. );
  828. typedef NTSTATUS
  829. (NTAPI LSA_AP_CALL_PACKAGE_PASSTHROUGH) (
  830. IN PLSA_CLIENT_REQUEST ClientRequest,
  831. IN PVOID ProtocolSubmitBuffer,
  832. IN PVOID ClientBufferBase,
  833. IN ULONG SubmitBufferLength,
  834. OUT PVOID *ProtocolReturnBuffer,
  835. OUT PULONG ReturnBufferLength,
  836. OUT PNTSTATUS ProtocolStatus
  837. );
  838. typedef VOID
  839. (NTAPI LSA_AP_LOGON_TERMINATED) (
  840. IN PLUID LogonId
  841. );
  842. typedef LSA_AP_CALL_PACKAGE LSA_AP_CALL_PACKAGE_UNTRUSTED;
  843. typedef LSA_AP_INITIALIZE_PACKAGE * PLSA_AP_INITIALIZE_PACKAGE ;
  844. typedef LSA_AP_LOGON_USER * PLSA_AP_LOGON_USER ;
  845. typedef LSA_AP_LOGON_USER_EX * PLSA_AP_LOGON_USER_EX ;
  846. typedef LSA_AP_CALL_PACKAGE * PLSA_AP_CALL_PACKAGE ;
  847. typedef LSA_AP_CALL_PACKAGE_PASSTHROUGH * PLSA_AP_CALL_PACKAGE_PASSTHROUGH ;
  848. typedef LSA_AP_LOGON_TERMINATED * PLSA_AP_LOGON_TERMINATED ;
  849. typedef LSA_AP_CALL_PACKAGE_UNTRUSTED * PLSA_AP_CALL_PACKAGE_UNTRUSTED ;
  850. // end_ntsecpkg
  851. // begin_ntsecapi
  852. ////////////////////////////////////////////////////////////////////////////
  853. // //
  854. // Local Security Policy Administration API datatypes and defines //
  855. // //
  856. ////////////////////////////////////////////////////////////////////////////
  857. //
  858. // Access types for the Policy object
  859. //
  860. #define POLICY_VIEW_LOCAL_INFORMATION 0x00000001L
  861. #define POLICY_VIEW_AUDIT_INFORMATION 0x00000002L
  862. #define POLICY_GET_PRIVATE_INFORMATION 0x00000004L
  863. #define POLICY_TRUST_ADMIN 0x00000008L
  864. #define POLICY_CREATE_ACCOUNT 0x00000010L
  865. #define POLICY_CREATE_SECRET 0x00000020L
  866. #define POLICY_CREATE_PRIVILEGE 0x00000040L
  867. #define POLICY_SET_DEFAULT_QUOTA_LIMITS 0x00000080L
  868. #define POLICY_SET_AUDIT_REQUIREMENTS 0x00000100L
  869. #define POLICY_AUDIT_LOG_ADMIN 0x00000200L
  870. #define POLICY_SERVER_ADMIN 0x00000400L
  871. #define POLICY_LOOKUP_NAMES 0x00000800L
  872. #define POLICY_NOTIFICATION 0x00001000L
  873. #define POLICY_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED |\
  874. POLICY_VIEW_LOCAL_INFORMATION |\
  875. POLICY_VIEW_AUDIT_INFORMATION |\
  876. POLICY_GET_PRIVATE_INFORMATION |\
  877. POLICY_TRUST_ADMIN |\
  878. POLICY_CREATE_ACCOUNT |\
  879. POLICY_CREATE_SECRET |\
  880. POLICY_CREATE_PRIVILEGE |\
  881. POLICY_SET_DEFAULT_QUOTA_LIMITS |\
  882. POLICY_SET_AUDIT_REQUIREMENTS |\
  883. POLICY_AUDIT_LOG_ADMIN |\
  884. POLICY_SERVER_ADMIN |\
  885. POLICY_LOOKUP_NAMES)
  886. #define POLICY_READ (STANDARD_RIGHTS_READ |\
  887. POLICY_VIEW_AUDIT_INFORMATION |\
  888. POLICY_GET_PRIVATE_INFORMATION)
  889. #define POLICY_WRITE (STANDARD_RIGHTS_WRITE |\
  890. POLICY_TRUST_ADMIN |\
  891. POLICY_CREATE_ACCOUNT |\
  892. POLICY_CREATE_SECRET |\
  893. POLICY_CREATE_PRIVILEGE |\
  894. POLICY_SET_DEFAULT_QUOTA_LIMITS |\
  895. POLICY_SET_AUDIT_REQUIREMENTS |\
  896. POLICY_AUDIT_LOG_ADMIN |\
  897. POLICY_SERVER_ADMIN)
  898. #define POLICY_EXECUTE (STANDARD_RIGHTS_EXECUTE |\
  899. POLICY_VIEW_LOCAL_INFORMATION |\
  900. POLICY_LOOKUP_NAMES)
  901. //
  902. // Policy object specific data types.
  903. //
  904. //
  905. // The following data type is used to identify a domain
  906. //
  907. typedef struct _LSA_TRUST_INFORMATION {
  908. LSA_UNICODE_STRING Name;
  909. PSID Sid;
  910. } LSA_TRUST_INFORMATION, *PLSA_TRUST_INFORMATION;
  911. // where members have the following usage:
  912. //
  913. // Name - The name of the domain.
  914. //
  915. // Sid - A pointer to the Sid of the Domain
  916. //
  917. //
  918. // The following data type is used in name and SID lookup services to
  919. // describe the domains referenced in the lookup operation.
  920. //
  921. typedef struct _LSA_REFERENCED_DOMAIN_LIST {
  922. ULONG Entries;
  923. PLSA_TRUST_INFORMATION Domains;
  924. } LSA_REFERENCED_DOMAIN_LIST, *PLSA_REFERENCED_DOMAIN_LIST;
  925. // where members have the following usage:
  926. //
  927. // Entries - Is a count of the number of domains described in the
  928. // Domains array.
  929. //
  930. // Domains - Is a pointer to an array of Entries LSA_TRUST_INFORMATION data
  931. // structures.
  932. //
  933. //
  934. // The following data type is used in name to SID lookup services to describe
  935. // the domains referenced in the lookup operation.
  936. //
  937. typedef struct _LSA_TRANSLATED_SID {
  938. SID_NAME_USE Use;
  939. ULONG RelativeId;
  940. LONG DomainIndex;
  941. } LSA_TRANSLATED_SID, *PLSA_TRANSLATED_SID;
  942. // where members have the following usage:
  943. //
  944. // Use - identifies the use of the SID. If this value is SidUnknown or
  945. // SidInvalid, then the remainder of the record is not set and
  946. // should be ignored.
  947. //
  948. // RelativeId - Contains the relative ID of the translated SID. The
  949. // remainder of the SID (the prefix) is obtained using the
  950. // DomainIndex field.
  951. //
  952. // DomainIndex - Is the index of an entry in a related
  953. // LSA_REFERENCED_DOMAIN_LIST data structure describing the
  954. // domain in which the account was found.
  955. //
  956. // If there is no corresponding reference domain for an entry, then
  957. // this field will contain a negative value.
  958. //
  959. typedef struct _LSA_TRANSLATED_SID2 {
  960. SID_NAME_USE Use;
  961. PSID Sid;
  962. LONG DomainIndex;
  963. ULONG Flags;
  964. } LSA_TRANSLATED_SID2, *PLSA_TRANSLATED_SID2;
  965. // where members have the following usage:
  966. //
  967. // Use - identifies the use of the SID. If this value is SidUnknown or
  968. // SidInvalid, then the remainder of the record is not set and
  969. // should be ignored.
  970. //
  971. // Sid - Contains the complete Sid of the tranlated SID
  972. //
  973. // DomainIndex - Is the index of an entry in a related
  974. // LSA_REFERENCED_DOMAIN_LIST data structure describing the
  975. // domain in which the account was found.
  976. //
  977. // If there is no corresponding reference domain for an entry, then
  978. // this field will contain a negative value.
  979. //
  980. //
  981. // The following data type is used in SID to name lookup services to
  982. // describe the domains referenced in the lookup operation.
  983. //
  984. typedef struct _LSA_TRANSLATED_NAME {
  985. SID_NAME_USE Use;
  986. LSA_UNICODE_STRING Name;
  987. LONG DomainIndex;
  988. } LSA_TRANSLATED_NAME, *PLSA_TRANSLATED_NAME;
  989. // where the members have the following usage:
  990. //
  991. // Use - Identifies the use of the name. If this value is SidUnknown
  992. // or SidInvalid, then the remainder of the record is not set and
  993. // should be ignored. If this value is SidWellKnownGroup then the
  994. // Name field is invalid, but the DomainIndex field is not.
  995. //
  996. // Name - Contains the isolated name of the translated SID.
  997. //
  998. // DomainIndex - Is the index of an entry in a related
  999. // LSA_REFERENCED_DOMAIN_LIST data structure describing the domain
  1000. // in which the account was found.
  1001. //
  1002. // If there is no corresponding reference domain for an entry, then
  1003. // this field will contain a negative value.
  1004. //
  1005. // end_ntsecapi
  1006. //
  1007. // The following data type specifies the ways in which a user or member of
  1008. // an alias or group may be allowed to access the system. An account may
  1009. // be granted zero or more of these types of access to the system.
  1010. //
  1011. // The types of access are:
  1012. //
  1013. // Interactive - The user or alias/group member may interactively logon
  1014. // to the system.
  1015. //
  1016. // Network - The user or alias/group member may access the system via
  1017. // the network (e.g., through shares).
  1018. //
  1019. // Service - The user or alias may be activated as a service on the
  1020. // system.
  1021. //
  1022. typedef ULONG POLICY_SYSTEM_ACCESS_MODE, *PPOLICY_SYSTEM_ACCESS_MODE;
  1023. #define POLICY_MODE_INTERACTIVE SECURITY_ACCESS_INTERACTIVE_LOGON
  1024. #define POLICY_MODE_NETWORK SECURITY_ACCESS_NETWORK_LOGON
  1025. #define POLICY_MODE_BATCH SECURITY_ACCESS_BATCH_LOGON
  1026. #define POLICY_MODE_SERVICE SECURITY_ACCESS_SERVICE_LOGON
  1027. #define POLICY_MODE_PROXY SECURITY_ACCESS_PROXY_LOGON
  1028. #define POLICY_MODE_DENY_INTERACTIVE SECURITY_ACCESS_DENY_INTERACTIVE_LOGON
  1029. #define POLICY_MODE_DENY_NETWORK SECURITY_ACCESS_DENY_NETWORK_LOGON
  1030. #define POLICY_MODE_DENY_BATCH SECURITY_ACCESS_DENY_BATCH_LOGON
  1031. #define POLICY_MODE_DENY_SERVICE SECURITY_ACCESS_DENY_SERVICE_LOGON
  1032. #define POLICY_MODE_REMOTE_INTERACTIVE SECURITY_ACCESS_REMOTE_INTERACTIVE_LOGON
  1033. #define POLICY_MODE_DENY_REMOTE_INTERACTIVE SECURITY_ACCESS_DENY_REMOTE_INTERACTIVE_LOGON
  1034. #define POLICY_MODE_ALL (POLICY_MODE_INTERACTIVE | \
  1035. POLICY_MODE_NETWORK | \
  1036. POLICY_MODE_BATCH | \
  1037. POLICY_MODE_SERVICE | \
  1038. POLICY_MODE_PROXY | \
  1039. POLICY_MODE_DENY_INTERACTIVE | \
  1040. POLICY_MODE_DENY_NETWORK | \
  1041. SECURITY_ACCESS_DENY_BATCH_LOGON | \
  1042. SECURITY_ACCESS_DENY_SERVICE_LOGON | \
  1043. POLICY_MODE_REMOTE_INTERACTIVE | \
  1044. POLICY_MODE_DENY_REMOTE_INTERACTIVE )
  1045. //
  1046. // The following is the bits allowed in NT4.0
  1047. //
  1048. #define POLICY_MODE_ALL_NT4 (POLICY_MODE_INTERACTIVE | \
  1049. POLICY_MODE_NETWORK | \
  1050. POLICY_MODE_BATCH | \
  1051. POLICY_MODE_SERVICE | \
  1052. POLICY_MODE_PROXY )
  1053. // begin_ntsecapi
  1054. //
  1055. // The following data type is used to represent the role of the LSA
  1056. // server (primary or backup).
  1057. //
  1058. typedef enum _POLICY_LSA_SERVER_ROLE {
  1059. PolicyServerRoleBackup = 2,
  1060. PolicyServerRolePrimary
  1061. } POLICY_LSA_SERVER_ROLE, *PPOLICY_LSA_SERVER_ROLE;
  1062. //
  1063. // The following data type is used to represent the state of the LSA
  1064. // server (enabled or disabled). Some operations may only be performed on
  1065. // an enabled LSA server.
  1066. //
  1067. typedef enum _POLICY_SERVER_ENABLE_STATE {
  1068. PolicyServerEnabled = 2,
  1069. PolicyServerDisabled
  1070. } POLICY_SERVER_ENABLE_STATE, *PPOLICY_SERVER_ENABLE_STATE;
  1071. //
  1072. // The following data type is used to specify the auditing options for
  1073. // an Audit Event Type.
  1074. //
  1075. typedef ULONG POLICY_AUDIT_EVENT_OPTIONS, *PPOLICY_AUDIT_EVENT_OPTIONS;
  1076. // where the following flags can be set:
  1077. //
  1078. // POLICY_AUDIT_EVENT_UNCHANGED - Leave existing auditing options
  1079. // unchanged for events of this type. This flag is only used for
  1080. // set operations. If this flag is set, then all other flags
  1081. // are ignored.
  1082. //
  1083. // POLICY_AUDIT_EVENT_NONE - Cancel all auditing options for events
  1084. // of this type. If this flag is set, the success/failure flags
  1085. // are ignored.
  1086. //
  1087. // POLICY_AUDIT_EVENT_SUCCESS - When auditing is enabled, audit all
  1088. // successful occurrences of events of the given type.
  1089. //
  1090. // POLICY_AUDIT_EVENT_FAILURE - When auditing is enabled, audit all
  1091. // unsuccessful occurrences of events of the given type.
  1092. //
  1093. // end_ntsecapi
  1094. //
  1095. // The following data type is used to return information about privileges
  1096. // defined on a system.
  1097. //
  1098. typedef struct _POLICY_PRIVILEGE_DEFINITION {
  1099. LSA_UNICODE_STRING Name;
  1100. LUID LocalValue;
  1101. } POLICY_PRIVILEGE_DEFINITION, *PPOLICY_PRIVILEGE_DEFINITION;
  1102. // where the members have the following usage:
  1103. //
  1104. // Name - Is the architected name of the privilege. This is the
  1105. // primary key of the privilege and the only value that is
  1106. // transportable between systems.
  1107. //
  1108. // Luid - is a LUID value assigned locally for efficient representation
  1109. // of the privilege. Ths value is meaningful only on the system it
  1110. // was assigned on and is not transportable in any way.
  1111. //
  1112. //
  1113. // System Flags for LsaLookupNames2
  1114. //
  1115. //
  1116. // Note the flags start backward so that public values
  1117. // don't have gaps.
  1118. //
  1119. //
  1120. // This flag controls LsaLookupNames2 such that isolated names, including
  1121. // UPN's are not searched for off the machine. Composite names
  1122. // (domain\username) are still sent off machine if necessary.
  1123. //
  1124. #define LSA_LOOKUP_ISOLATED_AS_LOCAL 0x80000000
  1125. // begin_ntsecapi
  1126. //
  1127. // The following data type defines the classes of Policy Information
  1128. // that may be queried/set.
  1129. //
  1130. typedef enum _POLICY_INFORMATION_CLASS {
  1131. PolicyAuditLogInformation = 1,
  1132. PolicyAuditEventsInformation,
  1133. PolicyPrimaryDomainInformation,
  1134. PolicyPdAccountInformation,
  1135. PolicyAccountDomainInformation,
  1136. PolicyLsaServerRoleInformation,
  1137. PolicyReplicaSourceInformation,
  1138. PolicyDefaultQuotaInformation,
  1139. PolicyModificationInformation,
  1140. PolicyAuditFullSetInformation,
  1141. PolicyAuditFullQueryInformation,
  1142. PolicyDnsDomainInformation,
  1143. PolicyDnsDomainInformationInt
  1144. } POLICY_INFORMATION_CLASS, *PPOLICY_INFORMATION_CLASS;
  1145. //
  1146. // The following data type corresponds to the PolicyAuditLogInformation
  1147. // information class. It is used to represent information relating to
  1148. // the Audit Log.
  1149. //
  1150. // This structure may be used in both query and set operations. However,
  1151. // when used in set operations, some fields are ignored.
  1152. //
  1153. typedef struct _POLICY_AUDIT_LOG_INFO {
  1154. ULONG AuditLogPercentFull;
  1155. ULONG MaximumLogSize;
  1156. LARGE_INTEGER AuditRetentionPeriod;
  1157. BOOLEAN AuditLogFullShutdownInProgress;
  1158. LARGE_INTEGER TimeToShutdown;
  1159. ULONG NextAuditRecordId;
  1160. } POLICY_AUDIT_LOG_INFO, *PPOLICY_AUDIT_LOG_INFO;
  1161. // where the members have the following usage:
  1162. //
  1163. // AuditLogPercentFull - Indicates the percentage of the Audit Log
  1164. // currently being used.
  1165. //
  1166. // MaximumLogSize - Specifies the maximum size of the Audit Log in
  1167. // kilobytes.
  1168. //
  1169. // AuditRetentionPeriod - Indicates the length of time that Audit
  1170. // Records are to be retained. Audit Records are discardable
  1171. // if their timestamp predates the current time minus the
  1172. // retention period.
  1173. //
  1174. // AuditLogFullShutdownInProgress - Indicates whether or not a system
  1175. // shutdown is being initiated due to the security Audit Log becoming
  1176. // full. This condition will only occur if the system is configured
  1177. // to shutdown when the log becomes full.
  1178. //
  1179. // TRUE indicates that a shutdown is in progress
  1180. // FALSE indicates that a shutdown is not in progress.
  1181. //
  1182. // Once a shutdown has been initiated, this flag will be set to
  1183. // TRUE. If an administrator is able to currect the situation
  1184. // before the shutdown becomes irreversible, then this flag will
  1185. // be reset to false.
  1186. //
  1187. // This field is ignored for set operations.
  1188. //
  1189. // TimeToShutdown - If the AuditLogFullShutdownInProgress flag is set,
  1190. // then this field contains the time left before the shutdown
  1191. // becomes irreversible.
  1192. //
  1193. // This field is ignored for set operations.
  1194. //
  1195. //
  1196. // The following data type corresponds to the PolicyAuditEventsInformation
  1197. // information class. It is used to represent information relating to
  1198. // the audit requirements.
  1199. //
  1200. typedef struct _POLICY_AUDIT_EVENTS_INFO {
  1201. BOOLEAN AuditingMode;
  1202. PPOLICY_AUDIT_EVENT_OPTIONS EventAuditingOptions;
  1203. ULONG MaximumAuditEventCount;
  1204. } POLICY_AUDIT_EVENTS_INFO, *PPOLICY_AUDIT_EVENTS_INFO;
  1205. // where the members have the following usage:
  1206. //
  1207. // AuditingMode - A Boolean variable specifying the Auditing Mode value.
  1208. // This value is interpreted as follows:
  1209. //
  1210. // TRUE - Auditing is to be enabled (set operations) or is enabled
  1211. // (query operations). Audit Records will be generated according
  1212. // to the Event Auditing Options in effect (see the
  1213. // EventAuditingOptions field.
  1214. //
  1215. // FALSE - Auditing is to be disabled (set operations) or is
  1216. // disabled (query operations). No Audit Records will be
  1217. // generated. Note that for set operations the Event Auditing
  1218. // Options in effect will still be updated as specified by the
  1219. // EventAuditingOptions field whether Auditing is enabled or
  1220. // disabled.
  1221. //
  1222. // EventAuditingOptions - Pointer to an array of Auditing Options
  1223. // indexed by Audit Event Type.
  1224. //
  1225. // MaximumAuditEventCount - Specifiesa count of the number of Audit
  1226. // Event Types specified by the EventAuditingOptions parameter. If
  1227. // this count is less than the number of Audit Event Types supported
  1228. // by the system, the Auditing Options for Event Types with IDs
  1229. // higher than (MaximumAuditEventCount + 1) are left unchanged.
  1230. //
  1231. //
  1232. // The following structure corresponds to the PolicyAccountDomainInformation
  1233. // information class.
  1234. //
  1235. typedef struct _POLICY_ACCOUNT_DOMAIN_INFO {
  1236. LSA_UNICODE_STRING DomainName;
  1237. PSID DomainSid;
  1238. } POLICY_ACCOUNT_DOMAIN_INFO, *PPOLICY_ACCOUNT_DOMAIN_INFO;
  1239. // where the members have the following usage:
  1240. //
  1241. // DomainName - Is the name of the domain
  1242. //
  1243. // DomainSid - Is the Sid of the domain
  1244. //
  1245. //
  1246. // The following structure corresponds to the PolicyPrimaryDomainInformation
  1247. // information class.
  1248. //
  1249. typedef struct _POLICY_PRIMARY_DOMAIN_INFO {
  1250. LSA_UNICODE_STRING Name;
  1251. PSID Sid;
  1252. } POLICY_PRIMARY_DOMAIN_INFO, *PPOLICY_PRIMARY_DOMAIN_INFO;
  1253. // where the members have the following usage:
  1254. //
  1255. // Name - Is the name of the domain
  1256. //
  1257. // Sid - Is the Sid of the domain
  1258. //
  1259. //
  1260. // The following structure corresponds to the PolicyDnsDomainInformation
  1261. // information class
  1262. //
  1263. typedef struct _POLICY_DNS_DOMAIN_INFO
  1264. {
  1265. LSA_UNICODE_STRING Name;
  1266. LSA_UNICODE_STRING DnsDomainName;
  1267. LSA_UNICODE_STRING DnsForestName;
  1268. GUID DomainGuid;
  1269. PSID Sid;
  1270. } POLICY_DNS_DOMAIN_INFO, *PPOLICY_DNS_DOMAIN_INFO;
  1271. // where the members have the following usage:
  1272. //
  1273. // Name - Is the name of the Domain
  1274. //
  1275. // DnsDomainName - Is the DNS name of the domain
  1276. //
  1277. // DnsForestName - Is the DNS forest name of the domain
  1278. //
  1279. // DomainGuid - Is the GUID of the domain
  1280. //
  1281. // Sid - Is the Sid of the domain
  1282. //
  1283. // The following structure corresponds to the PolicyPdAccountInformation
  1284. // information class. This structure may be used in Query operations
  1285. // only.
  1286. //
  1287. typedef struct _POLICY_PD_ACCOUNT_INFO {
  1288. LSA_UNICODE_STRING Name;
  1289. } POLICY_PD_ACCOUNT_INFO, *PPOLICY_PD_ACCOUNT_INFO;
  1290. // where the members have the following usage:
  1291. //
  1292. // Name - Is the name of an account in the domain that should be used
  1293. // for authentication and name/ID lookup requests.
  1294. //
  1295. //
  1296. // The following structure corresponds to the PolicyLsaServerRoleInformation
  1297. // information class.
  1298. //
  1299. typedef struct _POLICY_LSA_SERVER_ROLE_INFO {
  1300. POLICY_LSA_SERVER_ROLE LsaServerRole;
  1301. } POLICY_LSA_SERVER_ROLE_INFO, *PPOLICY_LSA_SERVER_ROLE_INFO;
  1302. // where the fields have the following usage:
  1303. //
  1304. // TBS
  1305. //
  1306. //
  1307. // The following structure corresponds to the PolicyReplicaSourceInformation
  1308. // information class.
  1309. //
  1310. typedef struct _POLICY_REPLICA_SOURCE_INFO {
  1311. LSA_UNICODE_STRING ReplicaSource;
  1312. LSA_UNICODE_STRING ReplicaAccountName;
  1313. } POLICY_REPLICA_SOURCE_INFO, *PPOLICY_REPLICA_SOURCE_INFO;
  1314. //
  1315. // The following structure corresponds to the PolicyDefaultQuotaInformation
  1316. // information class.
  1317. //
  1318. typedef struct _POLICY_DEFAULT_QUOTA_INFO {
  1319. QUOTA_LIMITS QuotaLimits;
  1320. } POLICY_DEFAULT_QUOTA_INFO, *PPOLICY_DEFAULT_QUOTA_INFO;
  1321. //
  1322. // The following structure corresponds to the PolicyModificationInformation
  1323. // information class.
  1324. //
  1325. typedef struct _POLICY_MODIFICATION_INFO {
  1326. LARGE_INTEGER ModifiedId;
  1327. LARGE_INTEGER DatabaseCreationTime;
  1328. } POLICY_MODIFICATION_INFO, *PPOLICY_MODIFICATION_INFO;
  1329. // where the members have the following usage:
  1330. //
  1331. // ModifiedId - Is a 64-bit unsigned integer that is incremented each
  1332. // time anything in the LSA database is modified. This value is
  1333. // only modified on Primary Domain Controllers.
  1334. //
  1335. // DatabaseCreationTime - Is the date/time that the LSA Database was
  1336. // created. On Backup Domain Controllers, this value is replicated
  1337. // from the Primary Domain Controller.
  1338. //
  1339. //
  1340. // The following structure type corresponds to the PolicyAuditFullSetInformation
  1341. // Information Class.
  1342. //
  1343. typedef struct _POLICY_AUDIT_FULL_SET_INFO {
  1344. BOOLEAN ShutDownOnFull;
  1345. } POLICY_AUDIT_FULL_SET_INFO, *PPOLICY_AUDIT_FULL_SET_INFO;
  1346. //
  1347. // The following structure type corresponds to the PolicyAuditFullQueryInformation
  1348. // Information Class.
  1349. //
  1350. typedef struct _POLICY_AUDIT_FULL_QUERY_INFO {
  1351. BOOLEAN ShutDownOnFull;
  1352. BOOLEAN LogIsFull;
  1353. } POLICY_AUDIT_FULL_QUERY_INFO, *PPOLICY_AUDIT_FULL_QUERY_INFO;
  1354. //
  1355. // The following data type defines the classes of Policy Information
  1356. // that may be queried/set that has domain wide effect.
  1357. //
  1358. typedef enum _POLICY_DOMAIN_INFORMATION_CLASS {
  1359. // PolicyDomainQualityOfServiceInformation, // value was used in W2K; no longer supported
  1360. PolicyDomainEfsInformation = 2,
  1361. PolicyDomainKerberosTicketInformation
  1362. } POLICY_DOMAIN_INFORMATION_CLASS, *PPOLICY_DOMAIN_INFORMATION_CLASS;
  1363. //
  1364. // QualityOfService information. Corresponds to PolicyDomainQualityOfServiceInformation
  1365. //
  1366. #define POLICY_QOS_SCHANNEL_REQUIRED 0x00000001
  1367. #define POLICY_QOS_OUTBOUND_INTEGRITY 0x00000002
  1368. #define POLICY_QOS_OUTBOUND_CONFIDENTIALITY 0x00000004
  1369. #define POLICY_QOS_INBOUND_INTEGRITY 0x00000008
  1370. #define POLICY_QOS_INBOUND_CONFIDENTIALITY 0x00000010
  1371. #define POLICY_QOS_ALLOW_LOCAL_ROOT_CERT_STORE 0x00000020
  1372. #define POLICY_QOS_RAS_SERVER_ALLOWED 0x00000040
  1373. #define POLICY_QOS_DHCP_SERVER_ALLOWED 0x00000080
  1374. //
  1375. // Bits 0x00000100 through 0xFFFFFFFF are reserved for future use.
  1376. //
  1377. //
  1378. // The following structure corresponds to the PolicyEfsInformation
  1379. // information class
  1380. //
  1381. typedef struct _POLICY_DOMAIN_EFS_INFO {
  1382. ULONG InfoLength;
  1383. PUCHAR EfsBlob;
  1384. } POLICY_DOMAIN_EFS_INFO, *PPOLICY_DOMAIN_EFS_INFO;
  1385. // where the members have the following usage:
  1386. //
  1387. // InfoLength - Length of the EFS Information blob
  1388. //
  1389. // EfsBlob - Efs blob data
  1390. //
  1391. //
  1392. // The following structure corresponds to the PolicyDomainKerberosTicketInformation
  1393. // information class
  1394. #define POLICY_KERBEROS_VALIDATE_CLIENT 0x00000080
  1395. typedef struct _POLICY_DOMAIN_KERBEROS_TICKET_INFO {
  1396. ULONG AuthenticationOptions;
  1397. LARGE_INTEGER MaxServiceTicketAge;
  1398. LARGE_INTEGER MaxTicketAge;
  1399. LARGE_INTEGER MaxRenewAge;
  1400. LARGE_INTEGER MaxClockSkew;
  1401. LARGE_INTEGER Reserved;
  1402. } POLICY_DOMAIN_KERBEROS_TICKET_INFO, *PPOLICY_DOMAIN_KERBEROS_TICKET_INFO;
  1403. //
  1404. // where the members have the following usage
  1405. //
  1406. // AuthenticationOptions -- allowed ticket options (POLICY_KERBEROS_* flags )
  1407. //
  1408. // MaxServiceTicketAge -- Maximum lifetime for a service ticket
  1409. //
  1410. // MaxTicketAge -- Maximum lifetime for the initial ticket
  1411. //
  1412. // MaxRenewAge -- Maximum cumulative age a renewable ticket can be with
  1413. // requring authentication
  1414. //
  1415. // MaxClockSkew -- Maximum tolerance for synchronization of computer clocks
  1416. //
  1417. // Reserved -- Reserved
  1418. //
  1419. // The following data type defines the classes of Policy Information / Policy Domain Information
  1420. // that may be used to request notification
  1421. //
  1422. typedef enum _POLICY_NOTIFICATION_INFORMATION_CLASS {
  1423. PolicyNotifyAuditEventsInformation = 1,
  1424. PolicyNotifyAccountDomainInformation,
  1425. PolicyNotifyServerRoleInformation,
  1426. PolicyNotifyDnsDomainInformation,
  1427. PolicyNotifyDomainEfsInformation,
  1428. PolicyNotifyDomainKerberosTicketInformation,
  1429. PolicyNotifyMachineAccountPasswordInformation
  1430. } POLICY_NOTIFICATION_INFORMATION_CLASS, *PPOLICY_NOTIFICATION_INFORMATION_CLASS;
  1431. // end_ntsecapi
  1432. //
  1433. // Account object type-specific Access Types
  1434. //
  1435. #define ACCOUNT_VIEW 0x00000001L
  1436. #define ACCOUNT_ADJUST_PRIVILEGES 0x00000002L
  1437. #define ACCOUNT_ADJUST_QUOTAS 0x00000004L
  1438. #define ACCOUNT_ADJUST_SYSTEM_ACCESS 0x00000008L
  1439. #define ACCOUNT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED |\
  1440. ACCOUNT_VIEW |\
  1441. ACCOUNT_ADJUST_PRIVILEGES |\
  1442. ACCOUNT_ADJUST_QUOTAS |\
  1443. ACCOUNT_ADJUST_SYSTEM_ACCESS)
  1444. #define ACCOUNT_READ (STANDARD_RIGHTS_READ |\
  1445. ACCOUNT_VIEW)
  1446. #define ACCOUNT_WRITE (STANDARD_RIGHTS_WRITE |\
  1447. ACCOUNT_ADJUST_PRIVILEGES |\
  1448. ACCOUNT_ADJUST_QUOTAS |\
  1449. ACCOUNT_ADJUST_SYSTEM_ACCESS)
  1450. #define ACCOUNT_EXECUTE (STANDARD_RIGHTS_EXECUTE)
  1451. // begin_ntsecapi
  1452. //
  1453. // LSA RPC Context Handle (Opaque form). Note that a Context Handle is
  1454. // always a pointer type unlike regular handles.
  1455. //
  1456. typedef PVOID LSA_HANDLE, *PLSA_HANDLE;
  1457. // end_ntsecapi
  1458. //
  1459. // Trusted Domain object specific access types
  1460. //
  1461. #define TRUSTED_QUERY_DOMAIN_NAME 0x00000001L
  1462. #define TRUSTED_QUERY_CONTROLLERS 0x00000002L
  1463. #define TRUSTED_SET_CONTROLLERS 0x00000004L
  1464. #define TRUSTED_QUERY_POSIX 0x00000008L
  1465. #define TRUSTED_SET_POSIX 0x00000010L
  1466. #define TRUSTED_SET_AUTH 0x00000020L
  1467. #define TRUSTED_QUERY_AUTH 0x00000040L
  1468. #define TRUSTED_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED |\
  1469. TRUSTED_QUERY_DOMAIN_NAME |\
  1470. TRUSTED_QUERY_CONTROLLERS |\
  1471. TRUSTED_SET_CONTROLLERS |\
  1472. TRUSTED_QUERY_POSIX |\
  1473. TRUSTED_SET_POSIX |\
  1474. TRUSTED_SET_AUTH |\
  1475. TRUSTED_QUERY_AUTH)
  1476. #define TRUSTED_READ (STANDARD_RIGHTS_READ |\
  1477. TRUSTED_QUERY_DOMAIN_NAME)
  1478. #define TRUSTED_WRITE (STANDARD_RIGHTS_WRITE |\
  1479. TRUSTED_SET_CONTROLLERS |\
  1480. TRUSTED_SET_POSIX |\
  1481. TRUSTED_SET_AUTH )
  1482. #define TRUSTED_EXECUTE (STANDARD_RIGHTS_EXECUTE |\
  1483. TRUSTED_QUERY_CONTROLLERS |\
  1484. TRUSTED_QUERY_POSIX)
  1485. // begin_ntsecapi
  1486. //
  1487. // Trusted Domain Object specific data types
  1488. //
  1489. //
  1490. // This data type defines the following information classes that may be
  1491. // queried or set.
  1492. //
  1493. typedef enum _TRUSTED_INFORMATION_CLASS {
  1494. TrustedDomainNameInformation = 1,
  1495. TrustedControllersInformation,
  1496. TrustedPosixOffsetInformation,
  1497. TrustedPasswordInformation,
  1498. TrustedDomainInformationBasic,
  1499. TrustedDomainInformationEx,
  1500. TrustedDomainAuthInformation,
  1501. TrustedDomainFullInformation,
  1502. TrustedDomainAuthInformationInternal,
  1503. TrustedDomainFullInformationInternal,
  1504. TrustedDomainInformationEx2Internal,
  1505. TrustedDomainFullInformation2Internal,
  1506. } TRUSTED_INFORMATION_CLASS, *PTRUSTED_INFORMATION_CLASS;
  1507. //
  1508. // The following data type corresponds to the TrustedDomainNameInformation
  1509. // information class.
  1510. //
  1511. typedef struct _TRUSTED_DOMAIN_NAME_INFO {
  1512. LSA_UNICODE_STRING Name;
  1513. } TRUSTED_DOMAIN_NAME_INFO, *PTRUSTED_DOMAIN_NAME_INFO;
  1514. // where members have the following meaning:
  1515. //
  1516. // Name - The name of the Trusted Domain.
  1517. //
  1518. //
  1519. // The following data type corresponds to the TrustedControllersInformation
  1520. // information class.
  1521. //
  1522. typedef struct _TRUSTED_CONTROLLERS_INFO {
  1523. ULONG Entries;
  1524. PLSA_UNICODE_STRING Names;
  1525. } TRUSTED_CONTROLLERS_INFO, *PTRUSTED_CONTROLLERS_INFO;
  1526. // where members have the following meaning:
  1527. //
  1528. // Entries - Indicate how mamy entries there are in the Names array.
  1529. //
  1530. // Names - Pointer to an array of LSA_UNICODE_STRING structures containing the
  1531. // names of domain controllers of the domain. This information may not
  1532. // be accurate and should be used only as a hint. The order of this
  1533. // list is considered significant and will be maintained.
  1534. //
  1535. // By convention, the first name in this list is assumed to be the
  1536. // Primary Domain Controller of the domain. If the Primary Domain
  1537. // Controller is not known, the first name should be set to the NULL
  1538. // string.
  1539. //
  1540. //
  1541. // The following data type corresponds to the TrustedPosixOffsetInformation
  1542. // information class.
  1543. //
  1544. typedef struct _TRUSTED_POSIX_OFFSET_INFO {
  1545. ULONG Offset;
  1546. } TRUSTED_POSIX_OFFSET_INFO, *PTRUSTED_POSIX_OFFSET_INFO;
  1547. // where members have the following meaning:
  1548. //
  1549. // Offset - Is an offset to use for the generation of Posix user and group
  1550. // IDs from SIDs. The Posix ID corresponding to any particular SID is
  1551. // generated by adding the RID of that SID to the Offset of the SID's
  1552. // corresponding TrustedDomain object.
  1553. //
  1554. //
  1555. // The following data type corresponds to the TrustedPasswordInformation
  1556. // information class.
  1557. //
  1558. typedef struct _TRUSTED_PASSWORD_INFO {
  1559. LSA_UNICODE_STRING Password;
  1560. LSA_UNICODE_STRING OldPassword;
  1561. } TRUSTED_PASSWORD_INFO, *PTRUSTED_PASSWORD_INFO;
  1562. typedef LSA_TRUST_INFORMATION TRUSTED_DOMAIN_INFORMATION_BASIC;
  1563. typedef PLSA_TRUST_INFORMATION PTRUSTED_DOMAIN_INFORMATION_BASIC;
  1564. //
  1565. // Direction of the trust
  1566. //
  1567. #define TRUST_DIRECTION_DISABLED 0x00000000
  1568. #define TRUST_DIRECTION_INBOUND 0x00000001
  1569. #define TRUST_DIRECTION_OUTBOUND 0x00000002
  1570. #define TRUST_DIRECTION_BIDIRECTIONAL (TRUST_DIRECTION_INBOUND | TRUST_DIRECTION_OUTBOUND)
  1571. #define TRUST_TYPE_DOWNLEVEL 0x00000001 // NT4 and before
  1572. #define TRUST_TYPE_UPLEVEL 0x00000002 // NT5
  1573. #define TRUST_TYPE_MIT 0x00000003 // Trust with a MIT Kerberos realm
  1574. #define TRUST_TYPE_DCE 0x00000004 // Trust with a DCE realm
  1575. // Levels 0x5 - 0x000FFFFF reserved for future use
  1576. // Provider specific trust levels are from 0x00100000 to 0xFFF00000
  1577. #define TRUST_ATTRIBUTE_NON_TRANSITIVE 0x00000001 // Disallow transitivity
  1578. #define TRUST_ATTRIBUTE_UPLEVEL_ONLY 0x00000002 // Trust link only valid for uplevel client
  1579. #define TRUST_ATTRIBUTE_FILTER_SIDS 0x00000004 // Used to quarantine domains
  1580. #define TRUST_ATTRIBUTE_FOREST_TRANSITIVE 0x00000008 // This link may contain forest trust information
  1581. // Trust attributes 0x00000010 through 0x00200000 are reserved for future use
  1582. // Trust attributes 0x00400000 through 0x00800000 were used previously (up to W2K) and should not be re-used
  1583. // Trust attributes 0x01000000 through 0x80000000 are reserved for user
  1584. #define TRUST_ATTRIBUTES_VALID 0xFF03FFFF
  1585. #define TRUST_ATTRIBUTES_USER 0xFF000000
  1586. typedef struct _TRUSTED_DOMAIN_INFORMATION_EX {
  1587. LSA_UNICODE_STRING Name;
  1588. LSA_UNICODE_STRING FlatName;
  1589. PSID Sid;
  1590. ULONG TrustDirection;
  1591. ULONG TrustType;
  1592. ULONG TrustAttributes;
  1593. } TRUSTED_DOMAIN_INFORMATION_EX, *PTRUSTED_DOMAIN_INFORMATION_EX;
  1594. typedef struct _TRUSTED_DOMAIN_INFORMATION_EX2 {
  1595. LSA_UNICODE_STRING Name;
  1596. LSA_UNICODE_STRING FlatName;
  1597. PSID Sid;
  1598. ULONG TrustDirection;
  1599. ULONG TrustType;
  1600. ULONG TrustAttributes;
  1601. ULONG ForestTrustLength;
  1602. #ifdef MIDL_PASS
  1603. [size_is( ForestTrustLength )]
  1604. #endif
  1605. PUCHAR ForestTrustInfo;
  1606. } TRUSTED_DOMAIN_INFORMATION_EX2, *PTRUSTED_DOMAIN_INFORMATION_EX2;
  1607. //
  1608. // Type of authentication information
  1609. //
  1610. #define TRUST_AUTH_TYPE_NONE 0 // Ignore this entry
  1611. #define TRUST_AUTH_TYPE_NT4OWF 1 // NT4 OWF password
  1612. #define TRUST_AUTH_TYPE_CLEAR 2 // Cleartext password
  1613. #define TRUST_AUTH_TYPE_VERSION 3 // Cleartext password version number
  1614. typedef struct _LSA_AUTH_INFORMATION {
  1615. LARGE_INTEGER LastUpdateTime;
  1616. ULONG AuthType;
  1617. ULONG AuthInfoLength;
  1618. PUCHAR AuthInfo;
  1619. } LSA_AUTH_INFORMATION, *PLSA_AUTH_INFORMATION;
  1620. typedef struct _TRUSTED_DOMAIN_AUTH_INFORMATION {
  1621. ULONG IncomingAuthInfos;
  1622. PLSA_AUTH_INFORMATION IncomingAuthenticationInformation;
  1623. PLSA_AUTH_INFORMATION IncomingPreviousAuthenticationInformation;
  1624. ULONG OutgoingAuthInfos;
  1625. PLSA_AUTH_INFORMATION OutgoingAuthenticationInformation;
  1626. PLSA_AUTH_INFORMATION OutgoingPreviousAuthenticationInformation;
  1627. } TRUSTED_DOMAIN_AUTH_INFORMATION, *PTRUSTED_DOMAIN_AUTH_INFORMATION;
  1628. typedef struct _TRUSTED_DOMAIN_FULL_INFORMATION {
  1629. TRUSTED_DOMAIN_INFORMATION_EX Information;
  1630. TRUSTED_POSIX_OFFSET_INFO PosixOffset;
  1631. TRUSTED_DOMAIN_AUTH_INFORMATION AuthInformation;
  1632. } TRUSTED_DOMAIN_FULL_INFORMATION, *PTRUSTED_DOMAIN_FULL_INFORMATION;
  1633. typedef struct _TRUSTED_DOMAIN_FULL_INFORMATION2 {
  1634. TRUSTED_DOMAIN_INFORMATION_EX2 Information;
  1635. TRUSTED_POSIX_OFFSET_INFO PosixOffset;
  1636. TRUSTED_DOMAIN_AUTH_INFORMATION AuthInformation;
  1637. } TRUSTED_DOMAIN_FULL_INFORMATION2, *PTRUSTED_DOMAIN_FULL_INFORMATION2;
  1638. typedef enum {
  1639. ForestTrustTopLevelName,
  1640. ForestTrustTopLevelNameEx,
  1641. ForestTrustDomainInfo,
  1642. ForestTrustRecordTypeLast = ForestTrustDomainInfo
  1643. } LSA_FOREST_TRUST_RECORD_TYPE;
  1644. #define LSA_FOREST_TRUST_RECORD_TYPE_UNRECOGNIZED 0x80000000
  1645. //
  1646. // Bottom 16 bits of the flags are reserved for disablement reasons
  1647. //
  1648. #define LSA_FTRECORD_DISABLED_REASONS ( 0x0000FFFFL )
  1649. //
  1650. // Reasons for a top-level name forest trust record to be disabled
  1651. //
  1652. #define LSA_TLN_DISABLED_NEW ( 0x00000001L )
  1653. #define LSA_TLN_DISABLED_ADMIN ( 0x00000002L )
  1654. #define LSA_TLN_DISABLED_CONFLICT ( 0x00000004L )
  1655. //
  1656. // Reasons for a domain information forest trust record to be disabled
  1657. //
  1658. #define LSA_SID_DISABLED_ADMIN ( 0x00000001L )
  1659. #define LSA_SID_DISABLED_CONFLICT ( 0x00000002L )
  1660. #define LSA_NB_DISABLED_ADMIN ( 0x00000004L )
  1661. #define LSA_NB_DISABLED_CONFLICT ( 0x00000008L )
  1662. typedef struct _LSA_FOREST_TRUST_DOMAIN_INFO {
  1663. #ifdef MIDL_PASS
  1664. PISID Sid;
  1665. #else
  1666. PSID Sid;
  1667. #endif
  1668. LSA_UNICODE_STRING DnsName;
  1669. LSA_UNICODE_STRING NetbiosName;
  1670. } LSA_FOREST_TRUST_DOMAIN_INFO, *PLSA_FOREST_TRUST_DOMAIN_INFO;
  1671. typedef struct _LSA_FOREST_TRUST_BINARY_DATA {
  1672. ULONG Length;
  1673. #ifdef MIDL_PASS
  1674. [size_is( Length )]
  1675. #endif
  1676. PUCHAR Buffer;
  1677. } LSA_FOREST_TRUST_BINARY_DATA, *PLSA_FOREST_TRUST_BINARY_DATA;
  1678. typedef struct _LSA_FOREST_TRUST_RECORD {
  1679. ULONG Flags;
  1680. LSA_FOREST_TRUST_RECORD_TYPE ForestTrustType; // type of record
  1681. LARGE_INTEGER Time;
  1682. #ifdef MIDL_PASS
  1683. [switch_type( LSA_FOREST_TRUST_RECORD_TYPE ), switch_is( ForestTrustType )]
  1684. #endif
  1685. union { // actual data
  1686. #ifdef MIDL_PASS
  1687. [case( ForestTrustTopLevelName,
  1688. ForestTrustTopLevelNameEx )] LSA_UNICODE_STRING TopLevelName;
  1689. [case( ForestTrustDomainInfo )] LSA_FOREST_TRUST_DOMAIN_INFO DomainInfo;
  1690. [default] LSA_FOREST_TRUST_BINARY_DATA Data;
  1691. #else
  1692. LSA_UNICODE_STRING TopLevelName;
  1693. LSA_FOREST_TRUST_DOMAIN_INFO DomainInfo;
  1694. LSA_FOREST_TRUST_BINARY_DATA Data; // used for unrecognized types
  1695. #endif
  1696. } ForestTrustData;
  1697. } LSA_FOREST_TRUST_RECORD, *PLSA_FOREST_TRUST_RECORD;
  1698. typedef struct _LSA_FOREST_TRUST_INFORMATION {
  1699. ULONG RecordCount;
  1700. #ifdef MIDL_PASS
  1701. [size_is( RecordCount )]
  1702. #endif
  1703. PLSA_FOREST_TRUST_RECORD * Entries;
  1704. } LSA_FOREST_TRUST_INFORMATION, *PLSA_FOREST_TRUST_INFORMATION;
  1705. typedef enum {
  1706. CollisionTdo,
  1707. CollisionXref,
  1708. CollisionOther
  1709. } LSA_FOREST_TRUST_COLLISION_RECORD_TYPE;
  1710. typedef struct _LSA_FOREST_TRUST_COLLISION_RECORD {
  1711. ULONG Index;
  1712. LSA_FOREST_TRUST_COLLISION_RECORD_TYPE Type;
  1713. ULONG Flags;
  1714. LSA_UNICODE_STRING Name;
  1715. } LSA_FOREST_TRUST_COLLISION_RECORD, *PLSA_FOREST_TRUST_COLLISION_RECORD;
  1716. typedef struct _LSA_FOREST_TRUST_COLLISION_INFORMATION {
  1717. ULONG RecordCount;
  1718. #ifdef MIDL_PASS
  1719. [size_is( RecordCount )]
  1720. #endif
  1721. PLSA_FOREST_TRUST_COLLISION_RECORD * Entries;
  1722. } LSA_FOREST_TRUST_COLLISION_INFORMATION, *PLSA_FOREST_TRUST_COLLISION_INFORMATION;
  1723. // end_ntsecapi
  1724. //
  1725. // Secret object specific access types
  1726. //
  1727. #define SECRET_SET_VALUE 0x00000001L
  1728. #define SECRET_QUERY_VALUE 0x00000002L
  1729. #define SECRET_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED |\
  1730. SECRET_SET_VALUE |\
  1731. SECRET_QUERY_VALUE)
  1732. #define SECRET_READ (STANDARD_RIGHTS_READ |\
  1733. SECRET_QUERY_VALUE)
  1734. #define SECRET_WRITE (STANDARD_RIGHTS_WRITE |\
  1735. SECRET_SET_VALUE)
  1736. #define SECRET_EXECUTE (STANDARD_RIGHTS_EXECUTE)
  1737. //
  1738. // Global secret object prefix
  1739. //
  1740. #define LSA_GLOBAL_SECRET_PREFIX L"G$"
  1741. #define LSA_GLOBAL_SECRET_PREFIX_LENGTH 2
  1742. #define LSA_LOCAL_SECRET_PREFIX L"L$"
  1743. #define LSA_LOCAL_SECRET_PREFIX_LENGTH 2
  1744. #define LSA_MACHINE_SECRET_PREFIX L"M$"
  1745. #define LSA_MACHINE_SECRET_PREFIX_LENGTH \
  1746. ( ( sizeof( LSA_MACHINE_SECRET_PREFIX ) - sizeof( WCHAR ) ) / sizeof( WCHAR ) )
  1747. //
  1748. // Secret object specific data types.
  1749. //
  1750. //
  1751. // Secret object limits
  1752. //
  1753. #define LSA_SECRET_MAXIMUM_COUNT 0x00001000L
  1754. #define LSA_SECRET_MAXIMUM_LENGTH 0x00000200L
  1755. // begin_ntsecapi
  1756. //
  1757. // LSA Enumeration Context
  1758. //
  1759. typedef ULONG LSA_ENUMERATION_HANDLE, *PLSA_ENUMERATION_HANDLE;
  1760. //
  1761. // LSA Enumeration Information
  1762. //
  1763. typedef struct _LSA_ENUMERATION_INFORMATION {
  1764. PSID Sid;
  1765. } LSA_ENUMERATION_INFORMATION, *PLSA_ENUMERATION_INFORMATION;
  1766. ////////////////////////////////////////////////////////////////////////////
  1767. // //
  1768. // Local Security Policy - Miscellaneous API function prototypes //
  1769. // //
  1770. ////////////////////////////////////////////////////////////////////////////
  1771. NTSTATUS
  1772. NTAPI
  1773. LsaFreeMemory(
  1774. IN PVOID Buffer
  1775. );
  1776. NTSTATUS
  1777. NTAPI
  1778. LsaClose(
  1779. IN LSA_HANDLE ObjectHandle
  1780. );
  1781. // end_ntsecapi
  1782. NTSTATUS
  1783. NTAPI
  1784. LsaDelete(
  1785. IN LSA_HANDLE ObjectHandle
  1786. );
  1787. NTSTATUS
  1788. NTAPI
  1789. LsaQuerySecurityObject(
  1790. IN LSA_HANDLE ObjectHandle,
  1791. IN SECURITY_INFORMATION SecurityInformation,
  1792. OUT PSECURITY_DESCRIPTOR *SecurityDescriptor
  1793. );
  1794. NTSTATUS
  1795. NTAPI
  1796. LsaSetSecurityObject(
  1797. IN LSA_HANDLE ObjectHandle,
  1798. IN SECURITY_INFORMATION SecurityInformation,
  1799. IN PSECURITY_DESCRIPTOR SecurityDescriptor
  1800. );
  1801. NTSTATUS
  1802. NTAPI
  1803. LsaChangePassword(
  1804. IN PLSA_UNICODE_STRING ServerName,
  1805. IN PLSA_UNICODE_STRING DomainName,
  1806. IN PLSA_UNICODE_STRING AccountName,
  1807. IN PLSA_UNICODE_STRING OldPassword,
  1808. IN PLSA_UNICODE_STRING NewPassword
  1809. );
  1810. // begin_ntsecapi
  1811. typedef struct _SECURITY_LOGON_SESSION_DATA {
  1812. ULONG Size ;
  1813. LUID LogonId ;
  1814. LSA_UNICODE_STRING UserName ;
  1815. LSA_UNICODE_STRING LogonDomain ;
  1816. LSA_UNICODE_STRING AuthenticationPackage ;
  1817. ULONG LogonType ;
  1818. ULONG Session ;
  1819. PSID Sid ;
  1820. LARGE_INTEGER LogonTime ;
  1821. //
  1822. // new for whistler:
  1823. //
  1824. LSA_UNICODE_STRING LogonServer ;
  1825. LSA_UNICODE_STRING DnsDomainName ;
  1826. LSA_UNICODE_STRING Upn ;
  1827. } SECURITY_LOGON_SESSION_DATA, * PSECURITY_LOGON_SESSION_DATA ;
  1828. NTSTATUS
  1829. NTAPI
  1830. LsaEnumerateLogonSessions(
  1831. OUT PULONG LogonSessionCount,
  1832. OUT PLUID * LogonSessionList
  1833. );
  1834. NTSTATUS
  1835. NTAPI
  1836. LsaGetLogonSessionData(
  1837. IN PLUID LogonId,
  1838. OUT PSECURITY_LOGON_SESSION_DATA * ppLogonSessionData
  1839. );
  1840. // end_ntsecapi
  1841. ///////////////////////////////////////////////////////////////////////////////
  1842. // //
  1843. // Local Security Policy - Policy Object API function prototypes //
  1844. // //
  1845. ///////////////////////////////////////////////////////////////////////////////
  1846. // begin_ntsecapi
  1847. NTSTATUS
  1848. NTAPI
  1849. LsaOpenPolicy(
  1850. IN PLSA_UNICODE_STRING SystemName OPTIONAL,
  1851. IN PLSA_OBJECT_ATTRIBUTES ObjectAttributes,
  1852. IN ACCESS_MASK DesiredAccess,
  1853. IN OUT PLSA_HANDLE PolicyHandle
  1854. );
  1855. // end_ntsecapi
  1856. NTSTATUS
  1857. NTAPI
  1858. LsaOpenPolicySce(
  1859. IN PLSA_UNICODE_STRING SystemName OPTIONAL,
  1860. IN PLSA_OBJECT_ATTRIBUTES ObjectAttributes,
  1861. IN ACCESS_MASK DesiredAccess,
  1862. IN OUT PLSA_HANDLE PolicyHandle
  1863. );
  1864. // begin_ntsecapi
  1865. NTSTATUS
  1866. NTAPI
  1867. LsaQueryInformationPolicy(
  1868. IN LSA_HANDLE PolicyHandle,
  1869. IN POLICY_INFORMATION_CLASS InformationClass,
  1870. OUT PVOID *Buffer
  1871. );
  1872. NTSTATUS
  1873. NTAPI
  1874. LsaSetInformationPolicy(
  1875. IN LSA_HANDLE PolicyHandle,
  1876. IN POLICY_INFORMATION_CLASS InformationClass,
  1877. IN PVOID Buffer
  1878. );
  1879. NTSTATUS
  1880. NTAPI
  1881. LsaQueryDomainInformationPolicy(
  1882. IN LSA_HANDLE PolicyHandle,
  1883. IN POLICY_DOMAIN_INFORMATION_CLASS InformationClass,
  1884. OUT PVOID *Buffer
  1885. );
  1886. NTSTATUS
  1887. NTAPI
  1888. LsaSetDomainInformationPolicy(
  1889. IN LSA_HANDLE PolicyHandle,
  1890. IN POLICY_DOMAIN_INFORMATION_CLASS InformationClass,
  1891. IN PVOID Buffer
  1892. );
  1893. NTSTATUS
  1894. NTAPI
  1895. LsaRegisterPolicyChangeNotification(
  1896. IN POLICY_NOTIFICATION_INFORMATION_CLASS InformationClass,
  1897. IN HANDLE NotificationEventHandle
  1898. );
  1899. NTSTATUS
  1900. NTAPI
  1901. LsaUnregisterPolicyChangeNotification(
  1902. IN POLICY_NOTIFICATION_INFORMATION_CLASS InformationClass,
  1903. IN HANDLE NotificationEventHandle
  1904. );
  1905. // end_ntsecapi
  1906. NTSTATUS
  1907. NTAPI
  1908. LsaClearAuditLog(
  1909. IN LSA_HANDLE PolicyHandle
  1910. );
  1911. NTSTATUS
  1912. NTAPI
  1913. LsaCreateAccount(
  1914. IN LSA_HANDLE PolicyHandle,
  1915. IN PSID AccountSid,
  1916. IN ACCESS_MASK DesiredAccess,
  1917. OUT PLSA_HANDLE AccountHandle
  1918. );
  1919. NTSTATUS
  1920. NTAPI
  1921. LsaEnumerateAccounts(
  1922. IN LSA_HANDLE PolicyHandle,
  1923. IN OUT PLSA_ENUMERATION_HANDLE EnumerationContext,
  1924. OUT PVOID *EnumerationBuffer,
  1925. IN ULONG PreferedMaximumLength,
  1926. OUT PULONG CountReturned
  1927. );
  1928. NTSTATUS
  1929. NTAPI
  1930. LsaCreateTrustedDomain(
  1931. IN LSA_HANDLE PolicyHandle,
  1932. IN PLSA_TRUST_INFORMATION TrustedDomainInformation,
  1933. IN ACCESS_MASK DesiredAccess,
  1934. OUT PLSA_HANDLE TrustedDomainHandle
  1935. );
  1936. // begin_ntsecapi
  1937. NTSTATUS
  1938. NTAPI
  1939. LsaEnumerateTrustedDomains(
  1940. IN LSA_HANDLE PolicyHandle,
  1941. IN OUT PLSA_ENUMERATION_HANDLE EnumerationContext,
  1942. OUT PVOID *Buffer,
  1943. IN ULONG PreferedMaximumLength,
  1944. OUT PULONG CountReturned
  1945. );
  1946. // end_ntsecapi
  1947. NTSTATUS
  1948. NTAPI
  1949. LsaEnumeratePrivileges(
  1950. IN LSA_HANDLE PolicyHandle,
  1951. IN OUT PLSA_ENUMERATION_HANDLE EnumerationContext,
  1952. OUT PVOID *Buffer,
  1953. IN ULONG PreferedMaximumLength,
  1954. OUT PULONG CountReturned
  1955. );
  1956. // begin_ntsecapi
  1957. NTSTATUS
  1958. NTAPI
  1959. LsaLookupNames(
  1960. IN LSA_HANDLE PolicyHandle,
  1961. IN ULONG Count,
  1962. IN PLSA_UNICODE_STRING Names,
  1963. OUT PLSA_REFERENCED_DOMAIN_LIST *ReferencedDomains,
  1964. OUT PLSA_TRANSLATED_SID *Sids
  1965. );
  1966. NTSTATUS
  1967. NTAPI
  1968. LsaLookupNames2(
  1969. IN LSA_HANDLE PolicyHandle,
  1970. IN ULONG Flags, // Reserved
  1971. IN ULONG Count,
  1972. IN PLSA_UNICODE_STRING Names,
  1973. OUT PLSA_REFERENCED_DOMAIN_LIST *ReferencedDomains,
  1974. OUT PLSA_TRANSLATED_SID2 *Sids
  1975. );
  1976. NTSTATUS
  1977. NTAPI
  1978. LsaLookupSids(
  1979. IN LSA_HANDLE PolicyHandle,
  1980. IN ULONG Count,
  1981. IN PSID *Sids,
  1982. OUT PLSA_REFERENCED_DOMAIN_LIST *ReferencedDomains,
  1983. OUT PLSA_TRANSLATED_NAME *Names
  1984. );
  1985. // end_ntsecapi
  1986. NTSTATUS
  1987. NTAPI
  1988. LsaCreateSecret(
  1989. IN LSA_HANDLE PolicyHandle,
  1990. IN PLSA_UNICODE_STRING SecretName,
  1991. IN ACCESS_MASK DesiredAccess,
  1992. OUT PLSA_HANDLE SecretHandle
  1993. );
  1994. ///////////////////////////////////////////////////////////////////////////////
  1995. // //
  1996. // Local Security Policy - Account Object API function prototypes //
  1997. // //
  1998. ///////////////////////////////////////////////////////////////////////////////
  1999. NTSTATUS
  2000. NTAPI
  2001. LsaOpenAccount(
  2002. IN LSA_HANDLE PolicyHandle,
  2003. IN PSID AccountSid,
  2004. IN ACCESS_MASK DesiredAccess,
  2005. OUT PLSA_HANDLE AccountHandle
  2006. );
  2007. NTSTATUS
  2008. NTAPI
  2009. LsaEnumeratePrivilegesOfAccount(
  2010. IN LSA_HANDLE AccountHandle,
  2011. OUT PPRIVILEGE_SET *Privileges
  2012. );
  2013. NTSTATUS
  2014. NTAPI
  2015. LsaAddPrivilegesToAccount(
  2016. IN LSA_HANDLE AccountHandle,
  2017. IN PPRIVILEGE_SET Privileges
  2018. );
  2019. NTSTATUS
  2020. NTAPI
  2021. LsaRemovePrivilegesFromAccount(
  2022. IN LSA_HANDLE AccountHandle,
  2023. IN BOOLEAN AllPrivileges,
  2024. IN PPRIVILEGE_SET Privileges
  2025. );
  2026. NTSTATUS
  2027. NTAPI
  2028. LsaGetQuotasForAccount(
  2029. IN LSA_HANDLE AccountHandle,
  2030. OUT PQUOTA_LIMITS QuotaLimits
  2031. );
  2032. NTSTATUS
  2033. NTAPI
  2034. LsaSetQuotasForAccount(
  2035. IN LSA_HANDLE AccountHandle,
  2036. IN PQUOTA_LIMITS QuotaLimits
  2037. );
  2038. NTSTATUS
  2039. NTAPI
  2040. LsaGetSystemAccessAccount(
  2041. IN LSA_HANDLE AccountHandle,
  2042. OUT PULONG SystemAccess
  2043. );
  2044. NTSTATUS
  2045. NTAPI
  2046. LsaSetSystemAccessAccount(
  2047. IN LSA_HANDLE AccountHandle,
  2048. IN ULONG SystemAccess
  2049. );
  2050. ///////////////////////////////////////////////////////////////////////////////
  2051. // //
  2052. // Local Security Policy - Trusted Domain Object API function prototypes //
  2053. // //
  2054. ///////////////////////////////////////////////////////////////////////////////
  2055. NTSTATUS
  2056. NTAPI
  2057. LsaOpenTrustedDomain(
  2058. IN LSA_HANDLE PolicyHandle,
  2059. IN PSID TrustedDomainSid,
  2060. IN ACCESS_MASK DesiredAccess,
  2061. OUT PLSA_HANDLE TrustedDomainHandle
  2062. );
  2063. NTSTATUS
  2064. NTAPI
  2065. LsaQueryInfoTrustedDomain(
  2066. IN LSA_HANDLE TrustedDomainHandle,
  2067. IN TRUSTED_INFORMATION_CLASS InformationClass,
  2068. OUT PVOID *Buffer
  2069. );
  2070. NTSTATUS
  2071. NTAPI
  2072. LsaSetInformationTrustedDomain(
  2073. IN LSA_HANDLE TrustedDomainHandle,
  2074. IN TRUSTED_INFORMATION_CLASS InformationClass,
  2075. IN PVOID Buffer
  2076. );
  2077. ///////////////////////////////////////////////////////////////////////////////
  2078. // //
  2079. // Local Security Policy - Secret Object API function prototypes //
  2080. // //
  2081. ///////////////////////////////////////////////////////////////////////////////
  2082. NTSTATUS
  2083. NTAPI
  2084. LsaOpenSecret(
  2085. IN LSA_HANDLE PolicyHandle,
  2086. IN PLSA_UNICODE_STRING SecretName,
  2087. IN ACCESS_MASK DesiredAccess,
  2088. OUT PLSA_HANDLE SecretHandle
  2089. );
  2090. NTSTATUS
  2091. NTAPI
  2092. LsaSetSecret(
  2093. IN LSA_HANDLE SecretHandle,
  2094. IN OPTIONAL PLSA_UNICODE_STRING CurrentValue,
  2095. IN OPTIONAL PLSA_UNICODE_STRING OldValue
  2096. );
  2097. NTSTATUS
  2098. NTAPI
  2099. LsaQuerySecret(
  2100. IN LSA_HANDLE SecretHandle,
  2101. OUT OPTIONAL PLSA_UNICODE_STRING *CurrentValue,
  2102. OUT OPTIONAL PLARGE_INTEGER CurrentValueSetTime,
  2103. OUT OPTIONAL PLSA_UNICODE_STRING *OldValue,
  2104. OUT OPTIONAL PLARGE_INTEGER OldValueSetTime
  2105. );
  2106. /////////////////////////////////////////////////////////////////////////
  2107. // //
  2108. // Local Security Policy - Privilege Object API Prototypes //
  2109. // //
  2110. /////////////////////////////////////////////////////////////////////////
  2111. NTSTATUS
  2112. NTAPI
  2113. LsaLookupPrivilegeValue(
  2114. IN LSA_HANDLE PolicyHandle,
  2115. IN PLSA_UNICODE_STRING Name,
  2116. OUT PLUID Value
  2117. );
  2118. NTSTATUS
  2119. NTAPI
  2120. LsaLookupPrivilegeName(
  2121. IN LSA_HANDLE PolicyHandle,
  2122. IN PLUID Value,
  2123. OUT PLSA_UNICODE_STRING *Name
  2124. );
  2125. NTSTATUS
  2126. NTAPI
  2127. LsaLookupPrivilegeDisplayName(
  2128. IN LSA_HANDLE PolicyHandle,
  2129. IN PLSA_UNICODE_STRING Name,
  2130. OUT PLSA_UNICODE_STRING *DisplayName,
  2131. OUT PSHORT LanguageReturned
  2132. );
  2133. /////////////////////////////////////////////////////////////////////////
  2134. // //
  2135. // Local Security Policy - New APIs for NT 4.0 (SUR release) //
  2136. // //
  2137. /////////////////////////////////////////////////////////////////////////
  2138. NTSTATUS
  2139. LsaGetUserName(
  2140. OUT PLSA_UNICODE_STRING * UserName,
  2141. OUT OPTIONAL PLSA_UNICODE_STRING * DomainName
  2142. );
  2143. NTSTATUS
  2144. LsaGetRemoteUserName(
  2145. IN OPTIONAL PLSA_UNICODE_STRING SystemName,
  2146. OUT PLSA_UNICODE_STRING * UserName,
  2147. OUT OPTIONAL PLSA_UNICODE_STRING * DomainName
  2148. );
  2149. /////////////////////////////////////////////////////////////////////////
  2150. // //
  2151. // Local Security Policy - New APIs for NT 3.51 (PPC release) //
  2152. // //
  2153. /////////////////////////////////////////////////////////////////////////
  2154. // begin_ntsecapi
  2155. #define SE_INTERACTIVE_LOGON_NAME TEXT("SeInteractiveLogonRight")
  2156. #define SE_NETWORK_LOGON_NAME TEXT("SeNetworkLogonRight")
  2157. #define SE_BATCH_LOGON_NAME TEXT("SeBatchLogonRight")
  2158. #define SE_SERVICE_LOGON_NAME TEXT("SeServiceLogonRight")
  2159. #define SE_DENY_INTERACTIVE_LOGON_NAME TEXT("SeDenyInteractiveLogonRight")
  2160. #define SE_DENY_NETWORK_LOGON_NAME TEXT("SeDenyNetworkLogonRight")
  2161. #define SE_DENY_BATCH_LOGON_NAME TEXT("SeDenyBatchLogonRight")
  2162. #define SE_DENY_SERVICE_LOGON_NAME TEXT("SeDenyServiceLogonRight")
  2163. #define SE_REMOTE_INTERACTIVE_LOGON_NAME TEXT("SeRemoteInteractiveLogonRight")
  2164. #define SE_DENY_REMOTE_INTERACTIVE_LOGON_NAME TEXT("SeDenyRemoteInteractiveLogonRight")
  2165. //
  2166. // This new API returns all the accounts with a certain privilege
  2167. //
  2168. NTSTATUS
  2169. NTAPI
  2170. LsaEnumerateAccountsWithUserRight(
  2171. IN LSA_HANDLE PolicyHandle,
  2172. IN OPTIONAL PLSA_UNICODE_STRING UserRights,
  2173. OUT PVOID *EnumerationBuffer,
  2174. OUT PULONG CountReturned
  2175. );
  2176. //
  2177. // These new APIs differ by taking a SID instead of requiring the caller
  2178. // to open the account first and passing in an account handle
  2179. //
  2180. NTSTATUS
  2181. NTAPI
  2182. LsaEnumerateAccountRights(
  2183. IN LSA_HANDLE PolicyHandle,
  2184. IN PSID AccountSid,
  2185. OUT PLSA_UNICODE_STRING *UserRights,
  2186. OUT PULONG CountOfRights
  2187. );
  2188. NTSTATUS
  2189. NTAPI
  2190. LsaAddAccountRights(
  2191. IN LSA_HANDLE PolicyHandle,
  2192. IN PSID AccountSid,
  2193. IN PLSA_UNICODE_STRING UserRights,
  2194. IN ULONG CountOfRights
  2195. );
  2196. NTSTATUS
  2197. NTAPI
  2198. LsaRemoveAccountRights(
  2199. IN LSA_HANDLE PolicyHandle,
  2200. IN PSID AccountSid,
  2201. IN BOOLEAN AllRights,
  2202. IN PLSA_UNICODE_STRING UserRights,
  2203. IN ULONG CountOfRights
  2204. );
  2205. ///////////////////////////////////////////////////////////////////////////////
  2206. // //
  2207. // Local Security Policy - Trusted Domain Object API function prototypes //
  2208. // //
  2209. ///////////////////////////////////////////////////////////////////////////////
  2210. NTSTATUS
  2211. NTAPI
  2212. LsaOpenTrustedDomainByName(
  2213. IN LSA_HANDLE PolicyHandle,
  2214. IN PLSA_UNICODE_STRING TrustedDomainName,
  2215. IN ACCESS_MASK DesiredAccess,
  2216. OUT PLSA_HANDLE TrustedDomainHandle
  2217. );
  2218. NTSTATUS
  2219. NTAPI
  2220. LsaQueryTrustedDomainInfo(
  2221. IN LSA_HANDLE PolicyHandle,
  2222. IN PSID TrustedDomainSid,
  2223. IN TRUSTED_INFORMATION_CLASS InformationClass,
  2224. OUT PVOID *Buffer
  2225. );
  2226. NTSTATUS
  2227. NTAPI
  2228. LsaSetTrustedDomainInformation(
  2229. IN LSA_HANDLE PolicyHandle,
  2230. IN PSID TrustedDomainSid,
  2231. IN TRUSTED_INFORMATION_CLASS InformationClass,
  2232. IN PVOID Buffer
  2233. );
  2234. NTSTATUS
  2235. NTAPI
  2236. LsaDeleteTrustedDomain(
  2237. IN LSA_HANDLE PolicyHandle,
  2238. IN PSID TrustedDomainSid
  2239. );
  2240. NTSTATUS
  2241. NTAPI
  2242. LsaQueryTrustedDomainInfoByName(
  2243. IN LSA_HANDLE PolicyHandle,
  2244. IN PLSA_UNICODE_STRING TrustedDomainName,
  2245. IN TRUSTED_INFORMATION_CLASS InformationClass,
  2246. OUT PVOID *Buffer
  2247. );
  2248. NTSTATUS
  2249. NTAPI
  2250. LsaSetTrustedDomainInfoByName(
  2251. IN LSA_HANDLE PolicyHandle,
  2252. IN PLSA_UNICODE_STRING TrustedDomainName,
  2253. IN TRUSTED_INFORMATION_CLASS InformationClass,
  2254. IN PVOID Buffer
  2255. );
  2256. NTSTATUS
  2257. NTAPI
  2258. LsaEnumerateTrustedDomainsEx(
  2259. IN LSA_HANDLE PolicyHandle,
  2260. IN OUT PLSA_ENUMERATION_HANDLE EnumerationContext,
  2261. OUT PVOID *Buffer,
  2262. IN ULONG PreferedMaximumLength,
  2263. OUT PULONG CountReturned
  2264. );
  2265. NTSTATUS
  2266. NTAPI
  2267. LsaCreateTrustedDomainEx(
  2268. IN LSA_HANDLE PolicyHandle,
  2269. IN PTRUSTED_DOMAIN_INFORMATION_EX TrustedDomainInformation,
  2270. IN PTRUSTED_DOMAIN_AUTH_INFORMATION AuthenticationInformation,
  2271. IN ACCESS_MASK DesiredAccess,
  2272. OUT PLSA_HANDLE TrustedDomainHandle
  2273. );
  2274. NTSTATUS
  2275. NTAPI
  2276. LsaQueryForestTrustInformation(
  2277. IN LSA_HANDLE PolicyHandle,
  2278. IN PLSA_UNICODE_STRING TrustedDomainName,
  2279. OUT PLSA_FOREST_TRUST_INFORMATION * ForestTrustInfo
  2280. );
  2281. NTSTATUS
  2282. NTAPI
  2283. LsaSetForestTrustInformation(
  2284. IN LSA_HANDLE PolicyHandle,
  2285. IN PLSA_UNICODE_STRING TrustedDomainName,
  2286. IN PLSA_FOREST_TRUST_INFORMATION ForestTrustInfo,
  2287. IN BOOLEAN CheckOnly,
  2288. OUT PLSA_FOREST_TRUST_COLLISION_INFORMATION * CollisionInfo
  2289. );
  2290. // #define TESTING_MATCHING_ROUTINE
  2291. #ifdef TESTING_MATCHING_ROUTINE
  2292. NTSTATUS
  2293. NTAPI
  2294. LsaForestTrustFindMatch(
  2295. IN LSA_HANDLE PolicyHandle,
  2296. IN ULONG Type,
  2297. IN PLSA_UNICODE_STRING Name,
  2298. OUT PLSA_UNICODE_STRING * Match
  2299. );
  2300. #endif
  2301. //
  2302. // This API sets the workstation password (equivalent of setting/getting
  2303. // the SSI_SECRET_NAME secret)
  2304. //
  2305. NTSTATUS
  2306. NTAPI
  2307. LsaStorePrivateData(
  2308. IN LSA_HANDLE PolicyHandle,
  2309. IN PLSA_UNICODE_STRING KeyName,
  2310. IN PLSA_UNICODE_STRING PrivateData
  2311. );
  2312. NTSTATUS
  2313. NTAPI
  2314. LsaRetrievePrivateData(
  2315. IN LSA_HANDLE PolicyHandle,
  2316. IN PLSA_UNICODE_STRING KeyName,
  2317. OUT PLSA_UNICODE_STRING * PrivateData
  2318. );
  2319. ULONG
  2320. NTAPI
  2321. LsaNtStatusToWinError(
  2322. NTSTATUS Status
  2323. );
  2324. //
  2325. // Define a symbol so we can tell if ntifs.h has been included.
  2326. //
  2327. // begin_ntifs
  2328. #ifndef _NTLSA_IFS_
  2329. #define _NTLSA_IFS_
  2330. #endif
  2331. // end_ntifs
  2332. //
  2333. // SPNEGO package stuff
  2334. //
  2335. enum NEGOTIATE_MESSAGES {
  2336. NegEnumPackagePrefixes = 0,
  2337. NegGetCallerName = 1,
  2338. NegCallPackageMax
  2339. } ;
  2340. #define NEGOTIATE_MAX_PREFIX 32
  2341. typedef struct _NEGOTIATE_PACKAGE_PREFIX {
  2342. ULONG_PTR PackageId ;
  2343. PVOID PackageDataA ;
  2344. PVOID PackageDataW ;
  2345. ULONG_PTR PrefixLen ;
  2346. UCHAR Prefix[ NEGOTIATE_MAX_PREFIX ];
  2347. } NEGOTIATE_PACKAGE_PREFIX, * PNEGOTIATE_PACKAGE_PREFIX ;
  2348. typedef struct _NEGOTIATE_PACKAGE_PREFIXES {
  2349. ULONG MessageType ;
  2350. ULONG PrefixCount ;
  2351. ULONG Offset ; // Offset to array of _PREFIX above
  2352. } NEGOTIATE_PACKAGE_PREFIXES, *PNEGOTIATE_PACKAGE_PREFIXES ;
  2353. typedef struct _NEGOTIATE_CALLER_NAME_REQUEST {
  2354. ULONG MessageType ;
  2355. LUID LogonId ;
  2356. } NEGOTIATE_CALLER_NAME_REQUEST, *PNEGOTIATE_CALLER_NAME_REQUEST ;
  2357. typedef struct _NEGOTIATE_CALLER_NAME_RESPONSE {
  2358. ULONG MessageType ;
  2359. PWSTR CallerName ;
  2360. } NEGOTIATE_CALLER_NAME_RESPONSE, * PNEGOTIATE_CALLER_NAME_RESPONSE ;
  2361. #define NEGOTIATE_ALLOW_NTLM 0x10000000
  2362. #define NEGOTIATE_NEG_NTLM 0x20000000
  2363. // end_ntsecapi
  2364. //
  2365. // Define parallel structures for WOW64 environment. These
  2366. // *must* stay in sync with their complements above.
  2367. //
  2368. typedef struct _NEGOTIATE_PACKAGE_PREFIX_WOW {
  2369. ULONG PackageId ;
  2370. ULONG PackageDataA ;
  2371. ULONG PackageDataW ;
  2372. ULONG PrefixLen ;
  2373. UCHAR Prefix[ NEGOTIATE_MAX_PREFIX ];
  2374. } NEGOTIATE_PACKAGE_PREFIX_WOW, * PNEGOTIATE_PACKAGE_PREFIX_WOW ;
  2375. typedef struct _NEGOTIATE_CALLER_NAME_RESPONSE_WOW {
  2376. ULONG MessageType ;
  2377. ULONG CallerName ;
  2378. } NEGOTIATE_CALLER_NAME_RESPONSE_WOW, * PNEGOTIATE_CALLER_NAME_RESPONSE_WOW ;
  2379. NTSTATUS
  2380. NTAPI
  2381. LsaSetPolicyReplicationHandle(
  2382. IN OUT PLSA_HANDLE PolicyHandle
  2383. );
  2384. #ifdef __cplusplus
  2385. }
  2386. #endif
  2387. #endif // _NTLSA_