Commit 95efcca3 authored by Jeff Smith's avatar Jeff Smith Committed by Alexandre Julliard

shlwapi: Fix SHFormatDateTime implementation during DST.

parent 9bc503b6
...@@ -4288,7 +4288,6 @@ INT WINAPI SHFormatDateTimeW(const FILETIME UNALIGNED *fileTime, DWORD *flags, ...@@ -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) #define SHFORMATDT_UNSUPPORTED_FLAGS (FDTF_RELATIVE | FDTF_LTRDATE | FDTF_RTLDATE | FDTF_NOAUTOREADINGORDER)
DWORD fmt_flags = flags ? *flags : FDTF_DEFAULT; DWORD fmt_flags = flags ? *flags : FDTF_DEFAULT;
SYSTEMTIME st; SYSTEMTIME st;
FILETIME ft;
INT ret = 0; INT ret = 0;
TRACE("%p %p %p %u\n", fileTime, flags, buf, size); TRACE("%p %p %p %u\n", fileTime, flags, buf, size);
...@@ -4299,8 +4298,8 @@ INT WINAPI SHFormatDateTimeW(const FILETIME UNALIGNED *fileTime, DWORD *flags, ...@@ -4299,8 +4298,8 @@ INT WINAPI SHFormatDateTimeW(const FILETIME UNALIGNED *fileTime, DWORD *flags,
if (fmt_flags & SHFORMATDT_UNSUPPORTED_FLAGS) if (fmt_flags & SHFORMATDT_UNSUPPORTED_FLAGS)
FIXME("ignoring some flags - 0x%08lx\n", fmt_flags & SHFORMATDT_UNSUPPORTED_FLAGS); FIXME("ignoring some flags - 0x%08lx\n", fmt_flags & SHFORMATDT_UNSUPPORTED_FLAGS);
FileTimeToLocalFileTime(fileTime, &ft); FileTimeToSystemTime(fileTime, &st);
FileTimeToSystemTime(&ft, &st); SystemTimeToTzSpecificLocalTime(NULL, &st, &st);
/* first of all date */ /* first of all date */
if (fmt_flags & (FDTF_LONGDATE | FDTF_SHORTDATE)) if (fmt_flags & (FDTF_LONGDATE | FDTF_SHORTDATE))
......
...@@ -1739,7 +1739,6 @@ static void test_SHFormatDateTimeA(const SYSTEMTIME *st) ...@@ -1739,7 +1739,6 @@ static void test_SHFormatDateTimeA(const SYSTEMTIME *st)
ok(ret == lstrlenA(buff)+1, "got %d\n", ret); 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)); 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); ok(ret == lstrlenA(buff2)+1, "got %d\n", ret);
todo_wine_if(!dstMatch)
ok(lstrcmpA(buff, buff2) == 0 || broken(!dstMatch) /* pre Windows 7 */, ok(lstrcmpA(buff, buff2) == 0 || broken(!dstMatch) /* pre Windows 7 */,
"expected (%s), got (%s)\n", buff2, buff); "expected (%s), got (%s)\n", buff2, buff);
...@@ -1748,7 +1747,6 @@ static void test_SHFormatDateTimeA(const SYSTEMTIME *st) ...@@ -1748,7 +1747,6 @@ static void test_SHFormatDateTimeA(const SYSTEMTIME *st)
ok(ret == lstrlenA(buff)+1, "got %d\n", ret); ok(ret == lstrlenA(buff)+1, "got %d\n", ret);
ret = GetTimeFormatA(LOCALE_USER_DEFAULT, LOCALE_USE_CP_ACP, st, NULL, buff2, sizeof(buff2)); ret = GetTimeFormatA(LOCALE_USER_DEFAULT, LOCALE_USE_CP_ACP, st, NULL, buff2, sizeof(buff2));
ok(ret == lstrlenA(buff2)+1, "got %d\n", ret); ok(ret == lstrlenA(buff2)+1, "got %d\n", ret);
todo_wine_if(!dstMatch)
ok(lstrcmpA(buff, buff2) == 0 || broken(!dstMatch) /* pre Windows 7 */, ok(lstrcmpA(buff, buff2) == 0 || broken(!dstMatch) /* pre Windows 7 */,
"expected (%s), got (%s)\n", buff2, buff); "expected (%s), got (%s)\n", buff2, buff);
...@@ -1758,7 +1756,6 @@ static void test_SHFormatDateTimeA(const SYSTEMTIME *st) ...@@ -1758,7 +1756,6 @@ static void test_SHFormatDateTimeA(const SYSTEMTIME *st)
ok(ret == lstrlenA(buff)+1, "got %d\n", ret); ok(ret == lstrlenA(buff)+1, "got %d\n", ret);
ret = GetTimeFormatA(LOCALE_USER_DEFAULT, LOCALE_USE_CP_ACP, st, NULL, buff2, sizeof(buff2)); ret = GetTimeFormatA(LOCALE_USER_DEFAULT, LOCALE_USE_CP_ACP, st, NULL, buff2, sizeof(buff2));
ok(ret == lstrlenA(buff2)+1, "got %d\n", ret); ok(ret == lstrlenA(buff2)+1, "got %d\n", ret);
todo_wine_if(!dstMatch)
ok(lstrcmpA(buff, buff2) == 0 || broken(!dstMatch) /* pre Windows 7 */, ok(lstrcmpA(buff, buff2) == 0 || broken(!dstMatch) /* pre Windows 7 */,
"expected (%s), got (%s)\n", buff2, buff); "expected (%s), got (%s)\n", buff2, buff);
...@@ -1790,7 +1787,6 @@ static void test_SHFormatDateTimeA(const SYSTEMTIME *st) ...@@ -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); 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)); 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); 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 */, ok(lstrcmpA(buff3, buff + lstrlenA(buff) - lstrlenA(buff3)) == 0 || broken(!dstMatch) /* pre Windows 7 */,
"expected (%s), got (%s) for time part\n", "expected (%s), got (%s) for time part\n",
buff3, buff + lstrlenA(buff) - lstrlenA(buff3)); buff3, buff + lstrlenA(buff) - lstrlenA(buff3));
...@@ -1805,7 +1801,6 @@ static void test_SHFormatDateTimeA(const SYSTEMTIME *st) ...@@ -1805,7 +1801,6 @@ static void test_SHFormatDateTimeA(const SYSTEMTIME *st)
ok(ret == lstrlenA(buff)+1, "got %d\n", ret); ok(ret == lstrlenA(buff)+1, "got %d\n", ret);
ret = GetTimeFormatA(LOCALE_USER_DEFAULT, LOCALE_USE_CP_ACP, st, NULL, buff3, sizeof(buff3)); ret = GetTimeFormatA(LOCALE_USER_DEFAULT, LOCALE_USE_CP_ACP, st, NULL, buff3, sizeof(buff3));
ok(ret == lstrlenA(buff3)+1, "got %d\n", ret); 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 */, ok(lstrcmpA(buff3, buff + lstrlenA(buff) - lstrlenA(buff3)) == 0 || broken(!dstMatch) /* pre Windows 7 */,
"expected (%s), got (%s) for time part\n", "expected (%s), got (%s) for time part\n",
buff3, buff + lstrlenA(buff) - lstrlenA(buff3)); buff3, buff + lstrlenA(buff) - lstrlenA(buff3));
...@@ -1824,7 +1819,6 @@ static void test_SHFormatDateTimeA(const SYSTEMTIME *st) ...@@ -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)); 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); ok(ret == lstrlenA(buff3)+1, "got %d\n", ret);
strcat(buff2, buff3); strcat(buff2, buff3);
todo_wine_if(!dstMatch)
ok(lstrcmpA(buff, buff2) == 0 || broken(!dstMatch) /* pre Windows 7 */, ok(lstrcmpA(buff, buff2) == 0 || broken(!dstMatch) /* pre Windows 7 */,
"expected (%s), got (%s)\n", buff2, buff); "expected (%s), got (%s)\n", buff2, buff);
...@@ -1837,7 +1831,6 @@ static void test_SHFormatDateTimeA(const SYSTEMTIME *st) ...@@ -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)); ret = GetTimeFormatA(LOCALE_USER_DEFAULT, LOCALE_USE_CP_ACP, st, NULL, buff3, sizeof(buff3));
ok(ret == lstrlenA(buff3)+1, "got %d\n", ret); ok(ret == lstrlenA(buff3)+1, "got %d\n", ret);
strcat(buff2, buff3); strcat(buff2, buff3);
todo_wine_if(!dstMatch)
ok(lstrcmpA(buff, buff2) == 0 || broken(!dstMatch) /* pre Windows 7 */, ok(lstrcmpA(buff, buff2) == 0 || broken(!dstMatch) /* pre Windows 7 */,
"expected (%s), got (%s)\n", buff2, buff); "expected (%s), got (%s)\n", buff2, buff);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment