title: Can CreateFile function open a handle to the devices that are only listed under Global?? directory in WinObj utility?
body: <p>You know - in C++, you can obtain a handle to an I/O device by passing its path as the first parameter in a call to CreateFile function. But I wonder how CreateFile locates and identifies the device by the path given. One day, I discovered something about this topic using WinObj utility, which may be probably true.<br>
  In WinObj, there is a directory named <em>Global??</em> which is located under the root directory, and can be seen on the left pane. This directory contains lots of items of type "SymbolicLink".<br>
  When you pass the path of an I/O device (such as "\.\C:" or "\.\Changer0") as the first parameter in a call to <code>CreateFile</code> function, the CreateFile function parses out the path and removes "\.\" from it to find a portion of the path. Then it searches the <em>Global??</em> directory for a SymbolicLink with the same name as that portion. Then it finds the address that the symbolic link refers to, which is the primary <strong>Physical Device Object Name</strong> (for example, "\Device\CdRom0").<br>
  So, is my discovery true? Are the devices contained within <em>Global??</em> directory the only devices that <code>CreateFile</code> function can open? Just to mention something:  not all of the items in <em>Global??</em> directory refer to a device, I guess.  </p>
  
  <h3>The second part of my question</h3>
  
  <p>One day, I wanted to decrease the screen brightness of my monitor programmatically, by sending an <code>IOCTL_VIDEO_SET_DISPLAY_BRIGHTNESS</code> control code to my monitor. The problem was that I didn't know what to specify for the first parameter of <code>CreateFile</code> function. So I did the following:  </p>
  
  <ol>
  <li>I opened <em>Device Manager</em> and found my monitor device among the list. The name of that device was "Generic Non-PnP Monitor".</li>
  <li>I right clicked on that list item and clicked on <em>Properties</em>.</li>
  <li>In the <em>Properties</em> window, I clicked on <em>Details</em> tab. Then I selected <em>Physical Device Object name</em> from the <em>Property</em> drop-down list.</li>
  <li>On the value section, I found the text "\Device\0000006f".</li>
  <li>In WinObj, I searched the <em>Global??</em> directory for a SymbolicLink which refers to "\Device\0000006f". The name of that SymbolicLink was long:</li>
  </ol>
  
  <blockquote>
    <p>DISPLAY#Default_Monitor#5&amp;1193a8c7&amp;0&amp;UID100663553#{866519b5-3f07-4c97-b7df-24c5d8a8ccb8}</p>
  </blockquote>
  
  <ol start="6">
  <li>Then I put a "\.\" before the aforementioned SymbolicLink name and
  specified it as the first parameter of <code>CreateFile</code> function.  </li>
  </ol>
  
  <p>Any ideas on how to do all of this operation programmatically? I mean, I'd like my program itself to obtain the value of <code>lpFileName</code> parameter. Not I place this string directly in my program's source code.</p>