Introduction
This sample application is used to demonstrate WlanOpenHandle
, WlanEnumInterfaces
, WlanRegisterNotification
, WlanScan
, WlanGetNetworkBssList
, WlanGetAvailableNetworkList
. Parse the IES from the last beacon and probe response from BSS network. Add the IE (Information Element) during the WlanScan
request. I have checked with (Intel(R) Centrino(R) Advanced-N 6205). This interface does not allow to send reserved information WiFi IES (52-126 according to the IEEE 802.11 spec) but I am able to include all the others in the scan request. I hope this code will be useful.
Background
Using the Code
Requirements:
- Visual Studio
- WDK and SDK
- Wireshark for verification for added IES in
WlanScan
request
int FuncWlanOpenAndEnum()
{
DWORD dwClientVersion=(IsVistaOrHigher() ? 2 : 1);
printf("######## FuncWlanOpenAndEnum--->######## \n\n");
hResult=WlanOpenHandle(dwClientVersion,NULL,&pdwNegotiatedVersion,&phClientHandle);
if(hResult!=ERROR_SUCCESS)
{
printf("failed WlanOpenHandle=%d \n",hResult);
return hResult;
}
else
{
printf("WlanOpenHandle is success=%d \n",hResult);
}
hResult=WlanEnumInterfaces(phClientHandle,NULL,&pIfList);
if(hResult!=ERROR_SUCCESS)
{
printf("failed WlanEnumInterfaces check adapter is on=%d \n",hResult);
return hResult;
}
else
{
printf("WlanEnumInterfaces is success=%d \n",hResult);
}
printf("######## FuncWlanOpenAndEnum<---######## \n \n");
return hResult;
}
void FuncWlanPrintInterfaceNames()
{
WCHAR SGuid[256]={0};
printf("######## FuncWlanPrintInterfaceNames--->######## \n\n");
for(unsigned int i=0;(i < pIfList->dwNumberOfItems);i++)
{
printf("WIFI Adapter Description =%ws \n",
pIfList->InterfaceInfo[pIfList->dwIndex].strInterfaceDescription);
StringFromGUID2(pIfList->InterfaceInfo[pIfList->dwIndex].InterfaceGuid,SGuid,256);
printf("WIFI Adapter GUID=%ws \n",SGuid);
}
guidInterface=pIfList->InterfaceInfo[0].InterfaceGuid;
printf("######## FuncWlanPrintInterfaceNames<---######## \n \n");
}
Points of Interest
It will be the first sample source code that includes IE during scan request. Parsing of IES will be great as it is helpful. We can check that the required IES are received from access points.