[Bug 18705] Exception in NtQuerySystemInformation when running HeavyLoad.exe

wine-bugs at winehq.org wine-bugs at winehq.org
Sun May 31 04:25:37 CDT 2009


http://bugs.winehq.org/show_bug.cgi?id=18705


Anastasius Focht <focht at gmx.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |focht at gmx.net




--- Comment #10 from Anastasius Focht <focht at gmx.net>  2009-05-31 04:25:36 ---
Hello,

although it's always welcome that people give as much information as possible
in bug reports please don't overdo it - sometimes less is more ;-)
Thanks anyway.

The programs try to determine the CPU load using a common pattern and due to
bad programming they go into recursion, eating up all the stack.

There are many examples/snippet in various programming languages how to do this
in Windows.
One example snippet:
http://cpansearch.perl.org/src/KXJ/Win32-SystemInfo-CpuUsage-0.02/CpuUsage.xs

The example code snippet doesn't resemble the app code exactly but it should
give you an idea how it's done.

The problem is that Wine's SystemPerformanceInformation info class currently
doesn't return useful values.
The "idle time" (large integer) value will be ever zero on each retrieval.

To synchronize the "first time" calculation to sane values, the app uses a
"while" loop, retrieving the values, calculating differences to previous ones.
It checks the idle value and as long as it remains zero, it calls the "get cpu
usage" function recursively which leads to infinite recursion until stack
overflow.

Solution: Either provide "idle time" value from OS or non-zero "spike" the
value at least once in a while.

Regards

-- 
Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email
Do not reply to this email, post in Bugzilla using the
above URL to reply.
------- You are receiving this mail because: -------
You are watching all bug changes.



More information about the wine-bugs mailing list