C# List All Partitions, Including Microsoft Reserved Partitions -
managementclass devs = new managementclass(@"win32_diskdrive"); managementobjectcollection moc = devs.getinstances(); foreach (managementobject mo in moc) { uint32 physicaldisknumber = (uint32)mo["index"]; uint64 disksize = (uint64)mo["size"]; foreach (managementobject b in mo.getrelated("win32_diskpartition")) { //b["name"] gives "disk #0, partition #0" string[] elems = b["name"].tostring().split(','); int partitionnumber = int32.parse(elems[1].replace("partition #", "").trim()); ulong size = (ulong) b["size"]; } }
this code retrieves partitions on disks. however, not retrieve microsoft reserved partitions. want retrieve partitions on disk, including msr partitions. how can accomplish in c#?
Comments
Post a Comment