Update driver_util.cpp

master
xerox 4 years ago
parent 408051164a
commit 2ed3c47765

@ -117,14 +117,18 @@ namespace driver_util
// save old function pointer // save old function pointer
result = reinterpret_cast<PVOID>(first_thunk->u1.Function); result = reinterpret_cast<PVOID>(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 write protection
// //
_disable();
auto cr0 = __readcr0(); auto cr0 = __readcr0();
cr0 &= 0xfffffffffffeffff; cr0 &= 0xfffffffffffeffff;
__writecr0(cr0); __writecr0(cr0);
_disable();
} }
// swap address // swap address
@ -136,8 +140,8 @@ namespace driver_util
// //
auto cr0 = __readcr0(); auto cr0 = __readcr0();
cr0 |= 0x10000; cr0 |= 0x10000;
_enable();
__writecr0(cr0); __writecr0(cr0);
_enable();
} }
return result; return result;
} }

Loading…
Cancel
Save