Solved

Enumerating devices

Posted on 2004-03-22
4
199 Views
Last Modified: 2013-12-03
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
Comment
Question by:dirtdart
  • 2
4 Comments
 
LVL 86

Assisted Solution

by:jkr
jkr earned 250 total points
Comment Utility
Check out http://support.microsoft.com/default.aspx?scid=kb;en-us;259695 ("HOWTO: Enumerate Hardware Devices by Using SetupDi Calls")
0
 
LVL 5

Author Comment

by:dirtdart
Comment Utility
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
 
LVL 9

Accepted Solution

by:
Cayce earned 250 total points
Comment Utility
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
 
LVL 5

Author Comment

by:dirtdart
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This article shows how to make a Windows 7 gadget that accepts files dropped from the Windows Explorer.  It also illustrates how to give your gadget a non-rectangular shape and how to add some nifty visual effects to text displayed in a your gadget.…
This article shows how to make a Windows 7 gadget that extends its U/I with a flyout panel -- a window that pops out next to the gadget.  The example gadget shows several additional techniques:  How to automatically resize a gadget or flyout panel t…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now