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

Chris Wilson boxbackup-dev at fluffy.co.uk
Thu May 25 21:16:59 BST 2006


Hi Pascal,

> 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.

You are absolutely right. I guess I had assumed that INVALID_HANDLE_VALUE 
was the same as NULL. I've just checked in a fix to my tree.

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

How did this happen? Were you running more than one copy of bbackupd.exe?

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

Better safe than sorry. INVALID_HANDLE_VALUE it is, and shall be forever 
more.

Cheers, Chris.
-- 
_ ___ __     _
  / __/ / ,__(_)_  | Chris Wilson <0000 at qwirx.com> - Cambs UK |
/ (_/ ,\/ _/ /_ \ | Security/C/C++/Java/Perl/SQL/HTML Developer |
\ _/_/_/_//_/___/ | We are GNU-free your mind-and your software |



More information about the Boxbackup-dev mailing list