Changeset 8456 for trunk/src


Ignore:
Timestamp:
May 20, 2002, 3:47:59 PM (23 years ago)
Author:
sandervl
Message:

DF: Removed 64 MB memory mapped file limit & Fix for opening memory mapped file with size larger than the file size

Location:
trunk/src/kernel32
Files:
3 edited

Legend:

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

    r8119 r8456  
    1 /* $Id: hmmmap.cpp,v 1.19 2002-03-24 11:59:45 sandervl Exp $ */
     1/* $Id: hmmmap.cpp,v 1.20 2002-05-20 13:47:58 sandervl Exp $ */
    22
    33/*
     
    5151//******************************************************************************
    5252DWORD HMDeviceMemMapClass::CreateFileMapping(PHMHANDLEDATA         pHMHandleData,
    53                                              HFILE hFile, 
     53                                             HFILE hFile,
    5454                                             SECURITY_ATTRIBUTES *sa, /* [in] Optional security attributes*/
    5555                                             DWORD protect,   /* [in] Protection for mapping object */
    5656                                             DWORD size_high, /* [in] High-order 32 bits of object size */
    5757                                             DWORD size_low,  /* [in] Low-order 32 bits of object size */
    58                                              LPCSTR name)     /* [in] Name of file-mapping object */ 
     58                                             LPCSTR name)     /* [in] Name of file-mapping object */
    5959{
    6060 Win32MemMap *map;
     
    6464     (protect & (PAGE_READONLY|PAGE_READWRITE|PAGE_WRITECOPY)) == 0 ||
    6565//     (hFile == -1 && (protect & SEC_COMMIT)) ||
    66      ((protect & SEC_COMMIT) && (protect & SEC_RESERVE))) 
     66     ((protect & SEC_COMMIT) && (protect & SEC_RESERVE)))
    6767  {
    6868
     
    109109                dprintf(("CreateFileMappingA: can't create Win32MemMap object!"));
    110110                return ERROR_OUTOFMEMORY;
    111         } 
    112 
    113         if(map->Init() == FALSE) {
     111        }
     112
     113        if(map->Init(size_low) == FALSE) {
    114114                dprintf(("CreateFileMappingA: init failed!"));
    115115                delete map;
     
    177177           dwFileOffsetHigh,
    178178           dwFileOffsetLow,
    179            dwNumberOfBytesToMap, 
     179           dwNumberOfBytesToMap,
    180180           lpBaseAddress));
    181181
    182   if(lpBaseAddress != NULL) 
     182  if(lpBaseAddress != NULL)
    183183  {
    184184#if 0
  • trunk/src/kernel32/mmap.cpp

    r8203 r8456  
    1 /* $Id: mmap.cpp,v 1.55 2002-04-07 15:44:11 sandervl Exp $ */
     1/* $Id: mmap.cpp,v 1.56 2002-05-20 13:47:59 sandervl Exp $ */
    22
    33/*
     
    105105//******************************************************************************
    106106//******************************************************************************
    107 BOOL Win32MemMap::Init()
     107BOOL Win32MemMap::Init(DWORD aMSize)
    108108{
    109109    mapMutex.enter();
     
    134134            goto fail;
    135135        }
     136        if (mSize < aMSize)
     137        {
     138            dprintf(("Win32MemMap::init: file size %d, memory map size %d", mSize, aMSize));
     139            //Froloff: Need to check if exist the possibility of file to memory
     140            //         mapping not from the beginning of file
     141            mSize = SetFilePointer(hMemFile, aMSize, NULL, FILE_BEGIN);
     142            // Commit filesize changes onto disk
     143            SetEndOfFile(hMemFile);
     144        }
     145#if 0
    136146        //SvL: Temporary limitation of size (Warp Server Advanced doesn't allow
    137147        //     one to reserve more than 450 MB (unless you override the virtual
     
    140150            mSize = 64*1024*1024;
    141151        }
     152#endif
    142153    }
    143154
     
    611622    //Named file mappings from other processes are always shared;
    612623    //map into our address space
    613     if(map->getMemName() != NULL && map->getProcessId() != mProcessId) 
     624    if(map->getMemName() != NULL && map->getProcessId() != mProcessId)
    614625    {
    615626        //shared memory map, so map it into our address space
     
    756767    }
    757768    while(view);
    758  
     769
    759770    //failure if we get here
    760771    view = NULL;
  • trunk/src/kernel32/mmap.h

    r8203 r8456  
    1 /* $Id: mmap.h,v 1.21 2002-04-07 15:44:11 sandervl Exp $ */
     1/* $Id: mmap.h,v 1.22 2002-05-20 13:47:59 sandervl Exp $ */
    22
    33/*
     
    4545  ~Win32MemMap();
    4646
    47    BOOL   Init();
     47   BOOL   Init(DWORD aMSize=0);
    4848   BOOL   flushView(ULONG offset, ULONG cbFlush);
    4949   LPVOID mapViewOfFile(ULONG size, ULONG offset, ULONG fdwAccess);
Note: See TracChangeset for help on using the changeset viewer.