From 285c11b7a6326841a164691559a23c6ec1fff093 Mon Sep 17 00:00:00 2001 From: McCabe Maxsted Date: Sun, 15 Aug 2010 17:12:38 -0700 Subject: Applied patch for #424: fix proper detection of Windows 7, backport from Snowglobe 2.0 by Ansariel Hiller --- linden/indra/llcommon/llsys.cpp | 42 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 39 insertions(+), 3 deletions(-) (limited to 'linden/indra/llcommon/llsys.cpp') diff --git a/linden/indra/llcommon/llsys.cpp b/linden/indra/llcommon/llsys.cpp index 2e93b2a..a56ac47 100644 --- a/linden/indra/llcommon/llsys.cpp +++ b/linden/indra/llcommon/llsys.cpp @@ -122,14 +122,50 @@ LLOSInfo::LLOSInfo() : else mOSStringSimple = "Microsoft Windows Server 2003 "; } - else if(osvi.dwMajorVersion == 6 && osvi.dwMinorVersion == 0) + else if(osvi.dwMajorVersion == 6 && osvi.dwMinorVersion <= 1) { - if(osvi.wProductType == VER_NT_WORKSTATION) + if(osvi.dwMinorVersion == 0) + { mOSStringSimple = "Microsoft Windows Vista "; - else mOSStringSimple = "Microsoft Windows Vista Server "; + } + else if(osvi.dwMinorVersion == 1) + { + mOSStringSimple = "Microsoft Windows 7 "; + } + + if(osvi.wProductType != VER_NT_WORKSTATION) + { + mOSStringSimple += "Server "; + } + + ///get native system info if available.. + typedef void (WINAPI *PGNSI)(LPSYSTEM_INFO); ///function pointer for loading GetNativeSystemInfo + SYSTEM_INFO si; //System Info object file contains architecture info + PGNSI pGNSI; //pointer object + ZeroMemory(&si, sizeof(SYSTEM_INFO)); //zero out the memory in information + pGNSI = (PGNSI) GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")), "GetNativeSystemInfo"); //load kernel32 get function + if(NULL != pGNSI) //check if it has failed + pGNSI(&si); //success + else + GetSystemInfo(&si); //if it fails get regular system info + //(Warning: If GetSystemInfo it may result in incorrect information in a WOW64 machine, if the kernel fails to load) + + //msdn microsoft finds 32 bit and 64 bit flavors this way.. + //http://msdn.microsoft.com/en-us/library/ms724429(VS.85).aspx (example code that contains quite a few more flavors + //of windows than this code does (in case it is needed for the future) + if ( si.wProcessorArchitecture==PROCESSOR_ARCHITECTURE_AMD64 ) //check for 64 bit + { + mOSStringSimple += "64-bit "; + } + else if (si.wProcessorArchitecture==PROCESSOR_ARCHITECTURE_INTEL ) + { + mOSStringSimple += "32-bit "; + } } else // Use the registry on early versions of Windows NT. { + mOSStringSimple = "Microsoft Windows (unrecognized) "; + HKEY hKey; WCHAR szProductType[80]; DWORD dwBufLen; -- cgit v1.1