Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 208
  • Last Modified:

Enumerating devices

I understand that I can open and manipulate a device by passing a name such as "\\.\TAPE0" to CreateFile.  However, I can find NO documentation that tells me where to find out that a device is named TAPE0.  I know that I can use GetNTMSInformation to find the names of tape devices, but

1.  I am trying to avoid using RSM because it is so horribly flaky and unreliable.
2.  That does nothing for disk drives unless they are removable.

Any suggestions?
0
dirtdart
Asked:
dirtdart
  • 2
2 Solutions
 
jkrCommented:
Check out http://support.microsoft.com/default.aspx?scid=kb;en-us;259695 ("HOWTO: Enumerate Hardware Devices by Using SetupDi Calls")
0
 
dirtdartAuthor Commented:
That does enumerate all the hardware on a machine, but unless I'm missing something, I have no way to find the device name from the information retrieved.  As stated above, I need to know that the device is named "TAPE0", "TAPE1", etc.
0
 
CayceCommented:
Check out the API call SetupDiGetDeviceInterfaceDetail (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/devio/base/setupdigetdeviceinterfacedetail.asp).

The DeviceInterfaceDetailData (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/devio/base/sp_device_interface_detail_data_str.asp) parameter includes the DevicePath that is what you are looking for.
0
 
dirtdartAuthor Commented:
That looks like it would probably do what I need.  However, the answer came just in time for the project to get cancelled.  Hopefully I'll have some time to pick it back up one day.  Thanks for your help.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now