netlogon.idl: make use of bitmap samr_GroupAttrs
[metze/samba/wb-ndr.git] / source / librpc / idl / netlogon.idl
1 /*
2   netlogon interface
3   much of this was derived from the ethereal sources - thanks to everyone 
4   who contributed!
5 */
6
7 import "lsa.idl", "samr.idl", "security.idl", "nbt.idl";
8
9 #include "idl_types.h"
10
11 [
12   uuid("12345678-1234-abcd-ef00-01234567cffb"),
13   version(1.0),
14   endpoint("ncacn_np:[\\pipe\\netlogon]","ncacn_ip_tcp:","ncalrpc:"),
15   pointer_default(unique),
16   pointer_default_top(unique)
17 ]
18
19 interface netlogon
20 {
21         typedef bitmap samr_AcctFlags samr_AcctFlags;
22         typedef bitmap samr_GroupAttrs samr_GroupAttrs;
23
24         /*****************/
25         /* Function 0x00 */
26
27         typedef struct {
28                 [string,charset(UTF16)] uint16 *account_name;
29                 uint32 priv;
30                 uint32 auth_flags;
31                 uint32 logon_count;
32                 uint32 bad_pw_count;
33                 time_t last_logon;
34                 time_t last_logoff;
35                 time_t logoff_time;
36                 time_t kickoff_time;
37                 uint32 password_age;
38                 time_t pw_can_change;
39                 time_t pw_must_change;
40                 [string,charset(UTF16)] uint16 *computer;
41                 [string,charset(UTF16)] uint16 *domain;
42                 [string,charset(UTF16)] uint16 *script_path;
43                 uint32 unknown;
44         } netr_UasInfo;
45
46         WERROR netr_LogonUasLogon(
47                 [in]   [string,charset(UTF16)] uint16 *server_name,
48                 [in]   [string,charset(UTF16)] uint16 account_name[],
49                 [in]   [string,charset(UTF16)] uint16 workstation[],
50                 [out]  netr_UasInfo *info
51                 );
52
53
54         /*****************/
55         /* Function 0x01 */
56
57         typedef struct {
58                 uint32 duration;
59                 uint16 logon_count;
60         } netr_UasLogoffInfo;
61
62         WERROR netr_LogonUasLogoff(
63                 [in] [string,charset(UTF16)] uint16 *server_name,
64                 [in] [string,charset(UTF16)] uint16 account_name[],
65                 [in] [string,charset(UTF16)] uint16 workstation[],
66                 [out] netr_UasLogoffInfo info
67                 );
68
69
70         /*****************/
71         /* Function 0x02 */
72
73         /* in netr_AcctLockStr size seems to be be 24, and rrenard thinks 
74            that the structure of the bindata looks like this:
75
76                 dlong  lockout_duration;
77                 udlong reset_count;
78                 uint32 bad_attempt_lockout;
79                 uint32 dummy;   
80
81            but it doesn't look as though this structure is reflected at the
82            NDR level. Maybe it is left to the application to decode the bindata array.
83         */
84         typedef struct {
85                 uint16 size;
86                 uint16 length;
87                 [size_is(size/2),length_is(length/2)] uint16 *bindata;
88         } netr_AcctLockStr;
89
90         const int MSV1_0_CLEARTEXT_PASSWORD_ALLOWED = 0x002;
91         const int MSV1_0_ALLOW_SERVER_TRUST_ACCOUNT = 0x020;
92         const int MSV1_0_ALLOW_WORKSTATION_TRUST_ACCOUNT = 0x800;
93
94         typedef struct {
95                 lsa_String  domain_name;
96                 uint32      parameter_control; /* see MSV1_0_* */
97                 uint32      logon_id_low;
98                 uint32      logon_id_high;
99                 lsa_String  account_name;
100                 lsa_String  workstation;
101         } netr_IdentityInfo;
102
103         typedef struct {
104                 netr_IdentityInfo identity_info;
105                 samr_Password lmpassword;
106                 samr_Password ntpassword;
107         } netr_PasswordInfo;
108
109         typedef [flag(NDR_PAHEX)] struct {
110                 uint16 length;
111                 [value(length)] uint16 size;
112                 [size_is(length),length_is(length)] uint8 *data;
113         } netr_ChallengeResponse;
114
115         typedef [flag(NDR_PAHEX)] struct {
116                 netr_IdentityInfo identity_info;
117                 uint8 challenge[8];
118                 netr_ChallengeResponse nt;
119                 netr_ChallengeResponse lm;
120         } netr_NetworkInfo;
121
122         typedef [public,switch_type(uint16)] union {
123                 [case(1)] netr_PasswordInfo *password;
124                 [case(2)] netr_NetworkInfo  *network;
125                 [case(3)] netr_PasswordInfo *password;
126                 [case(5)] netr_PasswordInfo *password;
127                 [case(6)] netr_NetworkInfo  *network;
128         } netr_LogonLevel;
129
130         typedef [public,flag(NDR_PAHEX)] struct {
131                 uint8 key[16];
132         } netr_UserSessionKey;
133
134         typedef [public,flag(NDR_PAHEX)] struct {
135                 uint8 key[8];
136         } netr_LMSessionKey;
137
138         /* Flags for user_flags below */
139         typedef [public,bitmap32bit] bitmap {
140                 NETLOGON_GUEST                  = 0x0001,
141                 NETLOGON_NOENCRYPTION           = 0x0002,
142                 NETLOGON_CACHED_ACCOUNT         = 0x0004,
143                 NETLOGON_USED_LM_PASSWORD       = 0x0008,
144                 NETLOGON_EXTRA_SIDS             = 0x0020,
145                 NETLOGON_SUBAUTH_SESSION_KEY    = 0x0040,
146                 NETLOGON_SERVER_TRUST_ACCOUNT   = 0x0080,
147                 NETLOGON_NTLMV2_ENABLED         = 0x0100,
148                 NETLOGON_RESOURCE_GROUPS        = 0x0200,
149                 NETLOGON_PROFILE_PATH_RETURNED  = 0x0400
150         } netr_UserFlags;
151
152         typedef struct {
153                 NTTIME last_logon;
154                 NTTIME last_logoff;
155                 NTTIME acct_expiry;
156                 NTTIME last_password_change;
157                 NTTIME allow_password_change;
158                 NTTIME force_password_change;
159                 lsa_String account_name;
160                 lsa_String full_name;
161                 lsa_String logon_script;
162                 lsa_String profile_path;
163                 lsa_String home_directory;
164                 lsa_String home_drive;
165                 uint16 logon_count;
166                 uint16 bad_password_count;
167                 uint32 rid;
168                 uint32 primary_gid;
169                 samr_RidWithAttributeArray groups;
170                 netr_UserFlags user_flags;
171                 netr_UserSessionKey key;
172                 lsa_StringLarge logon_server;
173                 lsa_StringLarge domain;
174                 dom_sid2 *domain_sid;
175                 netr_LMSessionKey LMSessKey;
176                 samr_AcctFlags acct_flags;
177                 uint32 unknown[7];
178         } netr_SamBaseInfo;
179
180         typedef struct {
181                 netr_SamBaseInfo base;
182         } netr_SamInfo2;
183
184         typedef struct {
185                 dom_sid2 *sid;
186                 samr_GroupAttrs attributes;
187         } netr_SidAttr;
188
189         typedef [public] struct {
190                 netr_SamBaseInfo base;
191                 uint32 sidcount;
192                 [size_is(sidcount)] netr_SidAttr *sids;
193         } netr_SamInfo3;
194
195         typedef struct {
196                 netr_SamBaseInfo base;
197                 uint32 sidcount;
198                 [size_is(sidcount)] netr_SidAttr *sids;
199                 lsa_String forest;
200                 lsa_String principle;
201                 uint32 unknown4[20];
202         } netr_SamInfo6;
203
204         typedef struct {
205                 uint32 pac_size;
206                 [size_is(pac_size)] uint8 *pac;
207                 lsa_String logon_domain;
208                 lsa_String logon_server;
209                 lsa_String principal_name;
210                 uint32 auth_size;
211                 [size_is(auth_size)] uint8 *auth;
212                 netr_UserSessionKey user_session_key;
213                 uint32 expansionroom[10];
214                 lsa_String unknown1;
215                 lsa_String unknown2;
216                 lsa_String unknown3;
217                 lsa_String unknown4;
218         } netr_PacInfo;
219
220         typedef [public,switch_type(uint16)] union {
221                 [case(2)] netr_SamInfo2 *sam2;
222                 [case(3)] netr_SamInfo3 *sam3;
223                 [case(4)] netr_PacInfo  *pac;
224                 [case(5)] netr_PacInfo  *pac;
225                 [case(6)] netr_SamInfo6 *sam6;
226         } netr_Validation;
227
228         typedef [public, flag(NDR_PAHEX)] struct {
229                 uint8 data[8];
230         } netr_Credential;
231
232         typedef [public] struct {
233                 netr_Credential cred;
234                 time_t timestamp;
235         } netr_Authenticator;
236
237         NTSTATUS netr_LogonSamLogon(
238                 [in] [string,charset(UTF16)] uint16 *server_name,
239                 [in] [string,charset(UTF16)] uint16 *computer_name,
240                 [in] netr_Authenticator *credential,
241                 [in][out] netr_Authenticator *return_authenticator,
242                 [in]  uint16 logon_level,
243                 [in]  [switch_is(logon_level)] netr_LogonLevel logon,
244                 [in]  uint16 validation_level,
245                 [out] [switch_is(validation_level)] netr_Validation validation,
246                 [out] uint8 authoritative
247                 );
248
249
250         /*****************/
251         /* Function 0x03 */
252
253         NTSTATUS netr_LogonSamLogoff(
254                 [in] [string,charset(UTF16)] uint16 *server_name,
255                 [in] [string,charset(UTF16)] uint16 *computer_name,
256                 [in]      netr_Authenticator *credential,
257                 [in][out] netr_Authenticator *return_authenticator,
258                 [in] uint16 logon_level,
259                 [in] [switch_is(logon_level)] netr_LogonLevel logon
260                 );
261         
262
263
264         /*****************/
265         /* Function 0x04 */
266
267         [public] NTSTATUS netr_ServerReqChallenge(
268                 [in,string,charset(UTF16)] uint16 *server_name,
269                 [in,string,charset(UTF16)] uint16 computer_name[],
270                 [in,out,ref] netr_Credential *credentials
271                 );
272
273
274         /*****************/
275         /* Function 0x05 */
276
277         typedef enum netr_SchannelType netr_SchannelType;
278
279         NTSTATUS netr_ServerAuthenticate(
280                 [in,string,charset(UTF16)] uint16 *server_name,
281                 [in,string,charset(UTF16)] uint16 account_name[],
282                 [in]                       netr_SchannelType secure_channel_type,
283                 [in,string,charset(UTF16)] uint16 computer_name[],
284                 [in,out,ref] netr_Credential *credentials
285                 );
286
287
288         /*****************/
289         /* Function 0x06 */
290
291         NTSTATUS netr_ServerPasswordSet(
292                 [in]  [string,charset(UTF16)] uint16 *server_name,
293                 [in]  [string,charset(UTF16)] uint16 account_name[],
294                 [in]  netr_SchannelType secure_channel_type,
295                 [in]  [string,charset(UTF16)] uint16 computer_name[],
296                 [in]  netr_Authenticator credential,
297                 [in]  samr_Password new_password,
298                 [out] netr_Authenticator return_authenticator
299                 );
300
301
302         /*****************/
303         /* Function 0x07 */
304
305         typedef enum netr_SamDatabaseID netr_SamDatabaseID;
306
307         typedef struct {
308                 [string,charset(UTF16)] uint16 *account_name;
309                 lsa_String unknown1;
310                 lsa_String unknown2;
311                 lsa_String unknown3;
312                 lsa_String unknown4;
313                 uint32 unknown5;
314                 uint32 unknown6;
315                 uint32 unknown7;
316                 uint32 unknown8;
317         } netr_DELTA_DELETE_USER;
318
319         typedef struct {
320                 uint16 length;
321                 [value(length)] uint16 size;
322                 uint32 flags;
323                 samr_Password pwd;
324         } netr_USER_KEY16;
325
326         typedef struct {
327                 uint16 nt_length;
328                 [value(nt_length)] uint16 nt_size;
329                 uint32 nt_flags;
330                 uint16 lm_length;
331                 [value(lm_length)] uint16 lm_size;
332                 uint32 lm_flags;
333                 uint8 nt_history[nt_length];
334                 uint8 lm_history[lm_length];
335         } netr_PasswordHistory;
336
337         typedef struct {
338                 netr_USER_KEY16 lmpassword;
339                 netr_USER_KEY16 ntpassword;
340                 netr_PasswordHistory history;
341         } netr_USER_KEYS2;
342
343         typedef struct { /* TODO: make this a union! */
344                 netr_USER_KEYS2 keys2;
345         } netr_USER_KEY_UNION;
346
347         typedef [public] struct {
348                 uint32 version;
349                 netr_USER_KEY_UNION keys;
350         } netr_USER_KEYS;
351
352         typedef struct {
353                 boolean8  SensitiveDataFlag;
354                 uint32 DataLength;
355
356                 /* netr_USER_KEYS encrypted with the session key */
357                 [size_is(DataLength)][flag(NDR_PAHEX)] uint8 *SensitiveData;
358         } netr_USER_PRIVATE_INFO;
359
360         typedef struct {
361                 lsa_String account_name;
362                 lsa_String full_name;
363                 uint32 rid;
364                 uint32 primary_gid;
365                 lsa_String home_directory;
366                 lsa_String home_drive;
367                 lsa_String logon_script;
368                 lsa_String description;
369                 lsa_String workstations;
370                 NTTIME last_logon;
371                 NTTIME last_logoff;
372                 samr_LogonHours logon_hours;
373                 uint16 bad_password_count;
374                 uint16 logon_count;
375                 NTTIME last_password_change;
376                 NTTIME acct_expiry;
377                 samr_AcctFlags acct_flags;
378                 samr_Password lmpassword;
379                 samr_Password ntpassword;
380                 boolean8 nt_password_present;
381                 boolean8 lm_password_present;
382                 boolean8 password_expired;
383                 lsa_String comment;
384                 lsa_String parameters;
385                 uint16 country_code;
386                 uint16 code_page;
387                 netr_USER_PRIVATE_INFO user_private_info;
388                 uint32 SecurityInformation;
389                 sec_desc_buf sdbuf;
390                 lsa_String profile_path;
391                 lsa_String unknown2;
392                 lsa_String unknown3;
393                 lsa_String unknown4;
394                 uint32 unknown5;
395                 uint32 unknown6;
396                 uint32 unknown7;
397                 uint32 unknown8;
398         } netr_DELTA_USER;
399
400         typedef struct {
401                 lsa_String domain_name;
402                 lsa_String comment;
403                 dlong force_logoff_time;
404                 uint16 min_password_length;
405                 uint16 password_history_length;
406                 /* yes, these are signed. They are in negative 100ns */
407                 dlong  max_password_age;
408                 dlong  min_password_age;
409                 udlong sequence_num;
410                 NTTIME domain_create_time;
411                 uint32 SecurityInformation;
412                 sec_desc_buf sdbuf;
413                 netr_AcctLockStr account_lockout;
414                 lsa_String unknown2;
415                 lsa_String unknown3;
416                 lsa_String unknown4;
417                 uint32 logon_to_chgpass;
418                 uint32 unknown6;
419                 uint32 unknown7;
420                 uint32 unknown8;
421         } netr_DELTA_DOMAIN;
422
423         typedef struct {
424                 lsa_String group_name;
425                 uint32 rid;
426                 uint32 attributes;
427                 lsa_String description;
428                 uint32 SecurityInformation;
429                 sec_desc_buf sdbuf;
430                 lsa_String unknown1;
431                 lsa_String unknown2;
432                 lsa_String unknown3;
433                 lsa_String unknown4;
434                 uint32 unknown5;
435                 uint32 unknown6;
436                 uint32 unknown7;
437                 uint32 unknown8;
438         } netr_DELTA_GROUP;
439
440         typedef struct {
441                 lsa_String OldName;
442                 lsa_String NewName;
443                 lsa_String unknown1;
444                 lsa_String unknown2;
445                 lsa_String unknown3;
446                 lsa_String unknown4;
447                 uint32 unknown5;
448                 uint32 unknown6;
449                 uint32 unknown7;
450                 uint32 unknown8;
451         } netr_DELTA_RENAME;
452
453         typedef struct {
454                 [size_is(num_rids)] uint32 *rids;
455                 [size_is(num_rids)] uint32 *attribs;
456                 uint32 num_rids;
457                 uint32 unknown1;
458                 uint32 unknown2;
459                 uint32 unknown3;
460                 uint32 unknown4;
461         } netr_DELTA_GROUP_MEMBER;
462
463         typedef struct {
464                 lsa_String alias_name;
465                 uint32 rid;
466                 uint32 SecurityInformation;
467                 sec_desc_buf sdbuf;
468                 lsa_String description;
469                 lsa_String unknown2;
470                 lsa_String unknown3;
471                 lsa_String unknown4;
472                 uint32 unknown5;
473                 uint32 unknown6;
474                 uint32 unknown7;
475                 uint32 unknown8;
476         } netr_DELTA_ALIAS;
477
478         typedef struct {
479                 lsa_SidArray sids;
480                 uint32 unknown1;
481                 uint32 unknown2;
482                 uint32 unknown3;
483                 uint32 unknown4;
484         } netr_DELTA_ALIAS_MEMBER;
485
486         typedef struct {
487                 uint32 pagedpoollimit;
488                 uint32 nonpagedpoollimit;
489                 uint32 minimumworkingsetsize;
490                 uint32 maximumworkingsetsize;
491                 uint32 pagefilelimit;
492                 NTTIME timelimit;
493         } netr_QUOTA_LIMITS;
494
495         typedef struct {
496                 uint32 maxlogsize;
497                 NTTIME auditretentionperiod;
498                 boolean8 auditingmode;
499                 uint32 maxauditeventcount;
500                 [size_is(maxauditeventcount+1)] uint32 *eventauditoptions;
501                 lsa_String primary_domain_name;
502                 dom_sid2 *sid;
503                 netr_QUOTA_LIMITS quota_limits;
504                 udlong sequence_num;
505                 NTTIME db_create_time;
506                 uint32 SecurityInformation;
507                 sec_desc_buf sdbuf;
508                 lsa_String unknown1;
509                 lsa_String unknown2;
510                 lsa_String unknown3;
511                 lsa_String unknown4;
512                 uint32 unknown5;
513                 uint32 unknown6;
514                 uint32 unknown7;
515                 uint32 unknown8;
516         } netr_DELTA_POLICY;
517
518         typedef struct {
519                 lsa_String domain_name;
520                 uint32 num_controllers;
521                 [size_is(num_controllers)] lsa_String *controller_names;
522                 uint32 SecurityInformation;
523                 sec_desc_buf sdbuf;
524                 lsa_String unknown1;
525                 lsa_String unknown2;
526                 lsa_String unknown3;
527                 lsa_String unknown4;
528                 uint32 posix_offset;
529                 uint32 unknown6;
530                 uint32 unknown7;
531                 uint32 unknown8;
532         } netr_DELTA_TRUSTED_DOMAIN;
533
534         typedef struct {
535                 uint16 unknown;
536         } netr_DELTA_DELETE_TRUST;
537
538         typedef struct {
539                 uint32 privilege_entries;
540                 uint32 privilege_control;
541                 [size_is(privilege_entries)] uint32 *privilege_attrib;
542                 [size_is(privilege_entries)] lsa_String *privilege_name;
543                 netr_QUOTA_LIMITS quotalimits;
544                 uint32 system_flags;
545                 uint32 SecurityInformation;
546                 sec_desc_buf sdbuf;
547                 lsa_String unknown1;
548                 lsa_String unknown2;
549                 lsa_String unknown3;
550                 lsa_String unknown4;
551                 uint32 unknown5;
552                 uint32 unknown6;
553                 uint32 unknown7;
554                 uint32 unknown8;
555         } netr_DELTA_ACCOUNT;
556
557         typedef struct {
558                 uint16 unknown;
559         } netr_DELTA_DELETE_ACCOUNT;
560
561         typedef struct {
562                 uint16 unknown;
563         } netr_DELTA_DELETE_SECRET;
564
565         typedef struct {
566                 uint32 len;
567                 uint32 maxlen;
568                 [size_is(maxlen)][length_is(len)] uint8 *cipher_data;
569         } netr_CIPHER_VALUE;
570
571         typedef struct {
572                 netr_CIPHER_VALUE current_cipher;
573                 NTTIME current_cipher_set_time;
574                 netr_CIPHER_VALUE old_cipher;
575                 NTTIME old_cipher_set_time;
576                 uint32 SecurityInformation;
577                 sec_desc_buf sdbuf;
578                 lsa_String unknown1;
579                 lsa_String unknown2;
580                 lsa_String unknown3;
581                 lsa_String unknown4;
582                 uint32 unknown5;
583                 uint32 unknown6;
584                 uint32 unknown7;
585                 uint32 unknown8;
586         } netr_DELTA_SECRET;
587
588         typedef enum {
589                 NETR_DELTA_DOMAIN           = 1,
590                 NETR_DELTA_GROUP            = 2,
591                 NETR_DELTA_DELETE_GROUP     = 3,
592                 NETR_DELTA_RENAME_GROUP     = 4,
593                 NETR_DELTA_USER             = 5,
594                 NETR_DELTA_DELETE_USER      = 6,
595                 NETR_DELTA_RENAME_USER      = 7,
596                 NETR_DELTA_GROUP_MEMBER     = 8,
597                 NETR_DELTA_ALIAS            = 9,
598                 NETR_DELTA_DELETE_ALIAS     = 10,
599                 NETR_DELTA_RENAME_ALIAS     = 11,
600                 NETR_DELTA_ALIAS_MEMBER     = 12,
601                 NETR_DELTA_POLICY           = 13,
602                 NETR_DELTA_TRUSTED_DOMAIN   = 14,
603                 NETR_DELTA_DELETE_TRUST     = 15,
604                 NETR_DELTA_ACCOUNT          = 16,
605                 NETR_DELTA_DELETE_ACCOUNT   = 17,
606                 NETR_DELTA_SECRET           = 18,
607                 NETR_DELTA_DELETE_SECRET    = 19,
608                 NETR_DELTA_DELETE_GROUP2    = 20,
609                 NETR_DELTA_DELETE_USER2     = 21,
610                 NETR_DELTA_MODIFY_COUNT     = 22
611         } netr_DeltaEnum;
612
613         typedef [switch_type(netr_DeltaEnum)] union {
614                 [case(NETR_DELTA_DOMAIN)]          netr_DELTA_DOMAIN          *domain;
615                 [case(NETR_DELTA_GROUP)]           netr_DELTA_GROUP           *group;
616                 [case(NETR_DELTA_DELETE_GROUP)]    ; /* rid only */
617                 [case(NETR_DELTA_RENAME_GROUP)]    netr_DELTA_RENAME          *rename_group;
618                 [case(NETR_DELTA_USER)]            netr_DELTA_USER            *user;
619                 [case(NETR_DELTA_DELETE_USER)]     ; /* rid only */
620                 [case(NETR_DELTA_RENAME_USER)]     netr_DELTA_RENAME          *rename_user;
621                 [case(NETR_DELTA_GROUP_MEMBER)]    netr_DELTA_GROUP_MEMBER    *group_member;
622                 [case(NETR_DELTA_ALIAS)]           netr_DELTA_ALIAS           *alias;
623                 [case(NETR_DELTA_DELETE_ALIAS)]    ; /* rid only */
624                 [case(NETR_DELTA_RENAME_ALIAS)]    netr_DELTA_RENAME          *rename_alias;
625                 [case(NETR_DELTA_ALIAS_MEMBER)]    netr_DELTA_ALIAS_MEMBER    *alias_member;
626                 [case(NETR_DELTA_POLICY)]          netr_DELTA_POLICY          *policy;
627                 [case(NETR_DELTA_TRUSTED_DOMAIN)]  netr_DELTA_TRUSTED_DOMAIN   *trusted_domain;
628                 [case(NETR_DELTA_DELETE_TRUST)]    netr_DELTA_DELETE_TRUST     delete_trust;
629                 [case(NETR_DELTA_ACCOUNT)]         netr_DELTA_ACCOUNT         *account;
630                 [case(NETR_DELTA_DELETE_ACCOUNT)]  netr_DELTA_DELETE_ACCOUNT   delete_account;
631                 [case(NETR_DELTA_SECRET)]          netr_DELTA_SECRET          *secret;
632                 [case(NETR_DELTA_DELETE_SECRET)]   netr_DELTA_DELETE_SECRET    delete_secret;
633                 [case(NETR_DELTA_DELETE_GROUP2)]   netr_DELTA_DELETE_USER     *delete_group;
634                 [case(NETR_DELTA_DELETE_USER2)]    netr_DELTA_DELETE_USER     *delete_user;
635                 [case(NETR_DELTA_MODIFY_COUNT)]    udlong                     *modified_count;
636         } netr_DELTA_UNION;
637
638         typedef [switch_type(netr_DeltaEnum)] union {
639                 [case(NETR_DELTA_DOMAIN)]          uint32 rid;
640                 [case(NETR_DELTA_GROUP)]           uint32 rid;
641                 [case(NETR_DELTA_DELETE_GROUP)]    uint32 rid;
642                 [case(NETR_DELTA_RENAME_GROUP)]    uint32 rid;
643                 [case(NETR_DELTA_USER)]            uint32 rid;
644                 [case(NETR_DELTA_DELETE_USER)]     uint32 rid;
645                 [case(NETR_DELTA_RENAME_USER)]     uint32 rid;
646                 [case(NETR_DELTA_GROUP_MEMBER)]    uint32 rid;
647                 [case(NETR_DELTA_ALIAS)]           uint32 rid;
648                 [case(NETR_DELTA_DELETE_ALIAS)]    uint32 rid;
649                 [case(NETR_DELTA_RENAME_ALIAS)]    uint32 rid;
650                 [case(NETR_DELTA_ALIAS_MEMBER)]    uint32 rid;
651                 [case(NETR_DELTA_POLICY)]          dom_sid2 *sid;
652                 [case(NETR_DELTA_TRUSTED_DOMAIN)]  dom_sid2 *sid;
653                 [case(NETR_DELTA_DELETE_TRUST)]    dom_sid2 *sid;
654                 [case(NETR_DELTA_ACCOUNT)]         dom_sid2 *sid;
655                 [case(NETR_DELTA_DELETE_ACCOUNT)]  dom_sid2 *sid;
656                 [case(NETR_DELTA_SECRET)]          [string,charset(UTF16)] uint16 *name;
657                 [case(NETR_DELTA_DELETE_SECRET)]   [string,charset(UTF16)] uint16 *name;
658                 [case(NETR_DELTA_DELETE_GROUP2)]   uint32 rid;
659                 [case(NETR_DELTA_DELETE_USER2)]    uint32 rid;
660                 [case(NETR_DELTA_MODIFY_COUNT)]    ;
661         } netr_DELTA_ID_UNION;
662
663         typedef struct {
664                 netr_DeltaEnum delta_type;
665                 [switch_is(delta_type)] netr_DELTA_ID_UNION delta_id_union;
666                 [switch_is(delta_type)] netr_DELTA_UNION delta_union;
667         } netr_DELTA_ENUM;
668
669         typedef struct {
670                 uint32 num_deltas;
671                 [size_is(num_deltas)] netr_DELTA_ENUM *delta_enum;
672         } netr_DELTA_ENUM_ARRAY;
673
674
675         NTSTATUS netr_DatabaseDeltas(
676                 [in]      [string,charset(UTF16)] uint16 logon_server[],
677                 [in]      [string,charset(UTF16)] uint16 computername[],
678                 [in]      netr_Authenticator credential,
679                 [in,out]  netr_Authenticator return_authenticator,
680                 [in]      netr_SamDatabaseID database_id,
681                 [in,out]  udlong sequence_num,
682                 [in]      uint32 preferredmaximumlength,
683                 [out]     netr_DELTA_ENUM_ARRAY *delta_enum_array
684                 );
685
686
687         /*****************/
688         /* Function 0x08 */
689
690         NTSTATUS netr_DatabaseSync(
691                 [in]     [string,charset(UTF16)] uint16 logon_server[],
692                 [in]     [string,charset(UTF16)] uint16 computername[],
693                 [in]     netr_Authenticator credential,
694                 [in,out] netr_Authenticator return_authenticator,
695                 [in]     netr_SamDatabaseID database_id,
696                 [in,out] uint32 sync_context,
697                 [in]     uint32 preferredmaximumlength,
698                 [out]    netr_DELTA_ENUM_ARRAY *delta_enum_array
699                 );
700
701
702         /*****************/
703         /* Function 0x09 */
704
705         /* w2k3 returns NT_STATUS_NOT_IMPLEMENTED for this call */
706
707         typedef [flag(NDR_PAHEX)] struct {
708                 uint8 computer_name[16];
709                 uint32 timecreated;
710                 uint32 serial_number;
711         } netr_UAS_INFO_0;
712
713         typedef struct {
714                 [flag(NDR_REMAINING)] DATA_BLOB blob;
715         } netr_AccountBuffer;
716
717         NTSTATUS netr_AccountDeltas(
718                 [in]     [string,charset(UTF16)] uint16 *logon_server,
719                 [in]     [string,charset(UTF16)] uint16 computername[],
720                 [in]     netr_Authenticator credential,
721                 [in,out] netr_Authenticator return_authenticator,
722                 [in]     netr_UAS_INFO_0 uas,
723                 [in]     uint32 count,
724                 [in]     uint32 level,
725                 [in]     uint32 buffersize,
726                 [out,subcontext(4)] netr_AccountBuffer buffer,
727                 [out]    uint32 count_returned,
728                 [out]    uint32 total_entries,
729                 [out]    netr_UAS_INFO_0 recordid
730                 );
731
732
733         /*****************/
734         /* Function 0x0A */
735
736         NTSTATUS netr_AccountSync(
737                 [in]      [string,charset(UTF16)] uint16 *logon_server,
738                 [in]      [string,charset(UTF16)] uint16 computername[],
739                 [in]      netr_Authenticator credential,
740                 [in,out]  netr_Authenticator return_authenticator,
741                 [in]      uint32 reference,
742                 [in]      uint32 level,
743                 [in]      uint32 buffersize,
744                 [out,subcontext(4)] netr_AccountBuffer buffer,
745                 [out]     uint32 count_returned,
746                 [out]     uint32 total_entries,
747                 [out]     uint32 next_reference,
748                 [in,out]  netr_UAS_INFO_0 recordid
749                 );
750
751
752         /*****************/
753         /* Function 0x0B */
754
755         WERROR netr_GetDcName(
756                 [in]  [string,charset(UTF16)] uint16 logon_server[],
757                 [in]  [string,charset(UTF16)] uint16 *domainname,
758                 [out] [string,charset(UTF16)] uint16 *dcname
759                 );
760
761         /*****************/
762         /* Function 0x0C */
763
764         typedef struct {
765                 uint32 flags;
766                 uint32 pdc_connection_status;
767         } netr_NETLOGON_INFO_1;
768
769         typedef struct {
770                 uint32 flags;
771                 uint32 pdc_connection_status;
772                 [string,charset(UTF16)] uint16 trusted_dc_name[];
773                 uint32 tc_connection_status;
774         } netr_NETLOGON_INFO_2;
775
776         typedef struct {
777                 uint32 flags;
778                 uint32 logon_attempts;
779                 uint32 unknown1;
780                 uint32 unknown2;
781                 uint32 unknown3;
782                 uint32 unknown4;
783                 uint32 unknown5;
784         } netr_NETLOGON_INFO_3;
785
786         typedef union {
787                 [case(1)]  netr_NETLOGON_INFO_1 *info1;
788                 [case(2)]  netr_NETLOGON_INFO_2 *info2;
789                 [case(3)]  netr_NETLOGON_INFO_3 *info3;
790         } netr_CONTROL_QUERY_INFORMATION;
791
792         /* function_code values */
793         typedef [v1_enum] enum {
794                 NETLOGON_CONTROL_REDISCOVER       = 5,
795                 NETLOGON_CONTROL_TC_QUERY         = 6,
796                 NETLOGON_CONTROL_TRANSPORT_NOTIFY = 7,
797                 NETLOGON_CONTROL_SET_DBFLAG       = 65534
798         } netr_LogonControlCode;
799
800         WERROR netr_LogonControl(
801                 [in]   [string,charset(UTF16)] uint16 *logon_server,
802                 [in]   netr_LogonControlCode function_code,
803                 [in]   uint32 level,
804                 [out,switch_is(level)]  netr_CONTROL_QUERY_INFORMATION info
805                 );
806
807
808         /*****************/
809         /* Function 0x0D */
810
811         WERROR netr_GetAnyDCName(
812                 [in]  [string,charset(UTF16)] uint16 *logon_server,
813                 [in]  [string,charset(UTF16)] uint16 *domainname,
814                 [out] [string,charset(UTF16)] uint16 *dcname
815                 );
816
817
818         /*****************/
819         /* Function 0x0E */
820
821         typedef union {
822                 [case(NETLOGON_CONTROL_REDISCOVER)]        [string,charset(UTF16)] uint16 *domain;
823                 [case(NETLOGON_CONTROL_TC_QUERY)]          [string,charset(UTF16)] uint16 *domain;
824                 [case(NETLOGON_CONTROL_TRANSPORT_NOTIFY)]  [string,charset(UTF16)] uint16 *domain;
825                 [case(NETLOGON_CONTROL_SET_DBFLAG)]        uint32 debug_level;
826         } netr_CONTROL_DATA_INFORMATION;
827
828         WERROR netr_LogonControl2(
829                 [in]    [string,charset(UTF16)] uint16 *logon_server,
830                 [in]    uint32 function_code,
831                 [in]    uint32 level,
832                 [in][switch_is(function_code)] netr_CONTROL_DATA_INFORMATION  data,
833                 [out][switch_is(level)]        netr_CONTROL_QUERY_INFORMATION query
834                 );
835
836
837         /* If this flag is not set, then the passwords and LM session keys are
838          * encrypted with DES calls.  (And the user session key is
839          * unencrypted) */ 
840         const int NETLOGON_NEG_ARCFOUR  = 0x00000004;
841         const int NETLOGON_NEG_128BIT   = 0x00004000;
842         const int NETLOGON_NEG_SCHANNEL = 0x40000000;
843
844         /*****************/
845         /* Function 0x0F */
846
847         NTSTATUS netr_ServerAuthenticate2(
848                 [in]         [string,charset(UTF16)] uint16 *server_name,
849                 [in]         [string,charset(UTF16)] uint16 account_name[],
850                 [in]         netr_SchannelType secure_channel_type,
851                 [in]         [string,charset(UTF16)] uint16 computer_name[],
852                 [in,out,ref] netr_Credential *credentials,
853                 [in,out,ref] uint32 *negotiate_flags
854                 );
855
856
857         /*****************/
858         /* Function 0x10 */
859
860         NTSTATUS netr_DatabaseSync2(
861                 [in]     [string,charset(UTF16)] uint16 logon_server[],
862                 [in]     [string,charset(UTF16)] uint16 computername[],
863                 [in]     netr_Authenticator credential,
864                 [in,out] netr_Authenticator return_authenticator,
865                 [in]     netr_SamDatabaseID database_id,
866                 [in]     uint16 restart_state,
867                 [in,out] uint32 sync_context,
868                 [in]     uint32 preferredmaximumlength,
869                 [out]    netr_DELTA_ENUM_ARRAY *delta_enum_array
870                 );
871
872
873         /*****************/
874         /* Function 0x11 */
875
876         /* i'm not at all sure how this call works */
877
878         NTSTATUS netr_DatabaseRedo(
879                 [in]     [string,charset(UTF16)] uint16 logon_server[],
880                 [in]     [string,charset(UTF16)] uint16 computername[],
881                 [in]     netr_Authenticator credential,
882                 [in,out] netr_Authenticator return_authenticator,
883                 [in][size_is(change_log_entry_size)] uint8 *change_log_entry,
884                 [in]     uint32 change_log_entry_size,
885                 [out]    netr_DELTA_ENUM_ARRAY *delta_enum_array
886                 );
887
888
889         /*****************/
890         /* Function 0x12 */
891
892         WERROR netr_LogonControl2Ex(
893                 [in]   [string,charset(UTF16)] uint16 *logon_server,
894                 [in]   uint32 function_code,
895                 [in]   uint32 level,
896                 [in][switch_is(function_code)] netr_CONTROL_DATA_INFORMATION  data,
897                 [out][switch_is(level)]        netr_CONTROL_QUERY_INFORMATION query
898                 );
899
900         /*****************/
901         /* Function 0x13 */
902         typedef struct {
903                 uint32 length;
904                 [size_is(length)] uint8 *data;
905         } netr_Blob;
906
907         WERROR netr_NetrEnumerateTrustedDomains(
908                 [in] [string,charset(UTF16)] uint16 *server_name,
909                 [out,ref] netr_Blob *trusted_domains_blob
910                 );
911
912         /*****************/
913         /* Function 0x14 */
914
915         /* two unkown bits still: DS_IP_VERSION_AGNOSTIC and
916          * DS_TRY_NEXTCLOSEST_SITE - Guenther */
917
918         typedef [bitmap32bit] bitmap {
919                 DS_FORCE_REDISCOVERY            = 0x00000001,
920                 DS_DIRECTORY_SERVICE_REQUIRED   = 0x00000010,
921                 DS_DIRECTORY_SERVICE_PREFERRED  = 0x00000020,
922                 DS_GC_SERVER_REQUIRED           = 0x00000040,
923                 DS_PDC_REQUIRED                 = 0x00000080,
924                 DS_BACKGROUND_ONLY              = 0x00000100,
925                 DS_IP_REQUIRED                  = 0x00000200,
926                 DS_KDC_REQUIRED                 = 0x00000400,
927                 DS_TIMESERV_REQUIRED            = 0x00000800,
928                 DS_WRITABLE_REQUIRED            = 0x00001000,
929                 DS_GOOD_TIMESERV_PREFERRED      = 0x00002000,
930                 DS_AVOID_SELF                   = 0x00004000,
931                 DS_ONLY_LDAP_NEEDED             = 0x00008000,
932                 DS_IS_FLAT_NAME                 = 0x00010000,
933                 DS_IS_DNS_NAME                  = 0x00020000,
934                 DS_RETURN_DNS_NAME              = 0x40000000,
935                 DS_RETURN_FLAT_NAME             = 0x80000000
936         } netr_DsRGetDCName_flags;
937
938         typedef [v1_enum] enum {
939                 DS_ADDRESS_TYPE_INET            = 1,
940                 DS_ADDRESS_TYPE_NETBIOS         = 2
941         } netr_DsRGetDCNameInfo_AddressType;
942
943         typedef [bitmap32bit] bitmap {
944                 DS_SERVER_PDC            = NBT_SERVER_PDC,
945                 DS_SERVER_GC             = NBT_SERVER_GC,
946                 DS_SERVER_LDAP           = NBT_SERVER_LDAP,
947                 DS_SERVER_DS             = NBT_SERVER_DS,
948                 DS_SERVER_KDC            = NBT_SERVER_KDC,
949                 DS_SERVER_TIMESERV       = NBT_SERVER_TIMESERV,
950                 DS_SERVER_CLOSEST        = NBT_SERVER_CLOSEST,
951                 DS_SERVER_WRITABLE       = NBT_SERVER_WRITABLE,
952                 DS_SERVER_GOOD_TIMESERV  = NBT_SERVER_GOOD_TIMESERV,
953                 DS_SERVER_NDNC           = 0x00000400,
954                 DS_DNS_CONTROLLER        = 0x20000000,
955                 DS_DNS_DOMAIN            = 0x40000000,
956                 DS_DNS_FOREST            = 0x80000000
957         } netr_DsR_DcFlags;
958
959         typedef struct {
960                 [string,charset(UTF16)] uint16 *dc_unc;
961                 [string,charset(UTF16)] uint16 *dc_address;
962                 netr_DsRGetDCNameInfo_AddressType dc_address_type;
963                 GUID domain_guid;
964                 [string,charset(UTF16)] uint16 *domain_name;
965                 [string,charset(UTF16)] uint16 *forest_name;
966                 netr_DsR_DcFlags dc_flags;
967                 [string,charset(UTF16)] uint16 *dc_site_name;
968                 [string,charset(UTF16)] uint16 *client_site_name;
969         } netr_DsRGetDCNameInfo;
970
971         WERROR netr_DsRGetDCName(
972                 [in] [string,charset(UTF16)] uint16 *server_unc,
973                 [in] [string,charset(UTF16)] uint16 *domain_name,
974                 [in] GUID *domain_guid,
975                 [in] GUID *site_guid,
976                 [in] netr_DsRGetDCName_flags flags,
977                 [out] netr_DsRGetDCNameInfo *info
978                 );
979
980         /*****************/
981         /* Function 0x15 */
982         WERROR netr_NETRLOGONDUMMYROUTINE1();
983
984         /****************/
985         /* Function 0x16 */
986         WERROR netr_NETRLOGONSETSERVICEBITS();
987
988         /****************/
989         /* Function 0x17 */
990         WERROR netr_NETRLOGONGETTRUSTRID();
991
992         /****************/
993         /* Function 0x18 */
994         WERROR netr_NETRLOGONCOMPUTESERVERDIGEST();
995
996         /****************/
997         /* Function 0x19 */
998         WERROR netr_NETRLOGONCOMPUTECLIENTDIGEST();
999
1000         /****************/
1001         /* Function 0x1a */
1002         [public] NTSTATUS netr_ServerAuthenticate3(
1003                 [in]         [string,charset(UTF16)] uint16 *server_name,
1004                 [in]         [string,charset(UTF16)] uint16 account_name[],
1005                 [in]         netr_SchannelType secure_channel_type,
1006                 [in]         [string,charset(UTF16)] uint16 computer_name[],
1007                 [in,out,ref] netr_Credential *credentials,
1008                 [in,out,ref] uint32 *negotiate_flags,
1009                 [out,ref]    uint32 *rid
1010                 );
1011
1012         /****************/
1013         /* Function 0x1b */
1014
1015         WERROR netr_DsRGetDCNameEx(
1016                 [in] [string,charset(UTF16)] uint16 *server_unc,
1017                 [in] [string,charset(UTF16)] uint16 *domain_name,
1018                 [in] GUID *domain_guid,
1019                 [in] [string,charset(UTF16)] uint16 *site_name,
1020                 [in] netr_DsRGetDCName_flags flags,
1021                 [out] netr_DsRGetDCNameInfo *info
1022                 );
1023
1024         /****************/
1025         /* Function 0x1c */
1026         WERROR netr_DsRGetSiteName(
1027                 [in] [string,charset(UTF16)] uint16 *computer_name,
1028                 [out] [string,charset(UTF16)] uint16 *site
1029                 );
1030
1031         /****************/
1032         /* Function 0x1d */
1033
1034         typedef [flag(NDR_PAHEX)] struct {
1035                 uint16 length;
1036                 uint16 size;
1037                 [size_is(size/2),length_is(length/2)] uint16 *data;
1038         } netr_BinaryString;
1039
1040         typedef struct {
1041                 netr_Blob blob;
1042                 [string,charset(UTF16)] uint16 *workstation_domain;
1043                 [string,charset(UTF16)] uint16 *workstation_site;
1044                 [string,charset(UTF16)] uint16 *unknown1;
1045                 [string,charset(UTF16)] uint16 *unknown2;
1046                 [string,charset(UTF16)] uint16 *unknown3;
1047                 [string,charset(UTF16)] uint16 *unknown4;
1048                 netr_BinaryString blob2;
1049                 lsa_String product;
1050                 lsa_String unknown5;
1051                 lsa_String unknown6;
1052                 uint32 unknown7[4];
1053         } netr_DomainQuery1;
1054
1055         typedef union {
1056                 [case(1)] netr_DomainQuery1 *query1;
1057                 [case(2)] netr_DomainQuery1 *query1;
1058         } netr_DomainQuery;
1059
1060         typedef struct {
1061                 lsa_String domainname;
1062                 lsa_String fulldomainname;
1063                 lsa_String forest;
1064                 GUID        guid;
1065                 dom_sid2    *sid;
1066                 netr_BinaryString unknown1[4];
1067                 uint32      unknown[4];
1068         } netr_DomainTrustInfo;
1069
1070         typedef struct {
1071                 netr_DomainTrustInfo domaininfo;
1072                 uint32 num_trusts;
1073                 [size_is(num_trusts)] netr_DomainTrustInfo *trusts;
1074                 uint32 unknown[14]; /* room for expansion? */
1075         } netr_DomainInfo1;
1076
1077         typedef union {
1078                 [case(1)] netr_DomainInfo1 *info1;
1079                 [case(2)] netr_DomainInfo1 *info1;
1080         } netr_DomainInfo;
1081         
1082         NTSTATUS netr_LogonGetDomainInfo(
1083                 [in]         [string,charset(UTF16)] uint16 server_name[],
1084                 [in]         [string,charset(UTF16)] uint16 *computer_name,
1085                 [in,ref]     netr_Authenticator *credential,
1086                 [in,out,ref] netr_Authenticator *return_authenticator,
1087                 [in]         uint32 level,
1088                 [in,switch_is(level)] netr_DomainQuery query,
1089                 [out,switch_is(level)] netr_DomainInfo info
1090                 );
1091
1092         typedef [flag(NDR_PAHEX)] struct {
1093                 uint8 data[512];
1094                 uint32 length;
1095         } netr_CryptPassword;
1096
1097         /*****************/
1098         /* Function 0x1e */
1099         NTSTATUS netr_ServerPasswordSet2(
1100                 [in]  [string,charset(UTF16)] uint16 *server_name,
1101                 [in]  [string,charset(UTF16)] uint16 account_name[],
1102                 [in]  netr_SchannelType secure_channel_type,
1103                 [in]  [string,charset(UTF16)] uint16 computer_name[],
1104                 [in]  netr_Authenticator credential,
1105                 [in]  netr_CryptPassword new_password,
1106                 [out] netr_Authenticator return_authenticator
1107                 );
1108
1109         /****************/
1110         /* Function 0x1f */
1111         WERROR netr_ServerPasswordGet(
1112                 [in]  [string,charset(UTF16)] uint16 *server_name,
1113                 [in]  [string,charset(UTF16)] uint16 account_name[],
1114                 [in]  netr_SchannelType secure_channel_type,
1115                 [in]  [string,charset(UTF16)] uint16 computer_name[],
1116                 [in,ref] netr_Authenticator *credential,
1117                 [out,ref] netr_Authenticator *return_authenticator,
1118                 [out,ref] samr_Password *password
1119                 );
1120
1121         /****************/
1122         /* Function 0x20 */
1123         WERROR netr_NETRLOGONSENDTOSAM();
1124
1125         /****************/
1126         /* Function 0x21 */
1127         typedef struct {
1128                 uint32 count;
1129                 [size_is(count)] lsa_String *sitename;
1130         } netr_DsRAddressToSitenamesWCtr;
1131
1132         typedef struct {
1133                 [size_is(size)] uint8 *buffer;
1134                 uint32 size;
1135         } netr_DsRAddress;
1136
1137         WERROR netr_DsRAddressToSitenamesW(
1138                 [in] [string,charset(UTF16)] uint16 *server_name,
1139                 [in] [range(0,32000)] uint32 count,
1140                 [in] [size_is(count)] [ref] netr_DsRAddress *addresses,
1141                 [out] [ref] netr_DsRAddressToSitenamesWCtr **ctr
1142                 );
1143
1144         /****************/
1145         /* Function 0x22 */
1146         WERROR netr_DsRGetDCNameEx2(
1147                 [in] [string,charset(UTF16)] uint16 *server_unc,
1148                 [in] [string,charset(UTF16)] uint16 *client_account,
1149                 [in] samr_AcctFlags mask,
1150                 [in] [string,charset(UTF16)] uint16 *domain_name,
1151                 [in] GUID *domain_guid,
1152                 [in] [string,charset(UTF16)] uint16 *site_name,
1153                 [in] netr_DsRGetDCName_flags flags,
1154                 [out] netr_DsRGetDCNameInfo *info
1155                 );
1156
1157         /****************/
1158         /* Function 0x23 */
1159         WERROR netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN();
1160
1161         /****************/
1162         /* Function 0x24 */
1163         typedef [bitmap32bit] bitmap {
1164                 NETR_TRUST_FLAG_IN_FOREST = 0x00000001,
1165                 NETR_TRUST_FLAG_OUTBOUND  = 0x00000002,
1166                 NETR_TRUST_FLAG_TREEROOT  = 0x00000004,
1167                 NETR_TRUST_FLAG_PRIMARY   = 0x00000008,
1168                 NETR_TRUST_FLAG_NATIVE    = 0x00000010,
1169                 NETR_TRUST_FLAG_INBOUND   = 0x00000020
1170         } netr_TrustFlags;
1171
1172         typedef [v1_enum] enum {
1173                 NETR_TRUST_TYPE_DOWNLEVEL       = 1,
1174                 NETR_TRUST_TYPE_UPLEVEL         = 2,
1175                 NETR_TRUST_TYPE_MIT             = 3,
1176                 NETR_TRUST_TYPE_DCE             = 4
1177         } netr_TrustType;
1178
1179         typedef [bitmap32bit] bitmap {
1180                 NETR_TRUST_ATTRIBUTE_NON_TRANSITIVE     = 0x00000001,
1181                 NETR_TRUST_ATTRIBUTE_UPLEVEL_ONLY       = 0x00000002,
1182                 NETR_TRUST_ATTRIBUTE_QUARANTINED_DOMAIN = 0x00000004,
1183                 NETR_TRUST_ATTRIBUTE_FOREST_TRANSITIVE  = 0x00000008,
1184                 NETR_TRUST_ATTRIBUTE_CROSS_ORGANIZATION = 0x00000010,
1185                 NETR_TRUST_ATTRIBUTE_WITHIN_FOREST      = 0x00000020,
1186                 NETR_TRUST_ATTRIBUTE_TREAT_AS_EXTERNAL  = 0x00000040
1187         } netr_TrustAttributes;
1188
1189         typedef struct {
1190                 [string,charset(UTF16)] uint16                  *netbios_name;
1191                 [string,charset(UTF16)] uint16                  *dns_name;
1192                 netr_TrustFlags         trust_flags;
1193                 uint32                  parent_index;
1194                 netr_TrustType          trust_type;
1195                 netr_TrustAttributes    trust_attributes;
1196                 dom_sid2                *sid;
1197                 GUID                    guid;
1198         } netr_DomainTrust;
1199
1200         typedef struct {
1201                 uint32 count;
1202                 [size_is(count)] netr_DomainTrust *array;
1203         } netr_DomainTrustList;
1204
1205         WERROR netr_NetrEnumerateTrustedDomainsEx(
1206                 [in] [string,charset(UTF16)] uint16 *server_name,
1207                 [out,ref] netr_DomainTrustList *dom_trust_list
1208         );
1209
1210         /****************/
1211         /* Function 0x25 */
1212         typedef struct {
1213                 uint32 count;
1214                 [size_is(count)] lsa_String *sitename;
1215                 [size_is(count)] lsa_String *subnetname;
1216         } netr_DsRAddressToSitenamesExWCtr;
1217
1218         WERROR netr_DsRAddressToSitenamesExW(
1219                 [in] [string,charset(UTF16)] uint16 *server_name,
1220                 [in] [range(0,32000)] uint32 count,
1221                 [in] [size_is(count)] [ref] netr_DsRAddress *addresses,
1222                 [out] [ref] netr_DsRAddressToSitenamesExWCtr **ctr
1223                 );
1224
1225         /****************/
1226         /* Function 0x26 */
1227
1228         typedef struct {
1229                 uint32 num_sites;
1230                 [size_is(num_sites)] [unique] lsa_String *sites;
1231         } DcSitesCtr;
1232
1233         WERROR netr_DsrGetDcSiteCoverageW(
1234                 [in] [string,charset(UTF16)] uint16 *server_name,
1235                 [out] DcSitesCtr *ctr
1236                 );
1237
1238         /****************/
1239         /* Function 0x27 */
1240         NTSTATUS netr_LogonSamLogonEx(
1241                 [in] [string,charset(UTF16)] uint16 *server_name,
1242                 [in] [string,charset(UTF16)] uint16 *computer_name,
1243                 [in]  uint16 logon_level,
1244                 [in]  [switch_is(logon_level)] netr_LogonLevel logon,
1245                 [in]  uint16 validation_level,
1246                 [out] [switch_is(validation_level)] netr_Validation validation,
1247                 [out] uint8 authoritative,
1248                 [in,out] uint32 flags
1249                 );
1250
1251         /****************/
1252         /* Function 0x28 */
1253
1254         WERROR netr_DsrEnumerateDomainTrusts(
1255                 [in]                 [string,charset(UTF16)] uint16           *server_name,
1256                 [in]                 netr_TrustFlags  trust_flags,
1257                 [out]                uint32           count,
1258                 [out,size_is(count)] netr_DomainTrust *trusts
1259                 );
1260
1261
1262         /****************/
1263         /* Function 0x29 */
1264         WERROR netr_DSRDEREGISTERDNSHOSTRECORDS();
1265
1266         /****************/
1267         /* Function 0x2a */
1268         NTSTATUS netr_ServerTrustPasswordsGet(
1269                 [in]  [string,charset(UTF16)] uint16 *server_name,
1270                 [in]  [string,charset(UTF16)] uint16 account_name[],
1271                 [in]  netr_SchannelType secure_channel_type,
1272                 [in]  [string,charset(UTF16)] uint16 computer_name[],
1273                 [in,ref] netr_Authenticator *credential,
1274                 [out,ref] netr_Authenticator *return_authenticator,
1275                 [out,ref] samr_Password *password,
1276                 [out,ref] samr_Password *password2
1277         );
1278
1279         /****************/
1280         /* Function 0x2b */
1281
1282         const int DS_GFTI_UPDATE_TDO = 0x1;
1283
1284         WERROR netr_DsRGetForestTrustInformation(
1285                 [in] [string,charset(UTF16)] uint16 *server_name,
1286                 [in] [string,charset(UTF16)] uint16 *trusted_domain_name,
1287                 [in] uint32 flags,
1288                 [out,ref] lsa_ForestTrustInformation **forest_trust_info
1289                 );
1290
1291         /****************/
1292         /* Function 0x2c */
1293         WERROR netr_GetForestTrustInformation(
1294                 [in] [string,charset(UTF16)] uint16 *server_name,
1295                 [in,ref] [string,charset(UTF16)] uint16 *trusted_domain_name,
1296                 [in,ref] netr_Authenticator *credential,
1297                 [out,ref] netr_Authenticator *return_authenticator,
1298                 [in] uint32 flags,
1299                 [out,ref] lsa_ForestTrustInformation **forest_trust_info
1300                 );
1301
1302         /****************/
1303         /* Function 0x2d */
1304
1305         /* this is the ADS varient. I don't yet know what the "flags" are for */
1306         NTSTATUS netr_LogonSamLogonWithFlags(
1307                 [in] [string,charset(UTF16)] uint16 *server_name,
1308                 [in] [string,charset(UTF16)] uint16 *computer_name,
1309                 [in] netr_Authenticator *credential,
1310                 [in][out] netr_Authenticator *return_authenticator,
1311                 [in]  uint16 logon_level,
1312                 [in]  [switch_is(logon_level)] netr_LogonLevel logon,
1313                 [in]  uint16 validation_level,
1314                 [out] [switch_is(validation_level)] netr_Validation validation,
1315                 [out] uint8 authoritative,
1316                 [in,out] uint32 flags
1317                 );
1318
1319         /****************/
1320         /* Function 0x2e */
1321         WERROR netr_NETRSERVERGETTRUSTINFO();
1322 }