(...) po wywołaniu CreateFileMapping() przez drugi proces funkcja powinna zwrócić NULL, ponieważ pamięć na nazwę podaną w argv[1] już istnieje
Nie, bo: If this parameter matches the name of an existing mapping object, the function requests access to the object with the protection that flProtect specifies.
Użyj OpenFileMapping i jeśli zwróci NULL, wtedy wywołaj CreateFileMapping.