Bug 773624 - Catch invalid vccorlib GetProcAddress calls when running on the desktop. r=ehsan
authorJim Mathies <jmathies@mozilla.com>
Fri, 13 Jul 2012 11:10:49 -0500
changeset 99202 17a9890a351a35909015d71d2e308702a6a4fc76
parent 99201 7601c7ace55288176dbc80a71bfea454327a0ed0
child 99203 30a4cd976842d78fffe99d201fd701fe516a3887
push id11881
push userjmathies@mozilla.com
push dateFri, 13 Jul 2012 16:10:58 +0000
treeherdermozilla-inbound@17a9890a351a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan
bugs773624
milestone16.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 773624 - Catch invalid vccorlib GetProcAddress calls when running on the desktop. r=ehsan
toolkit/library/nsDllMain.cpp
--- a/toolkit/library/nsDllMain.cpp
+++ b/toolkit/library/nsDllMain.cpp
@@ -83,17 +83,25 @@ FARPROC WINAPI DelayDllLoadHook(unsigned
   if (dliNotify == dliNotePreLoadLibrary) {
     if (IsWinRTDLLPresent(pdli, kvccorlib)) {
       return (FARPROC)LoadLibraryA("dummyvccorlib.dll");
     }
     NS_ASSERTION(!IsWinRTDLLPresent(pdli, kwinrtprelim),
       "Attempting to load winrt libs in non-metro environment. "
       "(Winrt variable type placed in global scope?)");
   }
+  if (dliNotify == dliFailGetProc && IsWinRTDLLPresent(pdli, kvccorlib)) {
+    NS_WARNING("Attempting to access winrt vccorlib entry point in non-metro environment.");
+    NS_WARNING(pdli->szDll);
+    NS_WARNING(pdli->dlp.szProcName);
+    NS_ABORT();
+  }
   return NULL;
 }
 
 ExternC PfnDliHook __pfnDliNotifyHook2 = DelayDllLoadHook;
+ExternC PfnDliHook __pfnDliFailureHook2 = DelayDllLoadHook;
+
 #endif // MOZ_METRO
 
 #if defined(__GNUC__)
 } // extern "C"
 #endif