[fpc-pascal] DoDirSeparators and special filenames on Windows

Sven Barth pascaldragon at googlemail.com
Sun Sep 8 19:56:30 CEST 2013


On 08.09.2013 10:44, Jürgen Hestermann wrote:
> Am 2013-09-07 21:46, schrieb Bart:
>  > On 9/7/13, Jürgen Hestermann <juergen.hestermann at gmx.de> wrote:
>  >> Of course! Why the hell should there be double pathdelims? And why
>  >> (silently) accept them as if they were one?
>  > There should not be, but (history: DOS and) WinApi accept them, so the
>  > are NOT illegal in normal filenames.
>
> In my many decades of MS experience I never have seen double path
> delimiters anywhere. How do you generate them? I would not know how to
> do it. And I doubt that all WinAPI function except such (and silently
> drop one delimiter in the background).

You generate them by letting the user input a path and passing it to a 
function as a normal Win32 style path "X:\..." instead of a "\\?\X:..." 
path. The Windows function that converts the Win32 style path to a NT 
path will also reduce duplicated path delimiters. So every WinAPI 
function that accepts a Win32 style path (so basically *all* WinAPI 
functions) will also accept duplicate path path delimiters. Windows 
Explorer does not allow them, because it uses the long path names while 
on the other hand e.g. PowerShell and Cmd do indeed allow them.

Regards,
Sven




More information about the fpc-pascal mailing list