sys: FspFsvolSetRenameInformation: correctly compute Suffix for SRV2 renames

This commit is contained in:
Bill Zissimopoulos 2016-10-27 11:44:43 -07:00
parent 26092211a8
commit 5fa631339d
3 changed files with 14 additions and 8 deletions

View File

@ -1161,10 +1161,16 @@ static NTSTATUS FspFsvolSetRenameInformation(
else else
FspFileNameSuffix(&FileNode->FileName, &Remain, &Suffix); FspFileNameSuffix(&FileNode->FileName, &Remain, &Suffix);
Suffix.Length = Suffix.MaximumLength = (USHORT)Info->FileNameLength; Suffix.Length = (USHORT)Info->FileNameLength;
Suffix.Buffer = Info->FileName; Suffix.Buffer = Info->FileName;
if (L'\\' == Suffix.Buffer[0]) /* if there is a backslash anywhere in the NewFileName get its suffix */
FspFileNameSuffix(&Suffix, &NewFileName, &Suffix); for (PWSTR P = Suffix.Buffer, EndP = P + Suffix.Length / sizeof(WCHAR); EndP > P; P++)
if (L'\\' == *P)
{
Suffix.Length = (USHORT)((EndP - P - 1) * sizeof(WCHAR));
Suffix.Buffer = P + 1;
}
Suffix.MaximumLength = Suffix.Length;
if (!FspFileNameIsValid(&Remain, 0, 0) || !FspFileNameIsValid(&Suffix, 0, 0)) if (!FspFileNameIsValid(&Remain, 0, 0) || !FspFileNameIsValid(&Suffix, 0, 0))
{ {

View File

@ -41,7 +41,7 @@ BOOLEAN FspFileNameIsValid(PUNICODE_STRING Path, PUNICODE_STRING StreamPart, PUL
/* if StreamPart is not NULL, StreamType must also be not NULL */ /* if StreamPart is not NULL, StreamType must also be not NULL */
ASSERT(0 == StreamPart || 0 != StreamType); ASSERT(0 == StreamPart || 0 != StreamType);
if (0 != Path->Length % sizeof(WCHAR)) if (0 == Path->Length || 0 != Path->Length % sizeof(WCHAR))
return FALSE; return FALSE;
PWSTR PathBgn, PathEnd, PathPtr, StreamTypeStr = 0; PWSTR PathBgn, PathEnd, PathPtr, StreamTypeStr = 0;

View File

@ -37,10 +37,10 @@ for %%f in (^
:winfsp-tests-x86-mountpoint-drive ^ :winfsp-tests-x86-mountpoint-drive ^
:winfsp-tests-x86-mountpoint-dir ^ :winfsp-tests-x86-mountpoint-dir ^
:winfsp-tests-x86-no-traverse ^ :winfsp-tests-x86-no-traverse ^
:winfsp-tests-x64-disk-share ^ :winfsp-tests-x64-external-share ^
:fsx-memfs-x64-disk ^ :fsx-memfs-x64-disk ^
:fsx-memfs-x64-net ^ :fsx-memfs-x64-net ^
:winfsp-tests-x86-disk-share ^ :winfsp-tests-x86-external-share ^
:fsx-memfs-x86-disk ^ :fsx-memfs-x86-disk ^
:fsx-memfs-x86-net ^ :fsx-memfs-x86-net ^
:winfstest-memfs-x64-disk ^ :winfstest-memfs-x64-disk ^
@ -142,7 +142,7 @@ winfsp-tests-x86 --no-traverse
if !ERRORLEVEL! neq 0 goto fail if !ERRORLEVEL! neq 0 goto fail
exit /b 0 exit /b 0
:winfsp-tests-x64-disk-share :winfsp-tests-x64-external-share
M: M:
"%ProjRoot%\build\VStudio\build\%Configuration%\winfsp-tests-x64.exe" --external --share=winfsp-tests-share=M:\ --resilient "%ProjRoot%\build\VStudio\build\%Configuration%\winfsp-tests-x64.exe" --external --share=winfsp-tests-share=M:\ --resilient
if !ERRORLEVEL! neq 0 goto fail if !ERRORLEVEL! neq 0 goto fail
@ -164,7 +164,7 @@ if !ERRORLEVEL! neq 0 goto fail
if !ERRORLEVEL! neq 0 goto fail if !ERRORLEVEL! neq 0 goto fail
exit /b 0 exit /b 0
:winfsp-tests-x86-disk-share :winfsp-tests-x86-external-share
O: O:
"%ProjRoot%\build\VStudio\build\%Configuration%\winfsp-tests-x86.exe" --external --share=winfsp-tests-share=O:\ --resilient "%ProjRoot%\build\VStudio\build\%Configuration%\winfsp-tests-x86.exe" --external --share=winfsp-tests-share=O:\ --resilient
if !ERRORLEVEL! neq 0 goto fail if !ERRORLEVEL! neq 0 goto fail