/
settings.cpp
78 lines (65 loc) · 2.3 KB
/
settings.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/*
* 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
*/
#include "precomp.h"
TASKBAR_SETTINGS TaskBarSettings;
const WCHAR szAdvancedSettingsKey[] = L"Software\\ReactOS\\Features\\Explorer";
VOID
LoadTaskBarSettings(VOID)
{
HKEY hKey;
/* Set defaults */
TaskBarSettings.bLock = TRUE;
TaskBarSettings.bAutoHide = FALSE;
TaskBarSettings.bAlwaysOnTop = FALSE;
TaskBarSettings.bGroupButtons = TRUE;
TaskBarSettings.bShowQuickLaunch = TRUE;
TaskBarSettings.bShowClock = TRUE;
TaskBarSettings.bShowSeconds = FALSE;
TaskBarSettings.bHideInactiveIcons = TRUE;
/* Check registry */
if (RegOpenKeyW(HKEY_CURRENT_USER, szAdvancedSettingsKey, &hKey) == ERROR_SUCCESS)
{
DWORD dwValue, dwValueLength, dwType;
dwValueLength = sizeof(dwValue);
if (RegQueryValueExW(hKey, L"ShowSeconds", NULL, &dwType, (PBYTE)&dwValue, &dwValueLength) == ERROR_SUCCESS && dwType == REG_DWORD)
TaskBarSettings.bShowSeconds = dwValue != 0;
RegCloseKey(hKey);
}
}
VOID
SaveTaskBarSettings(VOID)
{
SaveSettingDword(szAdvancedSettingsKey, TEXT("ShowSeconds"), TaskBarSettings.bShowSeconds);
}
BOOL
SaveSettingDword(IN LPCWSTR pszKeyName,
IN LPCWSTR pszValueName,
IN DWORD dwValue)
{
BOOL ret = FALSE;
HKEY hKey;
if (RegCreateKeyW(HKEY_CURRENT_USER, pszKeyName, &hKey) == ERROR_SUCCESS)
{
ret = RegSetValueExW(hKey, pszValueName, 0, REG_DWORD, (PBYTE)&dwValue, sizeof(dwValue)) == ERROR_SUCCESS;
RegCloseKey(hKey);
}
return ret;
}
/* EOF */