Hi,
There is a potential bug detecting the number of logical processors and page size in Win.
A 32 bit app running under WOW64 must use GetNativeSystemInfo(…).
So the function CPUFlags() (in juce_win32_SystemStats.cpp)
SystemStats::CPUFlags::CPUFlags()
{
hasMMX = IsProcessorFeaturePresent (PF_MMX_INSTRUCTIONS_AVAILABLE) != 0;
hasSSE = IsProcessorFeaturePresent (PF_XMMI_INSTRUCTIONS_AVAILABLE) != 0;
hasSSE2 = IsProcessorFeaturePresent (PF_XMMI64_INSTRUCTIONS_AVAILABLE) != 0;
#ifdef PF_AMD3D_INSTRUCTIONS_AVAILABLE
has3DNow = IsProcessorFeaturePresent (PF_AMD3D_INSTRUCTIONS_AVAILABLE) != 0;
#else
has3DNow = IsProcessorFeaturePresent (PF_3DNOW_INSTRUCTIONS_AVAILABLE) != 0;
#endif
SYSTEM_INFO systemInfo;
GetSystemInfo (&systemInfo);
numCpus = (int) systemInfo.dwNumberOfProcessors;
}
should be:
SystemStats::CPUFlags::CPUFlags()
{
hasMMX = IsProcessorFeaturePresent (PF_MMX_INSTRUCTIONS_AVAILABLE) != 0;
hasSSE = IsProcessorFeaturePresent (PF_XMMI_INSTRUCTIONS_AVAILABLE) != 0;
hasSSE2 = IsProcessorFeaturePresent (PF_XMMI64_INSTRUCTIONS_AVAILABLE) != 0;
#ifdef PF_AMD3D_INSTRUCTIONS_AVAILABLE
has3DNow = IsProcessorFeaturePresent (PF_AMD3D_INSTRUCTIONS_AVAILABLE) != 0;
#else
has3DNow = IsProcessorFeaturePresent (PF_3DNOW_INSTRUCTIONS_AVAILABLE) != 0;
#endif
SYSTEM_INFO systemInfo;
BOOL isWow64 = FALSE;
typedef BOOL(WINAPI* LPFN_ISWOW64PROCESS)(HANDLE, PBOOL);
LPFN_ISWOW64PROCESS fnIsWow64Process = (LPFN_ISWOW64PROCESS)GetProcAddress(GetModuleHandle(_T("kernel32")), "IsWow64Process");
if(fnIsWow64Process && fnIsWow64Process(GetCurrentProcess(), &isWow64) && isWow64)
{
// This is a 32 bit app running under WOW64
GetNativeSystemInfo(&systemInfo);
}
else
{
GetSystemInfo(&systemInfo);
}
numCpus = (int)systemInfo.dwNumberOfProcessors;
}
And the function SystemStats::getPageSize() should also use GetNativeSystemInfo(…) with 32 bit apps under WOW64.
