This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: Filename limits
- From: Colin JN Breame <colin at breame dot com>
- To: Shankar Unni <shankarunni at netscape dot net>
- Cc: cygwin at cygwin dot com
- Date: Thu, 28 Oct 2004 22:12:20 +0100
- Subject: Re: Filename limits
- References: <418019CC.6070900@breame.com> <clrdh7$lq1$1@sea.gmane.org>
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/