Why does PathIsUNC say that paths that begin with \\?\ are not UNCs?

Raymond Chen

An application vendor opened a bug with the product team saying that the Path­Is­UNC function was returning incorrect values in Windows Vista. Specifically, the Path­Is­UNC function was returning FALSE for strings that begin with \\?\, whereas Windows XP returned TRUE.

The answer is, “Yes, the Path­Is­UNC function returns FALSE for strings that begin with \\?\. Because they aren’t UNCs.”

There was a bug in the Windows XP version of the Path­Is­UNC function where it reported that anything that began with two backslashes was a UNC, even if it wasn’t. In particular, paths that begin with \\?\ are not UNCs, unless they happen to begin with \\?\UNC\. The bug was fixed in Windows Vista so it returned TRUE only if the \\?\ is followed by UNC\.

Fortunately, the application compatibility team had a ready answer for this: The Emulate­Old­Path­Is­UNC compatibility shim returns the Path­Is­UNC function to its old behavior that is bug-for-bug compatible with Windows XP.

0 comments

Discussion is closed.

Feedback usabilla icon