7c96a898baac92b77aef94b1a59ab091c829c9e4
[kai/samba-autobuild/.git] / librpc / idl / lsa.idl
1 #include "idl_types.h"
2
3 /*
4   lsa interface definition
5 */
6
7 import "misc.idl", "security.idl";
8
9 [ uuid("12345778-1234-abcd-ef00-0123456789ab"),
10   version(0.0),
11   endpoint("ncacn_np:[\\pipe\\lsarpc]","ncacn_np:[\\pipe\\netlogon]","ncacn_np:[\\pipe\\lsass]", "ncacn_ip_tcp:", "ncalrpc:"),
12   pointer_default(unique),
13   helpstring("Local Security Authority")
14 ] interface lsarpc
15 {
16         typedef bitmap security_secinfo security_secinfo;
17         typedef bitmap kerb_EncTypes kerb_EncTypes;
18
19         typedef [public] struct {
20                 [value(2*strlen_m(string))] uint16 length;
21                 [value(2*strlen_m(string))] uint16 size;
22                 [charset(UTF16),size_is(size/2),length_is(length/2)] uint16 *string;
23         } lsa_String;
24
25         typedef [public] struct {
26                 [value(2*strlen_m(string))] uint16 length;
27                 [value(2*strlen_m_term(string))] uint16 size;
28                 [charset(UTF16),size_is(size/2),length_is(length/2)] uint16 *string;
29         } lsa_StringLarge;
30
31         typedef [public] struct {
32                 uint32 count;
33                 [size_is(count)] lsa_String *names;
34         } lsa_Strings;
35
36         typedef [public] struct {
37                 [value(strlen_m(string))] uint16 length;
38                 [value(strlen_m(string))] uint16 size;
39                 [charset(DOS),size_is(size),length_is(length)] uint8 *string;
40         } lsa_AsciiString;
41
42         typedef [public] struct {
43                 [value(strlen_m(string))] uint16 length;
44                 [value(strlen_m_term(string))] uint16 size;
45                 [charset(DOS),size_is(size),length_is(length)] uint8 *string;
46         } lsa_AsciiStringLarge;
47
48         typedef [public] struct {
49                 uint16 length;
50                 uint16 size;
51                 [size_is(size/2),length_is(length/2)] uint16 *array;
52         } lsa_BinaryString;
53
54         /******************/
55         /* Function: 0x00 */
56         NTSTATUS lsa_Close (
57                 [in,out]     policy_handle *handle
58                 );
59
60
61         /******************/
62         /* Function: 0x01 */
63         [public] NTSTATUS lsa_Delete (
64                 [in]     policy_handle *handle
65                 );
66
67
68         /******************/
69         /* Function: 0x02 */
70         typedef struct {
71                 uint32 low;
72                 uint32 high;
73         } lsa_LUID;
74
75         typedef struct {
76                 lsa_StringLarge name;
77                 lsa_LUID luid;
78         } lsa_PrivEntry;
79
80         typedef struct {
81                 uint32 count;
82                 [size_is(count)] lsa_PrivEntry *privs;
83         } lsa_PrivArray;
84
85         [public] NTSTATUS lsa_EnumPrivs (
86                 [in]            policy_handle *handle,
87                 [in,out,ref]    uint32 *resume_handle,
88                 [out,ref]       lsa_PrivArray *privs,
89                 [in]            uint32 max_count
90                 );
91
92         /******************/
93         /* Function: 0x03 */
94         NTSTATUS lsa_QuerySecurity (
95                 [in]            policy_handle *handle,
96                 [in]            security_secinfo sec_info,
97                 [out,ref]       sec_desc_buf **sdbuf
98                 );
99
100         /******************/
101         /* Function: 0x04 */
102         NTSTATUS lsa_SetSecObj(
103                 [in]            policy_handle *handle,
104                 [in]            security_secinfo sec_info,
105                 [in,ref]        sec_desc_buf *sdbuf
106                 );
107
108         /******************/
109         /* Function: 0x05 */
110         [todo] NTSTATUS lsa_ChangePassword ();
111
112
113         /******************/
114         /* Function: 0x06 */
115         typedef struct {
116                 uint3264  len; /* ignored */
117                 uint16  impersonation_level;
118                 uint8   context_mode;
119                 uint8   effective_only;
120         } lsa_QosInfo;
121
122         typedef struct {
123                 uint3264 len; /* ignored */
124                 uint8 *root_dir;
125                 [string,charset(UTF16)] uint16 *object_name;
126                 uint32 attributes;
127                 security_descriptor *sec_desc;
128                 lsa_QosInfo *sec_qos;
129         } lsa_ObjectAttribute;
130
131         typedef [public,bitmap32bit] bitmap {
132                 LSA_POLICY_VIEW_LOCAL_INFORMATION       = 0x00000001,
133                 LSA_POLICY_VIEW_AUDIT_INFORMATION       = 0x00000002,
134                 LSA_POLICY_GET_PRIVATE_INFORMATION      = 0x00000004,
135                 LSA_POLICY_TRUST_ADMIN                  = 0x00000008,
136                 LSA_POLICY_CREATE_ACCOUNT               = 0x00000010,
137                 LSA_POLICY_CREATE_SECRET                = 0x00000020,
138                 LSA_POLICY_CREATE_PRIVILEGE             = 0x00000040,
139                 LSA_POLICY_SET_DEFAULT_QUOTA_LIMITS     = 0x00000080,
140                 LSA_POLICY_SET_AUDIT_REQUIREMENTS       = 0x00000100,
141                 LSA_POLICY_AUDIT_LOG_ADMIN              = 0x00000200,
142                 LSA_POLICY_SERVER_ADMIN                 = 0x00000400,
143                 LSA_POLICY_LOOKUP_NAMES                 = 0x00000800,
144                 LSA_POLICY_NOTIFICATION                 = 0x00001000
145         } lsa_PolicyAccessMask;
146
147         const int LSA_POLICY_ALL_ACCESS =
148                 (STANDARD_RIGHTS_REQUIRED_ACCESS        |
149                 LSA_POLICY_VIEW_LOCAL_INFORMATION       |
150                 LSA_POLICY_VIEW_AUDIT_INFORMATION       |
151                 LSA_POLICY_GET_PRIVATE_INFORMATION      |
152                 LSA_POLICY_TRUST_ADMIN                  |
153                 LSA_POLICY_CREATE_ACCOUNT               |
154                 LSA_POLICY_CREATE_SECRET                |
155                 LSA_POLICY_CREATE_PRIVILEGE             |
156                 LSA_POLICY_SET_DEFAULT_QUOTA_LIMITS     |
157                 LSA_POLICY_SET_AUDIT_REQUIREMENTS       |
158                 LSA_POLICY_AUDIT_LOG_ADMIN              |
159                 LSA_POLICY_SERVER_ADMIN                 |
160                 LSA_POLICY_LOOKUP_NAMES                 |
161                 LSA_POLICY_NOTIFICATION);
162
163         const int LSA_POLICY_READ =
164                 (STANDARD_RIGHTS_READ_ACCESS            |
165                 LSA_POLICY_VIEW_LOCAL_INFORMATION       |
166                 LSA_POLICY_VIEW_AUDIT_INFORMATION       |
167                 LSA_POLICY_GET_PRIVATE_INFORMATION);
168
169         const int LSA_POLICY_WRITE =
170                 (STANDARD_RIGHTS_READ_ACCESS            |
171                 LSA_POLICY_TRUST_ADMIN                  |
172                 LSA_POLICY_CREATE_ACCOUNT               |
173                 LSA_POLICY_CREATE_SECRET                |
174                 LSA_POLICY_CREATE_PRIVILEGE             |
175                 LSA_POLICY_SET_DEFAULT_QUOTA_LIMITS     |
176                 LSA_POLICY_SET_AUDIT_REQUIREMENTS       |
177                 LSA_POLICY_AUDIT_LOG_ADMIN              |
178                 LSA_POLICY_SERVER_ADMIN);
179
180         const int LSA_POLICY_EXECUTE =
181                 (STANDARD_RIGHTS_EXECUTE_ACCESS         |
182                 LSA_POLICY_VIEW_LOCAL_INFORMATION       |
183                 LSA_POLICY_LOOKUP_NAMES);
184
185         typedef [public,bitmap32bit] bitmap {
186                 LSA_ACCOUNT_VIEW                        = 0x00000001,
187                 LSA_ACCOUNT_ADJUST_PRIVILEGES           = 0x00000002,
188                 LSA_ACCOUNT_ADJUST_QUOTAS               = 0x00000004,
189                 LSA_ACCOUNT_ADJUST_SYSTEM_ACCESS        = 0x00000008
190         } lsa_AccountAccessMask;
191
192         const int LSA_ACCOUNT_ALL_ACCESS =
193                 (STANDARD_RIGHTS_REQUIRED_ACCESS        |
194                 LSA_ACCOUNT_VIEW                        |
195                 LSA_ACCOUNT_ADJUST_PRIVILEGES           |
196                 LSA_ACCOUNT_ADJUST_QUOTAS               |
197                 LSA_ACCOUNT_ADJUST_SYSTEM_ACCESS);
198
199         const int LSA_ACCOUNT_READ =
200                 (STANDARD_RIGHTS_READ_ACCESS            |
201                 LSA_ACCOUNT_VIEW);
202
203         const int LSA_ACCOUNT_WRITE =
204                 (STANDARD_RIGHTS_READ_ACCESS            |
205                 LSA_ACCOUNT_ADJUST_PRIVILEGES           |
206                 LSA_ACCOUNT_ADJUST_QUOTAS               |
207                 LSA_ACCOUNT_ADJUST_SYSTEM_ACCESS);
208
209         const int LSA_ACCOUNT_EXECUTE =
210                 (STANDARD_RIGHTS_EXECUTE_ACCESS);
211
212         typedef [public,bitmap32bit] bitmap {
213                 LSA_SECRET_SET_VALUE                    = 0x00000001,
214                 LSA_SECRET_QUERY_VALUE                  = 0x00000002
215         } lsa_SecretAccessMask;
216
217         const int LSA_SECRET_ALL_ACCESS =
218                 (LSA_SECRET_QUERY_VALUE |
219                  LSA_SECRET_SET_VALUE |
220                  SEC_STD_DELETE |
221                  STANDARD_RIGHTS_READ_ACCESS |
222                  SEC_STD_WRITE_DAC |
223                  SEC_STD_WRITE_OWNER); /* 0x000F0003 */
224
225         const int LSA_SECRET_READ =
226                 (LSA_SECRET_QUERY_VALUE |
227                 STANDARD_RIGHTS_READ_ACCESS); /* 0x00020002 */
228
229         const int LSA_SECRET_WRITE =
230                 (LSA_SECRET_SET_VALUE |
231                 STANDARD_RIGHTS_READ_ACCESS); /* 0x00020001 */
232
233         const int LSA_SECRET_EXECUTE =
234                 (STANDARD_RIGHTS_READ_ACCESS); /* 0x00020000 */
235
236         typedef [public,bitmap32bit] bitmap {
237                 LSA_TRUSTED_QUERY_DOMAIN_NAME           = 0x00000001,
238                 LSA_TRUSTED_QUERY_CONTROLLERS           = 0x00000002,
239                 LSA_TRUSTED_SET_CONTROLLERS             = 0x00000004,
240                 LSA_TRUSTED_QUERY_POSIX                 = 0x00000008,
241                 LSA_TRUSTED_SET_POSIX                   = 0x00000010,
242                 LSA_TRUSTED_SET_AUTH                    = 0x00000020,
243                 LSA_TRUSTED_QUERY_AUTH                  = 0x00000040
244         } lsa_TrustedAccessMask;
245
246         const int LSA_TRUSTED_DOMAIN_ALL_ACCESS =
247                 (LSA_TRUSTED_QUERY_DOMAIN_NAME |
248                  LSA_TRUSTED_QUERY_CONTROLLERS |
249                  LSA_TRUSTED_SET_CONTROLLERS |
250                  LSA_TRUSTED_QUERY_POSIX |
251                  LSA_TRUSTED_SET_POSIX |
252                  LSA_TRUSTED_SET_AUTH |
253                  LSA_TRUSTED_QUERY_AUTH |
254                  SEC_STD_DELETE |
255                  STANDARD_RIGHTS_READ_ACCESS |
256                  SEC_STD_WRITE_DAC |
257                  SEC_STD_WRITE_OWNER); /* 0x000F007F */
258
259         const int LSA_TRUSTED_DOMAIN_READ =
260                 (LSA_TRUSTED_QUERY_DOMAIN_NAME |
261                  STANDARD_RIGHTS_READ_ACCESS); /* 0x00020001 */
262
263         const int LSA_TRUSTED_DOMAIN_WRITE =
264                 (LSA_TRUSTED_SET_CONTROLLERS |
265                  LSA_TRUSTED_SET_POSIX |
266                  LSA_TRUSTED_SET_AUTH |
267                  STANDARD_RIGHTS_READ_ACCESS); /* 0x00020034 */
268
269         const int LSA_TRUSTED_DOMAIN_EXECUTE =
270                 (LSA_TRUSTED_QUERY_DOMAIN_NAME |
271                  LSA_TRUSTED_QUERY_POSIX |
272                  STANDARD_RIGHTS_READ_ACCESS); /* 0x0002000C */
273
274
275         /* notice the screwup with the system_name - thats why MS created
276            OpenPolicy2 */
277         [public] NTSTATUS lsa_OpenPolicy (
278                 [in,unique]       uint16 *system_name,
279                 [in]   lsa_ObjectAttribute *attr,
280                 [in]   lsa_PolicyAccessMask access_mask,
281                 [out]  policy_handle *handle
282                 );
283
284
285
286         /******************/
287         /* Function: 0x07 */
288
289         typedef struct {
290                 uint32 percent_full;
291                 uint32 maximum_log_size;
292                 hyper  retention_time;
293                 uint8  shutdown_in_progress;
294                 hyper  time_to_shutdown;
295                 uint32 next_audit_record;
296         } lsa_AuditLogInfo;
297
298         typedef [v1_enum] enum {
299                 LSA_AUDIT_POLICY_NONE=0,
300                 LSA_AUDIT_POLICY_SUCCESS=1,
301                 LSA_AUDIT_POLICY_FAILURE=2,
302                 LSA_AUDIT_POLICY_ALL=(LSA_AUDIT_POLICY_SUCCESS|LSA_AUDIT_POLICY_FAILURE),
303                 LSA_AUDIT_POLICY_CLEAR=4
304         } lsa_PolicyAuditPolicy;
305
306         typedef enum {
307                 LSA_AUDIT_CATEGORY_SYSTEM = 0,
308                 LSA_AUDIT_CATEGORY_LOGON = 1,
309                 LSA_AUDIT_CATEGORY_FILE_AND_OBJECT_ACCESS = 2,
310                 LSA_AUDIT_CATEGORY_USE_OF_USER_RIGHTS = 3,
311                 LSA_AUDIT_CATEGORY_PROCCESS_TRACKING = 4,
312                 LSA_AUDIT_CATEGORY_SECURITY_POLICY_CHANGES = 5,
313                 LSA_AUDIT_CATEGORY_ACCOUNT_MANAGEMENT = 6,
314                 LSA_AUDIT_CATEGORY_DIRECTORY_SERVICE_ACCESS = 7,        /* only in win2k/2k3 */
315                 LSA_AUDIT_CATEGORY_ACCOUNT_LOGON = 8                    /* only in win2k/2k3 */
316         } lsa_PolicyAuditEventType;
317
318         typedef struct {
319                 uint32 auditing_mode;
320                 [size_is(count)] lsa_PolicyAuditPolicy *settings;
321                 uint32 count;
322         } lsa_AuditEventsInfo;
323
324         typedef struct {
325                 lsa_StringLarge name;
326                 dom_sid2 *sid;
327         } lsa_DomainInfo;
328
329         typedef struct {
330                 lsa_String name;
331         } lsa_PDAccountInfo;
332
333         typedef [v1_enum] enum {
334                 LSA_ROLE_BACKUP=2,
335                 LSA_ROLE_PRIMARY=3
336         } lsa_Role;
337
338         typedef struct {
339                 lsa_Role role;
340         } lsa_ServerRole;
341
342         typedef struct {
343                 lsa_String source;
344                 lsa_String account;
345         } lsa_ReplicaSourceInfo;
346
347         typedef struct {
348                 uint32 paged_pool;
349                 uint32 non_paged_pool;
350                 uint32 min_wss;
351                 uint32 max_wss;
352                 uint32 pagefile;
353                 hyper unknown;
354         } lsa_DefaultQuotaInfo;
355
356         typedef struct {
357                 hyper modified_id;
358                 NTTIME_hyper db_create_time;
359         } lsa_ModificationInfo;
360
361         typedef struct {
362                 uint8 shutdown_on_full;
363         } lsa_AuditFullSetInfo;
364
365         typedef struct {
366                 uint8 shutdown_on_full;
367                 uint8 log_is_full;
368         } lsa_AuditFullQueryInfo;
369
370         typedef struct {
371                 /* it's important that we use the lsa_StringLarge here,
372                  * because otherwise windows clients result with such dns hostnames
373                  * e.g. w2k3-client.samba4.samba.orgsamba4.samba.org
374                  * where it should be
375                  *      w2k3-client.samba4.samba.org
376                  */
377                 lsa_StringLarge name;
378                 lsa_StringLarge dns_domain;
379                 lsa_StringLarge dns_forest;
380                 GUID domain_guid;
381                 dom_sid2 *sid;
382         } lsa_DnsDomainInfo;
383
384         typedef enum {
385                 LSA_POLICY_INFO_AUDIT_LOG=1,
386                 LSA_POLICY_INFO_AUDIT_EVENTS=2,
387                 LSA_POLICY_INFO_DOMAIN=3,
388                 LSA_POLICY_INFO_PD=4,
389                 LSA_POLICY_INFO_ACCOUNT_DOMAIN=5,
390                 LSA_POLICY_INFO_ROLE=6,
391                 LSA_POLICY_INFO_REPLICA=7,
392                 LSA_POLICY_INFO_QUOTA=8,
393                 LSA_POLICY_INFO_MOD=9,
394                 LSA_POLICY_INFO_AUDIT_FULL_SET=10,
395                 LSA_POLICY_INFO_AUDIT_FULL_QUERY=11,
396                 LSA_POLICY_INFO_DNS=12,
397                 LSA_POLICY_INFO_DNS_INT=13,
398                 LSA_POLICY_INFO_L_ACCOUNT_DOMAIN=14
399         } lsa_PolicyInfo;
400
401         typedef [switch_type(uint16)] union {
402                 [case(LSA_POLICY_INFO_AUDIT_LOG)]        lsa_AuditLogInfo       audit_log;
403                 [case(LSA_POLICY_INFO_AUDIT_EVENTS)]     lsa_AuditEventsInfo    audit_events;
404                 [case(LSA_POLICY_INFO_DOMAIN)]           lsa_DomainInfo         domain;
405                 [case(LSA_POLICY_INFO_PD)]               lsa_PDAccountInfo      pd;
406                 [case(LSA_POLICY_INFO_ACCOUNT_DOMAIN)]   lsa_DomainInfo         account_domain;
407                 [case(LSA_POLICY_INFO_ROLE)]             lsa_ServerRole         role;
408                 [case(LSA_POLICY_INFO_REPLICA)]          lsa_ReplicaSourceInfo  replica;
409                 [case(LSA_POLICY_INFO_QUOTA)]            lsa_DefaultQuotaInfo   quota;
410                 [case(LSA_POLICY_INFO_MOD)]              lsa_ModificationInfo   mod;
411                 [case(LSA_POLICY_INFO_AUDIT_FULL_SET)]   lsa_AuditFullSetInfo   auditfullset;
412                 [case(LSA_POLICY_INFO_AUDIT_FULL_QUERY)] lsa_AuditFullQueryInfo auditfullquery;
413                 [case(LSA_POLICY_INFO_DNS)]              lsa_DnsDomainInfo      dns;
414                 [case(LSA_POLICY_INFO_DNS_INT)]          lsa_DnsDomainInfo      dns;
415                 [case(LSA_POLICY_INFO_L_ACCOUNT_DOMAIN)] lsa_DomainInfo         l_account_domain;
416         } lsa_PolicyInformation;
417
418         NTSTATUS lsa_QueryInfoPolicy(
419                 [in]                            policy_handle *handle,
420                 [in]                            lsa_PolicyInfo level,
421                 [out,ref,switch_is(level)]      lsa_PolicyInformation **info
422                 );
423
424         /******************/
425         /* Function:       0x08 */
426         NTSTATUS lsa_SetInfoPolicy (
427                 [in]                            policy_handle *handle,
428                 [in]                            lsa_PolicyInfo level,
429                 [in,switch_is(level)]           lsa_PolicyInformation *info
430                 );
431
432         /******************/
433         /* Function:       0x09 */
434         [todo] NTSTATUS lsa_ClearAuditLog ();
435
436         /******************/
437         /* Function: 0x0a */
438         [public] NTSTATUS lsa_CreateAccount (
439                 [in]    policy_handle *handle,
440                 [in,ref] dom_sid2 *sid,
441                 [in]    lsa_AccountAccessMask access_mask,
442                 [out]   policy_handle *acct_handle
443                 );
444
445         /******************/
446         /* NOTE: This only returns accounts that have at least
447            one privilege set
448         */
449         /* Function: 0x0b */
450         typedef struct {
451                 dom_sid2 *sid;
452         } lsa_SidPtr;
453
454         typedef [public] struct {
455                 [range(0,20480)] uint32 num_sids;
456                 [size_is(num_sids)] lsa_SidPtr *sids;
457         } lsa_SidArray;
458
459         [public] NTSTATUS lsa_EnumAccounts(
460                 [in]         policy_handle *handle,
461                 [in,out,ref] uint32 *resume_handle,
462                 [out,ref]    lsa_SidArray *sids,
463                 [in,range(0,8192)] uint32 num_entries
464                 );
465
466         /*************************************************/
467         /* Function: 0x0c                                */
468
469         [public] NTSTATUS lsa_CreateTrustedDomain(
470                 [in]         policy_handle *policy_handle,
471                 [in]         lsa_DomainInfo *info,
472                 [in]         lsa_TrustedAccessMask access_mask,
473                 [out]        policy_handle *trustdom_handle
474                 );
475
476
477         /******************/
478         /* Function: 0x0d */
479
480         /* w2k3 treats max_size as max_domains*60       */
481         const int LSA_ENUM_TRUST_DOMAIN_MULTIPLIER = 60;
482
483         typedef struct {
484                 uint32 count;
485                 [size_is(count)] lsa_DomainInfo *domains;
486         } lsa_DomainList;
487
488         NTSTATUS lsa_EnumTrustDom(
489                 [in]               policy_handle *handle,
490                 [in,out,ref]       uint32 *resume_handle,
491                 [out,ref]          lsa_DomainList *domains,
492                 [in]               uint32 max_size
493                 );
494
495
496         /******************/
497         /* Function: 0x0e */
498         typedef [public] enum {
499                 SID_NAME_USE_NONE = 0,/* NOTUSED */
500                 SID_NAME_USER     = 1, /* user */
501                 SID_NAME_DOM_GRP  = 2, /* domain group */
502                 SID_NAME_DOMAIN   = 3, /* domain: don't know what this is */
503                 SID_NAME_ALIAS    = 4, /* local group */
504                 SID_NAME_WKN_GRP  = 5, /* well-known group */
505                 SID_NAME_DELETED  = 6, /* deleted account: needed for c2 rating */
506                 SID_NAME_INVALID  = 7, /* invalid account */
507                 SID_NAME_UNKNOWN  = 8, /* oops. */
508                 SID_NAME_COMPUTER = 9  /* machine */
509         } lsa_SidType;
510
511         typedef struct {
512                 lsa_SidType sid_type;
513                 uint32 rid;
514                 uint32 sid_index;
515         } lsa_TranslatedSid;
516
517         typedef struct {
518                 [range(0,1000)] uint32 count;
519                 [size_is(count)] lsa_TranslatedSid *sids;
520         } lsa_TransSidArray;
521
522         const int LSA_REF_DOMAIN_LIST_MULTIPLIER = 32;
523         typedef [public] struct {
524                 [range(0,1000)] uint32 count;
525                 [size_is(count)] lsa_DomainInfo *domains;
526                 uint32 max_size;
527         } lsa_RefDomainList;
528
529         /* Level 1: Ask everywhere
530          * Level 2: Ask domain and trusted domains, no builtin and wkn
531          * Level 3: Only ask domain
532          * Level 4: W2k3ad: Only ask AD trusts
533          * Level 5: Only ask transitive forest trusts
534          * Level 6: Like 4
535          */
536
537         typedef [public] enum {
538                 LSA_LOOKUP_NAMES_ALL = 1,
539                 LSA_LOOKUP_NAMES_DOMAINS_ONLY = 2,
540                 LSA_LOOKUP_NAMES_PRIMARY_DOMAIN_ONLY = 3,
541                 LSA_LOOKUP_NAMES_UPLEVEL_TRUSTS_ONLY = 4,
542                 LSA_LOOKUP_NAMES_FOREST_TRUSTS_ONLY = 5,
543                 LSA_LOOKUP_NAMES_UPLEVEL_TRUSTS_ONLY2 = 6,
544                 LSA_LOOKUP_NAMES_RODC_REFERRAL_TO_FULL_DC = 7
545         } lsa_LookupNamesLevel;
546
547         [public] NTSTATUS lsa_LookupNames (
548                 [in]         policy_handle *handle,
549                 [in,range(0,1000)] uint32 num_names,
550                 [in,size_is(num_names)]  lsa_String names[],
551                 [out,ref]    lsa_RefDomainList **domains,
552                 [in,out,ref] lsa_TransSidArray *sids,
553                 [in]         lsa_LookupNamesLevel level,
554                 [in,out,ref] uint32 *count
555                 );
556
557
558         /******************/
559         /* Function: 0x0f */
560
561         typedef struct {
562                 lsa_SidType sid_type;
563                 lsa_String name;
564                 uint32 sid_index;
565         } lsa_TranslatedName;
566
567         typedef [public] struct {
568                 [range(0,20480)] uint32 count;
569                 [size_is(count)] lsa_TranslatedName *names;
570         } lsa_TransNameArray;
571
572         [public] NTSTATUS lsa_LookupSids(
573                 [in]         policy_handle *handle,
574                 [in,ref]     lsa_SidArray *sids,
575                 [out,ref]    lsa_RefDomainList **domains,
576                 [in,out,ref] lsa_TransNameArray *names,
577                 [in]         lsa_LookupNamesLevel level,
578                 [in,out,ref] uint32 *count
579                 );
580
581
582         /* Function:        0x10 */
583         [public] NTSTATUS lsa_CreateSecret(
584                 [in]         policy_handle *handle,
585                 [in]         lsa_String       name,
586                 [in]         lsa_SecretAccessMask access_mask,
587                 [out]        policy_handle *sec_handle
588                 );
589
590
591         /*****************************************/
592         /* Function:     0x11                    */
593         NTSTATUS lsa_OpenAccount(
594                 [in]         policy_handle *handle,
595                 [in,ref]     dom_sid2 *sid,
596                 [in]         lsa_AccountAccessMask access_mask,
597                 [out]        policy_handle *acct_handle
598                 );
599
600
601         /****************************************/
602         /* Function:    0x12                    */
603
604         typedef struct {
605                 lsa_LUID luid;
606                 uint32 attribute;
607         } lsa_LUIDAttribute;
608
609         typedef struct {
610                 [range(0,1000)] uint32 count;
611                 uint32 unknown;
612                 [size_is(count)] lsa_LUIDAttribute set[*];
613         } lsa_PrivilegeSet;
614
615         NTSTATUS lsa_EnumPrivsAccount(
616                 [in]         policy_handle *handle,
617                 [out,ref] lsa_PrivilegeSet **privs
618                 );
619
620
621         /****************************************/
622         /* Function:            0x13 */
623         NTSTATUS lsa_AddPrivilegesToAccount(
624                 [in]         policy_handle *handle,
625                 [in,ref]     lsa_PrivilegeSet *privs
626                 );
627
628
629         /****************************************/
630         /* Function:         0x14 */
631         NTSTATUS lsa_RemovePrivilegesFromAccount(
632                 [in]         policy_handle *handle,
633                 [in]         uint8 remove_all,
634                 [in,unique]  lsa_PrivilegeSet *privs
635                 );
636
637         /* Function:           0x15 */
638         [todo] NTSTATUS lsa_GetQuotasForAccount();
639
640         /* Function:           0x16 */
641         [todo] NTSTATUS lsa_SetQuotasForAccount();
642
643         /* Function:    0x17 */
644         NTSTATUS lsa_GetSystemAccessAccount(
645                 [in]      policy_handle *handle,
646                 [out,ref] lsa_AccountAccessMask *access_mask
647                 );
648
649         /* Function:    0x18 */
650         NTSTATUS lsa_SetSystemAccessAccount(
651                 [in] policy_handle *handle,
652                 [in] lsa_AccountAccessMask access_mask
653                 );
654
655         /* Function:        0x19 */
656         NTSTATUS lsa_OpenTrustedDomain(
657                 [in]     policy_handle *handle,
658                 [in]     dom_sid2      *sid,
659                 [in]     lsa_TrustedAccessMask access_mask,
660                 [out]    policy_handle *trustdom_handle
661                 );
662
663         typedef [flag(NDR_PAHEX)] struct {
664                 uint3264 length;
665                 uint3264 size;
666                 [size_is(size),length_is(length)] uint8 *data;
667         } lsa_DATA_BUF;
668
669         typedef [flag(NDR_PAHEX)] struct {
670                 [range(0,65536)] uint32 size;
671                 [size_is(size)] uint8 *data;
672         } lsa_DATA_BUF2;
673
674         typedef enum {
675                 LSA_TRUSTED_DOMAIN_INFO_NAME                  = 1,
676                 LSA_TRUSTED_DOMAIN_INFO_CONTROLLERS           = 2,
677                 LSA_TRUSTED_DOMAIN_INFO_POSIX_OFFSET          = 3,
678                 LSA_TRUSTED_DOMAIN_INFO_PASSWORD              = 4,
679                 LSA_TRUSTED_DOMAIN_INFO_BASIC                 = 5,
680                 LSA_TRUSTED_DOMAIN_INFO_INFO_EX               = 6,
681                 LSA_TRUSTED_DOMAIN_INFO_AUTH_INFO             = 7,
682                 LSA_TRUSTED_DOMAIN_INFO_FULL_INFO             = 8,
683                 LSA_TRUSTED_DOMAIN_INFO_AUTH_INFO_INTERNAL    = 9,
684                 LSA_TRUSTED_DOMAIN_INFO_FULL_INFO_INTERNAL    = 10,
685                 LSA_TRUSTED_DOMAIN_INFO_INFO_EX2_INTERNAL     = 11,
686                 LSA_TRUSTED_DOMAIN_INFO_FULL_INFO_2_INTERNAL  = 12,
687                 LSA_TRUSTED_DOMAIN_SUPPORTED_ENCRYPTION_TYPES = 13
688         } lsa_TrustDomInfoEnum;
689
690         typedef [public,bitmap32bit] bitmap {
691                 LSA_TRUST_DIRECTION_INBOUND  = 0x00000001,
692                 LSA_TRUST_DIRECTION_OUTBOUND = 0x00000002
693         } lsa_TrustDirection;
694
695         typedef [public,v1_enum] enum {
696                 LSA_TRUST_TYPE_DOWNLEVEL  = 0x00000001,
697                 LSA_TRUST_TYPE_UPLEVEL    = 0x00000002,
698                 LSA_TRUST_TYPE_MIT        = 0x00000003,
699                 LSA_TRUST_TYPE_DCE        = 0x00000004
700         } lsa_TrustType;
701
702         typedef [public,bitmap32bit] bitmap {
703                 LSA_TRUST_ATTRIBUTE_NON_TRANSITIVE      = 0x00000001,
704                 LSA_TRUST_ATTRIBUTE_UPLEVEL_ONLY        = 0x00000002,
705                 LSA_TRUST_ATTRIBUTE_QUARANTINED_DOMAIN  = 0x00000004,
706                 LSA_TRUST_ATTRIBUTE_FOREST_TRANSITIVE   = 0x00000008,
707                 LSA_TRUST_ATTRIBUTE_CROSS_ORGANIZATION  = 0x00000010,
708                 LSA_TRUST_ATTRIBUTE_WITHIN_FOREST       = 0x00000020,
709                 LSA_TRUST_ATTRIBUTE_TREAT_AS_EXTERNAL   = 0x00000040,
710                 LSA_TRUST_ATTRIBUTE_USES_RC4_ENCRYPTION = 0x00000080
711         } lsa_TrustAttributes;
712
713         typedef struct {
714                 lsa_StringLarge  netbios_name;
715         } lsa_TrustDomainInfoName;
716
717
718         typedef struct {
719                 uint32 entries;
720                 [size_is(entries)] lsa_StringLarge  *netbios_names;
721         } lsa_TrustDomainInfoControllers;
722
723         typedef struct {
724                 uint32         posix_offset;
725         } lsa_TrustDomainInfoPosixOffset;
726
727         typedef struct {
728                 lsa_DATA_BUF  *password;
729                 lsa_DATA_BUF  *old_password;
730         } lsa_TrustDomainInfoPassword;
731
732         typedef struct {
733                 lsa_String     netbios_name;
734                 dom_sid2      *sid;
735         } lsa_TrustDomainInfoBasic;
736
737         typedef struct {
738                 lsa_StringLarge     domain_name;
739                 lsa_StringLarge     netbios_name;
740                 dom_sid2           *sid;
741                 lsa_TrustDirection  trust_direction;
742                 lsa_TrustType       trust_type;
743                 lsa_TrustAttributes trust_attributes;
744         } lsa_TrustDomainInfoInfoEx;
745
746         typedef [public,v1_enum] enum {
747                 TRUST_AUTH_TYPE_NONE = 0,
748                 TRUST_AUTH_TYPE_NT4OWF = 1,
749                 TRUST_AUTH_TYPE_CLEAR = 2,
750                 TRUST_AUTH_TYPE_VERSION = 3
751         } lsa_TrustAuthType;
752
753         typedef struct {
754                 NTTIME_hyper   last_update_time;
755                 lsa_TrustAuthType AuthType;
756                 lsa_DATA_BUF2  data;
757         } lsa_TrustDomainInfoBuffer;
758
759         typedef [public] struct {
760                 uint32 incoming_count;
761                 lsa_TrustDomainInfoBuffer *incoming_current_auth_info;
762                 lsa_TrustDomainInfoBuffer *incoming_previous_auth_info;
763                 uint32 outgoing_count;
764                 lsa_TrustDomainInfoBuffer *outgoing_current_auth_info;
765                 lsa_TrustDomainInfoBuffer *outgoing_previous_auth_info;
766         } lsa_TrustDomainInfoAuthInfo;
767
768         typedef struct {
769                 lsa_TrustDomainInfoInfoEx      info_ex;
770                 lsa_TrustDomainInfoPosixOffset posix_offset;
771                 lsa_TrustDomainInfoAuthInfo    auth_info;
772         } lsa_TrustDomainInfoFullInfo;
773
774         typedef struct {
775                 lsa_DATA_BUF2                          auth_blob;
776         } lsa_TrustDomainInfoAuthInfoInternal;
777
778         typedef struct {
779                 lsa_TrustDomainInfoInfoEx              info_ex;
780                 lsa_TrustDomainInfoPosixOffset         posix_offset;
781                 lsa_TrustDomainInfoAuthInfoInternal    auth_info;
782         } lsa_TrustDomainInfoFullInfoInternal;
783
784         typedef struct {
785                 lsa_TrustDomainInfoInfoEx      info_ex;
786                 uint32 forest_trust_length;
787                 [size_is(forest_trust_length)] uint8 *forest_trust_data;
788         } lsa_TrustDomainInfoInfoEx2Internal;
789
790         typedef struct {
791                 lsa_TrustDomainInfoInfoEx2Internal     info;
792                 lsa_TrustDomainInfoPosixOffset posix_offset;
793                 lsa_TrustDomainInfoAuthInfo    auth_info;
794         } lsa_TrustDomainInfoFullInfo2Internal;
795
796         typedef struct {
797                 kerb_EncTypes enc_types;
798         } lsa_TrustDomainInfoSupportedEncTypes;
799
800         typedef [switch_type(lsa_TrustDomInfoEnum)] union {
801                 [case(LSA_TRUSTED_DOMAIN_INFO_NAME)]
802                         lsa_TrustDomainInfoName              name;
803                 [case(LSA_TRUSTED_DOMAIN_INFO_CONTROLLERS)]
804                         lsa_TrustDomainInfoControllers   controllers;
805                 [case(LSA_TRUSTED_DOMAIN_INFO_POSIX_OFFSET)]
806                         lsa_TrustDomainInfoPosixOffset       posix_offset;
807                 [case(LSA_TRUSTED_DOMAIN_INFO_PASSWORD)]
808                         lsa_TrustDomainInfoPassword          password;
809                 [case(LSA_TRUSTED_DOMAIN_INFO_BASIC)]
810                         lsa_TrustDomainInfoBasic             info_basic;
811                 [case(LSA_TRUSTED_DOMAIN_INFO_INFO_EX)]
812                         lsa_TrustDomainInfoInfoEx            info_ex;
813                 [case(LSA_TRUSTED_DOMAIN_INFO_AUTH_INFO)]
814                         lsa_TrustDomainInfoAuthInfo          auth_info;
815                 [case(LSA_TRUSTED_DOMAIN_INFO_FULL_INFO)]
816                         lsa_TrustDomainInfoFullInfo          full_info;
817                 [case(LSA_TRUSTED_DOMAIN_INFO_AUTH_INFO_INTERNAL)]
818                         lsa_TrustDomainInfoAuthInfoInternal  auth_info_internal;
819                 [case(LSA_TRUSTED_DOMAIN_INFO_FULL_INFO_INTERNAL)]
820                         lsa_TrustDomainInfoFullInfoInternal  full_info_internal;
821                 [case(LSA_TRUSTED_DOMAIN_INFO_INFO_EX2_INTERNAL)]
822                         lsa_TrustDomainInfoInfoEx2Internal   info_ex2_internal;
823                 [case(LSA_TRUSTED_DOMAIN_INFO_FULL_INFO_2_INTERNAL)]
824                         lsa_TrustDomainInfoFullInfo2Internal     full_info2_internal;
825                 [case(LSA_TRUSTED_DOMAIN_SUPPORTED_ENCRYPTION_TYPES)]
826                         lsa_TrustDomainInfoSupportedEncTypes enc_types;
827         } lsa_TrustedDomainInfo;
828
829         /* Function:       0x1a */
830         NTSTATUS lsa_QueryTrustedDomainInfo(
831                 [in]     policy_handle                   *trustdom_handle,
832                 [in]     lsa_TrustDomInfoEnum             level,
833                 [out,switch_is(level),ref] lsa_TrustedDomainInfo **info
834                 );
835
836         /* Function:     0x1b */
837         NTSTATUS lsa_SetInformationTrustedDomain(
838                 [in]                  policy_handle         *trustdom_handle,
839                 [in]                  lsa_TrustDomInfoEnum   level,
840                 [in,switch_is(level)] lsa_TrustedDomainInfo *info
841                 );
842
843         /* Function:          0x1c */
844         [public] NTSTATUS lsa_OpenSecret(
845                 [in]     policy_handle    *handle,
846                 [in]         lsa_String        name,
847                 [in]     lsa_SecretAccessMask access_mask,
848                 [out]    policy_handle    *sec_handle
849                 );
850
851         /* Function:           0x1d */
852
853         [public] NTSTATUS lsa_SetSecret(
854                 [in]     policy_handle    *sec_handle,
855                 [in,unique]         lsa_DATA_BUF     *new_val,
856                 [in,unique]         lsa_DATA_BUF     *old_val
857                 );
858
859         typedef struct {
860                 lsa_DATA_BUF *buf;
861         } lsa_DATA_BUF_PTR;
862
863         /* Function:         0x1e */
864         [public] NTSTATUS lsa_QuerySecret (
865                 [in]     policy_handle     *sec_handle,
866                 [in,out,unique]     lsa_DATA_BUF_PTR  *new_val,
867                 [in,out,unique]     NTTIME_hyper      *new_mtime,
868                 [in,out,unique]     lsa_DATA_BUF_PTR  *old_val,
869                 [in,out,unique]     NTTIME_hyper      *old_mtime
870                 );
871
872         /* Function:     0x1f */
873         NTSTATUS lsa_LookupPrivValue(
874                 [in]     policy_handle *handle,
875                 [in,ref] lsa_String *name,
876                 [out,ref] lsa_LUID *luid
877                 );
878
879
880         /* Function:      0x20 */
881         NTSTATUS lsa_LookupPrivName(
882                 [in]     policy_handle *handle,
883                 [in,ref] lsa_LUID *luid,
884                 [out,ref] lsa_StringLarge **name
885                 );
886
887
888         /*******************/
889         /* Function:  0x21 */
890         NTSTATUS lsa_LookupPrivDisplayName(
891                 [in] policy_handle *handle,
892                 [in,ref] lsa_String *name,
893                 [in] uint16 language_id,
894                 [in] uint16 language_id_sys,
895                 [out,ref] lsa_StringLarge **disp_name,
896                 /* see http://www.microsoft.com/globaldev/nlsweb/ for
897                    language definitions */
898                 [out,ref] uint16 *returned_language_id
899                 );
900
901         /*******************/
902         /* Function:  0x22 */
903         NTSTATUS lsa_DeleteObject (
904                 [in,out]     policy_handle *handle
905                 );
906
907         /*******************/
908         /* Function:      0x23 */
909         NTSTATUS lsa_EnumAccountsWithUserRight (
910                 [in]     policy_handle *handle,
911                 [in,unique]         lsa_String *name,
912                 [out]    lsa_SidArray *sids
913                 );
914
915         /* Function:      0x24 */
916         typedef struct {
917                 [string,charset(UTF16)] uint16 *name;
918         } lsa_RightAttribute;
919
920         typedef struct {
921                 [range(0,256)] uint32 count;
922                 [size_is(count)] lsa_StringLarge *names;
923         } lsa_RightSet;
924
925         NTSTATUS lsa_EnumAccountRights (
926                 [in]     policy_handle *handle,
927                 [in,ref] dom_sid2 *sid,
928                 [out,ref] lsa_RightSet *rights
929                 );
930
931
932         /**********************/
933         /* Function:       0x25 */
934         NTSTATUS lsa_AddAccountRights (
935                 [in]     policy_handle *handle,
936                 [in,ref] dom_sid2 *sid,
937                 [in,ref] lsa_RightSet *rights
938                 );
939
940         /**********************/
941         /* Function:       0x26 */
942         NTSTATUS lsa_RemoveAccountRights (
943                 [in]     policy_handle *handle,
944                 [in,ref] dom_sid2 *sid,
945                 [in]     uint8 remove_all,
946                 [in,ref] lsa_RightSet *rights
947                 );
948
949         /* Function:   0x27 */
950         NTSTATUS lsa_QueryTrustedDomainInfoBySid(
951                 [in]               policy_handle         *handle,
952                 [in,ref]           dom_sid2              *dom_sid,
953                 [in]               lsa_TrustDomInfoEnum  level,
954                 [out,switch_is(level),ref] lsa_TrustedDomainInfo **info
955         );
956
957         /* Function:     0x28 */
958         NTSTATUS lsa_SetTrustedDomainInfo(
959                 [in]               policy_handle         *handle,
960                 [in]               dom_sid2              *dom_sid,
961                 [in]               lsa_TrustDomInfoEnum  level,
962                 [in,switch_is(level)] lsa_TrustedDomainInfo *info
963         );
964
965         /* Function:      0x29 */
966         NTSTATUS lsa_DeleteTrustedDomain(
967                 [in]               policy_handle         *handle,
968                 [in]               dom_sid2              *dom_sid
969         );
970
971         /* Function:       0x2a */
972         NTSTATUS lsa_StorePrivateData(
973                 [in]            policy_handle   *handle,
974                 [in,ref]        lsa_String      *name,
975                 [in,unique]     lsa_DATA_BUF    *val
976         );
977
978         /* Function:        0x2b */
979         NTSTATUS lsa_RetrievePrivateData(
980                 [in]            policy_handle   *handle,
981                 [in,ref]        lsa_String      *name,
982                 [in,out,ref]    lsa_DATA_BUF    **val
983         );
984
985         /**********************/
986         /* Function:     0x2c */
987         [public] NTSTATUS lsa_OpenPolicy2 (
988                 [in,unique]      [string,charset(UTF16)] uint16 *system_name,
989                 [in]  lsa_ObjectAttribute *attr,
990                 [in]  lsa_PolicyAccessMask access_mask,
991                 [out] policy_handle *handle
992                 );
993
994         /**********************/
995         /* Function:     0x2d */
996         NTSTATUS lsa_GetUserName(
997                 [in,unique] [string,charset(UTF16)] uint16 *system_name,
998                 [in,out,ref] lsa_String **account_name,
999                 [in,out,unique] lsa_String **authority_name
1000                 );
1001
1002         /**********************/
1003         /* Function:          0x2e */
1004
1005         NTSTATUS lsa_QueryInfoPolicy2(
1006                 [in]                         policy_handle *handle,
1007                 [in]                         lsa_PolicyInfo level,
1008                 [out,ref,switch_is(level)]   lsa_PolicyInformation **info
1009                 );
1010
1011         /* Function 0x2f */
1012         NTSTATUS lsa_SetInfoPolicy2(
1013                 [in]                            policy_handle *handle,
1014                 [in]                            lsa_PolicyInfo level,
1015                 [in,switch_is(level)]           lsa_PolicyInformation *info
1016                 );
1017
1018         /**********************/
1019         /* Function 0x30 */
1020         NTSTATUS lsa_QueryTrustedDomainInfoByName(
1021                 [in]                   policy_handle          *handle,
1022                 [in,ref]               lsa_String             *trusted_domain,
1023                 [in]                   lsa_TrustDomInfoEnum   level,
1024                 [out,ref,switch_is(level)] lsa_TrustedDomainInfo **info
1025                 );
1026
1027         /**********************/
1028         /* Function 0x31 */
1029         [public] NTSTATUS lsa_SetTrustedDomainInfoByName(
1030                 [in]                   policy_handle         *handle,
1031                 [in,ref]               lsa_String             *trusted_domain,
1032                 [in]                   lsa_TrustDomInfoEnum   level,
1033                 [in,ref,switch_is(level)] lsa_TrustedDomainInfo *info
1034                 );
1035
1036         /* Function 0x32 */
1037
1038         /* w2k3 treats max_size as max_domains*82       */
1039         const int LSA_ENUM_TRUST_DOMAIN_EX_MULTIPLIER = 82;
1040
1041         typedef struct {
1042                 uint32 count;
1043                 [size_is(count)] lsa_TrustDomainInfoInfoEx *domains;
1044         } lsa_DomainListEx;
1045
1046         NTSTATUS lsa_EnumTrustedDomainsEx (
1047                 [in]               policy_handle *handle,
1048                 [in,out]           uint32 *resume_handle,
1049                 [out]              lsa_DomainListEx *domains,
1050                 [in]               uint32 max_size
1051                 );
1052
1053         /* Function 0x33 */
1054         NTSTATUS lsa_CreateTrustedDomainEx(
1055                 [in]  policy_handle               *policy_handle,
1056                 [in]  lsa_TrustDomainInfoInfoEx   *info,
1057                 [in]  lsa_TrustDomainInfoAuthInfo *auth_info,
1058                 [in]  lsa_TrustedAccessMask access_mask,
1059                 [out] policy_handle               *trustdom_handle
1060                 );
1061
1062
1063         /* Function 0x34 */
1064         NTSTATUS lsa_CloseTrustedDomainEx(
1065                 [in,out]                   policy_handle         *handle
1066         );
1067
1068         /* Function 0x35 */
1069         typedef [bitmap32bit] bitmap {
1070                 LSA_POLICY_KERBEROS_VALIDATE_CLIENT = 0x00000080
1071         } lsa_krbAuthenticationOptions;
1072
1073         /* w2k3 returns either 0x000bbbd000000000 or 0x000a48e800000000
1074            for reserved - gd */
1075         typedef struct {
1076                 lsa_krbAuthenticationOptions authentication_options;
1077                 hyper service_tkt_lifetime;
1078                 hyper user_tkt_lifetime;
1079                 hyper user_tkt_renewaltime;
1080                 hyper clock_skew;
1081                 hyper reserved;
1082         } lsa_DomainInfoKerberos;
1083
1084         typedef struct {
1085                 uint32 blob_size;
1086                 [size_is(blob_size)] uint8 *efs_blob;
1087         } lsa_DomainInfoEfs;
1088
1089         typedef enum {
1090                 LSA_DOMAIN_INFO_POLICY_EFS=2,
1091                 LSA_DOMAIN_INFO_POLICY_KERBEROS=3
1092         } lsa_DomainInfoEnum;
1093
1094         typedef [switch_type(uint16)] union {
1095                 [case(LSA_DOMAIN_INFO_POLICY_EFS)]      lsa_DomainInfoEfs       efs_info;
1096                 [case(LSA_DOMAIN_INFO_POLICY_KERBEROS)] lsa_DomainInfoKerberos  kerberos_info;
1097         } lsa_DomainInformationPolicy;
1098
1099         NTSTATUS lsa_QueryDomainInformationPolicy(
1100                 [in]            policy_handle *handle,
1101                 [in]            uint16 level,
1102                 [out,ref,switch_is(level)]      lsa_DomainInformationPolicy **info
1103                 );
1104
1105         /* Function 0x36 */
1106         NTSTATUS lsa_SetDomainInformationPolicy(
1107                 [in]            policy_handle *handle,
1108                 [in]                    uint16 level,
1109                 [in,unique,switch_is(level)]    lsa_DomainInformationPolicy *info
1110                 );
1111
1112         /**********************/
1113         /* Function 0x37 */
1114         NTSTATUS lsa_OpenTrustedDomainByName(
1115                 [in]     policy_handle *handle,
1116                 [in]         lsa_String     name,
1117                 [in]     lsa_TrustedAccessMask access_mask,
1118                 [out]    policy_handle *trustdom_handle
1119                 );
1120
1121         /* Function 0x38 */
1122         [todo] NTSTATUS lsa_TestCall();
1123
1124         /**********************/
1125         /* Function 0x39 */
1126
1127         typedef struct {
1128                 lsa_SidType sid_type;
1129                 lsa_String name;
1130                 uint32 sid_index;
1131                 uint32 unknown;
1132         } lsa_TranslatedName2;
1133
1134         typedef struct {
1135                 [range(0,1000)] uint32 count;
1136                 [size_is(count)] lsa_TranslatedName2 *names;
1137         } lsa_TransNameArray2;
1138
1139         typedef [v1_enum] enum {
1140                 LSA_LOOKUP_OPTION_SEARCH_ISOLATED_NAMES         = 0x00000000,
1141                 LSA_LOOKUP_OPTION_SEARCH_ISOLATED_NAMES_LOCAL   = 0x80000000
1142         } lsa_LookupOptions;
1143
1144         typedef [v1_enum] enum {
1145                 LSA_CLIENT_REVISION_1   = 0x00000001,
1146                 LSA_CLIENT_REVISION_2   = 0x00000002
1147         } lsa_ClientRevision;
1148
1149         [public] NTSTATUS lsa_LookupSids2(
1150                 [in]     policy_handle *handle,
1151                 [in,ref] lsa_SidArray *sids,
1152                 [out,ref]    lsa_RefDomainList **domains,
1153                 [in,out,ref] lsa_TransNameArray2 *names,
1154                 [in]         lsa_LookupNamesLevel level,
1155                 [in,out,ref] uint32 *count,
1156                 [in]         lsa_LookupOptions lookup_options,
1157                 [in]         lsa_ClientRevision client_revision
1158                 );
1159
1160         /**********************/
1161         /* Function 0x3a */
1162
1163         typedef struct {
1164                 lsa_SidType sid_type;
1165                 uint32 rid;
1166                 uint32 sid_index;
1167                 uint32 unknown;
1168         } lsa_TranslatedSid2;
1169
1170         typedef struct {
1171                 [range(0,1000)] uint32 count;
1172                 [size_is(count)] lsa_TranslatedSid2 *sids;
1173         } lsa_TransSidArray2;
1174
1175         [public] NTSTATUS lsa_LookupNames2 (
1176                 [in]     policy_handle *handle,
1177                 [in,range(0,1000)] uint32 num_names,
1178                 [in,size_is(num_names)]  lsa_String names[],
1179                 [out,ref]    lsa_RefDomainList **domains,
1180                 [in,out,ref] lsa_TransSidArray2 *sids,
1181                 [in]         lsa_LookupNamesLevel level,
1182                 [in,out,ref] uint32 *count,
1183                 [in]         lsa_LookupOptions lookup_options,
1184                 [in]         lsa_ClientRevision client_revision
1185                 );
1186
1187         /* Function 0x3b */
1188         NTSTATUS lsa_CreateTrustedDomainEx2(
1189                 [in]  policy_handle               *policy_handle,
1190                 [in]  lsa_TrustDomainInfoInfoEx   *info,
1191                 [in]  lsa_TrustDomainInfoAuthInfoInternal *auth_info_internal,
1192                 [in]  lsa_TrustedAccessMask access_mask,
1193                 [out] policy_handle               *trustdom_handle
1194                 );
1195
1196         /* Function 0x3c */
1197         [todo] NTSTATUS lsa_CREDRWRITE();
1198
1199         /* Function 0x3d */
1200         [todo] NTSTATUS lsa_CREDRREAD();
1201
1202         /* Function 0x3e */
1203         [todo] NTSTATUS lsa_CREDRENUMERATE();
1204
1205         /* Function 0x3f */
1206         [todo] NTSTATUS lsa_CREDRWRITEDOMAINCREDENTIALS();
1207
1208         /* Function 0x40 */
1209         [todo] NTSTATUS lsa_CREDRREADDOMAINCREDENTIALS();
1210
1211         /* Function 0x41 */
1212         [todo] NTSTATUS lsa_CREDRDELETE();
1213
1214         /* Function 0x42 */
1215         [todo] NTSTATUS lsa_CREDRGETTARGETINFO();
1216
1217         /* Function 0x43 */
1218         [todo] NTSTATUS lsa_CREDRPROFILELOADED();
1219
1220         /**********************/
1221         /* Function 0x44 */
1222         typedef struct {
1223                 lsa_SidType sid_type;
1224                 dom_sid2 *sid;
1225                 uint32 sid_index;
1226                 uint32 flags;
1227         } lsa_TranslatedSid3;
1228
1229         typedef struct {
1230                 [range(0,1000)] uint32 count;
1231                 [size_is(count)] lsa_TranslatedSid3 *sids;
1232         } lsa_TransSidArray3;
1233
1234         [public] NTSTATUS lsa_LookupNames3 (
1235                 [in]     policy_handle *handle,
1236                 [in,range(0,1000)] uint32 num_names,
1237                 [in,size_is(num_names)]  lsa_String names[],
1238                 [out,ref]    lsa_RefDomainList **domains,
1239                 [in,out,ref] lsa_TransSidArray3 *sids,
1240                 [in]         lsa_LookupNamesLevel level,
1241                 [in,out,ref] uint32 *count,
1242                 [in]         lsa_LookupOptions lookup_options,
1243                 [in]         lsa_ClientRevision client_revision
1244                 );
1245
1246         /* Function 0x45 */
1247         [todo] NTSTATUS lsa_CREDRGETSESSIONTYPES();
1248
1249         /* Function 0x46 */
1250         [todo] NTSTATUS lsa_LSARREGISTERAUDITEVENT();
1251
1252         /* Function 0x47 */
1253         [todo] NTSTATUS lsa_LSARGENAUDITEVENT();
1254
1255         /* Function 0x48 */
1256         [todo] NTSTATUS lsa_LSARUNREGISTERAUDITEVENT();
1257
1258         /* Function 0x49 */
1259         typedef [bitmap32bit,public] bitmap {
1260                 /* these apply to LSA_FOREST_TRUST_TOP_LEVEL_NAME */
1261                 LSA_TLN_DISABLED_NEW            = 0x00000001,
1262                 LSA_TLN_DISABLED_ADMIN          = 0x00000002,
1263                 LSA_TLN_DISABLED_CONFLICT       = 0x00000004,
1264
1265                 /* these apply to LSA_FOREST_TRUST_DOMAIN_INFO */
1266                 LSA_SID_DISABLED_ADMIN          = 0x00000001,
1267                 LSA_SID_DISABLED_CONFLICT       = 0x00000002,
1268                 LSA_NB_DISABLED_ADMIN           = 0x00000004,
1269                 LSA_NB_DISABLED_CONFLICT        = 0x00000008
1270         } lsa_ForestTrustRecordFlags;
1271
1272         typedef enum {
1273                 LSA_FOREST_TRUST_TOP_LEVEL_NAME = 0,
1274                 LSA_FOREST_TRUST_TOP_LEVEL_NAME_EX = 1,
1275                 LSA_FOREST_TRUST_DOMAIN_INFO = 2,
1276                 LSA_FOREST_TRUST_RECORD_TYPE_LAST = 3
1277         } lsa_ForestTrustRecordType;
1278
1279         typedef struct {
1280                 [range(0,131072)] uint3264 length;
1281                 [size_is(length)] uint8 *data;
1282         } lsa_ForestTrustBinaryData;
1283
1284         typedef struct {
1285                 dom_sid2 *domain_sid;
1286                 lsa_StringLarge dns_domain_name;
1287                 lsa_StringLarge netbios_domain_name;
1288         } lsa_ForestTrustDomainInfo;
1289
1290         typedef [switch_type(lsa_ForestTrustRecordType)] union {
1291                 [case(LSA_FOREST_TRUST_TOP_LEVEL_NAME)] lsa_StringLarge top_level_name;
1292                 [case(LSA_FOREST_TRUST_TOP_LEVEL_NAME_EX)] lsa_StringLarge top_level_name_ex;
1293                 [case(LSA_FOREST_TRUST_DOMAIN_INFO)] lsa_ForestTrustDomainInfo domain_info;
1294                 [default] lsa_ForestTrustBinaryData data;
1295         } lsa_ForestTrustData;
1296
1297         typedef struct {
1298                 lsa_ForestTrustRecordFlags flags;
1299                 lsa_ForestTrustRecordType type;
1300                 NTTIME_hyper time;
1301                 [switch_is(type)] lsa_ForestTrustData forest_trust_data;
1302         } lsa_ForestTrustRecord;
1303
1304         typedef [public] struct {
1305                 [range(0,4000)] uint32 count;
1306                 [size_is(count)] lsa_ForestTrustRecord **entries;
1307         } lsa_ForestTrustInformation;
1308
1309         [public] NTSTATUS lsa_lsaRQueryForestTrustInformation(
1310                 [in] policy_handle *handle,
1311                 [in,ref] lsa_String *trusted_domain_name,
1312                 [in] lsa_ForestTrustRecordType highest_record_type,
1313                 [out,ref] lsa_ForestTrustInformation **forest_trust_info
1314                 );
1315
1316         /*****************
1317          * Function 0x4a */
1318
1319         typedef [v1_enum] enum {
1320                 LSA_FOREST_TRUST_COLLISION_TDO = 0,
1321                 LSA_FOREST_TRUST_COLLISION_XREF = 1,
1322                 LSA_FOREST_TRUST_COLLISION_OTHER = 2
1323         } lsa_ForestTrustCollisionRecordType;
1324
1325         typedef [public] struct {
1326                 uint32 index;
1327                 lsa_ForestTrustCollisionRecordType type;
1328                 lsa_ForestTrustRecordFlags flags;
1329                 lsa_String name;
1330         } lsa_ForestTrustCollisionRecord;
1331
1332         typedef [public] struct {
1333                 uint32 count;
1334                 [size_is(count)] lsa_ForestTrustCollisionRecord **entries;
1335         } lsa_ForestTrustCollisionInfo;
1336
1337         [public] NTSTATUS lsa_lsaRSetForestTrustInformation(
1338                 [in]      policy_handle *handle,
1339                 [in,ref]  lsa_StringLarge *trusted_domain_name,
1340                 [in]      lsa_ForestTrustRecordType highest_record_type,
1341                 [in,ref]  lsa_ForestTrustInformation *forest_trust_info,
1342                 [in]      boolean8 check_only,
1343                 [out,ref] lsa_ForestTrustCollisionInfo **collision_info
1344                 );
1345
1346         /* Function 0x4b */
1347         [todo] NTSTATUS lsa_CREDRRENAME();
1348
1349         /*****************/
1350         /* Function 0x4c */
1351
1352         [public] NTSTATUS lsa_LookupSids3(
1353                 [in,ref]     lsa_SidArray *sids,
1354                 [out,ref]    lsa_RefDomainList **domains,
1355                 [in,out,ref] lsa_TransNameArray2 *names,
1356                 [in]         lsa_LookupNamesLevel level,
1357                 [in,out,ref] uint32 *count,
1358                 [in]         lsa_LookupOptions lookup_options,
1359                 [in]         lsa_ClientRevision client_revision
1360                 );
1361
1362         const int LSA_CLIENT_REVISION_NO_DNS     = 0x00000001;
1363         const int LSA_CLIENT_REVISION_DNS        = 0x00000002;
1364
1365         const int LSA_LOOKUP_OPTIONS_NO_ISOLATED = 0x80000000;
1366
1367         /* Function 0x4d */
1368         NTSTATUS lsa_LookupNames4(
1369                 [in,range(0,1000)] uint32 num_names,
1370                 [in,size_is(num_names)]  lsa_String names[],
1371                 [out,ref]    lsa_RefDomainList **domains,
1372                 [in,out,ref] lsa_TransSidArray3 *sids,
1373                 [in]         lsa_LookupNamesLevel level,
1374                 [in,out,ref] uint32 *count,
1375                 [in]         lsa_LookupOptions lookup_options,
1376                 [in]         lsa_ClientRevision client_revision
1377                 );
1378
1379         /* Function 0x4e */
1380         [todo] NTSTATUS lsa_LSAROPENPOLICYSCE();
1381
1382         /* Function 0x4f */
1383         [todo] NTSTATUS lsa_LSARADTREGISTERSECURITYEVENTSOURCE();
1384
1385         /* Function 0x50 */
1386         [todo] NTSTATUS lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE();
1387
1388         /* Function 0x51 */
1389         [todo] NTSTATUS lsa_LSARADTREPORTSECURITYEVENT();
1390
1391 }