title: Windows Mountpoint for a Device
body: <p>I am trying to mount a windows device via ist device path to an ntfs-folder. The device path is in the form:</p>
  
  <pre><code>\\?\GLOBALROOT\Device\ImDisk{0}
  </code></pre>
  
  <p>i would like to mount it in an empty ntfs-folder, lets say:</p>
  
  <pre><code>c:\temp\
  </code></pre>
  
  <p>The device I try to mount is an ImDisk ram drive, which comes with an api. Essentially the api mounts the device via</p>
  
  <pre><code>hDir = CreateFile(Directory, GENERIC_READ | GENERIC_WRITE,
          FILE_SHARE_READ, NULL, OPEN_EXISTING,
          FILE_FLAG_BACKUP_SEMANTICS |
          FILE_FLAG_OPEN_REPARSE_POINT, NULL);
  </code></pre>
  
  <p>and then does a</p>
  
  <pre><code>DeviceIoControl(hDir, FSCTL_SET_REPARSE_POINT, &amp;ReparseData,
             16 + iSize + 2 + iSize + 2, NULL, 0, &amp;dw, NULL))
  </code></pre>
  
  <p>from all I can see in the msdn this is done correctly. The only problem is: It doesn't work. Whatever device notation I use the created junction can't be opened by the explorer. The junction is created and recognized by the explorer by when I try to open it, explorer tells me that the target syntax is invalid.</p>
  
  <p>So far I have tried to mount the device by addressing it like:</p>
  
  <pre><code>\\?\GLOBALROOT\Device\ImDisk0
  
  \\.\GLOBALROOT\Device\ImDisk0
  
  \\.\Device\ImDisk0
  
  \\Device\ImDisk0
  </code></pre>
  
  <p>None of this seems to work.
  I am positive that the Ram-Drive exists and is correctly formated. I am able to access it via a Driveletter (if I assign one during it's creation f.e. E:\)</p>
  
  <p>And I can access it via</p>
  
  <pre><code>CreateFile("\\?\GLOBALROOT\Device\ImDisk0\file.txt")
  </code></pre>
  
  <p>I can create a FileStream, execute code from it etc.</p>
  
  <p>Any clues how to mount it in a ntfs-folder?
  Any help is appreciated!</p>
  
  <p>Thanks in advance!</p>
  
  <p>Corelgott</p>