Author Topic: CreateFileW and the "nearly" 32,000 chars limit  (Read 1884 times)

jj2007

  • Member
  • *****
  • Posts: 13957
  • Assembly is fun ;-)
    • MasmBasic
Re: CreateFileW and the "nearly" 32,000 chars limit
« Reply #15 on: April 26, 2022, 02:25:51 AM »
There are people that use deeply nested folders/subfolders and the lenght of the combined names sometimes exceed MAX_PATH.

Such people should be locked in a psychiatric clinic, or be forced to work in Redmond :badgrin:

Just joking, José. I wonder if there is any risk in using the \\?\ scheme by default :rolleyes:

José Roca

  • Member
  • **
  • Posts: 182
Re: CreateFileW and the "nearly" 32,000 chars limit
« Reply #16 on: April 26, 2022, 02:42:25 AM »
There is at least one limitation: you can't use it with relative paths.

https://docs.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=cmd

José Roca

  • Member
  • **
  • Posts: 182
Re: CreateFileW and the "nearly" 32,000 chars limit
« Reply #17 on: April 26, 2022, 03:12:34 AM »
What I do is to use always the W function and let the onus to the user. If he needs more than MAX_PATH, he must add the \\?\ prefix.

jj2007

  • Member
  • *****
  • Posts: 13957
  • Assembly is fun ;-)
    • MasmBasic
Re: CreateFileW and the "nearly" 32,000 chars limit
« Reply #18 on: April 26, 2022, 05:06:50 AM »
There is at least one limitation: you can't use it with relative paths.

Good point. Same for \Masm32\some.txt paths. So it's quite limited, not worth to change all file I/O macros.