From c5b692ffd8c0b9e5097e7a1a7197880df836af40 Mon Sep 17 00:00:00 2001 From: lordmulder Date: Fri, 2 Mar 2012 14:31:13 +0100 Subject: [PATCH] Use the Job Object only on Windows XP and later. This avoids a bunch of warnings on Windows 2000, because SetInformationJobObject() is going to fail there. --- src/Config.h | 2 +- src/Tool_Abstract.cpp | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/Config.h b/src/Config.h index a6b63513..9805c847 100644 --- a/src/Config.h +++ b/src/Config.h @@ -30,7 +30,7 @@ #define VER_LAMEXP_MINOR_LO 4 #define VER_LAMEXP_TYPE Beta #define VER_LAMEXP_PATCH 4 -#define VER_LAMEXP_BUILD 898 +#define VER_LAMEXP_BUILD 899 /////////////////////////////////////////////////////////////////////////////// // Tool versions (minimum expected versions!) diff --git a/src/Tool_Abstract.cpp b/src/Tool_Abstract.cpp index 46dbf9f4..ff8935e8 100644 --- a/src/Tool_Abstract.cpp +++ b/src/Tool_Abstract.cpp @@ -68,11 +68,15 @@ AbstractTool::AbstractTool(void) if(m_jobObjRefCount < 1U) { - if(!CreateJobObjectPtr || !SetInformationJobObjectPtr) + DWORD osVersionNo = lamexp_get_os_version(); + if(((HIWORD(osVersionNo) == 5) && (LOWORD(osVersionNo) >= 1)) || (HIWORD(osVersionNo) > 5)) { - QLibrary Kernel32Lib("kernel32.dll"); - CreateJobObjectPtr = (CreateJobObjectFun) Kernel32Lib.resolve("CreateJobObjectA"); - SetInformationJobObjectPtr = (SetInformationJobObjectFun) Kernel32Lib.resolve("SetInformationJobObject"); + if((!CreateJobObjectPtr) || (!SetInformationJobObjectPtr)) + { + QLibrary Kernel32Lib("kernel32.dll"); + CreateJobObjectPtr = (CreateJobObjectFun) Kernel32Lib.resolve("CreateJobObjectA"); + SetInformationJobObjectPtr = (SetInformationJobObjectFun) Kernel32Lib.resolve("SetInformationJobObject"); + } } if(CreateJobObjectPtr && SetInformationJobObjectPtr) {