Skip to content

Commit 8a6fce5

Browse files
committed
[WLANWIZ] Introduce debug information
In a moment of doubt some help would be nice. We will start with chosen adapter and its radio power status (disabled or not). [WLANWIZ] Sorting oops
1 parent 8a21141 commit 8a6fce5

File tree

3 files changed

+30
-12
lines changed

3 files changed

+30
-12
lines changed

dll/shellext/wlanwiz/main.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@
22
* PROJECT: ReactOS Shell
33
* LICENSE: LGPL-2.1-or-later (https://spdx.org/licenses/LGPL-2.1-or-later)
44
* PURPOSE: ReactOS Wizard for Wireless Network Connections
5-
* COPYRIGHT: Copyright 2024 Vitaly Orekhov <[email protected]>
5+
* COPYRIGHT: Copyright 2024-2025 Vitaly Orekhov <[email protected]>
66
*/
77
#pragma once
88
#include <atlbase.h>
99
#include <atlcoll.h>
1010
#include <atlconv.h>
1111
#include <atlstr.h>
1212
#include <atlwin.h>
13+
#include <debug.h>
1314
#include <strsafe.h>
1415
#include <shlobj.h>
1516
#include <shlwapi.h>

dll/shellext/wlanwiz/scan.cpp

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,26 +30,39 @@ LRESULT CWlanWizard::OnScanNetworks(WORD wNotifyCode, WORD wID, HWND hWndCtl, BO
3030

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

41-
if (!( pWRSCurAdapter->PhyRadioState[0].dot11SoftwareRadioState == dot11_radio_state_on
42-
&& pWRSCurAdapter->PhyRadioState[0].dot11HardwareRadioState == dot11_radio_state_on))
41+
if (pWRSCurAdapter == NULL)
4342
{
44-
this->uScanStatus = STATUS_SCAN_COMPLETE;
45-
this->bScanTimeout = TRUE;
46-
47-
if (this->lstWlanNetworks != NULL)
43+
DPRINT1("Cannot determine radio state due to 0x%lx\n", dwResult);
44+
}
45+
else
46+
{
47+
DOT11_RADIO_STATE rsHw = pWRSCurAdapter->PhyRadioState[0].dot11HardwareRadioState;
48+
DOT11_RADIO_STATE rsSw = pWRSCurAdapter->PhyRadioState[0].dot11SoftwareRadioState;
49+
50+
DPRINT("WLAN adapter radio status: hardware %s, software %s\n",
51+
rsHw == dot11_radio_state_on ? "on" : "off (or unknown)",
52+
rsSw == dot11_radio_state_on ? "on" : "off (or unknown)");
53+
54+
if (!(rsSw == dot11_radio_state_on && rsHw == dot11_radio_state_on))
4855
{
49-
WlanFreeMemory(this->lstWlanNetworks);
50-
RtlSecureZeroMemory(&this->lstWlanNetworks, sizeof(this->lstWlanNetworks));
56+
this->uScanStatus = STATUS_SCAN_COMPLETE;
57+
this->bScanTimeout = TRUE;
58+
59+
if (this->lstWlanNetworks != NULL)
60+
{
61+
WlanFreeMemory(this->lstWlanNetworks);
62+
RtlSecureZeroMemory(&this->lstWlanNetworks, sizeof(this->lstWlanNetworks));
63+
}
64+
return FALSE;
5165
}
52-
return FALSE;
5366
}
5467

5568
m_SidebarButtonAS.EnableWindow(FALSE);

dll/shellext/wlanwiz/wlanwiz.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* PROJECT: ReactOS Shell
33
* LICENSE: LGPL-2.1-or-later (https://spdx.org/licenses/LGPL-2.1-or-later)
44
* PURPOSE: ReactOS Wizard for Wireless Network Connections
5-
* COPYRIGHT: Copyright 2024 Vitaly Orekhov <[email protected]>
5+
* COPYRIGHT: Copyright 2024-2025 Vitaly Orekhov <[email protected]>
66
*/
77
#include "main.h"
88
#include "resource.h"
@@ -143,6 +143,7 @@ BOOL CWlanWizard::FindWlanDevice(ATL::CString sGUID)
143143
{
144144
if (IsEqualGUID(gWlanDeviceID, this->lstWlanInterfaces->InterfaceInfo[i].InterfaceGuid))
145145
{
146+
DPRINT("Using manually selected adapter %S\n", this->lstWlanInterfaces->InterfaceInfo[i].strInterfaceDescription);
146147
StringFromIID(gWlanDeviceID, &this->m_sGUID);
147148
return TRUE;
148149
}
@@ -156,7 +157,10 @@ BOOL CWlanWizard::FindWlanDevice(ATL::CString sGUID)
156157
BOOL bWlanDevicePresent = this->lstWlanInterfaces->dwNumberOfItems > 0;
157158

158159
if (bWlanDevicePresent)
160+
{
161+
DPRINT("Using automatically selected adapter %S\n", this->lstWlanInterfaces->InterfaceInfo[0].strInterfaceDescription);
159162
dwResult = StringFromIID(this->lstWlanInterfaces->InterfaceInfo[0].InterfaceGuid, &this->m_sGUID);
163+
}
160164

161165
return bWlanDevicePresent;
162166
}

0 commit comments

Comments
 (0)