The MASM Forum Archive 2004 to 2012

General Forums => The Workshop => Topic started by: Ghirai on April 02, 2006, 01:51:36 PM

Title: MapViewOfFile fails on large file
Post by: Ghirai on April 02, 2006, 01:51:36 PM
Hello,

This code:
invoke MapViewOfFile,eax,FILE_MAP_READ,0,0,0

fails on a ~10GiB file.

Any indea how to make it work?

Thanks.
Title: Re: MapViewOfFile fails on large file
Post by: asmfan on April 02, 2006, 02:41:46 PM
let win32.hlp be with you:)
just make a view of not entire file but definite size chunk...
Title: Re: MapViewOfFile fails on large file
Post by: Ghirai on April 02, 2006, 05:19:38 PM
Yeah, i know ,i was hoping there's another way.

Thanks.

Title: Re: MapViewOfFile fails on large file
Post by: asmfan on April 02, 2006, 06:49:14 PM
MMF is a great mechanism. but it has its advantages while file stays in RAM. if this chunk size is more than available free mem all advantages disparear - file goes to swapfile. i'd suggest you to check free memory status and then choose the MMF chunk size.(e.g 2/3 of free RAM)
Title: Re: MapViewOfFile fails on large file
Post by: Evenbit on April 02, 2006, 08:28:45 PM
Quote from: Ghirai on April 02, 2006, 01:51:36 PM
Hello,

This code:
invoke MapViewOfFile,eax,FILE_MAP_READ,0,0,0

fails on a ~10GiB file.

Any indea how to make it work?

Thanks.


Take a look at the example that I posted here:

http://www.masmforum.com/simple/index.php?topic=3486.0;topicseen

It is written in HLA but should be clear enough for you to translate for other assemblers.

Nathan.