Index: base/shell/explorer-new/CMakeLists.txt =================================================================== --- base/shell/explorer-new/CMakeLists.txt (revision 58013) +++ base/shell/explorer-new/CMakeLists.txt (working copy) @@ -5,6 +5,7 @@ desktop.c dragdrop.c explorer.c + settings.c startmnu.c taskband.c taskswnd.c Index: base/shell/explorer-new/explorer.c =================================================================== --- base/shell/explorer-new/explorer.c (revision 58013) +++ base/shell/explorer-new/explorer.c (working copy) @@ -408,6 +408,8 @@ /* FIXME */ } + LoadAdvancedSettings(); + if (Tray != NULL) TrayMessageLoop(Tray); Index: base/shell/explorer-new/precomp.h =================================================================== --- base/shell/explorer-new/precomp.h (revision 58013) +++ base/shell/explorer-new/precomp.h (working copy) @@ -33,6 +33,13 @@ extern ADVANCED_SETTINGS AdvancedSettings; +/* + * settings.c + */ + +extern void LoadAdvancedSettings(void); +extern void SaveAdvancedSettings(void); + /* dynamic imports due to lack of support in msvc linker libs */ typedef INT (APIENTRY *REGSHELLHOOK)(HWND, DWORD); #ifdef UNICODE Index: base/shell/explorer-new/settings.c =================================================================== --- base/shell/explorer-new/settings.c (revision 0) +++ base/shell/explorer-new/settings.c (working copy) @@ -0,0 +1,67 @@ +/* + * ReactOS Explorer + * + * Copyright 2012 - 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 + */ + +#include + +static LPCTSTR s_szAdvancedRegistryKey = _T("Software\\ReactOS\\Features\\Explorer"); + + +void FillDefaultAdvancedSettings(void) +{ + AdvancedSettings.bShowSeconds = FALSE; +} + +extern void LoadAdvancedSettings(void) +{ + HKEY hKey = NULL; + + if (RegOpenKeyW(HKEY_CURRENT_USER, s_szAdvancedRegistryKey, &hKey) == ERROR_SUCCESS) + { + DWORD dwSize = sizeof(ADVANCED_SETTINGS); + if (RegQueryValueExW(hKey, L"AdvancedSettings", NULL, NULL, (LPBYTE)&AdvancedSettings, &dwSize) != ERROR_SUCCESS) + { + FillDefaultAdvancedSettings(); + } + + RegCloseKey(hKey); + } + else + { + /* Failed to open key, fill with defaults */ + FillDefaultAdvancedSettings(); + } +} + +extern void SaveAdvancedSettings(void) +{ + HKEY hKey = NULL; + + if (RegCreateKeyW(HKEY_CURRENT_USER, s_szAdvancedRegistryKey, &hKey) == ERROR_SUCCESS) + { + if (RegOpenKeyW(HKEY_CURRENT_USER, s_szAdvancedRegistryKey, &hKey) == ERROR_SUCCESS) + { + RegSetValueEx(hKey, L"AdvancedSettings", 0, REG_BINARY, (LPBYTE)&AdvancedSettings, sizeof(ADVANCED_SETTINGS)); + + RegCloseKey(hKey); + } + } +} + +/* EOF */ Index: base/shell/explorer-new/trayntfy.c =================================================================== --- base/shell/explorer-new/trayntfy.c (revision 58013) +++ base/shell/explorer-new/trayntfy.c (working copy) @@ -701,25 +701,6 @@ { FALSE, DATE_SHORTDATE, NULL } }; -HRESULT RegGetDWord(HKEY hKey, LPCTSTR szValueName, DWORD * lpdwResult) -{ - LONG lResult; - DWORD dwDataSize = sizeof(DWORD); - DWORD dwType = 0; - - // Check input parameters... - if (hKey == NULL || lpdwResult == NULL) return E_INVALIDARG; - - // Get dword value from the registry... - lResult = RegQueryValueEx(hKey, szValueName, 0, &dwType, (LPBYTE) lpdwResult, &dwDataSize ); - - // Check result and make sure the registry value is a DWORD(REG_DWORD)... - if (lResult != ERROR_SUCCESS) return HRESULT_FROM_WIN32(lResult); - else if (dwType != REG_DWORD) return DISP_E_TYPEMISMATCH; - - return NOERROR; -} - #define CLOCKWND_FORMAT_COUNT (sizeof(ClockWndFormats) / sizeof(ClockWndFormats[0])) #define TRAY_CLOCK_WND_SPACING_X 0 Index: base/shell/explorer-new/trayprop.c =================================================================== --- base/shell/explorer-new/trayprop.c (revision 58013) +++ base/shell/explorer-new/trayprop.c (working copy) @@ -225,6 +225,7 @@ case PSN_APPLY: AdvancedSettings.bShowSeconds = IsDlgButtonChecked(hwndDlg, IDC_TASKBARPROP_SECONDS); + SaveAdvancedSettings(); break; }