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