Question

I have searched for an answer to this, but unfortunately I have had little luck in finding any information on it!

In essence: What is the set of valid names for a memory mapped file in windows?

  • How long can they be?
  • What are legal characters, e.g. are forward slashes, hyphens, punctuation, etc. legal?
  • Are there limitations on character ordering, e.g. an mmf name cannot start with an underscore?

EDIT: I realize that the answer to this question might be "They are exactly the same as normal file naming conventions in Windows." However it is important that this be clarified.

Was it helpful?

Solution

MemoryMappedFile.CreateNew corresponds to CreateFileMapping. The documentation for CreateFileMapping says

The name can have a "Global\" or "Local\" prefix to explicitly create the object in the global or session namespace. The remainder of the name can contain any character except the backslash character (\). Creating a file mapping object in the global namespace from a session other than session zero requires the SeCreateGlobalPrivilege privilege. For more information, see Kernel Object Namespaces.

In other words, you can use any string you like as long as it doesn't contain a backslash.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top