Module: wine Branch: master Commit: 95efcca3151995fd30eeebf7d348f7c573ed065d URL: https://gitlab.winehq.org/wine/wine/-/commit/95efcca3151995fd30eeebf7d348f7c...
Author: Jeff Smith whydoubt@gmail.com Date: Thu Aug 31 22:34:08 2023 -0500
shlwapi: Fix SHFormatDateTime implementation during DST.
---
dlls/shlwapi/ordinal.c | 5 ++--- dlls/shlwapi/tests/ordinal.c | 7 ------- 2 files changed, 2 insertions(+), 10 deletions(-)
diff --git a/dlls/shlwapi/ordinal.c b/dlls/shlwapi/ordinal.c index 885da3f2269..6e21bd9e075 100644 --- a/dlls/shlwapi/ordinal.c +++ b/dlls/shlwapi/ordinal.c @@ -4288,7 +4288,6 @@ INT WINAPI SHFormatDateTimeW(const FILETIME UNALIGNED *fileTime, DWORD *flags, #define SHFORMATDT_UNSUPPORTED_FLAGS (FDTF_RELATIVE | FDTF_LTRDATE | FDTF_RTLDATE | FDTF_NOAUTOREADINGORDER) DWORD fmt_flags = flags ? *flags : FDTF_DEFAULT; SYSTEMTIME st; - FILETIME ft; INT ret = 0;
TRACE("%p %p %p %u\n", fileTime, flags, buf, size); @@ -4299,8 +4298,8 @@ INT WINAPI SHFormatDateTimeW(const FILETIME UNALIGNED *fileTime, DWORD *flags, if (fmt_flags & SHFORMATDT_UNSUPPORTED_FLAGS) FIXME("ignoring some flags - 0x%08lx\n", fmt_flags & SHFORMATDT_UNSUPPORTED_FLAGS);
- FileTimeToLocalFileTime(fileTime, &ft); - FileTimeToSystemTime(&ft, &st); + FileTimeToSystemTime(fileTime, &st); + SystemTimeToTzSpecificLocalTime(NULL, &st, &st);
/* first of all date */ if (fmt_flags & (FDTF_LONGDATE | FDTF_SHORTDATE)) diff --git a/dlls/shlwapi/tests/ordinal.c b/dlls/shlwapi/tests/ordinal.c index 2b9cb9f3127..676a537744d 100644 --- a/dlls/shlwapi/tests/ordinal.c +++ b/dlls/shlwapi/tests/ordinal.c @@ -1739,7 +1739,6 @@ static void test_SHFormatDateTimeA(const SYSTEMTIME *st) ok(ret == lstrlenA(buff)+1, "got %d\n", ret); ret = GetTimeFormatA(LOCALE_USER_DEFAULT, TIME_NOSECONDS | LOCALE_USE_CP_ACP, st, NULL, buff2, sizeof(buff2)); ok(ret == lstrlenA(buff2)+1, "got %d\n", ret); - todo_wine_if(!dstMatch) ok(lstrcmpA(buff, buff2) == 0 || broken(!dstMatch) /* pre Windows 7 */, "expected (%s), got (%s)\n", buff2, buff);
@@ -1748,7 +1747,6 @@ static void test_SHFormatDateTimeA(const SYSTEMTIME *st) ok(ret == lstrlenA(buff)+1, "got %d\n", ret); ret = GetTimeFormatA(LOCALE_USER_DEFAULT, LOCALE_USE_CP_ACP, st, NULL, buff2, sizeof(buff2)); ok(ret == lstrlenA(buff2)+1, "got %d\n", ret); - todo_wine_if(!dstMatch) ok(lstrcmpA(buff, buff2) == 0 || broken(!dstMatch) /* pre Windows 7 */, "expected (%s), got (%s)\n", buff2, buff);
@@ -1758,7 +1756,6 @@ static void test_SHFormatDateTimeA(const SYSTEMTIME *st) ok(ret == lstrlenA(buff)+1, "got %d\n", ret); ret = GetTimeFormatA(LOCALE_USER_DEFAULT, LOCALE_USE_CP_ACP, st, NULL, buff2, sizeof(buff2)); ok(ret == lstrlenA(buff2)+1, "got %d\n", ret); - todo_wine_if(!dstMatch) ok(lstrcmpA(buff, buff2) == 0 || broken(!dstMatch) /* pre Windows 7 */, "expected (%s), got (%s)\n", buff2, buff);
@@ -1790,7 +1787,6 @@ static void test_SHFormatDateTimeA(const SYSTEMTIME *st) ok(ret == lstrlenA(buff)+1, "got %d, length %d\n", ret, lstrlenA(buff)+1); ret = GetTimeFormatA(LOCALE_USER_DEFAULT, TIME_NOSECONDS | LOCALE_USE_CP_ACP, st, NULL, buff3, sizeof(buff3)); ok(ret == lstrlenA(buff3)+1, "got %d\n", ret); - todo_wine_if(!dstMatch) ok(lstrcmpA(buff3, buff + lstrlenA(buff) - lstrlenA(buff3)) == 0 || broken(!dstMatch) /* pre Windows 7 */, "expected (%s), got (%s) for time part\n", buff3, buff + lstrlenA(buff) - lstrlenA(buff3)); @@ -1805,7 +1801,6 @@ static void test_SHFormatDateTimeA(const SYSTEMTIME *st) ok(ret == lstrlenA(buff)+1, "got %d\n", ret); ret = GetTimeFormatA(LOCALE_USER_DEFAULT, LOCALE_USE_CP_ACP, st, NULL, buff3, sizeof(buff3)); ok(ret == lstrlenA(buff3)+1, "got %d\n", ret); - todo_wine_if(!dstMatch) ok(lstrcmpA(buff3, buff + lstrlenA(buff) - lstrlenA(buff3)) == 0 || broken(!dstMatch) /* pre Windows 7 */, "expected (%s), got (%s) for time part\n", buff3, buff + lstrlenA(buff) - lstrlenA(buff3)); @@ -1824,7 +1819,6 @@ static void test_SHFormatDateTimeA(const SYSTEMTIME *st) ret = GetTimeFormatA(LOCALE_USER_DEFAULT, TIME_NOSECONDS | LOCALE_USE_CP_ACP, st, NULL, buff3, sizeof(buff3)); ok(ret == lstrlenA(buff3)+1, "got %d\n", ret); strcat(buff2, buff3); - todo_wine_if(!dstMatch) ok(lstrcmpA(buff, buff2) == 0 || broken(!dstMatch) /* pre Windows 7 */, "expected (%s), got (%s)\n", buff2, buff);
@@ -1837,7 +1831,6 @@ static void test_SHFormatDateTimeA(const SYSTEMTIME *st) ret = GetTimeFormatA(LOCALE_USER_DEFAULT, LOCALE_USE_CP_ACP, st, NULL, buff3, sizeof(buff3)); ok(ret == lstrlenA(buff3)+1, "got %d\n", ret); strcat(buff2, buff3); - todo_wine_if(!dstMatch) ok(lstrcmpA(buff, buff2) == 0 || broken(!dstMatch) /* pre Windows 7 */, "expected (%s), got (%s)\n", buff2, buff); }