From 6c45dd47da7bf51b4ae073edba2e5a137329d01a Mon Sep 17 00:00:00 2001 From: Lysann Tranvouez Date: Tue, 30 Sep 2025 00:11:00 +0200 Subject: [PATCH] added detach test --- sample/main.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/sample/main.cpp b/sample/main.cpp index feed8d4..1a380a1 100644 --- a/sample/main.cpp +++ b/sample/main.cpp @@ -1,11 +1,10 @@ // Copyright (c) Lysann Tranvouez. All rights reserved. #include +#include #include "mach_detours.h" -#include - char* (*real_strerror)(int errno) = strerror; static int counter = 0; @@ -30,5 +29,13 @@ int main(int argc, const char* argv[]) strerror(0); assert(counter == 1); + detour_transaction_begin(); + detour_detach(reinterpret_cast(&real_strerror), reinterpret_cast(my_strerror)); + detour_transaction_commit(); + + assert(counter == 1); + strerror(0); + assert(counter == 1); + return 0; } \ No newline at end of file