https://git.reactos.org/?p=reactos.git;a=commitdiff;h=44b543bad32363dfce59f…
commit 44b543bad32363dfce59f3755d69616e476f8f86
Author: Doug Lyons <douglyons(a)douglyons.com>
AuthorDate: Sat Feb 10 15:47:04 2018 -0600
Commit: Thomas Faber <thomas.faber(a)reactos.org>
CommitDate: Sun Jul 7 12:45:36 2019 +0200
[TIMEDATE] Handle manual time server entry. CORE-13001
---
dll/cpl/timedate/internettime.c | 31 ++++++++++++++++++++++++++++++-
1 file changed, 30 insertions(+), 1 deletion(-)
diff --git a/dll/cpl/timedate/internettime.c b/dll/cpl/timedate/internettime.c
index 81a3ed0791c..808930e083e 100644
--- a/dll/cpl/timedate/internettime.c
+++ b/dll/cpl/timedate/internettime.c
@@ -8,6 +8,7 @@
*/
#include "timedate.h"
+#include <stdlib.h>
DWORD WINAPI W32TimeSyncNow(LPCWSTR cmdline, UINT blocking, UINT flags);
@@ -95,12 +96,40 @@ SetNTPServer(HWND hwnd)
UINT uSel;
WCHAR szSel[4];
LONG lRet;
+ WCHAR buffer[256];
hList = GetDlgItem(hwnd,
IDC_SERVERLIST);
uSel = (UINT)SendMessageW(hList, CB_GETCURSEL, 0, 0);
+ SendDlgItemMessageW(hwnd, IDC_SERVERLIST, WM_GETTEXT, _countof(buffer),
(LPARAM)buffer);
+
+ /* If there is new data entered then save it in the registry
+ The same key name of "0" is used to store all user entered values
+ */
+ if (uSel == -1)
+ {
+ lRet = RegOpenKeyExW(HKEY_LOCAL_MACHINE,
+
L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\DateTime\\Servers",
+ 0,
+ KEY_SET_VALUE,
+ &hKey);
+ if (lRet != ERROR_SUCCESS)
+ {
+ DisplayWin32Error(lRet);
+ return;
+ }
+ lRet = RegSetValueExW(hKey,
+ L"0",
+ 0,
+ REG_SZ,
+ (LPBYTE)buffer,
+ (wcslen(buffer) + 1) * sizeof(WCHAR));
+ if (lRet != ERROR_SUCCESS)
+ DisplayWin32Error(lRet);
+ }
+
/* Server reg entries count from 1,
* Combo boxes count from 0 */
uSel++;
@@ -255,7 +284,7 @@ InetTimePageProc(HWND hwndDlg,
break;
case IDC_SERVERLIST:
- if (HIWORD(wParam) == CBN_SELCHANGE)
+ if ((HIWORD(wParam) == CBN_SELCHANGE) || (HIWORD(wParam) ==
CBN_EDITCHANGE))
{
/* Enable the 'Apply' button */
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);