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