https://git.reactos.org/?p=reactos.git;a=commitdiff;h=cb499cd1fd700f311c391…
commit cb499cd1fd700f311c391d2ca43bad8e35dd4fba
Author: Bișoc George <fraizeraust99(a)gmail.com>
AuthorDate: Mon Oct 8 14:36:40 2018 +0200
Commit: Hermès BÉLUSCA - MAÏTO <hermes.belusca-maito(a)reactos.org>
CommitDate: Mon Oct 8 14:36:40 2018 +0200
[APPWIZ] Display a message box in case of failure (#913)
When the downloading process of Gecko fails, display a warning message box.
---
dll/cpl/appwiz/addons.c | 6 ++++--
dll/cpl/appwiz/lang/bg-BG.rc | 1 +
dll/cpl/appwiz/lang/cs-CZ.rc | 1 +
dll/cpl/appwiz/lang/de-DE.rc | 1 +
dll/cpl/appwiz/lang/el-GR.rc | 1 +
dll/cpl/appwiz/lang/en-US.rc | 1 +
dll/cpl/appwiz/lang/es-ES.rc | 1 +
dll/cpl/appwiz/lang/et-EE.rc | 1 +
dll/cpl/appwiz/lang/fr-FR.rc | 1 +
dll/cpl/appwiz/lang/he-IL.rc | 1 +
dll/cpl/appwiz/lang/it-IT.rc | 1 +
dll/cpl/appwiz/lang/ja-JP.rc | 1 +
dll/cpl/appwiz/lang/no-NO.rc | 1 +
dll/cpl/appwiz/lang/pl-PL.rc | 1 +
dll/cpl/appwiz/lang/pt-BR.rc | 1 +
dll/cpl/appwiz/lang/ro-RO.rc | 1 +
dll/cpl/appwiz/lang/ru-RU.rc | 1 +
dll/cpl/appwiz/lang/sk-SK.rc | 1 +
dll/cpl/appwiz/lang/sq-AL.rc | 1 +
dll/cpl/appwiz/lang/tr-TR.rc | 1 +
dll/cpl/appwiz/lang/uk-UA.rc | 1 +
dll/cpl/appwiz/lang/zh-CN.rc | 1 +
dll/cpl/appwiz/lang/zh-TW.rc | 1 +
dll/cpl/appwiz/resource.h | 1 +
24 files changed, 27 insertions(+), 2 deletions(-)
diff --git a/dll/cpl/appwiz/addons.c b/dll/cpl/appwiz/addons.c
index beec6a799b..c2fb28d2ad 100644
--- a/dll/cpl/appwiz/addons.c
+++ b/dll/cpl/appwiz/addons.c
@@ -351,6 +351,7 @@ static IBindStatusCallback InstallCallback = { &InstallCallbackVtbl };
static DWORD WINAPI download_proc(PVOID arg)
{
+ WCHAR message[256];
WCHAR tmp_dir[MAX_PATH], tmp_file[MAX_PATH];
HRESULT hres;
@@ -362,12 +363,13 @@ static DWORD WINAPI download_proc(PVOID arg)
hres = URLDownloadToFileW(NULL, GeckoUrl, tmp_file, 0, &InstallCallback);
if(FAILED(hres)) {
ERR("URLDownloadToFile failed: %08x\n", hres);
+ if (LoadStringW(hApplet, IDS_DWL_FAILED, message, sizeof(message) / sizeof(WCHAR))) {
+ MessageBoxW(NULL, message, NULL, MB_ICONERROR);
+ }
} else {
if(sha_check(tmp_file)) {
install_file(tmp_file);
}else {
- WCHAR message[256];
-
if(LoadStringW(hApplet, IDS_INVALID_SHA, message, sizeof(message)/sizeof(WCHAR))) {
MessageBoxW(NULL, message, NULL, MB_ICONERROR);
}
diff --git a/dll/cpl/appwiz/lang/bg-BG.rc b/dll/cpl/appwiz/lang/bg-BG.rc
index f1a883b21b..06c00ea539 100644
--- a/dll/cpl/appwiz/lang/bg-BG.rc
+++ b/dll/cpl/appwiz/lang/bg-BG.rc
@@ -79,6 +79,7 @@ BEGIN
IDS_INSTALLING "Installing..."
IDS_INVALID_SHA "Unexpected checksum of downloaded file. Aborting installation of corrupted file."
IDS_NEW_INTERNET_SHORTCUT "New Internet Shortcut"
+ IDS_DWL_FAILED "Failed to download the Gecko package. Make sure you have an internet connection in order to download it. The setup will proceed without installing Gecko."
IDS_CANTMAKEINETSHORTCUT "Failed to create internet shortcut."
IDS_CANTMAKESHORTCUT "Failed to create shortcut."
END
diff --git a/dll/cpl/appwiz/lang/cs-CZ.rc b/dll/cpl/appwiz/lang/cs-CZ.rc
index 3b60b303ca..f680584e0a 100644
--- a/dll/cpl/appwiz/lang/cs-CZ.rc
+++ b/dll/cpl/appwiz/lang/cs-CZ.rc
@@ -84,6 +84,7 @@ BEGIN
IDS_INSTALLING "Instalace..."
IDS_INVALID_SHA "Stažený soubor má neplatný kontrolní součet. Instalace poškozeného souboru bude přerušena."
IDS_NEW_INTERNET_SHORTCUT "New Internet Shortcut"
+ IDS_DWL_FAILED "Failed to download the Gecko package. Make sure you have an internet connection in order to download it. The setup will proceed without installing Gecko."
IDS_CANTMAKEINETSHORTCUT "Failed to create internet shortcut."
IDS_CANTMAKESHORTCUT "Failed to create shortcut."
END
diff --git a/dll/cpl/appwiz/lang/de-DE.rc b/dll/cpl/appwiz/lang/de-DE.rc
index 7dca52c8fa..af95ea7a34 100644
--- a/dll/cpl/appwiz/lang/de-DE.rc
+++ b/dll/cpl/appwiz/lang/de-DE.rc
@@ -79,6 +79,7 @@ BEGIN
IDS_INSTALLING "Installiere..."
IDS_INVALID_SHA "Die heruntergeladene Datei hat eine unerwartete Prüfsumme. Abbruch der Installation aufgrund beschädigter Datei."
IDS_NEW_INTERNET_SHORTCUT "New Internet Shortcut"
+ IDS_DWL_FAILED "Failed to download the Gecko package. Make sure you have an internet connection in order to download it. The setup will proceed without installing Gecko."
IDS_CANTMAKEINETSHORTCUT "Failed to create internet shortcut."
IDS_CANTMAKESHORTCUT "Failed to create shortcut."
END
diff --git a/dll/cpl/appwiz/lang/el-GR.rc b/dll/cpl/appwiz/lang/el-GR.rc
index d747592d19..51b48c935a 100644
--- a/dll/cpl/appwiz/lang/el-GR.rc
+++ b/dll/cpl/appwiz/lang/el-GR.rc
@@ -79,6 +79,7 @@ BEGIN
IDS_INSTALLING "Installing..."
IDS_INVALID_SHA "Unexpected checksum of downloaded file. Aborting installation of corrupted file."
IDS_NEW_INTERNET_SHORTCUT "New Internet Shortcut"
+ IDS_DWL_FAILED "Failed to download the Gecko package. Make sure you have an internet connection in order to download it. The setup will proceed without installing Gecko."
IDS_CANTMAKEINETSHORTCUT "Failed to create internet shortcut."
IDS_CANTMAKESHORTCUT "Failed to create shortcut."
END
diff --git a/dll/cpl/appwiz/lang/en-US.rc b/dll/cpl/appwiz/lang/en-US.rc
index e5d9516b17..38b19d5d19 100644
--- a/dll/cpl/appwiz/lang/en-US.rc
+++ b/dll/cpl/appwiz/lang/en-US.rc
@@ -79,6 +79,7 @@ BEGIN
IDS_INSTALLING "Installing..."
IDS_INVALID_SHA "Unexpected checksum of downloaded file. Aborting installation of corrupted file."
IDS_NEW_INTERNET_SHORTCUT "New Internet Shortcut"
+ IDS_DWL_FAILED "Failed to download the Gecko package. Make sure you have an internet connection in order to download it. The setup will proceed without installing Gecko."
IDS_CANTMAKEINETSHORTCUT "Failed to create internet shortcut."
IDS_CANTMAKESHORTCUT "Failed to create shortcut."
END
diff --git a/dll/cpl/appwiz/lang/es-ES.rc b/dll/cpl/appwiz/lang/es-ES.rc
index 949de044c3..9f55f9674a 100644
--- a/dll/cpl/appwiz/lang/es-ES.rc
+++ b/dll/cpl/appwiz/lang/es-ES.rc
@@ -85,6 +85,7 @@ BEGIN
IDS_INSTALLING "Instalando..."
IDS_INVALID_SHA "La suma de verificación del archivo descargado no coincide. Se ha cancelado la instalación del archivo corrupto."
IDS_NEW_INTERNET_SHORTCUT "New Internet Shortcut"
+ IDS_DWL_FAILED "Failed to download the Gecko package. Make sure you have an internet connection in order to download it. The setup will proceed without installing Gecko."
IDS_CANTMAKEINETSHORTCUT "Failed to create internet shortcut."
IDS_CANTMAKESHORTCUT "Failed to create shortcut."
END
diff --git a/dll/cpl/appwiz/lang/et-EE.rc b/dll/cpl/appwiz/lang/et-EE.rc
index 6d41c1bbd1..95e422bca5 100644
--- a/dll/cpl/appwiz/lang/et-EE.rc
+++ b/dll/cpl/appwiz/lang/et-EE.rc
@@ -86,6 +86,7 @@ BEGIN
IDS_INSTALLING "Paigaldamine..."
IDS_INVALID_SHA "Kontrollsumma ei kattu. Paigaldamine katkestatud korrupteerinud faili tõttu."
IDS_NEW_INTERNET_SHORTCUT "New Internet Shortcut"
+ IDS_DWL_FAILED "Failed to download the Gecko package. Make sure you have an internet connection in order to download it. The setup will proceed without installing Gecko."
IDS_CANTMAKEINETSHORTCUT "Failed to create internet shortcut."
IDS_CANTMAKESHORTCUT "Failed to create shortcut."
END
diff --git a/dll/cpl/appwiz/lang/fr-FR.rc b/dll/cpl/appwiz/lang/fr-FR.rc
index 6c942eeeb3..1aeb4989e0 100644
--- a/dll/cpl/appwiz/lang/fr-FR.rc
+++ b/dll/cpl/appwiz/lang/fr-FR.rc
@@ -79,6 +79,7 @@ BEGIN
IDS_INSTALLING "Installation..."
IDS_INVALID_SHA "La somme de contrôle du fichier téléchargé est erronée. Abandon de l'installation du fichier corrompu."
IDS_NEW_INTERNET_SHORTCUT "New Internet Shortcut"
+ IDS_DWL_FAILED "Failed to download the Gecko package. Make sure you have an internet connection in order to download it. The setup will proceed without installing Gecko."
IDS_CANTMAKEINETSHORTCUT "Failed to create internet shortcut."
IDS_CANTMAKESHORTCUT "Failed to create shortcut."
END
diff --git a/dll/cpl/appwiz/lang/he-IL.rc b/dll/cpl/appwiz/lang/he-IL.rc
index 145a093bd5..2ff33619e0 100644
--- a/dll/cpl/appwiz/lang/he-IL.rc
+++ b/dll/cpl/appwiz/lang/he-IL.rc
@@ -80,6 +80,7 @@ BEGIN
IDS_INSTALLING "Installing..."
IDS_INVALID_SHA "Unexpected checksum of downloaded file. Aborting installation of corrupted file."
IDS_NEW_INTERNET_SHORTCUT "New Internet Shortcut"
+ IDS_DWL_FAILED "Failed to download the Gecko package. Make sure you have an internet connection in order to download it. The setup will proceed without installing Gecko."
IDS_CANTMAKEINETSHORTCUT "Failed to create internet shortcut."
IDS_CANTMAKESHORTCUT "Failed to create shortcut."
END
diff --git a/dll/cpl/appwiz/lang/it-IT.rc b/dll/cpl/appwiz/lang/it-IT.rc
index f7b388cebf..3c886aed37 100644
--- a/dll/cpl/appwiz/lang/it-IT.rc
+++ b/dll/cpl/appwiz/lang/it-IT.rc
@@ -79,6 +79,7 @@ BEGIN
IDS_INSTALLING "Installando..."
IDS_INVALID_SHA "Checksum imprevisto del file scaricato. Interruzione installazione del file danneggiato."
IDS_NEW_INTERNET_SHORTCUT "New Internet Shortcut"
+ IDS_DWL_FAILED "Failed to download the Gecko package. Make sure you have an internet connection in order to download it. The setup will proceed without installing Gecko."
IDS_CANTMAKEINETSHORTCUT "Failed to create internet shortcut."
IDS_CANTMAKESHORTCUT "Failed to create shortcut."
END
diff --git a/dll/cpl/appwiz/lang/ja-JP.rc b/dll/cpl/appwiz/lang/ja-JP.rc
index c70ab86ff4..ba852629cd 100644
--- a/dll/cpl/appwiz/lang/ja-JP.rc
+++ b/dll/cpl/appwiz/lang/ja-JP.rc
@@ -79,6 +79,7 @@ BEGIN
IDS_INSTALLING "インストール中..."
IDS_INVALID_SHA "ダウンロードしたファイルのチェックサムが合致しません。壊れたファイルのインストールを中止しています。"
IDS_NEW_INTERNET_SHORTCUT "New Internet Shortcut"
+ IDS_DWL_FAILED "Failed to download the Gecko package. Make sure you have an internet connection in order to download it. The setup will proceed without installing Gecko."
IDS_CANTMAKEINETSHORTCUT "Failed to create internet shortcut."
IDS_CANTMAKESHORTCUT "Failed to create shortcut."
END
diff --git a/dll/cpl/appwiz/lang/no-NO.rc b/dll/cpl/appwiz/lang/no-NO.rc
index 26295693e1..fd37b67a2d 100644
--- a/dll/cpl/appwiz/lang/no-NO.rc
+++ b/dll/cpl/appwiz/lang/no-NO.rc
@@ -79,6 +79,7 @@ BEGIN
IDS_INSTALLING "Installing..."
IDS_INVALID_SHA "Unexpected checksum of downloaded file. Aborting installation of corrupted file."
IDS_NEW_INTERNET_SHORTCUT "New Internet Shortcut"
+ IDS_DWL_FAILED "Failed to download the Gecko package. Make sure you have an internet connection in order to download it. The setup will proceed without installing Gecko."
IDS_CANTMAKEINETSHORTCUT "Failed to create internet shortcut."
IDS_CANTMAKESHORTCUT "Failed to create shortcut."
END
diff --git a/dll/cpl/appwiz/lang/pl-PL.rc b/dll/cpl/appwiz/lang/pl-PL.rc
index 8eda5f3aba..c48e2a0f70 100644
--- a/dll/cpl/appwiz/lang/pl-PL.rc
+++ b/dll/cpl/appwiz/lang/pl-PL.rc
@@ -88,6 +88,7 @@ BEGIN
IDS_INSTALLING "Instalowanie..."
IDS_INVALID_SHA "Nieoczekiwana suma kontrolna ściągniętego pliku. Przerwanie instalacji uszkodzonego pliku."
IDS_NEW_INTERNET_SHORTCUT "Nowy skrót internetowy"
+ IDS_DWL_FAILED "Failed to download the Gecko package. Make sure you have an internet connection in order to download it. The setup will proceed without installing Gecko."
IDS_CANTMAKEINETSHORTCUT "Nie można utworzyć skrótu internetowego."
IDS_CANTMAKESHORTCUT "Nie można utworzyć skrótu."
END
diff --git a/dll/cpl/appwiz/lang/pt-BR.rc b/dll/cpl/appwiz/lang/pt-BR.rc
index cbfebd02c4..9d72434002 100644
--- a/dll/cpl/appwiz/lang/pt-BR.rc
+++ b/dll/cpl/appwiz/lang/pt-BR.rc
@@ -81,6 +81,7 @@ BEGIN
IDS_INSTALLING "Installing..."
IDS_INVALID_SHA "Unexpected checksum of downloaded file. Aborting installation of corrupted file."
IDS_NEW_INTERNET_SHORTCUT "New Internet Shortcut"
+ IDS_DWL_FAILED "Failed to download the Gecko package. Make sure you have an internet connection in order to download it. The setup will proceed without installing Gecko."
IDS_CANTMAKEINETSHORTCUT "Failed to create internet shortcut."
IDS_CANTMAKESHORTCUT "Failed to create shortcut."
END
diff --git a/dll/cpl/appwiz/lang/ro-RO.rc b/dll/cpl/appwiz/lang/ro-RO.rc
index d009d84519..77fa5e2635 100644
--- a/dll/cpl/appwiz/lang/ro-RO.rc
+++ b/dll/cpl/appwiz/lang/ro-RO.rc
@@ -85,6 +85,7 @@ BEGIN
IDS_INSTALLING "În curs de instalare…"
IDS_INVALID_SHA "Suma de control a fișierului descărcat nu corespunde. Deoarece fișierul a fost corupt, instalarea trebuie abandonată."
IDS_NEW_INTERNET_SHORTCUT "Creare scurtătură la Internet"
+ IDS_DWL_FAILED "Failed to download the Gecko package. Make sure you have an internet connection in order to download it. The setup will proceed without installing Gecko."
IDS_CANTMAKEINETSHORTCUT "Eșec în crearea scurtăturii la Internet."
IDS_CANTMAKESHORTCUT "Eșec în crearea scurtăturii."
END
diff --git a/dll/cpl/appwiz/lang/ru-RU.rc b/dll/cpl/appwiz/lang/ru-RU.rc
index aae79bc685..4c7e2fd1b7 100644
--- a/dll/cpl/appwiz/lang/ru-RU.rc
+++ b/dll/cpl/appwiz/lang/ru-RU.rc
@@ -79,6 +79,7 @@ BEGIN
IDS_INSTALLING "Установка..."
IDS_INVALID_SHA "Ошибка контрольной суммы загруженного файла. Прерывание установки поврежденного файла."
IDS_NEW_INTERNET_SHORTCUT "New Internet Shortcut"
+ IDS_DWL_FAILED "Failed to download the Gecko package. Make sure you have an internet connection in order to download it. The setup will proceed without installing Gecko."
IDS_CANTMAKEINETSHORTCUT "Failed to create internet shortcut."
IDS_CANTMAKESHORTCUT "Failed to create shortcut."
END
diff --git a/dll/cpl/appwiz/lang/sk-SK.rc b/dll/cpl/appwiz/lang/sk-SK.rc
index 5fb25dd6d9..e17a74484f 100644
--- a/dll/cpl/appwiz/lang/sk-SK.rc
+++ b/dll/cpl/appwiz/lang/sk-SK.rc
@@ -83,6 +83,7 @@ BEGIN
IDS_INSTALLING "Installing..."
IDS_INVALID_SHA "Unexpected checksum of downloaded file. Aborting installation of corrupted file."
IDS_NEW_INTERNET_SHORTCUT "New Internet Shortcut"
+ IDS_DWL_FAILED "Failed to download the Gecko package. Make sure you have an internet connection in order to download it. The setup will proceed without installing Gecko."
IDS_CANTMAKEINETSHORTCUT "Failed to create internet shortcut."
IDS_CANTMAKESHORTCUT "Failed to create shortcut."
END
diff --git a/dll/cpl/appwiz/lang/sq-AL.rc b/dll/cpl/appwiz/lang/sq-AL.rc
index 4bdac0270e..cc374b659a 100644
--- a/dll/cpl/appwiz/lang/sq-AL.rc
+++ b/dll/cpl/appwiz/lang/sq-AL.rc
@@ -83,6 +83,7 @@ BEGIN
IDS_INSTALLING "Instalim..."
IDS_INVALID_SHA "Kontroll i papritur ne shkarkimin e skedarit. Duke lënë instalimin e dokumentave të korruptuar."
IDS_NEW_INTERNET_SHORTCUT "New Internet Shortcut"
+ IDS_DWL_FAILED "Failed to download the Gecko package. Make sure you have an internet connection in order to download it. The setup will proceed without installing Gecko."
IDS_CANTMAKEINETSHORTCUT "Failed to create internet shortcut."
IDS_CANTMAKESHORTCUT "Failed to create shortcut."
END
diff --git a/dll/cpl/appwiz/lang/tr-TR.rc b/dll/cpl/appwiz/lang/tr-TR.rc
index 8c9f6573b9..3e3c2b3ade 100644
--- a/dll/cpl/appwiz/lang/tr-TR.rc
+++ b/dll/cpl/appwiz/lang/tr-TR.rc
@@ -81,6 +81,7 @@ BEGIN
IDS_INSTALLING "Kuruluyor..."
IDS_INVALID_SHA "İndirilen kütüğün sağlama toplamı beklenmeyen. Bozuk kütüğün kurulumu iptal ediliyor."
IDS_NEW_INTERNET_SHORTCUT "New Internet Shortcut"
+ IDS_DWL_FAILED "Failed to download the Gecko package. Make sure you have an internet connection in order to download it. The setup will proceed without installing Gecko."
IDS_CANTMAKEINETSHORTCUT "Failed to create internet shortcut."
IDS_CANTMAKESHORTCUT "Failed to create shortcut."
END
diff --git a/dll/cpl/appwiz/lang/uk-UA.rc b/dll/cpl/appwiz/lang/uk-UA.rc
index 94d1d23ef4..36c8a2afa5 100644
--- a/dll/cpl/appwiz/lang/uk-UA.rc
+++ b/dll/cpl/appwiz/lang/uk-UA.rc
@@ -87,6 +87,7 @@ BEGIN
IDS_INSTALLING "Installing..."
IDS_INVALID_SHA "Unexpected checksum of downloaded file. Aborting installation of corrupted file."
IDS_NEW_INTERNET_SHORTCUT "New Internet Shortcut"
+ IDS_DWL_FAILED "Failed to download the Gecko package. Make sure you have an internet connection in order to download it. The setup will proceed without installing Gecko."
IDS_CANTMAKEINETSHORTCUT "Failed to create internet shortcut."
IDS_CANTMAKESHORTCUT "Failed to create shortcut."
END
diff --git a/dll/cpl/appwiz/lang/zh-CN.rc b/dll/cpl/appwiz/lang/zh-CN.rc
index 4be6c8bcef..a8d9a7a3ee 100644
--- a/dll/cpl/appwiz/lang/zh-CN.rc
+++ b/dll/cpl/appwiz/lang/zh-CN.rc
@@ -88,6 +88,7 @@ BEGIN
IDS_INSTALLING "正在安装..."
IDS_INVALID_SHA "下载的文件校验和错误。中止安装已损坏的文件。"
IDS_NEW_INTERNET_SHORTCUT "New Internet Shortcut"
+ IDS_DWL_FAILED "Failed to download the Gecko package. Make sure you have an internet connection in order to download it. The setup will proceed without installing Gecko."
IDS_CANTMAKEINETSHORTCUT "Failed to create internet shortcut."
IDS_CANTMAKESHORTCUT "Failed to create shortcut."
END
diff --git a/dll/cpl/appwiz/lang/zh-TW.rc b/dll/cpl/appwiz/lang/zh-TW.rc
index b123d0f91e..d3090e83a6 100644
--- a/dll/cpl/appwiz/lang/zh-TW.rc
+++ b/dll/cpl/appwiz/lang/zh-TW.rc
@@ -86,6 +86,7 @@ BEGIN
IDS_INSTALLING "安裝中..."
IDS_INVALID_SHA "意外的下載了的檔案的校驗和。中止安裝已損壞的檔案。"
IDS_NEW_INTERNET_SHORTCUT "New Internet Shortcut"
+ IDS_DWL_FAILED "Failed to download the Gecko package. Make sure you have an internet connection in order to download it. The setup will proceed without installing Gecko."
IDS_CANTMAKEINETSHORTCUT "Failed to create internet shortcut."
IDS_CANTMAKESHORTCUT "Failed to create shortcut."
END
diff --git a/dll/cpl/appwiz/resource.h b/dll/cpl/appwiz/resource.h
index 3df2999642..c4119aa4bc 100644
--- a/dll/cpl/appwiz/resource.h
+++ b/dll/cpl/appwiz/resource.h
@@ -29,6 +29,7 @@
#define IDS_DOWNLOADING 14
#define IDS_INSTALLING 15
#define IDS_INVALID_SHA 16
+#define IDS_DWL_FAILED 17
/* Controls */
#define IDC_SHORTCUT_LOCATION 107
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=2cbac3d049c7b3b1e6833…
commit 2cbac3d049c7b3b1e6833ab092a8a2cff9a7771f
Author: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
AuthorDate: Mon Oct 8 00:42:02 2018 +0200
Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
CommitDate: Mon Oct 8 00:50:38 2018 +0200
[SHELL32] Finally fix the icon location path (un)expansion for shell links, and explain why I originally used SHExpandEnvironmentStringsW().
CORE-14009 CORE-14982
---
dll/win32/shell32/CShellLink.cpp | 71 +++++++++++++++++++++++++++++++---------
1 file changed, 55 insertions(+), 16 deletions(-)
diff --git a/dll/win32/shell32/CShellLink.cpp b/dll/win32/shell32/CShellLink.cpp
index 92f62961cf..fa1adab35f 100644
--- a/dll/win32/shell32/CShellLink.cpp
+++ b/dll/win32/shell32/CShellLink.cpp
@@ -143,6 +143,14 @@
WINE_DEFAULT_DEBUG_CHANNEL(shell);
+/*
+ * Allows to define whether or not Windows-compatible behaviour
+ * should be adopted when setting and retrieving icon location paths.
+ * See CShellLink::SetIconLocation(LPCWSTR pszIconPath, INT iIcon)
+ * for more details.
+ */
+#define ICON_LINK_WINDOWS_COMPAT
+
#define SHLINK_LOCAL 0
#define SHLINK_REMOTE 1
@@ -1715,7 +1723,7 @@ HRESULT STDMETHODCALLTYPE CShellLink::GetIconLocation(UINT uFlags, PWSTR pszIcon
uFlags |= GIL_FORSHORTCUT;
if (uFlags & GIL_DEFAULTICON)
- return E_FAIL;
+ return S_FALSE;
hr = GetIconLocation(pszIconFile, cchMax, piIndex);
if (FAILED(hr) || pszIconFile[0] == UNICODE_NULL)
@@ -1849,15 +1857,12 @@ BOOL PathFullyUnExpandEnvStringsW(
HRESULT STDMETHODCALLTYPE CShellLink::SetIconLocation(LPCWSTR pszIconPath, INT iIcon)
{
HRESULT hr = E_FAIL;
- WCHAR szUnExpIconPath[MAX_PATH];
- BOOL bSuccess;
+ WCHAR szIconPath[MAX_PATH];
TRACE("(%p)->(path=%s iicon=%u)\n", this, debugstr_w(pszIconPath), iIcon);
if (pszIconPath)
{
- /* Try to fully unexpand the icon path */
-
/*
* Check whether the user-given file path contains unexpanded
* environment variables. If so, create a target environment block.
@@ -1868,16 +1873,35 @@ HRESULT STDMETHODCALLTYPE CShellLink::SetIconLocation(LPCWSTR pszIconPath, INT i
* refer to the same place even if the would-be corresponding
* environment variable could change).
*/
- // FIXME: http://stackoverflow.com/questions/2976489/ishelllinkseticonlocation-transl…
- // if (PathFullyUnExpandEnvStringsW(pszIconPath, szUnExpIconPath, _countof(szUnExpIconPath)))
- bSuccess = PathUnExpandEnvStringsW(pszIconPath, szUnExpIconPath, _countof(szUnExpIconPath));
- if (bSuccess && wcscmp(pszIconPath, szUnExpIconPath) != 0)
+#ifdef ICON_LINK_WINDOWS_COMPAT
+ /* Try to fully unexpand the icon path */
+ // if (PathFullyUnExpandEnvStringsW(pszIconPath, szIconPath, _countof(szIconPath)))
+ BOOL bSuccess = PathUnExpandEnvStringsW(pszIconPath, szIconPath, _countof(szIconPath));
+ if (bSuccess && wcscmp(pszIconPath, szIconPath) != 0)
+#else
+ /*
+ * In some situations, described in http://stackoverflow.com/questions/2976489/ishelllinkseticonlocation-transl…
+ * the result of PathUnExpandEnvStringsW() could be wrong, and instead
+ * one would have to store the actual provided icon location path, while
+ * creating an icon environment block ONLY if that path already contains
+ * environment variables. This is what the present case is trying to implement.
+ */
+ SHExpandEnvironmentStringsW(pszIconPath, szIconPath, _countof(szIconPath));
+ if (wcscmp(pszIconPath, szIconPath) != 0)
+#endif
{
- /* Unexpansion succeeded, so we need an icon environment block */
+ /*
+ * The user-given file path contains unexpanded environment
+ * variables, so we need an icon environment block.
+ */
EXP_SZ_LINK buffer;
LPEXP_SZ_LINK pInfo;
- pszIconPath = szUnExpIconPath;
+#ifdef ICON_LINK_WINDOWS_COMPAT
+ /* Make pszIconPath point to the unexpanded path */
+ LPCWSTR pszOrgIconPath = pszIconPath;
+ pszIconPath = szIconPath;
+#endif
pInfo = (LPEXP_SZ_LINK)SHFindDataBlock(m_pDBList, EXP_SZ_ICON_SIG);
if (pInfo)
{
@@ -1902,8 +1926,8 @@ HRESULT STDMETHODCALLTYPE CShellLink::SetIconLocation(LPCWSTR pszIconPath, INT i
buffer.dwSignature = EXP_SZ_ICON_SIG;
}
- lstrcpynW(pInfo->szwTarget, szUnExpIconPath, _countof(pInfo->szwTarget));
- WideCharToMultiByte(CP_ACP, 0, szUnExpIconPath, -1,
+ lstrcpynW(pInfo->szwTarget, pszIconPath, _countof(pInfo->szwTarget));
+ WideCharToMultiByte(CP_ACP, 0, pszIconPath, -1,
pInfo->szTarget, _countof(pInfo->szTarget), NULL, NULL);
hr = S_OK;
@@ -1911,16 +1935,31 @@ HRESULT STDMETHODCALLTYPE CShellLink::SetIconLocation(LPCWSTR pszIconPath, INT i
hr = AddDataBlock(pInfo);
if (hr == S_OK)
m_Header.dwFlags |= SLDF_HAS_EXP_ICON_SZ;
+
+#ifdef ICON_LINK_WINDOWS_COMPAT
+ /* Set pszIconPath back to the original one */
+ pszIconPath = pszOrgIconPath;
+#else
+ /* Now, make pszIconPath point to the expanded path */
+ pszIconPath = szIconPath;
+#endif
}
else
{
- /* Unexpansion failed, so we need to remove any icon environment block */
+ /*
+ * The user-given file path does not contain unexpanded environment
+ * variables, so we need to remove any icon environment block.
+ */
m_Header.dwFlags &= ~SLDF_HAS_EXP_ICON_SZ;
RemoveDataBlock(EXP_SZ_ICON_SIG);
+
+ /* pszIconPath points to the user path */
}
}
- /* Store the original icon path location (this one may contain unexpanded environment strings) */
+#ifdef ICON_LINK_WINDOWS_COMPAT
+ /* Store the original icon path location (may contain unexpanded environment strings) */
+#endif
if (pszIconPath)
{
m_Header.dwFlags &= ~SLDF_HAS_ICONLOCATION;
@@ -2404,7 +2443,7 @@ HRESULT STDMETHODCALLTYPE CShellLink::SetPath(LPCWSTR pszFile)
if (hr == S_OK)
m_Header.dwFlags |= SLDF_HAS_EXP_SZ;
- /* Now, make pszFile point to the expanded buffer */
+ /* Now, make pszFile point to the expanded path */
pszFile = szPath;
}
else