https://git.reactos.org/?p=reactos.git;a=commitdiff;h=e7f6b473e6b2fb28efac4…
commit e7f6b473e6b2fb28efac42ee9cabb21db9171a73
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Fri Dec 8 15:30:55 2023 +0900
Commit: GitHub <noreply(a)github.com>
CommitDate: Fri Dec 8 15:30:55 2023 +0900
[SHIMGVW] Implement ImageView_Delete (#6132)
- Call SHFileOperation to delete.
- Rebuild the file list and load the
next file.
CORE-19358
---
dll/win32/shimgvw/shimgvw.c | 31 +++++++++++++++++++++++++++++--
1 file changed, 29 insertions(+), 2 deletions(-)
diff --git a/dll/win32/shimgvw/shimgvw.c b/dll/win32/shimgvw/shimgvw.c
index 800f60d20d5..613cb250023 100644
--- a/dll/win32/shimgvw/shimgvw.c
+++ b/dll/win32/shimgvw/shimgvw.c
@@ -989,8 +989,35 @@ ImageView_OnSize(HWND hwnd, UINT state, INT cx, INT cy)
static LRESULT
ImageView_Delete(HWND hwnd)
{
- DPRINT1("ImageView_Delete: unimplemented.\n");
- return 0;
+ WCHAR szCurFile[MAX_PATH + 1], szNextFile[MAX_PATH];
+ SHFILEOPSTRUCT FileOp = { hwnd, FO_DELETE };
+
+ if (image)
+ {
+ GdipDisposeImage(image);
+ image = NULL;
+ }
+
+ /* FileOp.pFrom must be double-null-terminated */
+ GetFullPathNameW(currentFile->FileName, _countof(szCurFile) - 1, szCurFile,
NULL);
+ szCurFile[_countof(szCurFile) - 2] = UNICODE_NULL; /* Avoid buffer overrun */
+ szCurFile[lstrlenW(szCurFile) + 1] = UNICODE_NULL;
+
+ GetFullPathNameW(currentFile->Next->FileName, _countof(szNextFile), szNextFile,
NULL);
+ szNextFile[_countof(szNextFile) - 1] = UNICODE_NULL; /* Avoid buffer overrun */
+
+ FileOp.pFrom = szCurFile;
+ FileOp.fFlags = FOF_ALLOWUNDO;
+ if (SHFileOperation(&FileOp) != 0)
+ return 0;
+
+ pFreeFileList(currentFile);
+ currentFile = NULL;
+
+ currentFile = pBuildFileList(szNextFile);
+ pLoadImageFromNode(currentFile, hwnd);
+
+ return 1;
}
static LRESULT