Advertisement
Guest User

Untitled

a guest
Oct 13th, 2015
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.51 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. #include <cstdint> /* uintptr_t */
  4. #include "saten.h" /* objAddr, substVmt */
  5.  
  6. class A {
  7. private:
  8.     int a;
  9. public:
  10.     A(int a) {
  11.         this->a = a;
  12.     };
  13.     virtual int getA() {
  14.         return a;
  15.     }
  16. };
  17.  
  18. int fake_getA(A * self) {
  19.     return *(buffAddr(self) + 1) * *(buffAddr(self) + 1);
  20. }
  21.  
  22. int main() {
  23.     A * a = new A(5);
  24.  
  25.     uintptr_t * fakeVmt = new uintptr_t;
  26.     *fakeVmt = (uintptr_t)objAddr(fake_getA);
  27.     substVmt(fakeVmt, a);
  28.  
  29.     std::cout << a->getA();
  30.  
  31.     return 0;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement