c# howto finding out from drive letter which physical device/interface is the mounted point

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Hi,<br/>
<br/>
I need to create a custom application that deals with physical devices and logical drives:<br/>
<br/>
We have a computer that contains many storage interfaces (scsi, ata, removable, etc) but there are 2 removable SSD bays (let’s say A,B). These SSD bays are connected as SATA devices. The OS is windows 7 and the corresponding chipset drivers are installed
properly.<br/>
when user removes or inserts SSD storage (hot plug) into the rack the windows handles it properly.<br/>
<br/>
When my applications is running I have to handle this hot-plug on a way that I need to know which logical drives are available on a given physical Location.<br/>
<br/>
So when user inserts a new SSD storage into A (I will put a stick on the PC’s box) my application is notified through wndProc event that a new drive letter is available.<br/>
I must somehow find out that the new drive letter is physically origined from A and not form any other place. This is really essential in my application because the business logic requires it.<br/>
<br/>
I can ask another way round: how can i get the partition letters for a SATA interface. E.g. I want:<br/>
- Location 0: drive letters: M:, D:, L:<br/>
- Location 1: drive letters: O:<br/>
Where Location can be accessed also via: right click on My Computers(C:)->Properties->Hardware tab. Select a device and Device Propeties will tell the Location.<br/>
<br/>
I thing to mention: i am not sure if the Location property is the right one. I have tried to query it through WMI but it seems that it is not refreshed quick enough or maybe i am using the wrong approach.<br/>
<br/>
Thanks for your help in advance!<br/>
<br/>
Kind regards,

View the full article
 
Back
Top