Another one from last night: fix for dlls/kernel/tests/time.c on Windows 98

Jakob Eriksson jakov at vmlinux.org
Mon Mar 21 08:00:22 CST 2005


http://test.winehq.org/data/200503181000/98_jmelgarejo98casa/kernel32:time.txt


This should account for broken Windows 98 behaviour.


regards,
Jakob

-------------- next part --------------
Index: dlls/kernel/tests/time.c
===================================================================
RCS file: /home/wine/wine/dlls/kernel/tests/time.c,v
retrieving revision 1.8
diff -u -r1.8 time.c
--- dlls/kernel/tests/time.c	17 Mar 2005 18:54:31 -0000	1.8
+++ dlls/kernel/tests/time.c	21 Mar 2005 13:58:57 -0000
@@ -120,16 +120,20 @@
 {
     FILETIME ft;
     SYSTEMTIME st;
-
+    unsigned int years;
+    BOOL ret;
 
     /* Invalid argument checks */
 
     ft.dwHighDateTime = 12345;
     ft.dwLowDateTime = 12345;
+    /* Windows 98 is a bit broken around these parts, it doesn't return FALSE as it should. */
+    /* If the resulting time is about 10000 AD, I consider the result invalid. */
+    ret = DosDateTimeToFileTime(0,0,&ft);
+    years = ((unsigned)ft.dwHighDateTime * 120) / 24 / 365;
     todo_wine {
-    ok( 0 == DosDateTimeToFileTime(0,0,&ft),
-        "Invalid DOS date/time, DosDateTimeToFileTime() didn't fail!\n"
-        "ft.dwHighDateTime=%d, ft.dwLowDateTime=%d.\n\n", (int)ft.dwHighDateTime, (int)ft.dwLowDateTime);
+        ok (FALSE == ret || years > 10000, "Invalid DOS date/time, DosDateTimeToFileTime() didn't fail!\n");
+        trace ("ft.dwHighDateTime=%d, ft.dwLowDateTime=%d.\n\n", (int)ft.dwHighDateTime, (int)ft.dwLowDateTime);
     }
 
     memset(&ft,0,sizeof ft);
@@ -155,8 +159,12 @@
 
     ft.dwHighDateTime = 11111;
     ft.dwLowDateTime = 22222;
-    ok( 0 == SystemTimeToFileTime(&st, &ft), "SystemTimeToFileTime() succeded unexpectedly!\n"
-        "ft.dwHighDateTime=%d, ft.dwLowDateTime=%d.\n\n", (int)ft.dwHighDateTime, (int)ft.dwLowDateTime);
+    /* Windows 98 is a bit broken around these parts, it doesn't return FALSE as it should. */
+    /* If the resulting time is about 10000 AD, I consider the result invalid. */
+    ret = SystemTimeToFileTime(&st, &ft);
+    years = ((unsigned)ft.dwHighDateTime * 120) / 24 / 365;
+    ok( FALSE == ret || years > 10000, "SystemTimeToFileTime() succeded unexpectedly!\n");
+    trace ("ft.dwHighDateTime=%x, ft.dwLowDateTime=%d.\n\n", (int)ft.dwHighDateTime, (int)ft.dwLowDateTime);
 
     /* with a bad hour */
     SETUP_1980(st)
@@ -469,3 +477,4 @@
     test_FileTimeToLocalFileTime();
     test_TzSpecificLocalTimeToSystemTime();
 }
+


More information about the wine-patches mailing list