[MOUNTMGR] Fix QueryPointsFromMemory and make it working

Select the current stack location for output buffer
And set output size so that buffer gets properly copied to caller
This commit is contained in:
Pierre Schweitzer
2019-09-05 08:28:56 +02:00
parent 70d29ec423
commit d592e00dfa

View File

@@ -332,12 +332,13 @@ QueryPointsFromMemory(IN PDEVICE_EXTENSION DeviceExtension,
}
/* Now, ensure output buffer can hold everything */
Stack = IoGetNextIrpStackLocation(Irp);
Stack = IoGetCurrentIrpStackLocation(Irp);
MountPoints = (PMOUNTMGR_MOUNT_POINTS)Irp->AssociatedIrp.SystemBuffer;
/* Ensure we set output to let user reallocate! */
MountPoints->Size = sizeof(MOUNTMGR_MOUNT_POINTS) + TotalSize;
MountPoints->NumberOfMountPoints = TotalSymLinks;
Irp->IoStatus.Information = sizeof(MOUNTMGR_MOUNT_POINTS) + TotalSize;
if (MountPoints->Size > Stack->Parameters.DeviceIoControl.OutputBufferLength)
{