[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
This commit is contained in:
Bișoc George 2020-02-05 19:54:33 +01:00 committed by GitHub
parent fb30239129
commit 37349d7a0f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 2 deletions

View file

@ -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)

View file

@ -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)

View file

@ -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;

View file

@ -16,6 +16,7 @@
#include <wchar.h>
#include <commctrl.h>
#include <cpl.h>
#include <debug.h>
#include "resource.h"