mirror of
https://github.com/reactos/reactos.git
synced 2024-11-23 11:33:31 +08:00
[SHELL32] Make Recycle Bin PIDL data handling more robust (#7328)
This commit is contained in:
parent
08a6834075
commit
abf3bde91b
@ -750,15 +750,20 @@ HRESULT WINAPI CRecycleBin::GetDetailsOf(PCUITEMID_CHILD pidl, UINT iColumn, LPS
|
||||
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->fmt = RecycleBinColumns[iColumn].fmt;
|
||||
pDetails->cxChar = RecycleBinColumns[iColumn].cxChars;
|
||||
return SHSetStrRet(&pDetails->str, RecycleBinColumns[iColumn].column_name_id);
|
||||
}
|
||||
|
||||
if (iColumn == COLUMN_NAME)
|
||||
return GetDisplayNameOf(pidl, SHGDN_NORMAL, &pDetails->str);
|
||||
|
||||
pFileDetails = _ILGetRecycleStruct(pidl);
|
||||
if (!pFileDetails && FAILED_UNEXPECTEDLY(E_INVALIDARG))
|
||||
return E_INVALIDARG;
|
||||
switch (iColumn)
|
||||
{
|
||||
case COLUMN_DATEDEL:
|
||||
@ -766,8 +771,16 @@ HRESULT WINAPI CRecycleBin::GetDetailsOf(PCUITEMID_CHILD pidl, UINT iColumn, LPS
|
||||
break;
|
||||
case COLUMN_DELFROM:
|
||||
pszBackslash = wcsrchr(pFileDetails->szName, L'\\');
|
||||
Length = (pszBackslash - pFileDetails->szName);
|
||||
memcpy((LPVOID)buffer, pFileDetails->szName, Length * sizeof(WCHAR));
|
||||
if (!pszBackslash)
|
||||
{
|
||||
ERR("Filename '%ls' not a valid path?\n", pFileDetails->szName);
|
||||
Length = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
Length = (pszBackslash - pFileDetails->szName);
|
||||
memcpy((LPVOID)buffer, pFileDetails->szName, Length * sizeof(WCHAR));
|
||||
}
|
||||
buffer[Length] = UNICODE_NULL;
|
||||
if (buffer[0] && buffer[1] == L':' && !buffer[2])
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user