https://git.reactos.org/?p=reactos.git;a=commitdiff;h=37349d7a0f065d141d8e7…
commit 37349d7a0f065d141d8e730535060e77b5f59561
Author: Bișoc George <fraizeraust99(a)gmail.com>
AuthorDate: Wed Feb 5 19:54:33 2020 +0100
Commit: GitHub <noreply(a)github.com>
CommitDate: Thu Feb 6 03:54:33 2020 +0900
[TIMEDATE] Do not display a message box when NTP sync fails (#2305)
This PR merely checks if the string is empty and displaying (only) a debug information
to the debugger, at disposal of displaying a message box. I might implement such dynamic
resource string to the CPL later in a next PR.
CORE-16654
---
base/services/w32time/w32time.c | 7 +++++++
dll/cpl/timedate/CMakeLists.txt | 2 +-
dll/cpl/timedate/internettime.c | 2 +-
dll/cpl/timedate/timedate.h | 1 +
4 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/base/services/w32time/w32time.c b/base/services/w32time/w32time.c
index abc58a5e151..c2b2bfeeeae 100644
--- a/base/services/w32time/w32time.c
+++ b/base/services/w32time/w32time.c
@@ -191,6 +191,13 @@ SetTime(VOID)
DPRINT("Time Server is '%S'.\n", szData);
+ /* Is the given string empty? */
+ if (cbName == 0 || szData[0] == '\0')
+ {
+ DPRINT("The time NTP server couldn't be found, the string is
empty!\n");
+ return ERROR_INVALID_DATA;
+ }
+
ulTime = GetServerTime(szData);
if (ulTime != 0)
diff --git a/dll/cpl/timedate/CMakeLists.txt b/dll/cpl/timedate/CMakeLists.txt
index d1b5275dd07..20f0d62d59c 100644
--- a/dll/cpl/timedate/CMakeLists.txt
+++ b/dll/cpl/timedate/CMakeLists.txt
@@ -19,6 +19,6 @@ add_library(timedate MODULE
${CMAKE_CURRENT_BINARY_DIR}/timedate.def)
set_module_type(timedate cpl UNICODE)
-add_importlibs(timedate w32time advapi32 user32 gdi32 comctl32 ws2_32 iphlpapi msvcrt
kernel32)
+add_importlibs(timedate w32time advapi32 user32 gdi32 comctl32 ws2_32 iphlpapi msvcrt
kernel32 ntdll)
add_pch(timedate timedate.h SOURCE)
add_cd_file(TARGET timedate DESTINATION reactos/system32 FOR all)
diff --git a/dll/cpl/timedate/internettime.c b/dll/cpl/timedate/internettime.c
index 808930e083e..88e95ae0f6e 100644
--- a/dll/cpl/timedate/internettime.c
+++ b/dll/cpl/timedate/internettime.c
@@ -278,7 +278,7 @@ InetTimePageProc(HWND hwndDlg,
dwError = W32TimeSyncNow(L"localhost", 0, 0);
if (dwError != ERROR_SUCCESS)
{
- DisplayWin32Error(dwError);
+ DPRINT("Failed to synchronize the time! Invalid NTP server
name has been caught or no server name could be found (Error: %lu).\n", dwError);
}
}
break;
diff --git a/dll/cpl/timedate/timedate.h b/dll/cpl/timedate/timedate.h
index 8cf7dbb74bd..500421758b7 100644
--- a/dll/cpl/timedate/timedate.h
+++ b/dll/cpl/timedate/timedate.h
@@ -16,6 +16,7 @@
#include <wchar.h>
#include <commctrl.h>
#include <cpl.h>
+#include <debug.h>
#include "resource.h"