summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2021-09-11 09:56:27 +0300
committerEli Zaretskii <eliz@gnu.org>2021-09-11 09:56:27 +0300
commitf98700af80b37a43669955ec399ac300c3979384 (patch)
tree417fb6bf2750dc90e83c94055628b11ed2eae24c
parentd37dcfa30ff20aa2d5b0d6c2e43ef5930e72e375 (diff)
downloademacs-f98700af80b37a43669955ec399ac300c3979384.tar.gz
emacs-f98700af80b37a43669955ec399ac300c3979384.tar.bz2
emacs-f98700af80b37a43669955ec399ac300c3979384.zip
Fix restoring from pdumper file on MS-Windows 9X
* src/pdumper.c (dump_map_file_w32): Use PAGE_WRITECOPY flag when calling CreateFileMapping for DUMP_MEMORY_ACCESS_READWRITE access, as that is required by Windows 9X. (Bug#50453)
-rw-r--r--src/pdumper.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/pdumper.c b/src/pdumper.c
index 7730ea3d061..2291fced5d7 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);