Rename samr_dissect_LOGON_HOURS() to dissect_ndr_nt_LOGON_HOURS() and
[obnox/wireshark/wip.git] / packet-dcerpc-samr.c
index 5c671ac14d44e2765db5ab8cd56840f1bfa2ad9d..405a5e97d6a434ba9d80e8f0ccd1739e1077a61e 100644 (file)
@@ -1,8 +1,9 @@
 /* packet-dcerpc-samr.c
  * Routines for SMB \\PIPE\\samr packet disassembly
  * Copyright 2001, Tim Potter <tpot@samba.org>
+ *   2002 Added all command dissectors  Ronnie Sahlberg
  *
- * $Id: packet-dcerpc-samr.c,v 1.8 2002/02/08 11:02:03 guy Exp $
+ * $Id: packet-dcerpc-samr.c,v 1.22 2002/03/11 00:00:15 sahlberg Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
@@ -46,7 +47,6 @@ static int hf_samr_alias = -1;
 static int hf_samr_rid_attrib = -1;
 static int hf_samr_rc = -1;
 static int hf_samr_index = -1;
-static int hf_samr_acct_ctrl = -1;
 static int hf_samr_count = -1;
 
 static int hf_samr_level = -1;
@@ -56,6 +56,8 @@ static int hf_samr_entries = -1;
 static int hf_samr_pref_maxsize = -1;
 static int hf_samr_total_size = -1;
 static int hf_samr_ret_size = -1;
+static int hf_samr_alias_name = -1;
+static int hf_samr_group_name = -1;
 static int hf_samr_acct_name = -1;
 static int hf_samr_full_name = -1;
 static int hf_samr_acct_desc = -1;
@@ -114,11 +116,71 @@ int hf_nt_str_off = -1;
 int hf_nt_str_max_len = -1;
 int hf_nt_string_length = -1;
 int hf_nt_string_size = -1;
-
+static int hf_nt_acct_ctrl = -1;
+static int hf_nt_acb_disabled = -1;
+static int hf_nt_acb_homedirreq = -1;
+static int hf_nt_acb_pwnotreq = -1;
+static int hf_nt_acb_tempdup = -1;
+static int hf_nt_acb_normal = -1;
+static int hf_nt_acb_mns = -1;
+static int hf_nt_acb_domtrust = -1;
+static int hf_nt_acb_wstrust = -1;
+static int hf_nt_acb_svrtrust = -1;
+static int hf_nt_acb_pwnoexp = -1;
+static int hf_nt_acb_autolock = -1;
 
 static gint ett_dcerpc_samr = -1;
 gint ett_nt_unicode_string = -1;       /* used by packet-dcerpc-nt.c*/
 static gint ett_samr_user_dispinfo_1 = -1;
+static gint ett_samr_user_dispinfo_1_array = -1;
+static gint ett_samr_user_dispinfo_2 = -1;
+static gint ett_samr_user_dispinfo_2_array = -1;
+static gint ett_samr_group_dispinfo = -1;
+static gint ett_samr_group_dispinfo_array = -1;
+static gint ett_samr_ascii_dispinfo = -1;
+static gint ett_samr_ascii_dispinfo_array = -1;
+static gint ett_samr_display_info = -1;
+static gint ett_samr_password_info = -1;
+static gint ett_samr_server = -1;
+static gint ett_samr_user_group = -1;
+static gint ett_samr_user_group_array = -1;
+static gint ett_samr_alias_info = -1;
+static gint ett_samr_group_info = -1;
+static gint ett_samr_domain_info_1 = -1;
+static gint ett_samr_domain_info_2 = -1;
+static gint ett_samr_domain_info_8 = -1;
+static gint ett_samr_replication_status = -1;
+static gint ett_samr_domain_info_11 = -1;
+static gint ett_samr_domain_info_13 = -1;
+static gint ett_samr_domain_info = -1;
+static gint ett_samr_sid_pointer = -1;
+static gint ett_samr_sid_array = -1;
+static gint ett_samr_index_array = -1;
+static gint ett_samr_idx_and_name = -1;
+static gint ett_samr_idx_and_name_array = -1;
+static gint ett_samr_logon_hours = -1;
+static gint ett_samr_logon_hours_hours = -1;
+static gint ett_samr_user_info_1 = -1;
+static gint ett_samr_user_info_2 = -1;
+static gint ett_samr_user_info_3 = -1;
+static gint ett_samr_user_info_5 = -1;
+static gint ett_samr_user_info_6 = -1;
+static gint ett_samr_user_info_18 = -1;
+static gint ett_samr_user_info_19 = -1;
+static gint ett_samr_buffer_buffer = -1;
+static gint ett_samr_buffer = -1;
+static gint ett_samr_user_info_21 = -1;
+static gint ett_samr_user_info_22 = -1;
+static gint ett_samr_user_info_23 = -1;
+static gint ett_samr_user_info_24 = -1;
+static gint ett_samr_user_info = -1;
+static gint ett_samr_member_array_types = -1;
+static gint ett_samr_member_array_rids = -1;
+static gint ett_samr_member_array = -1;
+static gint ett_samr_names = -1;
+static gint ett_samr_rids = -1;
+static gint ett_nt_acct_ctrl = -1;
+
 
 static e_uuid_t uuid_dcerpc_samr = {
         0x12345778, 0x1234, 0xabcd, 
@@ -128,98 +190,6 @@ static e_uuid_t uuid_dcerpc_samr = {
 static guint16 ver_dcerpc_samr = 1;
 
 
-/* functions to dissect a UNICODE_STRING structure, common to many 
-   NT services
-   struct {
-     short len;
-     short size;
-     [size_is(size/2), length_is(len/2), ptr] unsigned short *string;
-   } UNICODE_STRING;
-
-   these variables can be found in packet-dcerpc-samr.c 
-*/
-extern int hf_nt_str_len;
-extern int hf_nt_str_off;
-extern int hf_nt_str_max_len;
-extern int hf_nt_string_length;
-extern int hf_nt_string_size;
-extern gint ett_nt_unicode_string;
-
-int
-dissect_ndr_nt_UNICODE_STRING_string (tvbuff_t *tvb, int offset, 
-                             packet_info *pinfo, proto_tree *tree, 
-                             char *drep)
-{
-       guint32 len, off, max_len;
-       guint16 *data16;
-       char *text;
-       int old_offset;
-       header_field_info *hfi;
-       dcerpc_info *di;
-
-       di=pinfo->private_data;
-       if(di->conformant_run){
-               /*just a run to handle conformant arrays, nothing to dissect */
-               return offset;
-       }
-
-        offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep,
-                                     hf_nt_str_len, &len);
-        offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep,
-                                     hf_nt_str_off, &off);
-        offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep,
-                                     hf_nt_str_max_len, &max_len);
-
-       old_offset=offset;
-       offset = prs_uint16s(tvb, offset, pinfo, tree, max_len, &data16, NULL);
-       text = fake_unicode(data16, max_len);
-
-       hfi = proto_registrar_get_nth(di->hf_index);
-       proto_tree_add_string_format(tree, di->hf_index, 
-               tvb, old_offset, offset-old_offset,
-               text, "%s: %s", hfi->name, text);
-
-       if(tree){
-               proto_item_set_text(tree, "%s: %s", hfi->name, text);
-               proto_item_set_text(tree->parent, "%s: %s", hfi->name, text);
-       }
-       return offset;
-}
-
-int
-dissect_ndr_nt_UNICODE_STRING (tvbuff_t *tvb, int offset, 
-                             packet_info *pinfo, proto_tree *parent_tree, 
-                             char *drep, int hf_index)
-{
-       proto_item *item=NULL;
-       proto_tree *tree=NULL;
-       int old_offset=offset;
-       dcerpc_info *di;
-
-       di=pinfo->private_data;
-       if(di->conformant_run){
-               /*just a run to handle conformant arrays, nothing to dissect */
-               return offset;
-       }
-
-       if(parent_tree){
-               item = proto_tree_add_text(parent_tree, tvb, offset, 0,
-                       "Unicode String");
-               tree = proto_item_add_subtree(item, ett_nt_unicode_string);
-       }
-
-        offset = dissect_ndr_uint16 (tvb, offset, pinfo, tree, drep,
-                                     hf_nt_string_length, NULL);
-        offset = dissect_ndr_uint16 (tvb, offset, pinfo, tree, drep,
-                                     hf_nt_string_size, NULL);
-        offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
-                       dissect_ndr_nt_UNICODE_STRING_string, NDR_POINTER_PTR,
-                       hf_index);
-
-       proto_item_set_len(item, offset-old_offset);
-       return offset;
-}
-
 /* functions to dissect a STRING structure, common to many 
    NT services
    struct {
@@ -237,7 +207,7 @@ dissect_ndr_nt_STRING_string (tvbuff_t *tvb, int offset,
        guint32 len, off, max_len;
        guint8 *text;
        int old_offset;
-       header_field_info *hfi;
+       char *name;
        dcerpc_info *di;
 
        di=pinfo->private_data;
@@ -256,14 +226,13 @@ dissect_ndr_nt_STRING_string (tvbuff_t *tvb, int offset,
        old_offset=offset;
        offset = prs_uint8s(tvb, offset, pinfo, tree, max_len, &text, NULL);
 
-       hfi = proto_registrar_get_nth(di->hf_index);
-       proto_tree_add_string_format(tree, di->hf_index, 
-               tvb, old_offset, offset-old_offset,
-               text, "%s: %s", hfi->name, text);
+       name = proto_registrar_get_name(di->hf_index);
+       proto_tree_add_string(tree, di->hf_index, tvb, old_offset,
+               offset-old_offset, text);
 
        if(tree){
-               proto_item_set_text(tree, "%s: %s", hfi->name, text);
-               proto_item_set_text(tree->parent, "%s: %s", hfi->name, text);
+               proto_item_set_text(tree, "%s: %s", name, text);
+               proto_item_set_text(tree->parent, "%s: %s", name, text);
        }
        return offset;
 }
@@ -276,6 +245,7 @@ dissect_ndr_nt_STRING (tvbuff_t *tvb, int offset,
        proto_item *item=NULL;
        proto_tree *tree=NULL;
        int old_offset=offset;
+       char *name;
        dcerpc_info *di;
 
        di=pinfo->private_data;
@@ -284,9 +254,10 @@ dissect_ndr_nt_STRING (tvbuff_t *tvb, int offset,
                return offset;
        }
 
+       name = proto_registrar_get_name(di->hf_index);
        if(parent_tree){
-               item = proto_tree_add_text(parent_tree, tvb, offset, 0,
-                       "Unicode String");
+               item = proto_tree_add_text(parent_tree, tvb, offset, -1,
+                       "%s", name);
                tree = proto_item_add_subtree(item, ett_nt_unicode_string);
        }
 
@@ -296,39 +267,12 @@ dissect_ndr_nt_STRING (tvbuff_t *tvb, int offset,
                                      hf_nt_string_size, NULL);
         offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
                        dissect_ndr_nt_STRING_string, NDR_POINTER_PTR,
-                       hf_index);
+                       name, hf_index, 0);
 
        proto_item_set_len(item, offset-old_offset);
        return offset;
 }
 
-/* This should get fixed both here and in dissect_smb_64bit_time so
-   one can handle both BIG and LITTLE endian encodings 
- */
-int dissect_smb_64bit_time(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, int offset, int hf_date);
-int
-dissect_ndr_nt_NTTIME (tvbuff_t *tvb, int offset, 
-                       packet_info *pinfo, proto_tree *tree, 
-                       char *drep, int hf_index)
-{
-       dcerpc_info *di;
-
-       di=pinfo->private_data;
-       if(di->conformant_run){
-               /*just a run to handle conformant arrays, nothing to dissect */
-               return offset;
-       }
-
-       /* align to 4 byte boundary */
-       if(offset&0x03){
-               offset = (offset&0xfffffffc)+4;
-       }
-
-       offset = dissect_smb_64bit_time(tvb, pinfo, tree, offset,
-                hf_index);
-       return offset;
-}
-
 static int
 samr_dissect_SID(tvbuff_t *tvb, int offset, 
                        packet_info *pinfo, proto_tree *tree, 
@@ -356,22 +300,105 @@ samr_dissect_SID_ptr(tvbuff_t *tvb, int offset,
                        packet_info *pinfo, proto_tree *tree, 
                        char *drep)
 {
-        offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
+       offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
                        samr_dissect_SID, NDR_POINTER_UNIQUE,
-                       -1);
+                       "SID pointer", -1, 1);
        return offset;
 }
 
 
 
