title: WINAPI: Get a List of Devices by their NT name
body: <p>This <a href="http://support.microsoft.com/kb/235128" rel="nofollow">article</a> explains how to Query logical DOS names for their NT naming convention using <a href="http://msdn.microsoft.com/en-us/library/aa365461%28VS.85%29.aspx" rel="nofollow"><strong>QueryDosDevice</strong></a>. It explains how to add and remove Logical Device names using their NT naming convention using <a href="http://msdn.microsoft.com/en-us/library/aa363904%28VS.85%29.aspx" rel="nofollow"><strong>DefineDosDevice</strong></a>. The article explains that a DOS name is required to access various devices.</p>
  
  <blockquote>
    <p>"Win32 programs cannot use internal
    Windows NT device names to access
    devices because the Win32 subsystem
    and Win32 API require the more
    familiar drive letters and MS-DOS
    device names, such as A:, C:, COM1:,
    and LPT1"</p>
  </blockquote>
  
  <p>I found this <a href="http://www.vbaccelerator.com/home/vb/tips/Mapping_NT_Device_Names/article.asp" rel="nofollow">interesting article</a> that gets all the available DOS Names and then queries for the NT Name using the function <a href="http://msdn.microsoft.com/en-us/library/aa364975%28VS.85%29.aspx" rel="nofollow"><strong>GetLogicalDriveString</strong></a>. This article does not explain how to return all defined DOS names for devices, just drives.</p>
  
  <p>However, I would like to know how to do the reverse. How would I get a list of NT device names. I am not looking for just drives but all devices. For example <strong>LPT1</strong> and <strong>COM1</strong> are reserved DOS names that correspond to specific NT names. I would like to map additional devices they may not have a DOS name so that I can use the WINAPI function <a href="http://msdn.microsoft.com/en-us/library/aa363858%28VS.85%29.aspx" rel="nofollow"><strong>CreateFile</strong></a>.</p>
  
  <p><strong>How do I get a list of all NT device names oppose to DOS Names?</strong></p>