hi all

Problembs, is all about life, programming is solving problembs.....

I started a thread about global memory allocation and was advised to use CreateFileMapping for an 8mb buffer.

I initicially used CoTaskMemAlloc sucessfully completed my generation routine.

Unfortunatly after trying to use CreateFileMapping, i started to encounter acess violation errors ect,ect.

now i need to create a MappedFileView (something like that).

Is some1 able to tell me how write to the mapped file view in assembly. {my generation routine is based upon the starting address value of the allocated memmory}

Thank you all kindly
Black iCE
Posted on 2004-04-20 11:11:31 by Black iCE
Only use FileMapping if you need to share memory, otherwise it's a waste of time (both setup and access).

Anyway, it's easy enough. You get a handle back from CreateFileMapping... Then you do:

invoke MapViewOfFile, eax, FILE_MAP_WRITE, 0, 0, 0

Presto, the return value is a memory pointer that can be used to access the entire blob of memory.

Then you could do, say:

mov byte ptr [eax+100000h], 0

...or whatever.
Posted on 2004-04-20 11:18:50 by f0dder
then why doesn't MSDN make it so SIMPLE - all this "ifs" "checks" "buts" and i go from one article to the next and i forget why i initciallty started. Thank my stars that i found this board long long ago and have ppl like f0dder to help me and others out. I know that later i will be able to contribute more to other aswel.

Black iCE
Posted on 2004-04-20 11:28:44 by Black iCE
You will able to find in the following link and in the folder....a tutorial and some example which show how to use API about Mapping...


I hope this mini-tutorial could be help you...for your future...


"An expert is a man who has made all the mistakes which can be made in a very narrow field." Niels Bohr (1885-1962)

Here are a lot of good programs made in MASM....
Posted on 2004-04-20 11:37:53 by gerard
Shot!!! Thank you gerard, i bet i'll need it for later...

Was gonna do threading withing my app.
Posted on 2004-04-20 11:40:54 by Black iCE
GOT IT FINALLY WORKING - GENERATION correct, holds global reference during run and release after termination.

Thank you. :D
Posted on 2004-04-20 13:14:35 by Black iCE