As a disclaimer, I have successfully used DeviceIoControl with IOCTL_STORAGE_QUERY_PROPERTY to get a STORAGE_DEVICE_DESCRIPTOR structure that contains the BusType enum, such as SATA or NVMe for fixed storage.
I am using C# and .NET 10.
I am looking to get the media type, such as HDD or SSD, with winapi on Windows OS. Similar to how Windows Task Manager, Advanced storage settings, or Get-PhysicalDisk PowerShell command show:



Would anyone know how I can do this with winapi?