Update patternfind.c

This commit is contained in:
zeffy
2018-03-02 17:09:04 -08:00
parent 909d645f07
commit 79fa34dd27
2 changed files with 6 additions and 4 deletions

View File

@@ -5,7 +5,8 @@ Licensed under Lesser GNU Public License 3.0
Changes made:
- Ported to C, removed dependency on C++ type vector<T>
- Uses stdint.h type uint8_t instead of unsigned char (for readability)
- Renamed patternfind overloads to patternfind, patternfind_bytes, patternfind_pbyte
- Added VirtualProtect calls to patternwrite function to prevent access violation exceptions
- Ported to C, removed dependency on C++ type vector<T>.
- Uses stdint.h type uint8_t instead of unsigned char (for readability).
- Renamed patternfind overloads to patternfind, patternfind_bytes, patternfind_pbyte.
- Added VirtualProtect to patternwrite function to prevent access violation exceptions.
- Added FlushInstructionCache to patternwrite function.

View File

@@ -150,6 +150,7 @@ void patternwrite(uint8_t *data, size_t datasize, const char *pattern)
for ( size_t i = 0; i < writepatternsize; i++ )
patternwritebyte(&data[i], writepattern[i]);
result = VirtualProtect(data, writepatternsize, OldProtect, &OldProtect);
FlushInstructionCache(GetCurrentProcess(), data, datasize);
}
free(writepattern);