VirtualBox

Changeset 54931 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Mar 24, 2015 5:40:16 PM (10 years ago)
Author:
vboxsync
Message:

Runtime/r3/win: GetLogicalProcessorInformation is useless for querying the number of cores before Vista.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/r3/win/mp-win.cpp

    r48935 r54931  
    101101    /*
    102102     * Resolve the API dynamically (one try) as it requires XP w/ sp3 or later.
    103      */
     103     */   
    104104    typedef BOOL (WINAPI *PFNGETLOGICALPROCINFO)(PSYSTEM_LOGICAL_PROCESSOR_INFORMATION, PDWORD);
    105105    static PFNGETLOGICALPROCINFO s_pfnGetLogicalProcInfo = (PFNGETLOGICALPROCINFO)~(uintptr_t)0;
     
    107107        s_pfnGetLogicalProcInfo = (PFNGETLOGICALPROCINFO)RTLdrGetSystemSymbol("kernel32.dll", "GetLogicalProcessorInformation");
    108108
    109     if (s_pfnGetLogicalProcInfo)
     109    /*
     110     * Sadly, on XP and Server 2003, even if the API is present, it does not tell us
     111     * how many physical cores there are (any package will look like a single core).
     112     * That is worse than not using the API at all, so just skip it unless it's Vista+.
     113     */
     114    bool fIsVistaOrLater = false;
     115    OSVERSIONINFOEX OSInfoEx = { 0 };
     116    OSInfoEx.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
     117    if (   GetVersionEx((LPOSVERSIONINFO) &OSInfoEx)
     118        && (OSInfoEx.dwPlatformId == VER_PLATFORM_WIN32_NT)
     119        && (OSInfoEx.dwMajorVersion >= 6))
     120        fIsVistaOrLater = true;
     121
     122    if (s_pfnGetLogicalProcInfo && fIsVistaOrLater)
    110123    {
    111124        /*
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette