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