зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1446499: Use static nsWindowsDllInterceptor in plugin's HookProtectedMode r=aklotz
HookProtectedMode requires its nsWindowsDllInterceptor to last as long as the functions need to be overridden. This uses a static object instead of a local one. --HG-- extra : rebase_source : 7ba3f2fc1e19f89936b7f7fa490554e9cf9b885c
This commit is contained in:
Родитель
679c14a9c4
Коммит
a9fd0592af
|
@ -296,16 +296,23 @@ CreateFileWHookFn(LPCWSTR aFname, DWORD aAccess, DWORD aShare,
|
|||
|
||||
void FunctionHook::HookProtectedMode()
|
||||
{
|
||||
// Make sure we only do this once.
|
||||
static bool sRunOnce = false;
|
||||
if (sRunOnce) {
|
||||
return;
|
||||
}
|
||||
sRunOnce = true;
|
||||
|
||||
// Legacy code. Uses the nsWindowsDLLInterceptor directly instead of
|
||||
// using the FunctionHook
|
||||
sKernel32Intercept.Init("kernel32.dll");
|
||||
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Plugin);
|
||||
WindowsDllInterceptor k32Intercept("kernel32.dll");
|
||||
k32Intercept.AddHook("CreateFileW",
|
||||
reinterpret_cast<intptr_t>(CreateFileWHookFn),
|
||||
(void**) &sCreateFileWStub);
|
||||
k32Intercept.AddHook("CreateFileA",
|
||||
reinterpret_cast<intptr_t>(CreateFileAHookFn),
|
||||
(void**) &sCreateFileAStub);
|
||||
sKernel32Intercept.AddHook("CreateFileW",
|
||||
reinterpret_cast<intptr_t>(CreateFileWHookFn),
|
||||
(void**) &sCreateFileWStub);
|
||||
sKernel32Intercept.AddHook("CreateFileA",
|
||||
reinterpret_cast<intptr_t>(CreateFileAHookFn),
|
||||
(void**) &sCreateFileAStub);
|
||||
}
|
||||
|
||||
#endif // defined(XP_WIN)
|
||||
|
|
Загрузка…
Ссылка в новой задаче