add a helper that supports decoding either a 16 or 32 bit integer based
authorsahlberg <sahlberg@f5534014-38df-0310-8fa8-9805f1628bb7>
Sat, 3 Oct 2009 04:49:04 +0000 (04:49 +0000)
committersahlberg <sahlberg@f5534014-38df-0310-8fa8-9805f1628bb7>
Sat, 3 Oct 2009 04:49:04 +0000 (04:49 +0000)
on whether nrd or ndr64 is used.

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@30263 f5534014-38df-0310-8fa8-9805f1628bb7

epan/dissectors/packet-dcerpc-ndr.c
epan/dissectors/packet-dcerpc-samr.c
epan/dissectors/packet-dcerpc.h

index a6e760bde1d46673bf8eabd804302db906f1b3e1..dc1e01afc622a1074cd36316257ad20f03153880 100644 (file)
@@ -236,6 +236,28 @@ dissect_ndr_4or8 (tvbuff_t *tvb, gint offset, packet_info *pinfo,
     }
 }
 
+/* This is used to dissect the new datatypes, such as enums
+   that are 2 bytes in size in NDR but 4 bytes in NDR64.
+*/
+int
+dissect_ndr_2or4 (tvbuff_t *tvb, gint offset, packet_info *pinfo,
+                    proto_tree *tree, guint8 *drep,
+                    int hfindex, guint32 *pdata)
+{
+    dcerpc_info *di;
+
+    di=pinfo->private_data;
+
+    if (di->call_data->flags & DCERPC_IS_NDR64) {
+        return dissect_ndr_uint32(tvb, offset, pinfo, tree, drep, hfindex, pdata);
+    } else {
+        guint16 val;
+        offset = dissect_ndr_uint16(tvb, offset, pinfo, tree, drep, hfindex, &val);
+       *pdata = val;
+       return offset;
+    }
+}
+
 int
 PIDL_dissect_uint32 (tvbuff_t *tvb, gint offset, packet_info *pinfo,
                     proto_tree *tree, guint8 *drep,
index fdb9339646b6d1c2012eaf3e7c59ac948802c98d..f417464c7ce326d02681fbc43647ee720e0d63f5 100644 (file)
@@ -3785,7 +3785,7 @@ samr_dissect_DomainInfo(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U
        proto_item *item = NULL;
        proto_tree *tree = NULL;
        int old_offset;
-       guint16 level;
+       guint32 level;
 
        old_offset = offset;
        if (parent_tree) {
@@ -3793,7 +3793,7 @@ samr_dissect_DomainInfo(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U
                tree = proto_item_add_subtree(item, ett_samr_samr_DomainInfo);
        }
 
-       offset = dissect_ndr_uint16(tvb, offset, pinfo, tree, drep, hf_index, &level);
+       offset = dissect_ndr_2or4(tvb, offset, pinfo, tree, drep, hf_index, &level);
        ALIGN_TO_8_BYTES;
 
        switch(level) {
index d03b039afd5b56e77c2b85fc3da27664c72b5c66..14996828c9eb77bd544e9b0629506d1625420a75 100644 (file)
@@ -185,6 +185,9 @@ int dissect_ndr_uuid_t (tvbuff_t *tvb, gint offset, packet_info *pinfo,
 int dissect_ndr_ctx_hnd (tvbuff_t *tvb, gint offset, packet_info *pinfo,
                         proto_tree *tree, guint8 *drep,
                         int hfindex, e_ctx_hnd *pdata);
+int dissect_ndr_2or4 (tvbuff_t *tvb, gint offset, packet_info *pinfo,
+                       proto_tree *tree, guint8 *drep,
+                       int hfindex, guint32 *pdata);
 int dissect_ndr_4or8 (tvbuff_t *tvb, gint offset, packet_info *pinfo,
                        proto_tree *tree, guint8 *drep,
                        int hfindex, guint64 *pdata);