-/* above this line, just some general support routines which should be placed
-   in some more generic file common to all NT services dissectors
-*/
+static const true_false_string tfs_nt_acb_disabled = {
+       "Account is DISABLED",
+       "Account is NOT disabled"
+};
+static const true_false_string tfs_nt_acb_homedirreq = {
+       "Homedir is REQUIRED",
+       "Homedir is NOT required"
+};
+static const true_false_string tfs_nt_acb_pwnotreq = {
+       "Password is NOT required",
+       "Password is REQUIRED"
+};
+static const true_false_string tfs_nt_acb_tempdup = {
+       "This is a TEMPORARY DUPLICATE account",
+       "This is NOT a temporary duplicate account"
+};
+static const true_false_string tfs_nt_acb_normal = {
+       "This is a NORMAL USER account",
+       "This is NOT a normal user account"
+};
+static const true_false_string tfs_nt_acb_mns = {
+       "This is a MNS account",
+       "This is NOT a mns account"
+};
+static const true_false_string tfs_nt_acb_domtrust = {
+       "This is a DOMAIN TRUST account",
+       "This is NOT a domain trust account"
+};
+static const true_false_string tfs_nt_acb_wstrust = {
+       "This is a WORKSTATION TRUST account",
+       "This is NOT a workstation trust account"
+};
+static const true_false_string tfs_nt_acb_svrtrust = {
+       "This is a SERVER TRUST account",
+       "This is NOT a server trust account"
+};
+static const true_false_string tfs_nt_acb_pwnoexp = {
+       "Passwords does NOT expire",
+       "Password will EXPIRE"
+};
+static const true_false_string tfs_nt_acb_autolock = {
+       "This account has been AUTO LOCKED",
+       "This account has NOT been auto locked"
+};
+int
+dissect_ndr_nt_acct_ctrl(tvbuff_t *tvb, int offset, packet_info *pinfo, 
+                       proto_tree *parent_tree, char *drep)
+{
+       guint32 mask;
+       proto_item *item = NULL;
+       proto_tree *tree = NULL;
 
+       offset=dissect_ndr_uint32(tvb, offset, pinfo, NULL, drep,
+                       hf_nt_acct_ctrl, &mask);
 
+       if(parent_tree){
+               item = proto_tree_add_uint(parent_tree, hf_nt_acct_ctrl,
+                       tvb, offset-4, 4, mask);
+               tree = proto_item_add_subtree(item, ett_nt_acct_ctrl);
+       }
+
+       proto_tree_add_boolean(tree, hf_nt_acb_autolock,
+               tvb, offset-4, 4, mask);
+       proto_tree_add_boolean(tree, hf_nt_acb_pwnoexp,
+               tvb, offset-4, 4, mask);
+       proto_tree_add_boolean(tree, hf_nt_acb_svrtrust,
+               tvb, offset-4, 4, mask);
+       proto_tree_add_boolean(tree, hf_nt_acb_wstrust,
+               tvb, offset-4, 4, mask);
+       proto_tree_add_boolean(tree, hf_nt_acb_domtrust,
+               tvb, offset-4, 4, mask);
+       proto_tree_add_boolean(tree, hf_nt_acb_mns,
+               tvb, offset-4, 4, mask);
+       proto_tree_add_boolean(tree, hf_nt_acb_normal,
+               tvb, offset-4, 4, mask);
+       proto_tree_add_boolean(tree, hf_nt_acb_tempdup,
+               tvb, offset-4, 4, mask);
+       proto_tree_add_boolean(tree, hf_nt_acb_pwnotreq,
+               tvb, offset-4, 4, mask);
+       proto_tree_add_boolean(tree, hf_nt_acb_homedirreq,
+               tvb, offset-4, 4, mask);
+       proto_tree_add_boolean(tree, hf_nt_acb_disabled,
+               tvb, offset-4, 4, mask);
 
+       return offset;
+}
 
 
+/* above this line, just some general support routines which should be placed
+   in some more generic file common to all NT services dissectors
+*/
 
 static int
 samr_dissect_context_handle_reply(tvbuff_t *tvb, int offset, 
@@ -447,7 +474,7 @@ samr_dissect_pointer_UNICODE_STRING(tvbuff_t *tvb, int offset,
        }
 
        offset = dissect_ndr_nt_UNICODE_STRING(tvb, offset, pinfo, tree, drep,
-                       di->hf_index);
+                       di->hf_index, di->levels);
        return offset;
 }
 
@@ -493,7 +520,7 @@ samr_dissect_USER_DISPINFO_1(tvbuff_t *tvb, int offset,
        int old_offset=offset;
 
        if(parent_tree){
-               item = proto_tree_add_text(parent_tree, tvb, offset, 0,
+               item = proto_tree_add_text(parent_tree, tvb, offset, -1,
                        "User_DispInfo_1");
                tree = proto_item_add_subtree(item, ett_samr_user_dispinfo_1);
        }
@@ -502,14 +529,13 @@ samr_dissect_USER_DISPINFO_1(tvbuff_t *tvb, int offset,
                                hf_samr_index, NULL);
        offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep,
                                hf_samr_rid, NULL);
-       offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep,
-                               hf_samr_acct_ctrl, NULL);
+       offset = dissect_ndr_nt_acct_ctrl(tvb, offset, pinfo, tree, drep);
        offset = dissect_ndr_nt_UNICODE_STRING(tvb, offset, pinfo, tree, drep,
-                               hf_samr_acct_name);
+                               hf_samr_acct_name, 0);
        offset = dissect_ndr_nt_UNICODE_STRING(tvb, offset, pinfo, tree, drep,
-                               hf_samr_full_name);
+                               hf_samr_full_name, 0);
        offset = dissect_ndr_nt_UNICODE_STRING(tvb, offset, pinfo, tree, drep,
-                               hf_samr_acct_desc);
+                               hf_samr_acct_desc, 0);
 
        proto_item_set_len(item, offset-old_offset);
        return offset;
@@ -537,9 +563,9 @@ samr_dissect_USER_DISPINFO_1_ARRAY (tvbuff_t *tvb, int offset,
        int old_offset=offset;
 
        if(parent_tree){
-               item = proto_tree_add_text(parent_tree, tvb, offset, 0,
+               item = proto_tree_add_text(parent_tree, tvb, offset, -1,
                        "User_DispInfo_1 Array");
-               tree = proto_item_add_subtree(item, ett_samr_user_dispinfo_1);
+               tree = proto_item_add_subtree(item, ett_samr_user_dispinfo_1_array);
        }
 
 
@@ -547,7 +573,7 @@ samr_dissect_USER_DISPINFO_1_ARRAY (tvbuff_t *tvb, int offset,
                                      hf_samr_count, &count);
         offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
                        samr_dissect_USER_DISPINFO_1_ARRAY_users, NDR_POINTER_PTR,
-                       -1);
+                       "USER_DISPINFO_1_ARRAY", -1, 0);
 
        proto_item_set_len(item, offset-old_offset);
        return offset;
@@ -565,21 +591,20 @@ samr_dissect_USER_DISPINFO_2(tvbuff_t *tvb, int offset,
        int old_offset=offset;
 
        if(parent_tree){
-               item = proto_tree_add_text(parent_tree, tvb, offset, 0,
+               item = proto_tree_add_text(parent_tree, tvb, offset, -1,
                        "User_DispInfo_2");
-               tree = proto_item_add_subtree(item, ett_samr_user_dispinfo_1);
+               tree = proto_item_add_subtree(item, ett_samr_user_dispinfo_2);
        }
 
        offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep,
                        hf_samr_index, NULL);
        offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep,
                        hf_samr_rid, NULL);
-       offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep,
-                       hf_samr_acct_ctrl, NULL);
+       offset = dissect_ndr_nt_acct_ctrl(tvb, offset, pinfo, tree, drep);
        offset = dissect_ndr_nt_UNICODE_STRING(tvb, offset, pinfo, tree, drep,
-                       hf_samr_acct_name);
+                       hf_samr_acct_name, 0);
        offset = dissect_ndr_nt_UNICODE_STRING(tvb, offset, pinfo, tree, drep,
-                       hf_samr_acct_desc);
+                       hf_samr_acct_desc, 0);
 
        proto_item_set_len(item, offset-old_offset);
        return offset;
@@ -607,9 +632,9 @@ samr_dissect_USER_DISPINFO_2_ARRAY (tvbuff_t *tvb, int offset,
        int old_offset=offset;
 
        if(parent_tree){
-               item = proto_tree_add_text(parent_tree, tvb, offset, 0,
+               item = proto_tree_add_text(parent_tree, tvb, offset, -1,
                        "User_DispInfo_2 Array");
-               tree = proto_item_add_subtree(item, ett_samr_user_dispinfo_1);
+               tree = proto_item_add_subtree(item, ett_samr_user_dispinfo_2_array);
        }
 
 
@@ -617,7 +642,7 @@ samr_dissect_USER_DISPINFO_2_ARRAY (tvbuff_t *tvb, int offset,
                                      hf_samr_count, &count);
         offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
                        samr_dissect_USER_DISPINFO_2_ARRAY_users, NDR_POINTER_PTR,
-                       -1);
+                       "USER_DISPINFO_2_ARRAY", -1, 0);
 
        proto_item_set_len(item, offset-old_offset);
        return offset;
@@ -637,9 +662,9 @@ samr_dissect_GROUP_DISPINFO(tvbuff_t *tvb, int offset,
        int old_offset=offset;
 
        if(parent_tree){
-               item = proto_tree_add_text(parent_tree, tvb, offset, 0,
+               item = proto_tree_add_text(parent_tree, tvb, offset, -1,
                        "Group_DispInfo");
-               tree = proto_item_add_subtree(item, ett_samr_user_dispinfo_1);
+               tree = proto_item_add_subtree(item, ett_samr_group_dispinfo);
        }
 
         
@@ -647,12 +672,11 @@ samr_dissect_GROUP_DISPINFO(tvbuff_t *tvb, int offset,
                        hf_samr_index, NULL);
        offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep,
                        hf_samr_rid, NULL);
-       offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep,
-                       hf_samr_acct_ctrl, NULL);
+       offset = dissect_ndr_nt_acct_ctrl(tvb, offset, pinfo, tree, drep);
        offset = dissect_ndr_nt_UNICODE_STRING(tvb, offset, pinfo, tree, drep,
-                       hf_samr_acct_name);
+                       hf_samr_acct_name, 0);
        offset = dissect_ndr_nt_UNICODE_STRING(tvb, offset, pinfo, tree, drep,
-                       hf_samr_acct_desc);
+                       hf_samr_acct_desc, 0);
 
        proto_item_set_len(item, offset-old_offset);
        return offset;
@@ -680,16 +704,16 @@ samr_dissect_GROUP_DISPINFO_ARRAY(tvbuff_t *tvb, int offset,
        int old_offset=offset;
 
        if(parent_tree){
-               item = proto_tree_add_text(parent_tree, tvb, offset, 0,
+               item = proto_tree_add_text(parent_tree, tvb, offset, -1,
                        "Group_DispInfo Array");
-               tree = proto_item_add_subtree(item, ett_samr_user_dispinfo_1);
+               tree = proto_item_add_subtree(item, ett_samr_group_dispinfo_array);
        }
 
         offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep,
                                      hf_samr_count, &count);
         offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
                        samr_dissect_GROUP_DISPINFO_ARRAY_groups, NDR_POINTER_PTR,
-                       -1);
+                       "GROUP_DISPINFO_ARRAY", -1, 0);
 
        proto_item_set_len(item, offset-old_offset);
        return offset;
@@ -707,9 +731,9 @@ samr_dissect_ASCII_DISPINFO(tvbuff_t *tvb, int offset,
        int old_offset=offset;
 
        if(parent_tree){
-               item = proto_tree_add_text(parent_tree, tvb, offset, 0,
+               item = proto_tree_add_text(parent_tree, tvb, offset, -1,
                        "Ascii_DispInfo");
-               tree = proto_item_add_subtree(item, ett_samr_user_dispinfo_1);
+               tree = proto_item_add_subtree(item, ett_samr_ascii_dispinfo);
        }
 
         
@@ -717,8 +741,7 @@ samr_dissect_ASCII_DISPINFO(tvbuff_t *tvb, int offset,
                        hf_samr_index, NULL);
        offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep,
                        hf_samr_rid, NULL);
-       offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep,
-                       hf_samr_acct_ctrl, NULL);
+       offset = dissect_ndr_nt_acct_ctrl(tvb, offset, pinfo, tree, drep);
        offset = dissect_ndr_nt_STRING(tvb, offset, pinfo, tree, drep,
                        hf_samr_acct_name);
        offset = dissect_ndr_nt_STRING(tvb, offset, pinfo, tree, drep,
@@ -750,16 +773,16 @@ samr_dissect_ASCII_DISPINFO_ARRAY(tvbuff_t *tvb, int offset,
        int old_offset=offset;
 
        if(parent_tree){
-               item = proto_tree_add_text(parent_tree, tvb, offset, 0,
+               item = proto_tree_add_text(parent_tree, tvb, offset, -1,
                        "Ascii_DispInfo Array");
-               tree = proto_item_add_subtree(item, ett_samr_user_dispinfo_1);
+               tree = proto_item_add_subtree(item, ett_samr_ascii_dispinfo_array);
        }
 
         offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep,
                                      hf_samr_count, &count);
         offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
                        samr_dissect_ASCII_DISPINFO_ARRAY_users, NDR_POINTER_PTR,
-                       -1);
+                       "ACSII_DISPINFO_ARRAY", -1, 0);
 
        proto_item_set_len(item, offset-old_offset);
        return offset;
@@ -777,9 +800,9 @@ samr_dissect_DISPLAY_INFO (tvbuff_t *tvb, int offset,
        guint16 level;
 
        if(parent_tree){
-               item = proto_tree_add_text(parent_tree, tvb, offset, 0,
-                       "DispInfo");
-               tree = proto_item_add_subtree(item, ett_samr_user_dispinfo_1);
+               item = proto_tree_add_text(parent_tree, tvb, offset, -1,
+                       "DISP_INFO:");
+               tree = proto_item_add_subtree(item, ett_samr_display_info);
        }
 
         offset = dissect_ndr_uint16 (tvb, offset, pinfo, tree, drep,
@@ -818,13 +841,13 @@ samr_dissect_query_dispinfo_reply (tvbuff_t *tvb, int offset,
 {
         offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
                        samr_dissect_pointer_long, NDR_POINTER_REF,
-                       hf_samr_total_size);
+                       "", hf_samr_total_size, 0);
         offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
                        samr_dissect_pointer_long, NDR_POINTER_REF,
-                       hf_samr_ret_size);
+                       "", hf_samr_ret_size, 0);
         offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
                        samr_dissect_DISPLAY_INFO, NDR_POINTER_REF,
-                       -1);
+                       "", -1, 0);
         offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep,
                                      hf_samr_rc, NULL);
 
@@ -854,7 +877,7 @@ samr_dissect_get_display_enumeration_index_reply(tvbuff_t *tvb, int offset,
 {
         offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
                        samr_dissect_pointer_long, NDR_POINTER_REF,
-                       hf_samr_index);
+                       "", hf_samr_index, 0);
         offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep,
                                      hf_samr_rc, NULL);
 
@@ -874,10 +897,12 @@ samr_dissect_PASSWORD_INFO(tvbuff_t *tvb, int offset,
        proto_tree *tree=NULL;
        int old_offset=offset;
 
+       ALIGN_TO_4_BYTES;  /* strcture starts with short, but is aligned for longs */
+
        if(parent_tree){
-               item = proto_tree_add_text(parent_tree, tvb, offset, 0,
-                       "Password Info");
-               tree = proto_item_add_subtree(item, ett_samr_user_dispinfo_1);
+               item = proto_tree_add_text(parent_tree, tvb, offset, -1,
+                       "PASSWORD_INFO:");
+               tree = proto_item_add_subtree(item, ett_samr_password_info);
        }
 
         
@@ -897,7 +922,7 @@ samr_dissect_get_usrdom_pwinfo_reply(tvbuff_t *tvb, int offset,
 {
         offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
                        samr_dissect_PASSWORD_INFO, NDR_POINTER_REF,
-                       -1);
+                       "", -1, 0);
         offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep,
                                      hf_samr_rc, NULL);
        return offset;
@@ -915,12 +940,12 @@ samr_dissect_connect2_server(tvbuff_t *tvb, int offset,
        int old_offset=offset;
 
        if(parent_tree){
-               item = proto_tree_add_text(parent_tree, tvb, offset, 0,
+               item = proto_tree_add_text(parent_tree, tvb, offset, -1,
                        "Server");
-               tree = proto_item_add_subtree(item, ett_samr_user_dispinfo_1);
+               tree = proto_item_add_subtree(item, ett_samr_server);
        }
 
-       offset = dissect_ndr_nt_UNICODE_STRING_string(tvb, offset, pinfo, 
+       offset = dissect_ndr_nt_UNICODE_STRING_str(tvb, offset, pinfo, 
                        tree, drep);
 
        proto_item_set_len(item, offset-old_offset);
@@ -934,7 +959,7 @@ samr_dissect_connect2_rqst(tvbuff_t *tvb, int offset,
 {
         offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
                        samr_dissect_connect2_server, NDR_POINTER_UNIQUE,
-                       hf_samr_server);
+                       "Server", hf_samr_server, 0);
 
         offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep,
                                      hf_samr_access, NULL);
@@ -966,9 +991,9 @@ samr_dissect_USER_GROUP(tvbuff_t *tvb, int offset,
        int old_offset=offset;
 
        if(parent_tree){
-               item = proto_tree_add_text(parent_tree, tvb, offset, 0,
-                       "User Group");
-               tree = proto_item_add_subtree(item, ett_samr_user_dispinfo_1);
+               item = proto_tree_add_text(parent_tree, tvb, offset, -1,
+                       "USER_GROUP:");
+               tree = proto_item_add_subtree(item, ett_samr_user_group);
        }
 
         offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep,
@@ -1002,16 +1027,16 @@ samr_dissect_USER_GROUP_ARRAY(tvbuff_t *tvb, int offset,
        int old_offset=offset;
 
        if(parent_tree){
-               item = proto_tree_add_text(parent_tree, tvb, offset, 0,
-                       "User_Group Array");
-               tree = proto_item_add_subtree(item, ett_samr_user_dispinfo_1);
+               item = proto_tree_add_text(parent_tree, tvb, offset, -1,
+                       "USER_GROUP_ARRAY");
+               tree = proto_item_add_subtree(item, ett_samr_user_group_array);
        }
 
        offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep,
                        hf_samr_count, &count);
        offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
                        samr_dissect_USER_GROUP_ARRAY_groups, NDR_POINTER_UNIQUE,
-                       -1);
+                       "USER_GROUP_ARRAY", -1, 0);
 
        proto_item_set_len(item, offset-old_offset);
        return offset;
@@ -1024,7 +1049,7 @@ samr_dissect_USER_GROUP_ARRAY_ptr(tvbuff_t *tvb, int offset,
 {
         offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
                        samr_dissect_USER_GROUP_ARRAY, NDR_POINTER_UNIQUE,
-                       -1);
+                       "USER_GROUP_ARRAY", -1, 0);
        return offset;
 }
 
@@ -1035,7 +1060,7 @@ samr_dissect_get_groups_for_user_reply(tvbuff_t *tvb, int offset,
 {
         offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
                        samr_dissect_USER_GROUP_ARRAY_ptr, NDR_POINTER_REF,
-                       -1);
+                       "", -1, 0);
         offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep,
                                      hf_samr_rc, NULL);
        return offset;
@@ -1054,7 +1079,7 @@ samr_dissect_open_domain_rqst(tvbuff_t *tvb, int offset,
                                      hf_samr_access, NULL);
         offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
                        samr_dissect_SID, NDR_POINTER_REF,
-                       -1);
+                       "", -1, 0);
        return offset;
 }
 
@@ -1081,7 +1106,7 @@ samr_dissect_context_handle_SID(tvbuff_t *tvb, int offset,
                                       hf_samr_hnd, NULL);
         offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
                        samr_dissect_SID, NDR_POINTER_REF,
-                       -1);
+                       "SID", -1, 0);
        return offset;
 }
 
@@ -1127,7 +1152,7 @@ samr_dissect_unknown_3c_reply(tvbuff_t *tvb, int offset,
 {
         offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
                        samr_dissect_pointer_short, NDR_POINTER_REF,
-                       hf_samr_unknown_short);
+                       "", hf_samr_unknown_short, 0);
         offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep,
                                      hf_samr_rc, NULL);
        return offset;
@@ -1142,8 +1167,9 @@ samr_dissect_create_alias_in_domain_rqst(tvbuff_t *tvb, int offset,
 {
         offset = dissect_ndr_ctx_hnd (tvb, offset, pinfo, tree, drep,
                                       hf_samr_hnd, NULL);
-       offset = dissect_ndr_nt_UNICODE_STRING(tvb, offset, pinfo, tree, drep,
-                       hf_samr_acct_name);
+        offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
+                       samr_dissect_pointer_UNICODE_STRING, NDR_POINTER_REF,
+                       "Account Name", hf_samr_acct_name, 0);
         offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep,
                                      hf_samr_access, NULL);
        return offset;
@@ -1186,12 +1212,12 @@ samr_dissect_ALIAS_INFO_1 (tvbuff_t *tvb, int offset,
 {
        offset = dissect_ndr_nt_UNICODE_STRING(tvb, offset, pinfo, 
                tree, drep,
-               hf_samr_acct_name);
+               hf_samr_acct_name, 0);
         offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep,
                                      hf_samr_rid, NULL);
        offset = dissect_ndr_nt_UNICODE_STRING(tvb, offset, pinfo, 
                tree, drep,
-               hf_samr_acct_desc);
+               hf_samr_acct_desc, 0);
        return offset;
 }
 
@@ -1206,9 +1232,9 @@ samr_dissect_ALIAS_INFO(tvbuff_t *tvb, int offset,
        guint16 level;
 
        if(parent_tree){
-               item = proto_tree_add_text(parent_tree, tvb, offset, 0,
-                       "AliasInfo");
-               tree = proto_item_add_subtree(item, ett_samr_user_dispinfo_1);
+               item = proto_tree_add_text(parent_tree, tvb, offset, -1,
+                       "ALIAS_INFO:");
+               tree = proto_item_add_subtree(item, ett_samr_alias_info);
        }
 
         offset = dissect_ndr_uint16 (tvb, offset, pinfo, tree, drep,
@@ -1221,12 +1247,12 @@ samr_dissect_ALIAS_INFO(tvbuff_t *tvb, int offset,
        case 2: 
                offset = dissect_ndr_nt_UNICODE_STRING(tvb, offset, pinfo, 
                        tree, drep,
-                       hf_samr_acct_name);
+                       hf_samr_acct_name, 0);
                break;
        case 3: 
                offset = dissect_ndr_nt_UNICODE_STRING(tvb, offset, pinfo, 
                        tree, drep,
-                       hf_samr_acct_desc);
+                       hf_samr_acct_desc, 0);
                break;
        }
 
@@ -1241,7 +1267,7 @@ samr_dissect_ALIAS_INFO_ptr(tvbuff_t *tvb, int offset,
 {
        offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
                        samr_dissect_ALIAS_INFO, NDR_POINTER_UNIQUE,
-                       -1);
+                       "ALIAS_INFO", -1, 0);
        return offset;
 }
 
@@ -1252,7 +1278,7 @@ samr_dissect_query_information_alias_reply(tvbuff_t *tvb, int offset,
 {
        offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
                        samr_dissect_ALIAS_INFO_ptr, NDR_POINTER_REF,
-                       -1);
+                       "", -1, 0);
        offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep,
                        hf_samr_rc, NULL);
        return offset;
@@ -1269,7 +1295,7 @@ samr_dissect_set_information_alias_rqst(tvbuff_t *tvb, int offset,
                                      hf_samr_level, NULL);
         offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
                        samr_dissect_ALIAS_INFO, NDR_POINTER_REF,
-                       -1);
+                       "", -1, 0);
        return offset;
 }
 
@@ -1306,16 +1332,16 @@ samr_dissect_oem_change_password_user2_rqst(tvbuff_t *tvb, int offset,
                                       hf_samr_hnd, NULL);
         offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
                        samr_dissect_pointer_STRING, NDR_POINTER_UNIQUE,
-                       hf_samr_server);
+                       "Server", hf_samr_server, 0);
         offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
                        samr_dissect_pointer_STRING, NDR_POINTER_REF,
-                       hf_samr_acct_name);
+                       "Account Name", hf_samr_acct_name, 0);
         offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
                        samr_dissect_CRYPT_PASSWORD, NDR_POINTER_UNIQUE,
-                       -1);
+                       "Password", -1, 0);
         offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
                        samr_dissect_CRYPT_HASH, NDR_POINTER_UNIQUE,
-                       -1);
+                       "Hash", -1, 0);
        return offset;
 }
 
@@ -1328,24 +1354,24 @@ samr_dissect_unicode_change_password_user2_rqst(tvbuff_t *tvb, int offset,
                                       hf_samr_hnd, NULL);
         offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
                        samr_dissect_pointer_UNICODE_STRING, NDR_POINTER_UNIQUE,
-                       hf_samr_server);
+                       "Server", hf_samr_server, 0);
         offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
                        samr_dissect_pointer_UNICODE_STRING, NDR_POINTER_REF,
-                       hf_samr_acct_name);
+                       "Account Name", hf_samr_acct_name, 0);
         offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
                        samr_dissect_CRYPT_PASSWORD, NDR_POINTER_UNIQUE,
-                       -1);
+                       "Password", -1, 0);
         offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
                        samr_dissect_CRYPT_HASH, NDR_POINTER_UNIQUE,
-                       -1);
+                       "Hash", -1, 0);
         offset = dissect_ndr_uint8 (tvb, offset, pinfo, tree, drep,
                                      hf_samr_lm_change, NULL);
         offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
                        samr_dissect_CRYPT_PASSWORD, NDR_POINTER_UNIQUE,
-                       -1);
+                       "Password", -1, 0);
         offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
                        samr_dissect_CRYPT_HASH, NDR_POINTER_UNIQUE,
-                       -1);
+                       "Hash", -1, 0);
        return offset;
 }
 
@@ -1360,10 +1386,10 @@ samr_dissect_unknown_3b_rqst(tvbuff_t *tvb, int offset,
                                      hf_samr_unknown_short, NULL);
         offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
                        samr_dissect_pointer_UNICODE_STRING, NDR_POINTER_UNIQUE,
-                       hf_samr_unknown_string);
+                       "Unknown", hf_samr_unknown_string, 0);
         offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
                        samr_dissect_pointer_UNICODE_STRING, NDR_POINTER_UNIQUE,
-                       hf_samr_unknown_string);
+                       "Unknown", hf_samr_unknown_string, 0);
        return offset;
 }
 
@@ -1376,10 +1402,10 @@ samr_dissect_create_user2_in_domain_rqst(tvbuff_t *tvb, int offset,
         
        offset = dissect_ndr_ctx_hnd (tvb, offset, pinfo, tree, drep,
                        hf_samr_hnd, NULL);
-       offset = dissect_ndr_nt_UNICODE_STRING(tvb, offset, pinfo, tree, drep,
-                       hf_samr_acct_name);
-       offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep,
-                       hf_samr_acct_ctrl, NULL);
+        offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
+                       samr_dissect_pointer_UNICODE_STRING, NDR_POINTER_REF,
+                       "Account Name", hf_samr_acct_name, 0);
+       offset = dissect_ndr_nt_acct_ctrl(tvb, offset, pinfo, tree, drep);
        offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep,
                        hf_samr_access, NULL);
 
@@ -1411,8 +1437,9 @@ samr_dissect_get_display_enumeration_index2_rqst(tvbuff_t *tvb, int offset,
                                       hf_samr_hnd, NULL);
         offset = dissect_ndr_uint16 (tvb, offset, pinfo, tree, drep,
                                      hf_samr_level, NULL);
-       offset = dissect_ndr_nt_UNICODE_STRING(tvb, offset, pinfo, tree, drep,
-                       hf_samr_acct_name);
+        offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
+                       samr_dissect_pointer_UNICODE_STRING, NDR_POINTER_REF,
+                       "Account Name", hf_samr_acct_name, 0);
        return offset;
 }
 
@@ -1439,28 +1466,28 @@ samr_dissect_change_password_user_rqst(tvbuff_t *tvb, int offset,
                        hf_samr_unknown_char, NULL);
        offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
                        samr_dissect_CRYPT_HASH, NDR_POINTER_UNIQUE,
