7

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
    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. – music2myear Mar 1 '17 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. – Hashim Mar 1 '17 at 23:47
  • 4
4
+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).
  • 1
    "make two conjunctions"...perhaps you mean conjecture? – Twisty Impersonator May 26 '17 at 22:20
  • 1
    @Twisty: Yes, my brain did, but my fingers didn't follow. Corrected and thanks. – harrymc May 27 '17 at 6:52
  • Thanks for the research you did, and I'm really sorry I didn't award the bounty in time. – Hashim Aug 4 '17 at 3:43

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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