Commit 50c1e46d authored by Robert Shearman's avatar Robert Shearman Committed by Alexandre Julliard

shell: Convert SHELL32_GetDisplayNameOfChild to unicode.

parent 8cfa507f
...@@ -652,7 +652,8 @@ static HRESULT WINAPI ISF_ControlPanel_fnGetDisplayNameOf(IShellFolder2 * iface, ...@@ -652,7 +652,8 @@ static HRESULT WINAPI ISF_ControlPanel_fnGetDisplayNameOf(IShellFolder2 * iface,
{ {
ICPanelImpl *This = (ICPanelImpl *)iface; ICPanelImpl *This = (ICPanelImpl *)iface;
CHAR szPath[MAX_PATH*2]; CHAR szPath[MAX_PATH];
WCHAR wszPath[MAX_PATH+1]; /* +1 for potential backslash */
PIDLCPanelStruct* pcpanel; PIDLCPanelStruct* pcpanel;
*szPath = '\0'; *szPath = '\0';
...@@ -676,7 +677,7 @@ static HRESULT WINAPI ISF_ControlPanel_fnGetDisplayNameOf(IShellFolder2 * iface, ...@@ -676,7 +677,7 @@ static HRESULT WINAPI ISF_ControlPanel_fnGetDisplayNameOf(IShellFolder2 * iface,
BOOL bSimplePidl = _ILIsPidlSimple(pidl); BOOL bSimplePidl = _ILIsPidlSimple(pidl);
if (bSimplePidl) { if (bSimplePidl) {
_ILSimpleGetText(pidl, szPath, MAX_PATH); /* append my own path */ _ILSimpleGetTextW(pidl, wszPath, MAX_PATH); /* append my own path */
} else { } else {
FIXME("special pidl\n"); FIXME("special pidl\n");
} }
...@@ -684,12 +685,14 @@ static HRESULT WINAPI ISF_ControlPanel_fnGetDisplayNameOf(IShellFolder2 * iface, ...@@ -684,12 +685,14 @@ static HRESULT WINAPI ISF_ControlPanel_fnGetDisplayNameOf(IShellFolder2 * iface,
if ((dwFlags & SHGDN_FORPARSING) && !bSimplePidl) { /* go deeper if needed */ if ((dwFlags & SHGDN_FORPARSING) && !bSimplePidl) { /* go deeper if needed */
int len = 0; int len = 0;
PathAddBackslashA(szPath); /*FIXME*/ PathAddBackslashW(wszPath);
len = lstrlenA(szPath); len = lstrlenW(wszPath);
if (!SUCCEEDED if (!SUCCEEDED
(SHELL32_GetDisplayNameOfChild(iface, pidl, dwFlags | SHGDN_INFOLDER, szPath + len, MAX_PATH - len))) (SHELL32_GetDisplayNameOfChild(iface, pidl, dwFlags | SHGDN_INFOLDER, wszPath + len, MAX_PATH + 1 - len)))
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
if (!WideCharToMultiByte(CP_ACP, 0, wszPath, -1, szPath, MAX_PATH, NULL, NULL))
wszPath[0] = '\0';
} }
} }
......
...@@ -39,7 +39,7 @@ LPCWSTR GetNextElementW (LPCWSTR pszNext, LPWSTR pszOut, DWORD dwOut); ...@@ -39,7 +39,7 @@ LPCWSTR GetNextElementW (LPCWSTR pszNext, LPWSTR pszOut, DWORD dwOut);
HRESULT SHELL32_ParseNextElement (IShellFolder2 * psf, HWND hwndOwner, LPBC pbc, LPITEMIDLIST * pidlInOut, HRESULT SHELL32_ParseNextElement (IShellFolder2 * psf, HWND hwndOwner, LPBC pbc, LPITEMIDLIST * pidlInOut,
LPOLESTR szNext, DWORD * pEaten, DWORD * pdwAttributes); LPOLESTR szNext, DWORD * pEaten, DWORD * pdwAttributes);
HRESULT SHELL32_GetItemAttributes (IShellFolder * psf, LPCITEMIDLIST pidl, LPDWORD pdwAttributes); HRESULT SHELL32_GetItemAttributes (IShellFolder * psf, LPCITEMIDLIST pidl, LPDWORD pdwAttributes);
HRESULT SHELL32_GetDisplayNameOfChild (IShellFolder2 * psf, LPCITEMIDLIST pidl, DWORD dwFlags, LPSTR szOut, HRESULT SHELL32_GetDisplayNameOfChild (IShellFolder2 * psf, LPCITEMIDLIST pidl, DWORD dwFlags, LPWSTR szOut,
DWORD dwOutLen); DWORD dwOutLen);
HRESULT SHELL32_BindToChild (LPCITEMIDLIST pidlRoot, HRESULT SHELL32_BindToChild (LPCITEMIDLIST pidlRoot,
......
...@@ -562,6 +562,7 @@ static HRESULT WINAPI ISF_Desktop_fnGetDisplayNameOf (IShellFolder2 * iface, ...@@ -562,6 +562,7 @@ static HRESULT WINAPI ISF_Desktop_fnGetDisplayNameOf (IShellFolder2 * iface,
{ {
IGenericSFImpl *This = (IGenericSFImpl *)iface; IGenericSFImpl *This = (IGenericSFImpl *)iface;
HRESULT hr = S_OK; HRESULT hr = S_OK;
WCHAR wszPath[MAX_PATH];
TRACE ("(%p)->(pidl=%p,0x%08lx,%p)\n", This, pidl, dwFlags, strRet); TRACE ("(%p)->(pidl=%p,0x%08lx,%p)\n", This, pidl, dwFlags, strRet);
pdump (pidl); pdump (pidl);
...@@ -645,13 +646,20 @@ static HRESULT WINAPI ISF_Desktop_fnGetDisplayNameOf (IShellFolder2 * iface, ...@@ -645,13 +646,20 @@ static HRESULT WINAPI ISF_Desktop_fnGetDisplayNameOf (IShellFolder2 * iface,
if ((GET_SHGDN_RELATION (dwFlags) == SHGDN_NORMAL) && if ((GET_SHGDN_RELATION (dwFlags) == SHGDN_NORMAL) &&
bWantsForParsing) bWantsForParsing)
{ {
WCHAR wszPath[MAX_PATH];
/* /*
* we need the filesystem path to the destination folder. * we need the filesystem path to the destination folder.
* Only the folder itself can know it * Only the folder itself can know it
*/ */
hr = SHELL32_GetDisplayNameOfChild (iface, pidl, dwFlags, hr = SHELL32_GetDisplayNameOfChild (iface, pidl, dwFlags,
strRet->u.cStr, wszPath,
MAX_PATH); MAX_PATH);
if (SUCCEEDED(hr))
{
if (!WideCharToMultiByte(CP_ACP, 0, wszPath, -1, strRet->u.cStr, MAX_PATH,
NULL, NULL))
wszPath[0] = '\0';
}
} }
else else
{ {
...@@ -690,7 +698,13 @@ static HRESULT WINAPI ISF_Desktop_fnGetDisplayNameOf (IShellFolder2 * iface, ...@@ -690,7 +698,13 @@ static HRESULT WINAPI ISF_Desktop_fnGetDisplayNameOf (IShellFolder2 * iface,
{ {
/* a complex pidl, let the subfolder do the work */ /* a complex pidl, let the subfolder do the work */
hr = SHELL32_GetDisplayNameOfChild (iface, pidl, dwFlags, hr = SHELL32_GetDisplayNameOfChild (iface, pidl, dwFlags,
strRet->u.cStr, MAX_PATH); wszPath, MAX_PATH);
if (SUCCEEDED(hr))
{
if (!WideCharToMultiByte(CP_ACP, 0, wszPath, -1, strRet->u.cStr, MAX_PATH,
NULL, NULL))
wszPath[0] = '\0';
}
} }
TRACE ("-- (%p)->(%s,0x%08lx)\n", This, TRACE ("-- (%p)->(%s,0x%08lx)\n", This,
......
...@@ -816,7 +816,13 @@ IShellFolder_fnGetDisplayNameOf (IShellFolder2 * iface, LPCITEMIDLIST pidl, ...@@ -816,7 +816,13 @@ IShellFolder_fnGetDisplayNameOf (IShellFolder2 * iface, LPCITEMIDLIST pidl,
_ILSimpleGetText(pidl, strRet->u.cStr + len, MAX_PATH - len); _ILSimpleGetText(pidl, strRet->u.cStr + len, MAX_PATH - len);
if (!_ILIsFolder(pidl)) SHELL_FS_ProcessDisplayFilename(strRet->u.cStr, dwFlags); if (!_ILIsFolder(pidl)) SHELL_FS_ProcessDisplayFilename(strRet->u.cStr, dwFlags);
} else { } else {
hr = SHELL32_GetDisplayNameOfChild(iface, pidl, dwFlags, strRet->u.cStr, MAX_PATH); WCHAR wszPath[MAX_PATH];
hr = SHELL32_GetDisplayNameOfChild(iface, pidl, dwFlags, wszPath, MAX_PATH);
if (SUCCEEDED(hr)) {
if (!WideCharToMultiByte(CP_ACP, 0, wszPath, -1, strRet->u.cStr, MAX_PATH,
NULL, NULL))
wszPath[0] = '\0';
}
} }
TRACE ("-- (%p)->(%s)\n", This, strRet->u.cStr); TRACE ("-- (%p)->(%s)\n", This, strRet->u.cStr);
......
...@@ -617,12 +617,19 @@ static HRESULT WINAPI ISF_MyComputer_fnGetDisplayNameOf (IShellFolder2 *iface, ...@@ -617,12 +617,19 @@ static HRESULT WINAPI ISF_MyComputer_fnGetDisplayNameOf (IShellFolder2 *iface,
if ((GET_SHGDN_RELATION (dwFlags) == SHGDN_NORMAL) && if ((GET_SHGDN_RELATION (dwFlags) == SHGDN_NORMAL) &&
bWantsForParsing) bWantsForParsing)
{ {
WCHAR wszPath[MAX_PATH];
/* /*
* We need the filesystem path to the destination folder * We need the filesystem path to the destination folder
* Only the folder itself can know it * Only the folder itself can know it
*/ */
hr = SHELL32_GetDisplayNameOfChild (iface, pidl, hr = SHELL32_GetDisplayNameOfChild (iface, pidl,
dwFlags, szPath, MAX_PATH); dwFlags, wszPath, MAX_PATH);
if (SUCCEEDED(hr))
{
if (!WideCharToMultiByte(CP_ACP, 0, wszPath, -1, szPath, MAX_PATH,
NULL, NULL))
wszPath[0] = '\0';
}
} }
else else
{ {
...@@ -677,9 +684,16 @@ static HRESULT WINAPI ISF_MyComputer_fnGetDisplayNameOf (IShellFolder2 *iface, ...@@ -677,9 +684,16 @@ static HRESULT WINAPI ISF_MyComputer_fnGetDisplayNameOf (IShellFolder2 *iface,
} }
else else
{ {
WCHAR wszPath[MAX_PATH];
/* Complex pidl. Let the child folder do the work */ /* Complex pidl. Let the child folder do the work */
strRet->uType = STRRET_CSTR; strRet->uType = STRRET_CSTR;
hr = SHELL32_GetDisplayNameOfChild(iface, pidl, dwFlags, szPath, MAX_PATH); hr = SHELL32_GetDisplayNameOfChild(iface, pidl, dwFlags, wszPath, MAX_PATH);
if (SUCCEEDED(hr))
{
if (!WideCharToMultiByte(CP_ACP, 0, wszPath, -1, szPath, MAX_PATH,
NULL, NULL))
wszPath[0] = '\0';
}
} }
if (SUCCEEDED (hr)) if (SUCCEEDED (hr))
......
...@@ -331,7 +331,7 @@ HRESULT SHELL32_BindToChild (LPCITEMIDLIST pidlRoot, ...@@ -331,7 +331,7 @@ HRESULT SHELL32_BindToChild (LPCITEMIDLIST pidlRoot,
* virtual folders with the registry key WantsFORPARSING set. * virtual folders with the registry key WantsFORPARSING set.
*/ */
HRESULT SHELL32_GetDisplayNameOfChild (IShellFolder2 * psf, HRESULT SHELL32_GetDisplayNameOfChild (IShellFolder2 * psf,
LPCITEMIDLIST pidl, DWORD dwFlags, LPSTR szOut, DWORD dwOutLen) LPCITEMIDLIST pidl, DWORD dwFlags, LPWSTR szOut, DWORD dwOutLen)
{ {
LPITEMIDLIST pidlFirst; LPITEMIDLIST pidlFirst;
HRESULT hr = E_INVALIDARG; HRESULT hr = E_INVALIDARG;
...@@ -350,7 +350,7 @@ HRESULT SHELL32_GetDisplayNameOfChild (IShellFolder2 * psf, ...@@ -350,7 +350,7 @@ HRESULT SHELL32_GetDisplayNameOfChild (IShellFolder2 * psf,
hr = IShellFolder_GetDisplayNameOf (psfChild, pidlNext, dwFlags, &strTemp); hr = IShellFolder_GetDisplayNameOf (psfChild, pidlNext, dwFlags, &strTemp);
if (SUCCEEDED (hr)) { if (SUCCEEDED (hr)) {
hr = StrRetToStrNA (szOut, dwOutLen, &strTemp, pidlNext); hr = StrRetToStrNW (szOut, dwOutLen, &strTemp, pidlNext);
} }
IShellFolder_Release (psfChild); IShellFolder_Release (psfChild);
} }
...@@ -358,7 +358,7 @@ HRESULT SHELL32_GetDisplayNameOfChild (IShellFolder2 * psf, ...@@ -358,7 +358,7 @@ HRESULT SHELL32_GetDisplayNameOfChild (IShellFolder2 * psf,
} else } else
hr = E_OUTOFMEMORY; hr = E_OUTOFMEMORY;
TRACE ("-- ret=0x%08lx %s\n", hr, szOut); TRACE ("-- ret=0x%08lx %s\n", hr, debugstr_w(szOut));
return hr; return hr;
} }
......
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