title: Unique file identifiers on NTFS and $Object_ID
body: <p>From articles I have found online there appears to be two forms of unique identifiers for files on NTFS:</p>
  <ul>
  <li><p>Using Windows API GetFileInformationByHandle(), we can get access to the struct BY_HANDLE_FILE_INFORMATION, which contains a volume serial number and a low/high file index.
  <a href="http://msdn.microsoft.com/en-us/library/aa363788(VS.85).aspx" rel="noreferrer">http://msdn.microsoft.com/en-us/library/aa363788(VS.85).aspx</a></p>
  </li>
  <li><p>$Object_ID - The article <a href="http://blogs.technet.com/b/askcore/archive/2010/08/25/ntfs-file-attributes.aspx" rel="noreferrer">http://blogs.technet.com/b/askcore/archive/2010/08/25/ntfs-file-attributes.aspx</a> states:</p>
  </li>
  </ul>
  <blockquote>
  <p>$OBJECT_ID – This is an attribute that holds an ID. This ID is used by the Distributed Link Tracking Service. An example of how it is used would be found in shortcuts. Make a shortcut on your desktop that points to a file. Then move that file. The shortcut will still function because it is using a way to tack the source file other than just the path and file name.</p>
  <p>Not all files will have an $OBJECT_ID attribute. In fact, it isn’t until an actual ID is to be assigned that the attribute is added to the file.</p>
  </blockquote>
  <p>I am trying to understand when the Object ID is set. Here are a few questions:</p>
  <ol>
  <li><p>When does the Object ID get assigned? It would appear based on the above article that in one scenario this occurs when a shortcut to a file is created.</p>
  </li>
  <li><p>Does the Object ID get assigned automatically when a file references another file, e.g. a Word document, which embeds a Visio diagram?</p>
  </li>
  <li><p>Do Object IDs only get assigned when Distributed Link Tracking is enabled/running or do they exist regardless of Distributed Link Tracking?</p>
  </li>
  <li><p>If I wanted to track a unique identifier for a file, would there be any advantage for me to use the Object ID (64 bytes) over the combined volume serial number and file index (low/high), which are 12 bytes combined.</p>
  </li>
  </ol>
  <p>Thanks, Elan</p>