From 6b4b1dff6cf2f104767a37e20f634a7a7c7a5b90 Mon Sep 17 00:00:00 2001 From: Bill Zissimopoulos Date: Fri, 9 Oct 2020 15:19:51 -0700 Subject: [PATCH] sys: notify implementation --- src/sys/volume.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/sys/volume.c b/src/sys/volume.c index 94ae588d..3c033683 100644 --- a/src/sys/volume.c +++ b/src/sys/volume.c @@ -1218,6 +1218,9 @@ static VOID FspVolumeNotifyWork(PVOID NotifyWorkItem0) FileName.Length = FileName.MaximumLength = (USHORT)(NotifyInfoSize - sizeof(FSP_FSCTL_NOTIFY_INFO)); FileName.Buffer = NotifyInfo->FileNameBuf; + if (sizeof(WCHAR) * 2/* not empty or root */ <= FileName.Length && + L'\\' == FileName.Buffer[FileName.Length / sizeof(WCHAR) - 1]) + FileName.Length -= sizeof(WCHAR); if (!FspFileNameIsValid(&FileName, FsvolDeviceExtension->VolumeParams.MaxComponentLength, FsvolDeviceExtension->VolumeParams.NamedStreams ? &StreamPart : 0, @@ -1249,8 +1252,7 @@ static VOID FspVolumeNotifyWork(PVOID NotifyWorkItem0) Result = RtlAppendUnicodeStringToString(&FullFileName, &AbsFileName); if (NT_SUCCESS(Result)) { - if (sizeof(WCHAR) * 2/* not empty or root */ <= AbsFileName.Length && - L'\\' != AbsFileName.Buffer[AbsFileName.Length / sizeof(WCHAR) - 1]) + if (sizeof(WCHAR) * 2/* not empty or root */ <= AbsFileName.Length) Result = RtlAppendUnicodeToString(&FullFileName, L"\\"); } if (NT_SUCCESS(Result))