Fun stuff with \?
This comes up in an internal discussion about MAX_PATH limit. People do mention that the core file services supports syntax like [\\?\](file://\\?\) for path longer than MAX_PATH. The caveat is that file name with [\\?\](file://\\?\) is not canonicalized by the OS. This can lead to many funny behavior. One of our senior developer writes the following example to illustrate this problem.
C:\temp>md "\\?\c:\temp\bar."
C:\Temp>dir *bar*
Volume in drive C has no label.
Volume Serial Number is B0F1-CCDC
Directory of C:\Temp
02/18/2004 04:06 AM <DIR> bar.
0 File(s) 0 bytes
1 Dir(s) 6,810,882,048 bytes free
C:\Temp>rd bar.
The system cannot find the file specified.
c:\Temp\md bar
C:\Temp>dir *bar*
Volume in drive C has no label.
Volume Serial Number is B0F1-CCDC
Directory of C:\Temp
02/18/2004 04:08 AM <DIR> bar
02/18/2004 04:06 AM <DIR> bar.
0 File(s) 0 bytes
2 Dir(s) 6,810,882,048 bytes free
C:\Temp>echo foo > bar.\12346.txt
C:\Temp>dir/s/b 12346.txt
C:\Temp\bar\12346.txt
C:\Temp\bar.\12346.txt
C:\Temp>del /s 12346.txt
Deleted file - C:\Temp\bar\12346.txt
C:\Temp>echo foo > "\\?\c:\Temp\bar.\12347.txt"
C:\Temp>dir/s/b 12347.txt
File Not Found
C:\Temp>type "\\?\c:\Temp\bar.\12347.txt"
foo