* Restore file with SHFileOperation

svn path=/trunk/; revision=35451
This commit is contained in:
Johannes Anderwald 2008-08-19 13:14:25 +00:00
parent f1a1cc745a
commit 19ce17e295

View file

@ -472,6 +472,7 @@ RecycleBin5_RecycleBin5_Restore(
PINFO2_HEADER pHeader;
DELETED_FILE_RECORD *pRecord, *pLast;
DWORD dwEntries, i;
SHFILEOPSTRUCTW op;
TRACE("(%p, %s, %p)\n", This, debugstr_w(pDeletedFileName), pDeletedFile);
@ -496,7 +497,12 @@ RecycleBin5_RecycleBin5_Restore(
if (pRecord->dwRecordUniqueId == pDeletedFile->dwRecordUniqueId)
{
/* Restore file */
if (!MoveFileW(pDeletedFileName, pDeletedFile->FileNameW))
ZeroMemory(&op, sizeof(op));
op.wFunc = FO_COPY;
op.pFrom = pDeletedFileName;
op.pTo = pDeletedFile->FileNameW;
if (!SHFileOperationW(&op))
{
UnmapViewOfFile(pHeader);
return HRESULT_FROM_WIN32(GetLastError());