pam_winbind: fix the build wrt libreplace.
[kai/samba.git] / source3 / librpc / idl / lsa.idl
1 #include "idl_types.h"
2
3 /*
4   lsa interface definition
5 */
6
7 import "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         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         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         NTSTATUS lsa_GetQuotasForAccount();
510         
511         /* Function:           0x16 */
512         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         /* Function:      0x23 */
705         NTSTATUS lsa_EnumAccountsWithUserRight (
706                 [in]     policy_handle *handle,
707                 [in,unique]         lsa_String *name,
708                 [out]    lsa_SidArray *sids
709                 );
710
711         /* Function:      0x24 */
712         typedef struct {
713                 [string,charset(UTF16)] uint16 *name;
714         } lsa_RightAttribute;
715         
716         typedef struct {
717                 [range(0,256)] uint32 count;
718                 [size_is(count)] lsa_StringLarge *names;
719         } lsa_RightSet;
720         
721         NTSTATUS lsa_EnumAccountRights (
722                 [in]     policy_handle *handle,
723                 [in,ref] dom_sid2 *sid,
724                 [out,ref] lsa_RightSet *rights
725                 );
726
727
728         /**********************/
729         /* Function:       0x25 */
730         NTSTATUS lsa_AddAccountRights (
731                 [in]     policy_handle *handle,
732                 [in,ref] dom_sid2 *sid,
733                 [in,ref] lsa_RightSet *rights
734                 );
735         
736         /**********************/
737         /* Function:       0x26 */
738         NTSTATUS lsa_RemoveAccountRights (
739                 [in]     policy_handle *handle,
740                 [in,ref] dom_sid2 *sid,
741                 [in]     uint8 remove_all,
742                 [in,ref] lsa_RightSet *rights
743                 );
744
745         /* Function:   0x27 */
746         NTSTATUS lsa_QueryTrustedDomainInfoBySid(
747                 [in]               policy_handle         *handle,
748                 [in,ref]           dom_sid2              *dom_sid,
749                 [in]               lsa_TrustDomInfoEnum  level,
750                 [out,switch_is(level),ref] lsa_TrustedDomainInfo **info
751         );
752
753         /* Function:     0x28 */
754         NTSTATUS lsa_SetTrustedDomainInfo();
755         /* Function:      0x29 */
756         NTSTATUS lsa_DeleteTrustedDomain(
757                 [in]               policy_handle         *handle,
758                 [in]               dom_sid2              *dom_sid
759         );
760
761         /* Function:       0x2a */
762         NTSTATUS lsa_StorePrivateData();
763         /* Function:        0x2b */
764         NTSTATUS lsa_RetrievePrivateData();
765
766
767         /**********************/
768         /* Function:     0x2c */
769         [public] NTSTATUS lsa_OpenPolicy2 (
770                 [in,unique]      [string,charset(UTF16)] uint16 *system_name,
771                 [in]  lsa_ObjectAttribute *attr,
772                 [in]  lsa_PolicyAccessMask access_mask,
773                 [out] policy_handle *handle
774                 );
775
776         /**********************/
777         /* Function:     0x2d */
778         NTSTATUS lsa_GetUserName(
779                 [in,unique] [string,charset(UTF16)] uint16 *system_name,
780                 [in,out,ref] lsa_String **account_name,
781                 [in,out,unique] lsa_String **authority_name
782                 );
783
784         /**********************/
785         /* Function:          0x2e */
786
787         NTSTATUS lsa_QueryInfoPolicy2(
788                 [in]                         policy_handle *handle,
789                 [in]                         lsa_PolicyInfo level,
790                 [out,ref,switch_is(level)]   lsa_PolicyInformation **info
791                 );
792
793         /* Function 0x2f */
794         NTSTATUS lsa_SetInfoPolicy2(
795                 [in]                            policy_handle *handle,
796                 [in]                            lsa_PolicyInfo level,
797                 [in,switch_is(level)]           lsa_PolicyInformation *info
798                 );
799
800         /**********************/
801         /* Function 0x30 */
802         NTSTATUS lsa_QueryTrustedDomainInfoByName(
803                 [in]                   policy_handle          *handle,
804                 [in,ref]               lsa_String             *trusted_domain,
805                 [in]                   lsa_TrustDomInfoEnum   level,
806                 [out,ref,switch_is(level)] lsa_TrustedDomainInfo **info
807                 );
808
809         /**********************/
810         /* Function 0x31 */
811         NTSTATUS lsa_SetTrustedDomainInfoByName(
812                 [in]                   policy_handle         *handle,
813                 [in]                   lsa_String             trusted_domain,
814                 [in]                   lsa_TrustDomInfoEnum   level, 
815                 [in,unique,switch_is(level)] lsa_TrustedDomainInfo *info
816                 );
817
818         /* Function 0x32 */
819
820         /* w2k3 treats max_size as max_domains*82       */
821         const int LSA_ENUM_TRUST_DOMAIN_EX_MULTIPLIER = 82;
822
823         typedef struct {
824                 uint32 count;
825                 [size_is(count)] lsa_TrustDomainInfoInfoEx *domains;
826         } lsa_DomainListEx;
827
828         NTSTATUS lsa_EnumTrustedDomainsEx (
829                 [in]               policy_handle *handle,
830                 [in,out]           uint32 *resume_handle,
831                 [out]              lsa_DomainListEx *domains,
832                 [in]               uint32 max_size
833                 );
834
835
836         /* Function 0x33 */
837         NTSTATUS lsa_CreateTrustedDomainEx();
838
839         /* Function 0x34 */
840         NTSTATUS lsa_CloseTrustedDomainEx(
841                 [in,out]                   policy_handle         *handle
842         );
843
844         /* Function 0x35 */
845
846         /* w2k3 returns either 0x000bbbd000000000 or 0x000a48e800000000 
847            for unknown6 - gd */
848         typedef struct {
849                 uint32 enforce_restrictions;
850                 hyper service_tkt_lifetime;
851                 hyper user_tkt_lifetime;
852                 hyper user_tkt_renewaltime;
853                 hyper clock_skew;
854                 hyper unknown6;
855         } lsa_DomainInfoKerberos;
856
857         typedef struct {
858                 uint32 blob_size;
859                 [size_is(blob_size)] uint8 *efs_blob;
860         } lsa_DomainInfoEfs;
861
862         typedef enum {
863                 LSA_DOMAIN_INFO_POLICY_EFS=2,
864                 LSA_DOMAIN_INFO_POLICY_KERBEROS=3
865         } lsa_DomainInfoEnum;
866
867         typedef [switch_type(uint16)] union {
868                 [case(LSA_DOMAIN_INFO_POLICY_EFS)]      lsa_DomainInfoEfs       efs_info;
869                 [case(LSA_DOMAIN_INFO_POLICY_KERBEROS)] lsa_DomainInfoKerberos  kerberos_info;
870         } lsa_DomainInformationPolicy;
871
872         NTSTATUS lsa_QueryDomainInformationPolicy(
873                 [in]            policy_handle *handle,
874                 [in]            uint16 level,
875                 [out,ref,switch_is(level)]      lsa_DomainInformationPolicy **info
876                 );
877
878         /* Function 0x36 */
879         NTSTATUS lsa_SetDomainInformationPolicy(
880                 [in]            policy_handle *handle,
881                 [in]                    uint16 level,
882                 [in,unique,switch_is(level)]    lsa_DomainInformationPolicy *info
883                 );
884
885         /**********************/
886         /* Function 0x37 */
887         NTSTATUS lsa_OpenTrustedDomainByName(
888                 [in]     policy_handle *handle,
889                 [in]         lsa_String     name,
890                 [in]         uint32         access_mask,
891                 [out]    policy_handle *trustdom_handle
892                 );
893
894         /* Function 0x38 */
895         NTSTATUS lsa_TestCall();
896
897         /**********************/
898         /* Function 0x39 */
899
900         typedef struct {
901                 lsa_SidType sid_type;
902                 lsa_String name;
903                 uint32 sid_index;
904                 uint32 unknown;
905         } lsa_TranslatedName2;
906
907         typedef struct {
908                 [range(0,1000)] uint32 count;
909                 [size_is(count)] lsa_TranslatedName2 *names;
910         } lsa_TransNameArray2;
911
912         [public] NTSTATUS lsa_LookupSids2(
913                 [in]     policy_handle *handle,
914                 [in,ref] lsa_SidArray *sids,
915                 [out,ref]    lsa_RefDomainList **domains,
916                 [in,out,ref] lsa_TransNameArray2 *names,
917                 [in]         uint16 level,
918                 [in,out,ref] uint32 *count,
919                 [in]         uint32 unknown1,
920                 [in]         uint32 unknown2
921                 );
922
923         /**********************/
924         /* Function 0x3a */
925
926         typedef struct {
927                 lsa_SidType sid_type;
928                 uint32 rid;
929                 uint32 sid_index;
930                 uint32 unknown;
931         } lsa_TranslatedSid2;
932
933         typedef struct {
934                 [range(0,1000)] uint32 count;
935                 [size_is(count)] lsa_TranslatedSid2 *sids;
936         } lsa_TransSidArray2;
937
938         [public] NTSTATUS lsa_LookupNames2 (
939                 [in]     policy_handle *handle,
940                 [in,range(0,1000)] uint32 num_names,
941                 [in,size_is(num_names)]  lsa_String names[],
942                 [out,ref]    lsa_RefDomainList **domains,
943                 [in,out,ref] lsa_TransSidArray2 *sids,
944                 [in]         lsa_LookupNamesLevel level,
945                 [in,out,ref] uint32 *count,
946                 [in]         uint32 unknown1,
947                 [in]         uint32 unknown2
948                 );
949
950         /* Function 0x3b */
951         NTSTATUS lsa_CreateTrustedDomainEx2();
952
953         /* Function 0x3c */
954         NTSTATUS lsa_CREDRWRITE();
955
956         /* Function 0x3d */
957         NTSTATUS lsa_CREDRREAD();
958
959         /* Function 0x3e */
960         NTSTATUS lsa_CREDRENUMERATE();
961
962         /* Function 0x3f */
963         NTSTATUS lsa_CREDRWRITEDOMAINCREDENTIALS();
964
965         /* Function 0x40 */
966         NTSTATUS lsa_CREDRREADDOMAINCREDENTIALS();
967
968         /* Function 0x41 */
969         NTSTATUS lsa_CREDRDELETE();
970
971         /* Function 0x42 */
972         NTSTATUS lsa_CREDRGETTARGETINFO();
973
974         /* Function 0x43 */
975         NTSTATUS lsa_CREDRPROFILELOADED();
976
977         /**********************/
978         /* Function 0x44 */
979         typedef struct {
980                 lsa_SidType sid_type;
981                 dom_sid2 *sid;
982                 uint32 sid_index;
983                 uint32 unknown;
984         } lsa_TranslatedSid3;
985
986         typedef struct {
987                 [range(0,1000)] uint32 count;
988                 [size_is(count)] lsa_TranslatedSid3 *sids;
989         } lsa_TransSidArray3;
990
991         [public] NTSTATUS lsa_LookupNames3 (
992                 [in]     policy_handle *handle,
993                 [in,range(0,1000)] uint32 num_names,
994                 [in,size_is(num_names)]  lsa_String names[],
995                 [out,ref]    lsa_RefDomainList **domains,
996                 [in,out,ref] lsa_TransSidArray3 *sids,
997                 [in]         lsa_LookupNamesLevel level,
998                 [in,out,ref] uint32 *count,
999                 [in]         uint32 unknown1,
1000                 [in]         uint32 unknown2
1001                 );
1002
1003         /* Function 0x45 */
1004         NTSTATUS lsa_CREDRGETSESSIONTYPES();
1005
1006         /* Function 0x46 */
1007         NTSTATUS lsa_LSARREGISTERAUDITEVENT();
1008
1009         /* Function 0x47 */
1010         NTSTATUS lsa_LSARGENAUDITEVENT();
1011
1012         /* Function 0x48 */
1013         NTSTATUS lsa_LSARUNREGISTERAUDITEVENT();
1014
1015         /* Function 0x49 */
1016         typedef struct {
1017                 [range(0,131072)] uint32 length;
1018                 [size_is(length)] uint8 *data;
1019         } lsa_ForestTrustBinaryData;
1020
1021         typedef struct {
1022                 dom_sid2 *domain_sid;
1023                 lsa_StringLarge dns_domain_name;
1024                 lsa_StringLarge netbios_domain_name;
1025         } lsa_ForestTrustDomainInfo;
1026
1027         typedef [switch_type(uint32)] union {
1028                 [case(LSA_FOREST_TRUST_TOP_LEVEL_NAME)] lsa_String top_level_name;
1029                 [case(LSA_FOREST_TRUST_TOP_LEVEL_NAME_EX)] lsa_StringLarge top_level_name_ex;
1030                 [case(LSA_FOREST_TRUST_DOMAIN_INFO)] lsa_ForestTrustDomainInfo domain_info;
1031                 [default] lsa_ForestTrustBinaryData data;
1032         } lsa_ForestTrustData;
1033
1034         typedef [v1_enum] enum {
1035                 LSA_FOREST_TRUST_TOP_LEVEL_NAME = 0,
1036                 LSA_FOREST_TRUST_TOP_LEVEL_NAME_EX = 1,
1037                 LSA_FOREST_TRUST_DOMAIN_INFO = 2,
1038                 LSA_FOREST_TRUST_RECORD_TYPE_LAST = 3
1039         } lsa_ForestTrustRecordType;
1040
1041         typedef struct {
1042                 uint32 flags;
1043                 lsa_ForestTrustRecordType level;
1044                 hyper unknown;
1045                 [switch_is(level)] lsa_ForestTrustData forest_trust_data;
1046         } lsa_ForestTrustRecord;
1047
1048         typedef [public] struct {
1049                 [range(0,4000)] uint32 count;
1050                 [size_is(count)] lsa_ForestTrustRecord **entries;
1051         } lsa_ForestTrustInformation;
1052
1053         NTSTATUS lsa_lsaRQueryForestTrustInformation(
1054                 [in] policy_handle *handle,
1055                 [in,ref] lsa_String *trusted_domain_name,
1056                 [in] uint16 unknown, /* level ? */
1057                 [out,ref] lsa_ForestTrustInformation **forest_trust_info
1058                 );
1059
1060         /* Function 0x4a */
1061         NTSTATUS lsa_LSARSETFORESTTRUSTINFORMATION();
1062
1063         /* Function 0x4b */
1064         NTSTATUS lsa_CREDRRENAME();
1065
1066         /*****************/
1067         /* Function 0x4c */
1068
1069         [public] NTSTATUS lsa_LookupSids3(
1070                 [in,ref]     lsa_SidArray *sids,
1071                 [out,ref]    lsa_RefDomainList **domains,
1072                 [in,out,ref] lsa_TransNameArray2 *names,
1073                 [in]         uint16 level,
1074                 [in,out,ref] uint32 *count,
1075                 [in]         uint32 unknown1,
1076                 [in]         uint32 unknown2
1077                 );
1078
1079         /* Function 0x4d */
1080         NTSTATUS lsa_LookupNames4(
1081                 [in,range(0,1000)] uint32 num_names,
1082                 [in,size_is(num_names)]  lsa_String names[],
1083                 [out,ref]    lsa_RefDomainList **domains,
1084                 [in,out,ref] lsa_TransSidArray3 *sids,
1085                 [in]         lsa_LookupNamesLevel level,
1086                 [in,out,ref] uint32 *count,
1087                 [in]         uint32 unknown1,
1088                 [in]         uint32 unknown2
1089                 );
1090
1091         /* Function 0x4e */
1092         NTSTATUS lsa_LSAROPENPOLICYSCE();
1093
1094         /* Function 0x4f */
1095         NTSTATUS lsa_LSARADTREGISTERSECURITYEVENTSOURCE();
1096
1097         /* Function 0x50 */
1098         NTSTATUS lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE();
1099
1100         /* Function 0x51 */
1101         NTSTATUS lsa_LSARADTREPORTSECURITYEVENT();
1102
1103 }