Bug 1361410: Don't hook BaseThreadInitThunk when WRusr.dll is loaded, mitigating a crash; r=dmajor

MozReview-Commit-ID: KqWq2bHT0CE

--HG--
extra : rebase_source : 54292be2efe4d50ec5806c1d066eb34ac97ecf14
This commit is contained in:
Carl Corcoran 2017-08-17 15:05:17 +02:00
Родитель a4e932605b
Коммит 5c4000df9d
1 изменённых файлов: 8 добавлений и 5 удалений

Просмотреть файл

@ -866,17 +866,20 @@ DllBlocklist_Initialize(uint32_t aInitFlags)
}
#endif
#ifdef _M_IX86 // Minimize impact; crashes in BaseThreadInitThunk are vastly more frequent on x86
if(!Kernel32Intercept.AddDetour("BaseThreadInitThunk",
#ifdef _M_IX86 // Minimize impact. Crashes in BaseThreadInitThunk are more frequent on x86
// Bug 1361410: WRusr.dll will overwrite our hook and cause a crash.
// Workaround: If we detect WRusr.dll, don't hook.
if (!GetModuleHandleW(L"WRusr.dll")) {
if(!Kernel32Intercept.AddDetour("BaseThreadInitThunk",
reinterpret_cast<intptr_t>(patched_BaseThreadInitThunk),
(void**) &stub_BaseThreadInitThunk)) {
#ifdef DEBUG
printf_stderr("BaseThreadInitThunk hook failed\n");
printf_stderr("BaseThreadInitThunk hook failed\n");
#endif
}
}
#endif // _M_IX86
}
MFBT_API void