?? wifi.h
字號:
#pragma once
#include <Winbase.h>
#include <ntddndis.h>
#include <nuiouser.h>
#include <string>
#include <vector>
#include "wzcsapi.h"
namespace wifi
{
class CAvailableAPList
{
public:
CAvailableAPList(void);
CAvailableAPList(const LPBYTE lpByte);
CAvailableAPList(const CAvailableAPList& wlan);
CAvailableAPList operator = (const CAvailableAPList& wlan);
void Clear();
BOOL ParseFrom(const LPBYTE lpByte);
LPCWSTR GetLastErrorMsg(){ return this->m_strErr.c_str(); }
BOOL get_NDIS_WLAN_BSSID(const LPBYTE lpByte, PNDIS_WLAN_BSSID pBssid);
BOOL get_NDIS_802_11_CONFIGURATION(const LPBYTE lpByte, PNDIS_802_11_CONFIGURATION pConfig);
BOOL get_NDIS_802_11_CONFIGURATION_FH(const LPBYTE lpByte, PNDIS_802_11_CONFIGURATION_FH pConfigFH);
~CAvailableAPList(void);
public:
static const int LengthOffset = 4;
static const int MacAddressOffset = LengthOffset + 4;
static const int ReservedOffset = MacAddressOffset + 6;
static const int SsidOffset = ReservedOffset + 2;
static const int PrivacyOffset = SsidOffset + 36; // The ssid length plus 32 character array.
static const int RssiOffset = PrivacyOffset + 4;
static const int NetworkTypeInUseOffset = RssiOffset + 4;
static const int ConfigurationOffset = NetworkTypeInUseOffset + sizeof(NDIS_802_11_NETWORK_TYPE); // It's an enum. I hope it's four bytes.
static const int InfrastructureModeOffset = ConfigurationOffset + 32; // It's a structure, with another structure inside it.
static const int SupportedRatesOffset = InfrastructureModeOffset + 4; // Another enum.
NDIS_802_11_BSSID_LIST m_bssidList;
std::vector<NDIS_WLAN_BSSID> m_vectBssid;
private:
std::wstring m_strErr;
};
class CPreferredAPList
{
public:
CPreferredAPList(void);
CPreferredAPList(const LPBYTE lpByte);
CPreferredAPList(const CPreferredAPList& wlan);
CPreferredAPList operator = (const CPreferredAPList& wlan);
void Clear();
BOOL ParseFrom(const LPBYTE lpByte);
LPCWSTR GetLastErrorMsg(){ return this->m_strErr.c_str(); }
BOOL get_WZC_WLAN_CONFIG(const LPBYTE lpByte, PWZC_WLAN_CONFIG pConfig);
~CPreferredAPList(void);
public:
static const int NumberOfItemsOffset = 0;
static const int BaseIndexOffset = 4;
static const int ConfigOffset = 8;
public:
WZC_802_11_CONFIG_LIST m_stSsidList;
std::vector<WZC_WLAN_CONFIG> m_vectStSsid;
private:
std::wstring m_strErr;
};
class CWirelessUtil
{
public:
CWirelessUtil();
~CWirelessUtil();
BOOL Init();
void DeInit();
LPCWSTR GetFirstDeviceName();
LPCWSTR GetLastErrorMsg(){ return this->m_strErr.c_str(); }
BOOL IsInit(){ return this->m_bInit; }
BOOL GetSignalStrength(LPCTSTR ptcDeviceName, INT* piSignalStrength);
std::wstring SignalStrengthToString(INT nSignalStrength);
BOOL GetSsid(LPCTSTR ptcDeviceName, LPBYTE lpSsid, size_t nMaxLen);
std::wstring SsidToString(LPBYTE lpByte, int nLen = -1);
BOOL GetBSSIDList(LPCTSTR ptcDeviceName, CAvailableAPList* pWlan);
BOOL ScanForBSSIDList(LPCTSTR ptcDeviceName);
BOOL GetStSSIDList(LPCTSTR ptcDeviceName, CPreferredAPList* pWlan);
BOOL SetInterface(LPCTSTR ptcDeviceName, LPCTSTR szSsid);
protected:
BOOL IsNativeWifiDevice(LPCTSTR ptcDeviceName, INT *piSignalStrength);
long MapWirelessSignalStrengthToRSSI(IN ULONG ulWss);
private:
HANDLE m_hNdisUio;
INTFS_KEY_TABLE m_keyTable;
std::wstring m_strErr;
BOOL m_bInit;
};
};
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -