Author: gadamopoulos
Date: Mon Feb 20 20:13:22 2017
New Revision: 73865
URL:
http://svn.reactos.org/svn/reactos?rev=73865&view=rev
Log:
[SHELL32] -Cleanup CFSFolder::_LoadDynamicDropTargetHandlerForKey. Inspired by patch by
Victor Martinez Calvo. CORE-12799. CID 1401249
Modified:
trunk/reactos/dll/win32/shell32/folders/CFSFolder.cpp
Modified: trunk/reactos/dll/win32/shell32/folders/CFSFolder.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/folders/…
==============================================================================
--- trunk/reactos/dll/win32/shell32/folders/CFSFolder.cpp [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shell32/folders/CFSFolder.cpp [iso-8859-1] Mon Feb 20 20:13:22
2017
@@ -1056,38 +1056,41 @@
{
TRACE("CFSFolder::_LoadDynamicDropTargetHandlerForKey entered\n");
- WCHAR wszName[MAX_PATH], *pwszClsid;
+ WCHAR wszName[MAX_PATH];
DWORD dwSize = sizeof(wszName);
HRESULT hr;
-
- if (RegGetValueW(hRootKey, L"shellex\\DropHandler", NULL, RRF_RT_REG_SZ,
NULL, wszName, &dwSize) == ERROR_SUCCESS)
- {
- CLSID clsid;
- hr = CLSIDFromString(wszName, &clsid);
- if (hr == S_OK)
- pwszClsid = wszName;
-
- if (m_bGroupPolicyActive)
- {
- if (RegGetValueW(HKEY_LOCAL_MACHINE,
- L"Software\\Microsoft\\Windows\\CurrentVersion\\Shell
Extensions\\Approved",
- pwszClsid,
- RRF_RT_REG_SZ,
- NULL,
- NULL,
- NULL) == ERROR_SUCCESS)
- {
- hr = _LoadDynamicDropTargetHandler(&clsid, pwcsname, ppvOut);
- }
- }
- else
- {
- hr = _LoadDynamicDropTargetHandler(&clsid, pwcsname, ppvOut);
- }
- }
- else
- return E_FAIL;
- return hr;
+ LRESULT res;
+
+ res = RegGetValueW(hRootKey, L"shellex\\DropHandler", NULL, RRF_RT_REG_SZ,
NULL, wszName, &dwSize);
+ if (res != ERROR_SUCCESS)
+ return S_FALSE;
+
+ CLSID clsid;
+ hr = CLSIDFromString(wszName, &clsid);
+ if (FAILED_UNEXPECTEDLY(hr))
+ return hr;
+
+ if (m_bGroupPolicyActive)
+ {
+ res = RegGetValueW(HKEY_LOCAL_MACHINE,
+ L"Software\\Microsoft\\Windows\\CurrentVersion\\Shell
Extensions\\Approved",
+ wszName,
+ RRF_RT_REG_SZ,
+ NULL,
+ NULL,
+ NULL);
+ if (res != ERROR_SUCCESS)
+ {
+ ERR("DropHandler extension %S not approved\n", wszName);
+ return E_FAIL;
+ }
+ }
+
+ hr = _LoadDynamicDropTargetHandler(&clsid, pwcsname, ppvOut);
+ if (FAILED_UNEXPECTEDLY(hr))
+ return hr;
+
+ return S_OK;
}
HRESULT WINAPI CFSFolder::_LoadDynamicDropTargetHandler(const CLSID *pclsid, LPCWSTR
pwcsname, LPVOID *ppvOut)