typedef void (WINAPI *PGNSI)(LPSYSTEM_INFO);
DWORD GetNumberOfProcessors()
{
SYSTEM_INFO si;
// Call GetNativeSystemInfo if supported or GetSystemInfo otherwise.
PGNSI pfnGNSI = (PGNSI) GetProcAddress(GetModuleHandle(_T("kernel32.dll")), "GetNativeSystemInfo");
if(pfnGNSI)
{
pfnGNSI(&si);
}
else
{
GetSystemInfo(&si);
}
return si.dwNumberOfProcessors;
}