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.

This commit is contained in:
LoRd_MuldeR 2012-03-02 14:31:13 +01:00
parent 80df6532cd
commit c5b692ffd8
2 changed files with 9 additions and 5 deletions

View File

@ -30,7 +30,7 @@
#define VER_LAMEXP_MINOR_LO 4 #define VER_LAMEXP_MINOR_LO 4
#define VER_LAMEXP_TYPE Beta #define VER_LAMEXP_TYPE Beta
#define VER_LAMEXP_PATCH 4 #define VER_LAMEXP_PATCH 4
#define VER_LAMEXP_BUILD 898 #define VER_LAMEXP_BUILD 899
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// Tool versions (minimum expected versions!) // Tool versions (minimum expected versions!)

View File

@ -68,12 +68,16 @@ AbstractTool::AbstractTool(void)
if(m_jobObjRefCount < 1U) if(m_jobObjRefCount < 1U)
{ {
if(!CreateJobObjectPtr || !SetInformationJobObjectPtr) DWORD osVersionNo = lamexp_get_os_version();
if(((HIWORD(osVersionNo) == 5) && (LOWORD(osVersionNo) >= 1)) || (HIWORD(osVersionNo) > 5))
{
if((!CreateJobObjectPtr) || (!SetInformationJobObjectPtr))
{ {
QLibrary Kernel32Lib("kernel32.dll"); QLibrary Kernel32Lib("kernel32.dll");
CreateJobObjectPtr = (CreateJobObjectFun) Kernel32Lib.resolve("CreateJobObjectA"); CreateJobObjectPtr = (CreateJobObjectFun) Kernel32Lib.resolve("CreateJobObjectA");
SetInformationJobObjectPtr = (SetInformationJobObjectFun) Kernel32Lib.resolve("SetInformationJobObject"); SetInformationJobObjectPtr = (SetInformationJobObjectFun) Kernel32Lib.resolve("SetInformationJobObject");
} }
}
if(CreateJobObjectPtr && SetInformationJobObjectPtr) if(CreateJobObjectPtr && SetInformationJobObjectPtr)
{ {
HANDLE jobObject = CreateJobObjectPtr(NULL, NULL); HANDLE jobObject = CreateJobObjectPtr(NULL, NULL);