https://git.reactos.org/?p=reactos.git;a=commitdiff;h=4df9355d0c2657062b035…
commit 4df9355d0c2657062b0357829d90b79474c1a26c
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Sat Feb 29 08:08:26 2020 +0900
Commit: GitHub <noreply(a)github.com>
CommitDate: Sat Feb 29 08:08:26 2020 +0900
[SHELL32][BOOTDATA] Unselect filename extension upon renaming (#2398)
You can disable unselecting by setting TRUE to SelectExtOnRename value of
HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer. CORE-15242
---
boot/bootdata/hivedef.inf | 2 +-
dll/win32/shell32/CDefView.cpp | 28 ++++++++++++++++++++++++++++
2 files changed, 29 insertions(+), 1 deletion(-)
diff --git a/boot/bootdata/hivedef.inf b/boot/bootdata/hivedef.inf
index f2a7625204f..45e5d8e64c5 100644
--- a/boot/bootdata/hivedef.inf
+++ b/boot/bootdata/hivedef.inf
@@ -1883,6 +1883,7 @@ HKCU,"SOFTWARE\Classes\Applications",,0x00000012
HKCU,"SOFTWARE\Microsoft\Windows",,0x00000012
HKCU,"SOFTWARE\Microsoft\Windows\CurrentVersion",,0x00000012
HKCU,"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer",,0x00000012
+HKCU,"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer","SelectExtOnRename",0x00010001,0x00000000
HKCU,"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell
Folders",,0x00000012
HKCU,"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell
Folders",,0x00000012
HKCU,"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FileExts",,0x00000012
@@ -1901,7 +1902,6 @@
HKCU,"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\ComDlg32",,0x00000012
HKCU,"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\ComDlg32\LastVisitedMRU",,0x00000012
HKCU,"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\ComDlg32\OpenSaveMRU",,0x00000012
-
; Default shell for the current user (overrides the defaults from the HKLM Winlogon
sub-key)
HKCU,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon",,0x00000012
;HKCU,"SOFTWARE\Microsoft\Windows
NT\CurrentVersion\Winlogon","Shell",0x00020000,"%SystemRoot%\explorer.exe"
diff --git a/dll/win32/shell32/CDefView.cpp b/dll/win32/shell32/CDefView.cpp
index f2cfcead5f7..f2cb36153d9 100644
--- a/dll/win32/shell32/CDefView.cpp
+++ b/dll/win32/shell32/CDefView.cpp
@@ -1783,6 +1783,26 @@ LRESULT CDefView::OnCommand(UINT uMsg, WPARAM wParam, LPARAM
lParam, BOOL &bHand
return 0;
}
+static BOOL
+SelectExtOnRename(void)
+{
+ HKEY hKey;
+ LONG error;
+ DWORD dwValue = FALSE, cbValue;
+
+ error = RegOpenKeyExW(HKEY_CURRENT_USER,
+
L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer",
+ 0, KEY_READ, &hKey);
+ if (error)
+ return dwValue;
+
+ cbValue = sizeof(dwValue);
+ RegQueryValueExW(hKey, L"SelectExtOnRename", NULL, NULL,
(LPBYTE)&dwValue, &cbValue);
+
+ RegCloseKey(hKey);
+ return !!dwValue;
+}
+
/**********************************************************
* ShellView_OnNotify()
*/
@@ -1995,6 +2015,14 @@ LRESULT CDefView::OnNotify(UINT uMsg, WPARAM wParam, LPARAM lParam,
BOOL &bHandl
HWND hEdit =
reinterpret_cast<HWND>(m_ListView.SendMessage(LVM_GETEDITCONTROL));
SHLimitInputEdit(hEdit, m_pSFParent);
+ if (!(dwAttr & SFGAO_LINK) && (lpdi->item.mask &
LVIF_TEXT) && !SelectExtOnRename())
+ {
+ LPWSTR pszText = lpdi->item.pszText;
+ LPWSTR pchDotExt = PathFindExtensionW(pszText);
+ ::PostMessageW(hEdit, EM_SETSEL, 0, pchDotExt - pszText);
+ ::PostMessageW(hEdit, EM_SCROLLCARET, 0, 0);
+ }
+
m_isEditing = TRUE;
return FALSE;
}