Bug 1332523 - Move message indicating when the blocklist is initialized after user32.dll was loaded to the blocklist itself. r=dmajor draft
authorMike Hommey <mh+mozilla@glandium.org>
Thu, 12 Jan 2017 11:13:40 +0900
changeset 464388 ac2f8e30f09d5e3b8ac4cfda479b50f154932880
parent 463895 e2860876fc43daab36c5dbc920dcf4d298923de2
child 464389 1301d1088ef39022571fad25e2a3c3efc412c08c
push id42348
push userbmo:mh+mozilla@glandium.org
push dateFri, 20 Jan 2017 22:46:42 +0000
reviewersdmajor
bugs1332523
milestone53.0a1
Bug 1332523 - Move message indicating when the blocklist is initialized after user32.dll was loaded to the blocklist itself. r=dmajor
browser/app/nsBrowserApp.cpp
mozglue/build/WindowsDllBlocklist.cpp
--- a/browser/app/nsBrowserApp.cpp
+++ b/browser/app/nsBrowserApp.cpp
@@ -290,24 +290,16 @@ InitXPCOMGlue(const char *argv0)
 }
 
 int main(int argc, char* argv[], char* envp[])
 {
   mozilla::TimeStamp start = mozilla::TimeStamp::Now();
 
 #ifdef HAS_DLL_BLOCKLIST
   DllBlocklist_Initialize();
-
-#ifdef DEBUG
-  // In order to be effective against AppInit DLLs, the blocklist must be
-  // initialized before user32.dll is loaded into the process (bug 932100).
-  if (GetModuleHandleA("user32.dll")) {
-    fprintf(stderr, "DLL blocklist was unable to intercept AppInit DLLs.\n");
-  }
-#endif
 #endif
 
 #ifdef MOZ_BROWSER_CAN_BE_CONTENTPROC
   // We are launching as a content process, delegate to the appropriate
   // main
   if (argc > 1 && IsArg(argv[1], "contentproc")) {
 #if defined(XP_WIN) && defined(MOZ_SANDBOX)
     // We need to initialize the sandbox TargetServices before InitXPCOMGlue
--- a/mozglue/build/WindowsDllBlocklist.cpp
+++ b/mozglue/build/WindowsDllBlocklist.cpp
@@ -752,33 +752,38 @@ WindowsDllInterceptor NtDllIntercept;
 MFBT_API void
 DllBlocklist_Initialize()
 {
   if (sBlocklistInitAttempted) {
     return;
   }
   sBlocklistInitAttempted = true;
 
+  // In order to be effective against AppInit DLLs, the blocklist must be
+  // initialized before user32.dll is loaded into the process (bug 932100).
   if (GetModuleHandleA("user32.dll")) {
     sUser32BeforeBlocklist = true;
+#ifdef DEBUG
+    printf_stderr("DLL blocklist was unable to intercept AppInit DLLs.\n");
+#endif
   }
 
   NtDllIntercept.Init("ntdll.dll");
 
   ReentrancySentinel::InitializeStatics();
 
   // We specifically use a detour, because there are cases where external
   // code also tries to hook LdrLoadDll, and doesn't know how to relocate our
   // nop space patches. (Bug 951827)
   bool ok = NtDllIntercept.AddDetour("LdrLoadDll", reinterpret_cast<intptr_t>(patched_LdrLoadDll), (void**) &stub_LdrLoadDll);
 
   if (!ok) {
     sBlocklistInitFailed = true;
 #ifdef DEBUG
-    printf_stderr ("LdrLoadDll hook failed, no dll blocklisting active\n");
+    printf_stderr("LdrLoadDll hook failed, no dll blocklisting active\n");
 #endif
   }
 }
 
 MFBT_API void
 DllBlocklist_SetInXPCOMLoadOnMainThread(bool inXPCOMLoadOnMainThread)
 {
   if (inXPCOMLoadOnMainThread) {