From 6058db4dbc4f0f7627bac09a49a775d1953c428c Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 9 Jan 2022 18:36:39 +0300 Subject: more thorough fix for #2992 --- plugins/PluginUpdater/pu_stub/src/pu_stub.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'plugins/PluginUpdater/pu_stub/src/pu_stub.cpp') diff --git a/plugins/PluginUpdater/pu_stub/src/pu_stub.cpp b/plugins/PluginUpdater/pu_stub/src/pu_stub.cpp index 3da0773ec8..9bdbd46177 100644 --- a/plugins/PluginUpdater/pu_stub/src/pu_stub.cpp +++ b/plugins/PluginUpdater/pu_stub/src/pu_stub.cpp @@ -102,7 +102,7 @@ int APIENTRY wWinMain(HINSTANCE /*hInstance*/, HINSTANCE, LPTSTR lpCmdLine, int) log(L"Received command: %d <%s> <%s>", dwAction, ptszFile1, ptszFile2); switch (dwAction) { case 1: // copy - if (!CopyFile(ptszFile1, ptszFile2, FALSE)) + if (!CopyFileW(ptszFile1, ptszFile2, FALSE)) dwError = GetLastError(); break; @@ -160,6 +160,19 @@ int APIENTRY wWinMain(HINSTANCE /*hInstance*/, HINSTANCE, LPTSTR lpCmdLine, int) dwError = 0; break; + case 7: + { + wchar_t tmpPath[MAX_PATH+1]; + _snwprintf_s(tmpPath, _countof(tmpPath), L"%s%c", ptszFile1, 0); + + SHFILEOPSTRUCT shfo = {}; + shfo.wFunc = FO_DELETE; + shfo.pFrom = tmpPath; + shfo.fFlags = FOF_NOCONFIRMATION | FOF_NOERRORUI | FOF_SILENT | FOF_ALLOWUNDO; + dwError = SHFileOperation(&shfo); + } + break; + default: dwError = ERROR_UNKNOWN_FEATURE; } -- cgit v1.2.3