Changeset 770 for trunk/src/kernel32/mmap.cpp
- Timestamp:
- Sep 1, 1999, 2:04:33 AM (26 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kernel32/mmap.cpp
r712 r770 1 /* $Id: mmap.cpp,v 1.1 7 1999-08-27 16:51:00 sandervlExp $ */1 /* $Id: mmap.cpp,v 1.18 1999-09-01 00:03:51 phaller Exp $ */ 2 2 3 3 /* … … 60 60 { 61 61 mapMutex.enter(); 62 if(hMemFile != -1) 62 if(hMemFile != -1) 63 63 { 64 64 if(DuplicateHandle(GetCurrentProcess(), hMemFile, GetCurrentProcess(), 65 &hMemFile, 0, FALSE, DUPLICATE_SAME_ACCESS) == FALSE) 65 &hMemFile, 0, FALSE, DUPLICATE_SAME_ACCESS) == FALSE) 66 66 { 67 67 dprintf(("Win32MemMap::Init: DuplicateHandle failed!")); … … 136 136 137 137 // mapMutex.enter(); 138 138 139 139 newProt = mProtFlags & (PAGE_READONLY | PAGE_READWRITE | PAGE_WRITECOPY); 140 140 … … 236 236 Win32MemMapView *mapview; 237 237 238 if(fdwAccess & ~(FILE_MAP_WRITE|FILE_MAP_READ|FILE_MAP_COPY)) 239 goto parmfail; 240 if((fdwAccess & FILE_MAP_WRITE) && !(mProtFlags & PAGE_READWRITE)) 241 goto parmfail; 242 if((fdwAccess & FILE_MAP_READ) && !(mProtFlags & (PAGE_READWRITE|PAGE_READONLY))) 243 goto parmfail; 244 if((fdwAccess & FILE_MAP_COPY) && !(mProtFlags & PAGE_WRITECOPY)) 245 goto parmfail; 238 //@@@PH: if(fdwAccess & ~(FILE_MAP_WRITE|FILE_MAP_READ|FILE_MAP_COPY)) 239 // Docs say FILE_MAP_ALL_ACCESS is same as FILE_MAP_WRITE. Doesn't match reality though. 240 if(fdwAccess & ~FILE_MAP_ALL_ACCESS) 241 goto parmfail; 242 if((fdwAccess & FILE_MAP_WRITE) && !(mProtFlags & PAGE_READWRITE)) 243 goto parmfail; 244 if((fdwAccess & FILE_MAP_READ) && !(mProtFlags & (PAGE_READWRITE|PAGE_READONLY))) 245 goto parmfail; 246 247 //@@@PH 248 if (fdwAccess != FILE_MAP_ALL_ACCESS) 249 if((fdwAccess & FILE_MAP_COPY) && !(mProtFlags & PAGE_WRITECOPY)) 250 goto parmfail; 251 246 252 if(offset+size > mSize) 247 253 goto parmfail; … … 260 266 if(nrMappings == 0) {//if not mapped, reserve/commit entire view 261 267 //SvL: Always read/write access or else ReadFile will crash once we 262 // start committing pages. 268 // start committing pages. 263 269 // This is most likely an OS/2 bug and doesn't happen in Aurora 264 270 // when allocating memory with the PAG_ANY bit set. (without this … … 308 314 goto parmfail; 309 315 310 if(cbFlush == 0) 316 if(cbFlush == 0) 311 317 cbFlush = mSize; 312 318 … … 325 331 goto fail; 326 332 } 327 //If a page (or range of pages) is reserved or write protected, we 333 //If a page (or range of pages) is reserved or write protected, we 328 334 //won't bother flushing it to disk 329 if(memInfo.State & MEM_COMMIT && 330 memInfo.AllocationProtect & (PAGE_READWRITE|PAGE_WRITECOPY|PAGE_EXECUTE_READWRITE|PAGE_EXECUTE_WRITECOPY)) 335 if(memInfo.State & MEM_COMMIT && 336 memInfo.AllocationProtect & (PAGE_READWRITE|PAGE_WRITECOPY|PAGE_EXECUTE_READWRITE|PAGE_EXECUTE_WRITECOPY)) 331 337 {//committed and allowed for writing? 332 338 offset = (ULONG)lpvBase - (ULONG)pMapping; … … 418 424 //****************************************************************************** 419 425 //****************************************************************************** 420 Win32MemMapView::Win32MemMapView(Win32MemMap *map, ULONG offset, ULONG size, 426 Win32MemMapView::Win32MemMapView(Win32MemMap *map, ULONG offset, ULONG size, 421 427 ULONG fdwAccess) 422 428 { … … 520 526 //****************************************************************************** 521 527 //****************************************************************************** 522 Win32MemMap *Win32MemMapView::findMapByView(ULONG address, ULONG *offset, 528 Win32MemMap *Win32MemMapView::findMapByView(ULONG address, ULONG *offset, 523 529 ULONG accessType, 524 530 Win32MemMapView **pView) … … 531 537 if(view != NULL) { 532 538 while(view && (ULONG)view->getViewAddr() <= address) { 533 if((ULONG)view->getViewAddr() <= address && 539 if((ULONG)view->getViewAddr() <= address && 534 540 (ULONG)view->getViewAddr() + view->getSize() >= address && 535 541 view->getAccessFlags() >= accessType)
Note:
See TracChangeset
for help on using the changeset viewer.