-                       -1);
+                       "Hash", -1, 0);
        offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
                        samr_dissect_CRYPT_HASH, NDR_POINTER_UNIQUE,
-                       -1);
+                       "Hash", -1, 0);
        offset = dissect_ndr_uint8 (tvb, offset, pinfo, tree, drep,
                        hf_samr_unknown_char, NULL);
        offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
                        samr_dissect_CRYPT_HASH, NDR_POINTER_UNIQUE,
-                       -1);
+                       "Hash", -1, 0);
        offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
                        samr_dissect_CRYPT_HASH, NDR_POINTER_UNIQUE,
-                       -1);
+                       "Hash", -1, 0);
        offset = dissect_ndr_uint8 (tvb, offset, pinfo, tree, drep,
                        hf_samr_unknown_char, NULL);
        offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
                        samr_dissect_CRYPT_HASH, NDR_POINTER_UNIQUE,
-                       -1);
+                       "Hash", -1, 0);
        offset = dissect_ndr_uint8 (tvb, offset, pinfo, tree, drep,
                        hf_samr_unknown_char, NULL);
        offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
                        samr_dissect_CRYPT_HASH, NDR_POINTER_UNIQUE,
-                       -1);
+                       "Hash", -1, 0);
 
        return offset;
 }
@@ -1485,14 +1512,14 @@ samr_dissect_GROUP_INFO_1 (tvbuff_t *tvb, int offset,
 {
        offset = dissect_ndr_nt_UNICODE_STRING(tvb, offset, pinfo, 
                tree, drep,
-               hf_samr_acct_name);
+               hf_samr_acct_name, 0);
         offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep,
                                      hf_samr_rid, NULL);
         offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep,
                                        hf_samr_attrib, NULL);
        offset = dissect_ndr_nt_UNICODE_STRING(tvb, offset, pinfo, 
                tree, drep,
-               hf_samr_acct_desc);
+               hf_samr_acct_desc, 0);
        return offset;
 }
 
@@ -1507,9 +1534,9 @@ samr_dissect_GROUP_INFO(tvbuff_t *tvb, int offset,
        guint16 level;
 
        if(parent_tree){
-               item = proto_tree_add_text(parent_tree, tvb, offset, 0,
-                       "GroupInfo");
-               tree = proto_item_add_subtree(item, ett_samr_user_dispinfo_1);
+               item = proto_tree_add_text(parent_tree, tvb, offset, -1,
+                       "GROUP_INFO:");
+               tree = proto_item_add_subtree(item, ett_samr_group_info);
        }
 
         offset = dissect_ndr_uint16 (tvb, offset, pinfo, tree, drep,
@@ -1522,7 +1549,7 @@ samr_dissect_GROUP_INFO(tvbuff_t *tvb, int offset,
        case 2: 
                offset = dissect_ndr_nt_UNICODE_STRING(tvb, offset, pinfo, 
                        tree, drep,
-                       hf_samr_acct_name);
+                       hf_samr_acct_name, 0);
                break;
        case 3:
                offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep,
@@ -1531,7 +1558,7 @@ samr_dissect_GROUP_INFO(tvbuff_t *tvb, int offset,
        case 4: 
                offset = dissect_ndr_nt_UNICODE_STRING(tvb, offset, pinfo, 
                        tree, drep,
-                       hf_samr_acct_desc);
+                       hf_samr_acct_desc, 0);
                break;
        }
 
@@ -1546,7 +1573,7 @@ samr_dissect_GROUP_INFO_ptr(tvbuff_t *tvb, int offset,
 {
        offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
                        samr_dissect_GROUP_INFO, NDR_POINTER_UNIQUE,
-                       -1);
+                       "GROUP_INFO", -1, 0);
        return offset;
 }
 
@@ -1569,7 +1596,7 @@ samr_dissect_query_information_group_reply(tvbuff_t *tvb, int offset,
 {
        offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
                        samr_dissect_GROUP_INFO_ptr, NDR_POINTER_REF,
-                       -1);
+                       "", -1, 0);
        offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep,
                        hf_samr_rc, NULL);
        return offset;
@@ -1586,7 +1613,7 @@ samr_dissect_set_information_group_rqst (tvbuff_t *tvb, int offset,
                                      hf_samr_level, NULL);
         offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
                        samr_dissect_GROUP_INFO, NDR_POINTER_REF,
-                       -1);
+                       "", -1, 0);
        return offset;
 }
 
@@ -1602,7 +1629,7 @@ samr_dissect_get_domain_password_information_rqst (tvbuff_t *tvb, int offset,
 
         offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
                        samr_dissect_pointer_STRING, NDR_POINTER_UNIQUE,
-                       hf_samr_domain);
+                       "Domain", hf_samr_domain, 0);
        return offset;
 }
 
@@ -1616,10 +1643,12 @@ samr_dissect_DOMAIN_INFO_1(tvbuff_t *tvb, int offset,
        proto_tree *tree=NULL;
        int old_offset=offset;
 
+       ALIGN_TO_4_BYTES;  /* strcture starts with short, but is aligned for longs */ 
+
        if(parent_tree){
-               item = proto_tree_add_text(parent_tree, tvb, offset, 0,
-                       "DomainInfo_1");
-               tree = proto_item_add_subtree(item, ett_samr_user_dispinfo_1);
+               item = proto_tree_add_text(parent_tree, tvb, offset, -1,
+                       "DOMAIN_INFO_1:");
+               tree = proto_item_add_subtree(item, ett_samr_domain_info_1);
        }
 
         offset = dissect_ndr_uint16(tvb, offset, pinfo, tree, drep,
@@ -1646,19 +1675,19 @@ samr_dissect_DOMAIN_INFO_2(tvbuff_t *tvb, int offset,
        int old_offset=offset;
 
        if(parent_tree){
-               item = proto_tree_add_text(parent_tree, tvb, offset, 0,
-                       "DomainInfo_2");
-               tree = proto_item_add_subtree(item, ett_samr_user_dispinfo_1);
+               item = proto_tree_add_text(parent_tree, tvb, offset, -1,
+                       "DOMAIN_INFO_2:");
+               tree = proto_item_add_subtree(item, ett_samr_domain_info_2);
        }
 
        offset = dissect_ndr_nt_NTTIME(tvb, offset, pinfo, tree, drep,
                        hf_samr_unknown_time);
        offset = dissect_ndr_nt_UNICODE_STRING(tvb, offset, pinfo, tree, drep,
-                       hf_samr_unknown_string);
+                       hf_samr_unknown_string, 0);
        offset = dissect_ndr_nt_UNICODE_STRING(tvb, offset, pinfo, tree, drep,
-                       hf_samr_domain);
+                       hf_samr_domain, 0);
        offset = dissect_ndr_nt_UNICODE_STRING(tvb, offset, pinfo, tree, drep,
-                       hf_samr_controller);
+                       hf_samr_controller, 0);
        offset = dissect_ndr_nt_NTTIME(tvb, offset, pinfo, tree, drep,
                        hf_samr_unknown_time);
        offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep,
@@ -1688,9 +1717,9 @@ samr_dissect_DOMAIN_INFO_8(tvbuff_t *tvb, int offset,
        int old_offset=offset;
 
        if(parent_tree){
-               item = proto_tree_add_text(parent_tree, tvb, offset, 0,
-                       "DomainInfo_8");
-               tree = proto_item_add_subtree(item, ett_samr_user_dispinfo_1);
+               item = proto_tree_add_text(parent_tree, tvb, offset, -1,
+                       "DOMAIN_INFO_8:");
+               tree = proto_item_add_subtree(item, ett_samr_domain_info_8);
        }
 
        offset = dissect_ndr_nt_NTTIME(tvb, offset, pinfo, tree, drep,
@@ -1712,9 +1741,9 @@ samr_dissect_REPLICATION_STATUS(tvbuff_t *tvb, int offset,
        int old_offset=offset;
 
        if(parent_tree){
-               item = proto_tree_add_text(parent_tree, tvb, offset, 0,
-                       "Replication Status");
-               tree = proto_item_add_subtree(item, ett_samr_user_dispinfo_1);
+               item = proto_tree_add_text(parent_tree, tvb, offset, -1,
+                       "REPLICATION_STATUS:");
+               tree = proto_item_add_subtree(item, ett_samr_replication_status);
        }
 
        offset = dissect_ndr_uint64 (tvb, offset, pinfo, tree, drep,
@@ -1738,9 +1767,9 @@ samr_dissect_DOMAIN_INFO_11(tvbuff_t *tvb, int offset,
        int old_offset=offset;
 
        if(parent_tree){
-               item = proto_tree_add_text(parent_tree, tvb, offset, 0,
-                       "DomainInfo_11");
-               tree = proto_item_add_subtree(item, ett_samr_user_dispinfo_1);
+               item = proto_tree_add_text(parent_tree, tvb, offset, -1,
+                       "DOMAIN_INFO_11:");
+               tree = proto_item_add_subtree(item, ett_samr_domain_info_11);
        }
 
        offset = samr_dissect_DOMAIN_INFO_2(
@@ -1762,9 +1791,9 @@ samr_dissect_DOMAIN_INFO_13(tvbuff_t *tvb, int offset,
        int old_offset=offset;
 
        if(parent_tree){
-               item = proto_tree_add_text(parent_tree, tvb, offset, 0,
-                       "DomainInfo_13");
-               tree = proto_item_add_subtree(item, ett_samr_user_dispinfo_1);
+               item = proto_tree_add_text(parent_tree, tvb, offset, -1,
+                       "DOMAIN_INFO_13:");
+               tree = proto_item_add_subtree(item, ett_samr_domain_info_13);
        }
 
        offset = dissect_ndr_nt_NTTIME(tvb, offset, pinfo, tree, drep,
@@ -1790,13 +1819,15 @@ samr_dissect_DOMAIN_INFO(tvbuff_t *tvb, int offset,
        guint16 level;
 
        if(parent_tree){
-               item = proto_tree_add_text(parent_tree, tvb, offset, 0,
-                       "DomainInfo");
-               tree = proto_item_add_subtree(item, ett_samr_user_dispinfo_1);
+               item = proto_tree_add_text(parent_tree, tvb, offset, -1,
+                       "DOMAIN_INFO:");
+               tree = proto_item_add_subtree(item, ett_samr_domain_info);
        }
 
         offset = dissect_ndr_uint16 (tvb, offset, pinfo, tree, drep,
                                      hf_samr_level, &level);
+
+       ALIGN_TO_4_BYTES;  /* all union arms aligned to 4 bytes, case 7 and 9 need this  */
        switch(level){
        case 1: 
                offset = samr_dissect_DOMAIN_INFO_1(
@@ -1813,17 +1844,17 @@ samr_dissect_DOMAIN_INFO(tvbuff_t *tvb, int offset,
                break;
        case 4:
                offset = dissect_ndr_nt_UNICODE_STRING(tvb, offset, pinfo, 
-                       tree, drep, hf_samr_unknown_string);
+                       tree, drep, hf_samr_unknown_string, 0);
                break;
 
        case 5:
                offset = dissect_ndr_nt_UNICODE_STRING(tvb, offset, pinfo, 
-                       tree, drep, hf_samr_domain);
+                       tree, drep, hf_samr_domain, 0);
                break;
 
        case 6:
                offset = dissect_ndr_nt_UNICODE_STRING(tvb, offset, pinfo, 
-                       tree, drep, hf_samr_controller);
+                       tree, drep, hf_samr_controller, 0);
                break;
 
        case 7:
@@ -1863,7 +1894,7 @@ samr_dissect_DOMAIN_INFO_ptr(tvbuff_t *tvb, int offset,
 {
         offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
                        samr_dissect_DOMAIN_INFO, NDR_POINTER_UNIQUE,
-                       hf_samr_domain);
+                       "DOMAIN_INFO pointer", hf_samr_domain, 0);
        return offset;
 }
 
@@ -1874,7 +1905,7 @@ samr_dissect_query_information_domain_reply(tvbuff_t *tvb, int offset,
 {
         offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
                        samr_dissect_DOMAIN_INFO_ptr, NDR_POINTER_REF,
-                       hf_samr_domain);
+                       "", hf_samr_domain, 0);
         offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep,
                                      hf_samr_rc, NULL);
        return offset;
@@ -1896,6 +1927,19 @@ samr_dissect_set_information_domain_rqst(tvbuff_t *tvb, int offset,
 
 
 
+static int
+samr_dissect_lookup_domain_rqst(tvbuff_t *tvb, int offset, 
+                       packet_info *pinfo, proto_tree *tree,
+                       char *drep)
+{
+       offset = dissect_ndr_ctx_hnd (tvb, offset, pinfo, tree, drep,
+                       hf_samr_hnd, NULL);
+        offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
+                       samr_dissect_pointer_UNICODE_STRING, NDR_POINTER_REF,
+                       "", hf_samr_domain, 0);
+       return offset;
+}
+
 static int
 samr_dissect_lookup_domain_reply(tvbuff_t *tvb, int offset, 
                              packet_info *pinfo, proto_tree *tree,
@@ -1903,7 +1947,7 @@ samr_dissect_lookup_domain_reply(tvbuff_t *tvb, int offset,
 {
         offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
                        samr_dissect_SID_ptr, NDR_POINTER_REF,
-                       -1);
+                       "", -1, 0);
         offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep,
                                      hf_samr_rc, NULL);
        return offset;
@@ -1919,14 +1963,14 @@ samr_dissect_PSID(tvbuff_t *tvb, int offset,
        int old_offset=offset;
 
        if(parent_tree){
-               item = proto_tree_add_text(parent_tree, tvb, offset, 0,
-                       "SID");
-               tree = proto_item_add_subtree(item, ett_samr_user_dispinfo_1);
+               item = proto_tree_add_text(parent_tree, tvb, offset, -1,
+                       "SID pointer:");
+               tree = proto_item_add_subtree(item, ett_samr_sid_pointer);
        }
 
         offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
                        samr_dissect_SID, NDR_POINTER_UNIQUE,
-                       -1);
+                       "SID", -1, 0);
 
        proto_item_set_len(item, offset-old_offset);
        return offset;
@@ -1956,44 +2000,34 @@ samr_dissect_PSID_ARRAY(tvbuff_t *tvb, int offset,
        int old_offset=offset;
 
        if(parent_tree){
-               item = proto_tree_add_text(parent_tree, tvb, offset, 0,
-                       "SID Array");
-               tree = proto_item_add_subtree(item, ett_samr_user_dispinfo_1);
+               item = proto_tree_add_text(parent_tree, tvb, offset, -1,
+                       "SID array:");
+               tree = proto_item_add_subtree(item, ett_samr_sid_array);
        }
 
        offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep,
                        hf_samr_count, &count);
         offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
                        samr_dissect_PSID_ARRAY_sids, NDR_POINTER_UNIQUE,
-                       -1);
+                       "PSID_ARRAY", -1, 0);
 
        proto_item_set_len(item, offset-old_offset);
        return offset;
 }
 
 static int
-samr_dissect_pindex(tvbuff_t *tvb, int offset, 
-                             packet_info *pinfo, proto_tree *parent_tree,
+samr_dissect_index(tvbuff_t *tvb, int offset, 
+                             packet_info *pinfo, proto_tree *tree,
                              char *drep)
 {
-       proto_item *item=NULL;
-       proto_tree *tree=NULL;
        int old_offset=offset;
        dcerpc_info *di;
 
        di=pinfo->private_data;
 
-       if(parent_tree){
-               item = proto_tree_add_text(parent_tree, tvb, offset, 0,
-                       "SID");
-               tree = proto_item_add_subtree(item, ett_samr_user_dispinfo_1);
-       }
-
-        offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
-                       samr_dissect_pointer_long, NDR_POINTER_UNIQUE,
-                       di->hf_index);
+       offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep,
+                       di->hf_index, NULL);
 
-       proto_item_set_len(item, offset-old_offset);
        return offset;
 }
 
@@ -2004,36 +2038,55 @@ samr_dissect_INDEX_ARRAY_value (tvbuff_t *tvb, int offset,
                              char *drep)
 {
        offset = dissect_ndr_ucarray(tvb, offset, pinfo, tree, drep,
-                       samr_dissect_pindex);
+                       samr_dissect_index);
 
        return offset;
 }
 
+static char *
+plural_ending(const char *string)
+{
+       size_t string_len;
+
+       string_len = strlen(string);
+       if (string_len > 0 && string[string_len - 1] == 's') {
+               /* String ends with "s" - pluralize by adding "es" */
+               return "es";
+       } else {
+               /* Field name doesn't end with "s" - pluralize by adding "s" */
+               return "s";
+       }
+}
 
 static int
 samr_dissect_INDEX_ARRAY(tvbuff_t *tvb, int offset, 
                        packet_info *pinfo, proto_tree *parent_tree,
                        char *drep)
 {
+       char *field_name;
        guint32 count;
        proto_item *item=NULL;
        proto_tree *tree=NULL;
        int old_offset=offset;
        dcerpc_info *di;
+       char str[256];
 
        di=pinfo->private_data;
 
+       field_name = proto_registrar_get_name(di->hf_index);
+       snprintf(str, 255, "INDEX_ARRAY: %s%s:", field_name,
+           plural_ending(field_name));
        if(parent_tree){
-               item = proto_tree_add_text(parent_tree, tvb, offset, 0,
-                       "Index Array");
-               tree = proto_item_add_subtree(item, ett_samr_user_dispinfo_1);
+               item = proto_tree_add_text(parent_tree, tvb, offset, -1,
+                       "%s", str);
+               tree = proto_item_add_subtree(item, ett_samr_index_array);
        }
 
        offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep,
                        hf_samr_count, &count);
-        offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
+       offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
                        samr_dissect_INDEX_ARRAY_value, NDR_POINTER_UNIQUE,
-                       di->hf_index);
+                       str, di->hf_index, 0);
 
        proto_item_set_len(item, offset-old_offset);
        return offset;
