delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin-developers/1998/11/06/03:31:23

From: corinna DOT vinschen AT cityweb DOT de (Corinna Vinschen)
Subject: Re: [rdparker AT butlermfg DOT org: RE: B20 patch: UNC device path handl
ing]
6 Nov 1998 03:31:23 -0800 :
Message-ID: <3642B78B.60E37166.cygnus.cygwin32.developers@cityweb.de>
References: <199811051641 DOT RAA05674 AT mail1 DOT cityweb DOT de>
Mime-Version: 1.0
To: "Parker, Ron" <rdparker AT butlermfg DOT org>, cygwin32-developers AT cygnus DOT com,
Christopher Faylor <cgf AT cygnus DOT com>

Parker, Ron wrote:
> [...]
> On NT, \\.\ and \\?\ are equivalent.  They may be used to access devices

Help of VC says, \\?\ is special syntax for wide character usage.

> [...]
> Also X:\file is translated to \\.\X:\file as Corinna mentioned.  When
> this is looked up by the OM it is found that \\.\X: is a symbolic link
> to \Device\LanmanRedirector\X:\server\share or something similar.  The
> path is then modified to X:\server\share\file and is passed on to the
> specified redirector where it is finally resolved.

This sounds not bad, but then I don't understand the different handling of
X: and \\.\X:
Your description would lead in a identical behaviour of this two paths.
But you can't do `CreateFile("X:",...)' while a `CreateFile("\\\\.\\X:",...)'
opens X: as a raw device.

Nevertheless, I think, the following patch would do it correct, anyway.
It handles mount entries of mailslots and pipes like other devices and only
paths, beginning with \\.\UNC\ as path prefixes.

Regards,
Corinna

ChangeLog:
----------
Fri Nov  6  9:27:00 1998  Corinna Vinschen <corinna DOT vinschen AT cityweb DOT de>

        Patch suggested by Ron Parker <rdparker AT butlermfg DOT org>
        * path.cc (mount_info::conv_to_win32_path): Changed the
        recognition of UNC devices, to support also paths of type
        `\\.\UNC\'.

Mon Nov  3 0:50:00  Corinna Vinschen <corinna DOT vinschen AT cityweb DOT de>

        * path.cc (mount_info::conv_to_win32_path): Changed the
        recognition of UNC devices, to support devices, which
        are not partitions, too. 

------ snip -------
--- path.cc.orig        Mon Nov 02 23:29:45 1998
+++ path.cc     Fri Nov 06 09:24:38 1998
@@ -698,8 +698,8 @@ mount_info::conv_to_win32_path (const ch
          memcpy (p, mount[i].device, j);
          /* Do not add trailing \ to UNC device names like \\.\a: */
          if (pathbuf[mount[i].pathlen] != '/' &&
-               !(strncmp (mount[i].device, "\\\\.\\", 4) == 0 &&
-               mount[i].device[mount[i].devicelen-1] == ':'))
+             !(strncmp (mount[i].device, "\\\\.\\", 4) == 0 &&
+               strncmp (mount[i].device + 4, "UNC\\", 4) != 0))
            p[j++] = '\\';
          strcpy (p + j, pathbuf + mount[i].pathlen);
          backslashify (p, p, trailing_slash_p);


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019