From f203ad5cf4f650b77e5ae32ed977d3606c32bb2a Mon Sep 17 00:00:00 2001 From: "Carl J. Bialorucki" Date: Tue, 20 Jun 2023 03:16:23 -0600 Subject: [PATCH] [BROWSEUI] Add locked toolbar state persistence (#5350) Store the state of the explorer toolbar, locked or unlocked, in the proper registry location and set the proper toolbar state when initialized. CORE-9094 - Set `HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Toolbar\Locked` to 1 when the explorer toolbar is locked, 0 when the toolbar is unlocked. - Query `HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Toolbar\Locked` when the toolbar is initialized to set the correct locked state. - Set the default state of the toolbar to locked if the registry key does not exist, matching the behavior of Windows Server 2003. --- dll/win32/browseui/internettoolbar.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/dll/win32/browseui/internettoolbar.cpp b/dll/win32/browseui/internettoolbar.cpp index 8c71f4d1a3f..8d51ad6bcfe 100644 --- a/dll/win32/browseui/internettoolbar.cpp +++ b/dll/win32/browseui/internettoolbar.cpp @@ -607,8 +607,12 @@ HRESULT STDMETHODCALLTYPE CMenuCallback::CallbackSM(LPSMDATA psmd, UINT uMsg, WP CInternetToolbar::CInternetToolbar() { + fLocked = SHRegGetBoolUSValueW(L"Software\\Microsoft\\Internet Explorer\\Toolbar", + L"Locked", + FALSE, + TRUE); + fMainReBar = NULL; - fLocked = false; fMenuBandWindow = NULL; fNavigationWindow = NULL; fMenuCallback = new CComObject(); @@ -718,7 +722,15 @@ HRESULT CInternetToolbar::LockUnlockToolbars(bool locked) if (locked != fLocked) { + DWORD dwLocked = locked ? 1 : 0; + SHRegSetUSValueW(L"Software\\Microsoft\\Internet Explorer\\Toolbar", + L"Locked", + REG_DWORD, + &dwLocked, + sizeof(dwLocked), + SHREGSET_FORCE_HKCU); fLocked = locked; + rebarBandInfo.cbSize = sizeof(rebarBandInfo); rebarBandInfo.fMask = RBBIM_STYLE | RBBIM_LPARAM; bandCount = (int)SendMessage(fMainReBar, RB_GETBANDCOUNT, 0, 0);