Load XRT DLL from System32, and only on Win8+.
authorAditya Mandaleeka <adityam@microsoft.com>
Fri, 20 May 2016 18:24:17 +0000 (11:24 -0700)
committerAditya Mandaleeka <adityam@microsoft.com>
Fri, 20 May 2016 18:24:17 +0000 (11:24 -0700)
src/utilcode/appxutil.cpp

index 78a7c273ccd8529563fa5af7febaa17fd46ef6a7..759fbffcb110e46d34182c72605c45e895b8547a 100644 (file)
@@ -228,9 +228,14 @@ HRESULT InitAppXRT()
 
         do
         {
+            if (!RunningOnWin8())
+            {
+                break;
+            }
+
             LPCWSTR wzAppXRTDll = W("api-ms-win-appmodel-runtime-l1-1-0.dll");
             // Does not use GetLoadWithAlteredSearchPathFlag() because that would cause infinite recursion.
-            pAppXRTInfo->m_hAppXRTMod = WszLoadLibrary(wzAppXRTDll);
+            pAppXRTInfo->m_hAppXRTMod = WszLoadLibraryEx(wzAppXRTDll, nullptr, LOAD_LIBRARY_SEARCH_SYSTEM32);
             if (pAppXRTInfo->m_hAppXRTMod == nullptr)
             {   // Error is catastrophic: can't find kernel32.dll?
                 hr = HRESULT_FROM_GetLastError();