mirror of
https://github.com/reactos/reactos.git
synced 2025-02-24 09:25:10 +00:00
Pierre Schweitzer <heis_spiter@hotmail.com>
- Implement FsRtlDissectName() based on MSDN description. Improvements and bugfixes to the patch were made by Aleksey Bragin. svn path=/trunk/; revision=32447
This commit is contained in:
parent
3488e13934
commit
fc56cc8116
1 changed files with 39 additions and 1 deletions
|
@ -139,7 +139,45 @@ FsRtlDissectName(IN UNICODE_STRING Name,
|
|||
OUT PUNICODE_STRING FirstPart,
|
||||
OUT PUNICODE_STRING RemainingPart)
|
||||
{
|
||||
KEBUGCHECK(0);
|
||||
ULONG FirstPosition, i;
|
||||
ULONG SkipFirstSlash = 0;
|
||||
|
||||
/* Just quit if the string is empty */
|
||||
if (!Name.Length) return;
|
||||
|
||||
/* Find first backslash */
|
||||
FirstPosition = Name.Length / sizeof(WCHAR) ;
|
||||
for (i = 0; i < Name.Length / sizeof(WCHAR); i++)
|
||||
{
|
||||
/* If we found one... */
|
||||
if (Name.Buffer[i] == '\\')
|
||||
{
|
||||
/* If it begins string, just notice it and continue */
|
||||
if (i == 0)
|
||||
{
|
||||
SkipFirstSlash = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Else, save its position and break out of the loop */
|
||||
FirstPosition = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Set up the first result string */
|
||||
FirstPart->Buffer = Name.Buffer + SkipFirstSlash;
|
||||
FirstPart->Length = (FirstPosition - SkipFirstSlash) * sizeof(WCHAR);
|
||||
FirstPart->MaximumLength = Name.MaximumLength - FirstPart->Length;
|
||||
|
||||
/* And second one, if necessary */
|
||||
if (FirstPosition < (Name.Length / sizeof(WCHAR)))
|
||||
{
|
||||
RemainingPart->Buffer = Name.Buffer + FirstPosition + 1;
|
||||
RemainingPart->Length = (Name.Length - FirstPosition) * sizeof(WCHAR);
|
||||
RemainingPart->MaximumLength = Name.MaximumLength - RemainingPart->Length;
|
||||
}
|
||||
}
|
||||
|
||||
/*++
|
||||
|
|
Loading…
Reference in a new issue