HRESULT WINAPI CRecycleBin::GetDetailsOf(PCUITEMID_CHILD pidl, UINT iColumn, LPSHELLDETAILS pDetails) { PIDLRecycleStruct * pFileDetails; WCHAR buffer[MAX_PATH]; WCHAR szTypeName[100]; LPWSTR pszBackslash; UINT Length; TRACE("(%p, %p, %d, %p)\n", this, pidl, iColumn, pDetails); if (iColumn >= COLUMNS_COUNT) return E_FAIL; pDetails->fmt = RecycleBinColumns[iColumn].fmt; pDetails->cxChar = RecycleBinColumns[iColumn].cxChars; if (pidl == NULL) return SHSetStrRet(&pDetails->str, RecycleBinColumns[iColumn].column_name_id); if (iColumn == COLUMN_NAME) return GetDisplayNameOf(pidl, SHGDN_NORMAL, &pDetails->str); pFileDetails = _ILGetRecycleStruct(pidl); switch (iColumn) { case COLUMN_DATEDEL: FormatDateTime(buffer, MAX_PATH, &pFileDetails->DeletionTime); break; case COLUMN_DELFROM: pszBackslash = wcsrchr(pFileDetails->szName, L'\\'); Length = (pszBackslash - pFileDetails->szName); memcpy((LPVOID)buffer, pFileDetails->szName, Length * sizeof(WCHAR)); buffer[Length] = L'\0'; break; case COLUMN_SIZE: StrFormatKBSizeW(pFileDetails->FileSize.QuadPart, buffer, MAX_PATH); break; case COLUMN_MTIME: FormatDateTime(buffer, MAX_PATH, &pFileDetails->LastModification); break; case COLUMN_TYPE: // FIXME: We should in fact use a UNICODE version of _ILGetFileType szTypeName[0] = L'\0'; wcscpy(buffer, PathFindExtensionW(pFileDetails->szName)); if (!( HCR_MapTypeToValueW(buffer, buffer, _countof(buffer), TRUE) && HCR_MapTypeToValueW(buffer, szTypeName, _countof(szTypeName), FALSE ))) { /* load localized file string */ szTypeName[0] = '\0'; if(LoadStringW(shell32_hInstance, IDS_ANY_FILE, szTypeName, _countof(szTypeName))) { szTypeName[63] = '\0'; StringCchPrintfW(buffer, _countof(buffer), szTypeName, PathFindExtensionW(pFileDetails->szName)); } } return SHSetStrRet(&pDetails->str, szTypeName); default: return E_FAIL; } return SHSetStrRet(&pDetails->str, buffer); }
static HRESULT WINAPI RecycleBin_GetDetailsOf(IShellFolder2 *iface, LPCITEMIDLIST pidl, UINT iColumn, LPSHELLDETAILS pDetails) { RecycleBin *This = impl_from_IShellFolder2(iface); WIN32_FIND_DATAW data; WCHAR buffer[MAX_PATH]; TRACE("(%p, %p, %d, %p)\n", This, pidl, iColumn, pDetails); if (iColumn >= COLUMNS_COUNT) return E_FAIL; pDetails->fmt = RecycleBinColumns[iColumn].fmt; pDetails->cxChar = RecycleBinColumns[iColumn].cxChars; if (pidl == NULL) { pDetails->str.uType = STRRET_WSTR; LoadStringW(shell32_hInstance, RecycleBinColumns[iColumn].column_name_id, buffer, MAX_PATH); return SHStrDupW(buffer, &pDetails->str.u.pOleStr); } if (iColumn == COLUMN_NAME) return RecycleBin_GetDisplayNameOf(iface, pidl, SHGDN_NORMAL, &pDetails->str); TRASH_UnpackItemID(&pidl->mkid, &data); switch (iColumn) { case COLUMN_DATEDEL: FormatDateTime(buffer, MAX_PATH, data.ftLastAccessTime); break; case COLUMN_DELFROM: lstrcpyW(buffer, data.cFileName); PathRemoveFileSpecW(buffer); break; case COLUMN_SIZE: StrFormatKBSizeW(((LONGLONG)data.nFileSizeHigh<<32)|data.nFileSizeLow, buffer, MAX_PATH); break; case COLUMN_MTIME: FormatDateTime(buffer, MAX_PATH, data.ftLastWriteTime); break; case COLUMN_TYPE: /* TODO */ buffer[0] = 0; break; default: return E_FAIL; } pDetails->str.uType = STRRET_WSTR; return SHStrDupW(buffer, &pDetails->str.u.pOleStr); }