Created
March 9, 2020 12:27
-
-
Save shavitush/77512d0f37af487918a715ec2553e91d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template<typename T> | |
T sig_scan(const uint32_t dwStart, const uint32_t dwEnd, const uint8_t abPattern[], const char aMask[], const size_t dwPatternSize) | |
{ | |
for(uint32_t i = dwStart; i < dwEnd; i++) | |
{ | |
for(uint32_t x = 0; x < dwPatternSize; x++) | |
{ | |
const uint8_t bMemory = *reinterpret_cast<uint8_t*>(i + x); | |
if(aMask[x] == 'x' && bMemory != abPattern[x]) | |
{ | |
break; | |
} | |
else if(x == dwPatternSize - 1) | |
{ | |
return reinterpret_cast<T>(i); | |
} | |
} | |
} | |
return nullptr; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment