Skip to content

Commit 26daa21

Browse files
committed
[WLANWIZ] Compact FAILED() usages
1 parent 172d1aa commit 26daa21

File tree

2 files changed

+15
-22
lines changed

2 files changed

+15
-22
lines changed

dll/shellext/wlanwiz/advsettings.cpp

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@
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 (WLAN Advanced Settings)
5-
* COPYRIGHT: Copyright 2024 Vitaly Orekhov <[email protected]>
5+
* COPYRIGHT: Copyright 2024-2025 Vitaly Orekhov <[email protected]>
66
*/
7-
87
#include "main.h"
98

109
LRESULT CWlanWizard::OnAdvancedSettings(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
@@ -17,35 +16,22 @@ LRESULT CWlanWizard::OnAdvancedSettings(WORD wNotifyCode, WORD wID, HWND hWndCtl
1716
LPCITEMIDLIST pidlChild = NULL;
1817
SHDESCRIPTIONID did = { 0 };
1918

20-
HRESULT hr = SHGetSpecialFolderLocation(NULL, CSIDL_CONNECTIONS, &pidl);
21-
22-
if (FAILED(hr))
19+
if (FAILED(SHGetSpecialFolderLocation(NULL, CSIDL_CONNECTIONS, &pidl)))
2320
goto Exit;
2421

25-
hr = SHBindToParent(pidl, IID_IShellFolder, reinterpret_cast<LPVOID*>(&sfConn), &pidlChild);
26-
27-
if (FAILED(hr))
22+
if (FAILED(SHBindToParent(pidl, IID_IShellFolder, reinterpret_cast<LPVOID*>(&sfConn), &pidlChild)))
2823
goto Exit;
2924

30-
hr = SHGetDataFromIDListW(sfConn, pidlChild, SHGDFIL_DESCRIPTIONID, &did, sizeof(did));
31-
32-
if (FAILED(hr))
25+
if (FAILED(SHGetDataFromIDListW(sfConn, pidlChild, SHGDFIL_DESCRIPTIONID, &did, sizeof(did))))
3326
goto Exit;
3427

35-
hr = StringFromIID(did.clsid, &lpwszNetConCLSID);
36-
37-
if (FAILED(hr))
28+
if (FAILED(StringFromIID(did.clsid, &lpwszNetConCLSID)))
3829
goto Exit;
3930

4031
ILFree(pidl);
4132
sfConn.Release();
4233
#else
43-
#if _WIN32_WINNT < _WIN32_WINNT_VISTA
44-
HRESULT hr = StringFromIID(CLSID_NetworkConnections, &lpwszNetConCLSID);
45-
#else
46-
HRESULT hr = StringFromIID(CLSID_ConnectionFolder, &lpwszNetConCLSID);
47-
#endif
48-
if (FAILED(hr))
34+
if (FAILED(StringFromIID(CLSID_NetworkConnections, &lpwszNetConCLSID)))
4935
goto Exit;
5036
#endif
5137
cswNetworkAdapterPath.Format(L"::%s\\::%s", lpwszNetConCLSID, this->m_sGUID);

dll/shellext/wlanwiz/wlanwiz.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,19 @@ BOOL CWlanWizard::FindWlanDevice(ATL::CString sGUID)
8181
{
8282
/* Create WLAN client handle */
8383
DWORD dwResult = WlanOpenHandle(WLAN_API_VERSION_1_0, NULL, &this->dwNegotiatedVersion, &this->hWlanClient);
84-
8584
if (FAILED(dwResult))
86-
return 0; // TODO: handle it
85+
{
86+
DPRINT1("WlanOpenHandle failed: %lx\n", dwResult);
87+
return FALSE;
88+
}
8789

8890
/* Get list of all WLAN devices */
8991
dwResult = WlanEnumInterfaces(this->hWlanClient, NULL, &this->lstWlanInterfaces);
92+
if (FAILED(dwResult))
93+
{
94+
DPRINT1("WlanEnumInterfaces failed: %lx\n", dwResult);
95+
return FALSE;
96+
}
9097

9198
/* If GUID was supplied on start, we will try to find a device that has it. */
9299
if (!sGUID.IsEmpty())

0 commit comments

Comments
 (0)