mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-23 15:09:53 +08:00
07156ed156
* [detours] new port * [detours] Use PATCHES parameter instead of vcpkg_apply_patches function
25 lines
830 B
Diff
25 lines
830 B
Diff
diff --git a/src/detours.cpp b/src/detours.cpp
|
|
index 8345c4d..3cd0e9d 100644
|
|
--- a/src/detours.cpp
|
|
+++ b/src/detours.cpp
|
|
@@ -974,6 +974,19 @@ inline PBYTE detour_skip_jmp(PBYTE pbCode, PVOID *ppGlobals)
|
|
return pbCode;
|
|
}
|
|
|
|
+inline void detour_find_jmp_bounds(PBYTE pbCode,
|
|
+ PDETOUR_TRAMPOLINE *ppLower,
|
|
+ PDETOUR_TRAMPOLINE *ppUpper)
|
|
+{
|
|
+ // We have to place trampolines within +/- 2GB of code.
|
|
+ ULONG_PTR lo = detour_2gb_below((ULONG_PTR)pbCode);
|
|
+ ULONG_PTR hi = detour_2gb_above((ULONG_PTR)pbCode);
|
|
+ DETOUR_TRACE(("[%p..%p..%p]\n", lo, pbCode, hi));
|
|
+
|
|
+ *ppLower = (PDETOUR_TRAMPOLINE)lo;
|
|
+ *ppUpper = (PDETOUR_TRAMPOLINE)hi;
|
|
+}
|
|
+
|
|
inline BOOL detour_does_code_end_function(PBYTE pbCode)
|
|
{
|
|
ULONG Opcode = fetch_opcode(pbCode);
|