See inline...
Am 07.03.2014 20:33, schrieb pschweitzer(a)svn.reactos.org:
> [...]
> + /* Update user buffer with the change that occured
> + * First copy parent name if any
> + * Then copy target name, there's always one
> + * And finally, copy stream name if any
> + * If these names aren't unicode, then convert first
> + */
> + _SEH2_TRY
> + {
> + OutputBuffer->NextEntryOffset = 0;
> + OutputBuffer->Action = Action;
> + OutputBuffer->FileNameLength = DataLength - sizeof(FILE_NOTIFY_INFORMATION);
> + if (IsUnicode)
> + {
> + if (ParentName->Length)
> + {
> + RtlCopyMemory(OutputBuffer->FileName, ParentName->Buffer, ParentName->Length);
> + OutputBuffer->FileName[ParentName->Length / sizeof(WCHAR)] = L'\\';
> + AlreadyWritten = ParentName->Length + sizeof(WCHAR);
> + }
> + RtlCopyMemory(OutputBuffer->FileName + AlreadyWritten, TargetName->Buffer, TargetName->Length);
OutputBuffer->FileName is a WCHAR array, AlreadyWritten is a count of
bytes, the pointer arithmetic is wrong here.
> + if (StreamName)
> + {
> + AlreadyWritten += TargetName->Length;
> + OutputBuffer->FileName[AlreadyWritten / sizeof(WCHAR)] = L':';
> + RtlCopyMemory(OutputBuffer->FileName + AlreadyWritten + sizeof(WCHAR),
> + StreamName->Buffer, StreamName->Length);
see above
> + }
> + }
> + else
> + {
> + if (!ParentName->Length)
> + {
> + ASSERT(StreamName);
> + RtlCopyMemory(OutputBuffer->FileName, StreamName->Buffer, StreamName->Length);
> + }
> + else
> + {
> + RtlOemToUnicodeN(OutputBuffer->FileName, OutputBuffer->FileNameLength,
> + &ResultSize, ParentName->Buffer,
> + ParentName->Length);
> + OutputBuffer->FileName[ResultSize / sizeof(WCHAR)] = L'\\';
> + AlreadyWritten = ResultSize + sizeof(WCHAR);
> +
> + RtlOemToUnicodeN(OutputBuffer->FileName + AlreadyWritten,
> + OutputBuffer->FileNameLength, &ResultSize,
> + TargetName->Buffer, TargetName->Length);
see above
> +
> + if (StreamName)
> + {
> + AlreadyWritten += ResultSize;
> + OutputBuffer->FileName[AlreadyWritten / sizeof(WCHAR)] = L':';
> + RtlOemToUnicodeN(OutputBuffer->FileName + AlreadyWritten + sizeof(WCHAR),
> + OutputBuffer->FileNameLength, &ResultSize,
> + StreamName->Buffer, StreamName->Length);
see above
> [...]
> +
> + /* Look for target name & construct it, if required */
> + if (TargetName.Buffer)
> + {
> + TargetNameLength = TargetName.Length;
The TargetNameLength vatiable is completely redundant
> [...]
> +
> + /* Get the position where we can put our data (aligned!) */
> + AlignedDataLength = ROUND_UP(NotifyChange->DataLength, sizeof(ULONG));
> + /* If it's higher than buffer length, then, bail out without outputing */
> + if (DataLength > NumberOfBytes || AlignedDataLength + DataLength > NumberOfBytes)
> + {
> + NotifyChange->Flags |= NOTIFY_IMMEDIATELY;
> + }
> + else
> + {
> + OutputBuffer = 0;
> + FileNotifyInfo = 0;
Use NULL