summaryrefslogtreecommitdiffstats
path: root/src/patcher.h
diff options
context:
space:
mode:
authoraap <aap@papnet.eu>2019-06-21 17:28:55 +0200
committeraap <aap@papnet.eu>2019-06-21 17:28:55 +0200
commit66462d348bec183e6b7cf848a463052759221928 (patch)
tree797c5e37ee91514dbdffe2433394e8b994e16836 /src/patcher.h
parentMerge pull request #26 from erorcun/eray (diff)
downloadre3-66462d348bec183e6b7cf848a463052759221928.tar
re3-66462d348bec183e6b7cf848a463052759221928.tar.gz
re3-66462d348bec183e6b7cf848a463052759221928.tar.bz2
re3-66462d348bec183e6b7cf848a463052759221928.tar.lz
re3-66462d348bec183e6b7cf848a463052759221928.tar.xz
re3-66462d348bec183e6b7cf848a463052759221928.tar.zst
re3-66462d348bec183e6b7cf848a463052759221928.zip
Diffstat (limited to 'src/patcher.h')
-rw-r--r--src/patcher.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/patcher.h b/src/patcher.h
index 4ac1111b..43618b47 100644
--- a/src/patcher.h
+++ b/src/patcher.h
@@ -101,6 +101,15 @@ Nop(AT address, unsigned int nCount)
VirtualProtect((void*)address, nCount, dwProtect[0], &dwProtect[1]);
}
+template<typename AT> inline void
+ClearCC(AT address, unsigned int nCount)
+{
+ DWORD dwProtect[2];
+ VirtualProtect((void*)address, nCount, PAGE_EXECUTE_READWRITE, &dwProtect[0]);
+ memset((void*)address, 0xCC, nCount);
+ VirtualProtect((void*)address, nCount, dwProtect[0], &dwProtect[1]);
+}
+
template<typename AT, typename HT> inline void
InjectHook(AT address, HT hook, unsigned int nType=PATCH_NOTHING)
{