Ignore:
Timestamp:
Aug 26, 1999, 7:56:26 PM (26 years ago)
Author:
sandervl
Message:

Workaround for OS/2 bug + VirtualProtect/VirtualQuery bugfixes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kernel32/mmap.cpp

    r707 r708  
    1 /* $Id: mmap.cpp,v 1.15 1999-08-26 15:05:14 sandervl Exp $ */
     1/* $Id: mmap.cpp,v 1.16 1999-08-26 17:56:25 sandervl Exp $ */
    22
    33/*
     
    190190                }
    191191                if(mProtFlags & PAGE_READONLY) {
    192 //DosSetMem returns flags with EXECUTE bit set, even though the initial allocation is without this bit set!
    193 //Also returns access denied when trying to set it back to READONLY
    194                         VirtualProtect((LPVOID)pageAddr, nrpages*PAGE_SIZE, newProt, &oldProt);
    195 //                      if(VirtualProtect((LPVOID)pageAddr, nrpages*PAGE_SIZE, newProt, &oldProt) == FALSE) {
    196 //                              goto fail;
    197 //                      }
     192                        if(VirtualProtect((LPVOID)pageAddr, nrpages*PAGE_SIZE, newProt, &oldProt) == FALSE) {
     193                                goto fail;
     194                        }
    198195                }
    199196        }
     
    256253
    257254  if(fMapped == FALSE) {//if not mapped, reserve/commit entire view
    258         pMapping = VirtualAlloc(0, mSize, fAlloc, memFlags);
     255        //SvL: Always read/write access or else ReadFile will crash once we
     256        //     start decommitting pages.
     257        //     This is most likely an OS/2 bug and doesn't happen in Aurora
     258        //     when allocating memory with the PAG_ANY bit set. (without this
     259        //     flag it will also crash)
     260        pMapping = VirtualAlloc(0, mSize, fAlloc, PAGE_READWRITE);
    259261        if(pMapping == NULL) {
    260262                dprintf(("Win32MemMap::mapFileView: VirtualAlloc %x %x %x failed!", mSize, fAlloc, memFlags));
Note: See TracChangeset for help on using the changeset viewer.