shell: Convert SHELL32_GetDisplayNameOfChild to unicode.

This commit is contained in:
Robert Shearman 2006-01-16 21:31:10 +01:00 committed by Alexandre Julliard
parent 8cfa507f31
commit 50c1e46d18
6 changed files with 51 additions and 14 deletions

View file

@ -652,7 +652,8 @@ static HRESULT WINAPI ISF_ControlPanel_fnGetDisplayNameOf(IShellFolder2 * 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;
*szPath = '\0';
@ -676,7 +677,7 @@ static HRESULT WINAPI ISF_ControlPanel_fnGetDisplayNameOf(IShellFolder2 * iface,
BOOL bSimplePidl = _ILIsPidlSimple(pidl);
if (bSimplePidl) {
_ILSimpleGetText(pidl, szPath, MAX_PATH); /* append my own path */
_ILSimpleGetTextW(pidl, wszPath, MAX_PATH); /* append my own path */
} else {
FIXME("special pidl\n");
}
@ -684,12 +685,14 @@ static HRESULT WINAPI ISF_ControlPanel_fnGetDisplayNameOf(IShellFolder2 * iface,
if ((dwFlags & SHGDN_FORPARSING) && !bSimplePidl) { /* go deeper if needed */
int len = 0;
PathAddBackslashA(szPath); /*FIXME*/
len = lstrlenA(szPath);
PathAddBackslashW(wszPath);
len = lstrlenW(wszPath);
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;
if (!WideCharToMultiByte(CP_ACP, 0, wszPath, -1, szPath, MAX_PATH, NULL, NULL))
wszPath[0] = '\0';
}
}

View file

@ -39,7 +39,7 @@ LPCWSTR GetNextElementW (LPCWSTR pszNext, LPWSTR pszOut, DWORD dwOut);
HRESULT SHELL32_ParseNextElement (IShellFolder2 * psf, HWND hwndOwner, LPBC pbc, LPITEMIDLIST * pidlInOut,
LPOLESTR szNext, DWORD * pEaten, DWORD * 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);
HRESULT SHELL32_BindToChild (LPCITEMIDLIST pidlRoot,

View file

@ -562,6 +562,7 @@ static HRESULT WINAPI ISF_Desktop_fnGetDisplayNameOf (IShellFolder2 * iface,
{
IGenericSFImpl *This = (IGenericSFImpl *)iface;
HRESULT hr = S_OK;
WCHAR wszPath[MAX_PATH];
TRACE ("(%p)->(pidl=%p,0x%08lx,%p)\n", This, pidl, dwFlags, strRet);
pdump (pidl);
@ -645,13 +646,20 @@ static HRESULT WINAPI ISF_Desktop_fnGetDisplayNameOf (IShellFolder2 * iface,
if ((GET_SHGDN_RELATION (dwFlags) == SHGDN_NORMAL) &&
bWantsForParsing)
{
WCHAR wszPath[MAX_PATH];
/*
* we need the filesystem path to the destination folder.
* Only the folder itself can know it
*/
hr = SHELL32_GetDisplayNameOfChild (iface, pidl, dwFlags,
strRet->u.cStr,
wszPath,
MAX_PATH);
if (SUCCEEDED(hr))
{
if (!WideCharToMultiByte(CP_ACP, 0, wszPath, -1, strRet->u.cStr, MAX_PATH,
NULL, NULL))
wszPath[0] = '\0';
}
}
else
{
@ -690,7 +698,13 @@ static HRESULT WINAPI ISF_Desktop_fnGetDisplayNameOf (IShellFolder2 * iface,
{
/* a complex pidl, let the subfolder do the work */
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,

View file

@ -816,7 +816,13 @@ IShellFolder_fnGetDisplayNameOf (IShellFolder2 * iface, LPCITEMIDLIST pidl,
_ILSimpleGetText(pidl, strRet->u.cStr + len, MAX_PATH - len);
if (!_ILIsFolder(pidl)) SHELL_FS_ProcessDisplayFilename(strRet->u.cStr, dwFlags);
} 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);

View file

@ -617,12 +617,19 @@ static HRESULT WINAPI ISF_MyComputer_fnGetDisplayNameOf (IShellFolder2 *iface,
if ((GET_SHGDN_RELATION (dwFlags) == SHGDN_NORMAL) &&
bWantsForParsing)
{
WCHAR wszPath[MAX_PATH];
/*
* We need the filesystem path to the destination folder
* Only the folder itself can know it
*/
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
{
@ -677,9 +684,16 @@ static HRESULT WINAPI ISF_MyComputer_fnGetDisplayNameOf (IShellFolder2 *iface,
}
else
{
WCHAR wszPath[MAX_PATH];
/* Complex pidl. Let the child folder do the work */
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))

View file

@ -331,7 +331,7 @@ HRESULT SHELL32_BindToChild (LPCITEMIDLIST pidlRoot,
* virtual folders with the registry key WantsFORPARSING set.
*/
HRESULT SHELL32_GetDisplayNameOfChild (IShellFolder2 * psf,
LPCITEMIDLIST pidl, DWORD dwFlags, LPSTR szOut, DWORD dwOutLen)
LPCITEMIDLIST pidl, DWORD dwFlags, LPWSTR szOut, DWORD dwOutLen)
{
LPITEMIDLIST pidlFirst;
HRESULT hr = E_INVALIDARG;
@ -350,7 +350,7 @@ HRESULT SHELL32_GetDisplayNameOfChild (IShellFolder2 * psf,
hr = IShellFolder_GetDisplayNameOf (psfChild, pidlNext, dwFlags, &strTemp);
if (SUCCEEDED (hr)) {
hr = StrRetToStrNA (szOut, dwOutLen, &strTemp, pidlNext);
hr = StrRetToStrNW (szOut, dwOutLen, &strTemp, pidlNext);
}
IShellFolder_Release (psfChild);
}
@ -358,7 +358,7 @@ HRESULT SHELL32_GetDisplayNameOfChild (IShellFolder2 * psf,
} else
hr = E_OUTOFMEMORY;
TRACE ("-- ret=0x%08lx %s\n", hr, szOut);
TRACE ("-- ret=0x%08lx %s\n", hr, debugstr_w(szOut));
return hr;
}