From 19855526360effc4460232e0d6d26a9a2e3fba3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Tue, 3 Oct 2023 16:50:57 +0800 Subject: [PATCH] Disk (Windows): fix crashing on Windows 7 VM --- src/detection/disk/disk_windows.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/detection/disk/disk_windows.c b/src/detection/disk/disk_windows.c index dadb7d3ae..35f1722c4 100644 --- a/src/detection/disk/disk_windows.c +++ b/src/detection/disk/disk_windows.c @@ -38,6 +38,7 @@ const char* ffDetectDisksImpl(FFlist* disks) if (handle != INVALID_HANDLE_VALUE) { DEVICE_SEEK_PENALTY_DESCRIPTOR dspd = {}; + DWORD retSize = 0; if(DeviceIoControl( handle, IOCTL_STORAGE_QUERY_PROPERTY, @@ -48,9 +49,9 @@ const char* ffDetectDisksImpl(FFlist* disks) sizeof(STORAGE_PROPERTY_QUERY), &dspd, sizeof(dspd), - NULL, + &retSize, NULL - )) + ) && retSize == sizeof(dspd)) disk->physicalType = dspd.IncursSeekPenalty ? FF_DISK_PHYSICAL_TYPE_HDD : FF_DISK_PHYSICAL_TYPE_SSD; } }