0

I am doing one disk management application. I can take out the discs that have been created. The main problem is to see what has not been created. And to make them unit and shape. I do not want to use Windows's disk management application. What should I do for this? What I do is almost identical to the Windows Disk Management application.

I have tried with WMI and Drive Info but I can not see disks that have not been created yet.

Here is what I've alredy tried :

DataTable dt = new DataTable();
dt.Clear();
dt.Columns.Add("Name");
dt.Columns.Add("Volume Label");
dt.Columns.Add("Type");
dt.Columns.Add("Size");
dt.Columns.Add("Format");
dt.Columns.Add("Status");
dt.Columns.Add("Free Space");
dt.Columns.Add("Byte");

DriveInfo[] driverslist = DriveInfo.GetDrives();
foreach (DriveInfo d in driverslist)
{
    if (d.IsReady == true)
    {
        size = FormatBytes(Convert.ToInt64(d.TotalSize));
        totalfreesize = FormatBytes(Convert.ToInt64(d.TotalFreeSpace));
        dt.Rows.Add(d.Name, d.VolumeLabel, d.DriveType, size, d.DriveFormat, d.IsReady, totalfreesize, d.TotalSize);
    }
}
dataGrid.ItemsSource = dt.DefaultView;

I pull the harddisks in here and transfer them to the table.

Sergii Zhevzhyk
  • 4,074
  • 22
  • 28
  • When you say _"make them unit and shape"_, do you mean to say _format_? Are you trying to display attached but unformatted storage devices? If so, you'll need to use IOCTL functions and https://learn.microsoft.com/en-us/windows/desktop/FileIO/disk-management-control-codes – xxbbcc Jul 25 '18 at 15:02
  • Have you tried all of the answers to [Getting a list of logical drives](https://stackoverflow.com/q/781905)? There's also a fair amount of information in [How does one programmatically mount a drive in Windows?](https://stackoverflow.com/q/3788057) – Heretic Monkey Jul 25 '18 at 15:04
  • Can you be a bit more specific of what you need to do and what does not work with the existing code? I couldn't figure out what the problem is – ivcubr Jul 25 '18 at 17:39

0 Answers0