Where are files’ positions inside folders stored in Windows XP

windowswindows xp

Yesterday I had a rather complicated technical problem to solve. Would post the whole story if it weren't so extensive…

Long story short, I repaired Windows XP using the original installation CD. I noticed that the position of nearly all files, inside the folders, were wrong or set on automatic sort by name.

To avoid confusion, what I mean by position is the (x,y) coordinate where the file's icon exists, within a given folder, and not the actual physical location in the MBR.

I asked this question in chat and besides the former, someone suggested that the positions are stored in desktop.ini, which, AFAIK, is stored on a folder-by-folder basis.

It makes some sense that the repair process also restored the desktop.ini files to their initial setting. However, after repairing the Windows installation, I restored C:\Windows and C:\Documents and Settings from another system (long story here).

As soon as I accessed the system, the file's positions were exactly the same as before… except, the C:\, the C:\Program Files and many other folders had their settings restored. What boggles me now is that I didn't restore C:\, so a desktop.ini file wouldn't be there.

As I also have a guest account activated, I noticed I viewed the positions in a different way that my main (admin) account.

The question here is Where does Windows store this attribute, for a specific folder?

My current hypothesis is that it is a a set of user definitions, stored somewhere on C:\Documents and Settings, but on my searches I haven't found anything about user profiles and this attribute.


Note: As I was writing the question I replaced the word location to position in the post and I got some new information (some new question matches appeared) that might help anyone who tries to answer this:

Best Answer

You've pretty much answered your own question, by the looks of it. It is a combination of things, but the saved settings are at the registry key noted.

The Windows registry is actually a combination of several files found in the %windir%\System32\Config folder: Software, System, SAM, Security, Default, and UserDiff. The NTUSER.DAT file is the only registry file not so located; it is in %userprofile% as you noted.

Desktop.ini does some save settings for the desktop, but not the ordering; it is only created if you have enabled "save each folder's view settings". Here is typical content:

[.ShellClassInfo] LocalizedResourceName=@%SystemRoot%\system32\shell32.dll,-21769 IconResource=%SystemRoot%\system32\imageres.dll,-183 [LocalizedFileNames] VAIO Control Center.lnk=@C:\PROGRA~2\Sony\VAIOCO~\VAIOCO~1.EXE,-1319

There is further info on what you can incorporate into desktop.ini at http://msdn.microsoft.com/en-us/library/windows/desktop/cc144102%28v=vs.85%29.aspx

=========

But the last order "remembered", for icon arrangement, is shown primarily based on the information you mentioned as in the registry at HKCU\Software\Microsoft\Windows\Shell\Bags\1\Desktop

As you note, this key is stored in NTUSER.DAT for the individual user, and then incorporated into the registry as HKCU...

So when you did your restore, you likely restored NTUSER.DAT and thus got back the order that you last used.