1 /* $Id: name.c,v 1.9 2004/08/15 16:39:02 chorns Exp $
3 * reactos/ntoskrnl/fs/name.c
11 PUCHAR
* FsRtlLegalAnsiCharacterArray
= NULL
;
14 /**********************************************************************
16 * FsRtlAreNamesEqual@16
25 * From Bo Branten's ntifs.h v25.
30 FsRtlAreNamesEqual (IN PUNICODE_STRING Name1
,
31 IN PUNICODE_STRING Name2
,
32 IN BOOLEAN IgnoreCase
,
33 IN PWCHAR UpcaseTable OPTIONAL
)
39 /**********************************************************************
44 * Dissects a given path name into first and remaining part.
48 * Unicode string to dissect.
51 * Pointer to user supplied UNICODE_STRING, that will
52 * later point to the first part of the original name.
55 * Pointer to user supplied UNICODE_STRING, that will
56 * later point to the remaining part of the original name.
62 * Name: \test1\test2\test3
64 * RemainingPart: test2\test3
69 FsRtlDissectName (IN UNICODE_STRING Name
,
70 OUT PUNICODE_STRING FirstPart
,
71 OUT PUNICODE_STRING RemainingPart
)
73 USHORT NameOffset
= 0;
74 USHORT NameLength
= 0;
77 FirstPart
->Length
= 0;
78 FirstPart
->MaximumLength
= 0;
79 FirstPart
->Buffer
= NULL
;
81 RemainingPart
->Length
= 0;
82 RemainingPart
->MaximumLength
= 0;
83 RemainingPart
->Buffer
= NULL
;
88 /* Skip leading backslash */
89 if (Name
.Buffer
[0] == L
'\\')
92 Length
= Name
.Length
/ sizeof(WCHAR
);
94 /* Search for next backslash or end-of-string */
95 while ((NameOffset
+ NameLength
<= Length
) &&
96 (Name
.Buffer
[NameOffset
+ NameLength
] != L
'\\'))
101 FirstPart
->Length
= NameLength
* sizeof(WCHAR
);
102 FirstPart
->MaximumLength
= NameLength
* sizeof(WCHAR
);
103 FirstPart
->Buffer
= &Name
.Buffer
[NameOffset
];
105 NameOffset
+= (NameLength
+ 1);
106 if (NameOffset
< Length
)
108 RemainingPart
->Length
= (Length
- NameOffset
) * sizeof(WCHAR
);
109 RemainingPart
->MaximumLength
= (Length
- NameOffset
) * sizeof(WCHAR
);
110 RemainingPart
->Buffer
= &Name
.Buffer
[NameOffset
];
115 /**********************************************************************
117 * FsRtlDoesNameContainWildCards@4
126 * From Bo Branten's ntifs.h v12.
131 FsRtlDoesNameContainWildCards (IN PUNICODE_STRING Name
)
135 if (Name
->Length
== 0)
138 /* Set pointer to last character of the string */
139 Ptr
= (PWCHAR
)((ULONG_PTR
)Name
->Buffer
+ Name
->Length
- sizeof(WCHAR
));
141 while (Ptr
> Name
->Buffer
)
143 /* Stop at backslash */
147 /* Check for wildcards */
149 (*Ptr
== L
'\"' || *Ptr
== L
'*' || *Ptr
== L
'<' ||
150 *Ptr
== L
'>' || *Ptr
== L
'?'))
153 /* Move to previous character */
161 /**********************************************************************
163 * FsRtlIsNameInExpression@16
172 * From Bo Branten's ntifs.h v12.
177 FsRtlIsNameInExpression (IN PUNICODE_STRING Expression
,
178 IN PUNICODE_STRING Name
,
179 IN BOOLEAN IgnoreCase
,
180 IN PWCHAR UpcaseTable OPTIONAL
)