title: Distinguishing a pipe from a file in windows
body: <p>On Unix, everything is a file, so you can use file i/o functions with pipes, files, sockets, etc.  But on windows, the api you use depends on the type of i/o HANDLE you have.</p>
  
  <p>My question is: given a HANDLE how do you determine what the underlying type is?  For example, I have a HANDLE that's either real file, or a named/anonymous pipe.  I'd like to know whether PeekNamedPipe can be called on this HANDLE.</p>