[RTL/NDK]

- Add missing mmtypes.h include in mmfuncs.h
- Remove RtlDetermineDosPathNameType_Ustr from rtlfuncs.h, move it up in path.c
- Add RtlGetLongestNtPathLength to rtlfuncs.h

svn path=/trunk/; revision=56410
This commit is contained in:
Thomas Faber 2012-04-25 07:24:17 +00:00
parent 94545a76fb
commit 6eef1df19a
3 changed files with 44 additions and 43 deletions

View file

@ -23,6 +23,7 @@ Author:
// Dependencies
//
#include <umtypes.h>
#include <mmtypes.h>
#ifndef NTOS_MODE_USER

View file

@ -2512,13 +2512,6 @@ RtlDetermineDosPathNameType_U(
IN PCWSTR Path
);
NTSYSAPI
RTL_PATH_TYPE
NTAPI
RtlDetermineDosPathNameType_Ustr(
IN PCUNICODE_STRING Path
);
NTSYSAPI
ULONG
NTAPI
@ -2619,6 +2612,13 @@ RtlGetFullPathName_UstrEx(
OUT PSIZE_T LengthNeeded
);
NTSYSAPI
ULONG
NTAPI
RtlGetLongestNtPathLength(
VOID
);
NTSYSAPI
ULONG
NTAPI

View file

@ -50,6 +50,42 @@ PRTLP_CURDIR_REF RtlpCurDirRef;
/* PRIVATE FUNCTIONS **********************************************************/
RTL_PATH_TYPE
NTAPI
RtlDetermineDosPathNameType_Ustr(IN PCUNICODE_STRING PathString)
{
PWCHAR Path;
ULONG Chars;
/* Validate the input */
if (!PathString) return RtlPathTypeUnknown;
Path = PathString->Buffer;
Chars = PathString->Length / sizeof(WCHAR);
/* Return if there are no characters */
if (!Chars) return RtlPathTypeUnknown;
/*
* The algorithm is similar to RtlDetermineDosPathNameType_U but here we
* actually check for the path length before touching the characters
*/
if ((Chars < 1) || (IS_PATH_SEPARATOR(Path[0])))
{
if ((Chars < 2) || !(IS_PATH_SEPARATOR(Path[1]))) return RtlPathTypeRooted; /* \x */
if ((Chars < 3) || ((Path[2] != L'.') && (Path[2] != L'?'))) return RtlPathTypeUncAbsolute;/* \\x */
if ((Chars >= 4) && (IS_PATH_SEPARATOR(Path[3]))) return RtlPathTypeLocalDevice; /* \\.\x or \\?\x */
if (Chars != 3) return RtlPathTypeUncAbsolute; /* \\.x or \\?x */
return RtlPathTypeRootLocalDevice; /* \\. or \\? */
}
else
{
if ((Chars < 2) || (!(Path[0]) || (Path[1] != L':'))) return RtlPathTypeRelative; /* x */
if ((Chars < 3) || (IS_PATH_SEPARATOR(Path[2]))) return RtlPathTypeDriveAbsolute; /* x:\ */
return RtlPathTypeDriveRelative; /* x: */
}
}
ULONG
NTAPI
RtlIsDosDeviceName_Ustr(IN PCUNICODE_STRING PathString)
@ -211,42 +247,6 @@ RtlIsDosDeviceName_Ustr(IN PCUNICODE_STRING PathString)
return 0;
}
RTL_PATH_TYPE
NTAPI
RtlDetermineDosPathNameType_Ustr(IN PCUNICODE_STRING PathString)
{
PWCHAR Path;
ULONG Chars;
/* Validate the input */
if (!PathString) return RtlPathTypeUnknown;
Path = PathString->Buffer;
Chars = PathString->Length / sizeof(WCHAR);
/* Return if there are no characters */
if (!Chars) return RtlPathTypeUnknown;
/*
* The algorithm is similar to RtlDetermineDosPathNameType_U but here we
* actually check for the path length before touching the characters
*/
if ((Chars < 1) || (IS_PATH_SEPARATOR(Path[0])))
{
if ((Chars < 2) || !(IS_PATH_SEPARATOR(Path[1]))) return RtlPathTypeRooted; /* \x */
if ((Chars < 3) || ((Path[2] != L'.') && (Path[2] != L'?'))) return RtlPathTypeUncAbsolute;/* \\x */
if ((Chars >= 4) && (IS_PATH_SEPARATOR(Path[3]))) return RtlPathTypeLocalDevice; /* \\.\x or \\?\x */
if (Chars != 3) return RtlPathTypeUncAbsolute; /* \\.x or \\?x */
return RtlPathTypeRootLocalDevice; /* \\. or \\? */
}
else
{
if ((Chars < 2) || (!(Path[0]) || (Path[1] != L':'))) return RtlPathTypeRelative; /* x */
if ((Chars < 3) || (IS_PATH_SEPARATOR(Path[2]))) return RtlPathTypeDriveAbsolute; /* x:\ */
return RtlPathTypeDriveRelative; /* x: */
}
}
NTSTATUS
NTAPI
RtlpCheckDeviceName(IN PUNICODE_STRING FileName,