diff options
author | Steve Bennetts <steve@lindenlab.com> | 2009-11-20 17:38:42 -0800 |
---|---|---|
committer | Steve Bennetts <steve@lindenlab.com> | 2009-11-20 17:38:42 -0800 |
commit | 017b989de4f0c0c5ba29d7efa5f0677a80c25875 (patch) | |
tree | 7b137758e21dd0350c12d34417ad63adad62e107 | |
parent | c9101f603a7969f4d46a7d8d911fa8805d926548 (diff) | |
parent | 280a321867d02c5c139a974dfc89035ffb8dfcd6 (diff) |
Merge
--HG--
branch : product-engine
-rw-r--r-- | .hgignore | 2 | ||||
-rw-r--r-- | indra/llcommon/llsys.cpp | 129 | ||||
-rw-r--r-- | indra/newview/CMakeLists.txt | 2 | ||||
-rw-r--r-- | indra/newview/llappviewer.cpp | 9 |
4 files changed, 116 insertions, 26 deletions
@@ -13,6 +13,7 @@ LICENSES indra/.distcc indra/build-darwin-* indra/build-vc[0-9]* +indra/CMakeFiles indra/lib/mono/1.0/*.dll indra/lib/mono/indra/*.dll indra/lib/mono/indra/*.exe @@ -31,6 +32,7 @@ indra/newview/mozilla-universal-darwin.tgz indra/newview/res-sdl indra/newview/vivox-runtime indra/server-linux-* +indra/temp indra/test/linden_file.dat indra/test_apps/llmediatest/dependencies/i686-win32 indra/test_apps/terrain_mule/*.dll diff --git a/indra/llcommon/llsys.cpp b/indra/llcommon/llsys.cpp index 3652eeba72..cba8cf85b0 100644 --- a/indra/llcommon/llsys.cpp +++ b/indra/llcommon/llsys.cpp @@ -76,6 +76,75 @@ extern int errno; static const S32 CPUINFO_BUFFER_SIZE = 16383; LLCPUInfo gSysCPU; +#if LL_WINDOWS +#ifndef DLLVERSIONINFO
+typedef struct _DllVersionInfo
+{
+ DWORD cbSize;
+ DWORD dwMajorVersion;
+ DWORD dwMinorVersion;
+ DWORD dwBuildNumber;
+ DWORD dwPlatformID;
+}DLLVERSIONINFO;
+#endif
+
+#ifndef DLLGETVERSIONPROC
+typedef int (FAR WINAPI *DLLGETVERSIONPROC) (DLLVERSIONINFO *);
+#endif
+
+bool get_shell32_dll_version(DWORD& major, DWORD& minor, DWORD& build_number)
+{
+ bool result = false;
+ const U32 BUFF_SIZE = 32767;
+ WCHAR tempBuf[BUFF_SIZE];
+ if(GetSystemDirectory((LPWSTR)&tempBuf, BUFF_SIZE))
+ {
+
+ std::basic_string<WCHAR> shell32_path(tempBuf);
+
+ // Shell32.dll contains the DLLGetVersion function.
+ // according to msdn its not part of the API
+ // so you have to go in and get it.
+ // http://msdn.microsoft.com/en-us/library/bb776404(VS.85).aspx
+ shell32_path += TEXT("\\shell32.dll");
+
+ HMODULE hDllInst = LoadLibrary(shell32_path.c_str()); //load the DLL
+ if(hDllInst)
+ { // Could successfully load the DLL
+ DLLGETVERSIONPROC pDllGetVersion;
+ /*
+ You must get this function explicitly because earlier versions of the DLL
+ don't implement this function. That makes the lack of implementation of the
+ function a version marker in itself.
+ */
+ pDllGetVersion = (DLLGETVERSIONPROC) GetProcAddress(hDllInst,
+ "DllGetVersion");
+
+ if(pDllGetVersion)
+ {
+ // DLL supports version retrieval function
+ DLLVERSIONINFO dvi;
+
+ ZeroMemory(&dvi, sizeof(dvi));
+ dvi.cbSize = sizeof(dvi);
+ HRESULT hr = (*pDllGetVersion)(&dvi);
+
+ if(SUCCEEDED(hr))
+ { // Finally, the version is at our hands
+ major = dvi.dwMajorVersion;
+ minor = dvi.dwMinorVersion;
+ build_number = dvi.dwBuildNumber;
+ result = true;
+ }
+ }
+
+ FreeLibrary(hDllInst); // Release DLL
+ }
+ }
+ return result;
+}
+#endif // LL_WINDOWS + LLOSInfo::LLOSInfo() : mMajorVer(0), mMinorVer(0), mBuild(0) { @@ -98,6 +167,11 @@ LLOSInfo::LLOSInfo() : mMinorVer = osvi.dwMinorVersion; mBuild = osvi.dwBuildNumber; + DWORD shell32_major, shell32_minor, shell32_build; + bool got_shell32_version = get_shell32_dll_version(shell32_major, + shell32_minor, + shell32_build); + switch(osvi.dwPlatformId) { case VER_PLATFORM_WIN32_NT: @@ -122,8 +196,22 @@ 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.dwMinorVersion == 0) + { + mOSStringSimple = "Microsoft Windows Vista "; + } + 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 @@ -141,32 +229,13 @@ LLOSInfo::LLOSInfo() : //of windows than this code does (in case it is needed for the future) if ( si.wProcessorArchitecture==PROCESSOR_ARCHITECTURE_AMD64 ) //check for 64 bit { - if(osvi.wProductType == VER_NT_WORKSTATION) - mOSStringSimple = "Microsoft Windows Vista 64-bit "; - else - mOSStringSimple = "Microsoft Windows Vista Server 64-bit "; + mOSStringSimple += "64-bit "; } else if (si.wProcessorArchitecture==PROCESSOR_ARCHITECTURE_INTEL ) { - if(osvi.wProductType == VER_NT_WORKSTATION) - mOSStringSimple = "Microsoft Windows Vista 32-bit "; - else - mOSStringSimple = "Microsoft Windows Vista Server 32-bit "; - } - else // PROCESSOR_ARCHITECTURE_IA64 || PROCESSOR_ARCHITECTURE_UNKNOWN not checked - { - if(osvi.wProductType == VER_NT_WORKSTATION) - mOSStringSimple = "Microsoft Windows Vista "; - else - mOSStringSimple = "Microsoft Windows Vista Server "; + mOSStringSimple += "32-bit "; } } - else if(osvi.dwMajorVersion == 6 && osvi.dwMinorVersion == 1) - { - if(osvi.wProductType == VER_NT_WORKSTATION) - mOSStringSimple = "Microsoft Windows 7 "; - else mOSStringSimple = "Microsoft Windows 7 Server "; - } else // Use the registry on early versions of Windows NT. { mOSStringSimple = "Microsoft Windows (unrecognized) "; @@ -211,6 +280,7 @@ LLOSInfo::LLOSInfo() : csdversion.c_str(), (osvi.dwBuildNumber & 0xffff)); } + mOSString = mOSStringSimple + tmpstr; } break; @@ -240,6 +310,21 @@ LLOSInfo::LLOSInfo() : mOSString = mOSStringSimple; break; } + + std::string compatibility_mode; + if(got_shell32_version) + { + if(osvi.dwMajorVersion != shell32_major + || osvi.dwMinorVersion != shell32_minor) + { + compatibility_mode = llformat(" compatibility mode. real ver: %d.%d (Build %d)", + shell32_major, + shell32_minor, + shell32_build); + } + } + mOSString += compatibility_mode; + #else struct utsname un; if(uname(&un) != -1) diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index e7458529be..e8302ab5eb 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -1376,7 +1376,7 @@ if (WINDOWS) # sets the 'working directory' for debugging from visual studio. if (NOT UNATTENDED) add_custom_command( - TARGET ${VIEWER_BINARY_NAME} PRE_BUILD + TARGET ${VIEWER_BINARY_NAME} POST_BUILD COMMAND ${CMAKE_SOURCE_DIR}/tools/vstool/vstool.exe ARGS --solution diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index a5ca06ce30..4f2d3e9645 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -985,7 +985,8 @@ bool LLAppViewer::mainLoop() #endif //memory leaking simulation - LLFloaterMemLeak* mem_leak_instance = LLFloaterReg::getTypedInstance<LLFloaterMemLeak>("mem_leaking"); + LLFloaterMemLeak* mem_leak_instance = + LLFloaterReg::findTypedInstance<LLFloaterMemLeak>("mem_leaking"); if(mem_leak_instance) { mem_leak_instance->idle() ; @@ -1171,7 +1172,8 @@ bool LLAppViewer::mainLoop() catch(std::bad_alloc) { //stop memory leaking simulation - LLFloaterMemLeak* mem_leak_instance = LLFloaterReg::getTypedInstance<LLFloaterMemLeak>("mem_leaking"); + LLFloaterMemLeak* mem_leak_instance = + LLFloaterReg::findTypedInstance<LLFloaterMemLeak>("mem_leaking"); if(mem_leak_instance) { mem_leak_instance->stop() ; @@ -1199,7 +1201,8 @@ bool LLAppViewer::mainLoop() llwarns << "Bad memory allocation when saveFinalSnapshot() is called!" << llendl ; //stop memory leaking simulation - LLFloaterMemLeak* mem_leak_instance = LLFloaterReg::getTypedInstance<LLFloaterMemLeak>("mem_leaking"); + LLFloaterMemLeak* mem_leak_instance = + LLFloaterReg::findTypedInstance<LLFloaterMemLeak>("mem_leaking"); if(mem_leak_instance) { mem_leak_instance->stop() ; |