KWLAN-Tool
- 1 Download & Install
- 1.1 Source-Code
- 1.2 Binary
The KWLAN-Tool is a simple control-panel-applet which shows some useful advanced information on aavailablewireless networks and the WLAN-chip itself.
On the Status
-tab you see all access-points in range. The blue bar at the top indicates signal-strength.
The Advanced
-tab holds two buttons to enable and disable the WLAN device. This is useful to conserve power on battery-powered devices.
Here is the code-snippet how it is done:
BOOL PowerBGW211( BOOL fEnable)
{
BOOL ret = FALSE;
HANDLE hNdisPwr;
HANDLE hNdis;
NDISPWR_SAVEPOWERSTATE SavePowerState;
TCHAR DeviceName[8];
memset( &DeviceName[0], 0, sizeof( DeviceName));
wcscpy( &DeviceName[0], TEXT("BGW1"));
hNdisPwr = CreateFile( (PTCHAR)NDISPWR_DEVICE_NAME, 0x00, 0x00, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_OVERLAPPED, (HANDLE)INVALID_HANDLE_VALUE);
if (hNdisPwr != INVALID_HANDLE_VALUE)
{
SavePowerState.pwcAdapterName = &DeviceName[0];
if ( fEnable)
SavePowerState.CePowerState = PwrDeviceUnspecified;
else
SavePowerState.CePowerState = D4;
if (!DeviceIoControl( hNdisPwr, IOCTL_NPW_SAVE_POWER_STATE, &SavePowerState, sizeof(NDISPWR_SAVEPOWERSTATE), NULL, 0x00, NULL, NULL))
MessageBox( NULL, TEXT("Could not set Device PowerState!"), TEXT("Error"), MB_OK);
CloseHandle(hNdisPwr);
}
{
CEDEVICE_POWER_STATE Dx = PwrDeviceUnspecified;
TCHAR szName[MAX_PATH];
int nChars;
nChars = _sntprintf( szName, MAX_PATH-1, _T("%s\\%s"), PMCLASS_NDIS_MINIPORT, &DeviceName[0]);
szName[MAX_PATH-1]=0;
if(nChars != (-1))
{
if (fEnable)
SetDevicePower(szName, POWER_NAME, PwrDeviceUnspecified);
else
SetDevicePower(szName, POWER_NAME, D4);
}
}
hNdis = CreateFile( DD_NDIS_DEVICE_NAME, GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_ALWAYS,
0, NULL);
if ( hNdis != INVALID_HANDLE_VALUE)
{
DWORD dwReturned;
if (fEnable)
ret = DeviceIoControl( hNdis, IOCTL_NDIS_BIND_ADAPTER, &DeviceName[0], (_tcslen(&DeviceName[0])+2) * sizeof(TCHAR), NULL, 0, NULL, NULL);
else
ret = DeviceIoControl( hNdis, IOCTL_NDIS_UNBIND_ADAPTER, &DeviceName[0], (_tcslen(&DeviceName[0])+2) * sizeof(TCHAR), NULL, 0, NULL, NULL);
CloseHandle( hNdis);
}
return ret;
}
With PCTI
-tab you can obtain information about the WLAN-chip. Press Load PCTI Firmware
. This will load a special test-firmware, which is able to get the information.
Press Load Driver Firmware
to return to normal operation mode.
Download & Install
Source-Code
Binary
kwlan3.zip (added Power-Mgmt)
Copy kwlan.cpl
to the \windows
-directory of the device.
Than run Start→Settings→Control Panel.
Start the tool with the KWLAN
-icon.