[x64] Reuse module handle when pulling in growable function table imports.
This commit is contained in:
parent
92a85d6692
commit
918a7d4365
|
@ -163,12 +163,19 @@ bool Win32X64CodeCache::Initialize() {
|
||||||
unwind_table_.resize(kMaximumFunctionCount);
|
unwind_table_.resize(kMaximumFunctionCount);
|
||||||
|
|
||||||
// Check if this version of Windows supports growable function tables.
|
// Check if this version of Windows supports growable function tables.
|
||||||
|
auto ntdll_handle = GetModuleHandleW(L"ntdll.dll");
|
||||||
|
if (!ntdll_handle) {
|
||||||
|
add_growable_table_ = nullptr;
|
||||||
|
delete_growable_table_ = nullptr;
|
||||||
|
grow_table_ = nullptr;
|
||||||
|
} else {
|
||||||
add_growable_table_ = (FnRtlAddGrowableFunctionTable)GetProcAddress(
|
add_growable_table_ = (FnRtlAddGrowableFunctionTable)GetProcAddress(
|
||||||
GetModuleHandleW(L"ntdll.dll"), "RtlAddGrowableFunctionTable");
|
ntdll_handle, "RtlAddGrowableFunctionTable");
|
||||||
delete_growable_table_ = (FnRtlDeleteGrowableFunctionTable)GetProcAddress(
|
delete_growable_table_ = (FnRtlDeleteGrowableFunctionTable)GetProcAddress(
|
||||||
GetModuleHandleW(L"ntdll.dll"), "RtlDeleteGrowableFunctionTable");
|
ntdll_handle, "RtlDeleteGrowableFunctionTable");
|
||||||
grow_table_ = (FnRtlGrowFunctionTable)GetProcAddress(
|
grow_table_ = (FnRtlGrowFunctionTable)GetProcAddress(
|
||||||
GetModuleHandleW(L"ntdll.dll"), "RtlGrowFunctionTable");
|
ntdll_handle, "RtlGrowFunctionTable");
|
||||||
|
}
|
||||||
supports_growable_table_ =
|
supports_growable_table_ =
|
||||||
add_growable_table_ && delete_growable_table_ && grow_table_;
|
add_growable_table_ && delete_growable_table_ && grow_table_;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue