https://git.reactos.org/?p=reactos.git;a=commitdiff;h=47372e2ac9d6e6263940b2e37e5c08e5503f8965

commit 47372e2ac9d6e6263940b2e37e5c08e5503f8965
Author:     Timo Kreuzer <[email protected]>
AuthorDate: Tue Jul 6 13:48:52 2021 +0200
Commit:     Timo Kreuzer <[email protected]>
CommitDate: Sun Jul 11 21:43:07 2021 +0200

    [NTOS:MM] Fix MiSetSystemCodeProtection
    
    CORE-16387 CORE-17638
    Windows only makes the header RO for session space mapped drivers (win32k, 
dx and display drivers)
---
 ntoskrnl/mm/ARM3/sysldr.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/ntoskrnl/mm/ARM3/sysldr.c b/ntoskrnl/mm/ARM3/sysldr.c
index d3d9669ab52..31181b69fc9 100644
--- a/ntoskrnl/mm/ARM3/sysldr.c
+++ b/ntoskrnl/mm/ARM3/sysldr.c
@@ -2486,13 +2486,13 @@ MiWriteProtectSystemImage(
     /* Get the base address of the first section */
     SectionBase = Add2Ptr(ImageBase, SectionHeaders[0].VirtualAddress);
 
-    /* Start protecting the image header as R/O */
+    /* Start protecting the image header as R/W */
     FirstPte = MiAddressToPte(ImageBase);
     LastPte = MiAddressToPte(SectionBase) - 1;
-    Protection = IMAGE_SCN_MEM_READ;
+    Protection = IMAGE_SCN_MEM_READ | IMAGE_SCN_MEM_WRITE;
     if (LastPte >= FirstPte)
     {
-        MiSetSystemCodeProtection(FirstPte, LastPte, IMAGE_SCN_MEM_READ);
+        MiSetSystemCodeProtection(FirstPte, LastPte, Protection);
     }
 
     /* Loop the sections */

Reply via email to