mirror of
https://github.com/reactos/reactos.git
synced 2024-12-29 10:35:28 +00:00
[SHELL32] Fix recycle bin handle reference leaking (#4222)
CORE-13730 There was a handle reference leak in the recycler bin and the bin wasn't removing the copied file after restoring it. Close the handle were the memory leak was and move the file when restoring it.
This commit is contained in:
parent
3456538e3a
commit
dae6035b3b
2 changed files with 12 additions and 13 deletions
|
@ -380,19 +380,18 @@ HRESULT WINAPI CRecycleBinItemContextMenu::InvokeCommand(LPCMINVOKECOMMANDINFO l
|
|||
if (!Context.bFound)
|
||||
return E_FAIL;
|
||||
|
||||
if (lpcmi->lpVerb == MAKEINTRESOURCEA(1))
|
||||
{
|
||||
/* restore file */
|
||||
if (RestoreFile(Context.hDeletedFile))
|
||||
return S_OK;
|
||||
else
|
||||
return E_FAIL;
|
||||
}
|
||||
BOOL ret = TRUE;
|
||||
|
||||
/* restore file */
|
||||
if (lpcmi->lpVerb == MAKEINTRESOURCEA(1))
|
||||
ret = RestoreFile(Context.hDeletedFile);
|
||||
/* delete file */
|
||||
else
|
||||
{
|
||||
DeleteFileHandleToRecycleBin(Context.hDeletedFile);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
CloseRecycleBinHandle(Context.hDeletedFile);
|
||||
|
||||
return (ret ? S_OK : E_FAIL);
|
||||
}
|
||||
else if (lpcmi->lpVerb == MAKEINTRESOURCEA(3))
|
||||
{
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* LICENSE: GPL v2 - See COPYING in the top level directory
|
||||
* FILE: lib/recyclebin/recyclebin_v5.c
|
||||
* PURPOSE: Deals with recycle bins of Windows 2000/XP/2003
|
||||
* PROGRAMMERS: Copyright 2006-2007 Hervé Poussineau (hpoussin@reactos.org)
|
||||
* PROGRAMMERS: Copyright 2006-2007 Hervé Poussineau (hpoussin@reactos.org)
|
||||
*/
|
||||
|
||||
#include "recyclebin_private.h"
|
||||
|
@ -500,7 +500,7 @@ RecycleBin5_RecycleBin5_Restore(
|
|||
{
|
||||
/* Restore file */
|
||||
ZeroMemory(&op, sizeof(op));
|
||||
op.wFunc = FO_COPY;
|
||||
op.wFunc = FO_MOVE;
|
||||
op.pFrom = pDeletedFileName;
|
||||
op.pTo = pDeletedFile->FileNameW;
|
||||
|
||||
|
|
Loading…
Reference in a new issue