mirror of
https://github.com/reactos/reactos.git
synced 2025-05-23 11:04:52 +00:00
* Restore file with SHFileOperation
svn path=/trunk/; revision=35451
This commit is contained in:
parent
f1a1cc745a
commit
19ce17e295
1 changed files with 7 additions and 1 deletions
|
@ -472,6 +472,7 @@ RecycleBin5_RecycleBin5_Restore(
|
||||||
PINFO2_HEADER pHeader;
|
PINFO2_HEADER pHeader;
|
||||||
DELETED_FILE_RECORD *pRecord, *pLast;
|
DELETED_FILE_RECORD *pRecord, *pLast;
|
||||||
DWORD dwEntries, i;
|
DWORD dwEntries, i;
|
||||||
|
SHFILEOPSTRUCTW op;
|
||||||
|
|
||||||
TRACE("(%p, %s, %p)\n", This, debugstr_w(pDeletedFileName), pDeletedFile);
|
TRACE("(%p, %s, %p)\n", This, debugstr_w(pDeletedFileName), pDeletedFile);
|
||||||
|
|
||||||
|
@ -496,7 +497,12 @@ RecycleBin5_RecycleBin5_Restore(
|
||||||
if (pRecord->dwRecordUniqueId == pDeletedFile->dwRecordUniqueId)
|
if (pRecord->dwRecordUniqueId == pDeletedFile->dwRecordUniqueId)
|
||||||
{
|
{
|
||||||
/* Restore file */
|
/* 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);
|
UnmapViewOfFile(pHeader);
|
||||||
return HRESULT_FROM_WIN32(GetLastError());
|
return HRESULT_FROM_WIN32(GetLastError());
|
||||||
|
|
Loading…
Reference in a new issue