Shared memory and permissions

Would it be possible for a creation of shared memory to fail because the process has insufficient permissions?

Also, is it possible to create a shared memory that's only process-local? In case you're wondering what the point of a process-local shared memory would be, I need to share information between two pieces of code that have no way of interacting with each other, other than by agreeing at compile time on a particular string.
Would it be possible for a creation of shared memory to fail because the process has insufficient permissions?
Yes! At least if you use the method I link below.

Also, is it possible to create a shared memory that's only process-local.
I think you need to create a private object namespace
https://docs.microsoft.com/en-us/windows/win32/sync/object-namespaces
And then create a named file mapping object in that namespace
https://docs.microsoft.com/en-us/windows/win32/memory/creating-named-shared-memory
https://docs.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-createfilemappinga
Last edited on
Thanks. It seems like it would add more complexity than I'd like, though. A shared memory under Local\ will do. I'm primarily concerned with reliability. I don't want to introduce possible weird failure modes.
Registered users can post here. Sign in or register to post.