@@ -2049,7 +2102,7 @@ samr_dissect_get_alias_membership_rqst(tvbuff_t *tvb, int offset,
                                       hf_samr_hnd, NULL);
         offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
                        samr_dissect_PSID_ARRAY, NDR_POINTER_REF,
-                       -1);
+                       "", -1, 0);
        return offset;
 }
 
@@ -2060,7 +2113,7 @@ samr_dissect_get_alias_membership_reply(tvbuff_t *tvb, int offset,
 {
         offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
                        samr_dissect_INDEX_ARRAY, NDR_POINTER_REF,
-                       hf_samr_alias);
+                       "", hf_samr_alias, 0);
         offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep,
                        hf_samr_rc, NULL);
        return offset;
@@ -2075,20 +2128,22 @@ samr_dissect_IDX_AND_NAME(tvbuff_t *tvb, int offset,
        proto_item *item=NULL;
        proto_tree *tree=NULL;
        int old_offset=offset;
+       char str[256];
        dcerpc_info *di;
 
        di=pinfo->private_data;
 
+       snprintf(str, 255, "IDX_AND_NAME: %s:",proto_registrar_get_name(di->hf_index));
        if(parent_tree){
-               item = proto_tree_add_text(parent_tree, tvb, offset, 0,
-                       "IDX_AND_NAME");
-               tree = proto_item_add_subtree(item, ett_samr_user_dispinfo_1);
+               item = proto_tree_add_text(parent_tree, tvb, offset, -1,
+                               "%s",str);
+               tree = proto_item_add_subtree(item, ett_samr_idx_and_name);
        }
 
         offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep,
                        hf_samr_index, NULL);
        offset = dissect_ndr_nt_UNICODE_STRING(tvb, offset, pinfo, 
-                       tree, drep, di->hf_index);
+                       tree, drep, di->hf_index, 4);
 
        proto_item_set_len(item, offset-old_offset);
        return offset;
@@ -2111,26 +2166,33 @@ samr_dissect_IDX_AND_NAME_ARRAY(tvbuff_t *tvb, int offset,
                        packet_info *pinfo, proto_tree *parent_tree,
                        char *drep)
 {
+       char *field_name;
        guint32 count;
        proto_item *item=NULL;
        proto_tree *tree=NULL;
        int old_offset=offset;
        dcerpc_info *di;
+       char str[256];
 
        di=pinfo->private_data;
 
+       field_name = proto_registrar_get_name(di->hf_index);
+
        if(parent_tree){
-               item = proto_tree_add_text(parent_tree, tvb, offset, 0,
-                       "IDX_AND_NAME Array");
-               tree = proto_item_add_subtree(item, ett_samr_user_dispinfo_1);
+               item = proto_tree_add_text(parent_tree, tvb, offset, -1,
+                       "IDX_AND_NAME_ARRAY: %s%s:", field_name,
+                       plural_ending(field_name));
+               tree = proto_item_add_subtree(item, ett_samr_idx_and_name_array);
        }
 
         
        offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep,
                        hf_samr_count, &count);
+       snprintf(str, 255, "IDX_AND_NAME pointer: %s%s:", field_name,
+           plural_ending(field_name));
        offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
                        samr_dissect_IDX_AND_NAME_entry, NDR_POINTER_UNIQUE,
-                       di->hf_index);
+                       str, di->hf_index, 0);
 
        proto_item_set_len(item, offset-old_offset);
        return offset;
@@ -2141,9 +2203,18 @@ samr_dissect_IDX_AND_NAME_ARRAY_ptr(tvbuff_t *tvb, int offset,
                        packet_info *pinfo, proto_tree *tree,
                        char *drep)
 {
+       char *field_name;
+       char str[256];
+       dcerpc_info *di;
+
+       di=pinfo->private_data;
+
+       field_name = proto_registrar_get_name(di->hf_index);
+       snprintf(str, 255, "IDX_AND_NAME_ARRAY pointer: %s%s:", field_name,
+           plural_ending(field_name));
         offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
                        samr_dissect_IDX_AND_NAME_ARRAY, NDR_POINTER_UNIQUE,
-                       hf_samr_domain);
+                       str, di->hf_index, 0);
        return offset;
 }
 
@@ -2156,7 +2227,7 @@ samr_dissect_enum_domains_rqst(tvbuff_t *tvb, int offset,
                        hf_samr_hnd, NULL);
         offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
                        samr_dissect_pointer_long, NDR_POINTER_REF,
-                       hf_samr_resume_hnd);
+                       "", hf_samr_resume_hnd, 0);
         offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep,
                        hf_samr_pref_maxsize, NULL);
        return offset;
@@ -2169,13 +2240,13 @@ samr_dissect_enum_domains_reply(tvbuff_t *tvb, int offset,
 {
         offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
                        samr_dissect_pointer_long, NDR_POINTER_REF,
-                       hf_samr_resume_hnd);
+                       "", hf_samr_resume_hnd, 0);
         offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
                        samr_dissect_IDX_AND_NAME_ARRAY_ptr, NDR_POINTER_REF,
-                       hf_samr_domain);
+                       "", hf_samr_domain, 0);
         offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
                        samr_dissect_pointer_long, NDR_POINTER_REF,
-                       hf_samr_entries);
+                       "", hf_samr_entries, 0);
         offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep,
                                      hf_samr_rc, NULL);
        return offset;
@@ -2190,7 +2261,7 @@ samr_dissect_enum_dom_groups_rqst(tvbuff_t *tvb, int offset,
                        hf_samr_hnd, NULL);
         offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
                        samr_dissect_pointer_long, NDR_POINTER_REF,
-                       hf_samr_resume_hnd);
+                       "", hf_samr_resume_hnd, 0);
         offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep,
                        hf_samr_mask, NULL);
         offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep,
@@ -2205,13 +2276,13 @@ samr_dissect_enum_dom_groups_reply(tvbuff_t *tvb, int offset,
 {
         offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
                        samr_dissect_pointer_long, NDR_POINTER_REF,
-                       hf_samr_resume_hnd);
+                       "", hf_samr_resume_hnd, 0);
         offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
                        samr_dissect_IDX_AND_NAME_ARRAY_ptr, NDR_POINTER_REF,
-                       hf_samr_group);
+                       "", hf_samr_group_name, 0);
         offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
                        samr_dissect_pointer_long, NDR_POINTER_REF,
-                       hf_samr_entries);
+                       "", hf_samr_entries, 0);
         offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, drep,
                        hf_samr_rc, NULL);
        return offset;
@@ -2224,13 +2295,13 @@ samr_dissect_enum_dom_alias_reply(tvbuff_t *tvb, int offset,
 {
         offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
                        samr_dissect_pointer_long, NDR_POINTER_REF,
-                       hf_samr_resume_hnd);
+                       "", hf_samr_resume_hnd, 0);
         offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
                        samr_dissect_IDX_AND_NAME_ARRAY_ptr, NDR_POINTER_REF,
-                       hf_samr_alias);
+                       "", hf_samr_alias_name, 0);
         offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
                        samr_dissect_pointer_long, NDR_POINTER_REF,
-                       hf_samr_entries);
+                       "", hf_samr_entries, 0);
         offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, drep,
                        hf_samr_rc, NULL);
        return offset;
@@ -2243,7 +2314,7 @@ samr_dissect_get_members_in_alias_reply(tvbuff_t *tvb, int offset,
 {
        offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
                        samr_dissect_PSID_ARRAY, NDR_POINTER_REF,
-                       -1);
+                       "", -1, 0);
        offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, drep,
                        hf_samr_rc, NULL);
 
