diff --git a/src/hooking_test.cpp b/src/hooking_test.cpp index 74c8f60..5cdd493 100644 --- a/src/hooking_test.cpp +++ b/src/hooking_test.cpp @@ -5,15 +5,23 @@ #include #include +#include using namespace std; class C { public: + C() = default; + virtual ~C() = default; + void foo(int bar) { - cout << reinterpret_cast(this) << " -> " << bar << endl; + printf("%p -> %d\n", this, bar); + } + virtual void fooo(int bar) + { + printf("%p -> %d\n", this, bar); } }; @@ -24,10 +32,15 @@ int main(int argc, char **argv) { C c; cvifptr_t zup = &C::foo; - cout << zup << endl; vifptr_t baz = reinterpret_cast(zup); - cout << baz << endl; + void (C::*mfp)(int) = &C::foo; + vifptr_t biz = reinterpret_cast(c.*mfp); + + printf("%p\n", reinterpret_cast(baz)); + printf("%p\n", reinterpret_cast(biz)); (c.*zup)(123); - (*baz)(1234, 321); + (*baz)(0x1234, 321); + (*biz)(0x4321, 432); + return 0; }