Child-Prozess Mapping-Objekt öffnen

F

Futzel

Hallo.

im Eltern Prozess erzeuge ich eine Mapping-Objekt.

C++:
......
HANDLE hFile = NULL;
	LPVOID ptr; // = Typ des Returnwertes von MapViewOfFile()  

	//Mapping File Objekt erzeugen
	hFile =	CreateFileMapping((HANDLE)-1,  // keine eigene Datei, sondern PageFile.sys 
							  NULL,  // keine Sicherheitsattribute 
							  PAGE_READWRITE,  // schreiben und lesen 
							  0,4096,  // Größe (High+Low) 
							 "TEST");  // Name 

	if (hFile == INVALID_HANDLE_VALUE || hFile == NULL)
	{
		ShowError("FileMap-Objekt kann nicht erzeugt werden: ");
	}

	 // View des Objektes erzeugen 
	ptr = MapViewOfFile(hFile,  // File-Map Objekt 
						FILE_MAP_WRITE, // schreiben und lesen 
						0,0,    // Offset (High+Low) 
						4096);    // Größe 

	cout.setf(ios::hex); 
	cout << ptr << endl; 
.....

//Erzeugung Child Prozesse
if( !CreateProcess("C:\\Childprozess.exe",   // No module name (use command line)       
		NULL,        // Command line
        NULL,           // Process handle not inheritable
        NULL,           // Thread handle not inheritable
        FALSE,          // Set handle inheritance to FALSE
        CREATE_NEW_CONSOLE,              //creation flags
        NULL,           // Use parent's environment block
        NULL,           // Use parent's starting directory 
        &si_2,            // Pointer to STARTUPINFO structure
        &pi_2 )           // Pointer to PROCESS_INFORMATION structure
    ) 
    {
		ShowError("CreateProcess_2 failed: ");
        exit(-1);
    }

Wass muss ich nun im Child Prozess schreiben um auf dieses Objekt zuzugreifen und um dort z.B 2 Zeichen hineinzuschreiben?

Gruß

Futzel
 
Zuletzt bearbeitet von einem Moderator:
Zurück