https://git.reactos.org/?p=reactos.git;a=commitdiff;h=7e3a7a0e84bb8cdff4ad32cbd1a26d026ae2db1f

commit 7e3a7a0e84bb8cdff4ad32cbd1a26d026ae2db1f
Author:     Stanislav Motylkov <[email protected]>
AuthorDate: Wed Oct 6 01:04:50 2021 +0300
Commit:     Stanislav Motylkov <[email protected]>
CommitDate: Thu Oct 7 14:54:47 2021 +0300

    [ZIPFLDR] Show error when compression method is not supported
    
    CORE-17255
---
 dll/shellext/zipfldr/CZipExtract.cpp | 23 ++++++++++++++++++++---
 dll/shellext/zipfldr/lang/de-DE.rc   |  1 +
 dll/shellext/zipfldr/lang/en-US.rc   |  1 +
 dll/shellext/zipfldr/lang/et-EE.rc   |  1 +
 dll/shellext/zipfldr/lang/fr-FR.rc   |  1 +
 dll/shellext/zipfldr/lang/hi-IN.rc   |  1 +
 dll/shellext/zipfldr/lang/it-IT.rc   |  1 +
 dll/shellext/zipfldr/lang/ja-JP.rc   |  1 +
 dll/shellext/zipfldr/lang/pl-PL.rc   |  1 +
 dll/shellext/zipfldr/lang/pt-PT.rc   |  1 +
 dll/shellext/zipfldr/lang/ro-RO.rc   |  1 +
 dll/shellext/zipfldr/lang/ru-RU.rc   |  1 +
 dll/shellext/zipfldr/lang/sv-SE.rc   |  1 +
 dll/shellext/zipfldr/lang/zh-CN.rc   |  1 +
 dll/shellext/zipfldr/lang/zh-TW.rc   |  1 +
 dll/shellext/zipfldr/resource.h      |  3 ++-
 16 files changed, 36 insertions(+), 4 deletions(-)

diff --git a/dll/shellext/zipfldr/CZipExtract.cpp 
b/dll/shellext/zipfldr/CZipExtract.cpp
index 47be6caa5df..8f9381e9f83 100644
--- a/dll/shellext/zipfldr/CZipExtract.cpp
+++ b/dll/shellext/zipfldr/CZipExtract.cpp
@@ -590,7 +590,6 @@ public:
                     break;
 
                 case eExtractAbort:
-                case eOpenError:
                 case eUnpackError:
                 {
                     Close();
@@ -627,6 +626,20 @@ public:
                     }
                     break;
                 }
+
+                case eOpenError:
+                {
+                    if (err == UNZ_BADZIPFILE &&
+                        Info.compression_method != 0 &&
+                        Info.compression_method != Z_DEFLATED &&
+                        Info.compression_method != Z_BZIP2ED)
+                    {
+                        if (ShowExtractError(hDlg, FullPath, 
Info.compression_method, eOpenError) == IDYES)
+                            break;
+                    }
+                    Close();
+                    return false;
+                }
             }
             if (Result == eNoError && is_dir)
                 continue;
@@ -643,7 +656,7 @@ public:
         CStringA strErr, strText;
         PSTR Win32ErrorString;
 
-        if (ErrorType == eFileError)
+        if (ErrorType == eFileError || ErrorType == eOpenError)
             strText.LoadString(IDS_CANTEXTRACTFILE);
         else
             strText.LoadString(GetModuleHandleA("shell32.dll"), 128); // 
IDS_CREATEFOLDER_DENIED
@@ -660,7 +673,9 @@ public:
                 LocalFree(Win32ErrorString);
             }
         }
-        if (strErr.GetLength() == 0)
+        if (ErrorType == eOpenError)
+            strErr.Format(IDS_DECOMPRESSERROR, Error);
+        else if (strErr.GetLength() == 0)
             strErr.Format(IDS_UNKNOWNERROR, Error);
 
         strText.Append("\r\n\r\n" + strErr);
@@ -670,6 +685,8 @@ public:
             mbFlags |= MB_RETRYCANCEL;
         else if (ErrorType == eFileError)
             mbFlags |= MB_ABORTRETRYIGNORE;
+        else if (ErrorType == eOpenError)
+            mbFlags |= MB_YESNO;
 
         return MessageBoxA(hDlg, strText, strTitle, mbFlags);
     }
