DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 7 of 7

Thread: MapViewOfFile fails

  1. #1
    Philip Guest

    MapViewOfFile fails


    I am using a memory map object to access files that require processing by
    my application.It seems to fail for a files above 400MB.Anyone know a way
    to fix/workaround this ? Any suggestions will be appreciated.
    My code is below and the MapViewOfFile returns 0 (meaning it failed)
    Thanks in Advance



    If Len(FileName) Then
    hFile = CreateFile(FileName, CreateFlags, ShareFlags, ByVal 0&, Disposition,
    FILE_FLAG_RANDOM_ACCESS, 0&)
    End If
    If hFile <> INVALID_HANDLE_VALUE Then

    ' create file mapping, requesting existing size as maximum...
    m_hFile = CreateFileMapping(hFile, ByVal 0&, PAGE_READWRITE, 0&, Size,
    vbNullString)
    If m_hFile Then

    ' map the entire file into this process's address space...
    m_BaseAddr = MapViewOfFile(m_hFile, FILE_MAP_ALL_ACCESS, 0&, 0&,
    0&)

    ' if we have an address, we're off to the races!
    If m_BaseAddr <> 0 Then
    m_FileName = FileName
    m_FileSize = GetFileSize(hFile, ByVal 0&)
    OpenAndMap = True
    End If
    End If

    ' we don't need original file handle anymore...
    Call CloseHandle(hFile)
    End If

  2. #2
    Philip Guest

    Re: MapViewOfFile fails



    Mattias,
    Err.LastDllError returns 8

    Philip


    Mattias Sjögren <mattias.dont.want.spam@mvps.org> wrote:
    >Philip,
    >
    >>My code is below and the MapViewOfFile returns 0 (meaning it failed)

    >
    >What does Err.LastDllError return?
    >
    >
    >Mattias
    >
    >===
    >Mattias Sjögren (VB MVP)
    >mattias @ mvps.org
    >http://www.msjogren.net/dotnet/



  3. #3
    Philip Guest

    Re: MapViewOfFile fails



    Mattias,
    Err.LastDllError returns 8

    Philip


    Mattias Sjögren <mattias.dont.want.spam@mvps.org> wrote:
    >Philip,
    >
    >>My code is below and the MapViewOfFile returns 0 (meaning it failed)

    >
    >What does Err.LastDllError return?
    >
    >
    >Mattias
    >
    >===
    >Mattias Sjögren (VB MVP)
    >mattias @ mvps.org
    >http://www.msjogren.net/dotnet/



  4. #4
    Mattias Sjögren Guest

    Re: MapViewOfFile fails

    Philip,

    >My code is below and the MapViewOfFile returns 0 (meaning it failed)


    What does Err.LastDllError return?


    Mattias

    ===
    Mattias Sjögren (VB MVP)
    mattias @ mvps.org
    http://www.msjogren.net/dotnet/

  5. #5
    Mattias Sjögren Guest

    Re: MapViewOfFile fails

    Philip,

    >My code is below and the MapViewOfFile returns 0 (meaning it failed)


    What does Err.LastDllError return?


    Mattias

    ===
    Mattias Sjögren (VB MVP)
    mattias @ mvps.org
    http://www.msjogren.net/dotnet/

  6. #6
    Peter Young Guest

    Re: MapViewOfFile fails

    The description for error #8 is: Not enough storage is available to process
    this command.

    "Philip" <philip_jacob@countrywide.com> wrote in message
    news:3c473794$1@147.208.176.211...
    >
    >
    > Mattias,
    > Err.LastDllError returns 8
    >
    > Philip
    >
    >
    > Mattias Sjögren <mattias.dont.want.spam@mvps.org> wrote:
    > >Philip,
    > >
    > >>My code is below and the MapViewOfFile returns 0 (meaning it failed)

    > >
    > >What does Err.LastDllError return?
    > >
    > >
    > >Mattias
    > >
    > >===
    > >Mattias Sjögren (VB MVP)
    > >mattias @ mvps.org
    > >http://www.msjogren.net/dotnet/

    >




  7. #7
    Peter Young Guest

    Re: MapViewOfFile fails

    The description for error #8 is: Not enough storage is available to process
    this command.

    "Philip" <philip_jacob@countrywide.com> wrote in message
    news:3c473794$1@147.208.176.211...
    >
    >
    > Mattias,
    > Err.LastDllError returns 8
    >
    > Philip
    >
    >
    > Mattias Sjögren <mattias.dont.want.spam@mvps.org> wrote:
    > >Philip,
    > >
    > >>My code is below and the MapViewOfFile returns 0 (meaning it failed)

    > >
    > >What does Err.LastDllError return?
    > >
    > >
    > >Mattias
    > >
    > >===
    > >Mattias Sjögren (VB MVP)
    > >mattias @ mvps.org
    > >http://www.msjogren.net/dotnet/

    >




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center