diff --git a/src/Config.h b/src/Config.h index 9d8ea51d..a0e96179 100644 --- a/src/Config.h +++ b/src/Config.h @@ -30,7 +30,7 @@ #define VER_LAMEXP_MINOR_LO 3 #define VER_LAMEXP_TYPE RC #define VER_LAMEXP_PATCH 3 -#define VER_LAMEXP_BUILD 760 +#define VER_LAMEXP_BUILD 762 /////////////////////////////////////////////////////////////////////////////// // Tools versions diff --git a/src/Thread_CPUObserver.cpp b/src/Thread_CPUObserver.cpp index 99b04086..dacc247b 100644 --- a/src/Thread_CPUObserver.cpp +++ b/src/Thread_CPUObserver.cpp @@ -23,6 +23,9 @@ #include "Global.h" #include +#include + +typedef BOOL (WINAPI *GetSystemTimesPtr)(LPFILETIME lpIdleTime, LPFILETIME lpKernelTime, LPFILETIME lpUserTime); //////////////////////////////////////////////////////////// // Constructor & Destructor @@ -73,8 +76,21 @@ void CPUObserverThread::observe(void) { ULONGLONG sys[2], usr[2], idl[2]; FILETIME sysTime, usrTime, idlTime; + QLibrary kernel32("kernel32.dll"); + GetSystemTimesPtr getSystemTimes = NULL; bool first = true; double previous = -1.0; + + if(kernel32.load()) + { + getSystemTimes = reinterpret_cast(kernel32.resolve("GetSystemTimes")); + } + + if(getSystemTimes == NULL) + { + qWarning("GetSystemTimes() ist not available on this system!"); + return; + } for(size_t i = 0; i < 2; i++) { @@ -83,7 +99,7 @@ void CPUObserverThread::observe(void) while(!m_terminated) { - if(GetSystemTimes(&idlTime, &sysTime, &usrTime)) + if(getSystemTimes(&idlTime, &sysTime, &usrTime)) { sys[1] = sys[0]; sys[0] = filetime2ulonglong(&sysTime); usr[1] = usr[0]; usr[0] = filetime2ulonglong(&usrTime);