added detach test
This commit is contained in:
parent
aaad260259
commit
6c45dd47da
1 changed files with 9 additions and 2 deletions
|
|
@ -1,11 +1,10 @@
|
|||
// Copyright (c) Lysann Tranvouez. All rights reserved.
|
||||
|
||||
#include <cassert>
|
||||
#include <cstring>
|
||||
|
||||
#include "mach_detours.h"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
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<detour_func_t*>(&real_strerror), reinterpret_cast<detour_func_t>(my_strerror));
|
||||
detour_transaction_commit();
|
||||
|
||||
assert(counter == 1);
|
||||
strerror(0);
|
||||
assert(counter == 1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue