- /* Allow null matching */
- if (Expression->Buffer[ExpressionPosition] != L'?' &&
- Expression->Buffer[ExpressionPosition] != Name->Buffer[NamePosition])
- {
- NamePosition++;
- }
- }
- /* Check DOS_STAR */
- else if (Expression->Buffer[ExpressionPosition] == DOS_STAR)
- {
- /* Skip contigous stars */
- while ((ExpressionPosition + 1 < (USHORT)(Expression->Length / sizeof(WCHAR))) &&
- (Expression->Buffer[ExpressionPosition + 1] == DOS_STAR))
- {
- ExpressionPosition++;
- }
+ /* If buffer too small */
+ if (BackTrackingPosition > RTL_NUMBER_OF(BackTrackingBuffer) - 1)
+ {
+ /* Allocate memory for BackTracking */
+ BackTracking = ExAllocatePoolWithTag(PagedPool | POOL_RAISE_IF_ALLOCATION_FAILURE,
+ (Expression->Length + sizeof(WCHAR)) * sizeof(USHORT),
+ 'nrSF');
+ /* Copy old buffer content */
+ RtlCopyMemory(BackTracking,
+ BackTrackingBuffer,
+ RTL_NUMBER_OF(BackTrackingBuffer) * sizeof(USHORT));
+
+ /* Allocate memory for OldBackTracking */
+ OldBackTracking = ExAllocatePoolWithTag(PagedPool | POOL_RAISE_IF_ALLOCATION_FAILURE,
+ (Expression->Length + sizeof(WCHAR)) * sizeof(USHORT),
+ 'nrSF');
+ /* Copy old buffer content */
+ RtlCopyMemory(OldBackTracking,
+ OldBackTrackingBuffer,
+ RTL_NUMBER_OF(OldBackTrackingBuffer) * sizeof(USHORT));
+ }