Changeset 9911 for trunk/src/kernel32/oslibmem.cpp
- Timestamp:
- Mar 6, 2003, 11:44:34 AM (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kernel32/oslibmem.cpp
r9292 r9911 1 /* $Id: oslibmem.cpp,v 1. 5 2002-09-24 15:15:27sandervl Exp $ */1 /* $Id: oslibmem.cpp,v 1.6 2003-03-06 10:44:34 sandervl Exp $ */ 2 2 /* 3 3 * Wrappers for OS/2 Dos* API … … 43 43 44 44 //****************************************************************************** 45 //TODO: Assumes entire memory range has the same protection flags!46 45 //TODO: Check if this works for code aliases... 47 46 //****************************************************************************** … … 55 54 cb+= PAGE_SIZE; 56 55 57 rc = DosQueryMem(pb, &size, &attr);58 if(rc) {59 dprintf(("!ERROR!: OSLibDosAliasMem: DosQueryMem %x %x return %d", pb, size, rc));60 return rc;61 }62 size = (size-1) & ~0xfff;63 size+= PAGE_SIZE;64 if(size != cb) {65 dprintf(("!WARNING!: OSLibDosAliasMem: size != cb (%x!=%x)!!!!!!!!", size, cb));66 //ignore this and continue return 5;67 attr = fl; //just use original protection flags (NOT CORRECT)68 }69 attr &= (PAG_READ|PAG_WRITE|PAG_EXECUTE|PAG_GUARD|PAG_DEFAULT);70 if(attr != fl) {71 rc = DosSetMem(pb, size, fl);72 if(rc) {73 dprintf(("!ERROR!: OSLibDosAliasMem: DosSetMem %x %x return %d", pb, size, rc));74 attr = fl;75 //just continue for now76 //return rc;77 }78 }79 56 rc = DosAliasMem(pb, cb, ppbAlias, 2); 80 57 if(rc) { … … 82 59 return rc; 83 60 } 84 if(attr != fl) { 85 rc = DosSetMem(pb, size, attr); 86 if(rc) { 87 dprintf(("!ERROR!: OSLibDosAliasMem: DosSetMem (2) %x %x return %d", pb, size, rc)); 61 //Now try to change the protection flags of all pages in the aliased range 62 DWORD pAlias = (DWORD)*ppbAlias; 63 64 while(pAlias < (DWORD)*ppbAlias + cb) 65 { 66 rc = DosQueryMem((PVOID)pAlias, &size, &attr); 67 if(rc != NO_ERROR) { 68 dprintf(("!ERROR!: OSLibDosAliasMem: DosQueryMem %x returned %d", pAlias, rc)); 69 DebugInt3(); 88 70 return rc; 89 71 } 72 //Don't bother if the pages are not committed. DosSetMem will return 73 //ERROR_ACCESS_DENIED. 74 if(attr & PAG_COMMIT) { 75 rc = DosSetMem((PVOID)pAlias, size, fl); 76 if(rc) { 77 dprintf(("!ERROR!: OSLibDosAliasMem: DosSetMem %x %x return %d", *ppbAlias, size, rc)); 78 DebugInt3(); 79 return rc; 80 } 81 } 82 pAlias += size; 90 83 } 91 84 return 0;
Note:
See TracChangeset
for help on using the changeset viewer.