X-Git-Url: https://git.reactos.org/?p=reactos.git;a=blobdiff_plain;f=reactos%2Flib%2Frtl%2Fpath.c;h=ba53f968fd6597f4b08eb20141f19f5f451b8044;hp=45858153643f9639ddc36046324c8ab0cb442fbd;hb=6eef1df19a071376b4bc425955052e4eb3fb4065;hpb=94545a76fb2716aff68d5702111a84b3c561123c diff --git a/reactos/lib/rtl/path.c b/reactos/lib/rtl/path.c index 45858153643..ba53f968fd6 100644 --- a/reactos/lib/rtl/path.c +++ b/reactos/lib/rtl/path.c @@ -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,