https://git.reactos.org/?p=reactos.git;a=commitdiff;h=5eeeb1c23541b0eaf5edc…
commit 5eeeb1c23541b0eaf5edcc356ec35578d43b5da8
Author: Hervé Poussineau <hpoussin(a)reactos.org>
AuthorDate: Mon Sep 26 23:33:16 2022 +0200
Commit: Hervé Poussineau <hpoussin(a)reactos.org>
CommitDate: Mon Sep 26 23:33:57 2022 +0200
[NETSHELL] Return error if disconnection failed
CORE-12307
---
dll/shellext/netshell/connectmanager.cpp | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/dll/shellext/netshell/connectmanager.cpp
b/dll/shellext/netshell/connectmanager.cpp
index 78e2059df51..fd934b09b09 100644
--- a/dll/shellext/netshell/connectmanager.cpp
+++ b/dll/shellext/netshell/connectmanager.cpp
@@ -135,9 +135,10 @@ CNetConnection::Disconnect()
PropChangeParams.Scope = DICS_FLAG_CONFIGSPECIFIC;
PropChangeParams.HwProfile = 0;
- if (SetupDiSetClassInstallParams(hInfo, &DevInfo,
&PropChangeParams.ClassInstallHeader, sizeof(SP_PROPCHANGE_PARAMS)))
+ if (!SetupDiSetClassInstallParams(hInfo, &DevInfo,
&PropChangeParams.ClassInstallHeader, sizeof(SP_PROPCHANGE_PARAMS)) ||
+ !SetupDiCallClassInstaller(DIF_PROPERTYCHANGE, hInfo, &DevInfo))
{
- SetupDiCallClassInstaller(DIF_PROPERTYCHANGE, hInfo, &DevInfo);
+ hr = HRESULT_FROM_WIN32(GetLastError());
}
}
SetupDiDestroyDeviceInfoList(hInfo);
@@ -145,6 +146,9 @@ CNetConnection::Disconnect()
swprintf(szPath,
L"SYSTEM\\CurrentControlSet\\Control\\Network\\{4D36E972-E325-11CE-BFC1-08002BE10318}\\%s\\Connection",
pDisplayName);
CoTaskMemFree(pDisplayName);
+ if (FAILED_UNEXPECTEDLY(hr))
+ return hr;
+
if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, szPath, 0, KEY_READ, &hKey) !=
ERROR_SUCCESS)
return E_FAIL;