Home
Appendices|Shellfolder attributes

8.E Shellfolder attributes

March 23th, 2005 | plastic

A common ‘Shellfolder’ key in registry typically has an ‘Attributes’ value there. It can be either a binary or dword value, and contains attributes, or flags, that apply to the ‘object’. Having only a virtual existence, these define is it's a folder or not, can be renamed, deleted, and how explorer should treat it (read about Shell objects: [VP 4.1]).

8.E.1 Introduction

Basically, these values look like 0x000000 (0), dword, or 00 00 00 00, binary. 8 digits, 32 possible settings. We prefer to edit binary values, as they can be treated as a simple addition of attributes. Most common shell objects have a binary value, but if it's a dword value, you can rightclick the value and ‘Modify Binary Data’. The numbering is hexadecimal, so each digit can be set from 0 to F (0-15), and can hold up to 4 settings. Possible flags set here can be 1, 2, 4 or 8. If setting is C, that means 1, 4 and 8 are set, only one combination possible all the time. To combine multiple settings and to tweak existing settings, put the values underneath eachother and treat like a regular addition (see example).

In need of a name for the attributes, we'll use their handles as can be used by programmers to retrieve them (by which we found most documentation anyway), the IShellFolder::GetAttributesOf function.

8.E.2 Introduction (technical)

Technically, these values are binary strings, 32 bits long, with 32 possible options inside; every bit can be either 0 (no/false) or 1 (yes/true). The string is then reverted1, and converted to hexadecimal, and there we have our dword value.

Say, our object has an attribute that says it can be renamed. This is the 5th bit set to 1 (bit 4, we started counting at zero): 00001000000000000000000000000000. Reverted, that's 00000000000000000000000000010000 or 10000. Converted to hexadecimal (use Windows calculator to do conversion), we have 0x10. For conformity, these are always 8 digits long, thus the dword value reads 0x00000010 (16) - 16 being a conversion to decimal.

Now, in some cases there's no dword value, but there's a binary value2. The format is not reversed here, so that needs to be undone, but also, these values use ‘bit masks’. A bit mask, here also called ‘byte’, represents 8 bits, and the binary value has four of these (hence 32 bits, on a 32-bit OS that makes a ‘word’), seperately editable. Take the dword value, split up, then reverse order of bytes. Here, 0x00000010 becomes 00 00 00 10, reversed 10 00 00 00.

1 The reversion is standard, and originates in Intel-based processors using ‘little-endian’ (little end first) architecture (as opposed by, yes, Big-endian). This means the least significant bytes are stored in memory first, then the more significant bytes. A hassle to remember, hence our choice to calculate settings using binary data as the registry shows it.

2 Note that this is still REG_DWORD data, but presented as binary data, hexadecimal format. This is not the same binary data as the raw 32 bits set to 0 or 1. If you put 10000000 as hexadecimal in your calculator and convert to binary, you get (000)10000000000000000000000000000, by which you might conclude it's actually bit 3 (4th bit) being set...

8.E.3 Attributes

Ok, the list of attributes that apply here.They come in categories, and may differ with version of Windows. Not all do work (references: MSDN (1) | MSDN (2) | pinvoke.net):

Note we're trying to describe the attributes from our own perspective - no good for coders, yet lending a hand in molding things in shape for advanced registry fiddlers…

