Advertisement
Wolfrost

C++ FindPattern

Apr 1st, 2016
290
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. DWORD FindPattern(const BYTE* Pattern, const char* Mask, DWORD AddValue = NULL, bool SubtractBase = false)
  2. {
  3.     if (DumpedRegion == nullptr) if (!this->Dump()) return NULL;
  4.  
  5.     DWORD FoundOff = NULL;
  6.  
  7.     for (DWORD i=0; i<ModuleBase + ModuleSize; i++)
  8.     {
  9.         if (this->MaskCheck(i, Pattern, Mask))
  10.         {
  11.             if (!SubtractBase)
  12.                 return this->ModuleBase + (i + AddValue);
  13.             else
  14.                 return (this->ModuleBase + (i + AddValue)) - ModuleBase;
  15.         }
  16.     }
  17.  
  18.     return NULL;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement