Skip to content

Commit 5eeeb1c

Browse files
committed
[NETSHELL] Return error if disconnection failed
CORE-12307
1 parent 2469ce2 commit 5eeeb1c

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

dll/shellext/netshell/connectmanager.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,16 +135,20 @@ CNetConnection::Disconnect()
135135
PropChangeParams.Scope = DICS_FLAG_CONFIGSPECIFIC;
136136
PropChangeParams.HwProfile = 0;
137137

138-
if (SetupDiSetClassInstallParams(hInfo, &DevInfo, &PropChangeParams.ClassInstallHeader, sizeof(SP_PROPCHANGE_PARAMS)))
138+
if (!SetupDiSetClassInstallParams(hInfo, &DevInfo, &PropChangeParams.ClassInstallHeader, sizeof(SP_PROPCHANGE_PARAMS)) ||
139+
!SetupDiCallClassInstaller(DIF_PROPERTYCHANGE, hInfo, &DevInfo))
139140
{
140-
SetupDiCallClassInstaller(DIF_PROPERTYCHANGE, hInfo, &DevInfo);
141+
hr = HRESULT_FROM_WIN32(GetLastError());
141142
}
142143
}
143144
SetupDiDestroyDeviceInfoList(hInfo);
144145

145146
swprintf(szPath, L"SYSTEM\\CurrentControlSet\\Control\\Network\\{4D36E972-E325-11CE-BFC1-08002BE10318}\\%s\\Connection", pDisplayName);
146147
CoTaskMemFree(pDisplayName);
147148

149+
if (FAILED_UNEXPECTEDLY(hr))
150+
return hr;
151+
148152
if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, szPath, 0, KEY_READ, &hKey) != ERROR_SUCCESS)
149153
return E_FAIL;
150154

0 commit comments

Comments
 (0)