summaryrefslogtreecommitdiff
path: root/tools/pidl
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2015-09-28 07:28:28 +0200
committerMichael Mann <mmann78@netscape.net>2016-08-06 15:34:02 +0000
commit6e3ebccf22441c9f226fed77bd0c2d5418c3bbfc (patch)
tree0c4d1537717b29b1484e71e6541acff929f88fce /tools/pidl
parent29cc1817b9dee92748199f9517815a0437393023 (diff)
downloadwireshark-6e3ebccf22441c9f226fed77bd0c2d5418c3bbfc.tar.gz
tools/pidl: support HRESULT as return code in wireshark autogenerated dissectors.
Guenther Change-Id: I68b7c579c5a519e429d2f4c2b3f63247e02f24e3 Signed-off-by: Günther Deschner <gd@samba.org> Reviewed-on: https://code.wireshark.org/review/16718 Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'tools/pidl')
-rw-r--r--tools/pidl/lib/Parse/Pidl/Wireshark/NDR.pm9
1 files changed, 8 insertions, 1 deletions
diff --git a/tools/pidl/lib/Parse/Pidl/Wireshark/NDR.pm b/tools/pidl/lib/Parse/Pidl/Wireshark/NDR.pm
index 22854a9fbd..9c2983fc6b 100644
--- a/tools/pidl/lib/Parse/Pidl/Wireshark/NDR.pm
+++ b/tools/pidl/lib/Parse/Pidl/Wireshark/NDR.pm
@@ -591,7 +591,7 @@ sub Function($$$)
$self->pidl_code("{");
$self->indent;
if ( not defined($fn->{RETURN_TYPE})) {
- } elsif ($fn->{RETURN_TYPE} eq "NTSTATUS" or $fn->{RETURN_TYPE} eq "WERROR")
+ } elsif ($fn->{RETURN_TYPE} eq "NTSTATUS" or $fn->{RETURN_TYPE} eq "WERROR" or $fn->{RETURN_TYPE} eq "HRESULT")
{
$self->pidl_code("guint32 status;\n");
} elsif (my $type = getType($fn->{RETURN_TYPE})) {
@@ -627,6 +627,11 @@ sub Function($$$)
$self->pidl_code("\tcol_append_fstr(pinfo->cinfo, COL_INFO, \", Error: %s\", val_to_str(status, WERR_errors, \"Unknown DOS error 0x%08x\"));\n");
$return_types{$ifname}->{"werror"} = ["WERROR", "Windows Error"];
+ } elsif ($fn->{RETURN_TYPE} eq "HRESULT") {
+ $self->pidl_code("offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, di, drep, hf\_$ifname\_hresult, &status);\n");
+ $self->pidl_code("if (status != 0)");
+ $self->pidl_code("\tcol_append_fstr(pinfo->cinfo, COL_INFO, \", Error: %s\", val_to_str(status, HRES_errors, \"Unknown HRES error 0x%08x\"));\n");
+ $return_types{$ifname}->{"hresult"} = ["HRESULT", "HRES Windows Error"];
} elsif (my $type = getType($fn->{RETURN_TYPE})) {
if ($type->{DATA}->{TYPE} eq "ENUM") {
my $return_type = "g".Parse::Pidl::Typelist::enum_type_fn($type->{DATA});
@@ -1120,6 +1125,8 @@ sub Initialize($$)
"offset = PIDL_dissect_uint32(tvb, offset, pinfo, tree, di, drep, \@HF\@, \@PARAM\@);","FT_UINT32", "BASE_DEC", 0, "VALS(WERR_errors)", 4);
$self->register_type("NTSTATUS",
"offset = PIDL_dissect_uint32(tvb, offset, pinfo, tree, di, drep, \@HF\@, \@PARAM\@);","FT_UINT32", "BASE_DEC", 0, "VALS(NT_errors)", 4);
+ $self->register_type("HRESULT",
+ "offset = PIDL_dissect_uint32(tvb, offset, pinfo, tree, di, drep, \@HF\@, \@PARAM\@);","FT_UINT32", "BASE_DEC", 0, "VALS(HRES_errors)", 4);
$self->register_type("ipv6address", "proto_tree_add_item(tree, \@HF\@, tvb, offset, 16, ENC_NA); offset += 16;", "FT_IPv6", "BASE_NONE", 0, "NULL", 16);
$self->register_type("ipv4address", "proto_tree_add_item(tree, \@HF\@, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4;", "FT_IPv4", "BASE_NONE", 0, "NULL", 4);