diff --git a/CHANGELOG.md b/CHANGELOG.md index 7a16a26..74e24ce 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,6 +36,7 @@ Tested on OS build 22000.376. * Secondary taskbars' context menu is displayed similarly to the primary taskbar's context menu for Windows 10 style (.12) * Safeguards to prevent malicious executions on update mechanism hijacks for systems where User Account Control is disabled (#567) (.13) * Option to prevent certain Control Panel links from being redirected to the Settings app (.14), including in build 22523 (.15) +* Settings are now stored in `HKEY_CURRENT_USER\Software\ExplorerPatcher` so that Windows does not reset them anymore across major OS updates (#576) (.16) #### Simple Window Switcher diff --git a/ExplorerPatcher/GUI.c b/ExplorerPatcher/GUI.c index bde59ff..8c35bcb 100644 --- a/ExplorerPatcher/GUI.c +++ b/ExplorerPatcher/GUI.c @@ -141,6 +141,18 @@ LSTATUS GUI_RegSetValueExW( PostMessageW(FindWindowW(L"Shell_TrayWnd", NULL), WM_COMMAND, 435, 0); return ERROR_SUCCESS; } + else if (!wcscmp(lpValueName, L"Virtualized_" _T(EP_CLSID) L"_Start_MaximumFrequentApps")) + { + RegSetKeyValueW( + HKEY_CURRENT_USER, + TEXT(REGPATH), + L"Start_MaximumFrequentApps", + dwType, + lpData, + cbData + ); + return RegSetValueExW(hKey, L"Start_MaximumFrequentApps", 0, dwType, lpData, cbData); + } } LSTATUS GUI_RegQueryValueExW( @@ -223,6 +235,10 @@ LSTATUS GUI_RegQueryValueExW( { return RegQueryValueExW(hKey, L"PeopleBand", lpReserved, lpType, lpData, lpcbData); } + else if (!wcscmp(lpValueName, L"Virtualized_" _T(EP_CLSID) L"_Start_MaximumFrequentApps")) + { + return RegQueryValueExW(hKey, L"Start_MaximumFrequentApps", lpReserved, lpType, lpData, lpcbData); + } } static HRESULT GUI_AboutProc( diff --git a/ExplorerPatcher/dllmain.c b/ExplorerPatcher/dllmain.c index b750d28..9c0a098 100644 --- a/ExplorerPatcher/dllmain.c +++ b/ExplorerPatcher/dllmain.c @@ -3588,7 +3588,7 @@ void WINAPI LoadSettings(BOOL bIsExplorer) 0, NULL, REG_OPTION_NON_VOLATILE, - KEY_READ | KEY_WOW64_64KEY | KEY_WRITE, + KEY_ALL_ACCESS | KEY_WOW64_64KEY, NULL, &hKey, NULL @@ -3599,6 +3599,49 @@ void WINAPI LoadSettings(BOOL bIsExplorer) } if (hKey) { +#ifdef _WIN64 + dwSize = sizeof(DWORD); + dwTemp = 0; + RegQueryValueExW( + hKey, + TEXT("MigratedFromOldSettings"), + 0, + NULL, + &dwTemp, + &dwSize + ); + if (!dwTemp) + { + HKEY hOldKey = NULL; + RegOpenKeyExW( + HKEY_CURRENT_USER, + TEXT(REGPATH_OLD), + REG_OPTION_NON_VOLATILE, + KEY_ALL_ACCESS | KEY_WOW64_64KEY, + &hOldKey + ); + if (hOldKey == NULL || hOldKey == INVALID_HANDLE_VALUE) + { + hOldKey = NULL; + } + if (hOldKey) + { + if (RegCopyTreeW(hOldKey, NULL, hKey) == ERROR_SUCCESS) + { + RegDeleteKeyExW(hKey, TEXT(STARTDOCKED_SB_NAME), KEY_WOW64_64KEY, 0); + } + } + dwTemp = TRUE; + RegSetValueExW( + hKey, + TEXT("MigratedFromOldSettings"), + 0, + REG_DWORD, + &dwTemp, + sizeof(DWORD) + ); + } +#endif dwSize = sizeof(DWORD); RegQueryValueExW( hKey, @@ -6438,7 +6481,7 @@ void StartMenu_LoadSettings(BOOL bRestartIfChanged) } RegCreateKeyExW( HKEY_CURRENT_USER, - TEXT(REGPATH), + TEXT(REGPATH_STARTMENU), 0, NULL, REG_OPTION_NON_VOLATILE, @@ -6963,7 +7006,7 @@ void InjectStartMenu() settings[2].data = TRUE; settings[2].hEvent = NULL; settings[2].hKey = NULL; - wcscpy_s(settings[2].name, MAX_PATH, TEXT(REGPATH)); + wcscpy_s(settings[2].name, MAX_PATH, TEXT(REGPATH_STARTMENU)); settings[2].origin = HKEY_CURRENT_USER; SettingsChangeParameters* params = calloc(1, sizeof(SettingsChangeParameters)); @@ -6993,7 +7036,7 @@ void InjectStartMenu() dwSize = sizeof(DWORD); SHRegGetValueFromHKCUHKLMFunc( - TEXT(REGPATH) TEXT("\\") TEXT(STARTDOCKED_SB_NAME), + TEXT(REGPATH_STARTMENU) TEXT("\\") TEXT(STARTDOCKED_SB_NAME), TEXT(STARTDOCKED_SB_0), SRRF_RT_REG_DWORD, NULL, @@ -7001,7 +7044,7 @@ void InjectStartMenu() (LPDWORD)(&dwSize) ); SHRegGetValueFromHKCUHKLMFunc( - TEXT(REGPATH) TEXT("\\") TEXT(STARTDOCKED_SB_NAME), + TEXT(REGPATH_STARTMENU) TEXT("\\") TEXT(STARTDOCKED_SB_NAME), TEXT(STARTDOCKED_SB_1), SRRF_RT_REG_DWORD, NULL, @@ -7009,7 +7052,7 @@ void InjectStartMenu() (LPDWORD)(&dwSize) ); SHRegGetValueFromHKCUHKLMFunc( - TEXT(REGPATH) TEXT("\\") TEXT(STARTDOCKED_SB_NAME), + TEXT(REGPATH_STARTMENU) TEXT("\\") TEXT(STARTDOCKED_SB_NAME), TEXT(STARTDOCKED_SB_2), SRRF_RT_REG_DWORD, NULL, @@ -7017,7 +7060,7 @@ void InjectStartMenu() (LPDWORD)(&dwSize) ); SHRegGetValueFromHKCUHKLMFunc( - TEXT(REGPATH) TEXT("\\") TEXT(STARTDOCKED_SB_NAME), + TEXT(REGPATH_STARTMENU) TEXT("\\") TEXT(STARTDOCKED_SB_NAME), TEXT(STARTDOCKED_SB_3), SRRF_RT_REG_DWORD, NULL, @@ -7025,7 +7068,7 @@ void InjectStartMenu() (LPDWORD)(&dwSize) ); SHRegGetValueFromHKCUHKLMFunc( - TEXT(REGPATH) TEXT("\\") TEXT(STARTDOCKED_SB_NAME), + TEXT(REGPATH_STARTMENU) TEXT("\\") TEXT(STARTDOCKED_SB_NAME), TEXT(STARTDOCKED_SB_4), SRRF_RT_REG_DWORD, NULL, diff --git a/ExplorerPatcher/settings.reg b/ExplorerPatcher/settings.reg index 020b182..eeea6c2 100644 --- a/ExplorerPatcher/settings.reg +++ b/ExplorerPatcher/settings.reg @@ -5,7 +5,7 @@ ;T Taskbar -[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\ExplorerPatcher] +[HKEY_CURRENT_USER\Software\ExplorerPatcher] ;z 2 Taskbar style * ;x 0 Windows 11 (default) ;x 1 Windows 10 @@ -17,7 +17,7 @@ ;y Customize system icons in the notification area 🡕 ;shell:::{05d7b0f4-2121-4eff-bf6b-ed3f69b894d9}\SystemIcons ;t The following settings only apply to the Windows 10 taskbar: -;;[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\ExplorerPatcher] +;;[HKEY_CURRENT_USER\Software\ExplorerPatcher] ;;c 2 Start button style * ;;x 0 Windows 10 (default) ;;x 1 Windows 11 @@ -33,7 +33,7 @@ ;x 1 Combine when taskbar is full ;x 2 Never combine "MMTaskbarGlomLevel"=dword:00000002 -[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\ExplorerPatcher] +[HKEY_CURRENT_USER\Software\ExplorerPatcher] ;c 4 Primary taskbar location on screen * ;x 3 Bottom (default) ;x 1 Top @@ -68,10 +68,10 @@ [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced] ;b Show Desktop button "TaskbarSD"=dword:00000001 -[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\ExplorerPatcher] +[HKEY_CURRENT_USER\Software\ExplorerPatcher] ;b Show separators between toolbars * "ToolbarSeparators"=dword:00000000 -[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\ExplorerPatcher] +[HKEY_CURRENT_USER\Software\ExplorerPatcher] ;b Automatically hide the taskbar "Virtualized_{D17F1E1A-5919-4427-8F89-A1A8503CA3EB}_AutoHideTaskbar"=dword:00000000 @@ -79,7 +79,7 @@ [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced] ;b Show seconds in the clock "ShowSecondsInSystemClock"=dword:00000000 -[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\ExplorerPatcher] +[HKEY_CURRENT_USER\Software\ExplorerPatcher] ;b Skin taskbar and tray pop-up menus "SkinMenus"=dword:00000001 ;b Center tray icon pop-up menus @@ -94,7 +94,7 @@ [HKEY_CURRENT_USER\Software\Microsoft\TabletTip\1.7] ;b Show touch keyboard button * "TipbandDesiredVisibility"=dword:00000000 -[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\ExplorerPatcher] +[HKEY_CURRENT_USER\Software\ExplorerPatcher] ;a Choosing 'Open Network && Internet settings' when right clicking the ;c 3 network icon should open: ;x 0 Network section in the Settings app (default) @@ -128,7 +128,7 @@ ;x 0 Windows 10 flyout (default) ;x 1 Windows 7 "UseWin32BatteryFlyout"=dword:00000000 -[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\ExplorerPatcher] +[HKEY_CURRENT_USER\Software\ExplorerPatcher] ;c 6 Language switcher * ;x 0 Windows 11 (default) ;x 1 Windows 10 @@ -146,7 +146,7 @@ [-HKEY_CURRENT_USER\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32] ;d Disable the Windows 11 context menu * @="" -[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\ExplorerPatcher] +[HKEY_CURRENT_USER\Software\ExplorerPatcher] ;i Use immersive menus when displaying Windows 10 context menus ** "DisableImmersiveContextMenu"=dword:00000000 [-HKEY_CURRENT_USER\Software\Classes\CLSID\{056440FD-8568-48e7-A632-72157243B55B}\InprocServer32] @@ -155,7 +155,7 @@ [-HKEY_CURRENT_USER\Software\Classes\CLSID\{1d64637d-31e9-4b06-9124-e83fb178ac6e}\TreatAs] ;d Disable modern search bar @="{64bc32b5-4eec-4de7-972d-bd8bd0324537}" -[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\ExplorerPatcher] +[HKEY_CURRENT_USER\Software\ExplorerPatcher] ;b Hide search bar completely ** "HideExplorerSearchBar"=dword:00000000 ;p 2 @@ -203,7 +203,7 @@ ;x 19 19 ;x 20 20 ;x 99999 Unlimited -"Start_MaximumFrequentApps"=dword:00000006 +"Virtualized_{D17F1E1A-5919-4427-8F89-A1A8503CA3EB}_Start_MaximumFrequentApps"=dword:00000006 [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced] ;c 2 Position on screen ;x 0 Left @@ -220,7 +220,7 @@ ;x 2 Simple Window Switcher "AltTabSettings"=dword:00000000 ;t The following settings only apply to the Simple Window Switcher: -[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\ExplorerPatcher\sws] +[HKEY_CURRENT_USER\Software\ExplorerPatcher\sws] ;b Include desktop "IncludeWallpaper"=dword:00000001 ;b Always show on primary monitor @@ -256,19 +256,19 @@ ;x 35 35 % ;x 30 30 % "Grid_backgroundPercent"=dword:0000005F -[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\ExplorerPatcher\sws] +[HKEY_CURRENT_USER\Software\ExplorerPatcher\sws] ;c 3 Color scheme ;x 0 Follow system setting (default) ;x 1 Light ;x 2 Dark "ColorScheme"=dword:00000000 -[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\ExplorerPatcher\sws] +[HKEY_CURRENT_USER\Software\ExplorerPatcher\sws] ;c 3 Corner preference ;x 2 Rounded (default) ;x 3 Small rounded ;x 1 Not rounded "CornerPreference"=dword:00000002 -[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\ExplorerPatcher\sws] +[HKEY_CURRENT_USER\Software\ExplorerPatcher\sws] ;c 20 Row height ;x 330 330 pt ;x 320 320 pt @@ -346,7 +346,7 @@ ;https://github.com/valinet/ExplorerPatcher/wiki/Simple-Window-Switcher ;T Other -[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\ExplorerPatcher] +[HKEY_CURRENT_USER\Software\ExplorerPatcher] ;b Remember last used section in this window "LastSectionInProperties"=dword:00000000 ;b Open clock flyout when pressing Win+C instead of Microsoft Teams @@ -356,7 +356,7 @@ [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced] ;b Show Command Prompt instead of PowerShell in Win+X menu * "DontUsePowerShellOnWinX"=dword:00000000 -[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\ExplorerPatcher] +[HKEY_CURRENT_USER\Software\ExplorerPatcher] ;b Add shortcut to program settings in Win+X menu "PropertiesInWinX"=dword:00000000 ;b Remove shortcut key from program settings item in Win+X menu @@ -370,13 +370,13 @@ ;x 2 Shut down (default) ;x 4 Restart "Start_PowerButtonAction"=dword:00000002 -[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\ExplorerPatcher] +[HKEY_CURRENT_USER\Software\ExplorerPatcher] ;c 2 Snap Assist style ;x 0 Windows 11 (default) ;x 3 Windows 10 "SnapAssistSettings"=dword:00000000 ;t Prevent the following Control Panel links from being redirected to the Settings app: -[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\ExplorerPatcher] +[HKEY_CURRENT_USER\Software\ExplorerPatcher] ;b System / About page "DoNotRedirectSystemToSettingsApp"=dword:00000000 ;b Programs and Features @@ -388,7 +388,7 @@ ;T Updates -[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\ExplorerPatcher] +[HKEY_CURRENT_USER\Software\ExplorerPatcher] ;z 3 When File Explorer starts ;x 1 Notify about available updates (default) ;x 0 Prompt to install available updates @@ -408,7 +408,7 @@ ;T Advanced -[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\ExplorerPatcher] +[HKEY_CURRENT_USER\Software\ExplorerPatcher] ;b Enable console "AllocConsole"=dword:00000000 ;b Dump memory leaks @@ -416,13 +416,13 @@ [HKEY_CURRENT_USER\Control Panel\Desktop] ;b Show Windows build info on the desktop * "PaintDesktopversion"=dword:00000000 -[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\ExplorerPatcher] +[HKEY_CURRENT_USER\Software\ExplorerPatcher] ;b Enable advanced mitigations for correct rendering using classic theme * "ClassicThemeMitigations"=dword:00000000 [-HKEY_CURRENT_USER\Software\Classes\CLSID\{1eeb5b5a-06fb-4732-96b3-975c0194eb39}\InprocServer32] ;d Enable SysListView32 for Explorer views * @="" -[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\ExplorerPatcher] +[HKEY_CURRENT_USER\Software\ExplorerPatcher] ;b Enable symbols download * "EnableSymbolDownload"=dword:00000001 ;i Do not hook Start menu from main Explorer process (permanently disabled) * diff --git a/ExplorerPatcher/symbols.c b/ExplorerPatcher/symbols.c index f49143b..80c6c74 100644 --- a/ExplorerPatcher/symbols.c +++ b/ExplorerPatcher/symbols.c @@ -401,7 +401,7 @@ DWORD DownloadSymbols(DownloadSymbolsParams* params) } RegCreateKeyExW( HKEY_CURRENT_USER, - TEXT(REGPATH) L"\\" TEXT(STARTDOCKED_SB_NAME), + TEXT(REGPATH_STARTMENU) L"\\" TEXT(STARTDOCKED_SB_NAME), 0, NULL, REG_OPTION_NON_VOLATILE, @@ -656,7 +656,7 @@ BOOL LoadSymbols(symbols_addr* symbols_PTRS, HMODULE hModule) RegCreateKeyExW( HKEY_CURRENT_USER, - TEXT(REGPATH) L"\\" TEXT(STARTDOCKED_SB_NAME), + TEXT(REGPATH_STARTMENU) L"\\" TEXT(STARTDOCKED_SB_NAME), 0, NULL, REG_OPTION_NON_VOLATILE, @@ -800,7 +800,7 @@ BOOL LoadSymbols(symbols_addr* symbols_PTRS, HMODULE hModule) RegCreateKeyExW( HKEY_CURRENT_USER, - TEXT(REGPATH) L"\\" TEXT(STARTDOCKED_SB_NAME), + TEXT(REGPATH_STARTMENU) L"\\" TEXT(STARTDOCKED_SB_NAME), 0, NULL, REG_OPTION_NON_VOLATILE, diff --git a/ExplorerPatcher/utility.h b/ExplorerPatcher/utility.h index 61314df..13c658f 100644 --- a/ExplorerPatcher/utility.h +++ b/ExplorerPatcher/utility.h @@ -20,7 +20,9 @@ #pragma comment(lib, "Psapi.lib") #define APPID L"Microsoft.Windows.Explorer" -#define REGPATH "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\ExplorerPatcher" +#define REGPATH "SOFTWARE\\ExplorerPatcher" +#define REGPATH_OLD "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\ExplorerPatcher" +#define REGPATH_STARTMENU REGPATH_OLD #define SPECIAL_FOLDER CSIDL_PROGRAM_FILES #define SPECIAL_FOLDER_LEGACY CSIDL_APPDATA #define PRODUCT_NAME "ExplorerPatcher" diff --git a/version.h b/version.h index f9c1ae8..333d67a 100644 --- a/version.h +++ b/version.h @@ -1,7 +1,7 @@ #define VER_MAJOR 22000 #define VER_MINOR 376 #define VER_BUILD_HI 40 -#define VER_BUILD_LO 15 +#define VER_BUILD_LO 16 #define VER_FLAGS VS_FF_PRERELEASE @@ -12,5 +12,5 @@ #define VER_STR(arg) #arg // The String form of the version numbers -#define VER_FILE_STRING VALUE "FileVersion", "22000.376.40.15" -#define VER_PRODUCT_STRING VALUE "ProductVersion", "22000.376.40.15" +#define VER_FILE_STRING VALUE "FileVersion", "22000.376.40.16" +#define VER_PRODUCT_STRING VALUE "ProductVersion", "22000.376.40.16"