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