Initial commit
This commit is contained in:
commit
8ae1c4e9eb
5 changed files with 218 additions and 0 deletions
33
src/hooking_test.cpp
Normal file
33
src/hooking_test.cpp
Normal file
|
@ -0,0 +1,33 @@
|
|||
//============================================================================
|
||||
// Name : hooking_test.cpp
|
||||
// Author :Attila Body
|
||||
//============================================================================
|
||||
#include <stdint.h>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
|
||||
class C
|
||||
{
|
||||
public:
|
||||
void foo(int bar)
|
||||
{
|
||||
cout << reinterpret_cast<uintptr_t>(this) << " -> " << bar << endl;
|
||||
}
|
||||
};
|
||||
|
||||
typedef void (C::*cvifptr_t)(int);
|
||||
typedef void (*vifptr_t)(int, int);
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
C c;
|
||||
cvifptr_t zup = &C::foo;
|
||||
cout << zup << endl;
|
||||
vifptr_t baz = reinterpret_cast<vifptr_t>(zup);
|
||||
cout << baz << endl;
|
||||
(c.*zup)(123);
|
||||
(*baz)(1234, 321);
|
||||
return 0;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue