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