Commit 58797fc5 authored by Lei Zhang's avatar Lei Zhang Committed by Alexandre Julliard

shlwapi: Refactor data return code in IQueryAssociations_fnGetString.

parent 4e0c0ec1
......@@ -670,6 +670,29 @@ static HRESULT ASSOC_GetExecutable(IQueryAssociationsImpl *This,
return S_OK;
}
static HRESULT ASSOC_ReturnData(LPWSTR out, DWORD *outlen, LPCWSTR data,
DWORD datalen)
{
assert(outlen);
if (out)
{
if (*outlen < datalen)
{
*outlen = datalen;
return E_POINTER;
}
*outlen = datalen;
lstrcpynW(out, data, datalen);
return S_OK;
}
else
{
*outlen = datalen;
return S_FALSE;
}
}
/**************************************************************************
* IQueryAssociations_GetString {SHLWAPI}
*
......@@ -718,22 +741,7 @@ static HRESULT WINAPI IQueryAssociations_fnGetString(
if (FAILED(hr))
return hr;
len++;
if (pszOut)
{
if (*pcchOut < len)
{
*pcchOut = len;
return E_POINTER;
}
*pcchOut = len;
lstrcpynW(pszOut, path, len);
return S_OK;
}
else
{
*pcchOut = len;
return S_FALSE;
}
return ASSOC_ReturnData(pszOut, pcchOut, path, len);
break;
}
......
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