bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#50453: 27.2; Portable dumper broken on MSW


From: Eli Zaretskii
Subject: bug#50453: 27.2; Portable dumper broken on MSW
Date: Fri, 10 Sep 2021 15:18:31 +0300

> From: Po Lu <luangruo@yahoo.com>
> Cc: 50453@debbugs.gnu.org
> Date: Fri, 10 Sep 2021 08:48:47 +0800
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > How did you try that?  Did you rebuild Emacs?  If so, I would like you
> > to try a different change first, before we decide to give up on the
> > memory-mapped file approach.
> 
> Yes, I rebuilt Emacs.  I would be glad to test another change, thanks!

Please try the patch below.

diff --git a/src/pdumper.c b/src/pdumper.c
index 7730ea3..2291fce 100644
--- a/src/pdumper.c
+++ b/src/pdumper.c
@@ -4537,15 +4537,28 @@ dump_map_file_w32 (void *base, int fd, off_t offset, 
size_t size,
   uint32_t offset_low = (uint32_t) (full_offset & 0xffffffff);
 
   int error;
+  DWORD protect;
   DWORD map_access;
 
   file = (HANDLE) _get_osfhandle (fd);
   if (file == INVALID_HANDLE_VALUE)
     goto out;
 
+  switch (protection)
+    {
+    case DUMP_MEMORY_ACCESS_READWRITE:
+      protect = PAGE_WRITECOPY;        /* for Windows 9X */
+      break;
+    default:
+    case DUMP_MEMORY_ACCESS_NONE:
+    case DUMP_MEMORY_ACCESS_READ:
+      protect = PAGE_READONLY;
+      break;
+    }
+
   section = CreateFileMapping (file,
                               /*lpAttributes=*/NULL,
-                              PAGE_READONLY,
+                              protect,
                               /*dwMaximumSizeHigh=*/0,
                               /*dwMaximumSizeLow=*/0,
                               /*lpName=*/NULL);





reply via email to

[Prev in Thread] Current Thread [Next in Thread]