2013-01-06 10:08:10 +00:00
/*
* ReactOS Explorer
*
* Copyright 2013 - Edijs Kolesnikovics
*
* This library is free software ; you can redistribute it and / or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation ; either
* version 2.1 of the License , or ( at your option ) any later version .
*
* This library is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the GNU
* Lesser General Public License for more details .
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library ; if not , write to the Free Software
* Foundation , Inc . , 51 Franklin Street , Fifth Floor , Boston , MA 02110 - 1301 USA
*/
2013-01-24 23:00:42 +00:00
# include "precomp.h"
2013-01-06 10:08:10 +00:00
2017-04-14 18:08:34 +00:00
TASKBAR_SETTINGS TaskBarSettings ;
2017-05-08 15:27:33 +00:00
const WCHAR szSettingsKey [ ] = L " Software \\ Microsoft \\ Windows \\ CurrentVersion \\ Explorer " ;
const WCHAR szAdvancedSettingsKey [ ] = L " Software \\ Microsoft \\ Windows \\ CurrentVersion \\ Explorer \\ Advanced " ;
2013-01-06 10:08:10 +00:00
VOID
2017-04-14 18:08:34 +00:00
LoadTaskBarSettings ( VOID )
2013-01-06 10:08:10 +00:00
{
2017-05-08 15:27:33 +00:00
DWORD dwValue = NULL ;
2017-05-08 17:46:55 +00:00
LoadSettingDword ( szAdvancedSettingsKey , L " TaskbarSizeMove " , dwValue ) ;
TaskBarSettings . bLock = ( dwValue = = 0 ) ;
2017-05-08 15:27:33 +00:00
2017-05-08 17:46:55 +00:00
LoadSettingDword ( szAdvancedSettingsKey , L " ShowSeconds " , dwValue ) ;
TaskBarSettings . bShowSeconds = ( dwValue ! = 0 ) ;
2017-05-08 15:27:33 +00:00
2017-05-08 17:46:55 +00:00
LoadSettingDword ( szSettingsKey , L " EnableAutotray " , dwValue ) ;
TaskBarSettings . bHideInactiveIcons = ( dwValue ! = 0 ) ;
2017-05-08 15:27:33 +00:00
2017-05-08 17:46:55 +00:00
LoadSettingDword ( szAdvancedSettingsKey , L " TaskbarGlomming " , dwValue ) ;
TaskBarSettings . bGroupButtons = ( dwValue ! = 0 ) ;
2017-05-08 15:27:33 +00:00
TaskBarSettings . bShowQuickLaunch = TRUE ; //FIXME: Where is this stored, and how?
/* FIXME: The following settings are stored in stuckrects2, do they have to be load here too? */
TaskBarSettings . bShowClock = TRUE ;
2017-04-14 18:08:34 +00:00
TaskBarSettings . bAutoHide = FALSE ;
TaskBarSettings . bAlwaysOnTop = FALSE ;
2013-01-06 10:08:10 +00:00
}
2017-04-14 18:08:34 +00:00
VOID
SaveTaskBarSettings ( VOID )
{
2017-05-08 17:46:55 +00:00
SaveSettingDword ( szAdvancedSettingsKey , L " TaskbarSizeMove " , TaskBarSettings . bLock ) ;
SaveSettingDword ( szAdvancedSettingsKey , L " ShowSeconds " , TaskBarSettings . bShowSeconds ) ;
SaveSettingDword ( szSettingsKey , L " EnableAutotray " , TaskBarSettings . bHideInactiveIcons ) ;
SaveSettingDword ( szAdvancedSettingsKey , L " TaskbarGlomming " , TaskBarSettings . bGroupButtons ) ;
2017-05-08 15:27:33 +00:00
/* FIXME: Show Clock, AutoHide and Always on top are stored in the stuckrects2 key but are not written to it with a click on apply. How is this done instead?
AutoHide writes something to HKEY_CURRENT_USER \ Software \ Microsoft \ Internet Explorer \ Desktop \ Components \ 0 figure out what and why */
}
BOOL
LoadSettingDword ( IN LPCWSTR pszKeyName ,
IN LPCWSTR pszValueName ,
OUT DWORD & dwValue )
{
BOOL ret = FALSE ;
HKEY hKey ;
if ( RegOpenKeyW ( HKEY_CURRENT_USER , pszKeyName , & hKey ) = = ERROR_SUCCESS )
{
DWORD dwValueLength , dwType ;
dwValueLength = sizeof ( dwValue ) ;
ret = RegQueryValueExW ( hKey , pszValueName , NULL , & dwType , ( PBYTE ) & dwValue , & dwValueLength ) = = ERROR_SUCCESS & & dwType = = REG_DWORD ;
RegCloseKey ( hKey ) ;
}
return ret ;
2017-04-14 18:08:34 +00:00
}
2013-01-06 10:08:10 +00:00
BOOL
2016-06-04 14:09:20 +00:00
SaveSettingDword ( IN LPCWSTR pszKeyName ,
IN LPCWSTR pszValueName ,
2013-01-06 10:08:10 +00:00
IN DWORD dwValue )
{
BOOL ret = FALSE ;
HKEY hKey ;
2016-06-04 14:09:20 +00:00
if ( RegCreateKeyW ( HKEY_CURRENT_USER , pszKeyName , & hKey ) = = ERROR_SUCCESS )
2013-01-06 10:08:10 +00:00
{
2016-06-04 14:09:20 +00:00
ret = RegSetValueExW ( hKey , pszValueName , 0 , REG_DWORD , ( PBYTE ) & dwValue , sizeof ( dwValue ) ) = = ERROR_SUCCESS ;
2013-01-06 10:08:10 +00:00
RegCloseKey ( hKey ) ;
}
return ret ;
}
/* EOF */