The ‘mask’ attributes at the end of categories are not interesting from our perspective, rather are there as a way for programmers to retrieve information about a set of attributes (what's set for these).

SFGAOF Binary Dword (Decimal)
Capability attributes
SFGAO_CANCOPY 01 00 00 00 0x00000001 (1)
  Object can be copied (has a ‘Copy’ option in context menu).
SFGAO_CANMOVE 02 00 00 00 0x00000002 (2)
  Object can be moved (has a ‘Cut’ option in context menu).
SFGAO_CANLINK 04 00 00 00 0x00000004 (4)
  Object can be linked, shortcuts created. The option to do is available during drag & drop operations, plus a ‘Create shortcut’ option is created in context menu.*
SFGAO_CANRENAME 10 00 00 00 0x00000010 (16)
  Object can be renamed (has a ‘Rename’ option in context menu).
SFGAO_CANDELETE 20 00 00 00 0x00000020 (32)
  Object can be deleted (has a ‘Delete’ option in context menu).
SFGAO_HASPROPSHEET 40 00 00 00 0x00000040 (64)
  Object has a property sheet (has a ‘Properties’ option in context menu).
SFGAO_DROPTARGET 00 01 00 00 0x00000100 (256)
  Object allows being pasted into, objects being dropped into.
SFGAO_CAPABILITYMASK 77 01 00 00 0x00000177 (375)
Display attributes
SFGAO_LINK 00 00 01 00 0x00010000 (65536)
  Object is shortcut (displays arrow icon overlay).
SFGAO_SHARE 00 00 02 00 0x00020000 (131072)
  Object is shared (displays hand icon overlay).
SFGAO_READONLY 00 00 04 00 0x00040000 (262144)
  Object has ‘read-only’ attribute.
SFGAO_HIDDEN 00 00 08 00 0x00080000 (524288)
  Object has ‘hidden’ attribute (disabled look).
SFGAO_ISSLOW 00 40 00 00 0x00004000 (16384)
  Indicates that accessing the object is a slow operation.
SFGAO_GHOSTED 00 80 00 00 0x00008000 (32768)
  Object is ‘ghosted’ (as if after being cut, disabled look).
SFGAO_DISPLAYATTRMASK 00 C0 0F 00 0x000FC000 (1032192)
Content attributes
SFGAO_HASSUBFOLDER 00 00 00 80 0x80000000 (2147483648)
  Object contains folders (expandable in explorer/plus sign).
SFGAO_CONTENTSMASK 00 00 00 80 0x80000000 (2147483648)
Storage capability attributes
SFGAO_STORAGE 08 00 00 00 0x00000008 (8)
  Object can be bound to an IStorage interface.
SFGAO_STREAM 00 00 40 00 0x00400000 (4194304)
  Indicates that the item has a stream associated with it.
SFGAO_STORAGEANCESTOR 00 00 80 00 0x00800000 (8388608)
  Children of this item are accessible through IStream or IStorage.
SFGAO_FILESYSANCESTOR 00 00 00 10 0x10000000 (268435456)
  Object contains file system folder(s).
SFGAO_FOLDER 00 00 00 20 0x20000000 (536870912)
  Object is a folder.
SFGAO_FILESYSTEM 00 00 00 40 0x40000000 (1073741824)
  Object is "part of the file system (that is, they are files, directories, or root directories").
SFGAO_STORAGECAPMASK 08 00 C5 70 0x70C50008 (1891958792)
Miscellaneous attributes
SFGAO_ENCRYPTED 00 20 00 00 0x00002000 (8192)
  Object is encrypted (use system setting on colored display).
SFGAO_NONENUMERATED 00 00 10 00 0x00100000 (1048576)
  Object is a non-enumerated object (?).
SFGAO_NEWCONTENT 00 00 20 00 0x00200000 (2097152)
  Object has new content (should show bold in explorer tree).
SFGAO_VALIDATE 00 00 00 01 0x01000000 (16777216)
  Object/content is checked - no cached information is used.
SFGAO_REMOVABLE 00 00 00 02 0x02000000 (33554432)
  Object is on removable media, or a removable device itself.
SFGAO_COMPRESSED 00 00 00 04 0x04000000 (67108864)
  Object is compressed (use system setting on colored display).
SFGAO_BROWSABLE 00 00 00 08 0x08000000 (134217728)
  The specified items can be browsed in place (?).
Defunct (?) attributes
SFGAO_CANMONIKER 00 00 40 00 0x00400000 (4194304)
  Possible to create monikers for object(s).
SFGAO_HASSTORAGE 00 00 40 00 0x00400000 (4194304)
  ?

8.E.4 Example, the Recycle bin

Your desktop recycle bin is a shell object/folder. In its attributes is defined you can't rename or delete it. By adding the SFGAO_CANRENAME flag to the existing attributes you can, though. Default value is 40 01 00 20. This means below attributes are set. This simple addition shows how it should look to be able to rename the bin:

SFGAO_HASPROPSHEET : 40 00 00 00  
SFGAO_DROPTARGET : 00 01 00 00
SFGAO_FOLDER : 00 00 00 20

+
40 01 00 20  
SFGAO_CANRENAME : 10 00 00 00  

+
50 01 00 20  
Top Top
© Some rights reserved | accessibility | xhtml 1.1 | sitemap | search | msgboard | disclaimer