408956b3fa802c33c77a2fe514c856c2f88c17a8
[nivanova/samba-autobuild/.git] / source4 / 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 struct {
582                 NTTIME_hyper   last_update_time;
583                 uint32         secret_type;
584                 lsa_DATA_BUF2  data;
585         } lsa_TrustDomainInfoBuffer;
586
587         typedef struct {
588                 uint32 incoming_count;
589                 lsa_TrustDomainInfoBuffer *incoming_current_auth_info;
590                 lsa_TrustDomainInfoBuffer *incoming_previous_auth_info;
591                 uint32 outgoing_count;
592                 lsa_TrustDomainInfoBuffer *outgoing_current_auth_info;
593                 lsa_TrustDomainInfoBuffer *outgoing_previous_auth_info;
594         } lsa_TrustDomainInfoAuthInfo;
595
596         typedef struct {
597                 lsa_TrustDomainInfoInfoEx      info_ex;
598                 lsa_TrustDomainInfoPosixOffset posix_offset;
599                 lsa_TrustDomainInfoAuthInfo    auth_info;
600         } lsa_TrustDomainInfoFullInfo;
601
602         typedef struct {
603                 lsa_TrustDomainInfoInfoEx      info_ex;
604                 lsa_DATA_BUF2                  data1;
605         } lsa_TrustDomainInfoInfoEx2Internal;
606
607         typedef struct {
608                 lsa_TrustDomainInfoInfoEx      info_ex;
609                 lsa_DATA_BUF2                  data1;
610                 lsa_TrustDomainInfoPosixOffset posix_offset;
611                 lsa_TrustDomainInfoAuthInfo    auth_info;
612         } lsa_TrustDomainInfoInfo2Internal;
613
614         typedef struct {
615                 kerb_EncTypes enc_types;
616         } lsa_TrustDomainInfoSupportedEncTypes;
617
618         typedef [switch_type(lsa_TrustDomInfoEnum)] union {
619                 [case(LSA_TRUSTED_DOMAIN_INFO_NAME)]
620                         lsa_TrustDomainInfoName              name;
621                 [case(LSA_TRUSTED_DOMAIN_INFO_CONTROLLERS)]
622                         lsa_TrustDomainInfoControllers   controllers;
623                 [case(LSA_TRUSTED_DOMAIN_INFO_POSIX_OFFSET)]
624                         lsa_TrustDomainInfoPosixOffset       posix_offset;
625                 [case(LSA_TRUSTED_DOMAIN_INFO_PASSWORD)]
626                         lsa_TrustDomainInfoPassword          password;
627                 [case(LSA_TRUSTED_DOMAIN_INFO_BASIC)]
628                         lsa_TrustDomainInfoBasic             info_basic;
629                 [case(LSA_TRUSTED_DOMAIN_INFO_INFO_EX)]
630                         lsa_TrustDomainInfoInfoEx            info_ex;
631                 [case(LSA_TRUSTED_DOMAIN_INFO_AUTH_INFO)]
632                         lsa_TrustDomainInfoAuthInfo          auth_info;
633                 [case(LSA_TRUSTED_DOMAIN_INFO_FULL_INFO)]
634                         lsa_TrustDomainInfoFullInfo          full_info;
635                 [case(LSA_TRUSTED_DOMAIN_INFO_AUTH_INFO_INTERNAL)]
636                         lsa_TrustDomainInfoAuthInfo          auth_info_internal;
637                 [case(LSA_TRUSTED_DOMAIN_INFO_FULL_INFO_INTERNAL)]
638                         lsa_TrustDomainInfoFullInfo          full_info_internal;
639                 [case(LSA_TRUSTED_DOMAIN_INFO_INFO_EX2_INTERNAL)]
640                         lsa_TrustDomainInfoInfoEx2Internal   info_ex2_internal;
641                 [case(LSA_TRUSTED_DOMAIN_INFO_FULL_INFO_2_INTERNAL)]
642                         lsa_TrustDomainInfoInfo2Internal     info2_internal;
643                 [case(LSA_TRUSTED_DOMAIN_SUPPORTED_ENCRTYPION_TYPES)]
644                         lsa_TrustDomainInfoSupportedEncTypes enc_types;
645         } lsa_TrustedDomainInfo;
646
647         /* Function:       0x1a */
648         NTSTATUS lsa_QueryTrustedDomainInfo(
649                 [in]     policy_handle                   *trustdom_handle,
650                 [in]     lsa_TrustDomInfoEnum             level, 
651                 [out,switch_is(level),unique] lsa_TrustedDomainInfo *info
652                 );
653
654         /* Function:     0x1b */
655         [todo] NTSTATUS lsa_SetInformationTrustedDomain();
656
657         /* Function:          0x1c */
658         [public] NTSTATUS lsa_OpenSecret(
659                 [in]     policy_handle    *handle,
660                 [in]         lsa_String        name,
661                 [in]         uint32            access_mask,
662                 [out]    policy_handle    *sec_handle
663                 );
664
665         /* Function:           0x1d */
666
667         [public] NTSTATUS lsa_SetSecret(
668                 [in]     policy_handle    *sec_handle,
669                 [in,unique]         lsa_DATA_BUF     *new_val,
670                 [in,unique]         lsa_DATA_BUF     *old_val
671                 );
672
673         typedef struct {
674                 lsa_DATA_BUF *buf;
675         } lsa_DATA_BUF_PTR;
676
677         /* Function:         0x1e */
678         [public] NTSTATUS lsa_QuerySecret (
679                 [in]     policy_handle     *sec_handle,
680                 [in,out,unique]     lsa_DATA_BUF_PTR  *new_val,
681                 [in,out,unique]     NTTIME_hyper      *new_mtime,
682                 [in,out,unique]     lsa_DATA_BUF_PTR  *old_val,
683                 [in,out,unique]     NTTIME_hyper      *old_mtime
684                 );
685
686         /* Function:     0x1f */
687         NTSTATUS lsa_LookupPrivValue(
688                 [in]     policy_handle *handle,
689                 [in]     lsa_String *name,
690                 [out]    lsa_LUID *luid
691                 );
692
693
694         /* Function:      0x20 */
695         NTSTATUS lsa_LookupPrivName (
696                 [in]     policy_handle *handle,
697                 [in]     lsa_LUID *luid,
698                 [out,unique]        lsa_StringLarge *name
699                 );
700
701
702         /*******************/
703         /* Function:  0x21 */
704         NTSTATUS lsa_LookupPrivDisplayName (
705                 [in]     policy_handle *handle,
706                 [in]     lsa_String *name,
707                 [out,unique]        lsa_StringLarge *disp_name,
708                 /* see http://www.microsoft.com/globaldev/nlsweb/ for
709                    language definitions */
710                 [in,out] uint16 *language_id,
711                 [in]         uint16 unknown
712                 );
713
714         /*******************/
715         /* Function:  0x22 */
716         NTSTATUS lsa_DeleteObject (
717                 [in,out]     policy_handle *handle
718                 );
719
720
721         
722         /*******************/
723         /* Function:      0x23 */
724         NTSTATUS lsa_EnumAccountsWithUserRight (
725                 [in]     policy_handle *handle,
726                 [in,unique]         lsa_String *name,
727                 [out]    lsa_SidArray *sids
728                 );
729
730         /* Function:      0x24 */
731         typedef struct {
732                 [string,charset(UTF16)] uint16 *name;
733         } lsa_RightAttribute;
734         
735         typedef struct {
736                 uint32 count;
737                 [size_is(count)] lsa_StringLarge *names;
738         } lsa_RightSet;
739         
740         NTSTATUS lsa_EnumAccountRights (
741                 [in]     policy_handle *handle,
742                 [in]     dom_sid2 *sid,
743                 [out]    lsa_RightSet *rights
744                 );
745
746
747         /**********************/
748         /* Function:       0x25 */
749         NTSTATUS lsa_AddAccountRights (
750                 [in]     policy_handle *handle,
751                 [in]     dom_sid2 *sid,
752                 [in]     lsa_RightSet *rights
753                 );
754         
755         /**********************/
756         /* Function:       0x26 */
757         NTSTATUS lsa_RemoveAccountRights (
758                 [in]     policy_handle *handle,
759                 [in]     dom_sid2 *sid,
760                 [in]         uint32 unknown,
761                 [in]     lsa_RightSet *rights
762                 );
763
764         /* Function:   0x27 */
765         NTSTATUS lsa_QueryTrustedDomainInfoBySid(
766                 [in]               policy_handle         *handle,
767                 [in]               dom_sid2              *dom_sid,
768                 [in]                   lsa_TrustDomInfoEnum  level, 
769                 [out,switch_is(level),unique] lsa_TrustedDomainInfo *info
770         );
771
772         /* Function:     0x28 */
773         [todo] NTSTATUS lsa_SetTrustedDomainInfo();
774         /* Function:      0x29 */
775         NTSTATUS lsa_DeleteTrustedDomain(
776                 [in]               policy_handle         *handle,
777                 [in]               dom_sid2              *dom_sid
778         );
779
780         /* Function:       0x2a */
781         [todo] NTSTATUS lsa_StorePrivateData();
782         /* Function:        0x2b */
783         [todo] NTSTATUS lsa_RetrievePrivateData();
784
785
786         /**********************/
787         /* Function:     0x2c */
788         [public] NTSTATUS lsa_OpenPolicy2 (
789                 [in,unique]      [string,charset(UTF16)] uint16 *system_name,
790                 [in]  lsa_ObjectAttribute *attr,
791                 [in]      uint32 access_mask,
792                 [out] policy_handle *handle
793                 );
794
795         /**********************/
796         /* Function:     0x2d */
797         typedef struct {
798                 lsa_String *string;
799         } lsa_StringPointer;
800
801         NTSTATUS lsa_GetUserName(
802                 [in,unique] [string,charset(UTF16)] uint16 *system_name,
803                 [in,out,unique] lsa_String *account_name,
804                 [in,out,unique] lsa_StringPointer *authority_name
805                 );
806
807         /**********************/
808         /* Function:          0x2e */
809
810         NTSTATUS lsa_QueryInfoPolicy2(
811                 [in]                 policy_handle *handle,
812                 [in]                     lsa_PolicyInfo level,
813                 [out,unique,switch_is(level)]   lsa_PolicyInformation *info
814                 );
815
816         /* Function 0x2f */
817         NTSTATUS lsa_SetInfoPolicy2(
818                 [in]                            policy_handle *handle,
819                 [in]                            lsa_PolicyInfo level,
820                 [in,switch_is(level)]           lsa_PolicyInformation *info
821                 );
822
823         /**********************/
824         /* Function 0x30 */
825         NTSTATUS lsa_QueryTrustedDomainInfoByName(
826                 [in]                   policy_handle         *handle,
827                 [in]                   lsa_String             trusted_domain,
828                 [in]                   lsa_TrustDomInfoEnum   level, 
829                 [out,unique,switch_is(level)] lsa_TrustedDomainInfo *info
830                 );
831
832         /**********************/
833         /* Function 0x31 */
834         NTSTATUS lsa_SetTrustedDomainInfoByName(
835                 [in]                   policy_handle         *handle,
836                 [in]                   lsa_String             trusted_domain,
837                 [in]                   lsa_TrustDomInfoEnum   level, 
838                 [in,unique,switch_is(level)] lsa_TrustedDomainInfo *info
839                 );
840
841         /* Function 0x32 */
842
843         /* w2k3 treats max_size as max_domains*82       */
844         const int LSA_ENUM_TRUST_DOMAIN_EX_MULTIPLIER = 82;
845
846         typedef struct {
847                 uint32 count;
848                 [size_is(count)] lsa_TrustDomainInfoInfoEx *domains;
849         } lsa_DomainListEx;
850
851         NTSTATUS lsa_EnumTrustedDomainsEx (
852                 [in]               policy_handle *handle,
853                 [in,out]           uint32 *resume_handle,
854                 [out]              lsa_DomainListEx *domains,
855                 [in]               uint32 max_size
856                 );
857
858
859         /* Function 0x33 */
860         [todo] NTSTATUS lsa_CreateTrustedDomainEx();
861
862         /* Function 0x34 */
863         NTSTATUS lsa_CloseTrustedDomainEx(
864                 [in,out]                   policy_handle         *handle
865         );
866
867         /* Function 0x35 */
868
869         /* w2k3 returns either 0x000bbbd000000000 or 0x000a48e800000000 
870            for unknown6 - gd */
871         typedef struct {
872                 uint32 enforce_restrictions;
873                 hyper service_tkt_lifetime;
874                 hyper user_tkt_lifetime;
875                 hyper user_tkt_renewaltime;
876                 hyper clock_skew;
877                 hyper unknown6;
878         } lsa_DomainInfoKerberos;
879
880         typedef struct {
881                 uint32 blob_size;
882                 [size_is(blob_size)] uint8 *efs_blob;
883         } lsa_DomainInfoEfs;
884
885         typedef enum {
886                 LSA_DOMAIN_INFO_POLICY_EFS=2,
887                 LSA_DOMAIN_INFO_POLICY_KERBEROS=3
888         } lsa_DomainInfoEnum;
889
890         typedef [switch_type(uint16)] union {
891                 [case(LSA_DOMAIN_INFO_POLICY_EFS)]      lsa_DomainInfoEfs       efs_info;
892                 [case(LSA_DOMAIN_INFO_POLICY_KERBEROS)] lsa_DomainInfoKerberos  kerberos_info;
893         } lsa_DomainInformationPolicy;
894
895         NTSTATUS lsa_QueryDomainInformationPolicy(
896                 [in]            policy_handle *handle,
897                 [in]                    uint16 level,
898                 [out,unique,switch_is(level)]   lsa_DomainInformationPolicy *info
899                 );
900
901         /* Function 0x36 */
902         NTSTATUS lsa_SetDomainInformationPolicy(
903                 [in]            policy_handle *handle,
904                 [in]                    uint16 level,
905                 [in,unique,switch_is(level)]    lsa_DomainInformationPolicy *info
906                 );
907
908         /**********************/
909         /* Function 0x37 */
910         NTSTATUS lsa_OpenTrustedDomainByName(
911                 [in]     policy_handle *handle,
912                 [in]         lsa_String     name,
913                 [in]         uint32         access_mask,
914                 [out]    policy_handle *trustdom_handle
915                 );
916
917         /* Function 0x38 */
918         [todo] NTSTATUS lsa_TestCall();
919
920         /**********************/
921         /* Function 0x39 */
922
923         typedef struct {
924                 lsa_SidType sid_type;
925                 lsa_String name;
926                 uint32 sid_index;
927                 uint32 unknown;
928         } lsa_TranslatedName2;
929
930         typedef struct {
931                 [range(0,1000)] uint32 count;
932                 [size_is(count)] lsa_TranslatedName2 *names;
933         } lsa_TransNameArray2;
934
935         [public] NTSTATUS lsa_LookupSids2(
936                 [in]     policy_handle *handle,
937                 [in]     lsa_SidArray *sids,
938                 [out,unique]        lsa_RefDomainList *domains,
939                 [in,out] lsa_TransNameArray2 *names,
940                 [in]         uint16 level,
941                 [in,out] uint32 *count,
942                 [in]         uint32 unknown1,
943                 [in]         uint32 unknown2
944                 );
945
946         /**********************/
947         /* Function 0x3a */
948
949         typedef struct {
950                 lsa_SidType sid_type;
951                 uint32 rid;
952                 uint32 sid_index;
953                 uint32 unknown;
954         } lsa_TranslatedSid2;
955
956         typedef struct {
957                 [range(0,1000)] uint32 count;
958                 [size_is(count)] lsa_TranslatedSid2 *sids;
959         } lsa_TransSidArray2;
960
961         [public] NTSTATUS lsa_LookupNames2 (
962                 [in]     policy_handle *handle,
963                 [in,range(0,1000)] uint32 num_names,
964                 [in,size_is(num_names)]  lsa_String names[],
965                 [out,unique]        lsa_RefDomainList *domains,
966                 [in,out] lsa_TransSidArray2 *sids,
967                 [in]         lsa_LookupNamesLevel level,
968                 [in,out] uint32 *count,
969                 [in]         uint32 unknown1,
970                 [in]         uint32 unknown2
971                 );
972
973         /* Function 0x3b */
974         [todo] NTSTATUS lsa_CreateTrustedDomainEx2();
975
976         /* Function 0x3c */
977         [todo] NTSTATUS lsa_CREDRWRITE();
978
979         /* Function 0x3d */
980         [todo] NTSTATUS lsa_CREDRREAD();
981
982         /* Function 0x3e */
983         [todo] NTSTATUS lsa_CREDRENUMERATE();
984
985         /* Function 0x3f */
986         [todo] NTSTATUS lsa_CREDRWRITEDOMAINCREDENTIALS();
987
988         /* Function 0x40 */
989         [todo] NTSTATUS lsa_CREDRREADDOMAINCREDENTIALS();
990
991         /* Function 0x41 */
992         [todo] NTSTATUS lsa_CREDRDELETE();
993
994         /* Function 0x42 */
995         [todo] NTSTATUS lsa_CREDRGETTARGETINFO();
996
997         /* Function 0x43 */
998         [todo] NTSTATUS lsa_CREDRPROFILELOADED();
999
1000         /**********************/
1001         /* Function 0x44 */
1002         typedef struct {
1003                 lsa_SidType sid_type;
1004                 dom_sid2 *sid;
1005                 uint32 sid_index;
1006                 uint32 unknown;
1007         } lsa_TranslatedSid3;
1008
1009         typedef struct {
1010                 [range(0,1000)] uint32 count;
1011                 [size_is(count)] lsa_TranslatedSid3 *sids;
1012         } lsa_TransSidArray3;
1013
1014         [public] NTSTATUS lsa_LookupNames3 (
1015                 [in]     policy_handle *handle,
1016                 [in,range(0,1000)] uint32 num_names,
1017                 [in,size_is(num_names)]  lsa_String names[],
1018                 [out,unique]        lsa_RefDomainList *domains,
1019                 [in,out] lsa_TransSidArray3 *sids,
1020                 [in]         lsa_LookupNamesLevel level,
1021                 [in,out] uint32 *count,
1022                 [in]         uint32 unknown1,
1023                 [in]         uint32 unknown2
1024                 );
1025
1026         /* Function 0x45 */
1027         [todo] NTSTATUS lsa_CREDRGETSESSIONTYPES();
1028
1029         /* Function 0x46 */
1030         [todo] NTSTATUS lsa_LSARREGISTERAUDITEVENT();
1031
1032         /* Function 0x47 */
1033         [todo] NTSTATUS lsa_LSARGENAUDITEVENT();
1034
1035         /* Function 0x48 */
1036         [todo] NTSTATUS lsa_LSARUNREGISTERAUDITEVENT();
1037
1038         /* Function 0x49 */
1039         typedef struct {
1040                 [range(0,131072)] uint32 length;
1041                 [size_is(length)] uint8 *data;
1042         } lsa_ForestTrustBinaryData;
1043
1044         typedef struct {
1045                 dom_sid2 *domain_sid;
1046                 lsa_StringLarge dns_domain_name;
1047                 lsa_StringLarge netbios_domain_name;
1048         } lsa_ForestTrustDomainInfo;
1049
1050         typedef [switch_type(uint32)] union {
1051                 [case(LSA_FOREST_TRUST_TOP_LEVEL_NAME)] lsa_String top_level_name;
1052                 [case(LSA_FOREST_TRUST_TOP_LEVEL_NAME_EX)] lsa_StringLarge top_level_name_ex;
1053                 [case(LSA_FOREST_TRUST_DOMAIN_INFO)] lsa_ForestTrustDomainInfo domain_info;
1054                 [default] lsa_ForestTrustBinaryData data;
1055         } lsa_ForestTrustData;
1056
1057         typedef [v1_enum] enum {
1058                 LSA_FOREST_TRUST_TOP_LEVEL_NAME = 0,
1059                 LSA_FOREST_TRUST_TOP_LEVEL_NAME_EX = 1,
1060                 LSA_FOREST_TRUST_DOMAIN_INFO = 2,
1061                 LSA_FOREST_TRUST_RECORD_TYPE_LAST = 3
1062         } lsa_ForestTrustRecordType;
1063
1064         typedef struct {
1065                 uint32 flags;
1066                 lsa_ForestTrustRecordType level;
1067                 hyper unknown;
1068                 [switch_is(level)] lsa_ForestTrustData forest_trust_data;
1069         } lsa_ForestTrustRecord;
1070
1071         typedef [public] struct {
1072                 [range(0,4000)] uint32 count;
1073                 [size_is(count)] lsa_ForestTrustRecord **entries;
1074         } lsa_ForestTrustInformation;
1075
1076         NTSTATUS lsa_lsaRQueryForestTrustInformation(
1077                 [in] policy_handle *handle,
1078                 [in,ref] lsa_String *trusted_domain_name,
1079                 [in] uint16 unknown, /* level ? */
1080                 [out,ref] lsa_ForestTrustInformation **forest_trust_info
1081                 );
1082
1083         /* Function 0x4a */
1084         [todo] NTSTATUS lsa_LSARSETFORESTTRUSTINFORMATION();
1085
1086         /* Function 0x4b */
1087         [todo] NTSTATUS lsa_CREDRRENAME();
1088
1089         /*****************/
1090         /* Function 0x4c */
1091
1092         [public] NTSTATUS lsa_LookupSids3(
1093                 [in]         lsa_SidArray *sids,
1094                 [out,unique] lsa_RefDomainList *domains,
1095                 [in,out]     lsa_TransNameArray2 *names,
1096                 [in]         uint16 level,
1097                 [in,out]     uint32 *count,
1098                 [in]         uint32 unknown1,
1099                 [in]         uint32 unknown2
1100                 );
1101
1102         /* Function 0x4d */
1103         NTSTATUS lsa_LookupNames4(
1104                 [in,range(0,1000)] uint32 num_names,
1105                 [in,size_is(num_names)]  lsa_String names[],
1106                 [out,unique]        lsa_RefDomainList *domains,
1107                 [in,out] lsa_TransSidArray3 *sids,
1108                 [in]         lsa_LookupNamesLevel level,
1109                 [in,out] uint32 *count,
1110                 [in]         uint32 unknown1,
1111                 [in]         uint32 unknown2
1112                 );
1113
1114         /* Function 0x4e */
1115         [todo] NTSTATUS lsa_LSAROPENPOLICYSCE();
1116
1117         /* Function 0x4f */
1118         [todo] NTSTATUS lsa_LSARADTREGISTERSECURITYEVENTSOURCE();
1119
1120         /* Function 0x50 */
1121         [todo] NTSTATUS lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE();
1122
1123         /* Function 0x51 */
1124         [todo] NTSTATUS lsa_LSARADTREPORTSECURITYEVENT();
1125
1126 }