views:

43

answers:

0

According to MSDN,

[The pipe name] must have the following form:

\\.\pipe\pipename

The pipename part of the name can include any character other than a backslash, including numbers and special characters. The entire pipe name string can be up to 256 characters long. Pipe names are not case sensitive.

But there are plenty of examples where I've seen named pipe names with backslashes in them. For example, the standard pipe name for SQL Server is \\.\pipe\sql\query.

Running PipeList from SysInternals reveals plenty of pipes on my machine where the name includes a backslash.

So, can a pipe name have a backslash in it or not?

I ask because I was creating a service with several pipes with names like this:

\\.\pipe\MyApp
\\.\pipe\MyApp\0
\\.\pipe\MyApp\1
\\.\pipe\MyApp\2

After the first pipe was created, creating the other pipes would fail with Windows error 123 (ERROR_INVALID_NAME). If I skipped creating the first pipe, all the others, with the backslash character in the name, would work just fine.

It appears that pipes are hierarchical like the file system, and if you have a pipe with a particular name, that name can no longer be used as a "folder" or container for other pipes.

When trying to figure this out, I came across the MSDN article and am now questioning whether I should be using backslashes at all.

Any advice?