https://git.reactos.org/?p=reactos.git;a=commitdiff;h=d8e47d61d472519c0ee34…
commit d8e47d61d472519c0ee34dcdc1f22a49f0d7a050
Author: Charles Ambrye <giawa(a)hotmail.com>
AuthorDate: Sun Apr 19 12:48:14 2020 -0700
Commit: Giannis Adamopoulos <gadamopoulos(a)reactos.org>
CommitDate: Mon Apr 20 14:21:37 2020 +0300
[BROWSEUI] Display an error message if the path or drive don't exist (CORE-10989)
The return result of ParseNow was never checked, but contained useful information on
what type of error may have occurred. If the error is an issue with the path not existing
the explorer will now show an error message notifying the user of the problem instead of
silently failing.
Note: Shell32 does not properly return ERROR_INVALID_DRIVE when the drive path does
not exist. For that reason, it is still possible to browse to a non-existent drive.
However, once shell32 is patched this code will work properly, as it checks for both
ERROR_INVALID_DRIVE and ERROR_FILE_NOT_FOUND.
---
dll/win32/browseui/addresseditbox.cpp | 21 ++++++++++++++++++++-
dll/win32/browseui/addresseditbox.h | 1 +
dll/win32/browseui/lang/bg-BG.rc | 6 ++++++
dll/win32/browseui/lang/de-DE.rc | 6 ++++++
dll/win32/browseui/lang/en-US.rc | 6 ++++++
dll/win32/browseui/lang/es-ES.rc | 6 ++++++
dll/win32/browseui/lang/et-EE.rc | 6 ++++++
dll/win32/browseui/lang/fr-FR.rc | 6 ++++++
dll/win32/browseui/lang/he-IL.rc | 6 ++++++
dll/win32/browseui/lang/hi-IN.rc | 6 ++++++
dll/win32/browseui/lang/hu-HU.rc | 6 ++++++
dll/win32/browseui/lang/id-ID.rc | 6 ++++++
dll/win32/browseui/lang/it-IT.rc | 6 ++++++
dll/win32/browseui/lang/ja-JP.rc | 6 ++++++
dll/win32/browseui/lang/pl-PL.rc | 6 ++++++
dll/win32/browseui/lang/pt-BR.rc | 6 ++++++
dll/win32/browseui/lang/pt-PT.rc | 6 ++++++
dll/win32/browseui/lang/ro-RO.rc | 6 ++++++
dll/win32/browseui/lang/ru-RU.rc | 6 ++++++
dll/win32/browseui/lang/sq-AL.rc | 6 ++++++
dll/win32/browseui/lang/tr-TR.rc | 6 ++++++
dll/win32/browseui/lang/uk-UA.rc | 6 ++++++
dll/win32/browseui/lang/zh-CN.rc | 6 ++++++
dll/win32/browseui/lang/zh-TW.rc | 6 ++++++
dll/win32/browseui/resource.h | 3 +++
25 files changed, 156 insertions(+), 1 deletion(-)
diff --git a/dll/win32/browseui/addresseditbox.cpp
b/dll/win32/browseui/addresseditbox.cpp
index 5d96b896171..f3d7bc20008 100644
--- a/dll/win32/browseui/addresseditbox.cpp
+++ b/dll/win32/browseui/addresseditbox.cpp
@@ -174,6 +174,19 @@ cleanup:
return hr;
}
+HRESULT STDMETHODCALLTYPE CAddressEditBox::ShowFileNotFoundError(HRESULT hRet)
+{
+ CComHeapPtr<WCHAR> input;
+ int inputLength = fCombobox.GetWindowTextLength() + 2;
+
+ input.Allocate(inputLength);
+ fCombobox.GetWindowText(input, inputLength);
+
+ ShellMessageBoxW(_AtlBaseModule.GetResourceInstance(), fCombobox.m_hWnd,
MAKEINTRESOURCEW(IDS_PARSE_ADDR_ERR_TEXT), MAKEINTRESOURCEW(IDS_PARSE_ADDR_ERR_TITLE),
MB_OK | MB_ICONERROR, input.m_pData);
+
+ return hRet;
+}
+
HRESULT STDMETHODCALLTYPE CAddressEditBox::Execute(long paramC)
{
HRESULT hr;
@@ -182,7 +195,13 @@ HRESULT STDMETHODCALLTYPE CAddressEditBox::Execute(long paramC)
* Parse the path is it wasn't parsed
*/
if (!pidlLastParsed)
- ParseNow(0);
+ hr = ParseNow(0);
+
+ /*
+ * If the destination path doesn't exist then display an error message
+ */
+ if (hr == HRESULT_FROM_WIN32(ERROR_INVALID_DRIVE) || hr ==
HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND))
+ return ShowFileNotFoundError(hr);
if (!pidlLastParsed)
return E_FAIL;
diff --git a/dll/win32/browseui/addresseditbox.h b/dll/win32/browseui/addresseditbox.h
index ba03aa821fa..4b56a0f997b 100644
--- a/dll/win32/browseui/addresseditbox.h
+++ b/dll/win32/browseui/addresseditbox.h
@@ -47,6 +47,7 @@ private:
void AddComboBoxItem(LPITEMIDLIST pidl, int index, int indent);
void FillOneLevel(int index, int levelIndent, int indent);
LPITEMIDLIST GetItemData(int index);
+ HRESULT STDMETHODCALLTYPE ShowFileNotFoundError(HRESULT hRet);
public:
// *** IShellService methods ***
virtual HRESULT STDMETHODCALLTYPE SetOwner(IUnknown *);
diff --git a/dll/win32/browseui/lang/bg-BG.rc b/dll/win32/browseui/lang/bg-BG.rc
index 2df9859f64e..3499dec9de2 100644
--- a/dll/win32/browseui/lang/bg-BG.rc
+++ b/dll/win32/browseui/lang/bg-BG.rc
@@ -336,3 +336,9 @@ BEGIN
IDS_COL_LOCATION "In Folder"
IDS_COL_RELEVANCE "Relevance"
END
+
+STRINGTABLE
+BEGIN
+ IDS_PARSE_ADDR_ERR_TITLE "ReactOS Explorer"
+ IDS_PARSE_ADDR_ERR_TEXT "ReactOS Explorer cannot find '%1'. Check the
spelling and try again."
+END
diff --git a/dll/win32/browseui/lang/de-DE.rc b/dll/win32/browseui/lang/de-DE.rc
index 99026200bed..9b24f0ad907 100644
--- a/dll/win32/browseui/lang/de-DE.rc
+++ b/dll/win32/browseui/lang/de-DE.rc
@@ -355,3 +355,9 @@ BEGIN
IDS_COL_LOCATION "In Ordner"
IDS_COL_RELEVANCE "Relevanz"
END
+
+STRINGTABLE
+BEGIN
+ IDS_PARSE_ADDR_ERR_TITLE "ReactOS Explorer"
+ IDS_PARSE_ADDR_ERR_TEXT "ReactOS Explorer cannot find '%1'. Check the
spelling and try again."
+END
diff --git a/dll/win32/browseui/lang/en-US.rc b/dll/win32/browseui/lang/en-US.rc
index 9ad03fcd9c5..f0ce4179081 100644
--- a/dll/win32/browseui/lang/en-US.rc
+++ b/dll/win32/browseui/lang/en-US.rc
@@ -354,3 +354,9 @@ BEGIN
IDS_COL_LOCATION "In Folder"
IDS_COL_RELEVANCE "Relevance"
END
+
+STRINGTABLE
+BEGIN
+ IDS_PARSE_ADDR_ERR_TITLE "ReactOS Explorer"
+ IDS_PARSE_ADDR_ERR_TEXT "ReactOS Explorer cannot find '%1'. Check the
spelling and try again."
+END
diff --git a/dll/win32/browseui/lang/es-ES.rc b/dll/win32/browseui/lang/es-ES.rc
index cf9f4b20f37..e757c95ffd8 100644
--- a/dll/win32/browseui/lang/es-ES.rc
+++ b/dll/win32/browseui/lang/es-ES.rc
@@ -345,3 +345,9 @@ BEGIN
IDS_COL_LOCATION "En la carpeta"
IDS_COL_RELEVANCE "Relevancia"
END
+
+STRINGTABLE
+BEGIN
+ IDS_PARSE_ADDR_ERR_TITLE "ReactOS Explorer"
+ IDS_PARSE_ADDR_ERR_TEXT "ReactOS Explorer cannot find '%1'. Check the
spelling and try again."
+END
diff --git a/dll/win32/browseui/lang/et-EE.rc b/dll/win32/browseui/lang/et-EE.rc
index 9de2b95a55f..4a27091eb6b 100644
--- a/dll/win32/browseui/lang/et-EE.rc
+++ b/dll/win32/browseui/lang/et-EE.rc
@@ -343,3 +343,9 @@ BEGIN
IDS_COL_LOCATION "In Folder"
IDS_COL_RELEVANCE "Relevance"
END
+
+STRINGTABLE
+BEGIN
+ IDS_PARSE_ADDR_ERR_TITLE "ReactOS Explorer"
+ IDS_PARSE_ADDR_ERR_TEXT "ReactOS Explorer cannot find '%1'. Check the
spelling and try again."
+END
diff --git a/dll/win32/browseui/lang/fr-FR.rc b/dll/win32/browseui/lang/fr-FR.rc
index 2185583ad6d..5f3d9b568ea 100644
--- a/dll/win32/browseui/lang/fr-FR.rc
+++ b/dll/win32/browseui/lang/fr-FR.rc
@@ -354,3 +354,9 @@ BEGIN
IDS_COL_LOCATION "Dans le dossier"
IDS_COL_RELEVANCE "Pertinence"
END
+
+STRINGTABLE
+BEGIN
+ IDS_PARSE_ADDR_ERR_TITLE "Explorateur ReactOS"
+ IDS_PARSE_ADDR_ERR_TEXT "L'explorateur ReactOS ne peut trouver '%1'.
Veuillez vérifier l'orthographe et réessayer."
+END
diff --git a/dll/win32/browseui/lang/he-IL.rc b/dll/win32/browseui/lang/he-IL.rc
index 03d5366197b..f235d3420a1 100644
--- a/dll/win32/browseui/lang/he-IL.rc
+++ b/dll/win32/browseui/lang/he-IL.rc
@@ -338,3 +338,9 @@ BEGIN
IDS_COL_LOCATION "בתיקיה"
IDS_COL_RELEVANCE "רלוונטיות"
END
+
+STRINGTABLE
+BEGIN
+ IDS_PARSE_ADDR_ERR_TITLE "ReactOS Explorer"
+ IDS_PARSE_ADDR_ERR_TEXT "ReactOS Explorer cannot find '%1'. Check the
spelling and try again."
+END
diff --git a/dll/win32/browseui/lang/hi-IN.rc b/dll/win32/browseui/lang/hi-IN.rc
index 75a2008e5f3..2016cfa623a 100644
--- a/dll/win32/browseui/lang/hi-IN.rc
+++ b/dll/win32/browseui/lang/hi-IN.rc
@@ -336,3 +336,9 @@ BEGIN
IDS_COL_LOCATION "In Folder"
IDS_COL_RELEVANCE "Relevance"
END
+
+STRINGTABLE
+BEGIN
+ IDS_PARSE_ADDR_ERR_TITLE "ReactOS Explorer"
+ IDS_PARSE_ADDR_ERR_TEXT "ReactOS Explorer cannot find '%1'. Check the
spelling and try again."
+END
diff --git a/dll/win32/browseui/lang/hu-HU.rc b/dll/win32/browseui/lang/hu-HU.rc
index 812cc58a33f..226102189a6 100644
--- a/dll/win32/browseui/lang/hu-HU.rc
+++ b/dll/win32/browseui/lang/hu-HU.rc
@@ -354,3 +354,9 @@ BEGIN
IDS_COL_LOCATION "In Folder"
IDS_COL_RELEVANCE "Relevance"
END
+
+STRINGTABLE
+BEGIN
+ IDS_PARSE_ADDR_ERR_TITLE "ReactOS Explorer"
+ IDS_PARSE_ADDR_ERR_TEXT "ReactOS Explorer cannot find '%1'. Check the
spelling and try again."
+END
diff --git a/dll/win32/browseui/lang/id-ID.rc b/dll/win32/browseui/lang/id-ID.rc
index cf1729e3716..2ef4668ac1f 100644
--- a/dll/win32/browseui/lang/id-ID.rc
+++ b/dll/win32/browseui/lang/id-ID.rc
@@ -354,3 +354,9 @@ BEGIN
IDS_COL_LOCATION "Dalam Folder"
IDS_COL_RELEVANCE "Relevansi"
END
+
+STRINGTABLE
+BEGIN
+ IDS_PARSE_ADDR_ERR_TITLE "ReactOS Explorer"
+ IDS_PARSE_ADDR_ERR_TEXT "ReactOS Explorer cannot find '%1'. Check the
spelling and try again."
+END
diff --git a/dll/win32/browseui/lang/it-IT.rc b/dll/win32/browseui/lang/it-IT.rc
index 1fc6d3f8451..b50dca4a41b 100644
--- a/dll/win32/browseui/lang/it-IT.rc
+++ b/dll/win32/browseui/lang/it-IT.rc
@@ -336,3 +336,9 @@ BEGIN
IDS_COL_LOCATION "In Folder"
IDS_COL_RELEVANCE "Relevance"
END
+
+STRINGTABLE
+BEGIN
+ IDS_PARSE_ADDR_ERR_TITLE "ReactOS Explorer"
+ IDS_PARSE_ADDR_ERR_TEXT "ReactOS Explorer cannot find '%1'. Check the
spelling and try again."
+END
diff --git a/dll/win32/browseui/lang/ja-JP.rc b/dll/win32/browseui/lang/ja-JP.rc
index 46e37f04d22..aac4a1e3105 100644
--- a/dll/win32/browseui/lang/ja-JP.rc
+++ b/dll/win32/browseui/lang/ja-JP.rc
@@ -354,3 +354,9 @@ BEGIN
IDS_COL_LOCATION "場所"
IDS_COL_RELEVANCE "関連"
END
+
+STRINGTABLE
+BEGIN
+ IDS_PARSE_ADDR_ERR_TITLE "ReactOS Explorer"
+ IDS_PARSE_ADDR_ERR_TEXT "ReactOS Explorer cannot find '%1'. Check the
spelling and try again."
+END
diff --git a/dll/win32/browseui/lang/pl-PL.rc b/dll/win32/browseui/lang/pl-PL.rc
index 7333f5e58f7..22f3ac24444 100644
--- a/dll/win32/browseui/lang/pl-PL.rc
+++ b/dll/win32/browseui/lang/pl-PL.rc
@@ -344,3 +344,9 @@ BEGIN
IDS_COL_LOCATION "W folderze"
IDS_COL_RELEVANCE "Istotność"
END
+
+STRINGTABLE
+BEGIN
+ IDS_PARSE_ADDR_ERR_TITLE "ReactOS Explorer"
+ IDS_PARSE_ADDR_ERR_TEXT "ReactOS Explorer cannot find '%1'. Check the
spelling and try again."
+END
diff --git a/dll/win32/browseui/lang/pt-BR.rc b/dll/win32/browseui/lang/pt-BR.rc
index 819760b7ee3..569e93dfa07 100644
--- a/dll/win32/browseui/lang/pt-BR.rc
+++ b/dll/win32/browseui/lang/pt-BR.rc
@@ -338,3 +338,9 @@ BEGIN
IDS_COL_LOCATION "In Folder"
IDS_COL_RELEVANCE "Relevance"
END
+
+STRINGTABLE
+BEGIN
+ IDS_PARSE_ADDR_ERR_TITLE "ReactOS Explorer"
+ IDS_PARSE_ADDR_ERR_TEXT "ReactOS Explorer cannot find '%1'. Check the
spelling and try again."
+END
diff --git a/dll/win32/browseui/lang/pt-PT.rc b/dll/win32/browseui/lang/pt-PT.rc
index 2c4cdfe0c28..6c1cf775698 100644
--- a/dll/win32/browseui/lang/pt-PT.rc
+++ b/dll/win32/browseui/lang/pt-PT.rc
@@ -338,3 +338,9 @@ BEGIN
IDS_COL_LOCATION "In Folder"
IDS_COL_RELEVANCE "Relevance"
END
+
+STRINGTABLE
+BEGIN
+ IDS_PARSE_ADDR_ERR_TITLE "ReactOS Explorer"
+ IDS_PARSE_ADDR_ERR_TEXT "ReactOS Explorer cannot find '%1'. Check the
spelling and try again."
+END
diff --git a/dll/win32/browseui/lang/ro-RO.rc b/dll/win32/browseui/lang/ro-RO.rc
index 3be6b38605d..89dcae38e1f 100644
--- a/dll/win32/browseui/lang/ro-RO.rc
+++ b/dll/win32/browseui/lang/ro-RO.rc
@@ -338,3 +338,9 @@ BEGIN
IDS_COL_LOCATION "In Folder"
IDS_COL_RELEVANCE "Relevance"
END
+
+STRINGTABLE
+BEGIN
+ IDS_PARSE_ADDR_ERR_TITLE "ReactOS Explorer"
+ IDS_PARSE_ADDR_ERR_TEXT "ReactOS Explorer cannot find '%1'. Check the
spelling and try again."
+END
diff --git a/dll/win32/browseui/lang/ru-RU.rc b/dll/win32/browseui/lang/ru-RU.rc
index fd74f6d4ca3..43a3bba5d95 100644
--- a/dll/win32/browseui/lang/ru-RU.rc
+++ b/dll/win32/browseui/lang/ru-RU.rc
@@ -345,3 +345,9 @@ BEGIN
IDS_COL_LOCATION "В папке"
IDS_COL_RELEVANCE "Релевантность"
END
+
+STRINGTABLE
+BEGIN
+ IDS_PARSE_ADDR_ERR_TITLE "ReactOS Explorer"
+ IDS_PARSE_ADDR_ERR_TEXT "ReactOS Explorer cannot find '%1'. Check the
spelling and try again."
+END
diff --git a/dll/win32/browseui/lang/sq-AL.rc b/dll/win32/browseui/lang/sq-AL.rc
index 2632c14206f..72e95e50d63 100644
--- a/dll/win32/browseui/lang/sq-AL.rc
+++ b/dll/win32/browseui/lang/sq-AL.rc
@@ -355,3 +355,9 @@ BEGIN
IDS_COL_LOCATION "In Folder"
IDS_COL_RELEVANCE "Relevance"
END
+
+STRINGTABLE
+BEGIN
+ IDS_PARSE_ADDR_ERR_TITLE "ReactOS Explorer"
+ IDS_PARSE_ADDR_ERR_TEXT "ReactOS Explorer cannot find '%1'. Check the
spelling and try again."
+END
diff --git a/dll/win32/browseui/lang/tr-TR.rc b/dll/win32/browseui/lang/tr-TR.rc
index 8f127e2e7cf..fa0a5958e11 100644
--- a/dll/win32/browseui/lang/tr-TR.rc
+++ b/dll/win32/browseui/lang/tr-TR.rc
@@ -338,3 +338,9 @@ BEGIN
IDS_COL_LOCATION "In Folder"
IDS_COL_RELEVANCE "Relevance"
END
+
+STRINGTABLE
+BEGIN
+ IDS_PARSE_ADDR_ERR_TITLE "ReactOS Explorer"
+ IDS_PARSE_ADDR_ERR_TEXT "ReactOS Explorer cannot find '%1'. Check the
spelling and try again."
+END
diff --git a/dll/win32/browseui/lang/uk-UA.rc b/dll/win32/browseui/lang/uk-UA.rc
index 8ef156403e1..c59893b9ab6 100644
--- a/dll/win32/browseui/lang/uk-UA.rc
+++ b/dll/win32/browseui/lang/uk-UA.rc
@@ -344,3 +344,9 @@ BEGIN
IDS_COL_LOCATION "In Folder"
IDS_COL_RELEVANCE "Relevance"
END
+
+STRINGTABLE
+BEGIN
+ IDS_PARSE_ADDR_ERR_TITLE "ReactOS Explorer"
+ IDS_PARSE_ADDR_ERR_TEXT "ReactOS Explorer cannot find '%1'. Check the
spelling and try again."
+END
diff --git a/dll/win32/browseui/lang/zh-CN.rc b/dll/win32/browseui/lang/zh-CN.rc
index 732ffa3acee..bce7c45022a 100644
--- a/dll/win32/browseui/lang/zh-CN.rc
+++ b/dll/win32/browseui/lang/zh-CN.rc
@@ -357,3 +357,9 @@ BEGIN
IDS_COL_LOCATION "In Folder"
IDS_COL_RELEVANCE "Relevance"
END
+
+STRINGTABLE
+BEGIN
+ IDS_PARSE_ADDR_ERR_TITLE "ReactOS Explorer"
+ IDS_PARSE_ADDR_ERR_TEXT "ReactOS Explorer cannot find '%1'. Check the
spelling and try again."
+END
diff --git a/dll/win32/browseui/lang/zh-TW.rc b/dll/win32/browseui/lang/zh-TW.rc
index 00bbfec1fa1..20539a6d6fc 100644
--- a/dll/win32/browseui/lang/zh-TW.rc
+++ b/dll/win32/browseui/lang/zh-TW.rc
@@ -357,3 +357,9 @@ BEGIN
IDS_COL_LOCATION "In Folder"
IDS_COL_RELEVANCE "Relevance"
END
+
+STRINGTABLE
+BEGIN
+ IDS_PARSE_ADDR_ERR_TITLE "ReactOS Explorer"
+ IDS_PARSE_ADDR_ERR_TEXT "ReactOS Explorer cannot find '%1'. Check the
spelling and try again."
+END
diff --git a/dll/win32/browseui/resource.h b/dll/win32/browseui/resource.h
index aba9e2fb8b0..84269b677db 100644
--- a/dll/win32/browseui/resource.h
+++ b/dll/win32/browseui/resource.h
@@ -173,3 +173,6 @@
#define IDS_SEARCH_FOLDER 9234
#define IDS_SEARCH_RESULTS 30520
#define IDS_SEARCH_OPEN_FOLDER 40960
+
+#define IDS_PARSE_ADDR_ERR_TITLE 9600
+#define IDS_PARSE_ADDR_ERR_TEXT 9601