@@ -2270,9 +2341,9 @@ samr_dissect_LOGON_HOURS_hours(tvbuff_t *tvb, int offset,
        int old_offset=offset;
 
        if(parent_tree){
-               item = proto_tree_add_text(parent_tree, tvb, offset, 0,
-                       "LOGON_HOURS");
-               tree = proto_item_add_subtree(item, ett_samr_user_dispinfo_1);
+               item = proto_tree_add_text(parent_tree, tvb, offset, -1,
+                       "LOGON_HOURS:");
+               tree = proto_item_add_subtree(item, ett_samr_logon_hours_hours);
        }
 
        offset = dissect_ndr_ucvarray(tvb, offset, pinfo, tree, drep,
@@ -2284,8 +2355,8 @@ samr_dissect_LOGON_HOURS_hours(tvbuff_t *tvb, int offset,
        return offset;
 }
 
-static int
-samr_dissect_LOGON_HOURS(tvbuff_t *tvb, int offset, 
+int
+dissect_ndr_nt_LOGON_HOURS(tvbuff_t *tvb, int offset, 
                        packet_info *pinfo, proto_tree *parent_tree,
                        char *drep)
 {
@@ -2293,10 +2364,12 @@ samr_dissect_LOGON_HOURS(tvbuff_t *tvb, int offset,
        proto_tree *tree=NULL;
        int old_offset=offset;
 
+       ALIGN_TO_4_BYTES;  /* strcture starts with short, but is aligned for longs */
+
        if(parent_tree){
-               item = proto_tree_add_text(parent_tree, tvb, offset, 0,
-                       "LOGON_HOURS");
-               tree = proto_item_add_subtree(item, ett_samr_user_dispinfo_1);
+               item = proto_tree_add_text(parent_tree, tvb, offset, -1,
+                       "LOGON_HOURS:");
+               tree = proto_item_add_subtree(item, ett_samr_logon_hours);
        }
 
        offset = dissect_ndr_uint16(tvb, offset, pinfo, tree, drep,
@@ -2306,7 +2379,7 @@ samr_dissect_LOGON_HOURS(tvbuff_t *tvb, int offset,
           of 11? */
         offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
                        samr_dissect_LOGON_HOURS_hours, NDR_POINTER_UNIQUE,
-                       -1);
+                       "LOGON_HOURS", -1, 0);
 
        proto_item_set_len(item, offset-old_offset);
        return offset;
@@ -2323,21 +2396,20 @@ samr_dissect_USER_INFO_1(tvbuff_t *tvb, int offset,
        int old_offset=offset;
 
        if(parent_tree){
-               item = proto_tree_add_text(parent_tree, tvb, offset, 0,
-                       "UserInfo_1");
-               tree = proto_item_add_subtree(item, ett_samr_user_dispinfo_1);
+               item = proto_tree_add_text(parent_tree, tvb, offset, -1,
+                       "USER_INFO_1:");
+               tree = proto_item_add_subtree(item, ett_samr_user_info_1);
        }
 
        offset = dissect_ndr_nt_UNICODE_STRING(tvb, offset, pinfo, tree, drep,
-                               hf_samr_acct_name);
+                               hf_samr_acct_name, 0);
        offset = dissect_ndr_nt_UNICODE_STRING(tvb, offset, pinfo, tree, drep,
-                               hf_samr_full_name);
-        offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep,
-                               hf_samr_acct_ctrl, NULL);
+                               hf_samr_full_name, 0);
+       offset = dissect_ndr_nt_acct_ctrl(tvb, offset, pinfo, tree, drep);
        offset = dissect_ndr_nt_UNICODE_STRING(tvb, offset, pinfo, tree, drep,
-                               hf_samr_home);
+                               hf_samr_home, 0);
        offset = dissect_ndr_nt_UNICODE_STRING(tvb, offset, pinfo, tree, drep,
-                               hf_samr_script);
+                               hf_samr_script, 0);
 
        proto_item_set_len(item, offset-old_offset);
        return offset;
@@ -2353,15 +2425,15 @@ samr_dissect_USER_INFO_2(tvbuff_t *tvb, int offset,
        int old_offset=offset;
 
        if(parent_tree){
-               item = proto_tree_add_text(parent_tree, tvb, offset, 0,
-                       "UserInfo_2");
-               tree = proto_item_add_subtree(item, ett_samr_user_dispinfo_1);
+               item = proto_tree_add_text(parent_tree, tvb, offset, -1,
+                       "USER_INFO_2:");
+               tree = proto_item_add_subtree(item, ett_samr_user_info_2);
        }
 
        offset = dissect_ndr_nt_UNICODE_STRING(tvb, offset, pinfo, tree, drep,
-                               hf_samr_acct_name);
+                               hf_samr_acct_name, 0);
        offset = dissect_ndr_nt_UNICODE_STRING(tvb, offset, pinfo, tree, drep,
-                               hf_samr_full_name);
+                               hf_samr_full_name, 0);
        offset = dissect_ndr_uint16 (tvb, offset, pinfo, tree, drep,
                                hf_samr_bad_pwd_count, NULL);
        offset = dissect_ndr_uint16 (tvb, offset, pinfo, tree, drep,
@@ -2381,29 +2453,29 @@ samr_dissect_USER_INFO_3(tvbuff_t *tvb, int offset,
        int old_offset=offset;
 
        if(parent_tree){
-               item = proto_tree_add_text(parent_tree, tvb, offset, 0,
-                       "UserInfo_3");
-               tree = proto_item_add_subtree(item, ett_samr_user_dispinfo_1);
+               item = proto_tree_add_text(parent_tree, tvb, offset, -1,
+                       "USER_INFO_3:");
+               tree = proto_item_add_subtree(item, ett_samr_user_info_3);
        }
 
        offset = dissect_ndr_nt_UNICODE_STRING(tvb, offset, pinfo, tree, drep,
-                               hf_samr_acct_name);
+                               hf_samr_acct_name, 0);
        offset = dissect_ndr_nt_UNICODE_STRING(tvb, offset, pinfo, tree, drep,
-                               hf_samr_full_name);
+                               hf_samr_full_name, 0);
        offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, drep,
                                hf_samr_rid, NULL);
        offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, drep,
                                hf_samr_group, NULL);
        offset = dissect_ndr_nt_UNICODE_STRING(tvb, offset, pinfo, tree, drep,
-                               hf_samr_home);
+                               hf_samr_home, 0);
        offset = dissect_ndr_nt_UNICODE_STRING(tvb, offset, pinfo, tree, drep,
-                               hf_samr_home_drive);
+                               hf_samr_home_drive, 0);
        offset = dissect_ndr_nt_UNICODE_STRING(tvb, offset, pinfo, tree, drep,
-                               hf_samr_script);
+                               hf_samr_script, 0);
        offset = dissect_ndr_nt_UNICODE_STRING(tvb, offset, pinfo, tree, drep,
-                               hf_samr_acct_desc);
+                               hf_samr_acct_desc, 0);
        offset = dissect_ndr_nt_UNICODE_STRING(tvb, offset, pinfo, tree, drep,
-                               hf_samr_workstations);
+                               hf_samr_workstations, 0);
        offset = dissect_ndr_nt_NTTIME(tvb, offset, pinfo, tree, drep,
                                hf_samr_logon_time);
        offset = dissect_ndr_nt_NTTIME(tvb, offset, pinfo, tree, drep,
@@ -2414,13 +2486,12 @@ samr_dissect_USER_INFO_3(tvbuff_t *tvb, int offset,
                                hf_samr_pwd_can_change_time);
        offset = dissect_ndr_nt_NTTIME(tvb, offset, pinfo, tree, drep,
                                hf_samr_pwd_must_change_time);
-       offset = samr_dissect_LOGON_HOURS(tvb, offset, pinfo, tree, drep);
+       offset = dissect_ndr_nt_LOGON_HOURS(tvb, offset, pinfo, tree, drep);
        offset = dissect_ndr_uint16 (tvb, offset, pinfo, tree, drep,
                                hf_samr_logon_count, NULL);
        offset = dissect_ndr_uint16 (tvb, offset, pinfo, tree, drep,
                                hf_samr_bad_pwd_count, NULL);
-       offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep,
-                               hf_samr_acct_ctrl, NULL);
+       offset = dissect_ndr_nt_acct_ctrl(tvb, offset, pinfo, tree, drep);
 
        proto_item_set_len(item, offset-old_offset);
        return offset;
@@ -2436,15 +2507,15 @@ samr_dissect_USER_INFO_5(tvbuff_t *tvb, int offset,
        int old_offset=offset;
 
        if(parent_tree){
-               item = proto_tree_add_text(parent_tree, tvb, offset, 0,
-                       "UserInfo_5");
-               tree = proto_item_add_subtree(item, ett_samr_user_dispinfo_1);
+               item = proto_tree_add_text(parent_tree, tvb, offset, -1,
+                       "USER_INFO_5:");
+               tree = proto_item_add_subtree(item, ett_samr_user_info_5);
        }
 
        offset = dissect_ndr_nt_UNICODE_STRING(tvb, offset, pinfo, tree, drep,
-                               hf_samr_acct_name);
+                               hf_samr_acct_name, 0);
        offset = dissect_ndr_nt_UNICODE_STRING(tvb, offset, pinfo, tree, drep,
-                               hf_samr_full_name);
+                               hf_samr_full_name, 0);
        offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, drep,
                                hf_samr_rid, NULL);
        offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, drep,
@@ -2454,20 +2525,20 @@ samr_dissect_USER_INFO_5(tvbuff_t *tvb, int offset,
        offset = dissect_ndr_uint16(tvb, offset, pinfo, tree, drep,
                                hf_samr_codepage, NULL);
        offset = dissect_ndr_nt_UNICODE_STRING(tvb, offset, pinfo, tree, drep,
-                               hf_samr_home);
+                               hf_samr_home, 0);
        offset = dissect_ndr_nt_UNICODE_STRING(tvb, offset, pinfo, tree, drep,
-                               hf_samr_home_drive);
+                               hf_samr_home_drive, 0);
        offset = dissect_ndr_nt_UNICODE_STRING(tvb, offset, pinfo, tree, drep,
-                               hf_samr_script);
+                               hf_samr_script, 0);
        offset = dissect_ndr_nt_UNICODE_STRING(tvb, offset, pinfo, tree, drep,
-                               hf_samr_acct_desc);
+                               hf_samr_acct_desc, 0);
        offset = dissect_ndr_nt_UNICODE_STRING(tvb, offset, pinfo, tree, drep,
-                               hf_samr_workstations);
+                               hf_samr_workstations, 0);
        offset = dissect_ndr_nt_NTTIME(tvb, offset, pinfo, tree, drep,
                                hf_samr_logon_time);
        offset = dissect_ndr_nt_NTTIME(tvb, offset, pinfo, tree, drep,
                                hf_samr_logoff_time);
-       offset = samr_dissect_LOGON_HOURS(tvb, offset, pinfo, tree, drep);
+       offset = dissect_ndr_nt_LOGON_HOURS(tvb, offset, pinfo, tree, drep);
        offset = dissect_ndr_uint16 (tvb, offset, pinfo, tree, drep,
                                hf_samr_bad_pwd_count, NULL);
        offset = dissect_ndr_uint16 (tvb, offset, pinfo, tree, drep,
@@ -2476,8 +2547,7 @@ samr_dissect_USER_INFO_5(tvbuff_t *tvb, int offset,
                                hf_samr_pwd_last_set_time);
        offset = dissect_ndr_nt_NTTIME(tvb, offset, pinfo, tree, drep,
                                hf_samr_acct_expiry_time);
-       offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep,
-                               hf_samr_acct_ctrl, NULL);
+       offset = dissect_ndr_nt_acct_ctrl(tvb, offset, pinfo, tree, drep);
 
        proto_item_set_len(item, offset-old_offset);
        return offset;
@@ -2493,15 +2563,15 @@ samr_dissect_USER_INFO_6(tvbuff_t *tvb, int offset,
        int old_offset=offset;
 
        if(parent_tree){
-               item = proto_tree_add_text(parent_tree, tvb, offset, 0,
-                       "UserInfo_6");
-               tree = proto_item_add_subtree(item, ett_samr_user_dispinfo_1);
+               item = proto_tree_add_text(parent_tree, tvb, offset, -1,
+                       "USER_INFO_6:");
+               tree = proto_item_add_subtree(item, ett_samr_user_info_6);
        }
 
        offset = dissect_ndr_nt_UNICODE_STRING(tvb, offset, pinfo, tree, drep,
-                               hf_samr_acct_name);
+                               hf_samr_acct_name, 0);
        offset = dissect_ndr_nt_UNICODE_STRING(tvb, offset, pinfo, tree, drep,
-                               hf_samr_full_name);
+                               hf_samr_full_name, 0);
 
        proto_item_set_len(item, offset-old_offset);
        return offset;
