79617793

Date: 2025-05-12 12:05:05
Score: 3
Natty:
Report link

Might not be relevant to your use-case but I had a similar thing, legacy C code with shared memory access.

Two programs, one the existing, one my shiny new C# one. When running in a desktop session everything works fine. When both running as services, also works fine.

What doesn't work is one running as a service and one as a desktop session. I get the exact same error message - "File Not Found".

The answer is that by default windows uses session 0 for all global objects and services. Subsequent users get a new session number, as does Terminal Server sessions and as far as I can tell switching from a 64-bit process to a 32-bit.

If you want to connect to it just prefix the shared memory name with "Global\". The same has to be prefixed to Mutexes that your probably using.

Kernel Object Namespaces describes the process better.

Reasons:
  • Long answer (-0.5):
  • No code block (0.5):
  • Me too answer (2.5): I get the exact same error
  • Low reputation (0.5):
Posted by: AndyB