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

Wireshark-dev: Re: [Wireshark-dev] wireshark crashes after adding preference code to my

From: Jeff Morriss <jeff.morriss.ws@xxxxxxxxx>
Date: Thu, 27 Jan 2011 12:39:43 -0500
Note that you should have been seeing an assertion failure on Wireshark's stdout when this was happening. Rev 35683 changed it to have a more verbose explanation of the problem. But you first must be able to see Wireshark's standard output. On Windows there's a preference to control whether you see the Console window: especially if you're developing, you may want to turn that at least to "Automatic" so you can see this kind of problem in the future.

Yosi Saggi wrote:
Thanks, it works

-----Original Message-----
From: wireshark-dev-bounces@xxxxxxxxxxxxx
[mailto:wireshark-dev-bounces@xxxxxxxxxxxxx] On Behalf Of Jeff Morriss
Sent: Wednesday, January 26, 2011 4:35 PM
To: Developer support list for Wireshark
Subject: Re: [Wireshark-dev] wireshark crashes after adding preference
code to my

Yosi Saggi wrote:
Hi

I wanted to add some options in the preference window for my
dissector.
This is the code I have added to the "proto_register" function:
[...]
prefs_register_bool_preference(dan_lte_sdk_module,
"Dissect_MAC_Payload",
                               "Dissect MAC Layer from Data Payload",
"In Uplink and Downlink data packets, dissect MAC heaser layer " "Disabling MAC dissection will disable RLC dissection automaticly",
                               &global_dan_lte_sdk_dissect_MAC);
prefs_register_bool_preference(dan_lte_sdk_module,
"Dissect_RLC_Payload",
                               "Dissect RLC Layer from Data Payload",
"In Uplink and Downlink data packets, dissect RLC heaser layer ",
                               &global_dan_lte_sdk_dissect_RLC);
It works fine until I add those two (even one of them) "prefs_register_bool_preference" functions. What did I do wrong?

I get a "Runtime Error!" for wireshark.exe Removing those function
fixes
 it back.

 From epan/prefs.c:

         /*
          * Make sure that only lower-case ASCII letters, numbers,
          * underscores, and dots appear in the preference name.
          *
          * Crash if there is, as that's an error in the code;
          * you can make the title and description nice strings
          * with capitalization, white space, punctuation, etc.,
          * but the name can be used on the command line,
          * and shouldn't require quoting, shifting, etc.
          */

So change the preference names to use only lower case.