The way it opens a pipe is the prefix in the filename. It must be \\\\.\\pipe\\pipename
, which isn't a legal filename (for an actual file, you'd usually start with a relative path or a drive letter, colon and slash, except in the rare case of opening using a device ID or some such). Seeing as it can't be opening a file, it then must open a pipe.
To open a persistent pipe, I'm not sure whether you want to use it from multiple apps at once (if so, you can open it from each, but be careful not to block it up) or make it persist between sessions. If the latter, I'm not entirely sure, but I've never heard of a way to keep the pipe open when no program has it open (similar in some ways to keeping a file open, I'd presume). It's possible that as long as you don't CloseHandle
it, it will stay open until the next reboot. Worth testing, at least.
If you need persistent data transfer between applications or sessions, you may want to find a more reliable (and more flexible) method, however. Pipes can easily get blocked up if something unexpected happens (which should always be expected when multiple threads/processes are working together), which can freeze one or both connected applications (often to the point where even killing them in a debugger is difficult).