Rename structures to better match the names in the WSPP IDL.
[kai/samba.git] / source / librpc / idl / samr.idl
1 #include "idl_types.h"
2
3 /*
4   samr interface definition
5 */
6 import "misc.idl", "lsa.idl", "security.idl";
7
8 /*
9   Thanks to Todd Sabin for some information from his samr.idl in acltools
10 */
11
12 [ uuid("12345778-1234-abcd-ef00-0123456789ac"),
13   version(1.0),
14   endpoint("ncacn_np:[\\pipe\\samr]","ncacn_ip_tcp:", "ncalrpc:"),
15   pointer_default(unique)
16 ] interface samr
17 {
18         typedef bitmap security_secinfo security_secinfo;
19
20         /* account control (acct_flags) bits */
21         typedef [public,bitmap32bit] bitmap {
22                 ACB_DISABLED                    = 0x00000001,  /* 1 = User account disabled */
23                 ACB_HOMDIRREQ                   = 0x00000002,  /* 1 = Home directory required */
24                 ACB_PWNOTREQ                    = 0x00000004,  /* 1 = User password not required */
25                 ACB_TEMPDUP                     = 0x00000008,  /* 1 = Temporary duplicate account */
26                 ACB_NORMAL                      = 0x00000010,  /* 1 = Normal user account */
27                 ACB_MNS                         = 0x00000020,  /* 1 = MNS logon user account */
28                 ACB_DOMTRUST                    = 0x00000040,  /* 1 = Interdomain trust account */
29                 ACB_WSTRUST                     = 0x00000080,  /* 1 = Workstation trust account */
30                 ACB_SVRTRUST                    = 0x00000100,  /* 1 = Server trust account */
31                 ACB_PWNOEXP                     = 0x00000200,  /* 1 = User password does not expire */
32                 ACB_AUTOLOCK                    = 0x00000400,  /* 1 = Account auto locked */
33                 ACB_ENC_TXT_PWD_ALLOWED         = 0x00000800,  /* 1 = Encryped text password is allowed */
34                 ACB_SMARTCARD_REQUIRED          = 0x00001000,  /* 1 = Smart Card required */
35                 ACB_TRUSTED_FOR_DELEGATION      = 0x00002000,  /* 1 = Trusted for Delegation */
36                 ACB_NOT_DELEGATED               = 0x00004000,  /* 1 = Not delegated */
37                 ACB_USE_DES_KEY_ONLY            = 0x00008000,  /* 1 = Use DES key only */
38                 ACB_DONT_REQUIRE_PREAUTH        = 0x00010000,  /* 1 = Preauth not required */
39                 ACB_PW_EXPIRED                  = 0x00020000,  /* 1 = Password Expired */
40                 ACB_NO_AUTH_DATA_REQD           = 0x00080000   /* 1 = No authorization data required */
41         } samr_AcctFlags;
42
43         typedef [bitmap32bit] bitmap {
44                 SAMR_ACCESS_CONNECT_TO_SERVER   = 0x00000001,
45                 SAMR_ACCESS_SHUTDOWN_SERVER     = 0x00000002,
46                 SAMR_ACCESS_INITIALIZE_SERVER   = 0x00000004,
47                 SAMR_ACCESS_CREATE_DOMAIN       = 0x00000008,
48                 SAMR_ACCESS_ENUM_DOMAINS        = 0x00000010,
49                 SAMR_ACCESS_OPEN_DOMAIN         = 0x00000020
50         } samr_ConnectAccessMask;
51
52         typedef [bitmap32bit] bitmap {
53                 SAMR_USER_ACCESS_GET_NAME_ETC             = 0x00000001,
54                 SAMR_USER_ACCESS_GET_LOCALE               = 0x00000002,
55                 SAMR_USER_ACCESS_SET_LOC_COM              = 0x00000004,
56                 SAMR_USER_ACCESS_GET_LOGONINFO            = 0x00000008,
57                 SAMR_USER_ACCESS_GET_ATTRIBUTES           = 0x00000010,
58                 SAMR_USER_ACCESS_SET_ATTRIBUTES           = 0x00000020,
59                 SAMR_USER_ACCESS_CHANGE_PASSWORD          = 0x00000040,
60                 SAMR_USER_ACCESS_SET_PASSWORD             = 0x00000080,
61                 SAMR_USER_ACCESS_GET_GROUPS               = 0x00000100,
62                 SAMR_USER_ACCESS_GET_GROUP_MEMBERSHIP     = 0x00000200,
63                 SAMR_USER_ACCESS_CHANGE_GROUP_MEMBERSHIP  = 0x00000400
64         } samr_UserAccessMask;
65
66         typedef [bitmap32bit] bitmap {
67                 SAMR_DOMAIN_ACCESS_LOOKUP_INFO_1  = 0x00000001,
68                 SAMR_DOMAIN_ACCESS_SET_INFO_1     = 0x00000002,
69                 SAMR_DOMAIN_ACCESS_LOOKUP_INFO_2  = 0x00000004,
70                 SAMR_DOMAIN_ACCESS_SET_INFO_2     = 0x00000008,
71                 SAMR_DOMAIN_ACCESS_CREATE_USER    = 0x00000010,
72                 SAMR_DOMAIN_ACCESS_CREATE_GROUP   = 0x00000020,
73                 SAMR_DOMAIN_ACCESS_CREATE_ALIAS   = 0x00000040,
74                 SAMR_DOMAIN_ACCESS_LOOKUP_ALIAS   = 0x00000080,
75                 SAMR_DOMAIN_ACCESS_ENUM_ACCOUNTS  = 0x00000100,
76                 SAMR_DOMAIN_ACCESS_OPEN_ACCOUNT   = 0x00000200,
77                 SAMR_DOMAIN_ACCESS_SET_INFO_3     = 0x00000400
78         } samr_DomainAccessMask;
79
80         typedef [bitmap32bit] bitmap {
81                 SAMR_GROUP_ACCESS_LOOKUP_INFO     = 0x00000001,
82                 SAMR_GROUP_ACCESS_SET_INFO        = 0x00000002,
83                 SAMR_GROUP_ACCESS_ADD_MEMBER      = 0x00000004,
84                 SAMR_GROUP_ACCESS_REMOVE_MEMBER   = 0x00000008,
85                 SAMR_GROUP_ACCESS_GET_MEMBERS     = 0x00000010
86         } samr_GroupAccessMask;
87
88         typedef [bitmap32bit] bitmap {
89                 SAMR_ALIAS_ACCESS_ADD_MEMBER      = 0x00000001,
90                 SAMR_ALIAS_ACCESS_REMOVE_MEMBER   = 0x00000002,
91                 SAMR_ALIAS_ACCESS_GET_MEMBERS     = 0x00000004,
92                 SAMR_ALIAS_ACCESS_LOOKUP_INFO     = 0x00000008,
93                 SAMR_ALIAS_ACCESS_SET_INFO        = 0x00000010
94         } samr_AliasAccessMask;
95
96         /******************/
97         /* Function: 0x00 */
98         NTSTATUS samr_Connect (
99                 /* notice the lack of [string] */
100                 [in,unique] uint16 *system_name,
101                 [in]       samr_ConnectAccessMask access_mask,
102                 [out,ref]  policy_handle *connect_handle
103                 );
104
105
106         /******************/
107         /* Function: 0x01 */
108         [public] NTSTATUS samr_Close (
109                 [in,out,ref]  policy_handle *handle
110                 );
111
112         /******************/
113         /* Function: 0x02 */
114
115         NTSTATUS samr_SetSecurity (
116                 [in,ref]          policy_handle *handle,
117                 [in]              security_secinfo sec_info,
118                 [in,ref]          sec_desc_buf *sdbuf
119                 );
120
121         /******************/
122         /* Function: 0x03 */
123
124         NTSTATUS samr_QuerySecurity (
125                 [in,ref]          policy_handle *handle,
126                 [in]              security_secinfo sec_info,
127                 [out,unique]      sec_desc_buf *sdbuf
128                 );
129
130         /******************/
131         /* Function: 0x04 */
132
133         /*
134           shutdown the SAM - once you call this the SAM will be dead
135         */
136         NTSTATUS samr_Shutdown (
137                 [in,ref]   policy_handle *connect_handle
138                 );
139
140         /******************/
141         /* Function: 0x05 */
142         NTSTATUS samr_LookupDomain (
143                 [in,ref]  policy_handle *connect_handle,                
144                 [in,ref]  lsa_String *domain_name,
145                 [out,unique] dom_sid2 *sid
146                 );
147
148
149         /******************/
150         /* Function: 0x06 */
151
152         typedef struct {
153                 uint32 idx;
154                 lsa_String name;
155         } samr_SamEntry;
156
157         typedef struct {
158                 uint32 count;
159                 [size_is(count)] samr_SamEntry *entries;
160         } samr_SamArray;
161
162         NTSTATUS samr_EnumDomains (
163                 [in,ref]      policy_handle *connect_handle,
164                 [in,out,ref]  uint32 *resume_handle,
165                 [in]          uint32 buf_size,
166                 [out,unique]  samr_SamArray *sam,
167                 [out]         uint32 num_entries
168                 );
169
170
171         /************************/
172         /* Function    0x07     */
173         [public] NTSTATUS samr_OpenDomain(
174                 [in,ref]      policy_handle *connect_handle,
175                 [in]          samr_DomainAccessMask access_mask,
176                 [in,ref]      dom_sid2 *sid,
177                 [out,ref]     policy_handle *domain_handle
178                 );
179
180         /************************/
181         /* Function    0x08     */
182         /* server roles */
183         typedef [v1_enum] enum {
184                 SAMR_ROLE_STANDALONE    = 0,
185                 SAMR_ROLE_DOMAIN_MEMBER = 1,
186                 SAMR_ROLE_DOMAIN_BDC    = 2,
187                 SAMR_ROLE_DOMAIN_PDC    = 3
188         } samr_Role;
189
190         /* password properties flags */
191         typedef [public,bitmap32bit] bitmap {
192                 DOMAIN_PASSWORD_COMPLEX         = 0x00000001,
193                 DOMAIN_PASSWORD_NO_ANON_CHANGE  = 0x00000002,
194                 DOMAIN_PASSWORD_NO_CLEAR_CHANGE = 0x00000004,
195                 DOMAIN_PASSWORD_LOCKOUT_ADMINS  = 0x00000008,
196                 DOMAIN_PASSWORD_STORE_CLEARTEXT = 0x00000010,
197                 DOMAIN_REFUSE_PASSWORD_CHANGE   = 0x00000020
198         } samr_PasswordProperties;
199
200         typedef struct {
201                 uint16 min_password_length;
202                 uint16 password_history_length;
203                 samr_PasswordProperties password_properties;
204                 /* yes, these are signed. They are in negative 100ns */
205                 dlong  max_password_age;
206                 dlong  min_password_age;
207         } samr_DomInfo1;
208
209         typedef struct {
210                 NTTIME force_logoff_time;
211                 lsa_String oem_information; /* comment */
212                 lsa_String domain_name;
213                 lsa_String primary; /* PDC name if this is a BDC */
214                 udlong sequence_num;
215                 uint32 unknown2;
216                 samr_Role role;
217                 uint32 unknown3;
218                 uint32 num_users;
219                 uint32 num_groups;
220                 uint32 num_aliases;
221         } samr_DomGeneralInformation;
222
223         typedef struct {
224                 NTTIME force_logoff_time;
225         } samr_DomInfo3;
226
227         typedef struct {
228                 lsa_String oem_information; /* comment */
229         } samr_DomOEMInformation;
230
231         typedef struct {
232                 lsa_String domain_name;
233         } samr_DomInfo5;
234
235         typedef struct {
236                 lsa_String primary;
237         } samr_DomInfo6;
238
239         typedef struct {
240                 samr_Role role;
241         } samr_DomInfo7;
242
243         typedef struct {
244                 hyper sequence_num;
245                 NTTIME domain_create_time;
246         } samr_DomInfo8;
247
248         typedef struct {
249                 uint32 unknown; /* w2k3 returns 1 */
250         } samr_DomInfo9;
251
252         typedef struct {
253                 samr_DomGeneralInformation general;
254                 hyper lockout_duration;
255                 hyper lockout_window;
256                 uint16 lockout_threshold;
257         } samr_DomGeneralInformation2;
258
259         typedef struct {
260                 hyper lockout_duration;
261                 hyper lockout_window;
262                 uint16 lockout_threshold;
263         } samr_DomInfo12;
264
265         typedef struct {
266                 hyper sequence_num;
267                 NTTIME domain_create_time;
268                 uint32 unknown1;
269                 uint32 unknown2;
270         } samr_DomInfo13;
271
272         typedef [switch_type(uint16)] union {
273                 [case(1)] samr_DomInfo1 info1;
274                 [case(2)] samr_DomGeneralInformation general;
275                 [case(3)] samr_DomInfo3 info3;
276                 [case(4)] samr_DomOEMInformation oem;
277                 [case(5)] samr_DomInfo5 info5;
278                 [case(6)] samr_DomInfo6 info6;
279                 [case(7)] samr_DomInfo7 info7;
280                 [case(8)] samr_DomInfo8 info8;
281                 [case(9)] samr_DomInfo9 info9;
282                 [case(11)] samr_DomGeneralInformation2 general2;
283                 [case(12)] samr_DomInfo12 info12;
284                 [case(13)] samr_DomInfo13 info13;
285         } samr_DomainInfo;
286
287         NTSTATUS samr_QueryDomainInfo(
288                 [in,ref]      policy_handle *domain_handle,
289                 [in]          uint16 level,
290                 [out,switch_is(level),unique] samr_DomainInfo *info
291                 );
292
293         /************************/
294         /* Function    0x09     */
295         /*
296           only levels 1, 3, 4, 6, 7, 9, 12 are valid for this 
297           call in w2k3
298         */
299         NTSTATUS samr_SetDomainInfo(
300                 [in,ref]      policy_handle *domain_handle,
301                 [in]          uint16 level,
302                 [in,switch_is(level),ref] samr_DomainInfo *info
303                 );
304
305
306         /************************/
307         /* Function    0x0a     */
308         NTSTATUS samr_CreateDomainGroup(
309                 [in,ref]      policy_handle *domain_handle,
310                 [in,ref]      lsa_String *name,
311                 [in]          samr_GroupAccessMask access_mask,
312                 [out,ref]     policy_handle *group_handle,
313                 [out,ref]     uint32 *rid
314                 );
315                 
316
317         /************************/
318         /* Function    0x0b     */
319         NTSTATUS samr_EnumDomainGroups(
320                 [in,ref]      policy_handle *domain_handle,
321                 [in,out,ref]  uint32 *resume_handle,
322                 [in]          uint32 max_size,
323                 [out,unique]  samr_SamArray *sam,
324                 [out]         uint32 num_entries
325                 );
326
327         /************************/
328         /* Function    0x0c     */
329         NTSTATUS samr_CreateUser(
330                 [in,ref]      policy_handle *domain_handle,
331                 [in,ref]      lsa_String *account_name,
332                 [in]          samr_UserAccessMask access_mask,
333                 [out,ref]     policy_handle *user_handle,
334                 [out,ref]     uint32 *rid
335                 );
336
337         /************************/
338         /* Function    0x0d     */
339
340
341         /* w2k3 treats max_size as max_users*54 and sets the
342            resume_handle as the rid of the last user sent
343         */
344         const int SAMR_ENUM_USERS_MULTIPLIER = 54;
345
346         NTSTATUS samr_EnumDomainUsers(
347                 [in,ref]      policy_handle *domain_handle,
348                 [in,out,ref]  uint32 *resume_handle,
349                 [in]          samr_AcctFlags acct_flags,
350                 [in]          uint32 max_size,
351                 [out,unique]  samr_SamArray *sam,
352                 [out]         uint32 num_entries
353                 );
354
355         /************************/
356         /* Function    0x0e     */
357         NTSTATUS samr_CreateDomAlias(
358                 [in,ref]      policy_handle *domain_handle,
359                 [in,ref]      lsa_String   *alias_name,
360                 [in]          samr_AliasAccessMask access_mask,
361                 [out,ref]     policy_handle *alias_handle,
362                 [out,ref]     uint32        *rid
363                 );
364
365         /************************/
366         /* Function    0x0f     */
367         NTSTATUS samr_EnumDomainAliases(
368                 [in,ref]      policy_handle *domain_handle,
369                 [in,out,ref]  uint32 *resume_handle,
370                 [in]          samr_AcctFlags acct_flags,
371                 [out,unique]  samr_SamArray *sam,
372                 [out]         uint32 num_entries
373                 );
374
375         /************************/
376         /* Function    0x10     */
377
378         typedef struct {
379                 [range(0,1024)]  uint32 count;
380                 [size_is(count)] uint32 *ids;
381         } samr_Ids;
382
383         NTSTATUS samr_GetAliasMembership(
384                 [in,ref]      policy_handle *domain_handle,
385                 [in,ref]      lsa_SidArray  *sids,
386                 [out,ref]     samr_Ids *rids
387                 );
388
389         /************************/
390         /* Function    0x11     */
391
392         [public] NTSTATUS samr_LookupNames(
393                 [in,ref]      policy_handle *domain_handle,
394                 [in,range(0,1000)] uint32 num_names,
395                 [in,size_is(1000),length_is(num_names)] lsa_String names[],
396                 [out]         samr_Ids rids,
397                 [out]         samr_Ids types
398                 );
399
400
401         /************************/
402         /* Function    0x12     */
403         NTSTATUS samr_LookupRids(
404                 [in,ref]      policy_handle *domain_handle,
405                 [in,range(0,1000)] uint32 num_rids,
406                 [in,size_is(1000),length_is(num_rids)] uint32 rids[],
407                 [out]         lsa_Strings names,
408                 [out]         samr_Ids types
409                 );
410
411         /************************/
412         /* Function    0x13     */
413         NTSTATUS samr_OpenGroup(
414                 [in,ref]      policy_handle *domain_handle,
415                 [in]          samr_GroupAccessMask access_mask,
416                 [in]          uint32 rid,
417                 [out,ref]     policy_handle *group_handle
418                 );
419
420         /* Group attributes */
421         typedef [public,bitmap32bit] bitmap {
422                 SE_GROUP_MANDATORY              = 0x00000001,
423                 SE_GROUP_ENABLED_BY_DEFAULT     = 0x00000002,
424                 SE_GROUP_ENABLED                = 0x00000004,
425                 SE_GROUP_OWNER                  = 0x00000008,
426                 SE_GROUP_USE_FOR_DENY_ONLY      = 0x00000010,
427                 SE_GROUP_RESOURCE               = 0x20000000,
428                 SE_GROUP_LOGON_ID               = 0xC0000000
429         } samr_GroupAttrs;
430
431         /************************/
432         /* Function    0x14     */
433
434         typedef struct {
435                 lsa_String name;
436                 samr_GroupAttrs attributes;
437                 uint32 num_members;
438                 lsa_String description;
439         } samr_GroupInfoAll;
440
441         typedef struct {
442                 samr_GroupAttrs attributes;
443         } samr_GroupInfoAttributes;
444
445         typedef struct {
446                 lsa_String description;
447         } samr_GroupInfoDescription;
448
449         typedef enum {
450                 GROUPINFOALL          = 1,
451                 GROUPINFONAME         = 2,
452                 GROUPINFOATTRIBUTES   = 3,
453                 GROUPINFODESCRIPTION  = 4,
454                 GROUPINFOALL2         = 5
455         } samr_GroupInfoEnum;
456
457         typedef [switch_type(samr_GroupInfoEnum)] union {
458                 [case(GROUPINFOALL)]         samr_GroupInfoAll        all;
459                 [case(GROUPINFONAME)]        lsa_String               name;
460                 [case(GROUPINFOATTRIBUTES)]  samr_GroupInfoAttributes attributes;
461                 [case(GROUPINFODESCRIPTION)] lsa_String               description;
462                 [case(GROUPINFOALL2)]        samr_GroupInfoAll        all2;
463         } samr_GroupInfo;
464
465         NTSTATUS samr_QueryGroupInfo(
466                 [in,ref]                  policy_handle *group_handle,
467                 [in]                      samr_GroupInfoEnum level,
468                 [out,switch_is(level),unique] samr_GroupInfo *info
469                 );
470
471         /************************/
472         /* Function    0x15     */
473         NTSTATUS samr_SetGroupInfo(
474                 [in,ref]                  policy_handle *group_handle,
475                 [in]                      samr_GroupInfoEnum level,
476                 [in,switch_is(level),ref] samr_GroupInfo *info
477                 );
478
479         /************************/
480         /* Function    0x16     */
481         NTSTATUS samr_AddGroupMember(
482                 [in,ref]                  policy_handle *group_handle,
483                 [in]                      uint32 rid,
484                 [in]                      uint32 flags
485                 );
486
487         /************************/
488         /* Function    0x17     */
489         NTSTATUS samr_DeleteDomainGroup(
490                 [in,out,ref]   policy_handle *group_handle
491                 );
492
493         /************************/
494         /* Function    0x18     */
495         NTSTATUS samr_DeleteGroupMember(
496                 [in,ref]                  policy_handle *group_handle,
497                 [in]                      uint32 rid
498                 );
499
500
501         /************************/
502         /* Function    0x19     */
503         typedef struct {
504                 uint32 count;
505                 [size_is(count)] uint32 *rids;
506                 [size_is(count)] uint32 *types;
507         } samr_RidTypeArray;
508
509         NTSTATUS samr_QueryGroupMember(
510                 [in,ref]  policy_handle *group_handle,
511                 [out,unique] samr_RidTypeArray *rids
512                 );
513
514
515         /************************/
516         /* Function    0x1a     */
517
518         /*
519           win2003 seems to accept any data at all for the two integers
520           below, and doesn't seem to do anything with them that I can
521           see. Weird. I really expected the first integer to be a rid
522           and the second to be the attributes for that rid member.
523         */
524         NTSTATUS samr_SetMemberAttributesOfGroup(
525                 [in,ref]  policy_handle *group_handle,
526                 [in]      uint32 unknown1,
527                 [in]      uint32 unknown2
528                 );
529
530
531         /************************/
532         /* Function    0x1b     */
533         NTSTATUS samr_OpenAlias (
534                 [in,ref]      policy_handle *domain_handle,
535                 [in]          samr_AliasAccessMask access_mask,
536                 [in]          uint32 rid,
537                 [out,ref]     policy_handle *alias_handle
538                 );
539
540
541         /************************/
542         /* Function    0x1c     */
543
544         typedef struct {
545                 lsa_String name;
546                 uint32 num_members;
547                 lsa_String description;
548         } samr_AliasInfoAll;
549
550         typedef enum {
551                 ALIASINFOALL          = 1,
552                 ALIASINFONAME         = 2,
553                 ALIASINFODESCRIPTION  = 3
554         } samr_AliasInfoEnum;
555
556         typedef [switch_type(samr_AliasInfoEnum)] union {
557                 [case(ALIASINFOALL)] samr_AliasInfoAll all;
558                 [case(ALIASINFONAME)] lsa_String name;
559                 [case(ALIASINFODESCRIPTION)] lsa_String description;
560         } samr_AliasInfo;
561
562         NTSTATUS samr_QueryAliasInfo(
563                 [in,ref]                  policy_handle  *alias_handle,
564                 [in]                      samr_AliasInfoEnum      level,
565                 [out,switch_is(level),unique] samr_AliasInfo *info
566                 );
567
568         /************************/
569         /* Function    0x1d     */
570         NTSTATUS samr_SetAliasInfo(
571                 [in,ref]                  policy_handle  *alias_handle,
572                 [in]                      samr_AliasInfoEnum      level,
573                 [in,switch_is(level),ref] samr_AliasInfo *info
574                 );
575
576         /************************/
577         /* Function    0x1e     */
578         NTSTATUS samr_DeleteDomAlias(
579                 [in,out,ref]  policy_handle *alias_handle
580                 );
581
582         /************************/
583         /* Function    0x1f     */
584         NTSTATUS samr_AddAliasMember(
585                 [in,ref]  policy_handle *alias_handle,
586                 [in,ref]  dom_sid2      *sid
587                 );
588
589         /************************/
590         /* Function    0x20     */
591         NTSTATUS samr_DeleteAliasMember(
592                 [in,ref] policy_handle *alias_handle,
593                 [in,ref] dom_sid2      *sid
594                 );
595
596         /************************/
597         /* Function    0x21     */
598         NTSTATUS samr_GetMembersInAlias(
599                 [in,ref]   policy_handle *alias_handle,
600                 [out,ref]  lsa_SidArray    *sids
601                 );
602
603         /************************/
604         /* Function    0x22     */
605         [public] NTSTATUS samr_OpenUser(
606                 [in,ref]      policy_handle *domain_handle,
607                 [in]          samr_UserAccessMask access_mask,
608                 [in]          uint32 rid,
609                 [out,ref]     policy_handle *user_handle
610                 );
611
612         /************************/
613         /* Function    0x23     */
614         NTSTATUS samr_DeleteUser(
615                 [in,out,ref]   policy_handle *user_handle
616                 );
617
618         /************************/
619         /* Function    0x24     */
620         typedef struct {
621                 lsa_String account_name;
622                 lsa_String full_name;
623                 uint32 primary_gid;
624                 lsa_String description;
625                 lsa_String comment;
626         } samr_UserInfo1;
627
628         typedef struct {
629                 lsa_String comment;
630                 lsa_String unknown; /* settable, but doesn't stick. probably obsolete */
631                 uint16 country_code;
632                 uint16 code_page;
633         } samr_UserInfo2;
634
635         /* this is also used in samr and netlogon */
636         typedef [public, flag(NDR_PAHEX)] struct {
637                 uint16 units_per_week;
638                 [size_is(1260), length_is(units_per_week/8)] uint8 *bits;
639         } samr_LogonHours;
640
641         typedef struct {
642                 lsa_String account_name;
643                 lsa_String full_name;
644                 uint32 rid;
645                 uint32 primary_gid;
646                 lsa_String home_directory;
647                 lsa_String home_drive;
648                 lsa_String logon_script;
649                 lsa_String profile_path;
650                 lsa_String workstations;
651                 NTTIME last_logon;
652                 NTTIME last_logoff;
653                 NTTIME last_password_change;
654                 NTTIME allow_password_change;
655                 NTTIME force_password_change;
656                 samr_LogonHours logon_hours;
657                 uint16 bad_password_count;
658                 uint16 logon_count;
659                 samr_AcctFlags acct_flags;
660         } samr_UserInfo3;
661
662         typedef struct {
663                 samr_LogonHours logon_hours;
664         } samr_UserInfo4;
665
666         typedef struct {
667                 lsa_String account_name;
668                 lsa_String full_name;
669                 uint32 rid;
670                 uint32 primary_gid;
671                 lsa_String home_directory;
672                 lsa_String home_drive;
673                 lsa_String logon_script;
674                 lsa_String profile_path;
675                 lsa_String description;
676                 lsa_String workstations;
677                 NTTIME last_logon;
678                 NTTIME last_logoff;
679                 samr_LogonHours logon_hours;
680                 uint16 bad_password_count;
681                 uint16 logon_count;
682                 NTTIME last_password_change;
683                 NTTIME acct_expiry;
684                 samr_AcctFlags acct_flags;
685         } samr_UserInfo5;
686
687         typedef struct {
688                 lsa_String account_name;
689                 lsa_String full_name;
690         } samr_UserInfo6;
691
692         typedef struct {
693                 lsa_String account_name;
694         } samr_UserInfo7;
695
696         typedef struct {
697                 lsa_String full_name;
698         } samr_UserInfo8;
699
700         typedef struct {
701                 uint32 primary_gid;
702         } samr_UserInfo9;
703
704         typedef struct {
705                 lsa_String home_directory;
706                 lsa_String home_drive;
707         } samr_UserInfo10;
708
709         typedef struct {
710                 lsa_String logon_script;
711         } samr_UserInfo11;
712
713         typedef struct {
714                 lsa_String profile_path;
715         } samr_UserInfo12;
716
717         typedef struct {
718                 lsa_String description;
719         } samr_UserInfo13;
720
721         typedef struct {
722                 lsa_String workstations;
723         } samr_UserInfo14;
724
725         typedef struct {
726                 samr_AcctFlags acct_flags;
727         } samr_UserInfo16;
728         
729         typedef struct {
730                 NTTIME acct_expiry;
731         } samr_UserInfo17;
732
733         typedef struct {
734                 lsa_String parameters;
735         } samr_UserInfo20;
736
737         /* this defines the bits used for fields_present in info21 */
738         typedef [bitmap32bit] bitmap {
739                 SAMR_FIELD_ACCOUNT_NAME     = 0x00000001,
740                 SAMR_FIELD_FULL_NAME        = 0x00000002,
741                 SAMR_FIELD_RID              = 0x00000004,
742                 SAMR_FIELD_PRIMARY_GID      = 0x00000008,
743                 SAMR_FIELD_DESCRIPTION      = 0x00000010,
744                 SAMR_FIELD_COMMENT          = 0x00000020,
745                 SAMR_FIELD_HOME_DIRECTORY   = 0x00000040,
746                 SAMR_FIELD_HOME_DRIVE       = 0x00000080,
747                 SAMR_FIELD_LOGON_SCRIPT     = 0x00000100,
748                 SAMR_FIELD_PROFILE_PATH     = 0x00000200,
749                 SAMR_FIELD_WORKSTATIONS     = 0x00000400,
750                 SAMR_FIELD_LAST_LOGON       = 0x00000800,
751                 SAMR_FIELD_LAST_LOGOFF      = 0x00001000,
752                 SAMR_FIELD_LOGON_HOURS      = 0x00002000,
753                 SAMR_FIELD_BAD_PWD_COUNT    = 0x00004000,
754                 SAMR_FIELD_NUM_LOGONS       = 0x00008000,
755                 SAMR_FIELD_ALLOW_PWD_CHANGE = 0x00010000,
756                 SAMR_FIELD_FORCE_PWD_CHANGE = 0x00020000,
757                 SAMR_FIELD_LAST_PWD_CHANGE  = 0x00040000,
758                 SAMR_FIELD_ACCT_EXPIRY      = 0x00080000,
759                 SAMR_FIELD_ACCT_FLAGS       = 0x00100000,
760                 SAMR_FIELD_PARAMETERS       = 0x00200000,
761                 SAMR_FIELD_COUNTRY_CODE     = 0x00400000,
762                 SAMR_FIELD_CODE_PAGE        = 0x00800000,
763                 SAMR_FIELD_PASSWORD         = 0x01000000, /* either of these */
764                 SAMR_FIELD_PASSWORD2        = 0x02000000, /* two bits seems to work */
765                 SAMR_FIELD_PRIVATE_DATA     = 0x04000000,
766                 SAMR_FIELD_EXPIRED_FLAG     = 0x08000000,
767                 SAMR_FIELD_SEC_DESC         = 0x10000000,
768                 SAMR_FIELD_OWF_PWD          = 0x20000000
769         } samr_FieldsPresent;
770
771         typedef struct {
772                 NTTIME last_logon;
773                 NTTIME last_logoff;
774                 NTTIME last_password_change;
775                 NTTIME acct_expiry;
776                 NTTIME allow_password_change;
777                 NTTIME force_password_change;
778                 lsa_String account_name;
779                 lsa_String full_name;
780                 lsa_String home_directory;
781                 lsa_String home_drive;
782                 lsa_String logon_script;
783                 lsa_String profile_path;
784                 lsa_String description;
785                 lsa_String workstations;
786                 lsa_String comment;
787                 lsa_String parameters;
788                 lsa_String unknown1;
789                 lsa_String unknown2;
790                 lsa_String unknown3;
791                 uint32 buf_count;
792                 [size_is(buf_count)] uint8 *buffer;
793                 uint32 rid;
794                 uint32 primary_gid;
795                 samr_AcctFlags acct_flags;
796                 samr_FieldsPresent fields_present;
797                 samr_LogonHours logon_hours;
798                 uint16 bad_password_count;
799                 uint16 logon_count;
800                 uint16 country_code;
801                 uint16 code_page;
802                 uint8  nt_password_set;
803                 uint8  lm_password_set;
804                 uint8  password_expired;
805                 uint8  unknown4;
806         } samr_UserInfo21;
807
808         typedef [public, flag(NDR_PAHEX)] struct {
809                 uint8 data[516];
810         } samr_CryptPassword;
811
812         typedef struct {
813                 samr_UserInfo21 info;
814                 samr_CryptPassword password;
815         } samr_UserInfo23;
816
817         typedef struct {
818                 samr_CryptPassword password;
819                 uint8 pw_len;
820         } samr_UserInfo24;
821
822         typedef [flag(NDR_PAHEX)] struct {
823                 uint8 data[532];
824         } samr_CryptPasswordEx;
825
826         typedef struct {
827                 samr_UserInfo21 info;
828                 samr_CryptPasswordEx password;
829         } samr_UserInfo25;
830
831         typedef struct {
832                 samr_CryptPasswordEx password;
833                 uint8 pw_len;
834         } samr_UserInfo26;
835
836         typedef [switch_type(uint16)] union {
837                 [case(1)] samr_UserInfo1 info1;
838                 [case(2)] samr_UserInfo2 info2;
839                 [case(3)] samr_UserInfo3 info3;
840                 [case(4)] samr_UserInfo4 info4;
841                 [case(5)] samr_UserInfo5 info5;
842                 [case(6)] samr_UserInfo6 info6;
843                 [case(7)] samr_UserInfo7 info7;
844                 [case(8)] samr_UserInfo8 info8;
845                 [case(9)] samr_UserInfo9 info9;
846                 [case(10)] samr_UserInfo10 info10;
847                 [case(11)] samr_UserInfo11 info11;
848                 [case(12)] samr_UserInfo12 info12;
849                 [case(13)] samr_UserInfo13 info13;
850                 [case(14)] samr_UserInfo14 info14;
851                 [case(16)] samr_UserInfo16 info16;
852                 [case(17)] samr_UserInfo17 info17;
853                 [case(20)] samr_UserInfo20 info20;
854                 [case(21)] samr_UserInfo21 info21;
855                 [case(23)] samr_UserInfo23 info23;
856                 [case(24)] samr_UserInfo24 info24;
857                 [case(25)] samr_UserInfo25 info25;
858                 [case(26)] samr_UserInfo26 info26;
859         } samr_UserInfo;
860
861         [public] NTSTATUS samr_QueryUserInfo(
862                 [in,ref]                  policy_handle *user_handle,
863                 [in]                      uint16 level,
864                 [out,unique,switch_is(level)] samr_UserInfo *info
865                 );
866
867
868         /************************/
869         /* Function    0x25     */
870         [public] NTSTATUS samr_SetUserInfo(
871                 [in,ref]                   policy_handle *user_handle,
872                 [in]                       uint16 level,
873                 [in,ref,switch_is(level)]  samr_UserInfo *info
874                 );
875
876         /************************/
877         /* Function    0x26     */
878         typedef [public, flag(NDR_PAHEX)] struct {
879                 uint8 hash[16];
880         } samr_Password;
881
882         /*
883           this is a password change interface that doesn't give
884           the server the plaintext password. Depricated.
885         */
886         NTSTATUS samr_ChangePasswordUser(
887                 [in,ref]    policy_handle *user_handle,
888                 [in]        boolean8 lm_present,
889                 [in,unique] samr_Password *old_lm_crypted,
890                 [in,unique] samr_Password *new_lm_crypted,
891                 [in]        boolean8 nt_present,
892                 [in,unique] samr_Password *old_nt_crypted,
893                 [in,unique] samr_Password *new_nt_crypted,
894                 [in]        boolean8 cross1_present,
895                 [in,unique] samr_Password *nt_cross,
896                 [in]        boolean8 cross2_present,
897                 [in,unique] samr_Password *lm_cross
898                 );
899
900         /************************/
901         /* Function    0x27     */
902
903         typedef [public] struct {
904                 uint32 rid;
905                 samr_GroupAttrs attributes;
906         } samr_RidWithAttribute;
907
908         typedef [public] struct {
909                 uint32     count;
910                 [size_is(count)] samr_RidWithAttribute *rids;
911         } samr_RidWithAttributeArray;
912
913         NTSTATUS samr_GetGroupsForUser(
914                 [in,ref]   policy_handle *user_handle,
915                 [out,unique] samr_RidWithAttributeArray  *rids
916                 );
917
918         /************************/
919         /* Function    0x28     */
920
921         typedef struct {
922                 uint32    idx;
923                 uint32    rid;
924                 samr_AcctFlags acct_flags;
925                 lsa_String account_name;
926                 lsa_String description;
927                 lsa_String full_name;
928         } samr_DispEntryGeneral;
929
930         typedef struct {
931                 uint32 count;
932                 [size_is(count)] samr_DispEntryGeneral *entries;
933         } samr_DispInfoGeneral;
934
935         typedef struct {
936                 uint32    idx;
937                 uint32    rid;
938                 samr_AcctFlags acct_flags;
939                 lsa_String account_name;
940                 lsa_String description;
941         } samr_DispEntryFull;
942
943         typedef struct {
944                 uint32 count;
945                 [size_is(count)] samr_DispEntryFull *entries;
946         } samr_DispInfoFull;
947
948         typedef struct {
949                 uint32    idx;
950                 uint32    rid;
951                 samr_GroupAttrs acct_flags;
952                 lsa_String account_name;
953                 lsa_String description;
954         } samr_DispEntryFullGroup;
955
956         typedef struct {
957                 uint32 count;
958                 [size_is(count)] samr_DispEntryFullGroup *entries;
959         } samr_DispInfoFullGroups;
960
961         typedef struct {
962                 uint32    idx;
963                 lsa_AsciiStringLarge account_name;
964         } samr_DispEntryAscii;
965
966         typedef struct {
967                 uint32 count;
968                 [size_is(count)] samr_DispEntryAscii *entries;
969         } samr_DispInfoAscii;
970
971         typedef [switch_type(uint16)] union {
972                 [case(1)] samr_DispInfoGeneral info1;/* users */
973                 [case(2)] samr_DispInfoFull info2; /* trust accounts? */
974                 [case(3)] samr_DispInfoFullGroups info3; /* groups */
975                 [case(4)] samr_DispInfoAscii info4; /* users */
976                 [case(5)] samr_DispInfoAscii info5; /* groups */
977         } samr_DispInfo;
978
979         NTSTATUS samr_QueryDisplayInfo(
980                 [in,ref]    policy_handle *domain_handle,
981                 [in]        uint16 level,
982                 [in]        uint32 start_idx,
983                 [in]        uint32 max_entries,
984                 [in]        uint32 buf_size,
985                 [out]       uint32 total_size,
986                 [out]       uint32 returned_size,
987                 [out,switch_is(level)] samr_DispInfo info
988                 );
989
990
991         /************************/
992         /* Function    0x29     */
993
994         /*
995           this seems to be an alphabetic search function. The returned index
996           is the index for samr_QueryDisplayInfo needed to get names occurring
997           after the specified name. The supplied name does not need to exist
998           in the database (for example you can supply just a first letter for 
999           searching starting at that letter)
1000
1001           The level corresponds to the samr_QueryDisplayInfo level
1002         */
1003         NTSTATUS samr_GetDisplayEnumerationIndex(
1004                 [in,ref]    policy_handle *domain_handle,
1005                 [in]        uint16 level,
1006                 [in]        lsa_String name,
1007                 [out]       uint32 idx
1008                 );
1009
1010
1011
1012         /************************/
1013         /* Function    0x2a     */
1014
1015         /*
1016           w2k3 returns NT_STATUS_NOT_IMPLEMENTED for this
1017         */
1018         NTSTATUS samr_TestPrivateFunctionsDomain(
1019                 [in,ref]    policy_handle *domain_handle
1020                 );
1021
1022
1023         /************************/
1024         /* Function    0x2b     */
1025
1026         /*
1027           w2k3 returns NT_STATUS_NOT_IMPLEMENTED for this
1028         */
1029         NTSTATUS samr_TestPrivateFunctionsUser(
1030                 [in,ref]    policy_handle *user_handle
1031                 );
1032
1033
1034         /************************/
1035         /* Function    0x2c     */
1036
1037         typedef struct {
1038                 uint16 min_password_length;
1039                 samr_PasswordProperties password_properties;
1040         } samr_PwInfo;
1041
1042         [public] NTSTATUS samr_GetUserPwInfo(
1043                 [in,ref]    policy_handle *user_handle,
1044                 [out]       samr_PwInfo info
1045                 );
1046
1047         /************************/
1048         /* Function    0x2d     */
1049         NTSTATUS samr_RemoveMemberFromForeignDomain(
1050                 [in,ref]    policy_handle *domain_handle,
1051                 [in,ref]    dom_sid2 *sid
1052                 );
1053
1054         /************************/
1055         /* Function    0x2e     */
1056
1057         /*
1058           how is this different from QueryDomainInfo ??
1059         */
1060         NTSTATUS samr_QueryDomainInfo2(
1061                 [in,ref]      policy_handle *domain_handle,
1062                 [in]          uint16 level,
1063                 [out,unique,switch_is(level)] samr_DomainInfo *info
1064                 );
1065
1066         /************************/
1067         /* Function    0x2f     */
1068
1069         /*
1070           how is this different from QueryUserInfo ??
1071         */
1072         NTSTATUS samr_QueryUserInfo2(
1073                 [in,ref]                  policy_handle *user_handle,
1074                 [in]                      uint16 level,
1075                 [out,unique,switch_is(level)]    samr_UserInfo *info
1076                 );
1077
1078         /************************/
1079         /* Function    0x30     */
1080
1081         /*
1082           how is this different from QueryDisplayInfo??
1083         */
1084         NTSTATUS samr_QueryDisplayInfo2(
1085                 [in,ref]    policy_handle *domain_handle,
1086                 [in]        uint16 level,
1087                 [in]        uint32 start_idx,
1088                 [in]        uint32 max_entries,
1089                 [in]        uint32 buf_size,
1090                 [out]       uint32 total_size,
1091                 [out]       uint32 returned_size,
1092                 [out,switch_is(level)] samr_DispInfo info
1093                 );
1094
1095         /************************/
1096         /* Function    0x31     */
1097
1098         /*
1099           how is this different from GetDisplayEnumerationIndex ??
1100         */
1101         NTSTATUS samr_GetDisplayEnumerationIndex2(
1102                 [in,ref]    policy_handle *domain_handle,
1103                 [in]        uint16 level,
1104                 [in]        lsa_String name,
1105                 [out]       uint32 idx
1106                 );
1107
1108
1109         /************************/
1110         /* Function    0x32     */
1111         NTSTATUS samr_CreateUser2(
1112                 [in,ref]      policy_handle *domain_handle,
1113                 [in,ref]      lsa_String *account_name,
1114                 [in]          samr_AcctFlags acct_flags,
1115                 [in]          samr_UserAccessMask access_mask,
1116                 [out,ref]     policy_handle *user_handle,
1117                 [out,ref]     uint32 *access_granted,
1118                 [out,ref]     uint32 *rid
1119                 );
1120
1121
1122         /************************/
1123         /* Function    0x33     */
1124
1125         /*
1126           another duplicate. There must be a reason ....
1127         */
1128         NTSTATUS samr_QueryDisplayInfo3(
1129                 [in,ref]    policy_handle *domain_handle,
1130                 [in]        uint16 level,
1131                 [in]        uint32 start_idx,
1132                 [in]        uint32 max_entries,
1133                 [in]        uint32 buf_size,
1134                 [out]       uint32 total_size,
1135                 [out]       uint32 returned_size,
1136                 [out,switch_is(level)] samr_DispInfo info
1137                 );
1138
1139         /************************/
1140         /* Function    0x34     */
1141         NTSTATUS samr_AddMultipleMembersToAlias(
1142                 [in,ref]    policy_handle *alias_handle,
1143                 [in,ref]    lsa_SidArray *sids
1144                 );
1145
1146         /************************/
1147         /* Function    0x35     */
1148         NTSTATUS samr_RemoveMultipleMembersFromAlias(
1149                 [in,ref]    policy_handle *alias_handle,
1150                 [in,ref]    lsa_SidArray *sids
1151                 );
1152
1153         /************************/
1154         /* Function    0x36     */
1155
1156         NTSTATUS samr_OemChangePasswordUser2(
1157                 [in,unique]       lsa_AsciiString *server,
1158                 [in,ref]          lsa_AsciiString *account,
1159                 [in,unique]       samr_CryptPassword *password,
1160                 [in,unique]       samr_Password *hash
1161                 );
1162
1163         /************************/
1164         /* Function    0x37     */
1165         NTSTATUS samr_ChangePasswordUser2(
1166                 [in,unique]       lsa_String *server,
1167                 [in,ref]          lsa_String *account,
1168                 [in,unique]       samr_CryptPassword *nt_password,
1169                 [in,unique]       samr_Password *nt_verifier,
1170                 [in]              boolean8 lm_change,
1171                 [in,unique]       samr_CryptPassword *lm_password,
1172                 [in,unique]       samr_Password *lm_verifier
1173                 );
1174
1175         /************************/
1176         /* Function    0x38     */
1177         NTSTATUS samr_GetDomPwInfo(
1178                 [in,unique] lsa_String *domain_name,
1179                 [out]       samr_PwInfo info
1180                 );
1181
1182         /************************/
1183         /* Function    0x39     */
1184         NTSTATUS samr_Connect2(
1185                 [in,unique,string,charset(UTF16)] uint16 *system_name,
1186                 [in] samr_ConnectAccessMask access_mask,
1187                 [out,ref]  policy_handle *connect_handle
1188                 );
1189
1190         /************************/
1191         /* Function    0x3a     */
1192         /*
1193           seems to be an exact alias for samr_SetUserInfo() 
1194         */
1195         [public] NTSTATUS samr_SetUserInfo2(
1196                 [in,ref]                   policy_handle *user_handle,
1197                 [in]                       uint16 level,
1198                 [in,ref,switch_is(level)]  samr_UserInfo *info
1199                 );
1200
1201         /************************/
1202         /* Function    0x3b     */
1203         /*
1204           this one is mysterious. I have a few guesses, but nothing working yet
1205         */
1206         NTSTATUS samr_SetBootKeyInformation(
1207                 [in,ref]   policy_handle *connect_handle,
1208                 [in]       uint32 unknown1,
1209                 [in]       uint32 unknown2,
1210                 [in]       uint32 unknown3
1211                 );
1212
1213         /************************/
1214         /* Function    0x3c     */
1215         NTSTATUS samr_GetBootKeyInformation(
1216                 [in,ref]   policy_handle *domain_handle,
1217                 [out]      uint32 unknown
1218                 );
1219
1220         /************************/
1221         /* Function    0x3d     */
1222         NTSTATUS samr_Connect3(
1223                 [in,unique,string,charset(UTF16)] uint16 *system_name,
1224                 /* this unknown value seems to be completely ignored by w2k3 */
1225                 [in] uint32 unknown,
1226                 [in] samr_ConnectAccessMask access_mask,
1227                 [out,ref]  policy_handle *connect_handle
1228                 );
1229
1230         /************************/
1231         /* Function    0x3e     */
1232         NTSTATUS samr_Connect4(
1233                 [in,unique,string,charset(UTF16)] uint16 *system_name,
1234                 [in] uint32 unknown,
1235                 [in] samr_ConnectAccessMask access_mask,
1236                 [out,ref]  policy_handle *connect_handle
1237                 );
1238
1239         /************************/
1240         /* Function    0x3f     */
1241
1242         typedef enum samr_RejectReason samr_RejectReason;
1243
1244         typedef struct {
1245                 samr_RejectReason reason;
1246                 uint32 unknown1;
1247                 uint32 unknown2;
1248         } samr_ChangeReject;
1249
1250         NTSTATUS samr_ChangePasswordUser3(
1251                 [in,unique]       lsa_String *server,
1252                 [in,ref]          lsa_String *account,
1253                 [in,unique]       samr_CryptPassword *nt_password,
1254                 [in,unique]       samr_Password *nt_verifier,
1255                 [in]              boolean8 lm_change,
1256                 [in,unique]       samr_CryptPassword *lm_password,
1257                 [in,unique]       samr_Password *lm_verifier,
1258                 [in,unique]       samr_CryptPassword *password3,
1259                 [out,unique]      samr_DomInfo1 *dominfo,
1260                 [out,unique]      samr_ChangeReject *reject
1261                 );
1262
1263         /************************/
1264         /* Function    0x40      */
1265
1266         typedef struct {
1267                 uint32         unknown1; /* w2k3 gives 3 */
1268                 uint32         unknown2; /* w2k3 gives 0 */
1269         } samr_ConnectInfo1;
1270
1271         typedef union {
1272                 [case(1)]  samr_ConnectInfo1 info1;
1273         } samr_ConnectInfo;
1274
1275         [public] NTSTATUS samr_Connect5(
1276                 [in,unique,string,charset(UTF16)] uint16 *system_name,
1277                 [in]       samr_ConnectAccessMask  access_mask,
1278                 [in,out]   uint32             level,
1279                 [in,out,switch_is(level),ref] samr_ConnectInfo *info,
1280                 [out,ref]  policy_handle      *connect_handle
1281                 );
1282
1283         /************************/
1284         /* Function    0x41     */
1285         NTSTATUS samr_RidToSid(
1286                 [in,ref]    policy_handle *domain_handle,
1287                 [in]        uint32        rid,
1288                 [out,unique] dom_sid2      *sid
1289                 );
1290
1291
1292         /************************/
1293         /* Function    0x42     */
1294
1295         /*
1296           this should set the DSRM password for the server, which is used
1297           when booting into Directory Services Recovery Mode on a DC. Win2003
1298           gives me NT_STATUS_NOT_SUPPORTED
1299         */
1300
1301         NTSTATUS samr_SetDsrmPassword(
1302                 [in,unique] lsa_String *name,
1303                 [in]       uint32 unknown,
1304                 [in,unique] samr_Password *hash
1305                 );
1306
1307
1308         /************************/
1309         /* Function    0x43     */
1310         /************************/
1311         typedef [bitmap32bit] bitmap {
1312                 SAMR_VALIDATE_FIELD_PASSWORD_LAST_SET           = 0x00000001,
1313                 SAMR_VALIDATE_FIELD_BAD_PASSWORD_TIME           = 0x00000002,
1314                 SAMR_VALIDATE_FIELD_LOCKOUT_TIME                = 0x00000004,
1315                 SAMR_VALIDATE_FIELD_BAD_PASSWORD_COUNT          = 0x00000008,
1316                 SAMR_VALIDATE_FIELD_PASSWORD_HISTORY_LENGTH     = 0x00000010,
1317                 SAMR_VALIDATE_FIELD_PASSWORD_HISTORY            = 0x00000020
1318         } samr_ValidateFieldsPresent;
1319
1320         typedef enum {
1321                 NetValidateAuthentication = 1,
1322                 NetValidatePasswordChange= 2,
1323                 NetValidatePasswordReset = 3
1324         } samr_ValidatePasswordLevel;
1325
1326         /* NetApi maps samr_ValidationStatus errors to WERRORs. Haven't
1327          * identified the mapping of
1328          * - NERR_PasswordFilterError
1329          * - NERR_PasswordExpired and
1330          * - NERR_PasswordCantChange
1331          * yet - Guenther
1332          */
1333
1334         typedef enum {
1335                 SAMR_VALIDATION_STATUS_SUCCESS = 0,
1336                 SAMR_VALIDATION_STATUS_PASSWORD_MUST_CHANGE = 1,
1337                 SAMR_VALIDATION_STATUS_ACCOUNT_LOCKED_OUT = 2,
1338                 SAMR_VALIDATION_STATUS_BAD_PASSWORD = 4,
1339                 SAMR_VALIDATION_STATUS_PWD_HISTORY_CONFLICT = 5,
1340                 SAMR_VALIDATION_STATUS_PWD_TOO_SHORT = 6,
1341                 SAMR_VALIDATION_STATUS_PWD_TOO_LONG = 7,
1342                 SAMR_VALIDATION_STATUS_NOT_COMPLEX_ENOUGH = 8,
1343                 SAMR_VALIDATION_STATUS_PASSWORD_TOO_RECENT = 9
1344         } samr_ValidationStatus;
1345
1346         typedef struct {
1347                 uint32 length;
1348                 [size_is(length)] uint8 *data;
1349         } samr_ValidationBlob;
1350
1351         typedef struct {
1352                 samr_ValidateFieldsPresent fields_present;
1353                 NTTIME_hyper last_password_change;
1354                 NTTIME_hyper bad_password_time;
1355                 NTTIME_hyper lockout_time;
1356                 uint32 bad_pwd_count;
1357                 uint32 pwd_history_len;
1358                 [size_is(pwd_history_len)] samr_ValidationBlob *pwd_history;
1359         } samr_ValidatePasswordInfo;
1360
1361         typedef struct {
1362                 samr_ValidatePasswordInfo info;
1363                 samr_ValidationStatus status;
1364         } samr_ValidatePasswordRepCtr;
1365
1366         typedef [switch_type(uint16)] union {
1367                 [case(1)] samr_ValidatePasswordRepCtr ctr1;
1368                 [case(2)] samr_ValidatePasswordRepCtr ctr2;
1369                 [case(3)] samr_ValidatePasswordRepCtr ctr3;
1370         } samr_ValidatePasswordRep;
1371
1372         typedef struct {
1373                 samr_ValidatePasswordInfo info;
1374                 lsa_StringLarge password;
1375                 lsa_StringLarge account;
1376                 samr_ValidationBlob hash;
1377                 boolean8 pwd_must_change_at_next_logon;
1378                 boolean8 clear_lockout;
1379         } samr_ValidatePasswordReq3;
1380
1381         typedef struct {
1382                 samr_ValidatePasswordInfo info;
1383                 lsa_StringLarge password;
1384                 lsa_StringLarge account;
1385                 samr_ValidationBlob hash;
1386                 boolean8 password_matched;
1387         } samr_ValidatePasswordReq2;
1388
1389         typedef struct {
1390                 samr_ValidatePasswordInfo info;
1391                 boolean8 password_matched;
1392         } samr_ValidatePasswordReq1;
1393
1394         typedef [switch_type(uint16)] union {
1395                 [case(1)] samr_ValidatePasswordReq1 req1;
1396                 [case(2)] samr_ValidatePasswordReq2 req2;
1397                 [case(3)] samr_ValidatePasswordReq3 req3;
1398         } samr_ValidatePasswordReq;
1399
1400         NTSTATUS samr_ValidatePassword(
1401                 [in] samr_ValidatePasswordLevel level,
1402                 [in,switch_is(level)] samr_ValidatePasswordReq req,
1403                 [out,unique,switch_is(level)] samr_ValidatePasswordRep *rep
1404                 );
1405 }