Index: base/shell/explorer-new/CMakeLists.txt =================================================================== --- base/shell/explorer-new/CMakeLists.txt (revision 58064) +++ 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 58064) +++ base/shell/explorer-new/explorer.c (working copy) @@ -368,6 +368,7 @@ return 1; } + LoadAdvancedSettings(); hExplorerInstance = hInstance; hProcessHeap = GetProcessHeap(); Index: base/shell/explorer-new/precomp.h =================================================================== --- base/shell/explorer-new/precomp.h (revision 58064) +++ base/shell/explorer-new/precomp.h (working copy) @@ -33,6 +33,14 @@ extern ADVANCED_SETTINGS AdvancedSettings; +/* + * settings.c + */ + +extern LPCTSTR szAdvancedSettingsKey; +void LoadAdvancedSettings(void); +BOOL SaveSetting(HKEY hKey, LPCTSTR szSubKey, LPCTSTR lpValueName, DWORD dwType, BYTE *lpData); + /* 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,74 @@ +/* + * 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 + +LPCTSTR szAdvancedSettingsKey = _T("Software\\ReactOS\\Features\\Explorer"); +ADVANCED_SETTINGS AdvancedSettings; + + +/* win2k3 explorer loads all settings at once */ +void LoadAdvancedSettings(void) +{ + HKEY hKey; + + if (RegOpenKeyW(HKEY_CURRENT_USER, szAdvancedSettingsKey, &hKey) == ERROR_SUCCESS) + { + DWORD dwValueLength, dwType; + + dwValueLength = sizeof(DWORD); + if (RegQueryValueExW(hKey, L"bShowSeconds", NULL, &dwType, (LPBYTE)&AdvancedSettings.bShowSeconds, &dwValueLength) != ERROR_SUCCESS || dwType != REG_DWORD) + AdvancedSettings.bShowSeconds = FALSE; + + RegCloseKey(hKey); + } + else + { + /* Failed to open key, fill with defaults */ + AdvancedSettings.bShowSeconds = FALSE; + } +} + +/* win2k3 explorer saves one setting per change */ +BOOL SaveSetting(HKEY hKey, LPCTSTR szSubKey, LPCTSTR lpValueName, DWORD dwType, BYTE *lpData) +{ + HKEY hKeyLocal; + + if (RegCreateKeyW(hKey, szSubKey, &hKeyLocal) == ERROR_SUCCESS) + { + if (RegOpenKeyW(hKey, szSubKey, &hKeyLocal) == ERROR_SUCCESS) + { + LONG ret = FALSE; + + switch (dwType) + { + case REG_DWORD: + ret = RegSetValueExW(hKeyLocal, lpValueName, 0, REG_DWORD, (LPBYTE)&lpData, sizeof(DWORD)); + } + + RegCloseKey(hKeyLocal); + return (ret ? TRUE : FALSE); + } + } + + return FALSE; +} + +/* EOF */ Index: base/shell/explorer-new/trayntfy.c =================================================================== --- base/shell/explorer-new/trayntfy.c (revision 58064) +++ 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 58064) +++ base/shell/explorer-new/trayprop.c (working copy) @@ -30,9 +30,7 @@ HBITMAP hTaskbarBitmap; } PROPSHEET_INFO, *PPROPSHEET_INFO; -ADVANCED_SETTINGS AdvancedSettings = { FALSE }; - static BOOL UpdateTaskbarBitmap(PPROPSHEET_INFO pPropInfo) { @@ -225,6 +223,7 @@ case PSN_APPLY: AdvancedSettings.bShowSeconds = IsDlgButtonChecked(hwndDlg, IDC_TASKBARPROP_SECONDS); + SaveSetting(HKEY_CURRENT_USER, szAdvancedSettingsKey, L"bShowSeconds", REG_DWORD, (LPBYTE)AdvancedSettings.bShowSeconds); break; }