mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 18:15:11 +00:00
[TIMEDATE] Use w32time compatible registry settings. CORE-13001
This commit is contained in:
parent
d19b792511
commit
33401f3875
1 changed files with 44 additions and 2 deletions
|
@ -157,7 +157,7 @@ GetSyncSetting(HWND hwnd)
|
|||
DWORD dwSize;
|
||||
|
||||
if (RegOpenKeyExW(HKEY_LOCAL_MACHINE,
|
||||
L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\DateTime\\Parameters",
|
||||
L"SYSTEM\\CurrentControlSet\\Services\\W32Time\\Parameters",
|
||||
0,
|
||||
KEY_QUERY_VALUE,
|
||||
&hKey) == ERROR_SUCCESS)
|
||||
|
@ -171,7 +171,9 @@ GetSyncSetting(HWND hwnd)
|
|||
&dwSize) == ERROR_SUCCESS)
|
||||
{
|
||||
if (wcscmp(szData, L"NTP") == 0)
|
||||
SendDlgItemMessageW(hwnd, IDC_AUTOSYNC, BM_SETCHECK, 0, 0);
|
||||
SendDlgItemMessageW(hwnd, IDC_AUTOSYNC, BM_SETCHECK, BST_CHECKED, 0);
|
||||
else
|
||||
SendDlgItemMessageW(hwnd, IDC_AUTOSYNC, BM_SETCHECK, BST_UNCHECKED, 0);
|
||||
}
|
||||
|
||||
RegCloseKey(hKey);
|
||||
|
@ -187,6 +189,40 @@ OnInitDialog(HWND hwnd)
|
|||
CreateNTPServerList(hwnd);
|
||||
}
|
||||
|
||||
static VOID
|
||||
OnAutoSync(BOOL Sync)
|
||||
{
|
||||
HKEY hKey;
|
||||
LONG lRet;
|
||||
LPCWSTR szAuto;
|
||||
|
||||
if (Sync)
|
||||
szAuto = L"NTP";
|
||||
else
|
||||
szAuto = L"NoSync";
|
||||
|
||||
lRet = RegOpenKeyExW(HKEY_LOCAL_MACHINE,
|
||||
L"SYSTEM\\CurrentControlSet\\Services\\W32Time\\Parameters",
|
||||
0,
|
||||
KEY_SET_VALUE,
|
||||
&hKey);
|
||||
if (lRet != ERROR_SUCCESS)
|
||||
{
|
||||
DisplayWin32Error(lRet);
|
||||
return;
|
||||
}
|
||||
|
||||
lRet = RegSetValueExW(hKey,
|
||||
L"Type",
|
||||
0,
|
||||
REG_SZ,
|
||||
(LPBYTE)szAuto,
|
||||
(wcslen(szAuto) + 1) * sizeof(WCHAR));
|
||||
if (lRet != ERROR_SUCCESS)
|
||||
DisplayWin32Error(lRet);
|
||||
|
||||
RegCloseKey(hKey);
|
||||
}
|
||||
|
||||
/* Property page dialog callback */
|
||||
INT_PTR CALLBACK
|
||||
|
@ -249,6 +285,12 @@ InetTimePageProc(HWND hwndDlg,
|
|||
{
|
||||
case PSN_APPLY:
|
||||
SetNTPServer(hwndDlg);
|
||||
|
||||
if (SendDlgItemMessageW(hwndDlg, IDC_AUTOSYNC, BM_GETCHECK, 0, 0) == BST_CHECKED)
|
||||
OnAutoSync(TRUE);
|
||||
else
|
||||
OnAutoSync(FALSE);
|
||||
|
||||
return TRUE;
|
||||
|
||||
default:
|
||||
|
|
Loading…
Reference in a new issue