In fact, here's the smallest program that reproduces the problem for me:
#include <windows.h>
main() { FlushFileBuffers(CreateNamedPipeA("\\.\PiPe\foo", PIPE_ACCESS_DUPLEX, PIPE_TYPE_BYTE|PIPE_WAIT, 1, 1024, 1024, NMPWAIT_USE_DEFAULT_WAIT, NULL)); }
I believe this will run fine on real Windows, and that both calls will succeed there. I verified that FlushFileBuffers returns nonzero on Win2K even when calling it on a just-created pipe nobody had ever connected to. Thus I think Bill's patch is probably a bit wrong; if fd is NULL, it should just say "OK, I flushed" rather than returning a windows error. - Dan