Wireshark-dev: Re: [Wireshark-dev] wireshark crashes after adding preference code to my
From: Jeff Morriss <jeff.morriss.ws@xxxxxxxxx>
Date: Wed, 26 Jan 2011 09:34:50 -0500
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.