Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Wireshark-dev: [Wireshark-dev] runtime error using plugin with prefs_register_enum_preference

Date: Wed, 22 Oct 2008 17:36:07 +0200
Hi,
 
I'm trying to add a list of protocol versions in the preferences menu
using:
 
plugin with prefs_register_enum_preference
 
I've followed the example of other working dissectors.
 
The plugin compiles correctly but when I copy the dll to the wireshark
plugin directory and run wireshark I get the error message:
 
"runtime error!
 
Program: C:\wireshark-trunk\wireshark-gtk2\wireshark.exe
 
This application has requested the Runtime to terminate it in an unusual
way.
Please contact the application's support team for more information.
"
 
The code is here:
 
#define PROTO_TAG_ISMACRYP_11 "ISMACRYP 1.1"
#define PROTO_TAG_ISMACRYP_20 "ISMACRYP 2.0"
 
.....
 
/* The ISMACryp protocol version set in preferences menu */
static gint version_type = 11; /* ISMACryp 1.1 */
 
.......
 
static enum_val_t version_types[] = {
  {PROTO_TAG_ISMACRYP_11, PROTO_TAG_ISMACRYP_11, 11},
  {PROTO_TAG_ISMACRYP_20, PROTO_TAG_ISMACRYP_20, 20},
  {NULL, NULL, 0}        <- some dissectors have -1 here instead of 0
but makes no difference

 };
 
........
 
prefs_register_enum_preference(ismacryp_module, "ismacryp_encoding",
            "ISMACryp version",
            "ISMACryp version",
            &version_type, version_types, FALSE);
 
 
If I comment the lines for prefs_register_enum_preference things work
ok.
I haven't attempted to add it as a dissector to see if that works
(slower than just compiling a plugin).
Any thoughts?

Tnanks for your feedback,

David
 
Here is About Wireshark info:
 
Version 1.1.2 (SVN Rev unknown)
 
Copyright 1998-2008 Gerald Combs <gerald@xxxxxxxxxxxxx> and
contributors.
This is free software; see the source for copying conditions. There is
NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.
 
Compiled with GTK+ 2.14.3, with GLib 2.18.1, with WinPcap (version
unknown),
with libz 1.2.3, without POSIX capabilities, with libpcre 7.0, with SMI
0.4.8,
with c-ares 1.5.3, without ADNS, with Lua 5.1, with GnuTLS 2.3.8, with
Gcrypt
1.4.1, with MIT Kerberos, with PortAudio V19-devel (built Oct 14 2008),
with
AirPcap.
 
Running on Windows XP Service Pack 2, build 2600, with WinPcap version
4.0.2
(packet.dll version 4.0.0.1040), based on libpcap version 0.9.5, without
AirPcap.
 
Built using Microsoft Visual C++ 8.0 build 50727
 
Wireshark is Open Source Software released under the GNU General Public
License.
 
Check the man page and http://www.wireshark.org for more information.