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