title: Get the immediate target path from symlink/reparse point
body: <p>I am aware that <em>GetFinalPathNameByHandle</em> can be used to obtain the target of a symbolic link or a reparse point, but there are situations where its use is not desirable:</p>
  
  <ul>
  <li>If the target is not available, doesn't exist or cannot be opened, <em>CreateFile</em> on a symlink fails, and thus the path cannot be obtained.</li>
  <li>If I point a symlink "a" to file "b" and create a symlink "b" to file "c", the function follows the whole chain, returning "c".</li>
  <li>The function is not useful much when I already have the handle to the actual symlink at hand.</li>
  </ul>
  
  <p>It seems that <em>DeviceIoControl</em> can be used together with <code>FSCTL_GET_REPARSE_POINT</code> to obtain the actual reparse data of the file, but that gets me the <code>REPARSE_DATA_BUFFER</code>, and I would have to <em>parse</em> that.</p>
  
  <p>I don't know how the system actually processes reparse points, but I think that the target location is a piece of information that should be available at some point. The <code>dir</code> command, for example, can display the target path correctly for any reparse point... well I have already seen it handle just symlinks and mount points (junctions).</p>