Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Message-ID: <418160B4.2050404@breame.com>
Date: Thu, 28 Oct 2004 22:12:20 +0100
From: Colin JN Breame <colin@breame.com>
User-Agent: Mozilla Thunderbird 0.8 (Windows/20040913)
MIME-Version: 1.0
To: Shankar Unni <shankarunni@netscape.net>
Cc: cygwin@cygwin.com
Subject: Re: Filename limits
References: <418019CC.6070900@breame.com> <clrdh7$lq1$1@sea.gmane.org>
In-Reply-To: <clrdh7$lq1$1@sea.gmane.org>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-IsSubscribed: yes

Shankar Unni wrote:

>
> The Unicode versions of several functions permit a maximum path length 
> of 32,767 characters, composed of components up to 255 characters in 
> length. To specify such a path, use the "\\?\" prefix. For example, 
> "\\?\D:\<path>". To specify such a UNC path, use the "\\?\UNC\" 
> prefix. For example, "\\?\UNC\<server>\<share>". Note that these 
> prefixes are not used as part of the path itself. They indicate that 
> the path should be passed to the system with minimal modification. An 
> implication of this is that you cannot use forward slashes to 
> represent path separators or a period to represent the current directory.


If I have understood the documentation correctly, using the Unicode 
version of file functions (e.g. CreateFileW) and prepending \\?\ allows 
32k character path limit.

It would be possible to change all instances of CreateFile, MoveFile, 
DeleteFile, etc. to CreateFileW, MoveFileW, etc. and create a function 
that converted the win32 path into a unicode version (possibly something 
like path_conv.get_nt_native_path()).

The one drawback I can see is with compatibility:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/base/createfile.asp 
wrote:

> *Windows Me/98/95:  **CreateFileW* is supported by the Microsoft Layer 
> for Unicode. To use this, you must add certain files to your 
> application, as outlined in Microsoft Layer for Unicode on 
> Windows 95/98/Me Systems 
> <http://msdn.microsoft.com/library/en-us/mslu/winprog/microsoft_layer_for_unicode_on_windows_95_98_me_systems.asp>.

The best solution would to select either CreateFileA or CreateFileW at 
runtime, depending upon the system it is being run on.  However, what 
would happen if CreateFileW was linked (but not called) on a non-Unicode 
enabled win 95/98/Me system?

I noticed in fhandler.cc there is a reference to NtCreateFile, which 
according to msdn, is XP and 2000 only.  What happens on a win95 machine?

This would be a /real benefit/ if cygwin supported longer path names.

-- Colin



--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

