#define SAMR_CLOSE_HND 0x01
#define SAMR_UNKNOWN_3 0x03
+#define SAMR_LOOKUP_DOMAIN 0x05
#define SAMR_OPEN_DOMAIN 0x07
#define SAMR_QUERY_DOMAIN_INFO 0x08
#define SAMR_CREATE_DOM_GROUP 0x0a
+#define SAMR_ENUM_DOM_GROUPS 0x0b
#define SAMR_ENUM_DOM_USERS 0x0d
#define SAMR_CREATE_DOM_ALIAS 0x0e
#define SAMR_ENUM_DOM_ALIASES 0x0f
#define SAMR_QUERY_GROUPINFO 0x14
#define SAMR_SET_GROUPINFO 0x15
#define SAMR_ADD_GROUPMEM 0x16
+#define SAMR_DELETE_DOM_GROUP 0x17
+#define SAMR_DEL_GROUPMEM 0x18
#define SAMR_QUERY_GROUPMEM 0x19
#define SAMR_OPEN_ALIAS 0x1b
#define SAMR_QUERY_DISPINFO 0x28
#define SAMR_UNKNOWN_2C 0x2c
-#define SAMR_ENUM_DOM_GROUPS 0x30
+#define SAMR_QUERY_DISPINFO3 0x30 /* Alias for SAMR_QUERY_DISPINFO
+ with info level 3 */
#define SAMR_UNKNOWN_32 0x32
+#define SAMR_QUERY_DISPINFO4 0x33 /* Alias for SAMR_QUERY_DISPINFO
+ with info level 4 */
#define SAMR_UNKNOWN_34 0x34
#define SAMR_CHGPASSWD_USER 0x37
} SAMR_Q_QUERY_DOMAIN_INFO;
-typedef struct sam_unkown_info_2_info
+typedef struct sam_unknown_info_6_info
+{
+ uint32 unknown_0; /* 0x0000 0000 */
+
+ uint32 ptr_0; /* pointer to unknown structure */
+ uint8 padding[12]; /* 12 bytes zeros */
+
+} SAM_UNK_INFO_6;
+
+typedef struct sam_unknown_info_7_info
+{
+ uint16 unknown_0; /* 0x0003 */
+
+} SAM_UNK_INFO_7;
+
+typedef struct sam_unknown_info_2_info
{
uint32 unknown_0; /* 0x0000 0000 */
uint32 unknown_1; /* 0x8000 0000 */
union
{
SAM_UNK_INFO_2 inf2;
+ SAM_UNK_INFO_6 inf6;
+ SAM_UNK_INFO_7 inf7;
} info;
} SAMR_R_QUERY_DOMAIN_INFO;
+/* SAMR_Q_LOOKUP_DOMAIN - obtain SID for a local domain */
+typedef struct q_samr_lookup_domain_info
+{
+ POLICY_HND connect_pol;
+
+ UNIHDR hdr_domain;
+ UNISTR2 uni_domain;
+
+} SAMR_Q_LOOKUP_DOMAIN;
+
+
+/* SAMR_R_LOOKUP_DOMAIN */
+typedef struct r_samr_lookup_domain_info
+{
+ uint32 ptr_sid;
+ DOM_SID2 dom_sid;
+
+ uint32 status;
+
+} SAMR_R_LOOKUP_DOMAIN;
+
+
/****************************************************************************
SAMR_Q_OPEN_DOMAIN - unknown_0 values seen associated with SIDs:
} SAM_ENTRY;
+
/* SAMR_Q_ENUM_DOM_USERS - SAM rids and names */
typedef struct q_samr_enum_dom_users_info
{
POLICY_HND pol; /* policy handle */
- uint16 req_num_entries; /* number of values (0 indicates unlimited?) */
- uint16 unknown_0; /* enumeration context? */
+ uint32 start_idx; /* number of values (0 indicates unlimited?) */
uint16 acb_mask; /* 0x0000 indicates all */
uint16 unknown_1; /* 0x0000 */
/* SAMR_R_ENUM_DOM_USERS - SAM rids and names */
typedef struct r_samr_enum_dom_users_info
{
- uint32 unknown_0; /* unknown. */
- uint32 ptr_entries1; /* actual number of entries to follow, having masked some out */
+ uint32 next_idx; /* next starting index required for enum */
+ uint32 ptr_entries1;
uint32 num_entries2;
uint32 ptr_entries2;
} SAMR_R_ENUM_DOM_USERS;
-typedef struct samr_entry_info3
-{
- uint32 grp_idx;
-
- uint32 rid_grp;
- uint32 attr;
-
- UNIHDR hdr_grp_name;
- UNIHDR hdr_grp_desc;
-
-} SAM_ENTRY3;
-
-typedef struct samr_str_entry_info3
-{
- UNISTR2 uni_grp_name;
- UNISTR2 uni_grp_desc;
-
-} SAM_STR3;
-
/* SAMR_Q_ENUM_DOM_GROUPS - SAM rids and names */
typedef struct q_samr_enum_dom_groups_info
{
POLICY_HND pol; /* policy handle */
- /* these are possibly an enumeration context handle... */
- uint16 switch_level; /* 0x0003 */
- uint16 unknown_0; /* 0x0000 */
- uint32 start_idx; /* presumably the start enumeration index */
- uint32 unknown_1; /* 0x0000 07d0 */
+ /* this is possibly an enumeration context handle... */
+ uint32 unknown_0; /* 0x0000 0000 */
- uint32 max_size; /* 0x0000 7fff */
+ uint32 max_size; /* 0x0000 ffff */
} SAMR_Q_ENUM_DOM_GROUPS;
/* SAMR_R_ENUM_DOM_GROUPS - SAM rids and names */
typedef struct r_samr_enum_dom_groups_info
{
- uint32 unknown_0; /* 0x0000 0492 or 0x0000 00be */
- uint32 unknown_1; /* 0x0000 049a or 0x0000 00be */
- uint32 switch_level; /* 0x0000 0003 */
-
uint32 num_entries;
uint32 ptr_entries;
uint32 num_entries2;
+ uint32 ptr_entries2;
- SAM_ENTRY3 sam[MAX_SAM_ENTRIES];
- SAM_STR3 str[MAX_SAM_ENTRIES];
+ uint32 num_entries3;
+
+ SAM_ENTRY sam[MAX_SAM_ENTRIES];
+ UNISTR2 uni_grp_name[MAX_SAM_ENTRIES];
+
+ uint32 num_entries4;
uint32 status;
} SAMR_R_ENUM_DOM_GROUPS;
-
/* SAMR_Q_ENUM_DOM_ALIASES - SAM rids and names */
typedef struct q_samr_enum_dom_aliases_info
{
} SAMR_Q_ENUM_DOM_ALIASES;
+
/* SAMR_R_ENUM_DOM_ALIASES - SAM rids and names */
typedef struct r_samr_enum_dom_aliases_info
{
} SAMR_R_ENUM_DOM_ALIASES;
-
-/* SAMR_Q_QUERY_DISPINFO - SAM rids, names and descriptions */
-typedef struct q_samr_query_disp_info
-{
- POLICY_HND pol; /* policy handle */
-
- uint16 switch_level; /* 0x0001 and 0x0002 seen */
- uint16 unknown_0; /* 0x0000 and 0x2000 seen */
- uint32 start_idx; /* presumably the start enumeration index */
- uint32 unknown_1; /* 0x0000 07d0, 0x0000 0400 and 0x0000 0200 seen */
-
- uint32 max_size; /* 0x0000 7fff, 0x0000 7ffe and 0x0000 3fff seen*/
-
-} SAMR_Q_QUERY_DISPINFO;
+/* -- Level 1 Display Info - User Information -- */
typedef struct samr_entry_info1
{
typedef struct sam_entry_info_1
{
- uint32 num_entries;
- uint32 ptr_entries;
- uint32 num_entries2;
-
SAM_ENTRY1 sam[MAX_SAM_ENTRIES];
SAM_STR1 str[MAX_SAM_ENTRIES];
+} SAM_DISPINFO_1;
+
-} SAM_INFO_1;
+/* -- Level 2 Display Info - Trust Account Information -- */
typedef struct samr_entry_info2
{
typedef struct sam_entry_info_2
{
- uint32 num_entries;
- uint32 ptr_entries;
- uint32 num_entries2;
-
SAM_ENTRY2 sam[MAX_SAM_ENTRIES];
SAM_STR2 str[MAX_SAM_ENTRIES];
-} SAM_INFO_2;
+} SAM_DISPINFO_2;
+
+
+/* -- Level 3 Display Info - Domain Group Information -- */
+
+typedef struct samr_entry_info3
+{
+ uint32 grp_idx;
+
+ uint32 rid_grp;
+ uint32 attr; /* SE_GROUP_xxx, usually 7 */
+
+ UNIHDR hdr_grp_name;
+ UNIHDR hdr_grp_desc;
+
+} SAM_ENTRY3;
+
+typedef struct samr_str_entry_info3
+{
+ UNISTR2 uni_grp_name;
+ UNISTR2 uni_grp_desc;
+
+} SAM_STR3;
+
+typedef struct sam_entry_info_3
+{
+ SAM_ENTRY3 sam[MAX_SAM_ENTRIES];
+ SAM_STR3 str[MAX_SAM_ENTRIES];
+
+} SAM_DISPINFO_3;
+
+
+/* -- Level 4 Display Info - User List (ASCII) -- */
+
+typedef struct samr_entry_info4
+{
+ uint32 user_idx;
+ STRHDR hdr_acct_name;
+
+} SAM_ENTRY4;
+
+typedef struct samr_str_entry_info4
+{
+ STRING2 acct_name;
+
+} SAM_STR4;
+
+typedef struct sam_entry_info_4
+{
+ SAM_ENTRY4 sam[MAX_SAM_ENTRIES];
+ SAM_STR4 str[MAX_SAM_ENTRIES];
+
+} SAM_DISPINFO_4;
-typedef struct sam_info_ctr_info
+
+/* -- Level 5 Display Info - Group List (ASCII) -- */
+
+typedef struct samr_entry_info5
+{
+ uint32 grp_idx;
+ STRHDR hdr_grp_name;
+
+} SAM_ENTRY5;
+
+typedef struct samr_str_entry_info5
+{
+ STRING2 grp_name;
+
+} SAM_STR5;
+
+typedef struct sam_entry_info_5
+{
+ SAM_ENTRY5 sam[MAX_SAM_ENTRIES];
+ SAM_STR5 str[MAX_SAM_ENTRIES];
+
+} SAM_DISPINFO_5;
+
+
+typedef struct sam_dispinfo_ctr_info
{
union
{
- SAM_INFO_1 *info1; /* server info */
- SAM_INFO_2 *info2; /* user info */
+ SAM_DISPINFO_1 *info1; /* users/names/descriptions */
+ SAM_DISPINFO_2 *info2; /* trust accounts */
+ SAM_DISPINFO_3 *info3; /* domain groups/descriptions */
+ SAM_DISPINFO_4 *info4; /* user list (ASCII) - used by Win95 */
+ SAM_DISPINFO_5 *info5; /* group list (ASCII) */
void *info; /* allows assignment without typecasting, */
} sam;
-} SAM_INFO_CTR;
+} SAM_DISPINFO_CTR;
+
+
+/* SAMR_Q_QUERY_DISPINFO - SAM rids, names and descriptions */
+typedef struct q_samr_query_disp_info
+{
+ POLICY_HND domain_pol;
+
+ uint16 switch_level; /* see SAM_DISPINFO_CTR above */
+ /* align */
+
+ uint32 start_idx; /* start enumeration index */
+ uint32 max_entries; /* maximum number of entries to return */
+ uint32 max_size; /* recommended data size; if exceeded server
+ should return STATUS_MORE_ENTRIES */
+
+} SAMR_Q_QUERY_DISPINFO;
-/* SAMR_R_QUERY_DISPINFO - SAM rids, names and descriptions */
+
+/* SAMR_R_QUERY_DISPINFO */
typedef struct r_samr_query_dispinfo_info
{
- uint32 unknown_0; /* container length? 0x0000 0492 or 0x0000 00be */
- uint32 unknown_1; /* container length? 0x0000 049a or 0x0000 00be */
- uint16 switch_level; /* 0x0001 or 0x0002 */
- /*uint8 pad[2] */
+ uint32 total_size; /* total data size for all matching entries
+ (0 = uncalculated) */
+ uint32 data_size; /* actual data size returned = size of SAM_ENTRY
+ structures + total length of strings */
+
+ uint16 switch_level; /* see SAM_DISPINFO_CTR above */
+ /* align */
+
+ uint32 num_entries; /* number of entries returned */
+ uint32 ptr_entries;
+ uint32 num_entries2;
- SAM_INFO_CTR *ctr;
+ SAM_DISPINFO_CTR *ctr;
uint32 status;
} SAMR_R_QUERY_DISPINFO;
+/* SAMR_Q_DELETE_DOM_GROUP - delete domain group */
+typedef struct q_samr_delete_dom_group_info
+{
+ POLICY_HND group_pol; /* policy handle */
+
+} SAMR_Q_DELETE_DOM_GROUP;
+
+
+/* SAMR_R_DELETE_DOM_GROUP - delete domain group */
+typedef struct r_samr_delete_dom_group_info
+{
+ POLICY_HND pol; /* policy handle */
+ uint32 status; /* return status */
+
+} SAMR_R_DELETE_DOM_GROUP;
+
+
/* SAMR_Q_CREATE_DOM_GROUP - SAM create group */
typedef struct q_samr_create_dom_group_info
{
/****************************************************************************
-SAMR_Q_LOOKUP_NAMES - do a conversion from SID to RID.
-
-the policy handle allocated by an "samr open secret" call is associated
-with a SID. this policy handle is what is queried here, *not* the SID
-itself. the response to the lookup rids is relative to this SID.
+SAMR_Q_LOOKUP_NAMES - do a conversion from Names to RIDs+types.
*****************************************************************************/
/* SAMR_Q_LOOKUP_NAMES */
typedef struct q_samr_lookup_names_info
{
POLICY_HND pol; /* policy handle */
- uint32 num_rids1; /* number of rids being looked up */
- uint32 rid; /* 0x0000 03e8 - RID of the server doing the query? */
+ uint32 num_names1; /* number of names being looked up */
+ uint32 flags; /* 0x0000 03e8 - unknown */
uint32 ptr; /* 0x0000 0000 - 32 bit unknown */
- uint32 num_rids2; /* number of rids being looked up */
+ uint32 num_names2; /* number of names being looked up */
- UNIHDR hdr_user_name[MAX_LOOKUP_SIDS]; /* unicode account name header */
- UNISTR2 uni_user_name[MAX_LOOKUP_SIDS]; /* unicode account name string */
+ UNIHDR hdr_name[MAX_LOOKUP_SIDS]; /* unicode account name header */
+ UNISTR2 uni_name[MAX_LOOKUP_SIDS]; /* unicode account name string */
} SAMR_Q_LOOKUP_NAMES;
/* SAMR_R_LOOKUP_NAMES */
typedef struct r_samr_lookup_names_info
{
- uint32 num_entries;
- uint32 undoc_buffer; /* undocumented buffer pointer */
+ uint32 num_rids1; /* number of aliases being looked up */
+ uint32 ptr_rids; /* pointer to aliases */
+ uint32 num_rids2; /* number of aliases being looked up */
- uint32 num_entries2;
- DOM_RID3 dom_rid[MAX_LOOKUP_SIDS]; /* domain RIDs being looked up */
+ uint32 rid[MAX_LOOKUP_SIDS]; /* rids */
+
+ uint32 num_types1; /* number of users in aliases being looked up */
+ uint32 ptr_types; /* pointer to users in aliases */
+ uint32 num_types2; /* number of users in aliases being looked up */
+
+ uint32 type[MAX_LOOKUP_SIDS]; /* SID_ENUM type */
uint32 status; /* return code */
POLICY_HND pol; /* policy handle */
uint32 num_rids1; /* number of rids being looked up */
- uint32 flags; /* 0x0000 03e8 - RID of the server doing the query? */
+ uint32 flags; /* 0x0000 03e8 - unknown */
uint32 ptr; /* 0x0000 0000 - 32 bit unknown */
uint32 num_rids2; /* number of rids being looked up */
} SAMR_R_QUERY_GROUPMEM;
+/* SAMR_Q_DEL_GROUPMEM - probably an del group member */
+typedef struct q_samr_del_group_mem_info
+{
+ POLICY_HND pol; /* policy handle */
+
+ uint32 rid; /* rid */
+
+} SAMR_Q_DEL_GROUPMEM;
+
+
+/* SAMR_R_DEL_GROUPMEM - probably an del group member */
+typedef struct r_samr_del_group_mem_info
+{
+ uint32 status; /* return status */
+
+} SAMR_R_DEL_GROUPMEM;
+
+
/* SAMR_Q_ADD_GROUPMEM - probably an add group member */
typedef struct q_samr_add_group_mem_info
{
} SAMR_R_QUERY_ALIASMEM;
-/* SAMR_Q_ADD_ALIASMEM - don't know! */
+/* SAMR_Q_ADD_ALIASMEM - add alias member */
typedef struct q_samr_add_alias_mem_info
{
POLICY_HND alias_pol; /* policy handle */
- DOM_SID sid; /* member sid to be "something"ed to do with the alias */
+ DOM_SID2 sid; /* member sid to be added to the alias */
} SAMR_Q_ADD_ALIASMEM;
-/* SAMR_R_ADD_ALIASMEM - probably an open */
+/* SAMR_R_ADD_ALIASMEM - add alias member */
typedef struct r_samr_add_alias_mem_info
{
uint32 status; /* return status */