Ignore:
Timestamp:
May 26, 2000, 8:42:57 PM (25 years ago)
Author:
sandervl
Message:

memory map bugfixes + added method for querying image size

File:
1 edited

Legend:

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

    r3602 r3609  
    1 /* $Id: mmap.cpp,v 1.40 2000-05-24 19:28:26 sandervl Exp $ */
     1/* $Id: mmap.cpp,v 1.41 2000-05-26 18:42:55 sandervl Exp $ */
    22
    33/*
     
    1717 * TODO: Sharing memory mapped files between multiple processes
    1818 * TODO: Memory mapped files with views that extend the file (not 100% correct now)
     19 * TODO: Suspend all threads when a page is committed (possible that another thread
     20 *       accesses the same memory before the page is read from disk
    1921 *
    2022 * Project Odin Software License can be found in LICENSE.TXT
     
    5254//******************************************************************************
    5355Win32MemMap::Win32MemMap(HFILE hfile, ULONG size, ULONG fdwProtect, LPSTR lpszName)
    54                : nrMappings(0), pMapping(NULL), mMapAccess(0), referenced(0), image(0)
     56               : nrMappings(0), pMapping(NULL), mMapAccess(0), referenced(0), image(0),
     57                 fClosed(FALSE)
    5558{
    5659  globalmapMutex.enter(VMUTEX_WAIT_FOREVER, &hGlobalMapMutex);
     
    7578//******************************************************************************
    7679Win32MemMap::Win32MemMap(Win32PeLdrImage *pImage, ULONG baseAddress, ULONG size)
    77                : nrMappings(0), pMapping(NULL), mMapAccess(0), referenced(0)
     80               : nrMappings(0), pMapping(NULL), mMapAccess(0), referenced(0), image(0),
     81                 fClosed(FALSE)
    7882{
    7983  globalmapMutex.enter(VMUTEX_WAIT_FOREVER, &hGlobalMapMutex);
     
    292296  }
    293297  mapMutex.leave();
     298 
     299  //if there are no more mappings left and the memory map's handle has been
     300  //closed, then delete the object
     301  if(nrMappings == 0 && fClosed) {
     302        delete this;
     303  }
    294304  return TRUE;
    295305fail:
     
    526536                        delete map;
    527537                }
    528                 else    CloseHandle(memmaps->hMemMap);
     538                else {
     539                        if(!map->isClosed())
     540                                CloseHandle(memmaps->hMemMap);
     541                        delete map;
     542                }
    529543        }
    530544        else {
Note: See TracChangeset for help on using the changeset viewer.