SHELLKEY

Each member of the SHELLKEY enumeration is an ID that selects a shell key. Interpretation works through three levels of mask to specify a root, a key and a subkey.

Mask Role Masked Constant Interpretation
0x0000000F root 0x00000001 HKEY_CURRENT_USER
0x00000002 HKEY_LOCAL_MACHINE
0x00000FF0 key 0x00000000 Software\Microsoft\Windows\CurrentVersion\Explorer
0x00000010 Software\Microsoft\Windows\Shell
0x00000020 Software\Microsoft\Windows\ShellNoRoam
0x00000030 Software\Classes
0x000FF000 subkey 0x00000000 no subkey
0x00001000 LocalizedResourceName
0x00002000 Handlers
0x00003000 Associations
0x00004000 Volatile
0x00005000 MUICache
0x00006000 FileExts

If only in the current implementation, anything other than 2 in the root mask is accepted as denoting the current user. When the shell key functions execute in an impersonating thread, the root key for the “current” user is actually not HKEY_CURRENT_USER but the appropriate branch of HKEY_USERS.

If the subkey mask produces zero (or, if only in the current implementation, any value other than listed above), then the selected shell key is just root\key. Otherwise, the selected shell key is root\key\subkey.