March 24th, 2016

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

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.

Topics
Code

Author

Raymond has been involved in the evolution of Windows for more than 30 years. In 2003, he began a Web site known as The Old New Thing which has grown in popularity far beyond his wildest imagination, a development which still gives him the heebie-jeebies. The Web site spawned a book, coincidentally also titled The Old New Thing (Addison Wesley 2007). He occasionally appears on the Windows Dev Docs Twitter account to tell stories which convey no useful information.

0 comments

Discussion are closed.

Feedback