Louis Lenders : ntdll: Set the IdleTime member from the SystemPerformanceInformation info class in NtQuerySystemInformation .

Alexandre Julliard julliard at winehq.org
Fri Nov 26 10:20:06 CST 2010


Module: wine
Branch: master
Commit: fa2b7066e547294ac1f2452b9d60afeb97d4492f
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=fa2b7066e547294ac1f2452b9d60afeb97d4492f

Author: Louis Lenders <xerox_xerox2000 at yahoo.co.uk>
Date:   Fri Nov 19 18:57:08 2010 +0100

ntdll: Set the IdleTime member from the SystemPerformanceInformation info class in NtQuerySystemInformation.

---

 dlls/ntdll/nt.c |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/dlls/ntdll/nt.c b/dlls/ntdll/nt.c
index ba4202f..7ad56e4 100644
--- a/dlls/ntdll/nt.c
+++ b/dlls/ntdll/nt.c
@@ -1370,12 +1370,28 @@ NTSTATUS WINAPI NtQuerySystemInformation(
         {
             SYSTEM_PERFORMANCE_INFORMATION spi;
             static BOOL fixme_written = FALSE;
+            FILE *fp;
 
             memset(&spi, 0 , sizeof(spi));
             len = sizeof(spi);
 
             spi.Reserved3 = 0x7fffffff; /* Available paged pool memory? */
 
+            if ((fp = fopen("/proc/uptime", "r")))
+            {
+                double uptime, idle_time;
+
+                fscanf(fp, "%lf %lf", &uptime, &idle_time);
+                fclose(fp);
+                spi.IdleTime.QuadPart = 10000000 * idle_time;
+            }
+            else
+            {
+                static ULONGLONG idle;
+                /* many programs expect IdleTime to change so fake change */
+                spi.IdleTime.QuadPart = ++idle;
+            }
+
             if (Length >= len)
             {
                 if (!SystemInformation) ret = STATUS_ACCESS_VIOLATION;




More information about the wine-cvs mailing list