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