[PATCH] winedbg: correct mapping read/write/execute information

Eric Pouech eric.pouech at gmail.com
Fri Jul 2 02:49:25 CDT 2021


When processing memory related commands in winedbg, correctly report the
bits from VirtualQueryEx.
In details,
+ PAGE_WRITECOPY and PAGE_EXECUTE_WRITECOPY include read only
  access to the page.
+ PAGE_EXECUTE_WRITECOPY should report execution for the page.

This patch covers 'info mem' in standard mode, and 'monitor mem' in gdbproxy
mode.

Signed-off-by: Eric Pouech <eric.pouech at gmail.com>


---
 programs/winedbg/gdbproxy.c |    4 ++--
 programs/winedbg/info.c     |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/programs/winedbg/gdbproxy.c b/programs/winedbg/gdbproxy.c
index 4aef27c3204..2fa88b612ff 100644
--- a/programs/winedbg/gdbproxy.c
+++ b/programs/winedbg/gdbproxy.c
@@ -1459,13 +1459,13 @@ static void packet_query_monitor_mem(struct gdb_context* gdbctx, int len, const
             }
             memset(prot, ' ' , sizeof(prot)-1);
             prot[sizeof(prot)-1] = '\0';
-            if (mbi.AllocationProtect & (PAGE_READONLY|PAGE_READWRITE|PAGE_EXECUTE_READ|PAGE_EXECUTE_READWRITE))
+            if (mbi.AllocationProtect & (PAGE_READONLY|PAGE_READWRITE|PAGE_EXECUTE_READ|PAGE_EXECUTE_READWRITE|PAGE_WRITECOPY|PAGE_EXECUTE_WRITECOPY))
                 prot[0] = 'R';
             if (mbi.AllocationProtect & (PAGE_READWRITE|PAGE_EXECUTE_READWRITE))
                 prot[1] = 'W';
             if (mbi.AllocationProtect & (PAGE_WRITECOPY|PAGE_EXECUTE_WRITECOPY))
                 prot[1] = 'C';
-            if (mbi.AllocationProtect & (PAGE_EXECUTE|PAGE_EXECUTE_READ|PAGE_EXECUTE_READWRITE))
+            if (mbi.AllocationProtect & (PAGE_EXECUTE|PAGE_EXECUTE_READ|PAGE_EXECUTE_READWRITE|PAGE_EXECUTE_WRITECOPY))
                 prot[2] = 'X';
         }
         else
diff --git a/programs/winedbg/info.c b/programs/winedbg/info.c
index e1f3d269649..a6335092d84 100644
--- a/programs/winedbg/info.c
+++ b/programs/winedbg/info.c
@@ -769,13 +769,13 @@ void info_win32_virtual(DWORD pid)
             }
             memset(prot, ' ' , sizeof(prot) - 1);
             prot[sizeof(prot) - 1] = '\0';
-            if (mbi.AllocationProtect & (PAGE_READONLY|PAGE_READWRITE|PAGE_EXECUTE_READ|PAGE_EXECUTE_READWRITE))
+            if (mbi.AllocationProtect & (PAGE_READONLY|PAGE_READWRITE|PAGE_EXECUTE_READ|PAGE_EXECUTE_READWRITE|PAGE_WRITECOPY|PAGE_EXECUTE_WRITECOPY))
                 prot[0] = 'R';
             if (mbi.AllocationProtect & (PAGE_READWRITE|PAGE_EXECUTE_READWRITE))
                 prot[1] = 'W';
             if (mbi.AllocationProtect & (PAGE_WRITECOPY|PAGE_EXECUTE_WRITECOPY))
                 prot[1] = 'C';
-            if (mbi.AllocationProtect & (PAGE_EXECUTE|PAGE_EXECUTE_READ|PAGE_EXECUTE_READWRITE))
+            if (mbi.AllocationProtect & (PAGE_EXECUTE|PAGE_EXECUTE_READ|PAGE_EXECUTE_READWRITE|PAGE_EXECUTE_WRITECOPY))
                 prot[2] = 'X';
         }
         else




More information about the wine-devel mailing list