I am trying to map file and write it by mapping.
Here is my code

invoke CreateFile, ofn.lpstrFile, GENERIC_READ or GENERIC_WRITE ,NULL, \ ;open file name
jne OpenOK
invoke ShowErr,hWin,addr file_err
jmp ret0

mov hFile, eax
invoke CreateFileMapping, hFile, NULL, PAGE_READWRITE \ ;create filemapping
mov hMapping, eax
invoke CloseHandle,hFile
invoke MapViewOfFile,hMapping,FILE_MAP_WRITE ,0,0,0 ;view and store result
mov pMapping, eax
mov edi, pMapping

mov byte ptr edi,'A' ;this gives error

However if I use FILE_MAP_ALL_ACCESS it works.But in help file it says they are same and in order to read and write FILE_MAP_WRITE is needed.What I am doing wrong ? :stupid:
Posted on 2002-03-24 14:32:47 by LaptoniC
can you OR them together? like FILE_MAP_WRITE or FILE_MAP_ALL_ACCESS.

only I heard somewhere that ALL_ACCESS wont work on all windws versions.

and dont you need ot have FILE_MAP_READ to???

sorry not an expert jsut some ideas to try:stupid:
Posted on 2002-03-24 15:47:04 by dionysus
Hi my Friend,

This example file Zombie's mapfile library v4. Used with FILE_MAP_ALL_ACCESS and nicely work. I try beforehand, may be help you.

have nice days :grin:
Posted on 2002-03-24 19:19:35 by CYDONIA
I guess help file is wrong.I have searched the net and all mappign examples which write to file use FILE_MAP_ALL_ACCESS flag.Thanks for your answers
Posted on 2002-03-25 05:29:51 by LaptoniC