Skip to content

Commit a7bb32f

Browse files
committed
[WLANWIZ] Use CStringW instead of wstring_view on MSVC and clang-cl
stlport to praise
1 parent 483cae2 commit a7bb32f

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

dll/shellext/wlanwiz/scan.cpp

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,11 @@ LRESULT CWlanWizard::OnScanNetworks(WORD wNotifyCode, WORD wID, HWND hWndCtl, BO
128128
{
129129
if (dwKnownAPIdx == dwAP)
130130
return false;
131-
131+
#if defined(__REACTOS__) && defined(_MSC_VER)
132+
bool bProfileNameIsSSID = ATL::CStringW(wlanNetWithProfile->strProfileName) == APNameToUnicode(&this->lstWlanNetworks->Network[dwAP].dot11Ssid);
133+
#else
132134
bool bProfileNameIsSSID = std::wstring_view(wlanNetWithProfile->strProfileName) == std::wstring_view(APNameToUnicode(&this->lstWlanNetworks->Network[dwAP].dot11Ssid));
135+
#endif
133136
bool bHasProfile = (this->lstWlanNetworks->Network[dwAP].dwFlags & WLAN_AVAILABLE_NETWORK_HAS_PROFILE) != 0;
134137

135138
return bProfileNameIsSSID && !bHasProfile;
@@ -165,14 +168,7 @@ LRESULT CWlanWizard::OnScanNetworks(WORD wNotifyCode, WORD wID, HWND hWndCtl, BO
165168
for (const auto& dwNetwork : vecIndexesBySignalQuality)
166169
{
167170
PWLAN_AVAILABLE_NETWORK pWlanNetwork = &this->lstWlanNetworks->Network[dwNetwork];
168-
std::wstring_view wsvSSID;
169-
170-
// Convert SSID from UTF-8 to UTF-16
171-
int iSSIDLengthWide = MultiByteToWideChar(CP_UTF8, 0, reinterpret_cast<LPCSTR>(pWlanNetwork->dot11Ssid.ucSSID), pWlanNetwork->dot11Ssid.uSSIDLength, NULL, 0);
172-
173-
ATL::CStringW cswSSID = ATL::CStringW(L"", iSSIDLengthWide);
174-
MultiByteToWideChar(CP_UTF8, 0, reinterpret_cast<LPCSTR>(pWlanNetwork->dot11Ssid.ucSSID), pWlanNetwork->dot11Ssid.uSSIDLength, cswSSID.GetBuffer(), iSSIDLengthWide);
175-
wsvSSID = std::wstring_view(cswSSID.GetBuffer());
171+
ATL::CStringW cswSSID = APNameToUnicode(&pWlanNetwork->dot11Ssid);
176172

177173
if (cswSSID.IsEmpty())
178174
cswSSID.LoadStringW(IDS_WLANWIZ_HIDDEN_NETWORK);

0 commit comments

Comments
 (0)