From 8ea456e2a268af16ec22d365743f4d7d621ccb2c Mon Sep 17 00:00:00 2001 From: Hoang Hong Quan Date: Tue, 18 Feb 2025 03:42:39 +0700 Subject: [PATCH] Use disk drive name instead of storage controller name --- Scripts/platforms/windows.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Scripts/platforms/windows.py b/Scripts/platforms/windows.py index 5ed71bf..cebbf4a 100755 --- a/Scripts/platforms/windows.py +++ b/Scripts/platforms/windows.py @@ -83,6 +83,7 @@ class WindowsHardwareInfo: "Mouse": [], "HDC": [], "SCSIAdapter": [], + "DiskDrive": [], "Biometric": [], "Bluetooth": [], "SDHost": [], @@ -532,6 +533,12 @@ class WindowsHardwareInfo: def storage_controllers(self): storage_controller_info = {} + disk_drive_name_by_id = {} + for device in self.devices_by_class.get("DiskDrive"): + device_name = device.Name or None + parent_id = device.GetDeviceProperties(["DEVPKEY_Device_Parent"])[0][0].Data.upper() + disk_drive_name_by_id[parent_id] = device_name + for device in self.devices_by_class.get("HDC") + self.devices_by_class.get("SCSIAdapter"): device_name = device.Name or "Unknown" pnp_device_id = device.PNPDeviceID @@ -549,7 +556,7 @@ class WindowsHardwareInfo: pass device_info.update(self.get_device_location_paths(device)) - storage_controller_info[self.utils.get_unique_key(device_name, storage_controller_info)] = device_info + storage_controller_info[self.utils.get_unique_key(disk_drive_name_by_id.get(pnp_device_id, device_name), storage_controller_info)] = device_info return storage_controller_info