mirror of
https://github.com/reactos/reactos.git
synced 2025-02-22 08:25:03 +00:00
[W32TIME] Use a reasonable fallback of 9 hours. (#1724)
CORE-16181 This allows preventing spamming the time servers if the registry entry becomes corrupted or missing. Also, disallow a setting of less than 2 minutes for the same reasons, and instead use the fallback of 9 hours.
This commit is contained in:
parent
7f59361911
commit
5b9543c31a
1 changed files with 13 additions and 11 deletions
|
@ -129,16 +129,18 @@ GetIntervalSetting(VOID)
|
||||||
LONG lRet;
|
LONG lRet;
|
||||||
|
|
||||||
dwData = 0;
|
dwData = 0;
|
||||||
if (RegOpenKeyExW(HKEY_LOCAL_MACHINE,
|
lRet = RegOpenKeyExW(HKEY_LOCAL_MACHINE,
|
||||||
L"SYSTEM\\CurrentControlSet\\Services\\W32Time\\TimeProviders\\NtpClient",
|
L"SYSTEM\\CurrentControlSet\\Services\\W32Time\\TimeProviders\\NtpClient",
|
||||||
0,
|
0,
|
||||||
KEY_QUERY_VALUE,
|
KEY_QUERY_VALUE,
|
||||||
&hKey) == ERROR_SUCCESS)
|
&hKey);
|
||||||
|
if (lRet == ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
/* This key holds the update interval in seconds
|
/*
|
||||||
* It is useful for testing to set it to a value of 10 (Decimal)
|
* This key holds the update interval in seconds.
|
||||||
* This will cause the clock to try and update every 10 seconds
|
* It is useful for testing to set it to a value of 10 (Decimal).
|
||||||
* So you can change the time and expect it to be set back correctly in 10-20 seconds
|
* This will cause the clock to try and update every 10 seconds.
|
||||||
|
* So you can change the time and expect it to be set back correctly in 10-20 seconds.
|
||||||
*/
|
*/
|
||||||
lRet = RegQueryValueExW(hKey,
|
lRet = RegQueryValueExW(hKey,
|
||||||
L"SpecialPollInterval",
|
L"SpecialPollInterval",
|
||||||
|
@ -149,8 +151,8 @@ GetIntervalSetting(VOID)
|
||||||
RegCloseKey(hKey);
|
RegCloseKey(hKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lRet != ERROR_SUCCESS)
|
if (lRet != ERROR_SUCCESS || dwData < 120)
|
||||||
return 0;
|
return 9 * 60 * 60; // 9 hours, because Windows uses 9 hrs, 6 mins and 8 seconds by default.
|
||||||
else
|
else
|
||||||
return dwData;
|
return dwData;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue