1

When we set custom icons for folders, a desktop.ini file will be generated in it with the following structure:

[.ShellClassInfo]
IconResource=${path to the icon file},0
[ViewState]
Mode=
Vid=
FolderType=Generic

But if you manually create such a file in the directory, the custom icon won't be displayed. It confused me for quite a while until I accidentally looked into file attributes. Surprisingly, I found that the folders I set icons through the property window have a ReadOnly attribute. Then I tried manually adding the ReadOnly attribute for the folders that I tried setting icons by creating desktop.ini directly, and the custom icons were displayed.
Now I'm wondering, what does the ReadOnly attribute on a folder stand for? Could this behavior be found in any Microsoft documents?
Note that I'm talking about the ReadOnly file attribute on a directory file system entry, which differs from the read-only checkbox displayed in the property window.

1 Answer 1

1

It has no meaning to the rest of the OS, and is used specifically as an indicator for Explorer to look for a desktop.ini file.

  • The Old New Thing: Why is the readonly property for folders so strange?

    It's actually a signal to Explorer to look harder. It doesn't mean that the directory is read-only.

    If a folder has the Readonly or System flag set, then Explorer will look for a desktop.ini file which describes the folder customizations. For performance reasons, Explorer does this only if the directory has the +R or +S flag. (This is enormously important on slow networks.)

  • MS KB 256614 : Unable to remove Read-Only attribute from folder

    Windows Explorer uses the Read-Only attribute to determine whether or not the folder is customized.

  • MS KB 326549: You Cannot View or Change the Read-Only or System Attribute of Folders

    Unlike the Read-only attribute for a file, the Read-only attribute for a folder is typically ignored by Windows, Windows components and accessories, and other programs. [...] The Read-only and System attributes is only used by Windows Explorer to determine whether the folder is a special folder, such as a system folder that has its view customized by Windows (for example, My Documents, Favorites, Fonts, Downloaded Program Files), or a folder that you customized by using the Customize tab of the folder's Properties dialog box. As a result, Windows Explorer does not allow you to view or change the Read-only or System attributes of folders.

    When a folder has the Read-Only attribute set it causes Explorer to request the Desktop.ini of that folder to see if any special folder settings need to be set. It has been seen where if a network share that has a large amount of folders set to Read-only, it can cause Explorer to take longer then what is expected to render the contents of that share while it waits on the retrieval of the Desktop.ini files. The slower the network connectivity to the share the longer this process can take to the point where Explorer may timeout waiting for the data and render nothing or appear to hang.


Note that I'm talking about the ReadOnly file attribute on a directory file system entry, which differs from the read-only checkbox displayed in the property window.

It doesn't; the checkbox uses the same attribute. Only newer Windows versions have changed what objects the checkbox will apply the attribute to (i.e. it only applies it to files inside, instead of the directory itself), but it's still the same attribute.

In older Windows versions, such as Windows 98 SE, the checkbox directly controlled the attribute on the directory itself.

1
  • Thank you for the detailed answer! May 14 at 11:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.