[Issue 8967] dirEntries throws when encountering a "long path" on windows

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Mar 17 21:42:00 PDT 2014


https://d.puremagic.com/issues/show_bug.cgi?id=8967


Jay Norwood <jayn at prismnet.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jayn at prismnet.com


--- Comment #7 from Jay Norwood <jayn at prismnet.com> 2014-03-17 21:41:57 PDT ---
As has been stated in prior comments, it appears the intended solution is to
prepend "\\?\" to the path string.

It appears from the documentation that prepending should be done if path is >
MAX_PATH-12 for directory names or MAX_PATH-1 for file paths.  Maybe to
simplify this, just use MAX_PATH-12.

In addition, it appears from the documentation that two cases you would not
want to prepend are if the path already begins with "\\?\" or "\\.".

The code appears pretty consistently to use toUTF16z(name) in places where path
strings are being converted to Windows paths for calling the unicode versions
of the functions.  I looked through the 26 references to toUTF16z, and the only
one I couldn't confirm was a call to _wfopen.  So, I think perhaps these
toUTF16z calls could be changed to call a modified version that checks the path
length and optionally prepends.

we are using toUTF16z in the libraries when calling CreateFileW,
SetCurrentDirectoryW, CopyFileW, FindFirstFileW, CreateDirectoryW,
GetFileAttributesW, DeleteFileW, MoveFileExW,
RemoveDirectoryW,SetFileAttributesW, GetEnvironmentVariableW,
SetEnvironmentVariableW,

Searching for LPCWSTR brings up a number of windows api defs that are unused in
the libraries, but that would be candidates for use of toUTF16z.

tempDir() uses MAX_PATH, where the larger 32K limit should be used for the
buffer.

same for thisExePath(), and probably its call to GetModuleFileNameW should use
the toUTF16z

WIN32_FIND_DATAW should probably have the 32K buffer to be consistent, but
perhaps the operations that use it don't support the longer paths.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list