Commit d7d05848 authored by Andrew Eikum's avatar Andrew Eikum Committed by Alexandre Julliard

shell32: Rearrange error handling in IKnownFolder::GetFolderDefinition.

parent 41556170
......@@ -3675,20 +3675,25 @@ static HRESULT WINAPI knownfolder_GetFolderDefinition(
ZeroMemory(pKFD, sizeof(*pKFD));
hr = get_known_folder_category(knownfolder->registryPath, &pKFD->category);
if(FAILED(hr))
return hr;
if(SUCCEEDED(hr))
hr = HRESULT_FROM_WIN32(RegGetValueW(HKEY_LOCAL_MACHINE, knownfolder->registryPath, szName, RRF_RT_REG_SZ, NULL, NULL, &dwSize));
hr = HRESULT_FROM_WIN32(RegGetValueW(HKEY_LOCAL_MACHINE, knownfolder->registryPath, szName, RRF_RT_REG_SZ, NULL, NULL, &dwSize));
if(FAILED(hr))
return hr;
if(SUCCEEDED(hr))
{
pKFD->pszName = CoTaskMemAlloc(dwSize);
if(!pKFD->pszName) hr = E_OUTOFMEMORY;
}
pKFD->pszName = CoTaskMemAlloc(dwSize);
if(!pKFD->pszName)
return E_OUTOFMEMORY;
if(SUCCEEDED(hr))
hr = HRESULT_FROM_WIN32(RegGetValueW(HKEY_LOCAL_MACHINE, knownfolder->registryPath, szName, RRF_RT_REG_SZ, NULL, pKFD->pszName, &dwSize));
hr = HRESULT_FROM_WIN32(RegGetValueW(HKEY_LOCAL_MACHINE, knownfolder->registryPath, szName, RRF_RT_REG_SZ, NULL, pKFD->pszName, &dwSize));
if(FAILED(hr)){
CoTaskMemFree(pKFD->pszName);
pKFD->pszName = NULL;
return hr;
}
return hr;
return S_OK;
}
static const struct IKnownFolderVtbl knownfolder_vtbl =
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment