diff --git a/indra/llaudio/llaudiodecodemgr.cpp b/indra/llaudio/llaudiodecodemgr.cpp
index 58acd1083cce6425b69c6d9105a51a7e5f29396c..e7db84f6ab2783b048a778ae5f1ef551bfa012cd 100644
--- a/indra/llaudio/llaudiodecodemgr.cpp
+++ b/indra/llaudio/llaudiodecodemgr.cpp
@@ -271,11 +271,7 @@ BOOL LLVorbisDecodeState::initDecode()
 		mWAVBuffer.reserve(size_guess);
 		mWAVBuffer.resize(WAV_HEADER_SIZE);
 	}
-<<<<<<< HEAD
-	catch (const std::bad_alloc&)
-=======
 	catch (std::bad_alloc&)
->>>>>>> Linden_Release/master
 	{
 		LL_WARNS("AudioEngine") << "Out of memory when trying to alloc buffer: " << size_guess << LL_ENDL;
 		delete mInFilep;
diff --git a/indra/llcommon/llsdserialize.cpp b/indra/llcommon/llsdserialize.cpp
index 22b9c7937d1c1ff6c17d964e3e882b0432fb1662..8fcfaa7bc6c0cf4fac4fc42164b5360c285ae3da 100644
--- a/indra/llcommon/llsdserialize.cpp
+++ b/indra/llcommon/llsdserialize.cpp
@@ -2250,11 +2250,7 @@ LLUZipHelper::EZipRresult LLUZipHelper::unzip_llsd(LLSD& data, std::istream& is,
 			return ZR_SIZE_ERROR;
 		}
 #endif
-<<<<<<< HEAD
-		catch (const std::bad_alloc&)
-=======
 		catch (std::bad_alloc&)
->>>>>>> Linden_Release/master
 		{
 			free(result);
 			return ZR_MEM_ERROR;
diff --git a/indra/llcorehttp/_httpservice.cpp b/indra/llcorehttp/_httpservice.cpp
index 5f32e80f7079a2b3da6b7ec40f040d00fbe7c7e5..34268d94f64969b4746f302530a14e196fe3c72d 100644
--- a/indra/llcorehttp/_httpservice.cpp
+++ b/indra/llcorehttp/_httpservice.cpp
@@ -318,7 +318,6 @@ void HttpService::threadRun(LLCoreInt::HttpThread * thread)
         {
             LOG_UNHANDLED_EXCEPTION("");
         }
-        catch (const std::bad_alloc&)
         catch (std::bad_alloc&)
         {
             LLMemory::logMemoryInfo(TRUE);
diff --git a/indra/llcorehttp/bufferarray.cpp b/indra/llcorehttp/bufferarray.cpp
index 217c5985a91a67641237f4ab9c96c0b7371e1cba..e0b2876a0016167b6dc007da55e8eef869f54287 100644
--- a/indra/llcorehttp/bufferarray.cpp
+++ b/indra/llcorehttp/bufferarray.cpp
@@ -147,11 +147,7 @@ size_t BufferArray::append(const void * src, size_t len)
         {
             block = Block::alloc(BLOCK_ALLOC_SIZE);
         }
-<<<<<<< HEAD
-        catch (const std::bad_alloc&)
-=======
         catch (std::bad_alloc&)
->>>>>>> Linden_Release/master
         {
             LLMemory::logMemoryInfo(TRUE);
 
diff --git a/indra/llimage/llimagejpeg.cpp b/indra/llimage/llimagejpeg.cpp
index 8d151832bae5096a2719a57b59beb025c48545a6..b9561c2c1bd7f165b3fbf9374b024aef4e05d4ff 100644
--- a/indra/llimage/llimagejpeg.cpp
+++ b/indra/llimage/llimagejpeg.cpp
@@ -315,11 +315,7 @@ bool LLImageJPEG::decode(LLImageRaw* raw_image, F32 decode_time)
 		jpeg_destroy_decompress(&cinfo);
 	}
 
-<<<<<<< HEAD
-	catch (const std::bad_alloc&)
-=======
 	catch (std::bad_alloc&)
->>>>>>> Linden_Release/master
 	{
 		setLastError( "Out of memory");
 		jpeg_destroy_decompress(&cinfo);
diff --git a/indra/llimage/llpngwrapper.cpp b/indra/llimage/llpngwrapper.cpp
index 88d7ffbd3340ec3800ca90a9eb38b135fe79b997..f7dc6272cf94cc7c5ad4319669781eb7f63f9080 100644
--- a/indra/llimage/llpngwrapper.cpp
+++ b/indra/llimage/llpngwrapper.cpp
@@ -210,11 +210,7 @@ BOOL LLPngWrapper::readPng(U8* src, S32 dataSize, LLImageRaw* rawImage, ImageInf
 		releaseResources();
 		return (FALSE);
 	}
-<<<<<<< HEAD
-	catch (const std::bad_alloc&)
-=======
 	catch (std::bad_alloc&)
->>>>>>> Linden_Release/master
 	{
 		mErrorMessage = "LLPngWrapper";
 		releaseResources();
diff --git a/indra/llmath/llvolume.cpp b/indra/llmath/llvolume.cpp
index ad3b8318ddd78b65d606ae4773d2924af5317393..c20dcfe6f893a6915e2e5daf2bffbc2bddc2bbaf 100644
--- a/indra/llmath/llvolume.cpp
+++ b/indra/llmath/llvolume.cpp
@@ -5325,11 +5325,7 @@ bool LLVolumeFace::cacheOptimize()
 		triangle_data.resize(mNumIndices / 3);
 		vertex_data.resize(mNumVertices);
 	}
-<<<<<<< HEAD
-	catch (const std::bad_alloc&)
-=======
 	catch (std::bad_alloc&)
->>>>>>> Linden_Release/master
 	{
 		LL_WARNS("LLVOLUME") << "Resize failed" << LL_ENDL;
 		return false;
@@ -5483,11 +5479,7 @@ bool LLVolumeFace::cacheOptimize()
 	{
 		new_idx.resize(mNumVertices, -1);
 	}
-<<<<<<< HEAD
-	catch (const std::bad_alloc&)
-=======
 	catch (std::bad_alloc&)
->>>>>>> Linden_Release/master
 	{
 		ll_aligned_free<64>(pos);
 		ll_aligned_free_16(wght);
diff --git a/indra/llmessage/llcorehttputil.cpp b/indra/llmessage/llcorehttputil.cpp
index 45e53272ebcacdfde41c9a9572b1da63a658eda8..0eae6d98263a30f27e51febc085c8ae4210759f0 100644
--- a/indra/llmessage/llcorehttputil.cpp
+++ b/indra/llmessage/llcorehttputil.cpp
@@ -597,11 +597,7 @@ LLSD HttpCoroJSONHandler::handleSuccess(LLCore::HttpResponse * response, LLCore:
     {
         bas >> jsonRoot;
     }
-<<<<<<< HEAD
-    catch (const std::runtime_error& e)
-=======
     catch (std::runtime_error& e)
->>>>>>> Linden_Release/master
     {   // deserialization failed.  Record the reason and pass back an empty map for markup.
         status = LLCore::HttpStatus(499, std::string(e.what()));
         return result;
@@ -629,11 +625,7 @@ LLSD HttpCoroJSONHandler::parseBody(LLCore::HttpResponse *response, bool &succes
     {
         bas >> jsonRoot;
     }
-<<<<<<< HEAD
-    catch (const std::runtime_error&)
-=======
     catch (std::runtime_error&)
->>>>>>> Linden_Release/master
     {   
         success = false;
         return LLSD();
diff --git a/indra/llmessage/llhttpnode.cpp b/indra/llmessage/llhttpnode.cpp
index 4cbb40cfe4604d1eb54a9532beb7343397bc7756..6fd17c91549b59adce034624f8b9f4f25fb15c70 100644
--- a/indra/llmessage/llhttpnode.cpp
+++ b/indra/llmessage/llhttpnode.cpp
@@ -125,11 +125,7 @@ void LLHTTPNode::get(LLHTTPNode::ResponsePtr response, const LLSD& context) cons
 	{
 		response->result(simpleGet());
 	}
-<<<<<<< HEAD
-	catch (const NotImplemented&)
-=======
 	catch (NotImplemented&)
->>>>>>> Linden_Release/master
 	{
 		response->methodNotAllowed();
 	}
@@ -142,11 +138,7 @@ void LLHTTPNode::put(LLHTTPNode::ResponsePtr response, const LLSD& context, cons
 	{
 		response->result(simplePut(input));
 	}
-<<<<<<< HEAD
-	catch (const NotImplemented&)
-=======
 	catch (NotImplemented&)
->>>>>>> Linden_Release/master
 	{
 		response->methodNotAllowed();
 	}
@@ -159,11 +151,7 @@ void LLHTTPNode::post(LLHTTPNode::ResponsePtr response, const LLSD& context, con
 	{
 		response->result(simplePost(input));
 	}
-<<<<<<< HEAD
-	catch (const NotImplemented&)
-=======
 	catch (NotImplemented&)
->>>>>>> Linden_Release/master
 	{
 		response->methodNotAllowed();
 	}
@@ -176,11 +164,7 @@ void LLHTTPNode::del(LLHTTPNode::ResponsePtr response, const LLSD& context) cons
     {
 	response->result(simpleDel(context));
     }
-<<<<<<< HEAD
-    catch (const NotImplemented&)
-=======
     catch (NotImplemented&)
->>>>>>> Linden_Release/master
     {
 	response->methodNotAllowed();
     }
diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp
index 83e5d7900953674adfd392e5c6812a27c870d8d0..cdc86c45f8997cd0ae421e0e235811c9fd13a81d 100644
--- a/indra/llrender/llgl.cpp
+++ b/indra/llrender/llgl.cpp
@@ -699,41 +699,6 @@ bool LLGLManager::initGL()
 	initExtensions();
 	stop_glerror();
 
-<<<<<<< HEAD
-	if (mVRAM == 0)
-	{
-		S32 old_vram = mVRAM;
-
-		if (mHasATIMemInfo)
-		{ //ask the gl how much vram is free at startup and attempt to use no more than half of that
-			S32 meminfo[4];
-			glGetIntegerv(GL_TEXTURE_FREE_MEMORY_ATI, meminfo);
-
-			mVRAM = meminfo[0] / 1024;
-		}
-		else if (mHasNVXMemInfo)
-		{
-			S32 dedicated_memory;
-			glGetIntegerv(GL_GPU_MEMORY_INFO_DEDICATED_VIDMEM_NVX, &dedicated_memory);
-			mVRAM = dedicated_memory / 1024;
-		}
-
-		if (mVRAM < 256)
-		{ //something likely went wrong using the above extensions, fall back to old method
-			mVRAM = old_vram;
-			LL_INFOS("RenderInit") << "Failed to detect VRAM from GL falling back to value: " << mVRAM << LL_ENDL;
-		}
-		else
-		{
-			LL_INFOS("RenderInit") << "Detected VRAM from GL: " << mVRAM << LL_ENDL;
-		}
-	}
-	else
-	{
-		LL_INFOS("RenderInit") << "Using VRAM value from OS: " << mVRAM << LL_ENDL;
-	}
-
-=======
 	S32 old_vram = mVRAM;
 	mVRAM = 0;
 
@@ -812,7 +777,6 @@ bool LLGLManager::initGL()
 
 	stop_glerror();
 
->>>>>>> Linden_Release/master
 	stop_glerror();
 
 	if (mHasFragmentShader)
diff --git a/indra/llwindow/lldxhardware.cpp b/indra/llwindow/lldxhardware.cpp
index 287eb44a9ecd0e9f09173de96e1c731aea3e8621..0d830de22caae13f306bffee389e60720ba1b92f 100644
--- a/indra/llwindow/lldxhardware.cpp
+++ b/indra/llwindow/lldxhardware.cpp
@@ -34,7 +34,6 @@
 #include <dxdiag.h>
 #undef INITGUID
 
-#include <dxgi.h>
 #include <wbemidl.h>
 #include <comdef.h>
 
@@ -48,7 +47,7 @@
 #include "llstl.h"
 #include "lltimer.h"
 
-void(*gWriteDebug)(const char* msg) = nullptr;
+void(*gWriteDebug)(const char* msg) = NULL;
 LLDXHardware gDXHardware;
 
 //-----------------------------------------------------------------------------
@@ -58,171 +57,165 @@ LLDXHardware gDXHardware;
 #define SAFE_DELETE_ARRAY(p) { if(p) { delete[] (p);   (p)=NULL; } }
 #define SAFE_RELEASE(p)      { if(p) { (p)->Release(); (p)=NULL; } }
 
-<<<<<<< HEAD
 typedef BOOL(WINAPI* PfnCoSetProxyBlanket)(IUnknown* pProxy, DWORD dwAuthnSvc, DWORD dwAuthzSvc,
 	OLECHAR* pServerPrincName, DWORD dwAuthnLevel, DWORD dwImpLevel,
 	RPC_AUTH_IDENTITY_HANDLE pAuthInfo, DWORD dwCapabilities);
-=======
-typedef BOOL ( WINAPI* PfnCoSetProxyBlanket )( IUnknown* pProxy, DWORD dwAuthnSvc, DWORD dwAuthzSvc,
-                                               OLECHAR* pServerPrincName, DWORD dwAuthnLevel, DWORD dwImpLevel,
-                                               RPC_AUTH_IDENTITY_HANDLE pAuthInfo, DWORD dwCapabilities );
 
 HRESULT GetVideoMemoryViaWMI(WCHAR* strInputDeviceID, DWORD* pdwAdapterRam)
 {
-    HRESULT hr;
-    bool bGotMemory = false;
-    HRESULT hrCoInitialize = S_OK;
-    IWbemLocator* pIWbemLocator = nullptr;
-    IWbemServices* pIWbemServices = nullptr;
-    BSTR pNamespace = nullptr;
-
-    *pdwAdapterRam = 0;
-    hrCoInitialize = CoInitialize( 0 );
-
-    hr = CoCreateInstance( CLSID_WbemLocator,
-                           nullptr,
-                           CLSCTX_INPROC_SERVER,
-                           IID_IWbemLocator,
-                           ( LPVOID* )&pIWbemLocator );
+	HRESULT hr;
+	bool bGotMemory = false;
+	HRESULT hrCoInitialize = S_OK;
+	IWbemLocator* pIWbemLocator = nullptr;
+	IWbemServices* pIWbemServices = nullptr;
+	BSTR pNamespace = nullptr;
+
+	*pdwAdapterRam = 0;
+	hrCoInitialize = CoInitialize(0);
+
+	hr = CoCreateInstance(CLSID_WbemLocator,
+		nullptr,
+		CLSCTX_INPROC_SERVER,
+		IID_IWbemLocator,
+		(LPVOID*)&pIWbemLocator);
 #ifdef PRINTF_DEBUGGING
-    if( FAILED( hr ) ) wprintf( L"WMI: CoCreateInstance failed: 0x%0.8x\n", hr );
+	if (FAILED(hr)) wprintf(L"WMI: CoCreateInstance failed: 0x%0.8x\n", hr);
 #endif
 
-    if( SUCCEEDED( hr ) && pIWbemLocator )
-    {
-        // Using the locator, connect to WMI in the given namespace.
-        pNamespace = SysAllocString( L"\\\\.\\root\\cimv2" );
+	if (SUCCEEDED(hr) && pIWbemLocator)
+	{
+		// Using the locator, connect to WMI in the given namespace.
+		pNamespace = SysAllocString(L"\\\\.\\root\\cimv2");
 
-        hr = pIWbemLocator->ConnectServer( pNamespace, nullptr, nullptr, 0L,
-                                           0L, nullptr, nullptr, &pIWbemServices );
+		hr = pIWbemLocator->ConnectServer(pNamespace, nullptr, nullptr, 0L,
+			0L, nullptr, nullptr, &pIWbemServices);
 #ifdef PRINTF_DEBUGGING
-        if( FAILED( hr ) ) wprintf( L"WMI: pIWbemLocator->ConnectServer failed: 0x%0.8x\n", hr );
+		if (FAILED(hr)) wprintf(L"WMI: pIWbemLocator->ConnectServer failed: 0x%0.8x\n", hr);
 #endif
-        if( SUCCEEDED( hr ) && pIWbemServices != 0 )
-        {
-            HINSTANCE hinstOle32 = nullptr;
+		if (SUCCEEDED(hr) && pIWbemServices != 0)
+		{
+			HINSTANCE hinstOle32 = nullptr;
 
-            hinstOle32 = LoadLibraryW( L"ole32.dll" );
-            if( hinstOle32 )
-            {
-                PfnCoSetProxyBlanket pfnCoSetProxyBlanket = nullptr;
+			hinstOle32 = LoadLibraryW(L"ole32.dll");
+			if (hinstOle32)
+			{
+				PfnCoSetProxyBlanket pfnCoSetProxyBlanket = nullptr;
 
-                pfnCoSetProxyBlanket = ( PfnCoSetProxyBlanket )GetProcAddress( hinstOle32, "CoSetProxyBlanket" );
-                if( pfnCoSetProxyBlanket != 0 )
-                {
-                    // Switch security level to IMPERSONATE. 
-                    pfnCoSetProxyBlanket( pIWbemServices, RPC_C_AUTHN_WINNT, RPC_C_AUTHZ_NONE, nullptr,
-                                          RPC_C_AUTHN_LEVEL_CALL, RPC_C_IMP_LEVEL_IMPERSONATE, nullptr, 0 );
-                }
+				pfnCoSetProxyBlanket = (PfnCoSetProxyBlanket)GetProcAddress(hinstOle32, "CoSetProxyBlanket");
+				if (pfnCoSetProxyBlanket != 0)
+				{
+					// Switch security level to IMPERSONATE. 
+					pfnCoSetProxyBlanket(pIWbemServices, RPC_C_AUTHN_WINNT, RPC_C_AUTHZ_NONE, nullptr,
+						RPC_C_AUTHN_LEVEL_CALL, RPC_C_IMP_LEVEL_IMPERSONATE, nullptr, 0);
+				}
 
-                FreeLibrary( hinstOle32 );
-            }
+				FreeLibrary(hinstOle32);
+			}
 
-            IEnumWbemClassObject* pEnumVideoControllers = nullptr;
-            BSTR pClassName = nullptr;
+			IEnumWbemClassObject* pEnumVideoControllers = nullptr;
+			BSTR pClassName = nullptr;
 
-            pClassName = SysAllocString( L"Win32_VideoController" );
+			pClassName = SysAllocString(L"Win32_VideoController");
 
-            hr = pIWbemServices->CreateInstanceEnum( pClassName, 0,
-                                                     nullptr, &pEnumVideoControllers );
+			hr = pIWbemServices->CreateInstanceEnum(pClassName, 0,
+				nullptr, &pEnumVideoControllers);
 #ifdef PRINTF_DEBUGGING
-            if( FAILED( hr ) ) wprintf( L"WMI: pIWbemServices->CreateInstanceEnum failed: 0x%0.8x\n", hr );
+			if (FAILED(hr)) wprintf(L"WMI: pIWbemServices->CreateInstanceEnum failed: 0x%0.8x\n", hr);
 #endif
 
-            if( SUCCEEDED( hr ) && pEnumVideoControllers )
-            {
-                IWbemClassObject* pVideoControllers[10] = {0};
-                DWORD uReturned = 0;
-                BSTR pPropName = nullptr;
-
-                // Get the first one in the list
-                pEnumVideoControllers->Reset();
-                hr = pEnumVideoControllers->Next( 5000,             // timeout in 5 seconds
-                                                  10,                  // return the first 10
-                                                  pVideoControllers,
-                                                  &uReturned );
+			if (SUCCEEDED(hr) && pEnumVideoControllers)
+			{
+				IWbemClassObject* pVideoControllers[10] = { 0 };
+				DWORD uReturned = 0;
+				BSTR pPropName = nullptr;
+
+				// Get the first one in the list
+				pEnumVideoControllers->Reset();
+				hr = pEnumVideoControllers->Next(5000,             // timeout in 5 seconds
+					10,                  // return the first 10
+					pVideoControllers,
+					&uReturned);
 #ifdef PRINTF_DEBUGGING
-                if( FAILED( hr ) ) wprintf( L"WMI: pEnumVideoControllers->Next failed: 0x%0.8x\n", hr );
-                if( uReturned == 0 ) wprintf( L"WMI: pEnumVideoControllers uReturned == 0\n" );
+				if (FAILED(hr)) wprintf(L"WMI: pEnumVideoControllers->Next failed: 0x%0.8x\n", hr);
+				if (uReturned == 0) wprintf(L"WMI: pEnumVideoControllers uReturned == 0\n");
 #endif
 
-                VARIANT var;
-                if( SUCCEEDED( hr ) )
-                {
-                    bool bFound = false;
-                    for( UINT iController = 0; iController < uReturned; iController++ )
-                    {
-                        if ( !pVideoControllers[iController] )
-                            continue;
-
-                        // if strInputDeviceID is set find this specific device and return memory or specific device
-                        // if strInputDeviceID is not set return the best device
-                        if (strInputDeviceID)
-                        {
-                            pPropName = SysAllocString( L"PNPDeviceID" );
-                            hr = pVideoControllers[iController]->Get( pPropName, 0L, &var, nullptr, nullptr );
+				VARIANT var;
+				if (SUCCEEDED(hr))
+				{
+					bool bFound = false;
+					for (UINT iController = 0; iController < uReturned; iController++)
+					{
+						if (!pVideoControllers[iController])
+							continue;
+
+						// if strInputDeviceID is set find this specific device and return memory or specific device
+						// if strInputDeviceID is not set return the best device
+						if (strInputDeviceID)
+						{
+							pPropName = SysAllocString(L"PNPDeviceID");
+							hr = pVideoControllers[iController]->Get(pPropName, 0L, &var, nullptr, nullptr);
 #ifdef PRINTF_DEBUGGING
-                            if( FAILED( hr ) )
-                                wprintf( L"WMI: pVideoControllers[iController]->Get PNPDeviceID failed: 0x%0.8x\n", hr );
+							if (FAILED(hr))
+								wprintf(L"WMI: pVideoControllers[iController]->Get PNPDeviceID failed: 0x%0.8x\n", hr);
 #endif
-                            if( SUCCEEDED( hr ) && strInputDeviceID)
-                            {
-                                if( wcsstr( var.bstrVal, strInputDeviceID ) != 0 )
-                                    bFound = true;
-                            }
-                            VariantClear( &var );
-                            if( pPropName ) SysFreeString( pPropName );
-                        }
-
-                        if( bFound || !strInputDeviceID )
-                        {
-                            pPropName = SysAllocString( L"AdapterRAM" );
-                            hr = pVideoControllers[iController]->Get( pPropName, 0L, &var, nullptr, nullptr );
+							if (SUCCEEDED(hr) && strInputDeviceID)
+							{
+								if (wcsstr(var.bstrVal, strInputDeviceID) != 0)
+									bFound = true;
+							}
+							VariantClear(&var);
+							if (pPropName) SysFreeString(pPropName);
+						}
+
+						if (bFound || !strInputDeviceID)
+						{
+							pPropName = SysAllocString(L"AdapterRAM");
+							hr = pVideoControllers[iController]->Get(pPropName, 0L, &var, nullptr, nullptr);
 #ifdef PRINTF_DEBUGGING
-                            if( FAILED( hr ) )
-                                wprintf( L"WMI: pVideoControllers[iController]->Get AdapterRAM failed: 0x%0.8x\n",
-                                         hr );
+							if (FAILED(hr))
+								wprintf(L"WMI: pVideoControllers[iController]->Get AdapterRAM failed: 0x%0.8x\n",
+								hr);
 #endif
-                            if( SUCCEEDED( hr ) )
-                            {
-                                bGotMemory = true;
-                                *pdwAdapterRam = llmax(var.ulVal, *pdwAdapterRam);
-                            }
-                            VariantClear( &var );
-                            if( pPropName ) SysFreeString( pPropName );
-                        }
-
-                        SAFE_RELEASE( pVideoControllers[iController] );
-
-                        if (bFound)
-                        {
-                            break;
-                        }
-                    }
-                }
-            }
-
-            if( pClassName )
-                SysFreeString( pClassName );
-            SAFE_RELEASE( pEnumVideoControllers );
-        }
-
-        if( pNamespace )
-            SysFreeString( pNamespace );
-        SAFE_RELEASE( pIWbemServices );
-    }
-
-    SAFE_RELEASE( pIWbemLocator );
-
-    if( SUCCEEDED( hrCoInitialize ) )
-        CoUninitialize();
-
-    if( bGotMemory )
-        return S_OK;
-    else
-        return E_FAIL;
+							if (SUCCEEDED(hr))
+							{
+								bGotMemory = true;
+								*pdwAdapterRam = llmax(var.ulVal, *pdwAdapterRam);
+							}
+							VariantClear(&var);
+							if (pPropName) SysFreeString(pPropName);
+						}
+
+						SAFE_RELEASE(pVideoControllers[iController]);
+
+						if (bFound)
+						{
+							break;
+						}
+					}
+				}
+			}
+
+			if (pClassName)
+				SysFreeString(pClassName);
+			SAFE_RELEASE(pEnumVideoControllers);
+		}
+
+		if (pNamespace)
+			SysFreeString(pNamespace);
+		SAFE_RELEASE(pIWbemServices);
+	}
+
+	SAFE_RELEASE(pIWbemLocator);
+
+	if (SUCCEEDED(hrCoInitialize))
+		CoUninitialize();
+
+	if (bGotMemory)
+		return S_OK;
+	else
+		return E_FAIL;
 }
->>>>>>> Linden_Release/master
 
 //static
 S32 LLDXHardware::getMBVideoMemoryViaWMI()
@@ -389,7 +382,7 @@ std::string LLDXHardware::getDriverVersionWMI()
 	return mDriverVersion;
 }
 
-void get_wstring(IDxDiagContainer* containerp, const WCHAR* wszPropName, wchar_t* wszPropValue, int outputSize)
+void get_wstring(IDxDiagContainer* containerp, WCHAR* wszPropName, WCHAR* wszPropValue, int outputSize)
 {
 	HRESULT hr;
 	VARIANT var;
@@ -402,16 +395,16 @@ void get_wstring(IDxDiagContainer* containerp, const WCHAR* wszPropName, wchar_t
 		switch (var.vt)
 		{
 		case VT_UI4:
-			swprintf(wszPropValue, outputSize, L"%lu", var.ulVal);	/* Flawfinder: ignore */
+			swprintf(wszPropValue, L"%d", var.ulVal);	/* Flawfinder: ignore */
 			break;
 		case VT_I4:
-			swprintf(wszPropValue, outputSize, L"%li", var.lVal);	/* Flawfinder: ignore */
+			swprintf(wszPropValue, L"%d", var.lVal);	/* Flawfinder: ignore */
 			break;
 		case VT_BOOL:
-			wcscpy_s(wszPropValue, outputSize, (var.boolVal) ? L"true" : L"false");	/* Flawfinder: ignore */
+			wcscpy(wszPropValue, (var.boolVal) ? L"true" : L"false");	/* Flawfinder: ignore */
 			break;
 		case VT_BSTR:
-			wcsncpy_s(wszPropValue, outputSize, var.bstrVal, outputSize - 1);	/* Flawfinder: ignore */
+			wcsncpy(wszPropValue, var.bstrVal, outputSize - 1);	/* Flawfinder: ignore */
 			wszPropValue[outputSize - 1] = 0;
 			break;
 		}
@@ -420,12 +413,12 @@ void get_wstring(IDxDiagContainer* containerp, const WCHAR* wszPropName, wchar_t
 	VariantClear(&var);
 }
 
-std::string get_string(IDxDiagContainer *containerp, const WCHAR *wszPropName)
+std::string get_string(IDxDiagContainer *containerp, WCHAR *wszPropName)
 {
-	wchar_t wszPropValue[256];
-	get_wstring(containerp, wszPropName, wszPropValue, _countof(wszPropValue));
+	WCHAR wszPropValue[256];
+	get_wstring(containerp, wszPropName, wszPropValue, 256);
 
-	return ll_convert_wide_to_string(wszPropValue);
+	return utf16str_to_utf8str(wszPropValue);
 }
 
 
@@ -447,13 +440,14 @@ BOOL LLVersion::set(const std::string &version_string)
 		mFields[i] = 0;
 	}
 	// Split the version string.
+	std::string str(version_string);
 	typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
 	boost::char_separator<char> sep(".", "", boost::keep_empty_tokens);
-	tokenizer tokens(version_string, sep);
-
+	tokenizer tokens(str, sep);
 
+	tokenizer::iterator iter = tokens.begin();
 	S32 count = 0;
-	for (auto iter = tokens.begin(); iter != tokens.end() && count < 4; ++iter)
+	for (; (iter != tokens.end()) && (count < 4); ++iter)
 	{
 		mFields[count] = atoi(iter->c_str());
 		count++;
@@ -559,72 +553,69 @@ LLDXDriverFile *LLDXDevice::findDriver(const std::string &driver)
 		}
 	}
 
-	return nullptr;
+	return NULL;
 }
 
 LLDXHardware::LLDXHardware()
 {
 	mVRAM = 0;
-	gWriteDebug = nullptr;
+	gWriteDebug = NULL;
 }
 
 void LLDXHardware::cleanup()
 {
+	// for_each(mDevices.begin(), mDevices.end(), DeletePairedPointer());
+	// mDevices.clear();
 }
 
-BOOL LLDXHardware::updateVRAM()
+/*
+std::string LLDXHardware::dumpDevices()
 {
-<<<<<<< HEAD
-	HRESULT hr;
-	BOOL bGotMemory = FALSE;
-	HRESULT hrCoInitialize = S_OK;
-	SIZE_T vram = 0;
-=======
-	if (gWriteDebug)
-	{
-		gWriteDebug("\n");
-		gWriteDebug("StartAllDevices\n");
-	}
-	for (device_map_t::iterator iter = mDevices.begin(),
-			 end = mDevices.end();
-		 iter != end; iter++)
-	{
-		LLDXDevice *devicep = iter->second;
-		devicep->dump();
-	}
-	if (gWriteDebug)
-	{
-		gWriteDebug("EndAllDevices\n\n");
-	}
-	return "";
+if (gWriteDebug)
+{
+gWriteDebug("\n");
+gWriteDebug("StartAllDevices\n");
+}
+for (device_map_t::iterator iter = mDevices.begin(),
+end = mDevices.end();
+iter != end; iter++)
+{
+LLDXDevice *devicep = iter->second;
+devicep->dump();
+}
+if (gWriteDebug)
+{
+gWriteDebug("EndAllDevices\n\n");
+}
+return "";
 }
 
 LLDXDevice *LLDXHardware::findDevice(const std::string &vendor, const std::string &devices)
 {
-	// Iterate through different devices tokenized in devices string
-	std::string str(devices);
-	typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
-	boost::char_separator<char> sep("|", "", boost::keep_empty_tokens);
-	tokenizer tokens(str, sep);
-
-	tokenizer::iterator iter = tokens.begin();
-	for (;iter != tokens.end();++iter)
-	{
-		std::string dev_str = *iter;
-		for (device_map_t::iterator iter = mDevices.begin(),
-				 end = mDevices.end();
-			 iter != end; iter++)
-		{
-			LLDXDevice *devicep = iter->second;
-			if ((devicep->mVendorID == vendor)
-				&& (devicep->mDeviceID == dev_str))
-			{
-				return devicep;
-			}
-		}
-	}
+// Iterate through different devices tokenized in devices string
+std::string str(devices);
+typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
+boost::char_separator<char> sep("|", "", boost::keep_empty_tokens);
+tokenizer tokens(str, sep);
+
+tokenizer::iterator iter = tokens.begin();
+for (;iter != tokens.end();++iter)
+{
+std::string dev_str = *iter;
+for (device_map_t::iterator iter = mDevices.begin(),
+end = mDevices.end();
+iter != end; iter++)
+{
+LLDXDevice *devicep = iter->second;
+if ((devicep->mVendorID == vendor)
+&& (devicep->mDeviceID == dev_str))
+{
+return devicep;
+}
+}
+}
 
-	return NULL;
+return NULL;
 }
 */
 
@@ -632,12 +623,12 @@ BOOL LLDXHardware::getInfo(BOOL vram_only)
 {
 	LLTimer hw_timer;
 	BOOL ok = FALSE;
-    HRESULT       hr;
+	HRESULT       hr;
 
-    CoInitialize(NULL);
+	CoInitialize(NULL);
 
-    IDxDiagProvider *dx_diag_providerp = NULL;
-    IDxDiagContainer *dx_diag_rootp = NULL;
+	IDxDiagProvider *dx_diag_providerp = NULL;
+	IDxDiagContainer *dx_diag_rootp = NULL;
 	IDxDiagContainer *devices_containerp = NULL;
 	// IDxDiagContainer *system_device_containerp= NULL;
 	IDxDiagContainer *device_containerp = NULL;
@@ -647,51 +638,46 @@ BOOL LLDXHardware::getInfo(BOOL vram_only)
 
 	mVRAM = 0;
 
-    // CoCreate a IDxDiagProvider*
+	// CoCreate a IDxDiagProvider*
 	LL_DEBUGS("AppInit") << "CoCreateInstance IID_IDxDiagProvider" << LL_ENDL;
-    hr = CoCreateInstance(CLSID_DxDiagProvider,
-                          NULL,
-                          CLSCTX_INPROC_SERVER,
-                          IID_IDxDiagProvider,
-                          (LPVOID*) &dx_diag_providerp);
->>>>>>> Linden_Release/master
+	hr = CoCreateInstance(CLSID_DxDiagProvider,
+		NULL,
+		CLSCTX_INPROC_SERVER,
+		IID_IDxDiagProvider,
+		(LPVOID*)&dx_diag_providerp);
 
-	hrCoInitialize = CoInitialize(0);
-	if (SUCCEEDED(hrCoInitialize))
+	if (FAILED(hr))
 	{
-<<<<<<< HEAD
-		IDXGIFactory1* pDXGIFactory = nullptr;
-=======
 		LL_WARNS("AppInit") << "No DXDiag provider found!  DirectX 9 not installed!" << LL_ENDL;
 		gWriteDebug("No DXDiag provider found!  DirectX 9 not installed!\n");
 		goto LCleanup;
 	}
-    if (SUCCEEDED(hr)) // if FAILED(hr) then dx9 is not installed
-    {
-        // Fill out a DXDIAG_INIT_PARAMS struct and pass it to IDxDiagContainer::Initialize
-        // Passing in TRUE for bAllowWHQLChecks, allows dxdiag to check if drivers are 
-        // digital signed as logo'd by WHQL which may connect via internet to update 
-        // WHQL certificates.    
-        DXDIAG_INIT_PARAMS dx_diag_init_params;
-        ZeroMemory(&dx_diag_init_params, sizeof(DXDIAG_INIT_PARAMS));
-
-        dx_diag_init_params.dwSize                  = sizeof(DXDIAG_INIT_PARAMS);
-        dx_diag_init_params.dwDxDiagHeaderVersion   = DXDIAG_DX9_SDK_VERSION;
-        dx_diag_init_params.bAllowWHQLChecks        = TRUE;
-        dx_diag_init_params.pReserved               = NULL;
+	if (SUCCEEDED(hr)) // if FAILED(hr) then dx9 is not installed
+	{
+		// Fill out a DXDIAG_INIT_PARAMS struct and pass it to IDxDiagContainer::Initialize
+		// Passing in TRUE for bAllowWHQLChecks, allows dxdiag to check if drivers are 
+		// digital signed as logo'd by WHQL which may connect via internet to update 
+		// WHQL certificates.    
+		DXDIAG_INIT_PARAMS dx_diag_init_params;
+		ZeroMemory(&dx_diag_init_params, sizeof(DXDIAG_INIT_PARAMS));
+
+		dx_diag_init_params.dwSize = sizeof(DXDIAG_INIT_PARAMS);
+		dx_diag_init_params.dwDxDiagHeaderVersion = DXDIAG_DX9_SDK_VERSION;
+		dx_diag_init_params.bAllowWHQLChecks = TRUE;
+		dx_diag_init_params.pReserved = NULL;
 
 		LL_DEBUGS("AppInit") << "dx_diag_providerp->Initialize" << LL_ENDL;
-        hr = dx_diag_providerp->Initialize(&dx_diag_init_params);
-        if(FAILED(hr))
+		hr = dx_diag_providerp->Initialize(&dx_diag_init_params);
+		if (FAILED(hr))
 		{
-            goto LCleanup;
+			goto LCleanup;
 		}
 
 		LL_DEBUGS("AppInit") << "dx_diag_providerp->GetRootContainer" << LL_ENDL;
-        hr = dx_diag_providerp->GetRootContainer( &dx_diag_rootp );
-        if(FAILED(hr) || !dx_diag_rootp)
+		hr = dx_diag_providerp->GetRootContainer(&dx_diag_rootp);
+		if (FAILED(hr) || !dx_diag_rootp)
 		{
-            goto LCleanup;
+			goto LCleanup;
 		}
 
 		HRESULT hr;
@@ -699,30 +685,30 @@ BOOL LLDXHardware::getInfo(BOOL vram_only)
 		// Get display driver information
 		LL_DEBUGS("AppInit") << "dx_diag_rootp->GetChildContainer" << LL_ENDL;
 		hr = dx_diag_rootp->GetChildContainer(L"DxDiag_DisplayDevices", &devices_containerp);
-		if(FAILED(hr) || !devices_containerp)
+		if (FAILED(hr) || !devices_containerp)
 		{
-            // do not release 'dirty' devices_containerp at this stage, only dx_diag_rootp
-            devices_containerp = NULL; 
-            goto LCleanup;
+			// do not release 'dirty' devices_containerp at this stage, only dx_diag_rootp
+			devices_containerp = NULL;
+			goto LCleanup;
 		}
 
-        // make sure there is something inside
-        hr = devices_containerp->GetNumberOfChildContainers(&dw_device_count);
-        if (FAILED(hr) || dw_device_count == 0)
-        {
-            goto LCleanup;
-        }
+		// make sure there is something inside
+		hr = devices_containerp->GetNumberOfChildContainers(&dw_device_count);
+		if (FAILED(hr) || dw_device_count == 0)
+		{
+			goto LCleanup;
+		}
 
 		// Get device 0
 		// By default 0 device is the primary one, howhever in case of various hybrid graphics
 		// like itegrated AMD and PCI AMD GPUs system might switch.
 		LL_DEBUGS("AppInit") << "devices_containerp->GetChildContainer" << LL_ENDL;
 		hr = devices_containerp->GetChildContainer(L"0", &device_containerp);
-		if(FAILED(hr) || !device_containerp)
+		if (FAILED(hr) || !device_containerp)
 		{
-            goto LCleanup;
+			goto LCleanup;
 		}
-		
+
 		DWORD vram = 0;
 
 		WCHAR deviceID[512];
@@ -731,9 +717,9 @@ BOOL LLDXHardware::getInfo(BOOL vram_only)
 		// Example: searches id like 1F06 in pnp string (aka VEN_10DE&DEV_1F06)
 		// doesn't seem to work on some systems since format is unrecognizable
 		// but in such case keyDeviceID works
-		if (SUCCEEDED(GetVideoMemoryViaWMI(deviceID, &vram))) 
+		if (SUCCEEDED(GetVideoMemoryViaWMI(deviceID, &vram)))
 		{
-			mVRAM = vram/(1024*1024);
+			mVRAM = vram / (1024 * 1024);
 		}
 		else
 		{
@@ -747,18 +733,18 @@ BOOL LLDXHardware::getInfo(BOOL vram_only)
 				mVRAM = vram / (1024 * 1024);
 			}
 		}
-		
+
 		if (mVRAM == 0)
 		{ // Get the English VRAM string
-		  std::string ram_str = get_string(device_containerp, L"szDisplayMemoryEnglish");
+			std::string ram_str = get_string(device_containerp, L"szDisplayMemoryEnglish");
 
-		  // We don't need the device any more
-		  SAFE_RELEASE(device_containerp);
+			// We don't need the device any more
+			SAFE_RELEASE(device_containerp);
 
-		  // Dump the string as an int into the structure
-		  char *stopstring;
-		  mVRAM = strtol(ram_str.c_str(), &stopstring, 10); 
-		  LL_INFOS("AppInit") << "VRAM Detected: " << mVRAM << " DX9 string: " << ram_str << LL_ENDL;
+			// Dump the string as an int into the structure
+			char *stopstring;
+			mVRAM = strtol(ram_str.c_str(), &stopstring, 10);
+			LL_INFOS("AppInit") << "VRAM Detected: " << mVRAM << " DX9 string: " << ram_str << LL_ENDL;
 		}
 
 		if (vram_only)
@@ -769,64 +755,158 @@ BOOL LLDXHardware::getInfo(BOOL vram_only)
 
 
 		/* for now, we ONLY do vram_only the rest of this
-		   is commented out, to ensure no-one is tempted
-		   to use it
-		
+		is commented out, to ensure no-one is tempted
+		to use it
+
 		// Now let's get device and driver information
 		// Get the IDxDiagContainer object called "DxDiag_SystemDevices".
 		// This call may take some time while dxdiag gathers the info.
 		DWORD num_devices = 0;
-	    WCHAR wszContainer[256];
+		WCHAR wszContainer[256];
 		LL_DEBUGS("AppInit") << "dx_diag_rootp->GetChildContainer DxDiag_SystemDevices" << LL_ENDL;
 		hr = dx_diag_rootp->GetChildContainer(L"DxDiag_SystemDevices", &system_device_containerp);
 		if (FAILED(hr))
 		{
-			goto LCleanup;
+		goto LCleanup;
 		}
 
 		hr = system_device_containerp->GetNumberOfChildContainers(&num_devices);
 		if (FAILED(hr))
 		{
-			goto LCleanup;
+		goto LCleanup;
 		}
->>>>>>> Linden_Release/master
 
-		hr = CreateDXGIFactory1(IID_PPV_ARGS(&pDXGIFactory));
-		if (SUCCEEDED(hr))
+		LL_DEBUGS("AppInit") << "DX9 iterating over devices" << LL_ENDL;
+		S32 device_num = 0;
+		for (device_num = 0; device_num < (S32)num_devices; device_num++)
+		{
+		hr = system_device_containerp->EnumChildContainerNames(device_num, wszContainer, 256);
+		if (FAILED(hr))
 		{
-			assert(pDXGIFactory != 0);
+		goto LCleanup;
+		}
 
-			for (UINT index = 0;; ++index)
-			{
-				IDXGIAdapter1* pAdapter = nullptr;
-				hr = pDXGIFactory->EnumAdapters1(index, &pAdapter);
-				if (FAILED(hr)) // DXGIERR_NOT_FOUND is expected when the end of the list is hit
-					break;
-
-				DXGI_ADAPTER_DESC1 desc;
-				memset(&desc, 0, sizeof(DXGI_ADAPTER_DESC1));
-				if (SUCCEEDED(pAdapter->GetDesc1(&desc)))
-				{
-					if (desc.Flags == 0)
-					{
-						vram = desc.DedicatedVideoMemory;
-						bGotMemory = TRUE;
-					}
-				}
-				SAFE_RELEASE(pAdapter);
-				if (bGotMemory != FALSE)
-					break;
-			}
-			SAFE_RELEASE(pDXGIFactory);
+		hr = system_device_containerp->GetChildContainer(wszContainer, &device_containerp);
+		if (FAILED(hr) || device_containerp == NULL)
+		{
+		goto LCleanup;
 		}
-		CoUninitialize();
+
+		std::string device_name = get_string(device_containerp, L"szDescription");
+
+		std::string device_id = get_string(device_containerp, L"szDeviceID");
+
+		LLDXDevice *dxdevicep = new LLDXDevice;
+		dxdevicep->mName = device_name;
+		dxdevicep->mPCIString = device_id;
+		mDevices[dxdevicep->mPCIString] = dxdevicep;
+
+		// Split the PCI string based on vendor, device, subsys, rev.
+		std::string str(device_id);
+		typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
+		boost::char_separator<char> sep("&\\", "", boost::keep_empty_tokens);
+		tokenizer tokens(str, sep);
+
+		tokenizer::iterator iter = tokens.begin();
+		S32 count = 0;
+		BOOL valid = TRUE;
+		for (;(iter != tokens.end()) && (count < 3);++iter)
+		{
+		switch (count)
+		{
+		case 0:
+		if (strcmp(iter->c_str(), "PCI"))
+		{
+		valid = FALSE;
+		}
+		break;
+		case 1:
+		dxdevicep->mVendorID = iter->c_str();
+		break;
+		case 2:
+		dxdevicep->mDeviceID = iter->c_str();
+		break;
+		default:
+		// Ignore it
+		break;
+		}
+		count++;
+		}
+
+
+
+
+		// Now, iterate through the related drivers
+		hr = device_containerp->GetChildContainer(L"Drivers", &driver_containerp);
+		if (FAILED(hr) || !driver_containerp)
+		{
+		goto LCleanup;
+		}
+
+		DWORD num_files = 0;
+		hr = driver_containerp->GetNumberOfChildContainers(&num_files);
+		if (FAILED(hr))
+		{
+		goto LCleanup;
+		}
+
+		S32 file_num = 0;
+		for (file_num = 0; file_num < (S32)num_files; file_num++ )
+		{
+
+		hr = driver_containerp->EnumChildContainerNames(file_num, wszContainer, 256);
+		if (FAILED(hr))
+		{
+		goto LCleanup;
+		}
+
+		hr = driver_containerp->GetChildContainer(wszContainer, &file_containerp);
+		if (FAILED(hr) || file_containerp == NULL)
+		{
+		goto LCleanup;
+		}
+
+		std::string driver_path = get_string(file_containerp, L"szPath");
+		std::string driver_name = get_string(file_containerp, L"szName");
+		std::string driver_version = get_string(file_containerp, L"szVersion");
+		std::string driver_date = get_string(file_containerp, L"szDatestampEnglish");
+
+		LLDXDriverFile *dxdriverfilep = new LLDXDriverFile;
+		dxdriverfilep->mName = driver_name;
+		dxdriverfilep->mFilepath= driver_path;
+		dxdriverfilep->mVersionString = driver_version;
+		dxdriverfilep->mVersion.set(driver_version);
+		dxdriverfilep->mDateString = driver_date;
+
+		dxdevicep->mDriverFiles[driver_name] = dxdriverfilep;
+
+		SAFE_RELEASE(file_containerp);
+		}
+		SAFE_RELEASE(device_containerp);
+		}
+		*/
 	}
 
-	if (bGotMemory != FALSE)
+	// dumpDevices();
+	ok = TRUE;
+
+LCleanup:
+	if (!ok)
 	{
-		mVRAM = vram / (1024 * 1024);
+		LL_WARNS("AppInit") << "DX9 probe failed" << LL_ENDL;
+		gWriteDebug("DX9 probe failed\n");
 	}
-	return bGotMemory;
+
+	SAFE_RELEASE(file_containerp);
+	SAFE_RELEASE(driver_containerp);
+	SAFE_RELEASE(device_containerp);
+	SAFE_RELEASE(devices_containerp);
+	SAFE_RELEASE(dx_diag_rootp);
+	SAFE_RELEASE(dx_diag_providerp);
+
+	CoUninitialize();
+
+	return ok;
 }
 
 LLSD LLDXHardware::getDisplayInfo()
@@ -834,13 +914,7 @@ LLSD LLDXHardware::getDisplayInfo()
 	LLTimer hw_timer;
 	HRESULT       hr;
 	LLSD ret;
-	hr = CoInitialize(nullptr);
-	if (FAILED(hr))
-	{
-		LL_WARNS() << "COM initialization failure!" << LL_ENDL;
-		gWriteDebug("COM initialization failure!\n");
-		return ret;
-	}
+	CoInitialize(NULL);
 
 	IDxDiagProvider *dx_diag_providerp = NULL;
 	IDxDiagContainer *dx_diag_rootp = NULL;
@@ -853,7 +927,7 @@ LLSD LLDXHardware::getDisplayInfo()
 	// CoCreate a IDxDiagProvider*
 	LL_INFOS() << "CoCreateInstance IID_IDxDiagProvider" << LL_ENDL;
 	hr = CoCreateInstance(CLSID_DxDiagProvider,
-		nullptr,
+		NULL,
 		CLSCTX_INPROC_SERVER,
 		IID_IDxDiagProvider,
 		(LPVOID*)&dx_diag_providerp);
@@ -925,7 +999,7 @@ LLSD LLDXHardware::getDisplayInfo()
 
 		// Dump the string as an int into the structure
 		char *stopstring;
-		ret["VRAM"] = (LLSD::Integer)strtol(ram_str.c_str(), &stopstring, 10);
+		ret["VRAM"] = strtol(ram_str.c_str(), &stopstring, 10);
 		std::string device_name = get_string(device_containerp, L"szDescription");
 		ret["DeviceName"] = device_name;
 		std::string device_driver = get_string(device_containerp, L"szDriverVersion");
@@ -948,12 +1022,12 @@ LLSD LLDXHardware::getDisplayInfo()
 				DWORD dwType = REG_SZ;
 				DWORD dwSize = sizeof(WCHAR) * RV_SIZE;
 				if (ERROR_SUCCESS == RegQueryValueEx(hKey, TEXT("ReleaseVersion"),
-					nullptr, &dwType, (LPBYTE)release_version, &dwSize))
+					NULL, &dwType, (LPBYTE)release_version, &dwSize))
 				{
 					// print the value
 					// windows doesn't guarantee to be null terminated
 					release_version[RV_SIZE - 1] = NULL;
-					ret["DriverVersion"] = ll_convert_wide_to_string(release_version);
+					ret["DriverVersion"] = utf16str_to_utf8str(release_version);
 
 				}
 				RegCloseKey(hKey);
diff --git a/indra/llwindow/lldxhardware.h b/indra/llwindow/lldxhardware.h
index 7b631b6d1895dd4fe72b5481ebe08be7f8c75e2c..3ea4871ef10b1d05abd2da11f6aad62597ffbd2b 100644
--- a/indra/llwindow/lldxhardware.h
+++ b/indra/llwindow/lldxhardware.h
@@ -1,28 +1,28 @@
-/** 
- * @file lldxhardware.h
- * @brief LLDXHardware definition
- *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
- * $/LicenseInfo$
- */
+/**
+* @file lldxhardware.h
+* @brief LLDXHardware definition
+*
+* $LicenseInfo:firstyear=2001&license=viewerlgpl$
+* Second Life Viewer Source Code
+* Copyright (C) 2010, Linden Research, Inc.
+*
+* This library is free software; you can redistribute it and/or
+* modify it under the terms of the GNU Lesser General Public
+* License as published by the Free Software Foundation;
+* version 2.1 of the License only.
+*
+* This library is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this library; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+*
+* Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+* $/LicenseInfo$
+*/
 
 #ifndef LL_LLDXHARDWARE_H
 #define LL_LLDXHARDWARE_H
@@ -81,12 +81,12 @@ class LLDXHardware
 public:
 	LLDXHardware();
 
-	void setWriteDebugFunc(void (*func)(const char*));
+	void setWriteDebugFunc(void(*func)(const char*));
 	void cleanup();
 
 	// Returns TRUE on success.
 	// vram_only TRUE does a "light" probe.
-	BOOL updateVRAM();
+	BOOL getInfo(BOOL vram_only);
 
 	std::string getDriverVersionWMI();
 
@@ -112,7 +112,7 @@ class LLDXHardware
 	S32 mVRAM;
 };
 
-extern void (*gWriteDebug)(const char* msg);
+extern void(*gWriteDebug)(const char* msg);
 extern LLDXHardware gDXHardware;
 
 #endif // LL_LLDXHARDWARE_H
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index 382c7a9e992872ced1e6575f05b37f79324eb95e..4a3fcc0284da82888ebe54b16f90443f0b056f9e 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -1147,11 +1147,7 @@ bool LLAppViewer::init()
 	try {
 		initializeSecHandler();
 	}
-<<<<<<< HEAD
-	catch (const LLProtectedDataException&)
-=======
 	catch (LLProtectedDataException&)
->>>>>>> Linden_Release/master
 	{
 	  LLNotificationsUtil::add("CorruptedProtectedDataStore");
 	}
@@ -1395,11 +1391,7 @@ bool LLAppViewer::frame()
 		{
 			LOG_UNHANDLED_EXCEPTION("");
 		}
-<<<<<<< HEAD
-		catch (const std::bad_alloc&)
-=======
 		catch (std::bad_alloc&)
->>>>>>> Linden_Release/master
 		{
 			LLMemory::logMemoryInfo(TRUE);
 			LLFloaterMemLeak* mem_leak_instance = LLFloaterReg::findTypedInstance<LLFloaterMemLeak>("mem_leaking");
diff --git a/indra/newview/llappviewerwin32.cpp b/indra/newview/llappviewerwin32.cpp
index d869201cb889ef0cbd58ba061b6fedb569d615c6..c7c0802b584e71d1cf159e7724fab26273553d15 100644
--- a/indra/newview/llappviewerwin32.cpp
+++ b/indra/newview/llappviewerwin32.cpp
@@ -704,14 +704,43 @@ bool LLAppViewerWin32::initHardwareTest()
 	// Do driver verification and initialization based on DirectX
 	// hardware polling and driver versions
 	//
-	if (FALSE == gSavedSettings.getBOOL("NoHardwareProbe"))
+	if (TRUE == gSavedSettings.getBOOL("ProbeHardwareOnStartup") && FALSE == gSavedSettings.getBOOL("NoHardwareProbe"))
 	{
+		// per DEV-11631 - disable hardware probing for everything
+		// but vram.
+		BOOL vram_only = TRUE;
+
 		LLSplashScreen::update(LLTrans::getString("StartupDetectingHardware"));
 
 		LL_DEBUGS("AppInit") << "Attempting to poll DirectX for hardware info" << LL_ENDL;
 		gDXHardware.setWriteDebugFunc(write_debug_dx);
-		gDXHardware.updateVRAM();
-		LL_DEBUGS("AppInit") << "Done polling DXGI for vram info" << LL_ENDL;
+		BOOL probe_ok = gDXHardware.getInfo(vram_only);
+
+		if (!probe_ok
+			&& gWarningSettings.getBOOL("AboutDirectX9"))
+		{
+			LL_WARNS("AppInit") << "DirectX probe failed, alerting user." << LL_ENDL;
+
+			// Warn them that runnin without DirectX 9 will
+			// not allow us to tell them about driver issues
+			std::ostringstream msg;
+			msg << LLTrans::getString("MBNoDirectX");
+			S32 button = OSMessageBox(
+				msg.str(),
+				LLTrans::getString("MBWarning"),
+				OSMB_YESNO);
+			if (OSBTN_NO == button)
+			{
+				LL_INFOS("AppInit") << "User quitting after failed DirectX 9 detection" << LL_ENDL;
+				LLWeb::loadURLExternal("http://secondlife.com/support/", false);
+				return false;
+			}
+			gWarningSettings.setBOOL("AboutDirectX9", FALSE);
+		}
+		LL_DEBUGS("AppInit") << "Done polling DirectX for hardware info" << LL_ENDL;
+
+		// Only probe once after installation
+		gSavedSettings.setBOOL("ProbeHardwareOnStartup", FALSE);
 
 		// Disable so debugger can work
 		std::string splash_msg;
@@ -732,8 +761,7 @@ bool LLAppViewerWin32::initHardwareTest()
 		gGLManager.mVRAM = gDXHardware.getVRAM();
 	}
 
-	//BD - Don't show false information.
-	//LL_INFOS("AppInit") << "Detected VRAM: " << gGLManager.mVRAM << LL_ENDL;
+	LL_INFOS("AppInit") << "Detected VRAM: " << gGLManager.mVRAM << LL_ENDL;
 
 	return true;
 }
diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp
index 9163436e65e707871656ef0fa2cced34e5758e67..d8a1af1b747d66ee9d804138426aecdb7a663b6c 100644
--- a/indra/newview/llmeshrepository.cpp
+++ b/indra/newview/llmeshrepository.cpp
@@ -1922,11 +1922,7 @@ EMeshProcessingResult LLMeshRepoThread::lodReceived(const LLVolumeParams& mesh_p
 		std::string mesh_string((char*)data, data_size);
 		stream.str(mesh_string);
 	}
-<<<<<<< HEAD
-	catch (const std::bad_alloc&)
-=======
 	catch (std::bad_alloc&)
->>>>>>> Linden_Release/master
 	{
 		// out of memory, we won't be able to process this mesh
 		return MESH_OUT_OF_MEMORY;
diff --git a/indra/newview/llsecapi.cpp b/indra/newview/llsecapi.cpp
index 18abfb253189e48e38071d2da3e8e427933693e7..10e510b8428a777587476c42062ef26004bb58e8 100644
--- a/indra/newview/llsecapi.cpp
+++ b/indra/newview/llsecapi.cpp
@@ -64,11 +64,7 @@ void initializeSecHandler()
 		{
 			handler->init();
 		}
-<<<<<<< HEAD
-		catch (const LLProtectedDataException& e)
-=======
 		catch (LLProtectedDataException& e)
->>>>>>> Linden_Release/master
 		{
 			exception_msg = e.what();
 		}
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index 6af880430c5beeb9236ea28cc3b397a181c5210d..1fc40fdbe209883c26e6977d28f6ec39d43e420e 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -9218,7 +9218,6 @@ void LLPipeline::renderDeferredLighting(LLRenderTarget* screen_target)
 						}
 					}
 
-<<<<<<< HEAD
 					const LLViewerObject *vobj = drawablep->getVObj();
 					if (vobj)
 					{
@@ -9231,29 +9230,18 @@ void LLPipeline::renderDeferredLighting(LLRenderTarget* screen_target)
 							//     with one of LL's changes. We use the avatar's root bone world position now instead of the
 							//     avatar position because this one will always be accurate unless our avatar is really
 							//     being rendered at 0 0 0 and in that case our camera will probably be janked there as well.
-							if (av->isTooComplex() || av->isInMuteList() || dist_vec(av->mRoot->getWorldPosition(), LLViewerCamera::getInstance()->getOrigin()) > RenderFarClip)
+							if (av && (av->isTooComplex() || av->isInMuteList() || dist_vec(av->mRoot->getWorldPosition(), LLViewerCamera::getInstance()->getOrigin()) > RenderFarClip))
 							{
 								continue;
 							}
 						}
 					}
-=======
-                    const LLViewerObject *vobj = drawablep->getVObj();
-                    if (vobj)
-                    {
-                        LLVOAvatar *av = vobj->getAvatar();
-                        if (av && (av->isTooComplex() || av->isInMuteList()))
-                        {
-                            continue;
-                        }
-                    }
 
                     const LLVector3 position = drawablep->getPositionAgent();
                     if (dist_vec(position, LLViewerCamera::getInstance()->getOrigin()) > RenderFarClip + volume->getLightRadius())
                     {
                         continue;
                     }
->>>>>>> Linden_Release/master
 
 					LLVector4a center;
 					center.load3(position.mV);