12

In the Windows registry, adding the LegacyDisable string value to a key serves the purpose of instructing Windows to disregard the key, its values and any of its subkeys and subvalues, effectively disabling it.

For example, adding the LegacyDisable string value to the following key:

HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell\opennewwindow

...disables opennewwindow, removing the "Open in New Window" item from Windows Explorer's context menu. CCleaner's context menu cleanup tools also make use of LegacyDisable for this purpose.

However, documentation on the string value seems non-existent; I've not been able to find anything at all documenting it, either on here or via Google, so I'm left confused about where it came from, whether disabling registry keys is all it was ever intended for, and why it's not documented.

Is disabling registry keys LegacyDisable's only purpose?

When used to disable registry keys, how does its behaviour differ from the other method employed by CCleaner - prepending plain text to a string value's hex data? Why does CCleaner employ both methods?

3
  • 3
    Because Microsoft apparently has failed to publish an official document on the purpose of LegacyDisable, what you have already recorded in your "question" appears to be as much information as is actually available on this string value. Commented Mar 1, 2017 at 0:14
  • If it goes as far back as NT4 the next natural question would be why on earth it's still allowed for/relied on for modern systems. Commented Mar 1, 2017 at 23:47
  • 4
    See this:: msdn.microsoft.com/en-us/library/windows/desktop/…
    – Biswapriyo
    Commented May 24, 2017 at 17:46

1 Answer 1

7
+25

I did some sleuthing work on LegacyDisable that I detail below.

This method is documented by Microsoft in the article Verbs and File Associations - Registering Verbs for Backward Compatibility:

Some applications may search the registry for verb keys that are no longer used. For that purpose, those keys can be left in the registry with the addition of the LegacyDisable value to the verb's key, which tells the system that the verb is not an actual verb, but exists solely for the purpose of backward compatibility.

Use of the LegacyDisable value is shown here. The value only needs to be present; it can be of any value type (though REG_NONE is most appropriate) and does not require any data to be associated with it. If data is present, it is ignored.

* KEY_CLASSES_ROOT
  *  Application
    *   shell
       *  open
            (Default) = &Open
            LegacyDisable
            *  command
                (Default) = command line 

The use of LegacyDisable seems limited for disabling shell-context verbs, as it is always only described in this context.

This method is used by the utility ShellMenuView where it says "this Registry key is not supported by Windows 98", so it seems that it originated in Windows NT.

I have found this method referenced in two books :

  • Windows 7 Annoyances (2010), page 179 :

See a context menu item you want to get rid of? Just delete the corresponding action key (e.g., New, Open, Print), and it’ll disappear immediately. Better yet, add a string value named LegacyDisable to the key to hide it in Windows Explorer without having to delete anything.

  • Windows Registry Troubleshooting, page 100

Under these locations you will see subkeys for the third-party software that has plugged itself into your context menus. There are several ways to handle them. You can delete the keys to remove them completely. To force them to show only on a Shift+right click, add a string value to each called "Extended", or to leave them in the Registry but disable them, add a string value called "LegacyDisable".

I think that is about all the useful information that can be found for LegacyDisable.

As to why CCleaner employs this method together with the other method of destroying the key, I can only make two conjectures:

  1. The code was written by two different programmers, one of whom did not know about LegacyDisable
  2. The key destruction method is used for cases where LegacyDisable does not work (not shell-context verbs).
3
  • 1
    "make two conjunctions"...perhaps you mean conjecture? Commented May 26, 2017 at 22:20
  • 1
    @Twisty: Yes, my brain did, but my fingers didn't follow. Corrected and thanks.
    – harrymc
    Commented May 27, 2017 at 6:52
  • Thanks for the research you did, and I'm really sorry I didn't award the bounty in time. Commented Aug 4, 2017 at 3:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .