Fixed MyComputer's GetDisplayNameOf method.

This commit is contained in:
Michael Jung 2005-05-05 10:30:39 +00:00 committed by Alexandre Julliard
parent a9d42f44c1
commit ddc26aa94e

View File

@ -535,9 +535,7 @@ static HRESULT WINAPI ISF_MyComputer_fnGetDisplayNameOf (IShellFolder2 *iface,
{ {
IGenericSFImpl *This = (IGenericSFImpl *)iface; IGenericSFImpl *This = (IGenericSFImpl *)iface;
char szPath[MAX_PATH], szDrive[18]; char szPath[MAX_PATH];
int len = 0;
BOOL bSimplePidl;
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);
@ -547,9 +545,6 @@ static HRESULT WINAPI ISF_MyComputer_fnGetDisplayNameOf (IShellFolder2 *iface,
return E_INVALIDARG; return E_INVALIDARG;
szPath[0] = 0x00; szPath[0] = 0x00;
szDrive[0] = 0x00;
bSimplePidl = _ILIsPidlSimple (pidl);
if (!pidl->mkid.cb) if (!pidl->mkid.cb)
{ {
@ -557,10 +552,10 @@ static HRESULT WINAPI ISF_MyComputer_fnGetDisplayNameOf (IShellFolder2 *iface,
lstrcpyA (szPath, "::"); lstrcpyA (szPath, "::");
SHELL32_GUIDToStringA(&CLSID_MyComputer, &szPath[2]); SHELL32_GUIDToStringA(&CLSID_MyComputer, &szPath[2]);
} }
else if (_ILIsSpecialFolder (pidl)) else if (_ILIsPidlSimple(pidl))
{ {
/* take names of special folders only if its only this folder */ /* take names of special folders only if its only this folder */
if (bSimplePidl) if (_ILIsSpecialFolder(pidl))
{ {
GUID const *clsid; GUID const *clsid;
@ -634,23 +629,15 @@ static HRESULT WINAPI ISF_MyComputer_fnGetDisplayNameOf (IShellFolder2 *iface,
_ILSimpleGetText (pidl, szPath, MAX_PATH); _ILSimpleGetText (pidl, szPath, MAX_PATH);
} }
} }
else else if (_ILIsDrive(pidl))
FIXME ("special folder\n");
}
else
{ {
if (!_ILIsDrive (pidl))
{
ERR ("Wrong pidl type\n");
return E_INVALIDARG;
}
_ILSimpleGetText (pidl, szPath, MAX_PATH); /* append my own path */ _ILSimpleGetText (pidl, szPath, MAX_PATH); /* append my own path */
/* long view "lw_name (C:)" */ /* long view "lw_name (C:)" */
if (bSimplePidl && !(dwFlags & SHGDN_FORPARSING)) if (!(dwFlags & SHGDN_FORPARSING))
{ {
DWORD dwVolumeSerialNumber, dwMaximumComponetLength, dwFileSystemFlags; DWORD dwVolumeSerialNumber, dwMaximumComponetLength, dwFileSystemFlags;
char szDrive[18] = "";
GetVolumeInformationA (szPath, szDrive, sizeof (szDrive) - 6, GetVolumeInformationA (szPath, szDrive, sizeof (szDrive) - 6,
&dwVolumeSerialNumber, &dwVolumeSerialNumber,
@ -661,15 +648,18 @@ static HRESULT WINAPI ISF_MyComputer_fnGetDisplayNameOf (IShellFolder2 *iface,
strcpy (szPath, szDrive); strcpy (szPath, szDrive);
} }
} }
else
if (!bSimplePidl)
{ {
/* go deeper if needed */ /* Neither a shell namespace extension nor a drive letter. */
PathAddBackslashA (szPath); ERR("Wrong pidl type\n");
len = strlen (szPath); return E_INVALIDARG;
}
hr = SHELL32_GetDisplayNameOfChild (iface, pidl, }
dwFlags | SHGDN_INFOLDER, szPath + len, MAX_PATH - len); else
{
/* Complex pidl. Let the child folder do the work */
strRet->uType = STRRET_CSTR;
hr = SHELL32_GetDisplayNameOfChild(iface, pidl, dwFlags, szPath, MAX_PATH);
} }
if (SUCCEEDED (hr)) if (SUCCEEDED (hr))