summaryrefslogtreecommitdiffstats
path: root/src/patcher.h
diff options
context:
space:
mode:
authoreray orçunus <erayorcunus@gmail.com>2019-06-22 02:56:46 +0200
committereray orçunus <erayorcunus@gmail.com>2019-06-22 02:56:46 +0200
commit5ee579daa28b9b1d4036f041e7650755484d79fc (patch)
tree8aa93221bd0baa39340f69796d88efcaf24033f7 /src/patcher.h
parentShotgun fix, CPed, CWeaponInfo (diff)
parentMerge pull request #28 from gennariarmando/master (diff)
downloadre3-5ee579daa28b9b1d4036f041e7650755484d79fc.tar
re3-5ee579daa28b9b1d4036f041e7650755484d79fc.tar.gz
re3-5ee579daa28b9b1d4036f041e7650755484d79fc.tar.bz2
re3-5ee579daa28b9b1d4036f041e7650755484d79fc.tar.lz
re3-5ee579daa28b9b1d4036f041e7650755484d79fc.tar.xz
re3-5ee579daa28b9b1d4036f041e7650755484d79fc.tar.zst
re3-5ee579daa28b9b1d4036f041e7650755484d79fc.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)
{