diff --git a/dll/shellext/zipfldr/lang/de-DE.rc 
b/dll/shellext/zipfldr/lang/de-DE.rc
index 19bb69ad39b..50f7cc681f7 100644
--- a/dll/shellext/zipfldr/lang/de-DE.rc
+++ b/dll/shellext/zipfldr/lang/de-DE.rc
@@ -77,6 +77,7 @@ BEGIN
     IDS_CANTREADFILE "Datei '%s' konnte nicht gelesen werden."
     IDS_EXTRACTING "Extrahieren..."
     IDS_CANTEXTRACTFILE "Datei '%1' konnte nicht extrahiert werden."
+    IDS_DECOMPRESSERROR "Unsupported compression method %d. Do you want to 
continue?"
     IDS_UNKNOWNERROR "Unbekannter Fehler 0x%08x."
 
     IDS_WIZ_TITLE "Extrahier-Assistent"
diff --git a/dll/shellext/zipfldr/lang/en-US.rc 
b/dll/shellext/zipfldr/lang/en-US.rc
index e885f59a3f3..85286aa3a66 100644
--- a/dll/shellext/zipfldr/lang/en-US.rc
+++ b/dll/shellext/zipfldr/lang/en-US.rc
@@ -77,6 +77,7 @@ BEGIN
     IDS_CANTREADFILE "Cannot read file '%s'."
     IDS_EXTRACTING "Extracting..."
     IDS_CANTEXTRACTFILE "Cannot extract file '%1'."
+    IDS_DECOMPRESSERROR "Unsupported compression method %d. Do you want to 
continue?"
     IDS_UNKNOWNERROR "Unknown error 0x%08x."
 
     IDS_WIZ_TITLE "Extraction Wizard"
diff --git a/dll/shellext/zipfldr/lang/et-EE.rc 
b/dll/shellext/zipfldr/lang/et-EE.rc
index 61bd7947e67..b36d05b7f71 100644
--- a/dll/shellext/zipfldr/lang/et-EE.rc
+++ b/dll/shellext/zipfldr/lang/et-EE.rc
@@ -77,6 +77,7 @@ BEGIN
     IDS_CANTREADFILE "Cannot read file '%s'."
     IDS_EXTRACTING "Ekstraktimine..."
     IDS_CANTEXTRACTFILE "Cannot extract file '%1'."
+    IDS_DECOMPRESSERROR "Unsupported compression method %d. Do you want to 
continue?"
     IDS_UNKNOWNERROR "Unknown error 0x%08x."
 
     IDS_WIZ_TITLE "Ekstraktimise visard"
diff --git a/dll/shellext/zipfldr/lang/fr-FR.rc 
b/dll/shellext/zipfldr/lang/fr-FR.rc
index 217dca2d08b..9b47d0c7147 100644
--- a/dll/shellext/zipfldr/lang/fr-FR.rc
+++ b/dll/shellext/zipfldr/lang/fr-FR.rc
@@ -77,6 +77,7 @@ BEGIN
     IDS_CANTREADFILE "Cannot read file '%s'."
     IDS_EXTRACTING "Extraction..."
     IDS_CANTEXTRACTFILE "Cannot extract file '%1'."
+    IDS_DECOMPRESSERROR "Unsupported compression method %d. Do you want to 
continue?"
     IDS_UNKNOWNERROR "Unknown error 0x%08x."
 
     IDS_WIZ_TITLE "Assistant d'extraction"
diff --git a/dll/shellext/zipfldr/lang/hi-IN.rc 
b/dll/shellext/zipfldr/lang/hi-IN.rc
index 9b972305b39..1c7f17c7e69 100644
--- a/dll/shellext/zipfldr/lang/hi-IN.rc
+++ b/dll/shellext/zipfldr/lang/hi-IN.rc
@@ -64,6 +64,7 @@ BEGIN
     IDS_CANTREADFILE "Cannot read file '%s'."
     IDS_EXTRACTING "Extracting..."
     IDS_CANTEXTRACTFILE "Cannot extract file '%1'."
+    IDS_DECOMPRESSERROR "Unsupported compression method %d. Do you want to 
continue?"
     IDS_UNKNOWNERROR "Unknown error 0x%08x."
 
     IDS_WIZ_TITLE "निष्कर्षण विज़ार्ड"
