r469: considerably improved the ChangePasswordUser3() IDL thanks to an idea from...
[samba.git] / source / librpc / idl / samr.idl
1 #include "idl_types.h"
2
3 /*
4   samr interface definition
5 */
6
7 /*
8   Thanks to Todd Sabin for some information from his samr.idl in acltools
9 */
10
11 [ uuid(12345778-1234-abcd-ef00-0123456789ac),
12   version(1.0),
13   pointer_default(unique)
14 ] interface samr
15 {
16         /******************/
17         /* Function: 0x00 */
18         NTSTATUS samr_Connect (
19                 /* notice the lack of [string] */
20                 [in]       uint16 *system_name,
21                 [in]       uint32 access_mask,
22                 [out,ref]  policy_handle *handle
23                 );
24
25
26         /******************/
27         /* Function: 0x01 */
28         NTSTATUS samr_Close (
29                 [in,out,ref]  policy_handle *handle
30                 );
31
32         /******************/
33         /* Function: 0x02 */
34
35         typedef struct {
36                 [value(ndr_size_security_descriptor(r->sd))] uint32 sd_size;
37                 [subcontext(4)] security_descriptor *sd;
38         } samr_SdBuf;
39
40         NTSTATUS samr_SetSecurity (
41                 [in,ref]          policy_handle *handle,
42                 [in]              uint32 sec_info,
43                 [in,ref]          samr_SdBuf *sdbuf
44                 );
45
46         /******************/
47         /* Function: 0x03 */
48
49         NTSTATUS samr_QuerySecurity (
50                 [in,ref]          policy_handle *handle,
51                 [in]              uint32 sec_info,
52                 [out]             samr_SdBuf *sdbuf
53                 );
54
55         /******************/
56         /* Function: 0x04 */
57
58         /*
59           shutdown the SAM - once you call this the SAM will be dead
60         */
61         NTSTATUS samr_Shutdown (
62                 [in,ref]   policy_handle *handle
63                 );
64
65         /******************/
66         /* Function: 0x05 */
67         typedef struct {
68                 [value(2*strlen_m(r->name))] uint16 name_len;
69                 [value(r->name_len)] uint16 name_size;
70                 unistr_noterm *name;
71         } samr_Name;    
72
73         NTSTATUS samr_LookupDomain (
74                 [in,ref]  policy_handle *handle,                
75                 [in,ref]  samr_Name *domain,
76                 [out]     dom_sid2 *sid
77                 );
78
79
80         /******************/
81         /* Function: 0x06 */
82
83         typedef struct {
84                 uint32 idx;
85                 samr_Name name;
86         } samr_SamEntry;
87
88         typedef struct {
89                 uint32 count;
90                 [size_is(count)] samr_SamEntry *entries;
91         } samr_SamArray;
92
93         NTSTATUS samr_EnumDomains (
94                 [in,ref]      policy_handle *handle,
95                 [in,out,ref]  uint32 *resume_handle,
96                 [in]          uint32 buf_size,
97                 [out]         samr_SamArray *sam,
98                 [out]         uint32 num_entries
99                 );
100
101
102         /************************/
103         /* Function    0x07     */
104         NTSTATUS samr_OpenDomain(
105                 [in,ref]      policy_handle *handle,
106                 [in]          uint32 access_mask,
107                 [in,ref]      dom_sid2 *sid,
108                 [out,ref]     policy_handle *domain_handle
109                 );
110
111         /************************/
112         /* Function    0x08     */
113
114         typedef struct {
115                 uint16 min_pwd_len;
116                 uint16 password_history;
117                 uint32 password_properties;
118                 ULONG8 max_password_age;
119                 ULONG8 min_password_age;
120         } samr_DomInfo1;
121
122         typedef struct {
123                 ULONG8 force_logoff_time;
124                 samr_Name comment;
125                 samr_Name domain;  /* domain name */
126                 samr_Name primary; /* PDC name if this is a BDC */
127                 HYPER_T sequence_num;
128                 uint32 unknown2;
129                 uint32 role;
130                 uint32 unknown3;
131                 uint32 num_users;
132                 uint32 num_groups;
133                 uint32 num_aliases;
134         } samr_DomInfo2;
135
136         typedef struct {
137                 ULONG8 force_logoff_time;
138         } samr_DomInfo3;
139
140         typedef struct {
141                 /* I'm not entirely sure this is a comment. win2003
142                    allows it to be set, and it seems harmless (like a
143                    comment) but I haven't seen it show up anywhere */
144                 samr_Name comment;
145         } samr_DomInfo4;
146
147         typedef struct {
148                 samr_Name domain;
149         } samr_DomInfo5;
150
151         typedef struct {
152                 samr_Name primary;
153         } samr_DomInfo6;
154
155         typedef struct {
156                 uint32 role;
157         } samr_DomInfo7;
158
159         typedef struct {
160                 HYPER_T sequence_num;
161                 NTTIME last_xxx_time;
162         } samr_DomInfo8;
163
164         typedef struct {
165                 uint32 unknown; /* w2k3 returns 1 */
166         } samr_DomInfo9;
167
168         typedef struct {
169                 ULONG8 force_logoff_time;
170                 samr_Name comment;
171                 samr_Name domain;
172                 samr_Name primary;
173                 HYPER_T sequence_num;
174                 uint32 unknown2;  /* w2k3 returns 1 */
175                 uint32 role;
176                 uint32 unknown3;  /* w2k3 returns 1 */
177                 uint32 num_users;
178                 uint32 num_groups;
179                 uint32 num_aliases;
180                 HYPER_T lockout_duration;
181                 HYPER_T lockout_window;
182                 uint16 lockout_threshold;
183         } samr_DomInfo11;
184
185         typedef struct {
186                 HYPER_T lockout_duration;
187                 HYPER_T lockout_window;
188                 uint16 lockout_threshold;
189         } samr_DomInfo12;
190
191         typedef struct {
192                 HYPER_T sequence_num;
193                 NTTIME last_xxx_time;
194                 uint32 unknown1;
195                 uint32 unknown2;
196         } samr_DomInfo13;
197
198         typedef union {
199                 [case(1)] samr_DomInfo1 info1;
200                 [case(2)] samr_DomInfo2 info2;
201                 [case(3)] samr_DomInfo3 info3;
202                 [case(4)] samr_DomInfo4 info4;
203                 [case(5)] samr_DomInfo5 info5;
204                 [case(6)] samr_DomInfo6 info6;
205                 [case(7)] samr_DomInfo7 info7;
206                 [case(8)] samr_DomInfo8 info8;
207                 [case(9)] samr_DomInfo9 info9;
208                 [case(11)] samr_DomInfo11 info11;
209                 [case(12)] samr_DomInfo12 info12;
210                 [case(13)] samr_DomInfo13 info13;
211         } samr_DomainInfo;
212
213         NTSTATUS samr_QueryDomainInfo(
214                 [in,ref]      policy_handle *handle,
215                 [in]          uint16 level,
216                 [out,switch_is(level)] samr_DomainInfo *info
217                 );
218
219         /************************/
220         /* Function    0x09     */
221         /*
222           only levels 1, 3, 4, 6, 7, 9, 12 are valid for this 
223           call in w2k3
224         */
225         NTSTATUS samr_SetDomainInfo(
226                 [in,ref]      policy_handle *handle,
227                 [in]          uint16 level,
228                 [in,switch_is(level),ref] samr_DomainInfo *info
229                 );
230
231
232         /************************/
233         /* Function    0x0a     */
234         NTSTATUS samr_CreateDomainGroup(
235                 [in,ref]      policy_handle *handle,
236                 [in,ref]      samr_Name *name,
237                 [in]          uint32 access_mask,
238                 [out,ref]     policy_handle *group_handle,
239                 [out,ref]     uint32 *rid
240                 );
241                 
242
243         /************************/
244         /* Function    0x0b     */
245         NTSTATUS samr_EnumDomainGroups(
246                 [in,ref]      policy_handle *handle,
247                 [in,out,ref]  uint32 *resume_handle,
248                 [in]          uint32 max_size,
249                 [out]         samr_SamArray *sam,
250                 [out]         uint32 num_entries
251                 );
252
253         /************************/
254         /* Function    0x0c     */
255         NTSTATUS samr_CreateUser(
256                 [in,ref]      policy_handle *handle,
257                 [in,ref]      samr_Name *username,
258                 [in]          uint32 access_mask,
259                 [out,ref]     policy_handle *acct_handle,
260                 [out,ref]     uint32 *rid
261                 );
262
263         /************************/
264         /* Function    0x0d     */
265         NTSTATUS samr_EnumDomainUsers(
266                 [in,ref]      policy_handle *handle,
267                 [in,out,ref]  uint32 *resume_handle,
268                 [in]          uint32 acct_flags,
269                 [in]          uint32 max_size,
270                 [out]         samr_SamArray *sam,
271                 [out]         uint32 num_entries
272                 );
273
274         /************************/
275         /* Function    0x0e     */
276         NTSTATUS samr_CreateDomAlias(
277                 [in,ref]      policy_handle *handle,
278                 [in,ref]      samr_Name     *aliasname,
279                 [in]          uint32         access_mask,
280                 [out,ref]     policy_handle *acct_handle,
281                 [out,ref]     uint32        *rid
282                 );
283
284         /************************/
285         /* Function    0x0f     */
286         NTSTATUS samr_EnumDomainAliases(
287                 [in,ref]      policy_handle *handle,
288                 [in,out,ref]  uint32 *resume_handle,
289                 [in]          uint32 max_size,
290                 [out]         samr_SamArray *sam,
291                 [out]         uint32 num_entries
292                 );
293
294         /************************/
295         /* Function    0x10     */
296
297         typedef struct {
298                 uint32 count;
299                 [size_is(count)] uint32 *ids;
300         } samr_Ids;
301
302         NTSTATUS samr_GetAliasMembership(
303                 [in,ref]      policy_handle *handle,
304                 [in,ref]      lsa_SidArray  *sids,
305                 [out]         samr_Ids *rids
306                 );
307
308         /************************/
309         /* Function    0x11     */
310
311         NTSTATUS samr_LookupNames(
312                 [in,ref]      policy_handle *handle,
313                 [in]          uint32 num_names,
314                 [in,ref,size_is(1000),length_is(num_names)] samr_Name *names,
315                 [out]         samr_Ids rids,
316                 [out]         samr_Ids types
317                 );
318
319
320         /************************/
321         /* Function    0x12     */
322
323         typedef struct {
324                 uint32 count;
325                 [size_is(count)] samr_Name *names;
326         } samr_Names;
327
328         NTSTATUS samr_LookupRids(
329                 [in,ref]      policy_handle *handle,
330                 [in]          uint32 num_rids,
331                 [in,ref,size_is(1000),length_is(num_rids)] uint32 *rids,
332                 [out]         samr_Names names,
333                 [out]         samr_Ids types
334                 );
335
336         /************************/
337         /* Function    0x13     */
338         NTSTATUS samr_OpenGroup(
339                 [in,ref]      policy_handle *handle,
340                 [in]          uint32 access_mask,
341                 [in]          uint32 rid,
342                 [out,ref]     policy_handle *acct_handle
343                 );
344
345
346         /************************/
347         /* Function    0x14     */
348
349         typedef struct {
350                 samr_Name name;
351                 uint32 unknown;
352                 uint32 num_members;
353                 samr_Name description;
354         } samr_GroupInfoAll;
355
356         typedef struct {
357                 uint32 unknown;
358         } samr_GroupInfoX;
359
360         typedef struct {
361                 samr_Name description;
362         } samr_GroupInfoDesciption;
363
364         typedef enum {
365                 GroupInfoAll = 1,
366                 GroupInfoName,
367                 GroupInfoX,
368                 GroupInfoDescription
369         } GroupInfo;
370
371         typedef union {
372                 [case(GroupInfoAll)]         samr_GroupInfoAll    all;
373                 [case(GroupInfoName)]        samr_Name            name;
374                 [case(GroupInfoX)]           samr_GroupInfoX      unknown;
375                 [case(GroupInfoDescription)] samr_Name            description;
376         } samr_GroupInfo;
377
378         NTSTATUS samr_QueryGroupInfo(
379                 [in,ref]                  policy_handle *handle,
380                 [in]                      uint16 level,
381                 [out,switch_is(level)]    samr_GroupInfo *info
382                 );
383
384         /************************/
385         /* Function    0x15     */
386         NTSTATUS samr_SetGroupInfo(
387                 [in,ref]                  policy_handle *handle,
388                 [in]                      uint16 level,
389                 [in,switch_is(level),ref] samr_GroupInfo *info
390                 );
391
392         /************************/
393         /* Function    0x16     */
394         NTSTATUS samr_AddGroupMember(
395                 [in,ref]                  policy_handle *handle,
396                 [in]                      uint32 rid,
397                 [in]                      uint32 flags
398                 );
399
400         /************************/
401         /* Function    0x17     */
402         NTSTATUS samr_DeleteDomainGroup(
403                 [in,out,ref]   policy_handle *handle
404                 );
405
406         /************************/
407         /* Function    0x18     */
408         NTSTATUS samr_DeleteGroupMember(
409                 [in,ref]                  policy_handle *handle,
410                 [in]                      uint32 rid
411                 );
412
413
414         /************************/
415         /* Function    0x19     */
416         /*
417           this isn't really valid IDL, but it does work. I suspect
418           I need to do some more pidl work to get this really right
419         */
420         typedef struct {
421                 uint32 count;
422                 uint32 v[count];
423         } samr_intArray;
424
425         typedef struct {
426                 samr_intArray *rids;
427                 samr_intArray *unknown7;
428         } samr_ridArray;
429
430         NTSTATUS samr_QueryGroupMember(
431                 [in,ref]  policy_handle *handle,
432                 [out]     uint32 *count,
433                 [out]     samr_ridArray rids
434                 );
435
436
437         /************************/
438         /* Function    0x1a     */
439
440         /*
441           win2003 seems to accept any data at all for the two integers
442           below, and doesn't seem to do anything with them that I can
443           see. Weird. I really expected the first integer to be a rid
444           and the second to be the attributes for that rid member.
445         */
446         NTSTATUS samr_SetMemberAttributesOfGroup(
447                 [in,ref]  policy_handle *handle,
448                 [in]      uint32 unknown1,
449                 [in]      uint32 unknown2
450                 );
451
452
453         /************************/
454         /* Function    0x1b     */
455         NTSTATUS samr_OpenAlias (
456                 [in,ref]      policy_handle *handle,
457                 [in]          uint32 access_mask,
458                 [in]          uint32 rid,
459                 [out,ref]     policy_handle *acct_handle
460                 );
461
462
463         /************************/
464         /* Function    0x1c     */
465
466         typedef struct {
467                 samr_Name name;
468                 uint32 num_members;
469                 samr_Name description;
470         } samr_AliasInfoAll;
471
472         typedef union {
473                 [case(1)] samr_AliasInfoAll all;
474                 [case(2)] samr_Name name;
475                 [case(3)] samr_Name description;
476         } samr_AliasInfo;
477
478         NTSTATUS samr_QueryAliasInfo(
479                 [in,ref]                  policy_handle *handle,
480                 [in]                      uint16 level,
481                 [out,switch_is(level)]    samr_AliasInfo *info
482                 );
483
484         /************************/
485         /* Function    0x1d     */
486         NTSTATUS samr_SetAliasInfo(
487                 [in,ref]                  policy_handle  *handle,
488                 [in]                      uint16          level,
489                 [in,switch_is(level)]     samr_AliasInfo  info
490                 );
491
492         /************************/
493         /* Function    0x1e     */
494         NTSTATUS samr_DeleteDomAlias(
495                 [in,out,ref]  policy_handle *handle
496                 );
497
498         /************************/
499         /* Function    0x1f     */
500         NTSTATUS samr_AddAliasMember(
501                 [in,ref]  policy_handle *handle,
502                 [in,ref]  dom_sid2      *sid
503                 );
504
505         /************************/
506         /* Function    0x20     */
507         NTSTATUS samr_DeleteAliasMember(
508                 [in,ref] policy_handle *handle,
509                 [in,ref] dom_sid2      *sid
510                 );
511
512         /************************/
513         /* Function    0x21     */
514         NTSTATUS samr_GetMembersInAlias(
515                 [in,ref]   policy_handle *handle,
516                 [out,ref]  lsa_SidArray    *sids
517                 );
518
519         /************************/
520         /* Function    0x22     */
521         NTSTATUS samr_OpenUser(
522                 [in,ref]      policy_handle *handle,
523                 [in]          uint32 access_mask,
524                 [in]          uint32 rid,
525                 [out,ref]     policy_handle *acct_handle
526                 );
527
528         /************************/
529         /* Function    0x23     */
530         NTSTATUS samr_DeleteUser(
531                 [in,out,ref]   policy_handle *handle
532                 );
533
534         /************************/
535         /* Function    0x24     */
536         typedef struct {
537                 samr_Name username;
538                 samr_Name full_name;
539                 uint32 primary_gid;
540                 samr_Name description;
541                 samr_Name comment;
542         } samr_UserInfo1;
543
544         typedef struct {
545                 samr_Name comment;
546                 samr_Name unknown; /* settable, but doesn't stick. probably obsolete */
547                 uint16 country_code;
548                 uint16 code_page;
549         } samr_UserInfo2;
550
551         typedef struct {
552                 samr_Name username;
553                 samr_Name full_name;
554                 uint32 Rid;
555                 uint32 primary_gid;
556                 samr_Name home_directory;
557                 samr_Name home_drive;
558                 samr_Name logon_script;
559                 samr_Name profile;
560                 samr_Name workstations;
561                 NTTIME last_logon;
562                 NTTIME last_logoff;
563                 NTTIME last_pwd_change;
564                 NTTIME allow_pwd_change;
565                 NTTIME force_pwd_change;
566                 samr_LogonHours logon_hours;
567                 uint16 bad_pwd_count;
568                 uint16 num_logons;
569                 uint32 acct_flags;
570         } samr_UserInfo3;
571
572         typedef struct {
573                 samr_LogonHours logon_hours;
574         } samr_UserInfo4;
575
576         typedef struct {
577                 samr_Name username;
578                 samr_Name full_name;
579                 uint32 rid;
580                 uint32 primary_gid;
581                 samr_Name home_directory;
582                 samr_Name home_drive;
583                 samr_Name logon_script;
584                 samr_Name profile;
585                 samr_Name description;
586                 samr_Name workstations;
587                 NTTIME last_logon;
588                 NTTIME last_logoff;
589                 samr_LogonHours logon_hours;
590                 uint16 bad_pwd_count;
591                 uint16 num_logons;
592                 NTTIME last_pwd_change;
593                 NTTIME acct_expiry;
594                 uint32 acct_flags;
595         } samr_UserInfo5;
596
597         typedef struct {
598                 samr_Name username;
599                 samr_Name full_name;
600         } samr_UserInfo6;
601
602         typedef struct {
603                 samr_Name username;
604         } samr_UserInfo7;
605
606         typedef struct {
607                 samr_Name full_name;
608         } samr_UserInfo8;
609
610         typedef struct {
611                 uint32 primary_gid;
612         } samr_UserInfo9;
613
614         typedef struct {
615                 samr_Name home_dir;
616                 samr_Name home_drive;
617         } samr_UserInfo10;
618
619         typedef struct {
620                 samr_Name logon_script;
621         } samr_UserInfo11;
622
623         typedef struct {
624                 samr_Name profile;
625         } samr_UserInfo12;
626
627         typedef struct {
628                 samr_Name description;
629         } samr_UserInfo13;
630
631         typedef struct {
632                 samr_Name workstations;
633         } samr_UserInfo14;
634
635         typedef struct {
636                 uint32 acct_flags;
637         } samr_UserInfo16;
638         
639         typedef struct {
640                 NTTIME acct_expiry;
641         } samr_UserInfo17;
642
643         typedef struct {
644                 samr_Name callback;
645         } samr_UserInfo20;
646
647         /* this defines the bits used for fields_present in info21 */
648         const int SAMR_FIELD_NAME         = 0x00000002;
649         const int SAMR_FIELD_DESCRIPTION  = 0x00000010;
650         const int SAMR_FIELD_COMMENT      = 0x00000020;
651         const int SAMR_FIELD_LOGON_SCRIPT = 0x00000100;
652         const int SAMR_FIELD_PROFILE      = 0x00000200;
653         const int SAMR_FIELD_WORKSTATION  = 0x00000400;
654         const int SAMR_FIELD_LOGON_HOURS  = 0x00002000;
655         const int SAMR_FIELD_CALLBACK     = 0x00200000;
656         const int SAMR_FIELD_COUNTRY_CODE = 0x00400000;
657         const int SAMR_FIELD_CODE_PAGE    = 0x00800000;
658         const int SAMR_FIELD_PASSWORD     = 0x03000000; /* 2 bits!? */
659
660         typedef struct {
661                 NTTIME last_logon;
662                 NTTIME last_logoff;
663                 NTTIME last_pwd_change;
664                 NTTIME acct_expiry;
665                 NTTIME allow_pwd_change;
666                 NTTIME force_pwd_change;
667                 samr_Name username;
668                 samr_Name full_name;
669                 samr_Name home_dir;
670                 samr_Name home_drive;
671                 samr_Name logon_script;
672                 samr_Name profile;
673                 samr_Name description;
674                 samr_Name workstations;
675                 samr_Name comment;
676                 samr_Name callback;
677                 samr_Name unknown1;
678                 samr_Name unknown2;
679                 samr_Name unknown3;
680                 uint32 buf_count;
681                 [size_is(buf_count)] uint8 *buffer;
682                 uint32 rid;
683                 uint32 primary_gid;
684                 uint32 acct_flags;
685                 uint32 fields_present;
686                 samr_LogonHours logon_hours;
687                 uint16 bad_pwd_count;
688                 uint16 num_logons;
689                 uint16 country_code;
690                 uint16 code_page;
691                 uint8  nt_pwd_set;
692                 uint8  lm_pwd_set;
693                 uint8  expired_flag;
694                 uint8  unknown4;
695         } samr_UserInfo21;
696
697         typedef [flag(NDR_PAHEX)] struct {
698                 uint8 data[516];
699         } samr_CryptPassword;
700
701         typedef struct {
702                 samr_UserInfo21 info;
703                 samr_CryptPassword password;
704         } samr_UserInfo23;
705
706         typedef struct {
707                 samr_CryptPassword password;
708                 uint16 pw_len;
709         } samr_UserInfo24;
710
711         typedef [flag(NDR_PAHEX)] struct {
712                 uint8 data[532];
713         } samr_CryptPasswordEx;
714
715         typedef struct {
716                 samr_UserInfo21 info;
717                 samr_CryptPasswordEx password;
718         } samr_UserInfo25;
719
720         typedef struct {
721                 samr_CryptPasswordEx password;
722                 uint16 pw_len;
723         } samr_UserInfo26;
724
725         typedef union {
726                 [case(1)] samr_UserInfo1 info1;
727                 [case(2)] samr_UserInfo2 info2;
728                 [case(3)] samr_UserInfo3 info3;
729                 [case(4)] samr_UserInfo4 info4;
730                 [case(5)] samr_UserInfo5 info5;
731                 [case(6)] samr_UserInfo6 info6;
732                 [case(7)] samr_UserInfo7 info7;
733                 [case(8)] samr_UserInfo8 info8;
734                 [case(9)] samr_UserInfo9 info9;
735                 [case(10)] samr_UserInfo10 info10;
736                 [case(11)] samr_UserInfo11 info11;
737                 [case(12)] samr_UserInfo12 info12;
738                 [case(13)] samr_UserInfo13 info13;
739                 [case(14)] samr_UserInfo14 info14;
740                 [case(16)] samr_UserInfo16 info16;
741                 [case(17)] samr_UserInfo17 info17;
742                 [case(20)] samr_UserInfo20 info20;
743                 [case(21)] samr_UserInfo21 info21;
744                 [case(23)] samr_UserInfo23 info23;
745                 [case(24)] samr_UserInfo24 info24;
746                 [case(25)] samr_UserInfo25 info25;
747                 [case(26)] samr_UserInfo26 info26;
748         } samr_UserInfo;
749
750         NTSTATUS samr_QueryUserInfo(
751                 [in,ref]                  policy_handle *handle,
752                 [in]                      uint16 level,
753                 [out,switch_is(level)]    samr_UserInfo *info
754                 );
755
756
757         /************************/
758         /* Function    0x25     */
759         NTSTATUS samr_SetUserInfo(
760                 [in,ref]                   policy_handle *handle,
761                 [in]                       uint16 level,
762                 [in,ref,switch_is(level)]  samr_UserInfo *info
763                 );
764
765         /************************/
766         /* Function    0x26     */
767         
768         typedef [flag(NDR_PAHEX)] struct {
769                 uint8 hash[16];
770         } samr_Hash;
771
772         /*
773           this is a password change interface that doesn't give
774           the server the plaintext password. Depricated.
775         */
776         NTSTATUS samr_ChangePasswordUser(
777                 [in,ref]    policy_handle *handle,
778                 [in]        bool8 lm_present,
779                 [in]        samr_Hash *old_lm_crypted,
780                 [in]        samr_Hash *new_lm_crypted,
781                 [in]        bool8 nt_present,
782                 [in]        samr_Hash *old_nt_crypted,
783                 [in]        samr_Hash *new_nt_crypted,
784                 [in]        bool8 cross1_present,
785                 [in]        samr_Hash *nt_cross,
786                 [in]        bool8 cross2_present,
787                 [in]        samr_Hash *lm_cross
788                 );
789
790         /************************/
791         /* Function    0x27     */
792
793         typedef struct {
794                 uint32 rid;
795                 uint32 type;
796         } samr_RidType;
797
798         typedef struct {
799                 uint32     count;
800                 [size_is(count)] samr_RidType *rid;
801         } samr_RidArray;
802
803         NTSTATUS samr_GetGroupsForUser(
804                 [in,ref]   policy_handle *handle,
805                 [out]      samr_RidArray  *rids
806                 );
807
808         /************************/
809         /* Function    0x28     */
810
811         typedef struct {
812                 uint32    idx;
813                 uint32    rid;
814                 uint32    acct_flags;
815                 samr_Name account_name;
816                 samr_Name full_name;
817                 samr_Name description;
818         } samr_DispEntryGeneral;
819
820         typedef struct {
821                 uint32 count;
822                 [size_is(count)] samr_DispEntryGeneral *entries;
823         } samr_DispInfoGeneral;
824
825         typedef struct {
826                 uint32    idx;
827                 uint32    rid;
828                 uint32    acct_flags;
829                 samr_Name account_name;
830                 samr_Name description;
831         } samr_DispEntryFull;
832
833         typedef struct {
834                 uint32 count;
835                 [size_is(count)] samr_DispEntryFull *entries;
836         } samr_DispInfoFull;
837
838         typedef struct {
839                 [value(strlen_m(r->name))] uint16 name_len;
840                 [value(strlen_m(r->name))] uint16 name_size;
841                 ascstr_noterm *name;
842         } samr_AsciiName;       
843
844         typedef struct {
845                 uint32    idx;
846                 samr_AsciiName account_name;
847         } samr_DispEntryAscii;
848
849         typedef struct {
850                 uint32 count;
851                 [size_is(count)] samr_DispEntryAscii *entries;
852         } samr_DispInfoAscii;
853
854         typedef union {
855                 [case(1)] samr_DispInfoGeneral info1;/* users */
856                 [case(2)] samr_DispInfoFull info2; /* trust accounts? */
857                 [case(3)] samr_DispInfoFull info3; /* groups */
858                 [case(4)] samr_DispInfoAscii info4; /* users */
859                 [case(5)] samr_DispInfoAscii info5; /* groups */
860         } samr_DispInfo;
861
862         NTSTATUS samr_QueryDisplayInfo(
863                 [in,ref]    policy_handle *handle,
864                 [in]        uint16 level,
865                 [in]        uint32 start_idx,
866                 [in]        uint32 max_entries,
867                 [in]        uint32 buf_size,
868                 [out]       uint32 total_size,
869                 [out]       uint32 returned_size,
870                 [out,switch_is(level)] samr_DispInfo info
871                 );
872
873
874         /************************/
875         /* Function    0x29     */
876
877         /*
878           this seems to be an alphabetic search function. The returned index
879           is the index for samr_QueryDisplayInfo needed to get names occurring
880           after the specified name. The supplied name does not need to exist
881           in the database (for example you can supply just a first letter for 
882           searching starting at that letter)
883
884           The level corresponds to the samr_QueryDisplayInfo level
885         */
886         NTSTATUS samr_GetDisplayEnumerationIndex(
887                 [in,ref]    policy_handle *handle,
888                 [in]        uint16 level,
889                 [in]        samr_Name name,
890                 [out]       uint32 idx
891                 );
892
893
894
895         /************************/
896         /* Function    0x2a     */
897
898         /*
899           w2k3 returns NT_STATUS_NOT_IMPLEMENTED for this
900         */
901         NTSTATUS samr_TestPrivateFunctionsDomain(
902                 [in,ref]    policy_handle *handle
903                 );
904
905
906         /************************/
907         /* Function    0x2b     */
908
909         /*
910           w2k3 returns NT_STATUS_NOT_IMPLEMENTED for this
911         */
912         NTSTATUS samr_TestPrivateFunctionsUser(
913                 [in,ref]    policy_handle *handle
914                 );
915
916
917         /************************/
918         /* Function    0x2c     */
919
920         /* password properties flags */
921         const uint32 DOMAIN_PASSWORD_COMPLEX         = 0x00000001;
922         const uint32 DOMAIN_PASSWORD_NO_ANON_CHANGE  = 0x00000002;
923         const uint32 DOMAIN_PASSWORD_NO_CLEAR_CHANGE = 0x00000004;
924         const uint32 DOMAIN_PASSWORD_STORE_CLEARTEXT = 0x00000010;
925         const uint32 DOMAIN_REFUSE_PASSWORD_CHANGE   = 0x00000020;
926
927         typedef struct {
928                 uint16 min_pwd_len;
929                 uint32 password_properties;
930         } samr_PwInfo;
931
932         NTSTATUS samr_GetUserPwInfo(
933                 [in,ref]    policy_handle *handle,
934                 [out]       samr_PwInfo info
935                 );
936
937         /************************/
938         /* Function    0x2d     */
939         NTSTATUS samr_RemoveMemberFromForeignDomain(
940                 [in,ref]    policy_handle *handle,
941                 [in,ref]    dom_sid2 *sid
942                 );
943
944         /************************/
945         /* Function    0x2e     */
946
947         /*
948           how is this different from QueryDomainInfo ??
949         */
950         NTSTATUS samr_QueryDomainInfo2(
951                 [in,ref]      policy_handle *handle,
952                 [in]          uint16 level,
953                 [out,switch_is(level)] samr_DomainInfo *info
954                 );
955
956         /************************/
957         /* Function    0x2f     */
958
959         /*
960           how is this different from QueryUserInfo ??
961         */
962         NTSTATUS samr_QueryUserInfo2(
963                 [in,ref]                  policy_handle *handle,
964                 [in]                      uint16 level,
965                 [out,switch_is(level)]    samr_UserInfo *info
966                 );
967
968         /************************/
969         /* Function    0x30     */
970
971         /*
972           how is this different from QueryDisplayInfo??
973         */
974         NTSTATUS samr_QueryDisplayInfo2(
975                 [in,ref]    policy_handle *handle,
976                 [in]        uint16 level,
977                 [in]        uint32 start_idx,
978                 [in]        uint32 max_entries,
979                 [in]        uint32 buf_size,
980                 [out]       uint32 total_size,
981                 [out]       uint32 returned_size,
982                 [out,switch_is(level)] samr_DispInfo info
983                 );
984
985         /************************/
986         /* Function    0x31     */
987
988         /*
989           how is this different from GetDisplayEnumerationIndex ??
990         */
991         NTSTATUS samr_GetDisplayEnumerationIndex2(
992                 [in,ref]    policy_handle *handle,
993                 [in]        uint16 level,
994                 [in]        samr_Name name,
995                 [out]       uint32 idx
996                 );
997
998
999         /************************/
1000         /* Function    0x32     */
1001         NTSTATUS samr_CreateUser2(
1002                 [in,ref]      policy_handle *handle,
1003                 [in,ref]      samr_Name *username,
1004                 [in]          uint32 acct_flags,
1005                 [in]          uint32 access_mask,
1006                 [out,ref]     policy_handle *acct_handle,
1007                 [out,ref]     uint32 *access_granted,
1008                 [out,ref]     uint32 *rid
1009                 );
1010
1011
1012         /************************/
1013         /* Function    0x33     */
1014
1015         /*
1016           another duplicate. There must be a reason ....
1017         */
1018         NTSTATUS samr_QueryDisplayInfo3(
1019                 [in,ref]    policy_handle *handle,
1020                 [in]        uint16 level,
1021                 [in]        uint32 start_idx,
1022                 [in]        uint32 max_entries,
1023                 [in]        uint32 buf_size,
1024                 [out]       uint32 total_size,
1025                 [out]       uint32 returned_size,
1026                 [out,switch_is(level)] samr_DispInfo info
1027                 );
1028
1029         /************************/
1030         /* Function    0x34     */
1031         NTSTATUS samr_AddMultipleMembersToAlias(
1032                 [in,ref]    policy_handle *handle,
1033                 [in,ref]    lsa_SidArray *sids
1034                 );
1035
1036         /************************/
1037         /* Function    0x35     */
1038         NTSTATUS samr_RemoveMultipleMembersFromAlias(
1039                 [in,ref]    policy_handle *handle,
1040                 [in,ref]    lsa_SidArray *sids
1041                 );
1042
1043         /************************/
1044         /* Function    0x36     */
1045
1046         NTSTATUS samr_OemChangePasswordUser2(
1047                 [in]              samr_AsciiName *server,
1048                 [in,ref]          samr_AsciiName *account,
1049                 [in]              samr_CryptPassword *password,
1050                 [in]              samr_Hash *hash
1051                 );
1052
1053         /************************/
1054         /* Function    0x37     */
1055         NTSTATUS samr_ChangePasswordUser2(
1056                 [in]              samr_Name *server,
1057                 [in,ref]          samr_Name *account,
1058                 [in]              samr_CryptPassword *nt_password,
1059                 [in]              samr_Hash *nt_verifier,
1060                 [in]              bool8 lm_change,
1061                 [in]              samr_CryptPassword *lm_password,
1062                 [in]              samr_Hash *lm_verifier
1063                 );
1064
1065         /************************/
1066         /* Function    0x38     */
1067         NTSTATUS samr_GetDomPwInfo(
1068                 [in]        samr_Name *name,
1069                 [out]       samr_PwInfo info
1070                 );
1071
1072         /************************/
1073         /* Function    0x39     */
1074         NTSTATUS samr_Connect2(
1075                 [in] unistr *system_name,
1076                 [in] uint32 access_mask,
1077                 [out,ref]  policy_handle *handle
1078                 );
1079
1080         /************************/
1081         /* Function    0x3a     */
1082         /*
1083           seems to be an exact alias for samr_SetUserInfo() 
1084         */
1085         NTSTATUS samr_SetUserInfo2(
1086                 [in,ref]                   policy_handle *handle,
1087                 [in]                       uint16 level,
1088                 [in,ref,switch_is(level)]  samr_UserInfo *info
1089                 );
1090
1091         /************************/
1092         /* Function    0x3b     */
1093         /*
1094           this one is mysterious. I have a few guesses, but nothing working yet
1095         */
1096         NTSTATUS samr_SetBootKeyInformation(
1097                 [in,ref]   policy_handle *handle,
1098                 [in]       uint32 unknown1,
1099                 [in]       uint32 unknown2,
1100                 [in]       uint32 unknown3
1101                 );
1102
1103         /************************/
1104         /* Function    0x3c     */
1105         NTSTATUS samr_GetBootKeyInformation(
1106                 [in,ref]   policy_handle *handle,
1107                 [out]      uint32 unknown
1108                 );
1109
1110         /************************/
1111         /* Function    0x3d     */
1112         NTSTATUS samr_Connect3(
1113                 [in] unistr *system_name,
1114                 /* this unknown value seems to be completely ignored by w2k3 */
1115                 [in] uint32 unknown,
1116                 [in] uint32 access_mask,
1117                 [out,ref]  policy_handle *handle
1118                 );
1119
1120         /************************/
1121         /* Function    0x3e     */
1122         NTSTATUS samr_Connect4(
1123                 [in] unistr *system_name,
1124                 [in] uint32 unknown,
1125                 [in] uint32 access_mask,
1126                 [out,ref]  policy_handle *handle
1127                 );
1128
1129         /************************/
1130         /* Function    0x3f     */
1131
1132         typedef struct {
1133                 uint32 unknown1;
1134                 uint32 unknown2;
1135                 uint32 unknown3;
1136         } samr_ChangeReject;
1137
1138         NTSTATUS samr_ChangePasswordUser3(
1139                 [in]              samr_Name *server,
1140                 [in,ref]          samr_Name *account,
1141                 [in]              samr_CryptPassword *nt_password,
1142                 [in]              samr_Hash *nt_verifier,
1143                 [in]              bool8 lm_change,
1144                 [in]              samr_CryptPassword *lm_password,
1145                 [in]              samr_Hash *lm_verifier,
1146                 [in]              samr_CryptPassword *password3,
1147                 [out]             samr_DomInfo1 *dominfo,
1148                 [out]             samr_ChangeReject *reject
1149                 );
1150
1151         /************************/
1152         /* Function    0x40      */
1153
1154         typedef struct {
1155                 uint32         unknown1; /* w2k3 gives 3 */
1156                 uint32         unknown2; /* w2k3 gives 0 */
1157         } samr_ConnectInfo1;
1158
1159         typedef union {
1160                 [case(1)]  samr_ConnectInfo1 info1;
1161         } samr_ConnectInfo;
1162
1163         NTSTATUS samr_Connect5(
1164                 [in]       unistr             *system_name,
1165                 [in]       uint32             access_mask,
1166                 [in,out]   uint32             level,
1167                 [in,out,switch_is(level),ref] samr_ConnectInfo *info,
1168                 [out,ref]  policy_handle      *handle
1169                 );
1170
1171         /************************/
1172         /* Function    0x41     */
1173         NTSTATUS samr_RidToSid(
1174                 [in,ref]    policy_handle *handle,
1175                 [in]        uint32        rid,
1176                 [out]       dom_sid2      *sid
1177                 );
1178
1179
1180         /************************/
1181         /* Function    0x42     */
1182
1183         /*
1184           this should set the DSRM password for the server, which is used
1185           when booting into Directory Services Recovery Mode on a DC. Win2003
1186           gives me NT_STATUS_NOT_SUPPORTED
1187         */
1188
1189         NTSTATUS samr_SetDsrmPassword(
1190                 [in]       samr_Name *name,
1191                 [in]       uint32 unknown,
1192                 [in]       samr_Hash *hash
1193                 );
1194
1195
1196         /************************/
1197         /* Function    0x43     */
1198         /*
1199           I haven't been able to work out the format of this one yet.
1200           Seems to start with a switch level for a union?
1201         */
1202         NTSTATUS samr_ValidatePassword();
1203 }