Update patternfind.c
This commit is contained in:
@@ -5,7 +5,8 @@ Licensed under Lesser GNU Public License 3.0
|
|||||||
|
|
||||||
Changes made:
|
Changes made:
|
||||||
|
|
||||||
- Ported to C, removed dependency on C++ type vector<T>
|
- Ported to C, removed dependency on C++ type vector<T>.
|
||||||
- Uses stdint.h type uint8_t instead of unsigned char (for readability)
|
- Uses stdint.h type uint8_t instead of unsigned char (for readability).
|
||||||
- Renamed patternfind overloads to patternfind, patternfind_bytes, patternfind_pbyte
|
- Renamed patternfind overloads to patternfind, patternfind_bytes, patternfind_pbyte.
|
||||||
- Added VirtualProtect calls to patternwrite function to prevent access violation exceptions
|
- Added VirtualProtect to patternwrite function to prevent access violation exceptions.
|
||||||
|
- Added FlushInstructionCache to patternwrite function.
|
||||||
|
@@ -150,6 +150,7 @@ void patternwrite(uint8_t *data, size_t datasize, const char *pattern)
|
|||||||
for ( size_t i = 0; i < writepatternsize; i++ )
|
for ( size_t i = 0; i < writepatternsize; i++ )
|
||||||
patternwritebyte(&data[i], writepattern[i]);
|
patternwritebyte(&data[i], writepattern[i]);
|
||||||
result = VirtualProtect(data, writepatternsize, OldProtect, &OldProtect);
|
result = VirtualProtect(data, writepatternsize, OldProtect, &OldProtect);
|
||||||
|
FlushInstructionCache(GetCurrentProcess(), data, datasize);
|
||||||
}
|
}
|
||||||
|
|
||||||
free(writepattern);
|
free(writepattern);
|
||||||
|
Reference in New Issue
Block a user