Skip to content

Commit b666784

Browse files
committed
[WLANWIZ] Access WLAN_AVAILABLE_NETWORK through pointers
1 parent e80d956 commit b666784

File tree

2 files changed

+19
-21
lines changed

2 files changed

+19
-21
lines changed

dll/shellext/wlanwiz/draw.cpp

Lines changed: 16 additions & 16 deletions
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 (Drawing Routines)
5-
* COPYRIGHT: Copyright 2024 Vitaly Orekhov <[email protected]>
5+
* COPYRIGHT: Copyright 2024-2025 Vitaly Orekhov <[email protected]>
66
*/
77
#include "main.h"
88

@@ -158,7 +158,7 @@ LRESULT CWlanWizard::OnDrawItem(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& b
158158
UINT uSSIDLength = static_cast<UINT>(SendDlgItemMessageW(pdis->CtlID, LB_GETTEXTLEN, pdis->itemID, NULL));
159159
DWORD uItemRealID = static_cast<DWORD>(SendDlgItemMessageW(pdis->CtlID, LB_GETITEMDATA, pdis->itemID, NULL));
160160

161-
WLAN_AVAILABLE_NETWORK wlanNetwork = this->lstWlanNetworks->Network[uItemRealID];
161+
PWLAN_AVAILABLE_NETWORK pWlanNetwork = &this->lstWlanNetworks->Network[uItemRealID];
162162

163163
/* Step 1: draw listbox item's graphics, starting with the background */
164164
if (!(pdis->itemState & ODS_SELECTED))
@@ -210,7 +210,7 @@ LRESULT CWlanWizard::OnDrawItem(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& b
210210
}
211211

212212
/* Signal quality bar */
213-
WLAN_SIGNAL_QUALITY ulSQ = wlanNetwork.wlanSignalQuality;
213+
WLAN_SIGNAL_QUALITY ulSQ = pWlanNetwork->wlanSignalQuality;
214214
int iSQResIcon = IDI_WLANICON;
215215

216216
if (16 <= ulSQ && ulSQ < 36)
@@ -239,7 +239,7 @@ LRESULT CWlanWizard::OnDrawItem(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& b
239239
/* Network type */
240240
int iBSSIcon = IDI_BSS_INFRA;
241241

242-
if (wlanNetwork.dot11BssType == dot11_BSS_type_independent)
242+
if (pWlanNetwork->dot11BssType == dot11_BSS_type_independent)
243243
iBSSIcon = IDI_BSS_ADHOC;
244244

245245
hicnRes = static_cast<HICON>(LoadImageW(wlanwiz_hInstance, MAKEINTRESOURCEW(iBSSIcon), IMAGE_ICON, 48, 48, LR_LOADTRANSPARENT));
@@ -255,7 +255,7 @@ LRESULT CWlanWizard::OnDrawItem(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& b
255255
DestroyIcon(hicnRes);
256256

257257
/* Authentication standard strength */
258-
if (wlanNetwork.bSecurityEnabled)
258+
if (pWlanNetwork->bSecurityEnabled)
259259
{
260260
HICON hicnSecurity = LoadIconW(GetModuleHandleW(L"shell32.dll"), MAKEINTRESOURCEW(48)); /* lock icon */
261261

@@ -268,7 +268,7 @@ LRESULT CWlanWizard::OnDrawItem(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& b
268268
DI_NORMAL);
269269

270270
/* WEP is not secure for decades */
271-
if (wlanNetwork.dot11DefaultAuthAlgorithm < DOT11_AUTH_ALGO_WPA)
271+
if (pWlanNetwork->dot11DefaultAuthAlgorithm < DOT11_AUTH_ALGO_WPA)
272272
{
273273
DrawIconEx(pdis->hDC,
274274
54, pdis->rcItem.top + 37,
@@ -305,9 +305,9 @@ LRESULT CWlanWizard::OnDrawItem(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& b
305305
ATL::CStringW cswNetworkSecurityAlgo = L"";
306306
ATL::CStringW cswNetworkSecurity = L"";
307307

308-
if (wlanNetwork.bSecurityEnabled)
308+
if (pWlanNetwork->bSecurityEnabled)
309309
{
310-
switch (wlanNetwork.dot11DefaultAuthAlgorithm)
310+
switch (pWlanNetwork->dot11DefaultAuthAlgorithm)
311311
{
312312
case DOT11_AUTH_ALGO_80211_OPEN:
313313
case DOT11_AUTH_ALGO_80211_SHARED_KEY:
@@ -333,15 +333,15 @@ LRESULT CWlanWizard::OnDrawItem(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& b
333333
}
334334
}
335335

336-
if (wlanNetwork.dot11BssType == dot11_BSS_type_infrastructure)
337-
cswNetworkSecurity.LoadStringW(wlanNetwork.bSecurityEnabled ? IDS_WLANWIZ_ENCRYPTED_AP : IDS_WLANWIZ_UNENCRYPTED_AP);
338-
else if (wlanNetwork.dot11BssType == dot11_BSS_type_independent)
339-
cswNetworkSecurity.LoadStringW(wlanNetwork.bSecurityEnabled ? IDS_WLANWIZ_ENCRYPTED_IBSS : IDS_WLANWIZ_UNENCRYPTED_IBSS);
336+
if (pWlanNetwork->dot11BssType == dot11_BSS_type_infrastructure)
337+
cswNetworkSecurity.LoadStringW(pWlanNetwork->bSecurityEnabled ? IDS_WLANWIZ_ENCRYPTED_AP : IDS_WLANWIZ_UNENCRYPTED_AP);
338+
else if (pWlanNetwork->dot11BssType == dot11_BSS_type_independent)
339+
cswNetworkSecurity.LoadStringW(pWlanNetwork->bSecurityEnabled ? IDS_WLANWIZ_ENCRYPTED_IBSS : IDS_WLANWIZ_UNENCRYPTED_IBSS);
340340

341341
cswNetworkSecurity += cswNetworkSecurityAlgo;
342342

343343
TextOutW(pdis->hDC,
344-
wlanNetwork.bSecurityEnabled ? 72 : 52,
344+
pWlanNetwork->bSecurityEnabled ? 72 : 52,
345345
pdis->rcItem.top + 38,
346346
cswNetworkSecurity, cswNetworkSecurity.GetLength());
347347

@@ -351,13 +351,13 @@ LRESULT CWlanWizard::OnDrawItem(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& b
351351
{
352352
ATL::CStringW cswExpandedText = L"";
353353

354-
if (wlanNetwork.dwFlags & WLAN_AVAILABLE_NETWORK_CONNECTED)
354+
if (pWlanNetwork->dwFlags & WLAN_AVAILABLE_NETWORK_CONNECTED)
355355
cswExpandedText.LoadStringW(IDS_WLANWIZ_EXPAND_CONNECTED);
356356
else
357357
{
358-
if (wlanNetwork.bSecurityEnabled)
358+
if (pWlanNetwork->bSecurityEnabled)
359359
{
360-
wlanNetwork.dot11DefaultAuthAlgorithm < DOT11_AUTH_ALGO_WPA
360+
pWlanNetwork->dot11DefaultAuthAlgorithm < DOT11_AUTH_ALGO_WPA
361361
? cswExpandedText.LoadStringW(IDS_WLANWIZ_EXPAND_ENCRYPTED_OBSOLETE)
362362
: cswExpandedText.LoadStringW(IDS_WLANWIZ_EXPAND_ENCRYPTED);
363363
}

dll/shellext/wlanwiz/scan.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -206,14 +206,14 @@ LRESULT CWlanWizard::OnScanNetworks(WORD wNotifyCode, WORD wID, HWND hWndCtl, BO
206206

207207
for (const auto& dwNetwork : vecIndexesBySignalQuality)
208208
{
209-
WLAN_AVAILABLE_NETWORK wlanNetwork = this->lstWlanNetworks->Network[dwNetwork];
209+
PWLAN_AVAILABLE_NETWORK pWlanNetwork = &this->lstWlanNetworks->Network[dwNetwork];
210210
std::wstring_view wsvSSID;
211211

212212
// Convert SSID from UTF-8 to UTF-16
213-
int iSSIDLengthWide = MultiByteToWideChar(CP_UTF8, 0, reinterpret_cast<LPCSTR>(wlanNetwork.dot11Ssid.ucSSID), wlanNetwork.dot11Ssid.uSSIDLength, NULL, 0);
213+
int iSSIDLengthWide = MultiByteToWideChar(CP_UTF8, 0, reinterpret_cast<LPCSTR>(pWlanNetwork->dot11Ssid.ucSSID), pWlanNetwork->dot11Ssid.uSSIDLength, NULL, 0);
214214

215215
ATL::CStringW cswSSID = ATL::CStringW(L"", iSSIDLengthWide);
216-
MultiByteToWideChar(CP_UTF8, 0, reinterpret_cast<LPCSTR>(wlanNetwork.dot11Ssid.ucSSID), wlanNetwork.dot11Ssid.uSSIDLength, cswSSID.GetBuffer(), iSSIDLengthWide);
216+
MultiByteToWideChar(CP_UTF8, 0, reinterpret_cast<LPCSTR>(pWlanNetwork->dot11Ssid.ucSSID), pWlanNetwork->dot11Ssid.uSSIDLength, cswSSID.GetBuffer(), iSSIDLengthWide);
217217
wsvSSID = std::wstring_view(cswSSID.GetBuffer());
218218

219219
if (cswSSID.IsEmpty())
@@ -230,9 +230,7 @@ LRESULT CWlanWizard::OnScanNetworks(WORD wNotifyCode, WORD wID, HWND hWndCtl, BO
230230
}
231231

232232
/* Show discovered networks */
233-
RECT rc;
234233
m_ListboxWLAN.EnableWindow();
235-
m_ListboxWLAN.GetClientRect(&rc);
236234
m_ListboxWLAN.Invalidate();
237235
m_ListboxWLAN.SetFocus();
238236

0 commit comments

Comments
 (0)