[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.
|
||||||
add_growable_table_ = (FnRtlAddGrowableFunctionTable)GetProcAddress(
|
auto ntdll_handle = GetModuleHandleW(L"ntdll.dll");
|
||||||
GetModuleHandleW(L"ntdll.dll"), "RtlAddGrowableFunctionTable");
|
if (!ntdll_handle) {
|
||||||
delete_growable_table_ = (FnRtlDeleteGrowableFunctionTable)GetProcAddress(
|
add_growable_table_ = nullptr;
|
||||||
GetModuleHandleW(L"ntdll.dll"), "RtlDeleteGrowableFunctionTable");
|
delete_growable_table_ = nullptr;
|
||||||
grow_table_ = (FnRtlGrowFunctionTable)GetProcAddress(
|
grow_table_ = nullptr;
|
||||||
GetModuleHandleW(L"ntdll.dll"), "RtlGrowFunctionTable");
|
} else {
|
||||||
|
add_growable_table_ = (FnRtlAddGrowableFunctionTable)GetProcAddress(
|
||||||
|
ntdll_handle, "RtlAddGrowableFunctionTable");
|
||||||
|
delete_growable_table_ = (FnRtlDeleteGrowableFunctionTable)GetProcAddress(
|
||||||
|
ntdll_handle, "RtlDeleteGrowableFunctionTable");
|
||||||
|
grow_table_ = (FnRtlGrowFunctionTable)GetProcAddress(
|
||||||
|
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