96aab3a807d4cc9859b2442431fddc30e82de0fb
[ira/wip.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", "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   pointer_default_top(unique)
17 ]
18
19 interface netlogon
20 {
21         declare bitmap samr_AcctFlags;
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]   [string,charset(UTF16)] uint16 *server_name,
47                 [in]   [string,charset(UTF16)] uint16 account_name[],
48                 [in]   [string,charset(UTF16)] uint16 workstation[],
49                 [out]  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] [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         const int MSV1_0_CLEARTEXT_PASSWORD_ALLOWED = 0x002;
90         const int MSV1_0_ALLOW_SERVER_TRUST_ACCOUNT = 0x020;
91         const int MSV1_0_ALLOW_WORKSTATION_TRUST_ACCOUNT = 0x800;
92
93         typedef struct {
94                 lsa_String  domain_name;
95                 uint32      parameter_control; /* see MSV1_0_* */
96                 uint32      logon_id_low;
97                 uint32      logon_id_high;
98                 lsa_String  account_name;
99                 lsa_String  workstation;
100         } netr_IdentityInfo;
101
102         typedef struct {
103                 netr_IdentityInfo identity_info;
104                 samr_Password lmpassword;
105                 samr_Password ntpassword;
106         } netr_PasswordInfo;
107
108         typedef [flag(NDR_PAHEX)] struct {
109                 uint16 length;
110                 [value(length)] uint16 size;
111                 [size_is(length),length_is(length)] uint8 *data;
112         } netr_ChallengeResponse;
113
114         typedef [flag(NDR_PAHEX)] struct {
115                 netr_IdentityInfo identity_info;
116                 uint8 challenge[8];
117                 netr_ChallengeResponse nt;
118                 netr_ChallengeResponse lm;
119         } netr_NetworkInfo;
120
121         typedef [public,switch_type(uint16)] union {
122                 [case(1)] netr_PasswordInfo *password;
123                 [case(2)] netr_NetworkInfo  *network;
124                 [case(3)] netr_PasswordInfo *password;
125                 [case(5)] netr_PasswordInfo *password;
126                 [case(6)] netr_NetworkInfo  *network;
127         } netr_LogonLevel;
128
129         typedef [public] struct {
130                 uint32 rid;
131                 uint32 attributes;
132         } netr_GroupMembership;
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                 uint32 attribute;
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] [string,charset(UTF16)] uint16 *server_name,
243                 [in] [string,charset(UTF16)] uint16 *computer_name,
244                 [in] netr_Authenticator *credential,
245                 [in][out] 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] [string,charset(UTF16)] uint16 *server_name,
259                 [in] [string,charset(UTF16)] uint16 *computer_name,
260                 [in]      netr_Authenticator *credential,
261                 [in][out] 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,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         declare enum netr_SchannelType;
282
283         NTSTATUS netr_ServerAuthenticate(
284                 [in,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]  [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         declare enum 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 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]     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]    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]     [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]      [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]  [string,charset(UTF16)] uint16 *domainname,
762                 [out] [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]   [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]  [string,charset(UTF16)] uint16 *logon_server,
817                 [in]  [string,charset(UTF16)] uint16 *domainname,
818                 [out] [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]    [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]         [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]    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][size_is(change_log_entry_size)] uint8 *change_log_entry,
888                 [in]     uint32 change_log_entry_size,
889                 [out]    netr_DELTA_ENUM_ARRAY *delta_enum_array
890                 );
891
892
893         /*****************/
894         /* Function 0x12 */
895
896         WERROR netr_LogonControl2Ex(
897                 [in]   [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] [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] [string,charset(UTF16)] uint16 *server_unc,
977                 [in] [string,charset(UTF16)] uint16 *domain_name,
978                 [in] GUID *domain_guid,
979                 [in] GUID *site_guid,
980                 [in] netr_DsRGetDCName_flags flags,
981                 [out] netr_DsRGetDCNameInfo *info
982                 );
983
984         /*****************/
985         /* Function 0x15 */
986         WERROR netr_NETRLOGONDUMMYROUTINE1();
987
988         /****************/
989         /* Function 0x16 */
990         WERROR netr_NETRLOGONSETSERVICEBITS();
991
992         /****************/
993         /* Function 0x17 */
994         WERROR netr_NETRLOGONGETTRUSTRID();
995
996         /****************/
997         /* Function 0x18 */
998         WERROR netr_NETRLOGONCOMPUTESERVERDIGEST();
999
1000         /****************/
1001         /* Function 0x19 */
1002         WERROR netr_NETRLOGONCOMPUTECLIENTDIGEST();
1003
1004         /****************/
1005         /* Function 0x1a */
1006         [public] NTSTATUS netr_ServerAuthenticate3(
1007                 [in]         [string,charset(UTF16)] uint16 *server_name,
1008                 [in]         [string,charset(UTF16)] uint16 account_name[],
1009                 [in]         netr_SchannelType secure_channel_type,
1010                 [in]         [string,charset(UTF16)] uint16 computer_name[],
1011                 [in,out,ref] netr_Credential *credentials,
1012                 [in,out,ref] uint32 *negotiate_flags,
1013                 [out,ref]    uint32 *rid
1014                 );
1015
1016         /****************/
1017         /* Function 0x1b */
1018
1019         WERROR netr_DsRGetDCNameEx(
1020                 [in] [string,charset(UTF16)] uint16 *server_unc,
1021                 [in] [string,charset(UTF16)] uint16 *domain_name,
1022                 [in] GUID *domain_guid,
1023                 [in] [string,charset(UTF16)] uint16 *site_name,
1024                 [in] netr_DsRGetDCName_flags flags,
1025                 [out] netr_DsRGetDCNameInfo *info
1026                 );
1027
1028         /****************/
1029         /* Function 0x1c */
1030         WERROR netr_DsRGetSiteName(
1031                 [in] [string,charset(UTF16)] uint16 *computer_name,
1032                 [out] [string,charset(UTF16)] uint16 *site
1033                 );
1034
1035         /****************/
1036         /* Function 0x1d */
1037
1038         typedef [flag(NDR_PAHEX)] struct {
1039                 uint16 length;
1040                 uint16 size;
1041                 [size_is(size/2),length_is(length/2)] uint16 *data;
1042         } netr_BinaryString;
1043
1044         typedef struct {
1045                 netr_Blob blob;
1046                 [string,charset(UTF16)] uint16 *workstation_domain;
1047                 [string,charset(UTF16)] uint16 *workstation_site;
1048                 [string,charset(UTF16)] uint16 *unknown1;
1049                 [string,charset(UTF16)] uint16 *unknown2;
1050                 [string,charset(UTF16)] uint16 *unknown3;
1051                 [string,charset(UTF16)] uint16 *unknown4;
1052                 netr_BinaryString blob2;
1053                 lsa_String product;
1054                 lsa_String unknown5;
1055                 lsa_String unknown6;
1056                 uint32 unknown7[4];
1057         } netr_DomainQuery1;
1058
1059         typedef union {
1060                 [case(1)] netr_DomainQuery1 *query1;
1061                 [case(2)] netr_DomainQuery1 *query1;
1062         } netr_DomainQuery;
1063
1064         typedef struct {
1065                 lsa_String domainname;
1066                 lsa_String fulldomainname;
1067                 lsa_String forest;
1068                 GUID        guid;
1069                 dom_sid2    *sid;
1070                 netr_BinaryString unknown1[4];
1071                 uint32      unknown[4];
1072         } netr_DomainTrustInfo;
1073
1074         typedef struct {
1075                 netr_DomainTrustInfo domaininfo;
1076                 uint32 num_trusts;
1077                 [size_is(num_trusts)] netr_DomainTrustInfo *trusts;
1078                 uint32 unknown[14]; /* room for expansion? */
1079         } netr_DomainInfo1;
1080
1081         typedef union {
1082                 [case(1)] netr_DomainInfo1 *info1;
1083                 [case(2)] netr_DomainInfo1 *info1;
1084         } netr_DomainInfo;
1085         
1086         NTSTATUS netr_LogonGetDomainInfo(
1087                 [in]         [string,charset(UTF16)] uint16 server_name[],
1088                 [in]         [string,charset(UTF16)] uint16 *computer_name,
1089                 [in,ref]     netr_Authenticator *credential,
1090                 [in,out,ref] netr_Authenticator *return_authenticator,
1091                 [in]         uint32 level,
1092                 [in,switch_is(level)] netr_DomainQuery query,
1093                 [out,switch_is(level)] netr_DomainInfo info
1094                 );
1095
1096         typedef [flag(NDR_PAHEX)] struct {
1097                 uint8 data[512];
1098                 uint32 length;
1099         } netr_CryptPassword;
1100
1101         /*****************/
1102         /* Function 0x1e */
1103         NTSTATUS netr_ServerPasswordSet2(
1104                 [in]  [string,charset(UTF16)] uint16 *server_name,
1105                 [in]  [string,charset(UTF16)] uint16 account_name[],
1106                 [in]  netr_SchannelType secure_channel_type,
1107                 [in]  [string,charset(UTF16)] uint16 computer_name[],
1108                 [in]  netr_Authenticator credential,
1109                 [in]  netr_CryptPassword new_password,
1110                 [out] netr_Authenticator return_authenticator
1111                 );
1112
1113         /****************/
1114         /* Function 0x1f */
1115         WERROR netr_ServerPasswordGet(
1116                 [in]  [string,charset(UTF16)] uint16 *server_name,
1117                 [in]  [string,charset(UTF16)] uint16 account_name[],
1118                 [in]  netr_SchannelType secure_channel_type,
1119                 [in]  [string,charset(UTF16)] uint16 computer_name[],
1120                 [in,ref] netr_Authenticator *credential,
1121                 [out,ref] netr_Authenticator *return_authenticator,
1122                 [out,ref] samr_Password *password
1123                 );
1124
1125         /****************/
1126         /* Function 0x20 */
1127         WERROR netr_NETRLOGONSENDTOSAM();
1128
1129         /****************/
1130         /* Function 0x21 */
1131         typedef struct {
1132                 uint32 count;
1133                 [size_is(count)] lsa_String *sitename;
1134         } netr_DsRAddressToSitenamesWCtr;
1135
1136         typedef struct {
1137                 [size_is(size)] uint8 *buffer;
1138                 uint32 size;
1139         } netr_DsRAddress;
1140
1141         WERROR netr_DsRAddressToSitenamesW(
1142                 [in] [string,charset(UTF16)] uint16 *server_name,
1143                 [in] [range(0,32000)] uint32 count,
1144                 [in] [size_is(count)] [ref] netr_DsRAddress *addresses,
1145                 [out] [ref] netr_DsRAddressToSitenamesWCtr **ctr
1146                 );
1147
1148         /****************/
1149         /* Function 0x22 */
1150         WERROR netr_DsRGetDCNameEx2(
1151                 [in] [string,charset(UTF16)] uint16 *server_unc,
1152                 [in] [string,charset(UTF16)] uint16 *client_account,
1153                 [in] samr_AcctFlags mask,
1154                 [in] [string,charset(UTF16)] uint16 *domain_name,
1155                 [in] GUID *domain_guid,
1156                 [in] [string,charset(UTF16)] uint16 *site_name,
1157                 [in] netr_DsRGetDCName_flags flags,
1158                 [out] netr_DsRGetDCNameInfo *info
1159                 );
1160
1161         /****************/
1162         /* Function 0x23 */
1163         WERROR netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN();
1164
1165         /****************/
1166         /* Function 0x24 */
1167         typedef [bitmap32bit] bitmap {
1168                 NETR_TRUST_FLAG_IN_FOREST = 0x00000001,
1169                 NETR_TRUST_FLAG_OUTBOUND  = 0x00000002,
1170                 NETR_TRUST_FLAG_TREEROOT  = 0x00000004,
1171                 NETR_TRUST_FLAG_PRIMARY   = 0x00000008,
1172                 NETR_TRUST_FLAG_NATIVE    = 0x00000010,
1173                 NETR_TRUST_FLAG_INBOUND   = 0x00000020
1174         } netr_TrustFlags;
1175
1176         typedef [v1_enum] enum {
1177                 NETR_TRUST_TYPE_DOWNLEVEL       = 1,
1178                 NETR_TRUST_TYPE_UPLEVEL         = 2,
1179                 NETR_TRUST_TYPE_MIT             = 3,
1180                 NETR_TRUST_TYPE_DCE             = 4
1181         } netr_TrustType;
1182
1183         typedef [bitmap32bit] bitmap {
1184                 NETR_TRUST_ATTRIBUTE_NON_TRANSITIVE     = 0x00000001,
1185                 NETR_TRUST_ATTRIBUTE_UPLEVEL_ONLY       = 0x00000002,
1186                 NETR_TRUST_ATTRIBUTE_QUARANTINED_DOMAIN = 0x00000004,
1187                 NETR_TRUST_ATTRIBUTE_FOREST_TRANSITIVE  = 0x00000008,
1188                 NETR_TRUST_ATTRIBUTE_CROSS_ORGANIZATION = 0x00000010,
1189                 NETR_TRUST_ATTRIBUTE_WITHIN_FOREST      = 0x00000020,
1190                 NETR_TRUST_ATTRIBUTE_TREAT_AS_EXTERNAL  = 0x00000040
1191         } netr_TrustAttributes;
1192
1193         typedef struct {
1194                 [string,charset(UTF16)] uint16                  *netbios_name;
1195                 [string,charset(UTF16)] uint16                  *dns_name;
1196                 netr_TrustFlags         trust_flags;
1197                 uint32                  parent_index;
1198                 netr_TrustType          trust_type;
1199                 netr_TrustAttributes    trust_attributes;
1200                 dom_sid2                *sid;
1201                 GUID                    guid;
1202         } netr_DomainTrust;
1203
1204         typedef struct {
1205                 uint32 count;
1206                 [size_is(count)] netr_DomainTrust *array;
1207         } netr_DomainTrustList;
1208
1209         WERROR netr_NetrEnumerateTrustedDomainsEx(
1210                 [in] [string,charset(UTF16)] uint16 *server_name,
1211                 [out,ref] netr_DomainTrustList *dom_trust_list
1212         );
1213
1214         /****************/
1215         /* Function 0x25 */
1216         typedef struct {
1217                 uint32 count;
1218                 [size_is(count)] lsa_String *sitename;
1219                 [size_is(count)] lsa_String *subnetname;
1220         } netr_DsRAddressToSitenamesExWCtr;
1221
1222         WERROR netr_DsRAddressToSitenamesExW(
1223                 [in] [string,charset(UTF16)] uint16 *server_name,
1224                 [in] [range(0,32000)] uint32 count,
1225                 [in] [size_is(count)] [ref] netr_DsRAddress *addresses,
1226                 [out] [ref] netr_DsRAddressToSitenamesExWCtr **ctr
1227                 );
1228
1229         /****************/
1230         /* Function 0x26 */
1231
1232         typedef struct {
1233                 uint32 num_sites;
1234                 [size_is(num_sites)] [unique] lsa_String *sites;
1235         } DcSitesCtr;
1236
1237         WERROR netr_DsrGetDcSiteCoverageW(
1238                 [in] [string,charset(UTF16)] uint16 *server_name,
1239                 [out] DcSitesCtr *ctr
1240                 );
1241
1242         /****************/
1243         /* Function 0x27 */
1244         NTSTATUS netr_LogonSamLogonEx(
1245                 [in] [string,charset(UTF16)] uint16 *server_name,
1246                 [in] [string,charset(UTF16)] uint16 *computer_name,
1247                 [in]  uint16 logon_level,
1248                 [in]  [switch_is(logon_level)] netr_LogonLevel logon,
1249                 [in]  uint16 validation_level,
1250                 [out] [switch_is(validation_level)] netr_Validation validation,
1251                 [out] uint8 authoritative,
1252                 [in,out] uint32 flags
1253                 );
1254
1255         /****************/
1256         /* Function 0x28 */
1257
1258         WERROR netr_DsrEnumerateDomainTrusts(
1259                 [in]                 [string,charset(UTF16)] uint16           *server_name,
1260                 [in]                 netr_TrustFlags  trust_flags,
1261                 [out]                uint32           count,
1262                 [out,size_is(count)] netr_DomainTrust *trusts
1263                 );
1264
1265
1266         /****************/
1267         /* Function 0x29 */
1268         WERROR netr_DSRDEREGISTERDNSHOSTRECORDS();
1269
1270         /****************/
1271         /* Function 0x2a */
1272         NTSTATUS netr_ServerTrustPasswordsGet(
1273                 [in]  [string,charset(UTF16)] uint16 *server_name,
1274                 [in]  [string,charset(UTF16)] uint16 account_name[],
1275                 [in]  netr_SchannelType secure_channel_type,
1276                 [in]  [string,charset(UTF16)] uint16 computer_name[],
1277                 [in,ref] netr_Authenticator *credential,
1278                 [out,ref] netr_Authenticator *return_authenticator,
1279                 [out,ref] samr_Password *password,
1280                 [out,ref] samr_Password *password2
1281         );
1282
1283         /****************/
1284         /* Function 0x2b */
1285
1286         const int DS_GFTI_UPDATE_TDO = 0x1;
1287
1288         WERROR netr_DsRGetForestTrustInformation(
1289                 [in] [string,charset(UTF16)] uint16 *server_name,
1290                 [in] [string,charset(UTF16)] uint16 *trusted_domain_name,
1291                 [in] uint32 flags,
1292                 [out,ref] lsa_ForestTrustInformation **forest_trust_info
1293                 );
1294
1295         /****************/
1296         /* Function 0x2c */
1297         WERROR netr_GetForestTrustInformation(
1298                 [in] [string,charset(UTF16)] uint16 *server_name,
1299                 [in,ref] [string,charset(UTF16)] uint16 *trusted_domain_name,
1300                 [in,ref] netr_Authenticator *credential,
1301                 [out,ref] netr_Authenticator *return_authenticator,
1302                 [in] uint32 flags,
1303                 [out,ref] lsa_ForestTrustInformation **forest_trust_info
1304                 );
1305
1306         /****************/
1307         /* Function 0x2d */
1308
1309         /* this is the ADS varient. I don't yet know what the "flags" are for */
1310         NTSTATUS netr_LogonSamLogonWithFlags(
1311                 [in] [string,charset(UTF16)] uint16 *server_name,
1312                 [in] [string,charset(UTF16)] uint16 *computer_name,
1313                 [in] netr_Authenticator *credential,
1314                 [in][out] netr_Authenticator *return_authenticator,
1315                 [in]  uint16 logon_level,
1316                 [in]  [switch_is(logon_level)] netr_LogonLevel logon,
1317                 [in]  uint16 validation_level,
1318                 [out] [switch_is(validation_level)] netr_Validation validation,
1319                 [out] uint8 authoritative,
1320                 [in,out] uint32 flags
1321                 );
1322
1323         /****************/
1324         /* Function 0x2e */
1325         WERROR netr_NETRSERVERGETTRUSTINFO();
1326 }