title: How to Read/Write Windows 7 Library Locations?
body: <p><strong>Intro</strong></p>
  
  <p>In Windows 7 you have some special folders for documents, pictures and music etc called Libraries.</p>
  
  <p>If you are not aware of them, basically each Library folder can contain Locations (paths) which are basically shortcuts for each Library.</p>
  
  <p><strong>Some examples:</strong></p>
  
  <p><code>Documents (Library)</code></p>
  
  <ul>
  <li>E:\Personal\Documents <code>(Location)</code></li>
  <li>F:\Backups\Documents <code>(Location)</code></li>
  </ul>
  
  <p><code>Music (Library)</code></p>
  
  <ul>
  <li>E:\Media\Music\Albums <code>(Location)</code></li>
  <li>E:\Media\Music\Singles <code>(Location)</code></li>
  </ul>
  
  <p><code>Pictures (Library)</code></p>
  
  <ul>
  <li>E:\Media\Photos <code>(Location)</code></li>
  </ul>
  
  <p>When you click any of these Library folders from Windows Explorer or Start menu, Windows Explorer will show with the Locations defined inside that Library.</p>
  
  <p><strong>Task</strong></p>
  
  <p>What I need to be able to do is read the Locations for each Library type, and be able to write back (update) the Library with my own Locations. I have found that the Libraries are stored in the user AppData folder like this:</p>
  
  <p><code>C:\Users\SOMEUSER\AppData\Roaming\Microsoft\Windows\Libraries</code></p>
  
  <p>These Libraries are this file type: <strong>Library (.library-ms)</strong> - if you right click on one and select properties, Library tab you can see the Library locations associated with that Library.</p>
  
  <p>I don't see a way of extracting these and putting them for example into a TStringList for editing in Delphi. I wondered if these Library Locations were actually stored in the Windows Registry so with some research from Google I found these paths:</p>
  
  <ul>
  <li>HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders</li>
  <li>HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders</li>
  </ul>
  
  <p>But again, I don't see the actual list of Library Locations.</p>
  
  <p>So, how can I read the list of Locations inside a Library file in Delphi, add them to a Listbox or TStringList, edit the entries and then write back the changes? Just been able to extract the Library Location paths would be a start.</p>
  
  <p>I just have a feeling this is going to be one of those questions that has a simple answer I cannot seem to find!</p>