/* Airpcap wrapper, used to get the frequency of an airpcap adapter  */
gboolean airpcap_if_get_device_channel_ex(PAirpcapHandle ah, PAirpcapChannelInfo pChannelInfo)
/* Airpcap wrapper, used to get the frequency of an airpcap adapter  */
gboolean airpcap_if_get_device_channel_ex(PAirpcapHandle ah, PAirpcapChannelInfo pChannelInfo)
{
    if (!AirpcapLoaded) return FALSE;
    pChannelInfo->Frequency = 0;
    pChannelInfo->ExtChannel = 0;
    pChannelInfo->Reserved[0] = 0;
    pChannelInfo->Reserved[1] = 0;
    pChannelInfo->Reserved[2] = 0;
    if (airpcap_get_dll_state() == AIRPCAP_DLL_OLD){
        guint channel = 0;
        guint chan_freq = 0;
        if (!airpcap_if_get_device_channel(ah, &channel)) return FALSE;
        chan_freq = ieee80211_chan_to_mhz(channel, TRUE);
        if (chan_freq == 0) return FALSE;
        pChannelInfo->Frequency = chan_freq;
        return TRUE;
    } else if (airpcap_get_dll_state() == AIRPCAP_DLL_OK){
        return g_PAirpcapGetDeviceChannelEx (ah, pChannelInfo);
    }
    return FALSE;
}