[driver] changing logic in volume query
previously, if the supplied buffer length was smaller than the result of the volume query we returned SUCCESS and no data (ie. it was needed because Notepad passes in a buffer too small but doesn't like a buffer_too_small error.) However, it does work with buffer_overflow error and then a partial resulted returned.
This commit is contained in:
parent
8153733a77
commit
25cf92a60b
1 changed files with 19 additions and 18 deletions
|
|
@ -3346,26 +3346,27 @@ NTSTATUS nfs41_QueryVolumeInformation (
|
|||
PFILE_FS_VOLUME_INFORMATION pVolInfo = RxContext->Info.Buffer;
|
||||
DECLARE_CONST_UNICODE_STRING(Label, L"PnfsVolume");
|
||||
|
||||
SizeUsed = sizeof(FILE_FS_VOLUME_INFORMATION) + Label.Length;
|
||||
if (RemainingLength < SizeUsed) {
|
||||
#if 0
|
||||
if (RxContext->Info.LengthRemaining >= sizeof(FILE_FS_VOLUME_INFORMATION)) {
|
||||
RtlZeroMemory(pVolInfo, sizeof(FILE_FS_VOLUME_INFORMATION));
|
||||
pVolInfo->VolumeCreationTime.QuadPart = 0;
|
||||
pVolInfo->VolumeSerialNumber = 0xBABAFACE;
|
||||
pVolInfo->SupportsObjects = FALSE;
|
||||
RxContext->Info.LengthRemaining -= sizeof(FILE_FS_VOLUME_INFORMATION);
|
||||
} else {
|
||||
status = STATUS_BUFFER_TOO_SMALL;
|
||||
RxContext->InformationToReturn = SizeUsed;
|
||||
#else
|
||||
/* Have to have status success for Notepad to be happy */
|
||||
status = STATUS_SUCCESS;
|
||||
#endif
|
||||
RxContext->InformationToReturn = sizeof(FILE_FS_VOLUME_INFORMATION) + Label.Length;
|
||||
goto out;
|
||||
}
|
||||
if (RxContext->Info.LengthRemaining < Label.Length) {
|
||||
status = STATUS_BUFFER_OVERFLOW;
|
||||
goto out;
|
||||
} else {
|
||||
pVolInfo->VolumeLabelLength = Label.Length;
|
||||
RtlCopyMemory(&pVolInfo->VolumeLabel[0], (PVOID)Label.Buffer, Label.Length);
|
||||
RxContext->Info.LengthRemaining -= Label.Length;
|
||||
status = STATUS_SUCCESS;
|
||||
goto out;
|
||||
}
|
||||
RtlZeroMemory(pVolInfo, sizeof(FILE_FS_VOLUME_INFORMATION));
|
||||
pVolInfo->VolumeCreationTime.QuadPart = 0;
|
||||
pVolInfo->VolumeSerialNumber = 0xBABAFACE;
|
||||
pVolInfo->SupportsObjects = FALSE;
|
||||
pVolInfo->VolumeLabelLength = Label.Length;
|
||||
RtlCopyMemory(&pVolInfo->VolumeLabel[0], (PVOID)Label.Buffer, Label.Length);
|
||||
RxContext->Info.LengthRemaining -= SizeUsed;
|
||||
status = STATUS_SUCCESS;
|
||||
goto out;
|
||||
}
|
||||
|
||||
case FileFsDeviceInformation:
|
||||
|
|
@ -3380,7 +3381,7 @@ NTSTATUS nfs41_QueryVolumeInformation (
|
|||
}
|
||||
RtlZeroMemory(pDevInfo, SizeUsed);
|
||||
pDevInfo->DeviceType = RxContext->pFcb->pNetRoot->DeviceType;
|
||||
pDevInfo->Characteristics = FILE_REMOTE_DEVICE; // | FILE_READ_ONLY_DEVICE;
|
||||
pDevInfo->Characteristics = FILE_REMOTE_DEVICE | FILE_DEVICE_IS_MOUNTED;
|
||||
RxContext->Info.LengthRemaining -= SizeUsed;
|
||||
status = STATUS_SUCCESS;
|
||||
goto out;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue