|
1 | 1 | /* |
2 | 2 | * PROJECT: ReactOS RTL |
3 | | - * LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later) |
| 3 | + * LICENSE: MIT (https://spdx.org/licenses/MIT) |
4 | 4 | * PURPOSE: Dynamic function table support routines |
5 | | - * COPYRIGHT: Copyright 2022 Timo Kreuzer ([email protected]) |
| 5 | + * COPYRIGHT: Copyright 2022-2025 Timo Kreuzer ([email protected]) |
6 | 6 | */ |
7 | 7 |
|
8 | 8 | #include <rtl.h> |
@@ -154,6 +154,10 @@ RtlAddFunctionTable( |
154 | 154 | FunctionTable[i].EndAddress); |
155 | 155 | } |
156 | 156 |
|
| 157 | + /* Adjust the margins to be absolute addresses */ |
| 158 | + dynamicTable->MinimumAddress += BaseAddress; |
| 159 | + dynamicTable->MaximumAddress += BaseAddress; |
| 160 | + |
157 | 161 | /* Insert the table into the list */ |
158 | 162 | RtlpInsertDynamicFunctionTable(dynamicTable); |
159 | 163 |
|
@@ -277,6 +281,7 @@ RtlpLookupDynamicFunctionEntry( |
277 | 281 | PDYNAMIC_FUNCTION_TABLE dynamicTable; |
278 | 282 | PRUNTIME_FUNCTION functionTable, foundEntry = NULL; |
279 | 283 | PGET_RUNTIME_FUNCTION_CALLBACK callback; |
| 284 | + DWORD64 ipOffset; |
280 | 285 | ULONG i; |
281 | 286 |
|
282 | 287 | AcquireDynamicFunctionTableLockShared(); |
@@ -304,11 +309,12 @@ RtlpLookupDynamicFunctionEntry( |
304 | 309 |
|
305 | 310 | /* Loop all entries in the function table */ |
306 | 311 | functionTable = dynamicTable->FunctionTable; |
| 312 | + ipOffset = ControlPc - dynamicTable->BaseAddress; |
307 | 313 | for (i = 0; i < dynamicTable->EntryCount; i++) |
308 | 314 | { |
309 | 315 | /* Check if this entry contains the address */ |
310 | | - if ((ControlPc >= functionTable[i].BeginAddress) && |
311 | | - (ControlPc < functionTable[i].EndAddress)) |
| 316 | + if ((ipOffset >= functionTable[i].BeginAddress) && |
| 317 | + (ipOffset < functionTable[i].EndAddress)) |
312 | 318 | { |
313 | 319 | foundEntry = &functionTable[i]; |
314 | 320 | *ImageBase = dynamicTable->BaseAddress; |
|
0 commit comments