@@ -2517,9 +2587,9 @@ samr_dissect_USER_INFO_18(tvbuff_t *tvb, int offset,
        int old_offset=offset;
 
        if(parent_tree){
-               item = proto_tree_add_text(parent_tree, tvb, offset, 0,
-                       "UserInfo_18");
-               tree = proto_item_add_subtree(item, ett_samr_user_dispinfo_1);
+               item = proto_tree_add_text(parent_tree, tvb, offset, -1,
+                       "USER_INFO_18:");
+               tree = proto_item_add_subtree(item, ett_samr_user_info_18);
        }
 
        offset = samr_dissect_CRYPT_HASH(tvb, offset, pinfo, tree, drep);
@@ -2545,13 +2615,12 @@ samr_dissect_USER_INFO_19(tvbuff_t *tvb, int offset,
        int old_offset=offset;
 
        if(parent_tree){
-               item = proto_tree_add_text(parent_tree, tvb, offset, 0,
-                       "UserInfo_19");
-               tree = proto_item_add_subtree(item, ett_samr_user_dispinfo_1);
+               item = proto_tree_add_text(parent_tree, tvb, offset, -1,
+                       "USER_INFO_19:");
+               tree = proto_item_add_subtree(item, ett_samr_user_info_19);
        }
 
-       offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep,
-                               hf_samr_acct_ctrl, NULL);
+       offset = dissect_ndr_nt_acct_ctrl(tvb, offset, pinfo, tree, drep);
        offset = dissect_ndr_nt_NTTIME(tvb, offset, pinfo, tree, drep,
                                hf_samr_logon_time);
        offset = dissect_ndr_nt_NTTIME(tvb, offset, pinfo, tree, drep,
@@ -2586,9 +2655,9 @@ samr_dissect_BUFFER_buffer(tvbuff_t *tvb, int offset,
        int old_offset=offset;
 
        if(parent_tree){
-               item = proto_tree_add_text(parent_tree, tvb, offset, 0,
-                       "BUFFER");
-               tree = proto_item_add_subtree(item, ett_samr_user_dispinfo_1);
+               item = proto_tree_add_text(parent_tree, tvb, offset, -1,
+                       "BUFFER:");
+               tree = proto_item_add_subtree(item, ett_samr_buffer_buffer);
        }
 
        offset = dissect_ndr_ucarray(tvb, offset, pinfo, tree, drep,
@@ -2610,15 +2679,15 @@ samr_dissect_BUFFER(tvbuff_t *tvb, int offset,
        int old_offset=offset;
 
        if(parent_tree){
-               item = proto_tree_add_text(parent_tree, tvb, offset, 0,
-                       "BUFFER");
-               tree = proto_item_add_subtree(item, ett_samr_user_dispinfo_1);
+               item = proto_tree_add_text(parent_tree, tvb, offset, -1,
+                       "BUFFER:");
+               tree = proto_item_add_subtree(item, ett_samr_buffer);
        }
        offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep,
                                hf_samr_count, NULL);
         offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
                        samr_dissect_BUFFER_buffer, NDR_POINTER_UNIQUE,
-                       -1);
+                       "BUFFER", -1, 0);
 
        proto_item_set_len(item, offset-old_offset);
        return offset;
@@ -2631,7 +2700,7 @@ samr_dissect_BUFFER_ptr(tvbuff_t *tvb, int offset,
 {
         offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
                        samr_dissect_BUFFER, NDR_POINTER_UNIQUE,
-                       -1);
+                       "BUFFER", -1, 0);
        return offset;
 }
 
@@ -2645,9 +2714,9 @@ samr_dissect_USER_INFO_21(tvbuff_t *tvb, int offset,
        int old_offset=offset;
 
        if(parent_tree){
-               item = proto_tree_add_text(parent_tree, tvb, offset, 0,
-                       "UserInfo_21");
-               tree = proto_item_add_subtree(item, ett_samr_user_dispinfo_1);
+               item = proto_tree_add_text(parent_tree, tvb, offset, -1,
+                       "USER_INFO_21:");
+               tree = proto_item_add_subtree(item, ett_samr_user_info_21);
        }
 
        offset = dissect_ndr_nt_NTTIME(tvb, offset, pinfo, tree, drep,
@@ -2663,41 +2732,40 @@ samr_dissect_USER_INFO_21(tvbuff_t *tvb, int offset,
        offset = dissect_ndr_nt_NTTIME(tvb, offset, pinfo, tree, drep,
                                hf_samr_pwd_must_change_time);
        offset = dissect_ndr_nt_UNICODE_STRING(tvb, offset, pinfo, tree, drep,
-                               hf_samr_acct_name);
+                               hf_samr_acct_name, 2);
        offset = dissect_ndr_nt_UNICODE_STRING(tvb, offset, pinfo, tree, drep,
-                               hf_samr_full_name);
+                               hf_samr_full_name, 0);
        offset = dissect_ndr_nt_UNICODE_STRING(tvb, offset, pinfo, tree, drep,
-                               hf_samr_home);
+                               hf_samr_home, 0);
        offset = dissect_ndr_nt_UNICODE_STRING(tvb, offset, pinfo, tree, drep,
-                               hf_samr_home_drive);
+                               hf_samr_home_drive, 0);
        offset = dissect_ndr_nt_UNICODE_STRING(tvb, offset, pinfo, tree, drep,
-                               hf_samr_script);
+                               hf_samr_script, 0);
        offset = dissect_ndr_nt_UNICODE_STRING(tvb, offset, pinfo, tree, drep,
-                               hf_samr_profile);
+                               hf_samr_profile, 0);
        offset = dissect_ndr_nt_UNICODE_STRING(tvb, offset, pinfo, tree, drep,
-                               hf_samr_acct_desc);
+                               hf_samr_acct_desc, 0);
        offset = dissect_ndr_nt_UNICODE_STRING(tvb, offset, pinfo, tree, drep,
-                               hf_samr_workstations);
+                               hf_samr_workstations, 0);
        offset = dissect_ndr_nt_UNICODE_STRING(tvb, offset, pinfo, tree, drep,
-                               hf_samr_comment);
+                               hf_samr_comment, 0);
        offset = dissect_ndr_nt_UNICODE_STRING(tvb, offset, pinfo, tree, drep,
-                               hf_samr_parameters);
+                               hf_samr_parameters, 0);
        offset = dissect_ndr_nt_UNICODE_STRING(tvb, offset, pinfo, tree, drep,
-                               hf_samr_unknown_string);
+                               hf_samr_unknown_string, 0);
        offset = dissect_ndr_nt_UNICODE_STRING(tvb, offset, pinfo, tree, drep,
-                               hf_samr_unknown_string);
+                               hf_samr_unknown_string, 0);
        offset = dissect_ndr_nt_UNICODE_STRING(tvb, offset, pinfo, tree, drep,
-                               hf_samr_unknown_string);
+                               hf_samr_unknown_string, 0);
        offset = samr_dissect_BUFFER(tvb, offset, pinfo, tree, drep);
        offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, drep,
                                hf_samr_rid, NULL);
        offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, drep,
                                hf_samr_group, NULL);
-       offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep,
-                               hf_samr_acct_ctrl, NULL);
+       offset = dissect_ndr_nt_acct_ctrl(tvb, offset, pinfo, tree, drep);
        offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep,
                                hf_samr_unknown_long, NULL);
-       offset = samr_dissect_LOGON_HOURS(tvb, offset, pinfo, tree, drep);
+       offset = dissect_ndr_nt_LOGON_HOURS(tvb, offset, pinfo, tree, drep);
        offset = dissect_ndr_uint16 (tvb, offset, pinfo, tree, drep,
                                hf_samr_bad_pwd_count, NULL);
        offset = dissect_ndr_uint16 (tvb, offset, pinfo, tree, drep,
@@ -2729,9 +2797,9 @@ samr_dissect_USER_INFO_22(tvbuff_t *tvb, int offset,
        int old_offset=offset;
 
        if(parent_tree){
-               item = proto_tree_add_text(parent_tree, tvb, offset, 0,
-                       "UserInfo_22");
-               tree = proto_item_add_subtree(item, ett_samr_user_dispinfo_1);
+               item = proto_tree_add_text(parent_tree, tvb, offset, -1,
+                       "USER_INFO_22:");
+               tree = proto_item_add_subtree(item, ett_samr_user_info_22);
        }
 
        offset = samr_dissect_USER_INFO_21(tvb, offset, pinfo, tree, drep);
@@ -2752,9 +2820,9 @@ samr_dissect_USER_INFO_23(tvbuff_t *tvb, int offset,
        int old_offset=offset;
 
        if(parent_tree){
-               item = proto_tree_add_text(parent_tree, tvb, offset, 0,
-                       "UserInfo_23");
-               tree = proto_item_add_subtree(item, ett_samr_user_dispinfo_1);
+               item = proto_tree_add_text(parent_tree, tvb, offset, -1,
+                       "USER_INFO_23:");
+               tree = proto_item_add_subtree(item, ett_samr_user_info_23);
        }
 
        offset = samr_dissect_USER_INFO_21(tvb, offset, pinfo, tree, drep);
@@ -2774,9 +2842,9 @@ samr_dissect_USER_INFO_24(tvbuff_t *tvb, int offset,
        int old_offset=offset;
 
        if(parent_tree){
-               item = proto_tree_add_text(parent_tree, tvb, offset, 0,
-                       "UserInfo_24");
-               tree = proto_item_add_subtree(item, ett_samr_user_dispinfo_1);
+               item = proto_tree_add_text(parent_tree, tvb, offset, -1,
+                       "USER_INFO_24:");
+               tree = proto_item_add_subtree(item, ett_samr_user_info_24);
        }
 
        offset = samr_dissect_CRYPT_PASSWORD(tvb, offset, pinfo, tree, drep);
@@ -2798,9 +2866,9 @@ samr_dissect_USER_INFO (tvbuff_t *tvb, int offset,
        guint16 level;
 
        if(parent_tree){
-               item = proto_tree_add_text(parent_tree, tvb, offset, 0,
-                       "UserInfo");
-               tree = proto_item_add_subtree(item, ett_samr_user_dispinfo_1);
+               item = proto_tree_add_text(parent_tree, tvb, offset, -1,
+                       "USER_INFO:");
+               tree = proto_item_add_subtree(item, ett_samr_user_info);
        }
         offset = dissect_ndr_uint16 (tvb, offset, pinfo, tree, drep,
                                      hf_samr_level, &level);
@@ -2819,7 +2887,7 @@ samr_dissect_USER_INFO (tvbuff_t *tvb, int offset,
                                tvb, offset, pinfo, tree, drep);
                break;
        case 4: 
-               offset = samr_dissect_LOGON_HOURS(
+               offset = dissect_ndr_nt_LOGON_HOURS(
                                tvb, offset, pinfo, tree, drep);
                break;
        case 5: 
@@ -2832,11 +2900,11 @@ samr_dissect_USER_INFO (tvbuff_t *tvb, int offset,
                break;
        case 7:
                offset = dissect_ndr_nt_UNICODE_STRING(tvb, offset, pinfo, tree, drep,
-                               hf_samr_full_name);
+                               hf_samr_full_name, 0);
                break;
        case 8:
                offset = dissect_ndr_nt_UNICODE_STRING(tvb, offset, pinfo, tree, drep,
-                               hf_samr_acct_desc);
+                               hf_samr_acct_desc, 0);
                break;
        case 9:
                offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep,
@@ -2848,19 +2916,19 @@ samr_dissect_USER_INFO (tvbuff_t *tvb, int offset,
                break;
        case 11:
                offset = dissect_ndr_nt_UNICODE_STRING(tvb, offset, pinfo, tree, drep,
-                               hf_samr_home);
+                               hf_samr_home, 0);
                break;
        case 12:
                offset = dissect_ndr_nt_UNICODE_STRING(tvb, offset, pinfo, tree, drep,
-                               hf_samr_home_drive);
+                               hf_samr_home_drive, 0);
                break;
        case 13:
                offset = dissect_ndr_nt_UNICODE_STRING(tvb, offset, pinfo, tree, drep,
-                               hf_samr_script);
+                               hf_samr_script, 0);
                break;
        case 14:
                offset = dissect_ndr_nt_UNICODE_STRING(tvb, offset, pinfo, tree, drep,
-                               hf_samr_workstations);
+                               hf_samr_workstations, 0);
                break;
        case 16:
                offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep,
@@ -2880,7 +2948,7 @@ samr_dissect_USER_INFO (tvbuff_t *tvb, int offset,
                break;
        case 20:
                offset = dissect_ndr_nt_UNICODE_STRING(tvb, offset, pinfo, tree, drep,
-                               hf_samr_profile);
+                               hf_samr_profile, 0);
                break;
        case 21:        
                offset = samr_dissect_USER_INFO_21(
@@ -2911,7 +2979,7 @@ samr_dissect_USER_INFO_ptr(tvbuff_t *tvb, int offset,
 {
        offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
                        samr_dissect_USER_INFO, NDR_POINTER_UNIQUE,
-                       -1);
+                       "USER_INFO pointer", -1, 0);
        return offset;
 }
 
@@ -2926,7 +2994,7 @@ samr_dissect_set_information_user2_rqst(tvbuff_t *tvb, int offset,
                        hf_samr_level, NULL);
        offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
                        samr_dissect_USER_INFO, NDR_POINTER_REF,
-                       -1);
+                       "", -1, 0);
 
        return offset;
 }
@@ -2938,7 +3006,7 @@ samr_dissect_query_userinfo_reply(tvbuff_t *tvb, int offset,
 {
        offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
                        samr_dissect_USER_INFO_ptr, NDR_POINTER_REF,
-                       -1);
+                       "", -1, 0);
        offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, drep,
                        hf_samr_rc, NULL);
 
@@ -2967,9 +3035,9 @@ samr_dissect_MEMBER_ARRAY_types(tvbuff_t *tvb, int offset,
        int old_offset=offset;
 
        if(parent_tree){
-               item = proto_tree_add_text(parent_tree, tvb, offset, 0,
-                       "Types");
-               tree = proto_item_add_subtree(item, ett_samr_user_dispinfo_1);
+               item = proto_tree_add_text(parent_tree, tvb, offset, -1,
+                       "MEMBER_ARRAY_types:");
+               tree = proto_item_add_subtree(item, ett_samr_member_array_types);
        }
 
        offset = dissect_ndr_ucarray(tvb, offset, pinfo, tree, drep,
@@ -3003,9 +3071,9 @@ samr_dissect_MEMBER_ARRAY_rids(tvbuff_t *tvb, int offset,
        int old_offset=offset;
 
        if(parent_tree){
-               item = proto_tree_add_text(parent_tree, tvb, offset, 0,
-                       "RIDs");
-               tree = proto_item_add_subtree(item, ett_samr_user_dispinfo_1);
+               item = proto_tree_add_text(parent_tree, tvb, offset, -1,
+                       "MEMBER_ARRAY_rids:");
+               tree = proto_item_add_subtree(item, ett_samr_member_array_rids);
        }
 
        offset = dissect_ndr_ucarray(tvb, offset, pinfo, tree, drep,
@@ -3028,19 +3096,19 @@ samr_dissect_MEMBER_ARRAY(tvbuff_t *tvb, int offset,
        int old_offset=offset;
 
        if(parent_tree){
-               item = proto_tree_add_text(parent_tree, tvb, offset, 0,
-                       "Member Array");
-               tree = proto_item_add_subtree(item, ett_samr_user_dispinfo_1);
+               item = proto_tree_add_text(parent_tree, tvb, offset, -1,
+                       "MEMBER_ARRAY:");
+               tree = proto_item_add_subtree(item, ett_samr_member_array);
        }
 
        offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, drep,
                        hf_samr_count, &count);
         offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
                        samr_dissect_MEMBER_ARRAY_rids, NDR_POINTER_UNIQUE,
-                       -1);
+                       "RIDs", -1, 0);
         offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
                        samr_dissect_MEMBER_ARRAY_types, NDR_POINTER_UNIQUE,
-                       -1);
+                       "Types", -1, 0);
 
        proto_item_set_len(item, offset-old_offset);
        return offset;
@@ -3053,7 +3121,7 @@ samr_dissect_MEMBER_ARRAY_ptr(tvbuff_t *tvb, int offset,
 {
        offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
                        samr_dissect_MEMBER_ARRAY, NDR_POINTER_UNIQUE,
-                       -1);
+                       "MEMBER_ARRAY", -1, 0);
        return offset;
 }
 
@@ -3064,7 +3132,7 @@ samr_dissect_query_groupmem_reply(tvbuff_t *tvb, int offset,
 {
        offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
                        samr_dissect_MEMBER_ARRAY_ptr, NDR_POINTER_REF,
-                       -1);
+                       "", -1, 0);
        offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, drep,
                        hf_samr_rc, NULL);
 
@@ -3082,7 +3150,7 @@ samr_dissect_set_sec_object_rqst(tvbuff_t *tvb, int offset,
                        hf_samr_info_type, NULL);
        offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
                        samr_dissect_BUFFER, NDR_POINTER_REF,
-                       -1);
+                       "", -1, 0);
 
        return offset;
 }
@@ -3107,7 +3175,7 @@ samr_dissect_query_sec_object_reply(tvbuff_t *tvb, int offset,
 {
        offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
                        samr_dissect_BUFFER_ptr, NDR_POINTER_REF,
-                       -1);
+                       "", -1, 0);
        offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, drep,
                        hf_samr_rc, NULL);
 
@@ -3121,7 +3189,7 @@ samr_dissect_LOOKUP_NAMES_name(tvbuff_t *tvb, int offset,
                        char *drep)
 {
        offset = dissect_ndr_nt_UNICODE_STRING(tvb, offset, pinfo, tree, drep,
-                               hf_samr_acct_name);
+                               hf_samr_acct_name, 1);
        return offset;
 }
 
@@ -3135,9 +3203,9 @@ samr_dissect_LOOKUP_NAMES(tvbuff_t *tvb, int offset,
        int old_offset=offset;
 
        if(parent_tree){
-               item = proto_tree_add_text(parent_tree, tvb, offset, 0,
-                       "Names");
-               tree = proto_item_add_subtree(item, ett_samr_user_dispinfo_1);
+               item = proto_tree_add_text(parent_tree, tvb, offset, -1,
+                       "NAMES:");
+               tree = proto_item_add_subtree(item, ett_samr_names);
        }
 
        offset = dissect_ndr_ucvarray(tvb, offset, pinfo, tree, drep,
@@ -3159,7 +3227,7 @@ samr_dissect_lookup_names_rqst(tvbuff_t *tvb, int offset,
                        hf_samr_count, NULL);
         offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
                        samr_dissect_LOOKUP_NAMES, NDR_POINTER_REF,
-                       -1);
+                       "", -1, 0);
 
        return offset;
 }
@@ -3171,10 +3239,10 @@ samr_dissect_lookup_names_reply(tvbuff_t *tvb, int offset,
 {
         offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
                        samr_dissect_INDEX_ARRAY, NDR_POINTER_REF,
-                       hf_samr_rid);
+                       "", hf_samr_rid, 0);
         offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
                        samr_dissect_INDEX_ARRAY, NDR_POINTER_REF,
-                       hf_samr_type);
+                       "", hf_samr_type, 0);
        offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, drep,
                        hf_samr_rc, NULL);
 
@@ -3202,9 +3270,9 @@ samr_dissect_LOOKUP_RIDS(tvbuff_t *tvb, int offset,
        int old_offset=offset;
 
        if(parent_tree){
-               item = proto_tree_add_text(parent_tree, tvb, offset, 0,
-                       "RIDs");
-               tree = proto_item_add_subtree(item, ett_samr_user_dispinfo_1);
+               item = proto_tree_add_text(parent_tree, tvb, offset, -1,
+                       "RIDS:");
+               tree = proto_item_add_subtree(item, ett_samr_rids);
        }
 
        offset = dissect_ndr_ucvarray(tvb, offset, pinfo, tree, drep,
@@ -3226,7 +3294,7 @@ samr_dissect_lookup_rids_rqst(tvbuff_t *tvb, int offset,
                        hf_samr_count, NULL);
         offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
                        samr_dissect_LOOKUP_RIDS, NDR_POINTER_REF,
-                       -1);
+                       "", -1, 0);
 
        return offset;
 }
@@ -3237,7 +3305,17 @@ samr_dissect_UNICODE_STRING_ARRAY_name(tvbuff_t *tvb, int offset,
                        char *drep)
 {
        offset = dissect_ndr_nt_UNICODE_STRING(tvb, offset, pinfo, tree, drep,
-                               hf_samr_acct_name);
+                               hf_samr_acct_name, 0);
+       return offset;
+}
+
+static int
+samr_dissect_UNICODE_STRING_ARRAY_names(tvbuff_t *tvb, int offset, 
+                       packet_info *pinfo, proto_tree *tree,
+                       char *drep)
+{
+       offset = dissect_ndr_ucarray(tvb, offset, pinfo, tree, drep,
+                       samr_dissect_UNICODE_STRING_ARRAY_name);
        return offset;
 }
 
@@ -3251,16 +3329,17 @@ samr_dissect_UNICODE_STRING_ARRAY(tvbuff_t *tvb, int offset,
        int old_offset=offset;
 
        if(parent_tree){
-               item = proto_tree_add_text(parent_tree, tvb, offset, 0,
-                       "Names");
-               tree = proto_item_add_subtree(item, ett_samr_user_dispinfo_1);
+               item = proto_tree_add_text(parent_tree, tvb, offset, -1,
+                       "NAMES:");
+               tree = proto_item_add_subtree(item, ett_samr_names);
        }
 
        offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, drep,
                        hf_samr_count, NULL);
 
-       offset = dissect_ndr_ucarray(tvb, offset, pinfo, tree, drep,
-                       samr_dissect_UNICODE_STRING_ARRAY_name);
+        offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
+                       samr_dissect_UNICODE_STRING_ARRAY_names, NDR_POINTER_UNIQUE,
+                       "Strings", -1, 0);
 
        proto_item_set_len(item, offset-old_offset);
        return offset;
@@ -3276,10 +3355,10 @@ samr_dissect_lookup_rids_reply(tvbuff_t *tvb, int offset,
 {
         offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
                        samr_dissect_UNICODE_STRING_ARRAY, NDR_POINTER_REF,
-                       hf_samr_rid);
+                       "", hf_samr_rid, 0);
         offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
-                       samr_dissect_MEMBER_ARRAY_types, NDR_POINTER_REF,
-                       -1);
+                       samr_dissect_INDEX_ARRAY, NDR_POINTER_REF,
+                       "", hf_samr_type, 0);
        offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, drep,
                        hf_samr_rc, NULL);
 
@@ -3305,7 +3384,7 @@ static dcerpc_sub_dissector dcerpc_samr_dissectors[] = {
                samr_dissect_context_handle,
                samr_dissect_rc },
         { SAMR_LOOKUP_DOMAIN, "LOOKUP_DOMAIN",
-               samr_dissect_get_domain_password_information_rqst,
+               samr_dissect_lookup_domain_rqst,
                samr_dissect_lookup_domain_reply },
         { SAMR_ENUM_DOMAINS, "ENUM_DOMAINS",
                samr_dissect_enum_domains_rqst,
@@ -3535,13 +3614,17 @@ proto_register_dcerpc_samr(void)
                { "Index", "samr.index", FT_UINT32, BASE_DEC, 
                NULL, 0x0, "Index", HFILL }},
 
-       { &hf_samr_acct_ctrl,
-               { "Acct Ctrl", "samr.acct_ctrl", FT_UINT32, BASE_DEC, 
-               NULL, 0x0, "Acct CTRL", HFILL }},
-
         { &hf_samr_count,
           { "Count", "samr.count", FT_UINT32, BASE_DEC, NULL, 0x0, "Number of elements in following array", HFILL }},
 
+       { &hf_samr_alias_name,
+               { "Alias Name", "samr.alias_name", FT_STRING, BASE_NONE,
+               NULL, 0, "Name of Alias", HFILL }},
+
+       { &hf_samr_group_name,
+               { "Group Name", "samr.group_name", FT_STRING, BASE_NONE,
+               NULL, 0, "Name of Group", HFILL }},
+
        { &hf_samr_acct_name,
                { "Account Name", "samr.acct_name", FT_STRING, BASE_NONE,
                NULL, 0, "Name of Account", HFILL }},
@@ -3595,7 +3678,7 @@ proto_register_dcerpc_samr(void)
                NULL, 0, "Parameters", HFILL }},
 
        { &hf_samr_unknown_string,
-               { "Unknwon string", "samr.unknown_string", FT_STRING, BASE_NONE,
+               { "Unknown string", "samr.unknown_string", FT_STRING, BASE_NONE,
                NULL, 0, "Unknown string. If you know what this is, contact ethereal developers.", HFILL }},
 
        { &hf_samr_unknown_hyper,
@@ -3713,7 +3796,6 @@ proto_register_dcerpc_samr(void)
                "Divisions", "samr.divisions", FT_UINT16, BASE_DEC,
                NULL, 0, "Number of divisions for LOGON_HOURS", HFILL }},
 
-
        /* these are used by packet-dcerpc-nt.c */
        { &hf_nt_string_length,
                { "Length", "nt.string.length", FT_UINT16, BASE_DEC, 
@@ -3734,11 +3816,108 @@ proto_register_dcerpc_samr(void)
        { &hf_nt_str_max_len,
                { "Max Length", "nt.str.max_len", FT_UINT32, BASE_DEC, 
                NULL, 0x0, "Max Length of string in short integers", HFILL }},
+
+       { &hf_nt_acct_ctrl,
+               { "Acct Ctrl", "nt.acct_ctrl", FT_UINT32, BASE_HEX, 
+               NULL, 0x0, "Acct CTRL", HFILL }},
+
+       { &hf_nt_acb_disabled, {
+               "", "nt.acb.disabled", FT_BOOLEAN, 32,
+               TFS(&tfs_nt_acb_disabled), 0x0001, "If this account is enabled or disabled", HFILL }},
+
+       { &hf_nt_acb_homedirreq, {
+               "", "nt.acb.homedirreq", FT_BOOLEAN, 32,
+               TFS(&tfs_nt_acb_homedirreq), 0x0002, "Is hom,edirs required for this account?", HFILL }},
+
+       { &hf_nt_acb_pwnotreq, {
+               "", "nt.acb.pwnotreq", FT_BOOLEAN, 32,
+               TFS(&tfs_nt_acb_pwnotreq), 0x0004, "If a password is required for this account?", HFILL }},
+
+       { &hf_nt_acb_tempdup, {
+               "", "nt.acb.tempdup", FT_BOOLEAN, 32,
+               TFS(&tfs_nt_acb_tempdup), 0x0008, "If this is a temporary duplicate account", HFILL }},
+
+       { &hf_nt_acb_normal, {
+               "", "nt.acb.normal", FT_BOOLEAN, 32,
+               TFS(&tfs_nt_acb_normal), 0x0010, "If this is a normal user account", HFILL }},
+
+       { &hf_nt_acb_mns, {
+               "", "nt.acb.mns", FT_BOOLEAN, 32,
+               TFS(&tfs_nt_acb_mns), 0x0020, "MNS logon user account", HFILL }},
+
+       { &hf_nt_acb_domtrust, {
+               "", "nt.acb.domtrust", FT_BOOLEAN, 32,
+               TFS(&tfs_nt_acb_domtrust), 0x0040, "Interdomain trust account", HFILL }},
+
+       { &hf_nt_acb_wstrust, {
+               "", "nt.acb.wstrust", FT_BOOLEAN, 32,
+               TFS(&tfs_nt_acb_wstrust), 0x0080, "Workstation trust account", HFILL }},
+
+       { &hf_nt_acb_svrtrust, {
+               "", "nt.acb.svrtrust", FT_BOOLEAN, 32,
+               TFS(&tfs_nt_acb_svrtrust), 0x0100, "Server trust account", HFILL }},
+
+       { &hf_nt_acb_pwnoexp, {
+               "", "nt.acb.pwnoexp", FT_BOOLEAN, 32,
+               TFS(&tfs_nt_acb_pwnoexp), 0x0200, "If this account expires or not", HFILL }},
+
+       { &hf_nt_acb_autolock, {
+               "", "nt.acb.autolock", FT_BOOLEAN, 32,
+               TFS(&tfs_nt_acb_autolock), 0x0400, "If this account has been autolocked", HFILL }},
         };
         static gint *ett[] = {
                 &ett_dcerpc_samr,
                 &ett_nt_unicode_string,
                &ett_samr_user_dispinfo_1,
+                &ett_samr_user_dispinfo_1_array,
+                &ett_samr_user_dispinfo_2,
+                &ett_samr_user_dispinfo_2_array,
+                &ett_samr_group_dispinfo,
+                &ett_samr_group_dispinfo_array,
+                &ett_samr_ascii_dispinfo,
+                &ett_samr_ascii_dispinfo_array,
+                &ett_samr_display_info,
+                &ett_samr_password_info,
+                &ett_samr_server,
+                &ett_samr_user_group,
+                &ett_samr_user_group_array,
+                &ett_samr_alias_info,
+                &ett_samr_group_info,
+                &ett_samr_domain_info_1,
+                &ett_samr_domain_info_2,
+                &ett_samr_domain_info_8,
+                &ett_samr_replication_status,
+                &ett_samr_domain_info_11,
+                &ett_samr_domain_info_13,
+                &ett_samr_domain_info,
+                &ett_samr_sid_pointer,
+                &ett_samr_sid_array,
+                &ett_samr_index_array,
+                &ett_samr_idx_and_name,
+                &ett_samr_idx_and_name_array,
+                &ett_samr_logon_hours,
+                &ett_samr_logon_hours_hours,
+                &ett_samr_user_info_1,
+                &ett_samr_user_info_2,
+                &ett_samr_user_info_3,
+                &ett_samr_user_info_5,
+                &ett_samr_user_info_6,
+                &ett_samr_user_info_18,
+                &ett_samr_user_info_19,
+                &ett_samr_buffer_buffer,
+                &ett_samr_buffer,
+                &ett_samr_user_info_21,
+                &ett_samr_user_info_22,
+                &ett_samr_user_info_23,
+                &ett_samr_user_info_24,
+                &ett_samr_user_info,
+                &ett_samr_member_array_types,
+                &ett_samr_member_array_rids,
+                &ett_samr_member_array,
+                &ett_samr_names,
+                &ett_samr_rids,
+
+                &ett_nt_acct_ctrl,
         };
 
         proto_dcerpc_samr = proto_register_protocol(