Can you tell me how to write into the file using memory mapped file ??

:-----THIS is not working

mov hFile,eax
invoke CreateFileMapping,hFile,NULL,PAGE_READWRITE,FileSize,0,0
mov hFileMap,eax
invoke MapViewOfFile,hFileMap,FILE_MAP_READ or FILE_MAP_WRITE,0,0,0
mov pMemory,eax

it's terminating app when i try to write into pMemory
Posted on 2003-06-25 13:06:18 by AceEmbler
set the flag FILE_MAP_WRITE
Posted on 2003-06-25 13:16:30 by roticv
? i set it already. i think the problem lies somewhere in allocating file size.

but i dont get it. this maximumsize low and high can sb explain this to me ??
Posted on 2003-06-25 13:20:52 by AceEmbler
Did you read tut13?


invoke CreateFileMapping,hFile,NULL,PAGE_READWRITE,0,FileSize,0

File size is a 8 bytes long number.
If you have 12345678h then
1234h is the high part
5678h is the low part

So FileSize is the low dword
Posted on 2003-06-25 14:00:48 by greenant
Er, no. If you have 12345678h then 0 is the high part, and 12345678h is the low part.
Posted on 2003-06-25 14:04:25 by Sephiroth3
yep here was the problem thx.
Posted on 2003-06-25 14:12:06 by AceEmbler
Yes. I was thinking about dword and not quadword

If you have 0123456789ABCDEF
01234567 is the high part
89ABCDEF is the low part
Posted on 2003-06-26 02:06:03 by greenant