1

Since the \\?\ prefix can only be used with absolute paths, I need to find out a way to extend relative paths to absolute paths. For paths shorter than 260 characters, this isn't a problem because there is the GetFullPathName() Windows API which does exactly what I want.

However, for relative paths longer than 260 characters, I cannot use GetFullPathName() because it is limited to MAX_PATH as well. (Of course, this limit can be overridden by using the \\?\ prefix with GetFullPathName() but since this prefix is only allowed for absolute paths, I can't use it to make GetFullPathName() convert a long relative path to a long absolute path.)

So the only thing that comes to my mind is to call GetCurrentDirectory() and then manually compose the long relative path to a long absolute path. Of course, this also means that I'd have to manually handle stuff like .. and . which looks like quite a hassle. That's why I'd like to ask if there is an easier way to convert a long relative path to a long absolute path without doing everything manually.

Andreas
  • 9,245
  • 9
  • 49
  • 97
  • Yes, looks like my question is a duplicate. I've now tested `GetFullPathName()` with a relative path longer than 260 characters and without the \\?\ and it is indeed extended correctly so it looks like the MSDN docs on `GetFullPathName()` are wrong and it can be used with long relative paths just fine. – Andreas May 29 '19 at 16:44

0 Answers0