diff options
author | ulfl <ulfl@f5534014-38df-0310-8fa8-9805f1628bb7> | 2005-05-21 09:41:57 +0000 |
---|---|---|
committer | ulfl <ulfl@f5534014-38df-0310-8fa8-9805f1628bb7> | 2005-05-21 09:41:57 +0000 |
commit | fa1317cd942571234966e1b2c233c5d796425f62 (patch) | |
tree | 161bfeb9ffb93a16f6208fcab9bff94c7e33ad0e /capture_wpcap_packet.c | |
parent | 284c15fd3980e7f4786fe6063134662b4ca93afd (diff) |
as suggested by Loris: add wpcap_packet_get_version() and check the packet.dll version before using it (very restrictive for now, will check for exact DLL version strings). If version is unknown, ask user to continue or not.
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@14411 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'capture_wpcap_packet.c')
-rw-r--r-- | capture_wpcap_packet.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/capture_wpcap_packet.c b/capture_wpcap_packet.c index c208f9962b..d1ffcf25b1 100644 --- a/capture_wpcap_packet.c +++ b/capture_wpcap_packet.c @@ -79,6 +79,7 @@ gboolean has_wpacket = FALSE; /******************************************************************************************************************************/ /* stuff to load WinPcap's packet.dll and the functions required from it */ +static PCHAR (*p_PacketGetVersion) (void); static LPADAPTER (*p_PacketOpenAdapter) (char *adaptername); static void (*p_PacketCloseAdapter) (LPADAPTER); static int (*p_PacketRequest) (LPADAPTER, int, void *); @@ -97,9 +98,10 @@ wpcap_packet_load(void) /* These are the symbols I need or want from packet.dll */ static const symbol_table_t symbols[] = { + SYM(PacketGetVersion, FALSE), SYM(PacketOpenAdapter, FALSE), SYM(PacketCloseAdapter, FALSE), - SYM(PacketRequest, TRUE), + SYM(PacketRequest, FALSE), { NULL, NULL, FALSE } }; @@ -131,7 +133,6 @@ wpcap_packet_load(void) sym++; } - has_wpacket = TRUE; } @@ -141,12 +142,22 @@ wpcap_packet_load(void) /* functions to access the NDIS driver values */ +/* get dll version */ +char * +wpcap_packet_get_version(void) +{ + g_assert(has_wpacket); + return p_PacketGetVersion(); +} + + /* open the interface */ void * wpcap_packet_open(char *if_name) { - LPADAPTER adapter; + LPADAPTER adapter; + g_assert(has_wpacket); adapter = p_PacketOpenAdapter(if_name); return adapter; @@ -158,6 +169,7 @@ void wpcap_packet_close(void *adapter) { + g_assert(has_wpacket); p_PacketCloseAdapter(adapter); } |