possibly new regression

Rein Klazes wijn at wanadoo.nl
Mon Feb 21 14:49:32 CST 2005


On Sun, 20 Feb 2005 16:41:09 +0100, you wrote:

> On Sun, 20 Feb 2005 16:04:54 +0100
> Rein Klazes <wijn at wanadoo.nl> wrote:
> > 
> > Does this patch help?
> > 
> > Rein.
> 
> Unfortunately not - still the exact same error.

Surprise :(

OK, I can try once more, perhaps the counter is much more then the
program expects (it resets when windows is restarted, here it counts up
from 1970/1/1). Try attached patch (first reverse previous patch, them
make; make install and test again)

Then if it does not work. As the patch fixes a real problem, reverting
is not an option. You will need to debug this to find out why the crash
happens.

If you run this with WINEDEBUG=+relay, can you look for both
QueryPerformanceCounter or QueryPerformanceFrequency in the lines just
before the crash?

With some luck the addresses of the call (look at ret=......) is near
where the crash happens ( it is reported by the debugger: 0x00500280)
and we can look at the disassembled code (debugger command 
"disass adr1, addr2").

Rein.
-------------- next part --------------
--- wine/dlls/ntdll/nt.c	2005-02-12 08:18:02.000000000 +0100
+++ mywine/dlls/ntdll/nt.c	2005-02-21 19:28:46.000000000 +0100
@@ -519,10 +519,14 @@ NTSTATUS WINAPI NtQueryPerformanceCounte
 	OUT PLARGE_INTEGER Counter,
 	OUT PLARGE_INTEGER Frequency)
 {
-    LARGE_INTEGER time;
-    NtQuerySystemTime( &time );
-    Counter->QuadPart = time.QuadPart;
-    Frequency->QuadPart = 10000000;
+    struct timeval now;
+    gettimeofday( &now, 0 );
+    /* convert a counter that increments at a rate of 1 MHz
+     * to one of 1193182 Hz, with some care for arithmetic overflows
+     * ( will not overflow until 2038 ) */
+    Counter->QuadPart = (((now.tv_sec - 1109009802)* (ULONGLONG) 1000000 + now.tv_usec )
+                        * 105) / 88 ; /* 105/88 = 1.19318182 */
+    Frequency->QuadPart = 1193182;
     return 0;
 }
 


More information about the wine-devel mailing list