From 2ed3c47765c4372abe356bb8cee19adc36e02b98 Mon Sep 17 00:00:00 2001 From: xerox Date: Tue, 21 Jul 2020 18:16:31 +0000 Subject: [PATCH] Update driver_util.cpp --- kdstinker/driver_util.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/kdstinker/driver_util.cpp b/kdstinker/driver_util.cpp index 2122d2a..6a1292b 100644 --- a/kdstinker/driver_util.cpp +++ b/kdstinker/driver_util.cpp @@ -117,14 +117,18 @@ namespace driver_util // save old function pointer result = reinterpret_cast(first_thunk->u1.Function); + // + // although disabling wp bit can cause crashes, im disabling it for nano seconds. only to write 8 bytes... + // in reality this is 1 mov instruction. + // { // // disable write protection // + _disable(); auto cr0 = __readcr0(); cr0 &= 0xfffffffffffeffff; __writecr0(cr0); - _disable(); } // swap address @@ -136,8 +140,8 @@ namespace driver_util // auto cr0 = __readcr0(); cr0 |= 0x10000; - _enable(); __writecr0(cr0); + _enable(); } return result; }