зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1460022: Part 13 - Update profiler to use revised DLL interceptor interface; r=njn
This commit is contained in:
Родитель
230d3ee242
Коммит
e0e1a8b28a
|
@ -303,7 +303,8 @@ Registers::SyncPopulate()
|
|||
static WindowsDllInterceptor NtDllIntercept;
|
||||
|
||||
typedef NTSTATUS (NTAPI *LdrUnloadDll_func)(HMODULE module);
|
||||
static LdrUnloadDll_func stub_LdrUnloadDll;
|
||||
static WindowsDllInterceptor::FuncHookType<LdrUnloadDll_func>
|
||||
stub_LdrUnloadDll;
|
||||
|
||||
static NTSTATUS NTAPI
|
||||
patched_LdrUnloadDll(HMODULE module)
|
||||
|
@ -318,7 +319,8 @@ patched_LdrUnloadDll(HMODULE module)
|
|||
typedef PVOID (WINAPI *LdrResolveDelayLoadedAPI_func)(PVOID ParentModuleBase,
|
||||
PVOID DelayloadDescriptor, PVOID FailureDllHook, PVOID FailureSystemHook,
|
||||
PVOID ThunkAddress, ULONG Flags);
|
||||
static LdrResolveDelayLoadedAPI_func stub_LdrResolveDelayLoadedAPI;
|
||||
static WindowsDllInterceptor::FuncHookType<LdrResolveDelayLoadedAPI_func>
|
||||
stub_LdrResolveDelayLoadedAPI;
|
||||
|
||||
static PVOID WINAPI
|
||||
patched_LdrResolveDelayLoadedAPI(PVOID ParentModuleBase,
|
||||
|
@ -336,20 +338,12 @@ patched_LdrResolveDelayLoadedAPI(PVOID ParentModuleBase,
|
|||
void
|
||||
InitializeWin64ProfilerHooks()
|
||||
{
|
||||
static bool initialized = false;
|
||||
if (initialized) {
|
||||
return;
|
||||
}
|
||||
initialized = true;
|
||||
|
||||
NtDllIntercept.Init("ntdll.dll");
|
||||
NtDllIntercept.AddHook("LdrUnloadDll",
|
||||
reinterpret_cast<intptr_t>(patched_LdrUnloadDll),
|
||||
(void**)&stub_LdrUnloadDll);
|
||||
stub_LdrUnloadDll.Set(NtDllIntercept, "LdrUnloadDll", &patched_LdrUnloadDll);
|
||||
if (IsWin8OrLater()) { // LdrResolveDelayLoadedAPI was introduced in Win8
|
||||
NtDllIntercept.AddHook("LdrResolveDelayLoadedAPI",
|
||||
reinterpret_cast<intptr_t>(patched_LdrResolveDelayLoadedAPI),
|
||||
(void**)&stub_LdrResolveDelayLoadedAPI);
|
||||
stub_LdrResolveDelayLoadedAPI.Set(NtDllIntercept,
|
||||
"LdrResolveDelayLoadedAPI",
|
||||
&patched_LdrResolveDelayLoadedAPI);
|
||||
}
|
||||
}
|
||||
#endif // defined(GP_PLAT_amd64_windows)
|
||||
|
|
Загрузка…
Ссылка в новой задаче