Commit db8169b8 authored by Robert Shearman's avatar Robert Shearman Committed by Alexandre Julliard

shell32: Convert ISF_MyComputer_fnGetDisplayNameOf to Unicode.

parent 0da8836f
...@@ -555,7 +555,7 @@ static HRESULT WINAPI ISF_MyComputer_fnGetDisplayNameOf (IShellFolder2 *iface, ...@@ -555,7 +555,7 @@ static HRESULT WINAPI ISF_MyComputer_fnGetDisplayNameOf (IShellFolder2 *iface,
{ {
IGenericSFImpl *This = (IGenericSFImpl *)iface; IGenericSFImpl *This = (IGenericSFImpl *)iface;
char szPath[MAX_PATH]; WCHAR wszPath[MAX_PATH];
HRESULT hr = S_OK; HRESULT hr = S_OK;
TRACE ("(%p)->(pidl=%p,0x%08lx,%p)\n", This, pidl, dwFlags, strRet); TRACE ("(%p)->(pidl=%p,0x%08lx,%p)\n", This, pidl, dwFlags, strRet);
...@@ -564,13 +564,14 @@ static HRESULT WINAPI ISF_MyComputer_fnGetDisplayNameOf (IShellFolder2 *iface, ...@@ -564,13 +564,14 @@ static HRESULT WINAPI ISF_MyComputer_fnGetDisplayNameOf (IShellFolder2 *iface,
if (!strRet) if (!strRet)
return E_INVALIDARG; return E_INVALIDARG;
szPath[0] = 0x00; wszPath[0] = 0;
if (!pidl->mkid.cb) if (!pidl->mkid.cb)
{ {
/* parsing name like ::{...} */ /* parsing name like ::{...} */
lstrcpyA (szPath, "::"); wszPath[0] = ':';
SHELL32_GUIDToStringA(&CLSID_MyComputer, &szPath[2]); wszPath[1] = ':';
SHELL32_GUIDToStringW(&CLSID_MyComputer, &wszPath[2]);
} }
else if (_ILIsPidlSimple(pidl)) else if (_ILIsPidlSimple(pidl))
{ {
...@@ -617,62 +618,63 @@ static HRESULT WINAPI ISF_MyComputer_fnGetDisplayNameOf (IShellFolder2 *iface, ...@@ -617,62 +618,63 @@ 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, wszPath, 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
{ {
LPSTR p; LPWSTR p = wszPath;
/* parsing name like ::{...} */ /* parsing name like ::{...} */
p = lstrcpyA(szPath, "::") + 2; p[0] = ':';
p += SHELL32_GUIDToStringA(&CLSID_MyComputer, p); p[1] = ':';
p += 2;
lstrcatA(p, "\\::"); p += SHELL32_GUIDToStringW(&CLSID_MyComputer, p);
/* \:: */
p[0] = '\\';
p[1] = ':';
p[2] = ':';
p += 3; p += 3;
SHELL32_GUIDToStringA(clsid, p); SHELL32_GUIDToStringW(clsid, p);
} }
} }
else else
{ {
/* user friendly name */ /* user friendly name */
HCR_GetClassNameA (clsid, szPath, MAX_PATH); HCR_GetClassNameW (clsid, wszPath, MAX_PATH);
} }
} }
else else
{ {
/* append my own path */ /* append my own path */
_ILSimpleGetText (pidl, szPath, MAX_PATH); _ILSimpleGetTextW (pidl, wszPath, MAX_PATH);
} }
} }
else if (_ILIsDrive(pidl)) else if (_ILIsDrive(pidl))
{ {
_ILSimpleGetText (pidl, szPath, MAX_PATH); /* append my own path */ _ILSimpleGetTextW (pidl, wszPath, MAX_PATH); /* append my own path */
/* long view "lw_name (C:)" */ /* long view "lw_name (C:)" */
if (!(dwFlags & SHGDN_FORPARSING)) if (!(dwFlags & SHGDN_FORPARSING))
{ {
DWORD dwVolumeSerialNumber, dwMaximumComponetLength, dwFileSystemFlags; DWORD dwVolumeSerialNumber, dwMaximumComponetLength, dwFileSystemFlags;
char szDrive[18] = ""; WCHAR wszDrive[18] = {0};
static const WCHAR wszOpenBracket[] = {' ','(',0};
static const WCHAR wszCloseBracket[] = {')',0};
GetVolumeInformationA (szPath, szDrive, sizeof (szDrive) - 6, GetVolumeInformationW (wszPath, wszDrive,
sizeof(wszDrive)/sizeof(wszDrive[0]) - 6,
&dwVolumeSerialNumber, &dwVolumeSerialNumber,
&dwMaximumComponetLength, &dwFileSystemFlags, NULL, 0); &dwMaximumComponetLength, &dwFileSystemFlags, NULL, 0);
strcat (szDrive, " ("); strcatW (wszDrive, wszOpenBracket);
strncat (szDrive, szPath, 2); lstrcpynW (wszDrive + strlenW(wszDrive), wszPath, 3);
strcat (szDrive, ")"); strcatW (wszDrive, wszCloseBracket);
strcpy (szPath, szDrive); strcpyW (wszPath, wszDrive);
} }
} }
else else
...@@ -684,25 +686,19 @@ static HRESULT WINAPI ISF_MyComputer_fnGetDisplayNameOf (IShellFolder2 *iface, ...@@ -684,25 +686,19 @@ 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;
hr = SHELL32_GetDisplayNameOfChild(iface, pidl, dwFlags, wszPath, 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))
{ {
strRet->uType = STRRET_CSTR; strRet->uType = STRRET_CSTR;
lstrcpynA (strRet->u.cStr, szPath, MAX_PATH); if (!WideCharToMultiByte(CP_ACP, 0, wszPath, -1, strRet->u.cStr, MAX_PATH,
NULL, NULL))
strRet->u.cStr[0] = '\0';
} }
TRACE ("-- (%p)->(%s)\n", This, szPath); TRACE ("-- (%p)->(%s)\n", This, debugstr_w(wszPath));
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