From 23df4e7f01744225dab519fa3905f558367e7d62 Mon Sep 17 00:00:00 2001 From: Gerald Combs Date: Thu, 12 Nov 2009 23:48:11 +0000 Subject: [PATCH] Update the AirPcap code for Win64 and enable AirPcap for the 64-bit build. svn path=/trunk/; revision=30945 --- Makefile.nmake | 4 +++- airpcap_loader.c | 40 ++++++++++++++++++++-------------------- config.nmake | 4 ++-- gtk/airpcap_gui_utils.c | 12 ++++++------ tools/win32-setup.sh | 2 +- tools/win64-setup.sh | 2 +- 6 files changed, 33 insertions(+), 31 deletions(-) diff --git a/Makefile.nmake b/Makefile.nmake index 6e098a1d42..058f93ca42 100644 --- a/Makefile.nmake +++ b/Makefile.nmake @@ -760,7 +760,7 @@ process_libs: !ENDIF !IFDEF AIRPCAP_DIR @$(SH) $(WIN_SETUP) "$(WIN_SETUP_OPT)" "$(WIRESHARK_LIBS)" \ - AirPcap_Devpack_1_0_0_594 AirPcap_Devpack_1_0_0_594.zip + AirPcap_Devpack_4_1_0_1622 AirPcap_Devpack_4_1_0_1622.zip !ENDIF !IFDEF C_ARES_DIR @$(SH) $(WIN_SETUP) "$(WIN_SETUP_OPT)" "$(WIRESHARK_LIBS)" \ @@ -895,6 +895,8 @@ clean_setup: rm -r -f $(WIRESHARK_LIBS)/user-guide rm -r -f $(WIRESHARK_LIBS)/WpdPack rm -r -f $(WIRESHARK_LIBS)/AirPcap_Devpack_1_0_0_594 + rm -r -f $(WIRESHARK_LIBS)/AirPcap_Devpack_4_0_0_1480 + rm -r -f $(WIRESHARK_LIBS)/AirPcap_Devpack_4_1_0_1622 rm -r -f $(WIRESHARK_LIBS)/zlib123 rm -r -f $(WIRESHARK_LIBS)/zlib123-dll rm -r -f $(WIRESHARK_LIBS)/upx301w diff --git a/airpcap_loader.c b/airpcap_loader.c index afa2269826..90abe336b1 100644 --- a/airpcap_loader.c +++ b/airpcap_loader.c @@ -120,7 +120,7 @@ airpcap_if_info_t *airpcap_if_active = NULL; module_t *wlan_prefs = NULL; Dot11Channel *pSupportedChannels; -guint32 numSupportedChannels; +guint numSupportedChannels; static AirpcapChannelInfo LegacyChannels[] = { @@ -140,7 +140,7 @@ static AirpcapChannelInfo LegacyChannels[] = {2484, 0, {0,0,0}}, }; -static guint32 num_legacy_channels = 14; +static guint num_legacy_channels = 14; /* * Callback used by the load_wlan_keys() routine in order to read a WEP decryption key @@ -325,7 +325,7 @@ write_wlan_wep_keys_to_registry(airpcap_if_info_t* info_if, GList* key_list) GString *new_key; gchar s[3]; PAirpcapKeysCollection KeysCollection; - guint32 KeysCollectionSize; + guint KeysCollectionSize; guint8 KeyByte; guint keys_in_list = 0; decryption_key_t* key_item = NULL; @@ -364,7 +364,7 @@ write_wlan_wep_keys_to_registry(airpcap_if_info_t* info_if, GList* key_list) key_item = (decryption_key_t*)g_list_nth_data(key_list,i); new_key = g_string_new(key_item->key->str); - KeysCollection->Keys[i].KeyLen = new_key->len / 2; + KeysCollection->Keys[i].KeyLen = (guint) new_key->len / 2; memset(&KeysCollection->Keys[i].KeyData, 0, sizeof(KeysCollection->Keys[i].KeyData)); for(j = 0 ; j < new_key->len; j += 2) @@ -415,7 +415,7 @@ write_wlan_driver_wep_keys_to_registry(GList* key_list) GString *new_key; gchar s[3]; PAirpcapKeysCollection KeysCollection; - guint32 KeysCollectionSize; + guint KeysCollectionSize; guint8 KeyByte; guint keys_in_list = 0; decryption_key_t* key_item = NULL; @@ -485,7 +485,7 @@ write_wlan_driver_wep_keys_to_registry(GList* key_list) new_key = g_string_new(key_item->key->str); - KeysCollection->Keys[y].KeyLen = new_key->len / 2; + KeysCollection->Keys[y].KeyLen = (guint) new_key->len / 2; memset(&KeysCollection->Keys[y].KeyData, 0, sizeof(KeysCollection->Keys[y].KeyData)); for(j = 0 ; j < new_key->len; j += 2) @@ -758,7 +758,7 @@ airpcap_if_get_device_channel(PAirpcapHandle ah, guint * ch) * Airpcap wrapper, used to get the supported channels of an airpcap adapter */ gboolean -airpcap_if_get_device_supported_channels(PAirpcapHandle ah, AirpcapChannelInfo **cInfo, guint32 * nInfo) +airpcap_if_get_device_supported_channels(PAirpcapHandle ah, AirpcapChannelInfo **cInfo, guint * nInfo) { if (!AirpcapLoaded) return FALSE; if (airpcap_get_dll_state() == AIRPCAP_DLL_OLD){ @@ -776,10 +776,10 @@ airpcap_if_get_device_supported_channels(PAirpcapHandle ah, AirpcapChannelInfo * * Airpcap wrapper, used to get the supported channels of an airpcap adapter */ Dot11Channel* -airpcap_if_get_device_supported_channels_array(PAirpcapHandle ah, guint32 * pNumSupportedChannels) +airpcap_if_get_device_supported_channels_array(PAirpcapHandle ah, guint * pNumSupportedChannels) { AirpcapChannelInfo *chanInfo; - guint32 i=0, j=0, numInfo = 0; + guint i=0, j=0, numInfo = 0; if (!AirpcapLoaded) return NULL; @@ -797,7 +797,7 @@ airpcap_if_get_device_supported_channels_array(PAirpcapHandle ah, guint32 * pNum for (i = 0; i < numInfo; i++) { - guint32 supportedChannel = 0xFFFFFFFF; + guint supportedChannel = G_MAXUINT; /* * search if we have it already @@ -811,7 +811,7 @@ airpcap_if_get_device_supported_channels_array(PAirpcapHandle ah, guint32 * pNum } } - if (supportedChannel == 0xFFFFFFFF) + if (supportedChannel == G_MAXUINT) { /* * not found, create a new item @@ -933,7 +933,7 @@ airpcap_if_get_device_channel_ex(PAirpcapHandle ah, PAirpcapChannelInfo pChannel if (airpcap_get_dll_state() == AIRPCAP_DLL_OLD){ guint channel = 0; - guint32 chan_freq = 0; + guint chan_freq = 0; if (!airpcap_if_get_device_channel(ah, &channel)) return FALSE; @@ -1103,7 +1103,7 @@ airpcap_if_info_new(char *name, char *description) ad = airpcap_if_open(name, ebuf); if(ad) { - if_info = g_malloc(sizeof (airpcap_if_info_t)); + if_info = g_malloc0(sizeof (airpcap_if_info_t)); if_info->name = g_strdup(name); if (description == NULL){ if_info->description = NULL; @@ -1369,10 +1369,12 @@ get_airpcap_interface_list(int *err, char **err_str) { GList *il = NULL; airpcap_if_info_t *if_info; - int i, n_adapts; + int n_adapts; AirpcapDeviceDescription *devsList, *adListEntry; char errbuf[PCAP_ERRBUF_SIZE]; + *err = 0; + if (!AirpcapLoaded) { *err = AIRPCAP_NOT_LOADED; @@ -1413,7 +1415,7 @@ get_airpcap_interface_list(int *err, char **err_str) * Insert the adapters in our list */ adListEntry = devsList; - for(i = 0; i < n_adapts; i++) + while(adListEntry) { if_info = airpcap_if_info_new(adListEntry->Name, adListEntry->Description); if (if_info != NULL){ @@ -1425,7 +1427,6 @@ get_airpcap_interface_list(int *err, char **err_str) g_PAirpcapFreeDeviceList(devsList); - *err = 0; return il; } @@ -1473,7 +1474,6 @@ gchar* airpcap_get_key_string(AirpcapKey key) { unsigned int j = 0; - unsigned int l = 0; gchar *dst,*src; dst = NULL; @@ -1494,7 +1494,7 @@ airpcap_get_key_string(AirpcapKey key) /* * XXX - use g_strconcat() or GStrings instead ??? */ - l = g_strlcat(dst,src,WEP_KEY_MAX_CHAR_SIZE+1); + g_strlcat(dst, src, WEP_KEY_MAX_CHAR_SIZE+1); } g_free(src); } @@ -1808,7 +1808,7 @@ get_airpcap_device_keys(airpcap_if_info_t* info_if) g_free(tmp_key); /* BITS */ - new_key->bits = new_key->key->len *4; /* every char is 4 bits in WEP keys (it is an hexadecimal number) */ + new_key->bits = (guint) new_key->key->len *4; /* every char is 4 bits in WEP keys (it is an hexadecimal number) */ /* SSID not used in WEP keys */ new_key->ssid = NULL; @@ -1880,7 +1880,7 @@ get_airpcap_driver_keys(void) if(tmp_key != NULL) g_free(tmp_key); /* BITS */ - new_key->bits = new_key->key->len *4; /* every char is 4 bits in WEP keys (it is an hexadecimal number) */ + new_key->bits = (guint) new_key->key->len *4; /* every char is 4 bits in WEP keys (it is an hexadecimal number) */ /* SSID not used in WEP keys */ new_key->ssid = NULL; diff --git a/config.nmake b/config.nmake index 62670a6ade..06bfe923e6 100644 --- a/config.nmake +++ b/config.nmake @@ -341,7 +341,7 @@ PORTAUDIO_VERSION=19 # If you don't have the AirPcap developer's pack, comment this line out, # so that AIRPCAP_DIR isn't defined. # -AIRPCAP_DIR=$(WIRESHARK_LIBS)\AirPcap_Devpack_1_0_0_594\AirPcap_Devpack +AIRPCAP_DIR=$(WIRESHARK_LIBS)\AirPcap_Devpack_4_1_0_1622\AirPcap_Devpack # # Optional: LIBSMI, System Management Interface @@ -573,7 +573,7 @@ PORTAUDIO_VERSION=19 # If you don't have the AirPcap developer's pack, comment this line out, # so that AIRPCAP_DIR isn't defined. # -#AIRPCAP_DIR=$(WIRESHARK_LIBS)\AirPcap_Devpack_1_0_0_594\AirPcap_Devpack +AIRPCAP_DIR=$(WIRESHARK_LIBS)\AirPcap_Devpack_4_1_0_1622\AirPcap_Devpack # # Optional: LIBSMI, System Management Interface diff --git a/gtk/airpcap_gui_utils.c b/gtk/airpcap_gui_utils.c index 24465dc455..6f161087f9 100644 --- a/gtk/airpcap_gui_utils.c +++ b/gtk/airpcap_gui_utils.c @@ -625,7 +625,7 @@ airpcap_channel_offset_changed_cb(GtkWidget *channel_offset_cb, gpointer data _U * Update the channel offset of the given combobox according to the given frequency. */ void -airpcap_update_channel_offset_combo(airpcap_if_info_t* if_info, guint32 chan_freq, GtkWidget *channel_offset_cb, gboolean set) +airpcap_update_channel_offset_combo(airpcap_if_info_t* if_info, guint chan_freq, GtkWidget *channel_offset_cb, gboolean set) { gint current_offset; gint new_offset; @@ -754,7 +754,7 @@ airpcap_add_keys_from_list(GtkWidget *key_ls, airpcap_if_info_t *if_info _U_) guint i, j; gchar s[3]; PAirpcapKeysCollection KeysCollection; - guint32 KeysCollectionSize; + guint KeysCollectionSize; guint8 KeyByte; guint keys_in_list = 0; @@ -808,7 +808,7 @@ airpcap_add_keys_from_list(GtkWidget *key_ls, airpcap_if_info_t *if_info _U_) /* Retrieve the Item corresponding to the i-th key */ new_key = g_string_new(row_key); - KeysCollection->Keys[i].KeyLen = new_key->len / 2; + KeysCollection->Keys[i].KeyLen = (guint) new_key->len / 2; memset(&KeysCollection->Keys[i].KeyData, 0, sizeof(KeysCollection->Keys[i].KeyData)); for(j = 0 ; j < new_key->len; j += 2) @@ -848,7 +848,7 @@ airpcap_add_keys_to_driver_from_list(GtkWidget *key_ls,airpcap_if_info_t *fake_i guint i, j; gchar s[3]; PAirpcapKeysCollection KeysCollection; - guint32 KeysCollectionSize; + guint KeysCollectionSize; guint8 KeyByte; guint keys_in_list = 0; @@ -905,7 +905,7 @@ airpcap_add_keys_to_driver_from_list(GtkWidget *key_ls,airpcap_if_info_t *fake_i /* Retrieve the Item corresponding to the i-th key */ new_key = g_string_new(row_key); - KeysCollection->Keys[i].KeyLen = new_key->len / 2; + KeysCollection->Keys[i].KeyLen = (guint) new_key->len / 2; memset(&KeysCollection->Keys[i].KeyData, 0, sizeof(KeysCollection->Keys[i].KeyData)); /* Key must be saved in adifferent way, depending on its type... */ @@ -978,7 +978,7 @@ airpcap_read_and_save_decryption_keys_from_clist(GtkWidget* key_ls, airpcap_if_i tmp_dk->key = g_string_new(tmp_key); tmp_dk->ssid = NULL; tmp_dk->type = AIRPDCAP_KEY_TYPE_WEP; - tmp_dk->bits = tmp_dk->key->len * 4; + tmp_dk->bits = (guint) tmp_dk->key->len * 4; key_list = g_list_append(key_list,tmp_dk); } else if(g_ascii_strcasecmp(tmp_type,AIRPCAP_WPA_PWD_KEY_STRING) == 0) diff --git a/tools/win32-setup.sh b/tools/win32-setup.sh index 1db5981298..3e34eb15d7 100755 --- a/tools/win32-setup.sh +++ b/tools/win32-setup.sh @@ -4,7 +4,7 @@ # 32-bit wrapper for win-setup.sh. -export DOWNLOAD_TAG="2009-11-11" +export DOWNLOAD_TAG="2009-11-12" export WIRESHARK_TARGET_PLATFORM="win32" WIN_SETUP=`echo $0 | sed -e s/win32/win/` diff --git a/tools/win64-setup.sh b/tools/win64-setup.sh index b560ba46e2..45db6e968f 100755 --- a/tools/win64-setup.sh +++ b/tools/win64-setup.sh @@ -4,7 +4,7 @@ # 64-bit wrapper for win-setup.sh. -export DOWNLOAD_TAG="2009-10-20" +export DOWNLOAD_TAG="2009-11-12" export WIRESHARK_TARGET_PLATFORM="win64" WIN_SETUP=`echo $0 | sed -e s/win64/win/`