mirror of
https://github.com/reactos/reactos.git
synced 2025-05-21 10:05:35 +00:00
[RTL]
Implement and export RtlGetLengthWithoutTrailingPathSeperators (aka. RtlGetLengthWithoutTrailingPathSeparators) (needed for win2k3's basesrv.dll). Patch by David Quintana, where I simplified the loop (and reduced the number of local variables). CORE-7482 #comment Function committed in revision 60348, thanks ;) svn path=/trunk/; revision=60348
This commit is contained in:
parent
655b467d9a
commit
8c96a4e9a2
3 changed files with 52 additions and 1 deletions
|
@ -630,7 +630,7 @@
|
||||||
@ stdcall RtlGetLastWin32Error()
|
@ stdcall RtlGetLastWin32Error()
|
||||||
@ stdcall RtlGetLengthWithoutLastFullDosOrNtPathElement(long ptr ptr)
|
@ stdcall RtlGetLengthWithoutLastFullDosOrNtPathElement(long ptr ptr)
|
||||||
; Yes, Microsoft really misspelled this one!
|
; Yes, Microsoft really misspelled this one!
|
||||||
;@ stdcall RtlGetLengthWithoutTrailingPathSeperators
|
@ stdcall RtlGetLengthWithoutTrailingPathSeperators(long ptr ptr) RtlGetLengthWithoutTrailingPathSeparators
|
||||||
@ stdcall RtlGetLongestNtPathLength()
|
@ stdcall RtlGetLongestNtPathLength()
|
||||||
@ stdcall RtlGetNativeSystemInformation(long long long long) NtQuerySystemInformation
|
@ stdcall RtlGetNativeSystemInformation(long long long long) NtQuerySystemInformation
|
||||||
@ stdcall RtlGetNextRange(ptr ptr long)
|
@ stdcall RtlGetNextRange(ptr ptr long)
|
||||||
|
|
|
@ -2725,6 +2725,15 @@ RtlGetFullPathName_UstrEx(
|
||||||
_Out_opt_ PSIZE_T LengthNeeded
|
_Out_opt_ PSIZE_T LengthNeeded
|
||||||
);
|
);
|
||||||
|
|
||||||
|
NTSYSAPI
|
||||||
|
NTSTATUS
|
||||||
|
NTAPI
|
||||||
|
RtlGetLengthWithoutTrailingPathSeparators(
|
||||||
|
_In_ ULONG Flags,
|
||||||
|
_In_ PCUNICODE_STRING PathString,
|
||||||
|
_Out_ PULONG Length
|
||||||
|
);
|
||||||
|
|
||||||
NTSYSAPI
|
NTSYSAPI
|
||||||
ULONG
|
ULONG
|
||||||
NTAPI
|
NTAPI
|
||||||
|
|
|
@ -1251,6 +1251,48 @@ RtlGetLongestNtPathLength(VOID)
|
||||||
return MAX_PATH + RtlpDosDevicesUncPrefix.Length / sizeof(WCHAR) + sizeof(ANSI_NULL);
|
return MAX_PATH + RtlpDosDevicesUncPrefix.Length / sizeof(WCHAR) + sizeof(ANSI_NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @implemented
|
||||||
|
* @note: the export is called RtlGetLengthWithoutTrailingPathSeperators
|
||||||
|
* (with a 'e' instead of a 'a' in "Seperators").
|
||||||
|
*/
|
||||||
|
NTSTATUS
|
||||||
|
NTAPI
|
||||||
|
RtlGetLengthWithoutTrailingPathSeparators(IN ULONG Flags,
|
||||||
|
IN PCUNICODE_STRING PathString,
|
||||||
|
OUT PULONG Length)
|
||||||
|
{
|
||||||
|
ULONG NumChars;
|
||||||
|
|
||||||
|
/* Parameters validation */
|
||||||
|
if (Length == NULL) return STATUS_INVALID_PARAMETER;
|
||||||
|
|
||||||
|
*Length = 0;
|
||||||
|
|
||||||
|
if (PathString == NULL) return STATUS_INVALID_PARAMETER;
|
||||||
|
|
||||||
|
/* No flags are supported yet */
|
||||||
|
if (Flags != 0) return STATUS_INVALID_PARAMETER;
|
||||||
|
|
||||||
|
NumChars = PathString->Length / sizeof(WCHAR);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Notice that we skip the last character, therefore:
|
||||||
|
* - if we have: "some/path/f" we test for: "some/path/"
|
||||||
|
* - if we have: "some/path/" we test for: "some/path"
|
||||||
|
* - if we have: "s" we test for: ""
|
||||||
|
* - if we have: "" then NumChars was already zero and we aren't there
|
||||||
|
*/
|
||||||
|
|
||||||
|
while (NumChars > 0 && IS_PATH_SEPARATOR(PathString->Buffer[NumChars - 1]))
|
||||||
|
{
|
||||||
|
--NumChars;
|
||||||
|
}
|
||||||
|
|
||||||
|
*Length = NumChars;
|
||||||
|
return STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @implemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in a new issue