[KERNEL] Fix QueryPerformanceFrenquency in the non-RTDSC case.

Lionel Ulmer lionel.ulmer at free.fr
Fri Dec 24 13:35:53 CST 2004

Hi all,

As my laptop uses frequency scaling, RTDSC is pretty useless as a way to
measure time so I hacked the Wine KERNEL32 sources to use the 'standard' way
... which did not work either.

This came form the fact that the frequency returned by
'QueryPerformanceFrequency' was wrong: the code uses 'NtQuerySystemTime'
which, according to MSDN, returns the time in 'number of 100-nanosecond
intervals'. So the frequency is 10000000 instead of 1000000 (one zero
missing for those that cannot count :-) ).

With that (and the un-sent disabling of RTDSC) the game now runs at its
proper speed.

Now what would the proper fix be for laptops ? Completely remove the RTDSC
case for everyone at a slight performance hit on non-frequency-scaling PCs
or add a registry key to control this ?


 - fix non-RTDSC case for QueryPerformanceFrequency

		 Lionel Ulmer - http://www.bbrox.org/
-------------- next part --------------
Index: dlls/kernel/cpu.c
RCS file: /home/wine/wine/dlls/kernel/cpu.c,v
retrieving revision 1.7
diff -u -r1.7 cpu.c
--- dlls/kernel/cpu.c	18 Oct 2004 19:38:41 -0000	1.7
+++ dlls/kernel/cpu.c	24 Dec 2004 19:29:18 -0000
@@ -226,7 +226,7 @@
         return TRUE;
-    frequency->u.LowPart  = 1000000;
+    frequency->u.LowPart  = 10000000;
     frequency->u.HighPart = 0;
     return TRUE;

More information about the wine-patches mailing list