CreateFileMapping copy-on-write

James Abbatiello abbeyj at WPI.EDU
Wed Feb 7 01:07:51 CST 2001


Changelog:
	James Abbatiello <jabbey at codeweavers.com>
	Don't require write access on the file handle to create a copy-on-write 
mapping

-- 
James Abbatiello


-------------- next part --------------
Index: memory/virtual.c
===================================================================
RCS file: /home/wine/wine/memory/virtual.c,v
retrieving revision 1.57
diff -u -r1.57 virtual.c
--- memory/virtual.c	2001/01/15 22:20:30	1.57
+++ memory/virtual.c	2001/02/07 06:52:24
@@ -365,7 +365,14 @@
         vprot = VPROT_READ | VPROT_WRITE;
         break;
     case PAGE_WRITECOPY:
-        vprot = VPROT_READ | VPROT_WRITE | VPROT_WRITECOPY;
+	/* MSDN CreateFileMapping() states that if PAGE_WRITECOPY is given,
+	 * that the hFile must have been opened with GENERIC_READ and
+	 * GENERIC_WRITE access.  This is WRONG as tests show that you
+	 * only need GENERIC_READ access (at least for Win9x,
+	 * FIXME: what about NT?).  Thus, we don't put VPROT_WRITE in
+	 * PAGE_WRITECOPY and PAGE_EXECUTE_WRITECOPY.
+	 */
+ 	vprot = VPROT_READ | VPROT_WRITECOPY;
         break;
     case PAGE_EXECUTE:
         vprot = VPROT_EXEC;
@@ -377,7 +384,8 @@
         vprot = VPROT_EXEC | VPROT_READ | VPROT_WRITE;
         break;
     case PAGE_EXECUTE_WRITECOPY:
-        vprot = VPROT_EXEC | VPROT_READ | VPROT_WRITE | VPROT_WRITECOPY;
+	/* See comment for PAGE_WRITECOPY above */
+	vprot = VPROT_EXEC | VPROT_READ | VPROT_WRITECOPY;
         break;
     case PAGE_NOACCESS:
     default:


More information about the wine-patches mailing list