FIX: Opening Named Pipes on Win32s
PSS ID Number: Q108403
Article last modified on 07-27-1994

1.10

WINDOWS


----------------------------------------------------------------------
The information in this article applies to:

 - Microsoft Win32s version 1.1
----------------------------------------------------------------------

SYMPTOMS
========

Win32s 1.1 includes support for client-side named pipes, provided that the
underlying network supports them as well. The pipe must be created by an
application running on network software that supports server-side named
pipes, such as Windows NT.

On Windows NT, the following code will create a pipe named TestPipe:

   HANDLE hPipe;

   hPipe = CreateNamedPipe( "\\\\.\\pipe\\TestPipe",
      PIPE_ACCESS_OUTBOUND,
      PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_WAIT,
      1,
      BUFSIZE,
      BUFSIZE,
      NMPWAIT_WAIT_FOREVER,
      NULL
   );

However, this code results in an error on Win32s.

RESOLUTION
==========

On the client side, for example a Windows for Workgroups machine, the
following code can be used by a Win32 application to open the pipe
TestPipe:

   HANDLE hPipe;

   hPipe = CreateFile( "//<server>/pipe/TestPipe",
      GENERIC_READ,
      FILE_SHARE_READ,
      NULL,
      OPEN_EXISTING,
      0,
      NULL
   );

Note the use of forward slashes instead of backslashes in the pipe name. On
Windows NT, the first argument to CreateFile() could be
"\\\\<server>\\pipe\\TestPipe". However, this does not work on Win32s 1.1
running on top of Windows for Workgroups. The call above will work on
machines running Win32s and also on machines running Windows NT.

STATUS
======

Microsoft has confirmed this to be a problem in Win32s, version 1.1. This
problem was corrected in Win32s, version 1.15.

MORE INFORMATION
================

The following code can be used to open the same named pipe from a Win16
application running on Windows for Workgroups:

   HANDLE hPipe;
   OFSTRUCT Info;

   hPipe = OpenFile( "\\\\<server>\\pipe\\TestPipe",
      &Info,
      OF_READ | OF_SHARE_DENY_NONE
   );

Additional reference words: 1.10
KBCategory: Prg
KBSubcategory: W32s

=============================================================================

Copyright Microsoft Corporation 1994.