diff --git a/dll/shellext/zipfldr/lang/it-IT.rc 
b/dll/shellext/zipfldr/lang/it-IT.rc
index 6b75ce72126..a3ebbf1b386 100644
--- a/dll/shellext/zipfldr/lang/it-IT.rc
+++ b/dll/shellext/zipfldr/lang/it-IT.rc
@@ -77,6 +77,7 @@ BEGIN
     IDS_CANTREADFILE "Cannot read file '%s'."
     IDS_EXTRACTING "Estrazione..."
     IDS_CANTEXTRACTFILE "Cannot extract file '%1'."
+    IDS_DECOMPRESSERROR "Unsupported compression method %d. Do you want to 
continue?"
     IDS_UNKNOWNERROR "Unknown error 0x%08x."
 
     IDS_WIZ_TITLE "Estrazione Guidata"
diff --git a/dll/shellext/zipfldr/lang/ja-JP.rc 
b/dll/shellext/zipfldr/lang/ja-JP.rc
index 8132f95d611..072a4937160 100644
--- a/dll/shellext/zipfldr/lang/ja-JP.rc
+++ b/dll/shellext/zipfldr/lang/ja-JP.rc
@@ -77,6 +77,7 @@ BEGIN
     IDS_CANTREADFILE "ファイル '%s' が読めません。"
     IDS_EXTRACTING "展開中..."
     IDS_CANTEXTRACTFILE "Cannot extract file '%1'."
+    IDS_DECOMPRESSERROR "Unsupported compression method %d. Do you want to 
continue?"
     IDS_UNKNOWNERROR "Unknown error 0x%08x."
 
     IDS_WIZ_TITLE "展開ウィザード"
diff --git a/dll/shellext/zipfldr/lang/pl-PL.rc 
b/dll/shellext/zipfldr/lang/pl-PL.rc
index 166312bb90a..a9ef3c0a94a 100644
--- a/dll/shellext/zipfldr/lang/pl-PL.rc
+++ b/dll/shellext/zipfldr/lang/pl-PL.rc
@@ -78,6 +78,7 @@ BEGIN
     IDS_CANTREADFILE "Błąd podczas czytania pliku '%s'."
     IDS_EXTRACTING "Trwa wyodrębnianie..."
     IDS_CANTEXTRACTFILE "Cannot extract file '%1'."
+    IDS_DECOMPRESSERROR "Unsupported compression method %d. Do you want to 
continue?"
     IDS_UNKNOWNERROR "Unknown error 0x%08x."
 
     IDS_WIZ_TITLE "Kreator wyodrębniania"
diff --git a/dll/shellext/zipfldr/lang/pt-PT.rc 
b/dll/shellext/zipfldr/lang/pt-PT.rc
index 53bd82c5e7e..c43183dff83 100644
--- a/dll/shellext/zipfldr/lang/pt-PT.rc
+++ b/dll/shellext/zipfldr/lang/pt-PT.rc
@@ -77,6 +77,7 @@ BEGIN
     IDS_CANTREADFILE "Não é possível ler o arquivo '%s'."
     IDS_EXTRACTING "A extrair..."
     IDS_CANTEXTRACTFILE "Cannot extract file '%1'."
+    IDS_DECOMPRESSERROR "Unsupported compression method %d. Do you want to 
continue?"
     IDS_UNKNOWNERROR "Unknown error 0x%08x."
 
     IDS_WIZ_TITLE "Assistente de extração"
diff --git a/dll/shellext/zipfldr/lang/ro-RO.rc 
b/dll/shellext/zipfldr/lang/ro-RO.rc
index 021bf033732..ab05fc60e1f 100644
--- a/dll/shellext/zipfldr/lang/ro-RO.rc
+++ b/dll/shellext/zipfldr/lang/ro-RO.rc
@@ -77,6 +77,7 @@ BEGIN
     IDS_CANTREADFILE "Cannot read file '%s'."
     IDS_EXTRACTING "Extragere..."
     IDS_CANTEXTRACTFILE "Cannot extract file '%1'."
+    IDS_DECOMPRESSERROR "Unsupported compression method %d. Do you want to 
continue?"
     IDS_UNKNOWNERROR "Unknown error 0x%08x."
 
     IDS_WIZ_TITLE "Asistent de extracție"
