[Box Backup-dev] CreateNamedPipeW()'s return value on error (Win32)

Pascal Lalonde boxbackup-dev@fluffy.co.uk
Thu, 25 May 2006 15:51:23 -0400


Are you sure that CreateNamedPipeW() returns NULL on error?

I had this:
ConnectNamedPipe failed: 6
CloseHandle failed: 6

According to
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/debug/base/system_error_codes__0-499_.asp,
error 6 would be ERROR_INVALID_HANDLE. I'd expect to get a error from 
CreateNamedPipeW(), but I get none.

In lib/win32/WinNamedPipeStream.cpp at line 128, mSocketHandle is 
compared against NULL for errors.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ipc/base/createnamedpipe.asp 
states that CreateNamedPipe() returns INVALID_HANDLE_VALUE on error, not 
NULL, which would explain this behavior.

I don't know if this is true for every flavor of Windows though. I 
experienced this on Windows XP Pro SP2. Using r568.

Pascal