This is a static archive of our old Q&A Site. Please post any new questions and answers at ask.wireshark.org.

Get Wireshark Install Directory inside Dissector

0

How can I get the Wireshark install directory from within a wireshark dissector? My dissector relies on some external libraries and I would like to avoid hard coding "C:Program FilesWiresharkPluginsFooDebendancies"

Thank you for your time, Brandon

asked 25 Jul '11, 08:09

officialhopsof's gravatar image

officialhopsof
318812
accept rate: 100%


One Answer:

1

You can use one of the routines in epan/filesystem.c, for example get_plugin_dir().

Not that you should normally be doing any such thing in a dissector...

answered 25 Jul '11, 14:05

JeffMorriss's gravatar image

JeffMorriss ♦
6.2k572
accept rate: 27%

include <epan/filesystem.c>

Causes linker errors, specifically:
error LNK2019: unresolved external symbol _ws_stdio_stat64 referenced in function _test_for_directory
error LNK2019: unresolved external symbol _utf_16to8 referenced in function _init_progfile_dir
error LNK2019: unresolved external symbol _getenv_utf8 referenced in function _get_datafile_dir
error LNK2019: unresolved external symbol _ws_stdio_remove referenced in function _delete_directory
error LNK2019: unresolved external symbol _ws_stdio_rename referenced in function _rename_persconffile_profile

(26 Jul '11, 12:56) officialhopsof

error LNK2019: unresolved external symbol _ws_stdio_mkdir referenced in function _create_persconffile_profile
packet-vmf.obj : error LNK2019: unresolved external symbol imp[email protected] referenced in function _get_persdatafile_dir
error LNK2019: unresolved external symbol _ws_stdio_unlink referenced in function _deletefile
error LNK2019: unresolved external symbol _ws_stdio_open referenced in function _copy_file_binary_mode

But this appears like it's what I want.

(26 Jul '11, 12:56) officialhopsof

It's an atrocity to #include a C file. Include the header instead.

(26 Jul '11, 13:03) bstn

Oh! That was a typo I didn't spot! Thanks!

(26 Jul '11, 13:24) officialhopsof