From 7c07d4e6578b0eab6de015ab7c1126e2f8fa4a13 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 21 May 2025 11:35:33 +0300 Subject: more logs for Plugin Updater --- plugins/PluginUpdater/src/unzipfile.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'plugins/PluginUpdater/src/unzipfile.cpp') diff --git a/plugins/PluginUpdater/src/unzipfile.cpp b/plugins/PluginUpdater/src/unzipfile.cpp index 56457b07ee..2252f2ae9b 100644 --- a/plugins/PluginUpdater/src/unzipfile.cpp +++ b/plugins/PluginUpdater/src/unzipfile.cpp @@ -70,8 +70,10 @@ int extractCurrentFile(unzFile uf, wchar_t *pwszDestPath, wchar_t *pwszBackPath, mir_ptr buf((char *)mir_alloc(DATA_BUF_SIZE+1)); int err = unzGetCurrentFileInfo64(uf, &file_info, filename, sizeof(filename), buf, DATA_BUF_SIZE, nullptr, 0); - if (err != UNZ_OK) + if (err != UNZ_OK) { + Netlib_LogfW(g_hNetlibUser, L"Error retrieving file info %S: %d", filename, err); return err; + } for (char *p = strchr(filename, '/'); p; p = strchr(p + 1, '/')) *p = '\\'; @@ -111,9 +113,12 @@ int extractCurrentFile(unzFile uf, wchar_t *pwszDestPath, wchar_t *pwszBackPath, pwszFile2unzip = wszBackFile; } - HANDLE hFile = CreateFile(pwszFile2unzip, GENERIC_WRITE, FILE_SHARE_WRITE, nullptr, CREATE_ALWAYS, file_info.external_fa, nullptr); - if (hFile == INVALID_HANDLE_VALUE) - return GetLastError(); + HANDLE hFile = CreateFileW(pwszFile2unzip, GENERIC_WRITE, FILE_SHARE_WRITE, nullptr, CREATE_ALWAYS, file_info.external_fa, nullptr); + if (hFile == INVALID_HANDLE_VALUE) { + err = GetLastError(); + Netlib_LogfW(g_hNetlibUser, L"Error creating file %s: %d", pwszFile2unzip, err); + return err; + } while (true) { err = unzReadCurrentFile(uf, buf, DATA_BUF_SIZE); @@ -123,6 +128,7 @@ int extractCurrentFile(unzFile uf, wchar_t *pwszDestPath, wchar_t *pwszBackPath, DWORD bytes; if (!WriteFile(hFile, buf, err, &bytes, FALSE)) { err = GetLastError(); + Netlib_LogfW(g_hNetlibUser, L"Error writing file %s: %d", pwszFile2unzip, err); break; } } -- cgit v1.2.3