I'm trying to get all unallocated spaces (as a list of <offset,size> pairs) on a disk.
Everything is good as far there aren't any extended partitions on the disk - I just list Win32_DiskPartition
s associated with the selected Win32_DiskDrive
and analyze their offsets and sizes to find gaps between them.
If, however, there's an extended partition, things get complicated - it is like a black box and the internal partitions aren't among objects associated with my Win32_DiskDrive
. I tried listing the extended partition's associated objects, but there are no "internal" Win32_DiskPartition
s linked to the extended partition, onlyWin32_LogicalDisk
s, but they don't give me any information about the partition's actual geometry
It tried using diskpart for this purpose, but it rounds all the partition sizes to GB, and I need them to be exact. Also it's locale-dependent, which makes it hard it parse the output (my app needs to be as locale-independent as possible)