aboutsummaryrefslogtreecommitdiffstats
path: root/capture-wpcap.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2005-04-14 20:37:13 +0000
committerGuy Harris <guy@alum.mit.edu>2005-04-14 20:37:13 +0000
commit8f71b85840aefae003a8bd601014e96b4e1bf85d (patch)
treebcb1d4299964e32fe9cd5d381037d6a4f06868eb /capture-wpcap.c
parentadbc8b86b5e9b60e08b29b65734d31b32a32119a (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. svn path=/trunk/; revision=14081
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, " ");