Skip to content

Commit a3e3ede

Browse files
committed
[WLANWIZ] Fix crashing on Windows XP/Server 2003
We cannot check radio state there. https://learn.microsoft.com/en-us/windows/win32/api/wlanapi/nf-wlanapi-wlanqueryinterface
1 parent 01fe7bf commit a3e3ede

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

dll/shellext/wlanwiz/scan.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,25 @@ LRESULT CWlanWizard::OnScanNetworks(WORD wNotifyCode, WORD wID, HWND hWndCtl, BO
3232

3333
/* Check if the adapter is enabled, both hardware and software */
3434
IIDFromString(this->m_sGUID, &gCurAdapter);
35-
WlanQueryInterface(this->hWlanClient,
35+
DWORD dwResult = WlanQueryInterface(this->hWlanClient,
3636
&gCurAdapter,
3737
wlan_intf_opcode_radio_state,
3838
NULL,
3939
&dwWRSsize,
4040
reinterpret_cast<PVOID*>(&pWRSCurAdapter),
4141
&wovtCurrAdapter);
4242

43+
if (pWRSCurAdapter == NULL)
44+
{
45+
DPRINT1("Cannot determine radio state due to 0x%lx\n", dwResult);
46+
}
47+
else
48+
{
4349
DPRINT("WLAN adapter radio status: hardware %s, software %s\n",
4450
pWRSCurAdapter->PhyRadioState[0].dot11HardwareRadioState == dot11_radio_state_on ? "on" : "off",
4551
pWRSCurAdapter->PhyRadioState[0].dot11SoftwareRadioState == dot11_radio_state_on ? "on" : "off");
52+
}
53+
4654

4755
if (!( pWRSCurAdapter->PhyRadioState[0].dot11SoftwareRadioState == dot11_radio_state_on
4856
&& pWRSCurAdapter->PhyRadioState[0].dot11HardwareRadioState == dot11_radio_state_on))

0 commit comments

Comments
 (0)