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