https://git.reactos.org/?p=reactos.git;a=commitdiff;h=f203ad5cf4f650b77e5ae…
commit f203ad5cf4f650b77e5ae32ed977d3606c32bb2a
Author: Carl J. Bialorucki <cbialo2(a)outlook.com>
AuthorDate: Tue Jun 20 03:16:23 2023 -0600
Commit: GitHub <noreply(a)github.com>
CommitDate: Tue Jun 20 11:16:23 2023 +0200
[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<CMenuCallback>();
@@ -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);