delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2004/10/28/17:12:28

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

- Raw text -


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