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

updating windows plugin from wireshark 1.6 to 2.2

0

Hello dear Wireshark Exprets,

after trying to update the plugin by myself and removing as much error as I can, I am stuck with These Errors and don't know what to do with These. I'd really appreciate your help. Thanks in advance

   "C:\Temp\_temp_setupFiles\Development\wsbuild32\plugins\myPlugin\myPlugin.vcxproj" (Standardziel) (140) ->
   (Link Ziel) -> 
     packet-myPlugin.obj : error LNK2005: _plugin_reg_handoff already defined in plugin.obj [C:\Temp\_temp_setupFiles\Development\wsbuild32\plugins\myPlugin\myPlugin.vcxproj]
     packet-myPlugin.obj : error LNK2005: _plugin_register already defined in plugin.obj [C:\Temp\_temp_setupFiles\Development\wsbuild32\plugins\myPlugin\myPlugin.vcxproj]
     plugin.obj : error LNK2019: unresolved external symbol _proto_register_myPlugin referenced in function _plugin_register [C:\Temp\_temp_setupFiles\Development\wsbuild32\plugins\myPlugin\myPlugin.vcxproj]
     plugin.obj : error LNK2019: unresolved external symbol _proto_reg_handoff_myPlugin referenced in function _plugin_reg_handoff [C:\Temp\_temp_setupFiles\Development\wsbuild32\plugins\myPlugin\myPlugin.vcxproj]
     packet-myPlugin.obj : error LNK2019: unresolved external symbol _match_strval referenced in function _dissector_ife [C:\Temp\_temp_setupFiles\Development\wsbuild32\plugins\myPlugin\myPlugin.vcxproj]
     packet-myPlugin.obj : error LNK2019: unresolved external symbol _ADDRESSES_EQUAL referenced in function _dissector_ife [C:\Temp\_temp_setupFiles\Development\wsbuild32\plugins\myPlugin\myPlugin.vcxproj]
     packet-myPlugin.obj : error LNK2019: unresolved external symbol _se_alloc referenced in function _dissector_ife [C:\Temp\_temp_setupFiles\Development\wsbuild32\plugins\myPlugin\myPlugin.vcxproj]
     packet-myPlugin.obj : error LNK2019: unresolved external symbol _proto_tree_add_text referenced in function _dissector_ife [C:\Temp\_temp_setupFiles\Development\wsbuild32\plugins\myPlugin\myPlugin.vcxproj]
     packet-myPlugin.obj : error LNK2019: unresolved external symbol _snprintf referenced in function _dissector_ife [C:\Temp\_temp_setupFiles\Development\wsbuild32\plugins\myPlugin\myPlugin.vcxproj]
     packet-myPlugin.obj : error LNK2019: unresolved external symbol _ep_strdup_printf referenced in function _dissector_ife [C:\Temp\_temp_setupFiles\Development\wsbuild32\plugins\myPlugin\myPlugin.vcxproj]
     packet-myPlugin.obj : error LNK2019: unresolved external symbol _tvb_get_ephemeral_string referenced in function _dissector_ife [C:\Temp\_temp_setupFiles\Development\wsbuild32\plugins\myPlugin\myPlugin.vcxproj]
     packet-myPlugin.obj : error LNK2019: unresolved external symbol _tvb_get_string referenced in function _dissector_ife [C:\Temp\_temp_setupFiles\Development\wsbuild32\plugins\myPlugin\myPlugin.vcxproj]
     C:\Temp\_temp_setupFiles\Development\wsbuild32\run\RelWithDebInfo\plugins\myPlugin.dll : fatal error LNK1120: 10 unresolved externals [C:\Temp\_temp_setupFiles\Development\wsbuild32\plugins\myPlugin\myPlugin.vcxproj]

asked 28 Nov '16, 06:27

xaheen's gravatar image

xaheen
71141519
accept rate: 50%

edited 28 Nov '16, 18:38

Guy%20Harris's gravatar image

Guy Harris ♦♦
17.4k335196

1

So you are looking at the following functions:

match_strval()
ADDRESSES_EQUAL()
se_alloc()
proto_tree_add_text()
snprintf()
ep_strdup_printf()
tvb_get_ephemeral_string()
tvb_get_string()
(28 Nov '16, 11:16) Jaap ♦

@jaap thanks for your reply. Which functions should I use instead of these functions?

(29 Nov '16, 04:09) xaheen
1

In addition to the above you need to change the plugin_reg_handoff() to proto_reg_handof_foo. eg the same handoff and register functions are used in plugins as in regular dissectors. You should probably look at the(c)make files of plugin in the current code base. ep and se memory has been replaced by wmem you can look up the usage of those funktions in the docs and or the code base.

(29 Nov '16, 05:16) Anders ♦

Thanks guys :)

(29 Nov '16, 05:22) xaheen

One Answer:

1
match_strval -> try_val_to_str
ADDRESSES_EQUAL -> addresses_equal
se_alloc(XXX) -> wmem_alloc(wmem_file_scope(), XXX)
proto_tree_add_text -> must be replaced by the proper proto_tree_add_XXX function depending on your use case
ep_strdup_printf(XXX) -> wmem_strdup(wmem_packet_scope(), XXX)
tvb_get_ephemeral_string(XXX) -> tvb_get_string_enc(wmem_packet_scope(), XXX, ENC_UTF_8|ENC_NA)
tvb_get_string(XXX) -> tvb_get_string_enc(NULL, XXX, ENC_UTF_8|ENC_NA)

As for snprintf(), this is a standard C function and not a Wireshark API.

answered 29 Nov '16, 05:12

Pascal%20Quantin's gravatar image

Pascal Quantin
5.5k1060
accept rate: 30%

Thanks a bunch for saving my day :D

(29 Nov '16, 05:21) xaheen
1

As for snprintf(), this is a standard C function

It's a standard C99 function, but not a standard C89 function, and older versions of Microsoft Visual Studio don't provide it.

In Wireshark 2.2 and later, you can include <wsutil/ws_printf.h> and use ws_snprintf() instead of snprintf(); it should work on UN*X and it should also work on Windows with all versions of Visual Studio that we support.

(29 Nov '16, 14:52) Guy Harris ♦♦

ep_strdup_printf(XXX) -> wmem_strdup(wmem_packet_scope(), XXX) didnt work for me.

wmem_strdup_printf(wmem_packet_scope(), XXX) worked perfectly

(01 Mar '17, 01:13) xaheen