summaryrefslogtreecommitdiff
path: root/qga
diff options
context:
space:
mode:
authorPeng Ji <peng.ji@smartx.com>2023-12-27 14:32:06 +0800
committerKonstantin Kostiuk <kkostiuk@redhat.com>2024-01-30 12:14:11 +0200
commit7c4486350a79532580a37d42abdeb1dc7e4fa6c9 (patch)
tree3e3d12ddcb0b8a3666e1698683d0404e9908a454 /qga
parent8c72e19bfdf40ed8306769359c2b8902609672c7 (diff)
qga-win: Fix guest-get-fsinfo multi-disks collection
When a volume has more than one disk, all disks cannot be returned correctly because there is not enough malloced memory for disk extents, so before executing DeviceIoControl for the second time, get the correct size of the required memory space to store all disk extents. Details: https://learn.microsoft.com/en-us/windows/win32/api/winioctl/ns-winioctl-volume_disk_extents Signed-off-by: Peng Ji <peng.ji@smartx.com> Reviewed-by: Konstantin Kostiuk <kkostiuk@redhat.com> Signed-off-by: Konstantin Kostiuk <kkostiuk@redhat.com>
Diffstat (limited to 'qga')
-rw-r--r--qga/commands-win32.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/qga/commands-win32.c b/qga/commands-win32.c
index 697c65507c..a1015757d8 100644
--- a/qga/commands-win32.c
+++ b/qga/commands-win32.c
@@ -935,6 +935,8 @@ static GuestDiskAddressList *build_guest_disk_info(char *guid, Error **errp)
DWORD last_err = GetLastError();
if (last_err == ERROR_MORE_DATA) {
/* Try once more with big enough buffer */
+ size = sizeof(VOLUME_DISK_EXTENTS) +
+ (sizeof(DISK_EXTENT) * (extents->NumberOfDiskExtents - 1));
g_free(extents);
extents = g_malloc0(size);
if (!DeviceIoControl(