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