aboutsummaryrefslogtreecommitdiffstats
path: root/capture-wpcap.c
diff options
context:
space:
mode:
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>2005-04-14 20:37:13 +0000
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>2005-04-14 20:37:13 +0000
commite8d12ad1e7d00b3903b2de3a5873f240b702f8c2 (patch)
treebcb1d4299964e32fe9cd5d381037d6a4f06868eb /capture-wpcap.c
parent7abb1e5e4e142b5ce690650dc47797ffbac8e206 (diff)
Strip off anything after a blank in the PacketLibraryVersion string, as
the string says "3.0 alpha3" in the final release of WinPcap 3.0, and saying that's "3.0 alpha3" is misleading. Don't repeatedly fetch the version string from PacketLibraryVersion; just cache the version we got the first time. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@14081 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'capture-wpcap.c')
-rw-r--r--capture-wpcap.c44
1 files changed, 32 insertions, 12 deletions
diff --git a/capture-wpcap.c b/capture-wpcap.c
index 85dbf849ab..7228f953c7 100644
--- a/capture-wpcap.c
+++ b/capture-wpcap.c
@@ -616,24 +616,44 @@ get_runtime_pcap_version(GString *str)
* what version we have.
*/
GModule *handle; /* handle returned by dlopen */
- gchar *packetVer = NULL;
+ static gchar *packetVer;
+ gchar *blankp;
if (has_wpcap) {
- /* An alternative method of obtaining the version number */
- if ((handle = g_module_open("Packet.dll", 0)) != NULL) {
- if (g_module_symbol(handle, "PacketLibraryVersion",
- (gpointer*)&packetVer) == FALSE)
- packetVer = NULL;
- g_module_close(handle);
- }
-
g_string_sprintfa(str, "with ");
if (p_pcap_lib_version != NULL)
g_string_sprintfa(str, p_pcap_lib_version());
- else if (packetVer != NULL)
+ else {
+ /*
+ * An alternative method of obtaining the version
+ * number, by using the PacketLibraryVersion"
+ * string from packet.dll.
+ *
+ * Unfortunately, in WinPcap 3.0, it returns
+ * "3.0 alpha3", even in the final version of
+ * WinPcap 3.0, so if there's a blank in the
+ * string, we strip it and everything after
+ * it from the string, so we don't misleadingly
+ * report that 3.0 alpha3 is being used when
+ * the final version is being used.
+ */
+ if (packetVer == NULL) {
+ packetVer = "version unknown";
+ handle = g_module_open("Packet.dll", 0);
+ if (handle != NULL) {
+ if (g_module_symbol(handle,
+ "PacketLibraryVersion",
+ (gpointer*)&packetVer)) {
+ packetVer = g_strdup(packetVer);
+ blankp = strchr(packetVer, ' ');
+ if (blankp != NULL)
+ *blankp = '\0';
+ }
+ g_module_close(handle);
+ }
+ }
g_string_sprintfa(str, "WinPcap (%s)", packetVer);
- else
- g_string_append(str, "WinPcap (version unknown)");
+ }
} else
g_string_append(str, "without WinPcap");
g_string_append(str, " ");