https://git.reactos.org/?p=reactos.git;a=commitdiff;h=08deb1d9de834a46f70d8…
commit 08deb1d9de834a46f70d8c0848098ff741cf38d9
Author: Mark Jansen <mark.jansen(a)reactos.org>
AuthorDate: Wed Feb 27 22:18:52 2019 +0100
Commit: Mark Jansen <mark.jansen(a)reactos.org>
CommitDate: Wed Mar 6 23:09:35 2019 +0100
[ZIPFLDR] Allow the shell extension to extract passworded zip files
---
dll/shellext/zipfldr/CMakeLists.txt | 1 +
dll/shellext/zipfldr/CZipExtract.cpp | 63 +++++++++++++++++++++---
dll/shellext/zipfldr/CZipPassword.cpp | 91 +++++++++++++++++++++++++++++++++++
dll/shellext/zipfldr/lang/de-DE.rc | 17 ++++++-
dll/shellext/zipfldr/lang/en-US.rc | 19 +++++++-
dll/shellext/zipfldr/lang/et-EE.rc | 17 ++++++-
dll/shellext/zipfldr/lang/fr-FR.rc | 17 ++++++-
dll/shellext/zipfldr/lang/it-IT.rc | 17 ++++++-
dll/shellext/zipfldr/lang/ja-JP.rc | 17 ++++++-
dll/shellext/zipfldr/lang/pl-PL.rc | 17 ++++++-
dll/shellext/zipfldr/lang/ro-RO.rc | 15 ++++++
dll/shellext/zipfldr/lang/ru-RU.rc | 19 +++++++-
dll/shellext/zipfldr/lang/sv-SE.rc | 17 ++++++-
dll/shellext/zipfldr/lang/zh-CN.rc | 17 ++++++-
dll/shellext/zipfldr/precomp.h | 21 ++++++++
dll/shellext/zipfldr/resource.h | 5 ++
dll/shellext/zipfldr/zippidl.cpp | 4 +-
17 files changed, 352 insertions(+), 22 deletions(-)
diff --git a/dll/shellext/zipfldr/CMakeLists.txt b/dll/shellext/zipfldr/CMakeLists.txt
index 86a1b9c289..f527665805 100644
--- a/dll/shellext/zipfldr/CMakeLists.txt
+++ b/dll/shellext/zipfldr/CMakeLists.txt
@@ -31,6 +31,7 @@ list(APPEND SOURCE
CZipEnumerator.hpp
CZipExtract.cpp
CZipFolder.hpp
+ CZipPassword.cpp
Debug.cpp
zipfldr.spec
precomp.h
diff --git a/dll/shellext/zipfldr/CZipExtract.cpp b/dll/shellext/zipfldr/CZipExtract.cpp
index a95f8ba108..d3b3756f34 100644
--- a/dll/shellext/zipfldr/CZipExtract.cpp
+++ b/dll/shellext/zipfldr/CZipExtract.cpp
@@ -2,7 +2,7 @@
* PROJECT: ReactOS Zip Shell Extension
* LICENSE: GPL-2.0+ (
https://spdx.org/licenses/GPL-2.0+)
* PURPOSE: Zip extraction
- * COPYRIGHT: Copyright 2017 Mark Jansen (mark.jansen(a)reactos.org)
+ * COPYRIGHT: Copyright 2017-2019 Mark Jansen (mark.jansen(a)reactos.org)
*/
#include "precomp.h"
@@ -12,6 +12,7 @@ class CZipExtract :
{
CStringW m_Filename;
CStringW m_Directory;
+ CStringA m_Password;
bool m_DirectoryChanged;
unzFile uf;
public:
@@ -70,11 +71,13 @@ public:
{
private:
CZipExtract* m_pExtract;
+ CStringA* m_pPassword;
public:
- CExtractSettingsPage(CZipExtract* extract)
+ CExtractSettingsPage(CZipExtract* extract, CStringA* password)
:CPropertyPageImpl<CExtractSettingsPage>(MAKEINTRESOURCE(IDS_WIZ_TITLE))
,m_pExtract(extract)
+ ,m_pPassword(password)
{
m_psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_WIZ_DEST_TITLE);
m_psp.pszHeaderSubTitle = MAKEINTRESOURCE(IDS_WIZ_DEST_SUBTITLE);
@@ -85,7 +88,6 @@ public:
{
SetDlgItemTextW(IDC_DIRECTORY, m_pExtract->m_Directory);
m_pExtract->m_DirectoryChanged = false;
- ::EnableWindow(GetDlgItem(IDC_PASSWORD), FALSE); /* Not supported for now
*/
GetParent().CenterWindow(::GetDesktopWindow());
SetWizardButtons(PSWIZB_NEXT);
return 0;
@@ -108,7 +110,7 @@ public:
::EnableWindow(GetDlgItem(IDC_BROWSE), TRUE);
::EnableWindow(GetDlgItem(IDC_DIRECTORY), TRUE);
- ::EnableWindow(GetDlgItem(IDC_PASSWORD), FALSE); /* Not supported for
now */
+ ::EnableWindow(GetDlgItem(IDC_PASSWORD), TRUE);
SetWizardButtons(PSWIZB_NEXT);
return TRUE;
@@ -171,6 +173,11 @@ public:
LRESULT OnPassword(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
{
+ CStringA Password;
+ if (_CZipAskPassword(m_hWnd, NULL, Password) == eAccept)
+ {
+ *m_pPassword = Password;
+ }
return 0;
}
@@ -247,7 +254,7 @@ public:
psh.dwFlags = PSH_WIZARD97 | PSH_HEADER;
psh.hInstance = _AtlBaseModule.GetResourceInstance();
- CExtractSettingsPage extractPage(this);
+ CExtractSettingsPage extractPage(this, &m_Password);
CCompleteSettingsPage completePage(this);
HPROPSHEETPAGE hpsp[] =
{
@@ -288,6 +295,7 @@ public:
BYTE Buffer[2048];
CStringA BaseDirectory = m_Directory;
CStringA Name;
+ CStringA Password = m_Password;
unz_file_info64 Info;
int CurrentFile = 0;
bool bOverwriteAll = false;
@@ -310,9 +318,48 @@ public:
if (is_dir)
continue;
- const char* password = NULL;
- /* FIXME: Process password, if required and not specified, prompt the user
*/
- err = unzOpenCurrentFilePassword(uf, password);
+ if (Info.flag & MINIZIP_PASSWORD_FLAG)
+ {
+ eZipPasswordResponse Response = eAccept;
+ do
+ {
+ /* If there is a password set, try it */
+ if (!Password.IsEmpty())
+ {
+ err = unzOpenCurrentFilePassword(uf, Password);
+ if (err == UNZ_OK)
+ {
+ /* Try to read some bytes, because unzOpenCurrentFilePassword
does not return failure */
+ char Buf[10];
+ err = unzReadCurrentFile(uf, Buf, sizeof(Buf));
+ unzCloseCurrentFile(uf);
+ if (err >= UNZ_OK)
+ {
+ /* 're'-open the file so that we can begin to
extract */
+ err = unzOpenCurrentFilePassword(uf, Password);
+ break;
+ }
+ }
+ }
+ Response = _CZipAskPassword(hDlg, Name, Password);
+ } while (Response == eAccept);
+
+ if (Response == eSkip)
+ {
+ Progress.SendMessage(PBM_SETPOS, CurrentFile, 0);
+ continue;
+ }
+ else if (Response == eAbort)
+ {
+ Close();
+ return false;
+ }
+ }
+ else
+ {
+ err = unzOpenCurrentFile(uf);
+ }
+
if (err != UNZ_OK)
{
DPRINT1("ERROR, unzOpenCurrentFilePassword: 0x%x\n", err);
diff --git a/dll/shellext/zipfldr/CZipPassword.cpp
b/dll/shellext/zipfldr/CZipPassword.cpp
new file mode 100644
index 0000000000..99c896029d
--- /dev/null
+++ b/dll/shellext/zipfldr/CZipPassword.cpp
@@ -0,0 +1,91 @@
+/*
+ * PROJECT: ReactOS Zip Shell Extension
+ * LICENSE: GPL-2.0+ (
https://spdx.org/licenses/GPL-2.0+)
+ * PURPOSE: Ask the user for a password
+ * COPYRIGHT: Copyright 2019 Mark Jansen (mark.jansen(a)reactos.org)
+ */
+
+#include "precomp.h"
+
+class CZipPassword : public CDialogImpl<CZipPassword>
+{
+private:
+ CStringA m_Filename;
+ CStringA* m_pPassword;
+public:
+ CZipPassword(const char* filename, CStringA* Password)
+ :m_pPassword(Password)
+ {
+ if (filename != NULL)
+ m_Filename = filename;
+ }
+
+ LRESULT OnInitDialog(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
+ {
+ CenterWindow(GetParent());
+
+ /* No filename, so this is the question before starting to extract */
+ if (m_Filename.IsEmpty())
+ {
+ CStringA message(MAKEINTRESOURCE(IDS_PASSWORD_ZIP_TEXT));
+ ::SetDlgItemTextA(m_hWnd, IDC_MESSAGE, message);
+ ::ShowWindow(GetDlgItem(IDSKIP), SW_HIDE);
+ }
+ else
+ {
+ /* Our CString does not support FormatMessage yet */
+ CStringA message(MAKEINTRESOURCE(IDS_PASSWORD_FILE_TEXT));
+ CHeapPtr<CHAR, CLocalAllocator> formatted;
+
+ DWORD_PTR args[2] =
+ {
+ (DWORD_PTR)m_Filename.GetString(),
+ NULL
+ };
+
+ ::FormatMessageA(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_ALLOCATE_BUFFER
| FORMAT_MESSAGE_ARGUMENT_ARRAY,
+ message, 0, 0, (LPSTR)&formatted, 0, (va_list*)args);
+
+ ::SetDlgItemTextA(m_hWnd, IDC_MESSAGE, formatted);
+ }
+ return TRUE;
+ }
+
+ LRESULT OnButton(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
+ {
+ if (wID == IDOK)
+ {
+ HWND item = GetDlgItem(IDC_PASSWORD);
+ int len = ::GetWindowTextLengthA(item);
+ len = ::GetDlgItemTextA(m_hWnd, IDC_PASSWORD,
m_pPassword->GetBuffer(len+1), len+1);
+ m_pPassword->ReleaseBuffer(len);
+ }
+ EndDialog(wID);
+ return 0;
+ }
+
+public:
+ enum { IDD = IDD_PASSWORD };
+
+ BEGIN_MSG_MAP(CZipPassword)
+ MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
+ COMMAND_ID_HANDLER(IDOK, OnButton)
+ COMMAND_ID_HANDLER(IDSKIP, OnButton)
+ COMMAND_ID_HANDLER(IDCANCEL, OnButton)
+ END_MSG_MAP()
+};
+
+eZipPasswordResponse _CZipAskPassword(HWND hDlg, const char* filename, CStringA&
Password)
+{
+ if (filename)
+ filename = PathFindFileNameA(filename);
+ CZipPassword password(filename, &Password);
+ INT_PTR Result = password.DoModal(hDlg);
+ switch (Result)
+ {
+ case IDOK: return eAccept;
+ case IDSKIP: return eSkip;
+ default:
+ case IDCANCEL: return eAbort;
+ }
+}
diff --git a/dll/shellext/zipfldr/lang/de-DE.rc b/dll/shellext/zipfldr/lang/de-DE.rc
index fc81d02a1c..5925822e05 100644
--- a/dll/shellext/zipfldr/lang/de-DE.rc
+++ b/dll/shellext/zipfldr/lang/de-DE.rc
@@ -37,13 +37,26 @@ CAPTION "Ersetzen von Dateien bestätigen"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
DEFPUSHBUTTON "&Ja",IDYES,6,36,62,14
- PUSHBUTTON "Abbrechen",IDCANCEL,204,36,62,14
PUSHBUTTON "Alle",IDYESALL,72,36,62,14
PUSHBUTTON "&Nein",IDNO,138,36,62,14
+ PUSHBUTTON "Abbrechen",IDCANCEL,204,36,62,14
ICON "",IDC_EXCLAMATION_ICON,6,6,24,22
LTEXT "",IDC_MESSAGE,36,6,228,24
END
+IDD_PASSWORD DIALOGEX 0, 0, 243, 62
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Password needed"
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ EDITTEXT IDC_PASSWORD,72,42,108,13,ES_PASSWORD | ES_AUTOHSCROLL
+ DEFPUSHBUTTON "OK",IDOK,186,6,50,14
+ PUSHBUTTON "Skip File",IDSKIP,186,24,50,14
+ PUSHBUTTON "Cancel",IDCANCEL,186,42,50,14
+ LTEXT "Static",IDC_MESSAGE,24,6,156,30
+ LTEXT "Password:",IDC_STATIC,24,44,44,8
+END
+
STRINGTABLE
BEGIN
IDS_COL_NAME "Name"
@@ -64,6 +77,8 @@ BEGIN
IDS_WIZ_BROWSE_TITLE "Wählen Sie ein Ziel zum Extrahieren der Dateien."
IDS_OVERWRITEFILE_TEXT "Dieser Ordner enthält bereits eine Datei
'%1'.\nMöchten Sie die existierende Datei ersetzen?"
+ IDS_PASSWORD_FILE_TEXT "The file '%1' is password protected. Please
enter the password."
+ IDS_PASSWORD_ZIP_TEXT "Please specify the password to use when extracting this
zip file."
IDS_MENUITEM "&Alle Extrahieren..."
IDS_HELPTEXT "Ordnerinhalt extrahieren"
diff --git a/dll/shellext/zipfldr/lang/en-US.rc b/dll/shellext/zipfldr/lang/en-US.rc
index ce2b78e1c7..bba5be5c87 100644
--- a/dll/shellext/zipfldr/lang/en-US.rc
+++ b/dll/shellext/zipfldr/lang/en-US.rc
@@ -2,7 +2,7 @@
* PROJECT: ReactOS Zip Shell Extension
* LICENSE: GPL-2.0+ (
https://spdx.org/licenses/GPL-2.0+)
* PURPOSE: English (United States) resource translation
- * COPYRIGHT: Copyright 2017 Mark Jansen (mark.jansen(a)reactos.org)
+ * COPYRIGHT: Copyright 2017-2019 Mark Jansen (mark.jansen(a)reactos.org)
*/
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
@@ -37,13 +37,26 @@ CAPTION "Confirm File Replace"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
DEFPUSHBUTTON "&Yes",IDYES,6,36,62,14
- PUSHBUTTON "Cancel",IDCANCEL,204,36,62,14
PUSHBUTTON "Yes &To All",IDYESALL,72,36,62,14
PUSHBUTTON "&No",IDNO,138,36,62,14
+ PUSHBUTTON "Cancel",IDCANCEL,204,36,62,14
ICON "",IDC_EXCLAMATION_ICON,6,6,24,22
LTEXT "",IDC_MESSAGE,36,6,228,24
END
+IDD_PASSWORD DIALOGEX 0, 0, 243, 62
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Password needed"
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ EDITTEXT IDC_PASSWORD,72,42,108,13,ES_PASSWORD | ES_AUTOHSCROLL
+ DEFPUSHBUTTON "OK",IDOK,186,6,50,14
+ PUSHBUTTON "Skip File",IDSKIP,186,24,50,14
+ PUSHBUTTON "Cancel",IDCANCEL,186,42,50,14
+ LTEXT "Static",IDC_MESSAGE,24,6,156,30
+ LTEXT "Password:",IDC_STATIC,24,44,44,8
+END
+
STRINGTABLE
BEGIN
IDS_COL_NAME "Name"
@@ -64,6 +77,8 @@ BEGIN
IDS_WIZ_BROWSE_TITLE "Select the place where you want to extract the selected
items."
IDS_OVERWRITEFILE_TEXT "This folder already contains a file called
'%1'.\nDo you want to replace it?"
+ IDS_PASSWORD_FILE_TEXT "The file '%1' is password protected. Please
enter the password."
+ IDS_PASSWORD_ZIP_TEXT "Please specify the password to use when extracting this
zip file."
IDS_MENUITEM "Extract &All..."
IDS_HELPTEXT "Extracts folder contents"
diff --git a/dll/shellext/zipfldr/lang/et-EE.rc b/dll/shellext/zipfldr/lang/et-EE.rc
index 1cd5431a37..c9a7cc0f98 100644
--- a/dll/shellext/zipfldr/lang/et-EE.rc
+++ b/dll/shellext/zipfldr/lang/et-EE.rc
@@ -37,13 +37,26 @@ CAPTION "Kinnita faili ülekirjutus"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
DEFPUSHBUTTON "&Jah",IDYES,6,36,62,14
- PUSHBUTTON "Loobu",IDCANCEL,204,36,62,14
PUSHBUTTON "Jah &kõigile",IDYESALL,72,36,62,14
PUSHBUTTON "&Ei",IDNO,138,36,62,14
+ PUSHBUTTON "Loobu",IDCANCEL,204,36,62,14
ICON "",IDC_EXCLAMATION_ICON,6,6,24,22
LTEXT "",IDC_MESSAGE,36,6,228,24
END
+IDD_PASSWORD DIALOGEX 0, 0, 243, 62
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Password needed"
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ EDITTEXT IDC_PASSWORD,72,42,108,13,ES_PASSWORD | ES_AUTOHSCROLL
+ DEFPUSHBUTTON "OK",IDOK,186,6,50,14
+ PUSHBUTTON "Skip File",IDSKIP,186,24,50,14
+ PUSHBUTTON "Cancel",IDCANCEL,186,42,50,14
+ LTEXT "Static",IDC_MESSAGE,24,6,156,30
+ LTEXT "Password:",IDC_STATIC,24,44,44,8
+END
+
STRINGTABLE
BEGIN
IDS_COL_NAME "Nimi"
@@ -64,6 +77,8 @@ BEGIN
IDS_WIZ_BROWSE_TITLE "Vali koht kuhu soovid ekstraktida valitud üksused."
IDS_OVERWRITEFILE_TEXT "See kaust juba sisaldab faili nimega '%1'.\nKas
tahad seda asendada?"
+ IDS_PASSWORD_FILE_TEXT "The file '%1' is password protected. Please
enter the password."
+ IDS_PASSWORD_ZIP_TEXT "Please specify the password to use when extracting this
zip file."
IDS_MENUITEM "Ekstrakti &kõik..."
IDS_HELPTEXT "Ekstraktib kausta sisu"
diff --git a/dll/shellext/zipfldr/lang/fr-FR.rc b/dll/shellext/zipfldr/lang/fr-FR.rc
index 1cce07cfa0..19d4520a60 100644
--- a/dll/shellext/zipfldr/lang/fr-FR.rc
+++ b/dll/shellext/zipfldr/lang/fr-FR.rc
@@ -37,13 +37,26 @@ CAPTION "Confirmer le remplacement de fichier"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
DEFPUSHBUTTON "&Oui",IDYES,6,36,62,14
- PUSHBUTTON "Annuler",IDCANCEL,204,36,62,14
PUSHBUTTON "Oui à &tous",IDYESALL,72,36,62,14
PUSHBUTTON "&Non",IDNO,138,36,62,14
+ PUSHBUTTON "Annuler",IDCANCEL,204,36,62,14
ICON "",IDC_EXCLAMATION_ICON,6,6,24,22
LTEXT "",IDC_MESSAGE,36,6,228,24
END
+IDD_PASSWORD DIALOGEX 0, 0, 243, 62
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Password needed"
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ EDITTEXT IDC_PASSWORD,72,42,108,13,ES_PASSWORD | ES_AUTOHSCROLL
+ DEFPUSHBUTTON "OK",IDOK,186,6,50,14
+ PUSHBUTTON "Skip File",IDSKIP,186,24,50,14
+ PUSHBUTTON "Cancel",IDCANCEL,186,42,50,14
+ LTEXT "Static",IDC_MESSAGE,24,6,156,30
+ LTEXT "Password:",IDC_STATIC,24,44,44,8
+END
+
STRINGTABLE
BEGIN
IDS_COL_NAME "Nom"
@@ -64,6 +77,8 @@ BEGIN
IDS_WIZ_BROWSE_TITLE "Choisissez l'endroit où vous voulez extraits les
éléments sélectionnés."
IDS_OVERWRITEFILE_TEXT "Ce répertoire contient déjà un fichier nommé
'%1'.\nVoulez-vous le remplacer ?"
+ IDS_PASSWORD_FILE_TEXT "The file '%1' is password protected. Please
enter the password."
+ IDS_PASSWORD_ZIP_TEXT "Please specify the password to use when extracting this
zip file."
IDS_MENUITEM "&Tout extraire..."
IDS_HELPTEXT "Extrait le contenu du répertoire"
diff --git a/dll/shellext/zipfldr/lang/it-IT.rc b/dll/shellext/zipfldr/lang/it-IT.rc
index 6d63957c76..9f8864383f 100644
--- a/dll/shellext/zipfldr/lang/it-IT.rc
+++ b/dll/shellext/zipfldr/lang/it-IT.rc
@@ -37,13 +37,26 @@ CAPTION "Conferma Sostituzione File"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
DEFPUSHBUTTON "&Sì",IDYES,6,36,62,14
- PUSHBUTTON "Annulla",IDCANCEL,204,36,62,14
PUSHBUTTON "Sì &A Tutti",IDYESALL,72,36,62,14
PUSHBUTTON "&No",IDNO,138,36,62,14
+ PUSHBUTTON "Annulla",IDCANCEL,204,36,62,14
ICON "",IDC_EXCLAMATION_ICON,6,6,24,22
LTEXT "",IDC_MESSAGE,36,6,228,24
END
+IDD_PASSWORD DIALOGEX 0, 0, 243, 62
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Password needed"
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ EDITTEXT IDC_PASSWORD,72,42,108,13,ES_PASSWORD | ES_AUTOHSCROLL
+ DEFPUSHBUTTON "OK",IDOK,186,6,50,14
+ PUSHBUTTON "Skip File",IDSKIP,186,24,50,14
+ PUSHBUTTON "Cancel",IDCANCEL,186,42,50,14
+ LTEXT "Static",IDC_MESSAGE,24,6,156,30
+ LTEXT "Password:",IDC_STATIC,24,44,44,8
+END
+
STRINGTABLE
BEGIN
IDS_COL_NAME "Nome"
@@ -64,6 +77,8 @@ BEGIN
IDS_WIZ_BROWSE_TITLE "Seleziona la destinazione in cui desideri estrarre gli
elementi selezionati."
IDS_OVERWRITEFILE_TEXT "Questa cartella già contiene un file chiamato
'%1'.\nVuoi sostituirla?"
+ IDS_PASSWORD_FILE_TEXT "The file '%1' is password protected. Please
enter the password."
+ IDS_PASSWORD_ZIP_TEXT "Please specify the password to use when extracting this
zip file."
IDS_MENUITEM "Estrai &Tutto..."
IDS_HELPTEXT "Estrae i contenuti della cartella"
diff --git a/dll/shellext/zipfldr/lang/ja-JP.rc b/dll/shellext/zipfldr/lang/ja-JP.rc
index 4b15dd20c0..63564b7200 100644
--- a/dll/shellext/zipfldr/lang/ja-JP.rc
+++ b/dll/shellext/zipfldr/lang/ja-JP.rc
@@ -37,13 +37,26 @@ CAPTION "ファイルの置換の確認"
FONT 9, "MS UI Gothic", 400, 0, 0x0
BEGIN
DEFPUSHBUTTON "はい(&Y)",IDYES,6,36,62,14
- PUSHBUTTON "キャンセル",IDCANCEL,204,36,62,14
PUSHBUTTON "すべてはい(&T)",IDYESALL,72,36,62,14
PUSHBUTTON "いいえ(&N)",IDNO,138,36,62,14
+ PUSHBUTTON "キャンセル",IDCANCEL,204,36,62,14
ICON "",IDC_EXCLAMATION_ICON,6,6,24,22
LTEXT "",IDC_MESSAGE,36,6,228,24
END
+IDD_PASSWORD DIALOGEX 0, 0, 243, 62
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Password needed"
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ EDITTEXT IDC_PASSWORD,72,42,108,13,ES_PASSWORD | ES_AUTOHSCROLL
+ DEFPUSHBUTTON "OK",IDOK,186,6,50,14
+ PUSHBUTTON "Skip File",IDSKIP,186,24,50,14
+ PUSHBUTTON "Cancel",IDCANCEL,186,42,50,14
+ LTEXT "Static",IDC_MESSAGE,24,6,156,30
+ LTEXT "Password:",IDC_STATIC,24,44,44,8
+END
+
STRINGTABLE
BEGIN
IDS_COL_NAME "名前"
@@ -64,6 +77,8 @@ BEGIN
IDS_WIZ_BROWSE_TITLE "選択された項目を展開したい場所を選んで下さい。"
IDS_OVERWRITEFILE_TEXT "'%1'という名前のファイルがフォルダ内に既に存在します。\n置き換えしますか?"
+ IDS_PASSWORD_FILE_TEXT "The file '%1' is password protected. Please
enter the password."
+ IDS_PASSWORD_ZIP_TEXT "Please specify the password to use when extracting this
zip file."
IDS_MENUITEM "すべて展開(&A)..."
IDS_HELPTEXT "フォルダ内容の展開"
diff --git a/dll/shellext/zipfldr/lang/pl-PL.rc b/dll/shellext/zipfldr/lang/pl-PL.rc
index 7d2e2e47fc..098e11d1d3 100644
--- a/dll/shellext/zipfldr/lang/pl-PL.rc
+++ b/dll/shellext/zipfldr/lang/pl-PL.rc
@@ -36,13 +36,26 @@ CAPTION "Potwierdzenie zamiany pliku"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
DEFPUSHBUTTON "&Tak",IDYES,6,36,62,14
- PUSHBUTTON "Anuluj",IDCANCEL,204,36,62,14
PUSHBUTTON "Tak na &wszystkie",IDYESALL,72,36,62,14
PUSHBUTTON "&Nie",IDNO,138,36,62,14
+ PUSHBUTTON "Anuluj",IDCANCEL,204,36,62,14
ICON "",IDC_EXCLAMATION_ICON,6,6,24,22
LTEXT "",IDC_MESSAGE,36,6,228,24
END
+IDD_PASSWORD DIALOGEX 0, 0, 243, 62
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Password needed"
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ EDITTEXT IDC_PASSWORD,72,42,108,13,ES_PASSWORD | ES_AUTOHSCROLL
+ DEFPUSHBUTTON "OK",IDOK,186,6,50,14
+ PUSHBUTTON "Skip File",IDSKIP,186,24,50,14
+ PUSHBUTTON "Cancel",IDCANCEL,186,42,50,14
+ LTEXT "Static",IDC_MESSAGE,24,6,156,30
+ LTEXT "Password:",IDC_STATIC,24,44,44,8
+END
+
STRINGTABLE
BEGIN
IDS_COL_NAME "Nazwa"
@@ -63,6 +76,8 @@ BEGIN
IDS_WIZ_BROWSE_TITLE "Wybierz miejsce, w którym chcesz wyodrębnić wybrane
elementy."
IDS_OVERWRITEFILE_TEXT "Ten folder zawiera już plik o nazwie '%1'.\nCzy
chcesz zamienić istniejący plik?"
+ IDS_PASSWORD_FILE_TEXT "The file '%1' is password protected. Please
enter the password."
+ IDS_PASSWORD_ZIP_TEXT "Please specify the password to use when extracting this
zip file."
IDS_MENUITEM "Wy&odrębnij wszystkie..."
IDS_HELPTEXT "Wyodrębnia zawartość folderów"
diff --git a/dll/shellext/zipfldr/lang/ro-RO.rc b/dll/shellext/zipfldr/lang/ro-RO.rc
index a41744d48c..31642b0f48 100644
--- a/dll/shellext/zipfldr/lang/ro-RO.rc
+++ b/dll/shellext/zipfldr/lang/ro-RO.rc
@@ -44,6 +44,19 @@ BEGIN
LTEXT "",IDC_MESSAGE,36,6,228,24
END
+IDD_PASSWORD DIALOGEX 0, 0, 243, 62
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Password needed"
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ EDITTEXT IDC_PASSWORD,72,42,108,13,ES_PASSWORD | ES_AUTOHSCROLL
+ DEFPUSHBUTTON "OK",IDOK,186,6,50,14
+ PUSHBUTTON "Skip File",IDSKIP,186,24,50,14
+ PUSHBUTTON "Cancel",IDCANCEL,186,42,50,14
+ LTEXT "Static",IDC_MESSAGE,24,6,156,30
+ LTEXT "Password:",IDC_STATIC,24,44,44,8
+END
+
STRINGTABLE
BEGIN
IDS_COL_NAME "Nume"
@@ -64,6 +77,8 @@ BEGIN
IDS_WIZ_BROWSE_TITLE "Selectați destinația unde doriți să extrageți elementele
selectate."
IDS_OVERWRITEFILE_TEXT "Acest folder deja conține un fișier numit
'%1'.\nDoriți să o înlocuiți?"
+ IDS_PASSWORD_FILE_TEXT "The file '%1' is password protected. Please
enter the password."
+ IDS_PASSWORD_ZIP_TEXT "Please specify the password to use when extracting this
zip file."
IDS_MENUITEM "Extrage &Tot..."
IDS_HELPTEXT "Extrage conținutul folderului"
diff --git a/dll/shellext/zipfldr/lang/ru-RU.rc b/dll/shellext/zipfldr/lang/ru-RU.rc
index 7e7a38ed62..89096a3440 100644
--- a/dll/shellext/zipfldr/lang/ru-RU.rc
+++ b/dll/shellext/zipfldr/lang/ru-RU.rc
@@ -37,13 +37,26 @@ CAPTION "Подтвердите замену файла"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
DEFPUSHBUTTON "&Да",IDYES,6,36,62,14
- PUSHBUTTON "Отмена",IDCANCEL,204,36,62,14
PUSHBUTTON "Заменить &все",IDYESALL,72,36,62,14
PUSHBUTTON "&Нет",IDNO,138,36,62,14
+ PUSHBUTTON "Отмена",IDCANCEL,204,36,62,14
ICON "",IDC_EXCLAMATION_ICON,6,6,24,22
LTEXT "",IDC_MESSAGE,36,6,228,24
END
+IDD_PASSWORD DIALOGEX 0, 0, 243, 62
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Password needed"
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ EDITTEXT IDC_PASSWORD,72,42,108,13,ES_PASSWORD | ES_AUTOHSCROLL
+ DEFPUSHBUTTON "OK",IDOK,186,6,50,14
+ PUSHBUTTON "Skip File",IDSKIP,186,24,50,14
+ PUSHBUTTON "Cancel",IDCANCEL,186,42,50,14
+ LTEXT "Static",IDC_MESSAGE,24,6,156,30
+ LTEXT "Password:",IDC_STATIC,24,44,44,8
+END
+
STRINGTABLE
BEGIN
IDS_COL_NAME "Название"
@@ -63,7 +76,9 @@ BEGIN
IDS_WIZ_COMPL_SUBTITLE "Файлы из zip архива были извлечены."
IDS_WIZ_BROWSE_TITLE "Выберите расположение для извлечения элементов."
- IDS_OVERWRITEFILE_TEXT "В данной папке уже есть файл '%1'.\nВы хотите
заменить его?"
+ IDS_OVERWRITEFILE_TEXT "В данной папке уже есть файл '%1!ls!'.\nВы
хотите заменить его?"
+ IDS_PASSWORD_FILE_TEXT "The file '%1' is password protected. Please
enter the password."
+ IDS_PASSWORD_ZIP_TEXT "Please specify the password to use when extracting this
zip file."
IDS_MENUITEM "&Извлечь всё..."
IDS_HELPTEXT "Извлекает содержимое архива"
diff --git a/dll/shellext/zipfldr/lang/sv-SE.rc b/dll/shellext/zipfldr/lang/sv-SE.rc
index 2b35afce03..a2f1c90c73 100644
--- a/dll/shellext/zipfldr/lang/sv-SE.rc
+++ b/dll/shellext/zipfldr/lang/sv-SE.rc
@@ -37,13 +37,26 @@ CAPTION "Bekräfta filersättning"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
DEFPUSHBUTTON "&Ja",IDYES,6,36,62,14
- PUSHBUTTON "Avbryt",IDCANCEL,204,36,62,14
PUSHBUTTON "Ja &till alla",IDYESALL,72,36,62,14
PUSHBUTTON "&Nej",IDNO,138,36,62,14
+ PUSHBUTTON "Avbryt",IDCANCEL,204,36,62,14
ICON "",IDC_EXCLAMATION_ICON,6,6,24,22
LTEXT "",IDC_MESSAGE,36,6,228,24
END
+IDD_PASSWORD DIALOGEX 0, 0, 243, 62
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Password needed"
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ EDITTEXT IDC_PASSWORD,72,42,108,13,ES_PASSWORD | ES_AUTOHSCROLL
+ DEFPUSHBUTTON "OK",IDOK,186,6,50,14
+ PUSHBUTTON "Skip File",IDSKIP,186,24,50,14
+ PUSHBUTTON "Cancel",IDCANCEL,186,42,50,14
+ LTEXT "Static",IDC_MESSAGE,24,6,156,30
+ LTEXT "Password:",IDC_STATIC,24,44,44,8
+END
+
STRINGTABLE
BEGIN
IDS_COL_NAME "Namn"
@@ -64,6 +77,8 @@ BEGIN
IDS_WIZ_BROWSE_TITLE "Välj plats där du vill extrahera de valda objekten."
IDS_OVERWRITEFILE_TEXT "Den här mappen innehåller redan en fil med namnet
'%1'.\nVill du ersätta den?"
+ IDS_PASSWORD_FILE_TEXT "The file '%1' is password protected. Please
enter the password."
+ IDS_PASSWORD_ZIP_TEXT "Please specify the password to use when extracting this
zip file."
IDS_MENUITEM "Extrahera &alla..."
IDS_HELPTEXT "Extraherar mappinnehållet"
diff --git a/dll/shellext/zipfldr/lang/zh-CN.rc b/dll/shellext/zipfldr/lang/zh-CN.rc
index 1914a37bfe..27066adfdf 100644
--- a/dll/shellext/zipfldr/lang/zh-CN.rc
+++ b/dll/shellext/zipfldr/lang/zh-CN.rc
@@ -37,13 +37,26 @@ CAPTION "确认替换文件"
FONT 9, "宋体", 400, 0, 0x1
BEGIN
DEFPUSHBUTTON "是(&Y)",IDYES,6,36,62,14
- PUSHBUTTON "取消",IDCANCEL,204,36,62,14
PUSHBUTTON "全部为是(&T)",IDYESALL,72,36,62,14
PUSHBUTTON "否(&N)",IDNO,138,36,62,14
+ PUSHBUTTON "取消",IDCANCEL,204,36,62,14
ICON "",IDC_EXCLAMATION_ICON,6,6,24,22
LTEXT "",IDC_MESSAGE,36,6,228,24
END
+IDD_PASSWORD DIALOGEX 0, 0, 243, 62
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Password needed"
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ EDITTEXT IDC_PASSWORD,72,42,108,13,ES_PASSWORD | ES_AUTOHSCROLL
+ DEFPUSHBUTTON "OK",IDOK,186,6,50,14
+ PUSHBUTTON "Skip File",IDSKIP,186,24,50,14
+ PUSHBUTTON "Cancel",IDCANCEL,186,42,50,14
+ LTEXT "Static",IDC_MESSAGE,24,6,156,30
+ LTEXT "Password:",IDC_STATIC,24,44,44,8
+END
+
STRINGTABLE
BEGIN
IDS_COL_NAME "名称"
@@ -64,6 +77,8 @@ BEGIN
IDS_WIZ_BROWSE_TITLE "选择您想要解压指定项目到的地方。"
IDS_OVERWRITEFILE_TEXT "这个文件夹中已经包含一个叫 %1 的文件。\n您想要替换它吗?"
+ IDS_PASSWORD_FILE_TEXT "The file '%1' is password protected. Please
enter the password."
+ IDS_PASSWORD_ZIP_TEXT "Please specify the password to use when extracting this
zip file."
IDS_MENUITEM "解压全部(&A)..."
IDS_HELPTEXT "解压文件夹内容"
diff --git a/dll/shellext/zipfldr/precomp.h b/dll/shellext/zipfldr/precomp.h
index 01b92991d5..06c82a8b15 100644
--- a/dll/shellext/zipfldr/precomp.h
+++ b/dll/shellext/zipfldr/precomp.h
@@ -41,6 +41,8 @@ extern LONG g_ModuleRefCnt;
WCHAR* guid2string(REFCLSID iid);
+#define MINIZIP_PASSWORD_FLAG 1
+
#include "minizip/unzip.h"
#include "minizip/ioapi.h"
@@ -56,6 +58,25 @@ HRESULT _CExplorerCommandProvider_CreateInstance(IContextMenu*
zipObject, REFIID
HRESULT _CFolderViewCB_CreateInstance(REFIID riid, LPVOID * ppvOut);
void _CZipExtract_runWizard(PCWSTR Filename);
+enum eZipPasswordResponse
+{
+ eAbort,
+ eSkip,
+ eAccept,
+};
+
+eZipPasswordResponse _CZipAskPassword(HWND hDlg, const char* filename, CStringA&
Password);
+
+enum eZipConfirmResponse
+{
+ eYes,
+ eYesToAll,
+ eNo,
+ eCancel
+};
+
+eZipConfirmResponse _CZipAskReplace(HWND hDlg, const char* FullPath);
+
#include "CZipEnumerator.hpp"
#include "CZipFolder.hpp"
diff --git a/dll/shellext/zipfldr/resource.h b/dll/shellext/zipfldr/resource.h
index 6c2ea39c2e..b14faeb7d2 100644
--- a/dll/shellext/zipfldr/resource.h
+++ b/dll/shellext/zipfldr/resource.h
@@ -21,6 +21,9 @@
#define IDC_EXCLAMATION_ICON 1205
#define IDC_MESSAGE 1206
+#define IDD_PASSWORD 1300
+#define IDSKIP 1301
+
/* Strings */
#define IDS_COL_NAME 100
@@ -45,6 +48,8 @@
/* Questions */
#define IDS_OVERWRITEFILE_TEXT 9000
+#define IDS_PASSWORD_FILE_TEXT 9001
+#define IDS_PASSWORD_ZIP_TEXT 9002
/* Context menu / ExplorerCommand strings */
diff --git a/dll/shellext/zipfldr/zippidl.cpp b/dll/shellext/zipfldr/zippidl.cpp
index 79b23c3b00..09f26cd6f2 100644
--- a/dll/shellext/zipfldr/zippidl.cpp
+++ b/dll/shellext/zipfldr/zippidl.cpp
@@ -2,7 +2,7 @@
* PROJECT: ReactOS Zip Shell Extension
* LICENSE: GPL-2.0+ (
https://spdx.org/licenses/GPL-2.0+)
* PURPOSE: zip pidl handling
- * COPYRIGHT: Copyright 2017 Mark Jansen (mark.jansen(a)reactos.org)
+ * COPYRIGHT: Copyright 2017-2019 Mark Jansen (mark.jansen(a)reactos.org)
*/
#include "precomp.h"
@@ -25,7 +25,7 @@ LPITEMIDLIST _ILCreate(ZipPidlType Type, LPCSTR lpString,
unz_file_info64& info)
pidl->CompressedSize = info.compressed_size;
pidl->UncompressedSize = info.uncompressed_size;
pidl->DosDate = info.dosDate;
- pidl->Password = info.flag & 1;
+ pidl->Password = info.flag & MINIZIP_PASSWORD_FLAG;
}
strcpy(pidl->Name, lpString);