vcl/win/window/salframe.cxx | 41 +++++++++++++---------------------------- 1 file changed, 13 insertions(+), 28 deletions(-)
New commits: commit 2086f693a31fa8f4afda5ea640a652dd13287687 Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Sat Jun 15 19:40:06 2024 +0500 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Sat Jun 15 18:38:39 2024 +0200 Simplify a bit using newer registry API Change-Id: I0bd2a238662e1da0c62cdaec96b9892df82298f6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168909 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx index 288b561970f0..ebcb85f55cff 100644 --- a/vcl/win/window/salframe.cxx +++ b/vcl/win/window/salframe.cxx @@ -2652,22 +2652,15 @@ void WinSalFrame::UpdateSettings( AllSettings& rSettings ) aMouseSettings.SetStartDragWidth( nDragWidth ); if ( nDragHeight ) aMouseSettings.SetStartDragHeight( nDragHeight ); - HKEY hRegKey; - if ( RegOpenKeyW( HKEY_CURRENT_USER, - L"Control Panel\Desktop", - &hRegKey ) == ERROR_SUCCESS ) { wchar_t aValueBuf[10]; DWORD nValueSize = sizeof( aValueBuf ); - DWORD nType; - if ( RegQueryValueExW( hRegKey, L"MenuShowDelay", nullptr, - &nType, reinterpret_cast<LPBYTE>(aValueBuf), &nValueSize ) == ERROR_SUCCESS ) + if (RegGetValueW(HKEY_CURRENT_USER, L"Control Panel\Desktop", L"MenuShowDelay", + RRF_RT_REG_SZ, nullptr, reinterpret_cast<LPVOID>(aValueBuf), &nValueSize) + == ERROR_SUCCESS) { - if ( nType == REG_SZ ) - aMouseSettings.SetMenuDelay( static_cast<sal_uLong>(ImplW2I( aValueBuf )) ); + aMouseSettings.SetMenuDelay( static_cast<sal_uLong>(ImplW2I( aValueBuf )) ); } - - RegCloseKey( hRegKey ); } StyleSettings aStyleSettings = rSettings.GetStyleSettings(); @@ -2949,30 +2942,22 @@ void WinSalFrame::UpdateSettings( AllSettings& rSettings ) aStyleSettings.SetDragFullOptions( nDragFullOptions ); } - if ( RegOpenKeyW( HKEY_CURRENT_USER, - L"Control Panel\International\Calendars\TwoDigitYearMax", - &hRegKey ) == ERROR_SUCCESS ) { wchar_t aValueBuf[10]; - DWORD nValue; DWORD nValueSize = sizeof( aValueBuf ); - DWORD nType; - if ( RegQueryValueExW( hRegKey, L"1", nullptr, - &nType, reinterpret_cast<LPBYTE>(aValueBuf), &nValueSize ) == ERROR_SUCCESS ) + if (RegGetValueW(HKEY_CURRENT_USER, + L"Control Panel\International\Calendars\TwoDigitYearMax", L"1", + RRF_RT_REG_SZ, nullptr, reinterpret_cast<LPVOID>(aValueBuf), &nValueSize) + == ERROR_SUCCESS) { - if ( nType == REG_SZ ) + DWORD nValue = static_cast<sal_uLong>(ImplW2I(aValueBuf)); + if ((nValue > 1000) && (nValue < 10000)) { - nValue = static_cast<sal_uLong>(ImplW2I( aValueBuf )); - if ( (nValue > 1000) && (nValue < 10000) ) - { - std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create()); - officecfg::Office::Common::DateFormat::TwoDigitYear::set(static_cast<sal_Int32>(nValue-99), batch); - batch->commit(); - } + std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create()); + officecfg::Office::Common::DateFormat::TwoDigitYear::set(static_cast<sal_Int32>(nValue-99), batch); + batch->commit(); } } - - RegCloseKey( hRegKey ); } rSettings.SetMouseSettings( aMouseSettings );