Cromon

CMappedModule.cpp

Oct 24th, 2012
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.15 KB | None | 0 0
  1.     std::vector<BYTE> CMappedModule::getRemoteJumpEntry() {
  2.         std::vector<BYTE> ret;
  3.         DWORD dwEntryPoint = mParsedModule.getEntryPoint() + (DWORD)mBaseOfDll;
  4.  
  5.         // push ebp
  6.         ret.push_back(0x55);
  7.         // mov ebp, esp
  8.         ret.push_back(0x8B); ret.push_back(0xEC);
  9.  
  10.         // push imm8
  11.         ret.push_back(0x68);
  12.         // lpReserved
  13.         ret.push_back(0); ret.push_back(0); ret.push_back(0); ret.push_back(0);
  14.         // push imm8
  15.         ret.push_back(0x68);
  16.         // dwReason
  17.         ret.push_back(1); ret.push_back(0); ret.push_back(0); ret.push_back(0);
  18.         // push imm32
  19.         ret.push_back(0x68);
  20.         // hInstance
  21.         ret.insert(ret.end(), (BYTE*)&mBaseOfDll, ((BYTE*)&mBaseOfDll) + 4);
  22.         // mov eax
  23.         ret.push_back(0xB8);
  24.         // dllEntryPoint
  25.         ret.insert(ret.end(), (BYTE*)&dwEntryPoint, ((BYTE*)&dwEntryPoint) + 4);
  26.         // call eax
  27.         ret.push_back(0xFF); ret.push_back(0xD0);
  28.  
  29.         // int 3
  30.         ret.push_back(0xCC);
  31.  
  32.         // pop eax * 3
  33.         ret.push_back(0x5B);
  34.         ret.push_back(0x5B);
  35.         ret.push_back(0x5B);
  36.  
  37.         // mov esp, ebp
  38.         ret.push_back(0x8B); ret.push_back(0xE5);
  39.         // pop ebp
  40.         ret.push_back(0x5D);
  41.         // retn 4
  42.         ret.push_back(0xC2); ret.push_back(4); ret.push_back(0);
  43.  
  44.         return ret;
  45.     }
Advertisement
Add Comment
Please, Sign In to add comment