Index: trunk/src/kernel32/mmap.cpp
===================================================================
--- trunk/src/kernel32/mmap.cpp	(revision 769)
+++ trunk/src/kernel32/mmap.cpp	(revision 770)
@@ -1,3 +1,3 @@
-/* $Id: mmap.cpp,v 1.17 1999-08-27 16:51:00 sandervl Exp $ */
+/* $Id: mmap.cpp,v 1.18 1999-09-01 00:03:51 phaller Exp $ */
 
 /*
@@ -60,8 +60,8 @@
 {
   mapMutex.enter();
-  if(hMemFile != -1) 
+  if(hMemFile != -1)
   {
      	if(DuplicateHandle(GetCurrentProcess(), hMemFile, GetCurrentProcess(),
-                           &hMemFile, 0, FALSE, DUPLICATE_SAME_ACCESS) == FALSE) 
+                           &hMemFile, 0, FALSE, DUPLICATE_SAME_ACCESS) == FALSE)
      	{
 		dprintf(("Win32MemMap::Init: DuplicateHandle failed!"));
@@ -136,5 +136,5 @@
 
 //  mapMutex.enter();
-  
+
   newProt  = mProtFlags & (PAGE_READONLY | PAGE_READWRITE | PAGE_WRITECOPY);
 
@@ -236,12 +236,18 @@
   Win32MemMapView *mapview;
 
-  if(fdwAccess & ~(FILE_MAP_WRITE|FILE_MAP_READ|FILE_MAP_COPY)) 
-	goto parmfail;
-  if((fdwAccess & FILE_MAP_WRITE) && !(mProtFlags & PAGE_READWRITE)) 
-	goto parmfail;
-  if((fdwAccess & FILE_MAP_READ) && !(mProtFlags & (PAGE_READWRITE|PAGE_READONLY))) 
-	goto parmfail;
-  if((fdwAccess & FILE_MAP_COPY) && !(mProtFlags & PAGE_WRITECOPY)) 
-	goto parmfail;
+  //@@@PH: if(fdwAccess & ~(FILE_MAP_WRITE|FILE_MAP_READ|FILE_MAP_COPY))
+  // Docs say FILE_MAP_ALL_ACCESS is same as FILE_MAP_WRITE. Doesn't match reality though.
+  if(fdwAccess & ~FILE_MAP_ALL_ACCESS)
+	goto parmfail;
+  if((fdwAccess & FILE_MAP_WRITE) && !(mProtFlags & PAGE_READWRITE))
+	goto parmfail;
+  if((fdwAccess & FILE_MAP_READ) && !(mProtFlags & (PAGE_READWRITE|PAGE_READONLY)))
+	goto parmfail;
+
+  //@@@PH
+  if (fdwAccess != FILE_MAP_ALL_ACCESS)
+    if((fdwAccess & FILE_MAP_COPY) && !(mProtFlags & PAGE_WRITECOPY))
+      goto parmfail;
+
   if(offset+size > mSize)
 	goto parmfail;
@@ -260,5 +266,5 @@
   if(nrMappings == 0) {//if not mapped, reserve/commit entire view
 	//SvL: Always read/write access or else ReadFile will crash once we
- 	//     start committing pages. 
+ 	//     start committing pages.
 	//     This is most likely an OS/2 bug and doesn't happen in Aurora
         //     when allocating memory with the PAG_ANY bit set. (without this
@@ -308,5 +314,5 @@
 	goto parmfail;
 
-  if(cbFlush == 0) 
+  if(cbFlush == 0)
  	cbFlush = mSize;
 
@@ -325,8 +331,8 @@
 		goto fail;
 	}
-	//If a page (or range of pages) is reserved or write protected, we 
+	//If a page (or range of pages) is reserved or write protected, we
         //won't bother flushing it to disk
-	if(memInfo.State & MEM_COMMIT && 
-           memInfo.AllocationProtect & (PAGE_READWRITE|PAGE_WRITECOPY|PAGE_EXECUTE_READWRITE|PAGE_EXECUTE_WRITECOPY)) 
+	if(memInfo.State & MEM_COMMIT &&
+           memInfo.AllocationProtect & (PAGE_READWRITE|PAGE_WRITECOPY|PAGE_EXECUTE_READWRITE|PAGE_EXECUTE_WRITECOPY))
         {//committed and allowed for writing?
 		offset = (ULONG)lpvBase - (ULONG)pMapping;
@@ -418,5 +424,5 @@
 //******************************************************************************
 //******************************************************************************
-Win32MemMapView::Win32MemMapView(Win32MemMap *map, ULONG offset, ULONG size, 
+Win32MemMapView::Win32MemMapView(Win32MemMap *map, ULONG offset, ULONG size,
                                  ULONG fdwAccess)
 {
@@ -520,5 +526,5 @@
 //******************************************************************************
 //******************************************************************************
-Win32MemMap *Win32MemMapView::findMapByView(ULONG address, ULONG *offset, 
+Win32MemMap *Win32MemMapView::findMapByView(ULONG address, ULONG *offset,
                                             ULONG accessType,
                                             Win32MemMapView **pView)
@@ -531,5 +537,5 @@
   if(view != NULL) {
   	while(view && (ULONG)view->getViewAddr() <= address) {
-		if((ULONG)view->getViewAddr() <= address && 
+		if((ULONG)view->getViewAddr() <= address &&
                    (ULONG)view->getViewAddr() + view->getSize() >= address &&
                    view->getAccessFlags() >= accessType)
