[RTL]: RtlDetermineDosPathNameType_U Path is not optional. Checked build ASSERTs if not present. Also, \\? is valid, not only \\., so this should fix a bunch of incorrect path determinations. Aren't there supposed to be unit tests for these things?!

svn path=/trunk/; revision=52624
This commit is contained in:
Alex Ionescu 2011-07-11 00:47:44 +00:00
parent 2507c181d0
commit 67f44266b0

View file

@ -66,32 +66,29 @@ RtlGetLongestNtPathLength(VOID)
* @implemented
*
*/
ULONG NTAPI
RtlDetermineDosPathNameType_U(PCWSTR Path)
ULONG
NTAPI
RtlDetermineDosPathNameType_U(IN PCWSTR Path)
{
DPRINT("RtlDetermineDosPathNameType_U %S\n", Path);
DPRINT("RtlDetermineDosPathNameType_U %S\n", Path);
ASSERT(Path != NULL);
if (Path == NULL)
{
return RtlPathTypeUnknown;
}
if (IS_PATH_SEPARATOR(Path[0]))
{
if (!IS_PATH_SEPARATOR(Path[1])) return RtlPathTypeRooted; /* \xxx */
if ((Path[2] != L'.') && (Path[2] != L'?')) return RtlPathTypeUncAbsolute;/* \\xxx */
if (IS_PATH_SEPARATOR(Path[3])) return RtlPathTypeLocalDevice; /* \\.\xxx */
if (Path[3]) return RtlPathTypeUncAbsolute; /* \\.xxxx */
if (IS_PATH_SEPARATOR(Path[0]))
{
if (!IS_PATH_SEPARATOR(Path[1])) return RtlPathTypeRooted; /* \xxx */
if (Path[2] != L'.') return RtlPathTypeUncAbsolute; /* \\xxx */
if (IS_PATH_SEPARATOR(Path[3])) return RtlPathTypeLocalDevice; /* \\.\xxx */
if (Path[3]) return RtlPathTypeUncAbsolute; /* \\.xxxx */
return RtlPathTypeRootLocalDevice; /* \\. */
}
else
{
if (!(Path[0]) || (Path[1] != L':')) return RtlPathTypeRelative; /* xxx */
if (IS_PATH_SEPARATOR(Path[2])) return RtlPathTypeDriveAbsolute; /* x:\xxx */
return RtlPathTypeRootLocalDevice; /* \\. */
}
else
{
if (!Path[0] || Path[1] != L':') return RtlPathTypeRelative; /* xxx */
if (IS_PATH_SEPARATOR(Path[2])) return RtlPathTypeDriveAbsolute; /* x:\xxx */
return RtlPathTypeDriveRelative; /* x:xxx */
}
return RtlPathTypeDriveRelative; /* x:xxx */
}
}