diff --git a/dll/shellext/zipfldr/lang/ru-RU.rc 
b/dll/shellext/zipfldr/lang/ru-RU.rc
index e8b9c21b046..adfd8416be2 100644
--- a/dll/shellext/zipfldr/lang/ru-RU.rc
+++ b/dll/shellext/zipfldr/lang/ru-RU.rc
@@ -77,6 +77,7 @@ BEGIN
     IDS_CANTREADFILE "Не удалось прочитать файл '%s'."
     IDS_EXTRACTING "Извлечение..."
     IDS_CANTEXTRACTFILE "Не удалось извлечь файл '%1'."
+    IDS_DECOMPRESSERROR "Неизвестный метод компрессии %d. Продолжить?"
     IDS_UNKNOWNERROR "Неизвестная ошибка 0x%08x."
 
     IDS_WIZ_TITLE "Мастер извлечения архивов"
diff --git a/dll/shellext/zipfldr/lang/sv-SE.rc 
b/dll/shellext/zipfldr/lang/sv-SE.rc
index 90d2676e9a5..e5da27b41a7 100644
--- a/dll/shellext/zipfldr/lang/sv-SE.rc
+++ b/dll/shellext/zipfldr/lang/sv-SE.rc
@@ -77,6 +77,7 @@ BEGIN
     IDS_CANTREADFILE "Cannot read file '%s'."
     IDS_EXTRACTING "Extraherar..."
     IDS_CANTEXTRACTFILE "Cannot extract file '%1'."
+    IDS_DECOMPRESSERROR "Unsupported compression method %d. Do you want to 
continue?"
     IDS_UNKNOWNERROR "Unknown error 0x%08x."
 
     IDS_WIZ_TITLE "Extraheringsguiden"
diff --git a/dll/shellext/zipfldr/lang/zh-CN.rc 
b/dll/shellext/zipfldr/lang/zh-CN.rc
index f899a8e218b..3cc125f21b6 100644
--- a/dll/shellext/zipfldr/lang/zh-CN.rc
+++ b/dll/shellext/zipfldr/lang/zh-CN.rc
@@ -77,6 +77,7 @@ BEGIN
     IDS_CANTREADFILE "Cannot read file '%s'."
     IDS_EXTRACTING "正在解压..."
     IDS_CANTEXTRACTFILE "Cannot extract file '%1'."
+    IDS_DECOMPRESSERROR "Unsupported compression method %d. Do you want to 
continue?"
     IDS_UNKNOWNERROR "Unknown error 0x%08x."
 
     IDS_WIZ_TITLE "解压向导"
diff --git a/dll/shellext/zipfldr/lang/zh-TW.rc 
b/dll/shellext/zipfldr/lang/zh-TW.rc
index c982d9a64c9..b2183286c27 100644
--- a/dll/shellext/zipfldr/lang/zh-TW.rc
+++ b/dll/shellext/zipfldr/lang/zh-TW.rc
@@ -80,6 +80,7 @@ BEGIN
     IDS_CANTREADFILE "無法讀取檔案 '%s'."
     IDS_EXTRACTING "正在解壓縮..."
     IDS_CANTEXTRACTFILE "Cannot extract file '%1'."
+    IDS_DECOMPRESSERROR "Unsupported compression method %d. Do you want to 
continue?"
     IDS_UNKNOWNERROR "Unknown error 0x%08x."
 
     IDS_WIZ_TITLE "解壓縮精靈"
diff --git a/dll/shellext/zipfldr/resource.h b/dll/shellext/zipfldr/resource.h
index c7e021c63f4..7a9566e1f47 100644
--- a/dll/shellext/zipfldr/resource.h
+++ b/dll/shellext/zipfldr/resource.h
@@ -48,7 +48,8 @@
 #define IDS_CANTREADFILE    113
 #define IDS_EXTRACTING      114
 #define IDS_CANTEXTRACTFILE 115
-#define IDS_UNKNOWNERROR    116
+#define IDS_DECOMPRESSERROR 116
+#define IDS_UNKNOWNERROR    117
 
 /* Wizard titles */
 #define IDS_WIZ_TITLE           8000

Reply via email to