4de3d6f1bf1909bf2e7465a559856391b5fe3ab6
[metze/samba/wip.git] / source / 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,noejs] 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         /******************/
49         /* Function: 0x00 */
50         NTSTATUS lsa_Close (
51                 [in,out]     policy_handle *handle
52                 );
53         
54
55         /******************/
56         /* Function: 0x01 */
57         [public] NTSTATUS lsa_Delete (
58                 [in]     policy_handle *handle
59                 );
60
61
62         /******************/
63         /* Function: 0x02 */
64         typedef struct {
65                 uint32 low;
66                 uint32 high;
67         } lsa_LUID;
68         
69         typedef struct {
70                 lsa_StringLarge name;
71                 lsa_LUID luid;
72         } lsa_PrivEntry;
73
74         typedef struct {
75                 uint32 count;
76                 [size_is(count)] lsa_PrivEntry *privs;
77         } lsa_PrivArray;
78
79         [public] NTSTATUS lsa_EnumPrivs (
80                 [in]     policy_handle *handle,
81                 [in,out] uint32 *resume_handle,
82                 [in]         uint32 max_count,
83                 [out]    lsa_PrivArray *privs
84                 );
85
86         /******************/
87         /* Function: 0x03 */
88
89         NTSTATUS lsa_QuerySecurity (
90                 [in]     policy_handle *handle,
91                 [in]         security_secinfo sec_info,
92                 [out,unique]        sec_desc_buf *sdbuf
93                 );
94
95
96         /******************/
97         /* Function: 0x04 */
98         [todo] NTSTATUS lsa_SetSecObj ();
99
100
101         /******************/
102         /* Function: 0x05 */
103         [todo] NTSTATUS lsa_ChangePassword ();
104
105
106         /******************/
107         /* Function: 0x06 */
108         typedef struct {
109                 uint32  len; /* ignored */
110                 uint16  impersonation_level;
111                 uint8   context_mode;
112                 uint8   effective_only;
113         } lsa_QosInfo;
114         
115         typedef struct {
116                 uint32 len; /* ignored */
117                 uint8 *root_dir;
118                 [string,charset(UTF16)] uint16 *object_name;
119                 uint32 attributes;
120                 security_descriptor *sec_desc;
121                 lsa_QosInfo *sec_qos;
122         } lsa_ObjectAttribute;
123
124         /* notice the screwup with the system_name - thats why MS created
125            OpenPolicy2 */
126         [public] NTSTATUS lsa_OpenPolicy (
127                 [in,unique]       uint16 *system_name,
128                 [in]   lsa_ObjectAttribute *attr,
129                 [in]       uint32 access_mask,
130                 [out]  policy_handle *handle
131                 );
132         
133
134
135         /******************/
136         /* Function: 0x07 */
137
138         typedef struct {
139                 uint32 percent_full;
140                 uint32 log_size;
141                 NTTIME retention_time;
142                 uint8  shutdown_in_progress;
143                 NTTIME time_to_shutdown;
144                 uint32 next_audit_record;
145                 uint32 unknown;
146         } lsa_AuditLogInfo;
147
148         typedef [v1_enum] enum {
149                 LSA_AUDIT_POLICY_NONE=0,
150                 LSA_AUDIT_POLICY_SUCCESS=1,
151                 LSA_AUDIT_POLICY_FAILURE=2,
152                 LSA_AUDIT_POLICY_ALL=(LSA_AUDIT_POLICY_SUCCESS|LSA_AUDIT_POLICY_FAILURE),
153                 LSA_AUDIT_POLICY_CLEAR=4
154         } lsa_PolicyAuditPolicy;
155
156         typedef enum {
157                 LSA_AUDIT_CATEGORY_SYSTEM = 0,
158                 LSA_AUDIT_CATEGORY_LOGON = 1,
159                 LSA_AUDIT_CATEGORY_FILE_AND_OBJECT_ACCESS = 2,
160                 LSA_AUDIT_CATEGORY_USE_OF_USER_RIGHTS = 3,
161                 LSA_AUDIT_CATEGORY_PROCCESS_TRACKING = 4,
162                 LSA_AUDIT_CATEGORY_SECURITY_POLICY_CHANGES = 5,
163                 LSA_AUDIT_CATEGORY_ACCOUNT_MANAGEMENT = 6,
164                 LSA_AUDIT_CATEGORY_DIRECTORY_SERVICE_ACCESS = 7,        /* only in win2k/2k3 */
165                 LSA_AUDIT_CATEGORY_ACCOUNT_LOGON = 8                    /* only in win2k/2k3 */
166         } lsa_PolicyAuditEventType;
167
168         typedef struct {
169                 uint32 auditing_mode;
170                 [size_is(count)] lsa_PolicyAuditPolicy *settings;
171                 uint32 count;
172         } lsa_AuditEventsInfo;
173
174         typedef struct {
175                 lsa_StringLarge name;
176                 dom_sid2 *sid;
177         } lsa_DomainInfo;
178
179         typedef struct {
180                 lsa_String name;
181         } lsa_PDAccountInfo;
182
183         typedef struct {
184                 uint16 unknown; /* an midl padding bug? */
185                 uint16 role;
186         } lsa_ServerRole;
187
188         typedef struct {
189                 lsa_String source;
190                 lsa_String account;
191         } lsa_ReplicaSourceInfo;
192
193         typedef struct {
194                 uint32 paged_pool;
195                 uint32 non_paged_pool;
196                 uint32 min_wss;
197                 uint32 max_wss;
198                 uint32 pagefile;
199                 hyper unknown;
200         } lsa_DefaultQuotaInfo;
201
202         typedef struct {
203                 hyper modified_id;
204                 NTTIME db_create_time;
205         } lsa_ModificationInfo;
206
207         typedef struct {
208                 uint8 shutdown_on_full;
209         } lsa_AuditFullSetInfo;
210
211         typedef struct {
212                 uint16 unknown; /* an midl padding bug? */
213                 uint8 shutdown_on_full;
214                 uint8 log_is_full;
215         } lsa_AuditFullQueryInfo;
216
217         typedef struct {
218                 /* it's important that we use the lsa_StringLarge here,
219                  * because otherwise windows clients result with such dns hostnames
220                  * e.g. w2k3-client.samba4.samba.orgsamba4.samba.org
221                  * where it should be
222                  *      w2k3-client.samba4.samba.org
223                  */
224                 lsa_StringLarge name;
225                 lsa_StringLarge dns_domain;
226                 lsa_StringLarge dns_forest;
227                 GUID domain_guid;
228                 dom_sid2 *sid;
229         } lsa_DnsDomainInfo;
230
231         typedef enum {
232                 LSA_POLICY_INFO_AUDIT_LOG=1,
233                 LSA_POLICY_INFO_AUDIT_EVENTS=2,
234                 LSA_POLICY_INFO_DOMAIN=3,
235                 LSA_POLICY_INFO_PD=4,
236                 LSA_POLICY_INFO_ACCOUNT_DOMAIN=5,
237                 LSA_POLICY_INFO_ROLE=6,
238                 LSA_POLICY_INFO_REPLICA=7,
239                 LSA_POLICY_INFO_QUOTA=8,
240                 LSA_POLICY_INFO_DB=9,
241                 LSA_POLICY_INFO_AUDIT_FULL_SET=10,
242                 LSA_POLICY_INFO_AUDIT_FULL_QUERY=11,
243                 LSA_POLICY_INFO_DNS=12
244         } lsa_PolicyInfo;
245
246         typedef [switch_type(uint16)] union {
247                 [case(LSA_POLICY_INFO_AUDIT_LOG)]        lsa_AuditLogInfo       audit_log;
248                 [case(LSA_POLICY_INFO_AUDIT_EVENTS)]     lsa_AuditEventsInfo    audit_events;
249                 [case(LSA_POLICY_INFO_DOMAIN)]           lsa_DomainInfo         domain;
250                 [case(LSA_POLICY_INFO_PD)]               lsa_PDAccountInfo      pd;
251                 [case(LSA_POLICY_INFO_ACCOUNT_DOMAIN)]   lsa_DomainInfo         account_domain;
252                 [case(LSA_POLICY_INFO_ROLE)]             lsa_ServerRole         role;
253                 [case(LSA_POLICY_INFO_REPLICA)]          lsa_ReplicaSourceInfo  replica;
254                 [case(LSA_POLICY_INFO_QUOTA)]            lsa_DefaultQuotaInfo   quota;
255                 [case(LSA_POLICY_INFO_DB)]               lsa_ModificationInfo   db;
256                 [case(LSA_POLICY_INFO_AUDIT_FULL_SET)]   lsa_AuditFullSetInfo   auditfullset;
257                 [case(LSA_POLICY_INFO_AUDIT_FULL_QUERY)] lsa_AuditFullQueryInfo auditfullquery;
258                 [case(LSA_POLICY_INFO_DNS)]              lsa_DnsDomainInfo      dns;
259         } lsa_PolicyInformation;
260
261         NTSTATUS lsa_QueryInfoPolicy (
262                 [in]                            policy_handle *handle,
263                 [in]                            lsa_PolicyInfo level,
264                 [out,unique,switch_is(level)]   lsa_PolicyInformation *info
265                 );
266
267         /******************/
268         /* Function:       0x08 */
269         NTSTATUS lsa_SetInfoPolicy (
270                 [in]                            policy_handle *handle,
271                 [in]                            lsa_PolicyInfo level,
272                 [in,switch_is(level)]           lsa_PolicyInformation *info
273                 );
274
275         /******************/
276         /* Function:       0x09 */
277         [todo] NTSTATUS lsa_ClearAuditLog ();
278
279         /******************/
280         /* Function: 0x0a */
281         [public] NTSTATUS lsa_CreateAccount (
282                 [in]    policy_handle *handle,
283                 [in]    dom_sid2 *sid,
284                 [in]    uint32 access_mask,
285                 [out]   policy_handle *acct_handle
286                 );
287
288         /******************/
289         /* NOTE: This only returns accounts that have at least
290            one privilege set 
291         */
292         /* Function: 0x0b */
293         typedef struct {
294                 dom_sid2 *sid;
295         } lsa_SidPtr;
296         
297         typedef [public] struct {
298                 [range(0,1000)] uint32 num_sids;
299                 [size_is(num_sids)] lsa_SidPtr *sids;
300         } lsa_SidArray;
301
302         [public] NTSTATUS lsa_EnumAccounts (
303                 [in]         policy_handle *handle,
304                 [in,out]     uint32 *resume_handle,
305                 [in,range(0,8192)] uint32 num_entries,
306                 [out]        lsa_SidArray *sids
307                 );
308
309
310         /*************************************************/
311         /* Function: 0x0c                                */
312
313         [public] NTSTATUS lsa_CreateTrustedDomain(
314                 [in]         policy_handle *handle,
315                 [in]         lsa_DomainInfo *info,
316                 [in]         uint32 access_mask,
317                 [out]        policy_handle *trustdom_handle
318                 );
319
320
321         /******************/
322         /* Function: 0x0d */
323
324         /* w2k3 treats max_size as max_domains*60       */
325         const int LSA_ENUM_TRUST_DOMAIN_MULTIPLIER = 60;
326
327         typedef struct {
328                 uint32 count;
329                 [size_is(count)] lsa_DomainInfo *domains;
330         } lsa_DomainList;
331
332         NTSTATUS lsa_EnumTrustDom (
333                 [in]               policy_handle *handle,
334                 [in,out]           uint32 *resume_handle,
335                 [in]               uint32 max_size,
336                 [out]              lsa_DomainList *domains
337                 );
338
339
340         /******************/
341         /* Function: 0x0e */
342         typedef [public] enum {
343                 SID_NAME_USE_NONE = 0,/* NOTUSED */
344                 SID_NAME_USER     = 1, /* user */
345                 SID_NAME_DOM_GRP  = 2, /* domain group */
346                 SID_NAME_DOMAIN   = 3, /* domain: don't know what this is */
347                 SID_NAME_ALIAS    = 4, /* local group */
348                 SID_NAME_WKN_GRP  = 5, /* well-known group */
349                 SID_NAME_DELETED  = 6, /* deleted account: needed for c2 rating */
350                 SID_NAME_INVALID  = 7, /* invalid account */
351                 SID_NAME_UNKNOWN  = 8, /* oops. */
352                 SID_NAME_COMPUTER = 9  /* machine */
353         } lsa_SidType;
354
355         typedef struct {
356                 lsa_SidType sid_type;
357                 uint32 rid;
358                 uint32 sid_index;
359         } lsa_TranslatedSid;
360
361         typedef struct {
362                 [range(0,1000)] uint32 count;
363                 [size_is(count)] lsa_TranslatedSid *sids;
364         } lsa_TransSidArray;
365
366         const int LSA_REF_DOMAIN_LIST_MULTIPLIER = 32;
367         typedef struct {
368                 [range(0,1000)] uint32 count;
369                 [size_is(count)] lsa_DomainInfo *domains;
370                 uint32 max_size;
371         } lsa_RefDomainList;
372
373         /* Level 1: Ask everywhere
374          * Level 2: Ask domain and trusted domains, no builtin and wkn
375          * Level 3: Only ask domain
376          * Level 4: W2k3ad: Only ask AD trusts
377          * Level 5: Only ask transitive forest trusts
378          * Level 6: Like 4
379          */
380
381         typedef enum {
382                 LSA_LOOKUP_NAMES_ALL = 1,
383                 LSA_LOOKUP_NAMES_DOMAINS_ONLY = 2,
384                 LSA_LOOKUP_NAMES_PRIMARY_DOMAIN_ONLY = 3,
385                 LSA_LOOKUP_NAMES_UPLEVEL_TRUSTS_ONLY = 4,
386                 LSA_LOOKUP_NAMES_FOREST_TRUSTS_ONLY = 5,
387                 LSA_LOOKUP_NAMES_UPLEVEL_TRUSTS_ONLY2 = 6
388         } lsa_LookupNamesLevel;
389
390         [public] NTSTATUS lsa_LookupNames (
391                 [in]         policy_handle *handle,
392                 [in,range(0,1000)] uint32 num_names,
393                 [in,size_is(num_names)]  lsa_String names[],
394                 [out,unique] lsa_RefDomainList *domains,
395                 [in,out]     lsa_TransSidArray *sids,
396                 [in]         lsa_LookupNamesLevel level,
397                 [in,out]     uint32 *count
398                 );
399
400
401         /******************/
402         /* Function: 0x0f */
403
404         typedef struct {
405                 lsa_SidType sid_type;
406                 lsa_String name;
407                 uint32 sid_index;
408         } lsa_TranslatedName;
409
410         typedef struct {
411                 [range(0,1000)] uint32 count;
412                 [size_is(count)] lsa_TranslatedName *names;
413         } lsa_TransNameArray;
414
415         [public] NTSTATUS lsa_LookupSids (
416                 [in]         policy_handle *handle,
417                 [in]         lsa_SidArray *sids,
418                 [out,unique]        lsa_RefDomainList *domains,
419                 [in,out]     lsa_TransNameArray *names,
420                 [in]         uint16 level,
421                 [in,out] uint32 *count
422                 );
423
424
425         /* Function:        0x10 */
426         [public] NTSTATUS lsa_CreateSecret(
427                 [in]         policy_handle *handle,
428                 [in]         lsa_String       name,
429                 [in]         uint32         access_mask,
430                 [out]        policy_handle *sec_handle
431                 );
432
433
434         /*****************************************/
435         /* Function:     0x11                    */
436         NTSTATUS lsa_OpenAccount (
437                 [in]         policy_handle *handle,
438                 [in]         dom_sid2 *sid,
439                 [in]         uint32 access_mask,
440                 [out]        policy_handle *acct_handle
441                 );
442
443
444         /****************************************/
445         /* Function:    0x12                    */
446
447         typedef struct {
448                 lsa_LUID luid;
449                 uint32 attribute;
450         } lsa_LUIDAttribute;
451         
452         typedef struct {
453                 [range(0,1000)] uint32 count;
454                 uint32 unknown;
455                 [size_is(count)] lsa_LUIDAttribute set[*];
456         } lsa_PrivilegeSet;
457         
458         NTSTATUS lsa_EnumPrivsAccount (
459                 [in]         policy_handle *handle,
460                 [out,unique] lsa_PrivilegeSet *privs
461                 );
462
463
464         /****************************************/
465         /* Function:            0x13 */
466         NTSTATUS lsa_AddPrivilegesToAccount(
467                 [in]         policy_handle *handle,
468                 [in]         lsa_PrivilegeSet *privs
469                 );
470         
471
472         /****************************************/
473         /* Function:         0x14 */
474         NTSTATUS lsa_RemovePrivilegesFromAccount(
475                 [in]         policy_handle *handle,
476                 [in]         uint8 remove_all,
477                 [in,unique]  lsa_PrivilegeSet *privs
478                 );
479
480         /* Function:           0x15 */
481         [todo] NTSTATUS lsa_GetQuotasForAccount();
482         
483         /* Function:           0x16 */
484         [todo] NTSTATUS lsa_SetQuotasForAccount();
485         
486         /* Function:    0x17 */
487         [todo] NTSTATUS lsa_GetSystemAccessAccount();
488         /* Function:    0x18 */
489         [todo] NTSTATUS lsa_SetSystemAccessAccount();
490
491         /* Function:        0x19 */
492         NTSTATUS lsa_OpenTrustedDomain(
493                 [in]     policy_handle *handle,
494                 [in]     dom_sid2      *sid,
495                 [in]         uint32         access_mask,
496                 [out]    policy_handle *trustdom_handle
497                 );
498
499         typedef [flag(NDR_PAHEX)] struct {
500                 uint32 length;
501                 uint32 size;
502                 [size_is(size),length_is(length)] uint8 *data;
503         } lsa_DATA_BUF;
504
505         typedef [flag(NDR_PAHEX)] struct {
506                 [range(0,65536)] uint32 size;
507                 [size_is(size)] uint8 *data;
508         } lsa_DATA_BUF2;
509
510         typedef enum {
511                 LSA_TRUSTED_DOMAIN_INFO_NAME                  = 1,
512                 LSA_TRUSTED_DOMAIN_INFO_CONTROLLERS           = 2,
513                 LSA_TRUSTED_DOMAIN_INFO_POSIX_OFFSET          = 3,
514                 LSA_TRUSTED_DOMAIN_INFO_PASSWORD              = 4,
515                 LSA_TRUSTED_DOMAIN_INFO_BASIC                 = 5,
516                 LSA_TRUSTED_DOMAIN_INFO_INFO_EX               = 6,
517                 LSA_TRUSTED_DOMAIN_INFO_AUTH_INFO             = 7,
518                 LSA_TRUSTED_DOMAIN_INFO_FULL_INFO             = 8,
519                 LSA_TRUSTED_DOMAIN_INFO_AUTH_INFO_INTERNAL    = 9,
520                 LSA_TRUSTED_DOMAIN_INFO_FULL_INFO_INTERNAL    = 10,
521                 LSA_TRUSTED_DOMAIN_INFO_INFO_EX2_INTERNAL     = 11,
522                 LSA_TRUSTED_DOMAIN_INFO_FULL_INFO_2_INTERNAL  = 12,
523                 LSA_TRUSTED_DOMAIN_SUPPORTED_ENCRTYPION_TYPES = 13
524         } lsa_TrustDomInfoEnum;
525
526         typedef [public,bitmap32bit] bitmap {
527                 LSA_TRUST_DIRECTION_INBOUND  = 0x00000001,
528                 LSA_TRUST_DIRECTION_OUTBOUND = 0x00000002
529         } lsa_TrustDirection;
530
531         typedef [v1_enum] enum {
532                 LSA_TRUST_TYPE_DOWNLEVEL  = 0x00000001,
533                 LSA_TRUST_TYPE_UPLEVEL    = 0x00000002,
534                 LSA_TRUST_TYPE_MIT        = 0x00000003
535         } lsa_TrustType;
536
537         typedef [public,bitmap32bit] bitmap {
538                 LSA_TRUST_ATTRIBUTE_NON_TRANSITIVE      = 0x00000001,
539                 LSA_TRUST_ATTRIBUTE_UPLEVEL_ONLY        = 0x00000002,
540                 LSA_TRUST_ATTRIBUTE_QUARANTINED_DOMAIN  = 0x00000004,
541                 LSA_TRUST_ATTRIBUTE_FOREST_TRANSITIVE   = 0x00000008,
542                 LSA_TRUST_ATTRIBUTE_CROSS_ORGANIZATION  = 0x00000010,
543                 LSA_TRUST_ATTRIBUTE_WITHIN_FOREST       = 0x00000020,
544                 LSA_TRUST_ATTRIBUTE_TREAT_AS_EXTERNAL   = 0x00000040,
545                 LSA_TRUST_ATTRIBUTE_USES_RC4_ENCRYPTION = 0x00000080
546         } lsa_TrustAttributes;
547
548         typedef struct {
549                 lsa_StringLarge  netbios_name;
550         } lsa_TrustDomainInfoName;
551
552
553         typedef struct {
554                 uint32 entries;
555                 [size_is(entries)] lsa_StringLarge  *netbios_names;
556         } lsa_TrustDomainInfoControllers;
557
558         typedef struct {
559                 uint32         posix_offset;
560         } lsa_TrustDomainInfoPosixOffset;
561
562         typedef struct {
563                 lsa_DATA_BUF  *password;
564                 lsa_DATA_BUF  *old_password;
565         } lsa_TrustDomainInfoPassword;
566
567         typedef struct {
568                 lsa_String     netbios_name;
569                 dom_sid2      *sid;
570         } lsa_TrustDomainInfoBasic;
571
572         typedef struct {
573                 lsa_StringLarge     domain_name;
574                 lsa_StringLarge     netbios_name;
575                 dom_sid2           *sid;
576                 lsa_TrustDirection  trust_direction;
577                 lsa_TrustType       trust_type;
578                 lsa_TrustAttributes trust_attributes;
579         } lsa_TrustDomainInfoInfoEx;
580
581         typedef [public,v1_enum] enum {
582                 TRUST_AUTH_TYPE_NONE = 0,
583                 TRUST_AUTH_TYPE_NT4OWF = 1,
584                 TRUST_AUTH_TYPE_CLEAR = 2,
585                 TRUST_AUTH_TYPE_VERSION = 3
586         } lsa_TrustAuthType;
587
588         typedef struct {
589                 NTTIME_hyper   last_update_time;
590                 lsa_TrustAuthType AuthType;
591                 lsa_DATA_BUF2  data;
592         } lsa_TrustDomainInfoBuffer;
593
594         typedef struct {
595                 uint32 incoming_count;
596                 lsa_TrustDomainInfoBuffer *incoming_current_auth_info;
597                 lsa_TrustDomainInfoBuffer *incoming_previous_auth_info;
598                 uint32 outgoing_count;
599                 lsa_TrustDomainInfoBuffer *outgoing_current_auth_info;
600                 lsa_TrustDomainInfoBuffer *outgoing_previous_auth_info;
601         } lsa_TrustDomainInfoAuthInfo;
602
603         typedef struct {
604                 lsa_TrustDomainInfoInfoEx      info_ex;
605                 lsa_TrustDomainInfoPosixOffset posix_offset;
606                 lsa_TrustDomainInfoAuthInfo    auth_info;
607         } lsa_TrustDomainInfoFullInfo;
608
609         typedef struct {
610                 lsa_DATA_BUF2                          auth_blob;
611         } lsa_TrustDomainInfoAuthInfoInternal;
612
613         typedef struct {
614                 lsa_TrustDomainInfoInfoEx              info_ex;
615                 lsa_TrustDomainInfoPosixOffset         posix_offset;
616                 lsa_TrustDomainInfoAuthInfoInternal    auth_info;
617         } lsa_TrustDomainInfoFullInfoInternal;
618
619         typedef struct {
620                 lsa_TrustDomainInfoInfoEx      info_ex;
621                 uint32 forest_trust_length;
622                 [size_is(forest_trust_length)] uint8 *forest_trust_data;
623         } lsa_TrustDomainInfoInfoEx2Internal;
624
625         typedef struct {
626                 lsa_TrustDomainInfoInfoEx2Internal     info;
627                 lsa_TrustDomainInfoPosixOffset posix_offset;
628                 lsa_TrustDomainInfoAuthInfo    auth_info;
629         } lsa_TrustDomainInfoInfo2Internal;
630
631         typedef struct {
632                 kerb_EncTypes enc_types;
633         } lsa_TrustDomainInfoSupportedEncTypes;
634
635         typedef [switch_type(lsa_TrustDomInfoEnum)] union {
636                 [case(LSA_TRUSTED_DOMAIN_INFO_NAME)]
637                         lsa_TrustDomainInfoName              name;
638                 [case(LSA_TRUSTED_DOMAIN_INFO_CONTROLLERS)]
639                         lsa_TrustDomainInfoControllers   controllers;
640                 [case(LSA_TRUSTED_DOMAIN_INFO_POSIX_OFFSET)]
641                         lsa_TrustDomainInfoPosixOffset       posix_offset;
642                 [case(LSA_TRUSTED_DOMAIN_INFO_PASSWORD)]
643                         lsa_TrustDomainInfoPassword          password;
644                 [case(LSA_TRUSTED_DOMAIN_INFO_BASIC)]
645                         lsa_TrustDomainInfoBasic             info_basic;
646                 [case(LSA_TRUSTED_DOMAIN_INFO_INFO_EX)]
647                         lsa_TrustDomainInfoInfoEx            info_ex;
648                 [case(LSA_TRUSTED_DOMAIN_INFO_AUTH_INFO)]
649                         lsa_TrustDomainInfoAuthInfo          auth_info;
650                 [case(LSA_TRUSTED_DOMAIN_INFO_FULL_INFO)]
651                         lsa_TrustDomainInfoFullInfo          full_info;
652                 [case(LSA_TRUSTED_DOMAIN_INFO_AUTH_INFO_INTERNAL)]
653                         lsa_TrustDomainInfoAuthInfoInternal  auth_info_internal;
654                 [case(LSA_TRUSTED_DOMAIN_INFO_FULL_INFO_INTERNAL)]
655                         lsa_TrustDomainInfoFullInfoInternal  full_info_internal;
656                 [case(LSA_TRUSTED_DOMAIN_INFO_INFO_EX2_INTERNAL)]
657                         lsa_TrustDomainInfoInfoEx2Internal   info_ex2_internal;
658                 [case(LSA_TRUSTED_DOMAIN_INFO_FULL_INFO_2_INTERNAL)]
659                         lsa_TrustDomainInfoInfo2Internal     info2_internal;
660                 [case(LSA_TRUSTED_DOMAIN_SUPPORTED_ENCRTYPION_TYPES)]
661                         lsa_TrustDomainInfoSupportedEncTypes enc_types;
662         } lsa_TrustedDomainInfo;
663
664         /* Function:       0x1a */
665         NTSTATUS lsa_QueryTrustedDomainInfo(
666                 [in]     policy_handle                   *trustdom_handle,
667                 [in]     lsa_TrustDomInfoEnum             level, 
668                 [out,switch_is(level),unique] lsa_TrustedDomainInfo *info
669                 );
670
671         /* Function:     0x1b */
672         NTSTATUS lsa_SetInformationTrustedDomain(
673                 [in]                  policy_handle         *trustdom_handle,
674                 [in]                  lsa_TrustDomInfoEnum   level, 
675                 [in,switch_is(level)] lsa_TrustedDomainInfo *info
676                 );
677
678         /* Function:          0x1c */
679         [public] NTSTATUS lsa_OpenSecret(
680                 [in]     policy_handle    *handle,
681                 [in]         lsa_String        name,
682                 [in]         uint32            access_mask,
683                 [out]    policy_handle    *sec_handle
684                 );
685
686         /* Function:           0x1d */
687
688         [public] NTSTATUS lsa_SetSecret(
689                 [in]     policy_handle    *sec_handle,
690                 [in,unique]         lsa_DATA_BUF     *new_val,
691                 [in,unique]         lsa_DATA_BUF     *old_val
692                 );
693
694         typedef struct {
695                 lsa_DATA_BUF *buf;
696         } lsa_DATA_BUF_PTR;
697
698         /* Function:         0x1e */
699         [public] NTSTATUS lsa_QuerySecret (
700                 [in]     policy_handle     *sec_handle,
701                 [in,out,unique]     lsa_DATA_BUF_PTR  *new_val,
702                 [in,out,unique]     NTTIME_hyper      *new_mtime,
703                 [in,out,unique]     lsa_DATA_BUF_PTR  *old_val,
704                 [in,out,unique]     NTTIME_hyper      *old_mtime
705                 );
706
707         /* Function:     0x1f */
708         NTSTATUS lsa_LookupPrivValue(
709                 [in]     policy_handle *handle,
710                 [in]     lsa_String *name,
711                 [out]    lsa_LUID *luid
712                 );
713
714
715         /* Function:      0x20 */
716         NTSTATUS lsa_LookupPrivName (
717                 [in]     policy_handle *handle,
718                 [in]     lsa_LUID *luid,
719                 [out,unique]        lsa_StringLarge *name
720                 );
721
722
723         /*******************/
724         /* Function:  0x21 */
725         NTSTATUS lsa_LookupPrivDisplayName (
726                 [in]     policy_handle *handle,
727                 [in]     lsa_String *name,
728                 [out,unique]        lsa_StringLarge *disp_name,
729                 /* see http://www.microsoft.com/globaldev/nlsweb/ for
730                    language definitions */
731                 [in,out] uint16 *language_id,
732                 [in]         uint16 unknown
733                 );
734
735         /*******************/
736         /* Function:  0x22 */
737         NTSTATUS lsa_DeleteObject (
738                 [in,out]     policy_handle *handle
739                 );
740
741
742         
743         /*******************/
744         /* Function:      0x23 */
745         NTSTATUS lsa_EnumAccountsWithUserRight (
746                 [in]     policy_handle *handle,
747                 [in,unique]         lsa_String *name,
748                 [out]    lsa_SidArray *sids
749                 );
750
751         /* Function:      0x24 */
752         typedef struct {
753                 [string,charset(UTF16)] uint16 *name;
754         } lsa_RightAttribute;
755         
756         typedef struct {
757                 uint32 count;
758                 [size_is(count)] lsa_StringLarge *names;
759         } lsa_RightSet;
760         
761         NTSTATUS lsa_EnumAccountRights (
762                 [in]     policy_handle *handle,
763                 [in]     dom_sid2 *sid,
764                 [out]    lsa_RightSet *rights
765                 );
766
767
768         /**********************/
769         /* Function:       0x25 */
770         NTSTATUS lsa_AddAccountRights (
771                 [in]     policy_handle *handle,
772                 [in]     dom_sid2 *sid,
773                 [in]     lsa_RightSet *rights
774                 );
775         
776         /**********************/
777         /* Function:       0x26 */
778         NTSTATUS lsa_RemoveAccountRights (
779                 [in]     policy_handle *handle,
780                 [in]     dom_sid2 *sid,
781                 [in]         uint32 unknown,
782                 [in]     lsa_RightSet *rights
783                 );
784
785         /* Function:   0x27 */
786         NTSTATUS lsa_QueryTrustedDomainInfoBySid(
787                 [in]               policy_handle         *handle,
788                 [in]               dom_sid2              *dom_sid,
789                 [in]                   lsa_TrustDomInfoEnum  level, 
790                 [out,switch_is(level),unique] lsa_TrustedDomainInfo *info
791         );
792
793         /* Function:     0x28 */
794         NTSTATUS lsa_SetTrustedDomainInfo(
795                 [in]               policy_handle         *handle,
796                 [in]               dom_sid2              *dom_sid,
797                 [in]                   lsa_TrustDomInfoEnum  level, 
798                 [in,switch_is(level)] lsa_TrustedDomainInfo *info
799         );
800         /* Function:      0x29 */
801         NTSTATUS lsa_DeleteTrustedDomain(
802                 [in]               policy_handle         *handle,
803                 [in]               dom_sid2              *dom_sid
804         );
805
806         /* Function:       0x2a */
807         [todo] NTSTATUS lsa_StorePrivateData();
808         /* Function:        0x2b */
809         [todo] NTSTATUS lsa_RetrievePrivateData();
810
811
812         /**********************/
813         /* Function:     0x2c */
814         [public] NTSTATUS lsa_OpenPolicy2 (
815                 [in,unique]      [string,charset(UTF16)] uint16 *system_name,
816                 [in]  lsa_ObjectAttribute *attr,
817                 [in]      uint32 access_mask,
818                 [out] policy_handle *handle
819                 );
820
821         /**********************/
822         /* Function:     0x2d */
823         typedef struct {
824                 lsa_String *string;
825         } lsa_StringPointer;
826
827         NTSTATUS lsa_GetUserName(
828                 [in,unique] [string,charset(UTF16)] uint16 *system_name,
829                 [in,out,unique] lsa_String *account_name,
830                 [in,out,unique] lsa_StringPointer *authority_name
831                 );
832
833         /**********************/
834         /* Function:          0x2e */
835
836         NTSTATUS lsa_QueryInfoPolicy2(
837                 [in]                 policy_handle *handle,
838                 [in]                     lsa_PolicyInfo level,
839                 [out,unique,switch_is(level)]   lsa_PolicyInformation *info
840                 );
841
842         /* Function 0x2f */
843         NTSTATUS lsa_SetInfoPolicy2(
844                 [in]                            policy_handle *handle,
845                 [in]                            lsa_PolicyInfo level,
846                 [in,switch_is(level)]           lsa_PolicyInformation *info
847                 );
848
849         /**********************/
850         /* Function 0x30 */
851         NTSTATUS lsa_QueryTrustedDomainInfoByName(
852                 [in]                   policy_handle         *handle,
853                 [in]                   lsa_String             trusted_domain,
854                 [in]                   lsa_TrustDomInfoEnum   level, 
855                 [out,unique,switch_is(level)] lsa_TrustedDomainInfo *info
856                 );
857
858         /**********************/
859         /* Function 0x31 */
860         NTSTATUS lsa_SetTrustedDomainInfoByName(
861                 [in]                   policy_handle         *handle,
862                 [in]                   lsa_String             trusted_domain,
863                 [in]                   lsa_TrustDomInfoEnum   level, 
864                 [in,unique,switch_is(level)] lsa_TrustedDomainInfo *info
865                 );
866
867         /* Function 0x32 */
868
869         /* w2k3 treats max_size as max_domains*82       */
870         const int LSA_ENUM_TRUST_DOMAIN_EX_MULTIPLIER = 82;
871
872         typedef struct {
873                 uint32 count;
874                 [size_is(count)] lsa_TrustDomainInfoInfoEx *domains;
875         } lsa_DomainListEx;
876
877         NTSTATUS lsa_EnumTrustedDomainsEx (
878                 [in]               policy_handle *handle,
879                 [in,out]           uint32 *resume_handle,
880                 [out]              lsa_DomainListEx *domains,
881                 [in]               uint32 max_size
882                 );
883
884         /* Function 0x33 */
885         NTSTATUS lsa_CreateTrustedDomainEx(
886                 [in]  policy_handle               *policy_handle,
887                 [in]  lsa_TrustDomainInfoInfoEx   *info,
888                 [in]  lsa_TrustDomainInfoAuthInfoInternal *auth_info,
889                 [in]  uint32 access_mask,
890                 [out] policy_handle               *trustdom_handle
891                 );
892
893
894         /* Function 0x34 */
895         NTSTATUS lsa_CloseTrustedDomainEx(
896                 [in,out]                   policy_handle         *handle
897         );
898
899         /* Function 0x35 */
900
901         /* w2k3 returns either 0x000bbbd000000000 or 0x000a48e800000000 
902            for unknown6 - gd */
903         typedef struct {
904                 uint32 enforce_restrictions;
905                 hyper service_tkt_lifetime;
906                 hyper user_tkt_lifetime;
907                 hyper user_tkt_renewaltime;
908                 hyper clock_skew;
909                 hyper unknown6;
910         } lsa_DomainInfoKerberos;
911
912         typedef struct {
913                 uint32 blob_size;
914                 [size_is(blob_size)] uint8 *efs_blob;
915         } lsa_DomainInfoEfs;
916
917         typedef enum {
918                 LSA_DOMAIN_INFO_POLICY_EFS=2,
919                 LSA_DOMAIN_INFO_POLICY_KERBEROS=3
920         } lsa_DomainInfoEnum;
921
922         typedef [switch_type(uint16)] union {
923                 [case(LSA_DOMAIN_INFO_POLICY_EFS)]      lsa_DomainInfoEfs       efs_info;
924                 [case(LSA_DOMAIN_INFO_POLICY_KERBEROS)] lsa_DomainInfoKerberos  kerberos_info;
925         } lsa_DomainInformationPolicy;
926
927         NTSTATUS lsa_QueryDomainInformationPolicy(
928                 [in]            policy_handle *handle,
929                 [in]                    uint16 level,
930                 [out,unique,switch_is(level)]   lsa_DomainInformationPolicy *info
931                 );
932
933         /* Function 0x36 */
934         NTSTATUS lsa_SetDomainInformationPolicy(
935                 [in]            policy_handle *handle,
936                 [in]                    uint16 level,
937                 [in,unique,switch_is(level)]    lsa_DomainInformationPolicy *info
938                 );
939
940         /**********************/
941         /* Function 0x37 */
942         NTSTATUS lsa_OpenTrustedDomainByName(
943                 [in]     policy_handle *handle,
944                 [in]         lsa_String     name,
945                 [in]         uint32         access_mask,
946                 [out]    policy_handle *trustdom_handle
947                 );
948
949         /* Function 0x38 */
950         [todo] NTSTATUS lsa_TestCall();
951
952         /**********************/
953         /* Function 0x39 */
954
955         typedef struct {
956                 lsa_SidType sid_type;
957                 lsa_String name;
958                 uint32 sid_index;
959                 uint32 unknown;
960         } lsa_TranslatedName2;
961
962         typedef struct {
963                 [range(0,1000)] uint32 count;
964                 [size_is(count)] lsa_TranslatedName2 *names;
965         } lsa_TransNameArray2;
966
967         [public] NTSTATUS lsa_LookupSids2(
968                 [in]     policy_handle *handle,
969                 [in]     lsa_SidArray *sids,
970                 [out,unique]        lsa_RefDomainList *domains,
971                 [in,out] lsa_TransNameArray2 *names,
972                 [in]         uint16 level,
973                 [in,out] uint32 *count,
974                 [in]         uint32 unknown1,
975                 [in]         uint32 unknown2
976                 );
977
978         /**********************/
979         /* Function 0x3a */
980
981         typedef struct {
982                 lsa_SidType sid_type;
983                 uint32 rid;
984                 uint32 sid_index;
985                 uint32 unknown;
986         } lsa_TranslatedSid2;
987
988         typedef struct {
989                 [range(0,1000)] uint32 count;
990                 [size_is(count)] lsa_TranslatedSid2 *sids;
991         } lsa_TransSidArray2;
992
993         [public] NTSTATUS lsa_LookupNames2 (
994                 [in]     policy_handle *handle,
995                 [in,range(0,1000)] uint32 num_names,
996                 [in,size_is(num_names)]  lsa_String names[],
997                 [out,unique]        lsa_RefDomainList *domains,
998                 [in,out] lsa_TransSidArray2 *sids,
999                 [in]         lsa_LookupNamesLevel level,
1000                 [in,out] uint32 *count,
1001                 [in]         uint32 unknown1,
1002                 [in]         uint32 unknown2
1003                 );
1004
1005         /* Function 0x3b */
1006         NTSTATUS lsa_CreateTrustedDomainEx2(
1007                 [in]  policy_handle               *policy_handle,
1008                 [in]  lsa_TrustDomainInfoInfoEx   *info,
1009                 [in]  lsa_TrustDomainInfoAuthInfoInternal *auth_info,
1010                 [in]  uint32                       access_mask,
1011                 [out] policy_handle               *trustdom_handle
1012                 );
1013
1014         /* Function 0x3c */
1015         [todo] NTSTATUS lsa_CREDRWRITE();
1016
1017         /* Function 0x3d */
1018         [todo] NTSTATUS lsa_CREDRREAD();
1019
1020         /* Function 0x3e */
1021         [todo] NTSTATUS lsa_CREDRENUMERATE();
1022
1023         /* Function 0x3f */
1024         [todo] NTSTATUS lsa_CREDRWRITEDOMAINCREDENTIALS();
1025
1026         /* Function 0x40 */
1027         [todo] NTSTATUS lsa_CREDRREADDOMAINCREDENTIALS();
1028
1029         /* Function 0x41 */
1030         [todo] NTSTATUS lsa_CREDRDELETE();
1031
1032         /* Function 0x42 */
1033         [todo] NTSTATUS lsa_CREDRGETTARGETINFO();
1034
1035         /* Function 0x43 */
1036         [todo] NTSTATUS lsa_CREDRPROFILELOADED();
1037
1038         /**********************/
1039         /* Function 0x44 */
1040         typedef struct {
1041                 lsa_SidType sid_type;
1042                 dom_sid2 *sid;
1043                 uint32 sid_index;
1044                 uint32 unknown;
1045         } lsa_TranslatedSid3;
1046
1047         typedef struct {
1048                 [range(0,1000)] uint32 count;
1049                 [size_is(count)] lsa_TranslatedSid3 *sids;
1050         } lsa_TransSidArray3;
1051
1052         [public] NTSTATUS lsa_LookupNames3 (
1053                 [in]     policy_handle *handle,
1054                 [in,range(0,1000)] uint32 num_names,
1055                 [in,size_is(num_names)]  lsa_String names[],
1056                 [out,unique]        lsa_RefDomainList *domains,
1057                 [in,out] lsa_TransSidArray3 *sids,
1058                 [in]         lsa_LookupNamesLevel level,
1059                 [in,out] uint32 *count,
1060                 [in]         uint32 unknown1,
1061                 [in]         uint32 unknown2
1062                 );
1063
1064         /* Function 0x45 */
1065         [todo] NTSTATUS lsa_CREDRGETSESSIONTYPES();
1066
1067         /* Function 0x46 */
1068         [todo] NTSTATUS lsa_LSARREGISTERAUDITEVENT();
1069
1070         /* Function 0x47 */
1071         [todo] NTSTATUS lsa_LSARGENAUDITEVENT();
1072
1073         /* Function 0x48 */
1074         [todo] NTSTATUS lsa_LSARUNREGISTERAUDITEVENT();
1075
1076         /* Function 0x49 */
1077         typedef struct {
1078                 [range(0,131072)] uint32 length;
1079                 [size_is(length)] uint8 *data;
1080         } lsa_ForestTrustBinaryData;
1081
1082         typedef struct {
1083                 dom_sid2 *domain_sid;
1084                 lsa_StringLarge dns_domain_name;
1085                 lsa_StringLarge netbios_domain_name;
1086         } lsa_ForestTrustDomainInfo;
1087
1088         typedef [switch_type(uint32)] union {
1089                 [case(LSA_FOREST_TRUST_TOP_LEVEL_NAME)] lsa_String top_level_name;
1090                 [case(LSA_FOREST_TRUST_TOP_LEVEL_NAME_EX)] lsa_StringLarge top_level_name_ex;
1091                 [case(LSA_FOREST_TRUST_DOMAIN_INFO)] lsa_ForestTrustDomainInfo domain_info;
1092                 [default] lsa_ForestTrustBinaryData data;
1093         } lsa_ForestTrustData;
1094
1095         typedef [v1_enum] enum {
1096                 LSA_FOREST_TRUST_TOP_LEVEL_NAME = 0,
1097                 LSA_FOREST_TRUST_TOP_LEVEL_NAME_EX = 1,
1098                 LSA_FOREST_TRUST_DOMAIN_INFO = 2,
1099                 LSA_FOREST_TRUST_RECORD_TYPE_LAST = 3
1100         } lsa_ForestTrustRecordType;
1101
1102         typedef struct {
1103                 uint32 flags;
1104                 lsa_ForestTrustRecordType level;
1105                 hyper unknown;
1106                 [switch_is(level)] lsa_ForestTrustData forest_trust_data;
1107         } lsa_ForestTrustRecord;
1108
1109         typedef [public] struct {
1110                 [range(0,4000)] uint32 count;
1111                 [size_is(count)] lsa_ForestTrustRecord **entries;
1112         } lsa_ForestTrustInformation;
1113
1114         NTSTATUS lsa_lsaRQueryForestTrustInformation(
1115                 [in] policy_handle *handle,
1116                 [in,ref] lsa_String *trusted_domain_name,
1117                 [in] uint16 unknown, /* level ? */
1118                 [out,ref] lsa_ForestTrustInformation **forest_trust_info
1119                 );
1120
1121         /* Function 0x4a */
1122         [todo] NTSTATUS lsa_LSARSETFORESTTRUSTINFORMATION();
1123
1124         /* Function 0x4b */
1125         [todo] NTSTATUS lsa_CREDRRENAME();
1126
1127         /*****************/
1128         /* Function 0x4c */
1129
1130         [public] NTSTATUS lsa_LookupSids3(
1131                 [in]         lsa_SidArray *sids,
1132                 [out,unique] lsa_RefDomainList *domains,
1133                 [in,out]     lsa_TransNameArray2 *names,
1134                 [in]         uint16 level,
1135                 [in,out]     uint32 *count,
1136                 [in]         uint32 unknown1,
1137                 [in]         uint32 unknown2
1138                 );
1139
1140         /* Function 0x4d */
1141         NTSTATUS lsa_LookupNames4(
1142                 [in,range(0,1000)] uint32 num_names,
1143                 [in,size_is(num_names)]  lsa_String names[],
1144                 [out,unique]        lsa_RefDomainList *domains,
1145                 [in,out] lsa_TransSidArray3 *sids,
1146                 [in]         lsa_LookupNamesLevel level,
1147                 [in,out] uint32 *count,
1148                 [in]         uint32 unknown1,
1149                 [in]         uint32 unknown2
1150                 );
1151
1152         /* Function 0x4e */
1153         [todo] NTSTATUS lsa_LSAROPENPOLICYSCE();
1154
1155         /* Function 0x4f */
1156         [todo] NTSTATUS lsa_LSARADTREGISTERSECURITYEVENTSOURCE();
1157
1158         /* Function 0x50 */
1159         [todo] NTSTATUS lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE();
1160
1161         /* Function 0x51 */
1162         [todo] NTSTATUS lsa_LSARADTREPORTSECURITYEVENT();
1163
1164 }