CreateProcess and Memory mapped files
hi everyone
I'm taking a course in operating systems, and I have an assignment that uses multiple processes, and memmory mapped files.
I have been able to create a memory mapped file (only took about 60 hours looking at the documentation), but I am unable to use create process. Currently I am trying to get the original process to run a hello world program as its child. whenever I run the program it just skips that section. I would really appreciate someone explaining in english:) how to use the createProcess comand(ie what all the fields mean). or better yet if someone has a SIMPLE program that uses Create Process that would be great thanks
kevcri
i really think I'm close now
I did what you said, and I'm not getting the error I was getting. the only problem is that the memory mapped file in the child process does not contain the same data as in the parent process.
please check the declarations and make sure I'm using the right parameters
parent process
Code:
A1=CreateFileMapping(
INVALID_HANDLE_VALUE,
NULL,
PAGE_READWRITE,
0,
0x01400000,
"MAPPEDA1");
TEST=MapViewOfFile(A1, // handle to mapping object
FILE_MAP_ALL_ACCESS, // read/write permission
0, // max. object size
0, // size of hFile
0);
*((LPWORD)TEST)=50;
printf ("%d",*((LPWORD)TEST));
child process
Code:
A1=CreateFileMapping(
INVALID_HANDLE_VALUE,
NULL,
PAGE_READWRITE,
0,
0x01400000,
"MAPPEDA1");
TEST=MapViewOfFile(A1, // handle to mapping object
FILE_MAP_ALL_ACCESS, // read/write permission
0, // max. object size
0, // size of hFile
0);
printf ("%d",*((LPWORD)TEST));
these both should print out 50 but I get 50 and 0
thanks for all your help so far