Bug 1332523 - Move message indicating when the blocklist is initialized after user32.dll was loaded to the blocklist itself. r=dmajor
--- 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) {