TimeFence: persistent focus timer HUD — buy direct, lifetime license.
Engineering ContextCleaner

How ContextCleaner Edits the Context Menu Without Destroying Anything

Published May 27, 2026 11 min read

Most tutorials for customizing the Windows context menu tell you to delete or rename registry keys. That works, but it is destructive: once a key is gone, getting it back depends on you having saved it first. ContextCleaner takes a deliberately different approach. It changes how the menu behaves without removing the underlying registrations, which is what makes every change cleanly reversible.

This is a technical deep dive into how that works — where the entries come from, how hiding and reordering are implemented as additive overrides rather than deletions, and how disabling a shell extension uses a documented Windows mechanism instead of tearing out its registration. It is written for developers, IT pros, and anyone who wants to understand the model before trusting it.

🛍️ Get ContextCleaner on the Microsoft Store →

Where context menu entries actually live

The Windows shell assembles the right-click menu at runtime from several registry locations. ContextCleaner scans the ones that matter for everyday customization:

  • HKEY_CLASSES_ROOT\* and AllFilesystemObjects — entries that appear for any file
  • HKEY_CLASSES_ROOT\Directory and Folder — entries for folders
  • HKEY_CLASSES_ROOT\Directory\Background — entries for right-clicking empty space in a window
  • HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Shell Extensions\Approved — the per-machine approved shell extensions

Within each scope, there are two structural kinds of entry:

  • Verbs under shell\<verb> — named commands, often with a display label in the default value or a MUIVerb.
  • Context menu handlers under shellex\ContextMenuHandlers\<name> — COM components, each pointing at a CLSID that resolves to a DLL.

ContextCleaner enumerates both, resolves friendly names (including following a handler’s CLSID to its registered display name), and classifies each entry’s scope from its registry path. The result is the single labeled list you see in the app, derived directly from the live registry rather than a hardcoded catalog.

Hiding is an override, not a deletion

Here is the core design decision. When you hide a verb-based entry, ContextCleaner does not delete the shell\<verb> key. Instead it writes a LegacyDisable value — the documented marker the shell honors to suppress a verb — and it writes it as a per-user override under HKEY_CURRENT_USER\Software\Classes, mirroring the path that otherwise lives under HKEY_CLASSES_ROOT.

Two things make this safe:

  1. The original registration is untouched. HKEY_CLASSES_ROOT is a merged view of machine-wide (HKLM) and per-user (HKCU) class data, with the per-user view taking precedence. By writing the suppression to HKCU\Software\Classes, ContextCleaner layers a “hide this” instruction on top of the original without modifying or removing the underlying key.
  2. Re-showing is just removing the override. To unhide, the app deletes the LegacyDisable value it added. There is nothing to reconstruct, because nothing was destroyed.

Detecting current state follows the same logic in reverse: an entry is treated as hidden if it carries a LegacyDisable or ProgrammaticAccessOnly value, so the UI reflects reality rather than a cached assumption.

Reordering uses the same additive model

Promoting and demoting between the top menu and “Show more options” works on the same principle. Demoting an entry to the extended menu sets the Extended value on the per-user override; promoting removes it. The Extended marker is the documented way to tell the shell that a verb belongs in the legacy/overflow menu rather than the primary one.

Again, nothing is deleted. A demote adds a value; a promote removes the value the app added. The whole reordering feature is expressed as the presence or absence of small per-user markers layered over the originals.

🛍️ See it work — ContextCleaner on the Microsoft Store →

Disabling a shell extension uses the documented Blocked list

Shell extensions are the COM handlers that run code while the menu is built, and they are the entries most likely to slow Explorer down. Disabling one could be done destructively by removing its registration — but that is exactly what ContextCleaner avoids.

Instead, disabling an extension writes its CLSID into:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Shell Extensions\Blocked

This Blocked key is the mechanism Windows itself provides to suppress an approved shell extension. The extension’s own registration stays intact; Windows simply declines to load any handler whose CLSID appears in the block list. Re-enabling is, once again, just removing the CLSID from that key.

Because Blocked is a machine-wide hive, writing to it requires administrator rights. ContextCleaner does not pretend otherwise or fail silently — it surfaces the elevation requirement and records the outcome in the audit log whether it succeeds or fails.

Identifying what is safe to touch

A non-destructive model still benefits from telling you what is risky to change. ContextCleaner classifies each shell extension as system or third-party by resolving the handler’s InprocServer32 DLL path, expanding environment variables Windows stores unexpanded (such as %SystemRoot% and %windir%), normalizing slashes, and checking whether the resolved path lives inside the Windows install directory.

A handler backed by a DLL under C:\Windows\System32 is treated as a Microsoft system component and triggers a warning before you disable it. One under C:\Program Files\SomeVendor is third-party and is the safer candidate. This is a heuristic, not a guarantee, but it is a well-grounded one that reliably separates “almost certainly safe to disable” from “be careful here.”

Every write goes through one safe path

The non-destructive primitives above all flow through a single apply pipeline, and that pipeline does the protective work in a consistent order:

  1. Accumulate pending changes. Toggling in the UI does not write anything; it builds a list of pending changes with a visible count.
  2. Back up first. On Apply, the affected keys are exported to a timestamped .reg snapshot before any write (when auto-backup is on, which is the default). If the backup fails, the apply aborts rather than proceeding unprotected.
  3. Apply each change as an additive override or block-list entry, as described above.
  4. Record the result in the tamper-evident audit log, with a summary of how many entries were enabled, disabled, or moved — and any error.

The cross-platform structure of the code reflects the same discipline: the Windows registry logic is isolated, and non-Windows builds substitute mock data so the UI can be developed and demonstrated without touching a real registry.

Why this model matters

The payoff of the additive approach is that reversibility is structural, not bolted on. Because every change is either a small value the app added or a CLSID it inserted into the block list, undoing a change is always “remove what we added.” Combined with the automatic .reg snapshot and the 10-step undo stack, there is no state ContextCleaner can put your menu into that it cannot take back.

That is the difference between a tool that edits the registry and a tool that manages it.

Frequently asked questions

Does ContextCleaner ever delete registry keys?

For hide, show, promote, and demote, no. Those are implemented as per-user override values that the app adds or removes. Disabling a shell extension adds a CLSID to the documented Blocked list rather than deleting the extension’s registration.

What is the difference between HKCR and the HKCU override it writes?

HKEY_CLASSES_ROOT is a merged view of machine-wide and per-user class registrations, with the per-user data taking precedence. ContextCleaner writes suppression and placement markers under HKEY_CURRENT_USER\Software\Classes, layering its instructions on top of the originals without modifying machine-wide keys.

Why does disabling some extensions ask for administrator rights?

The shell extension block list lives under HKEY_LOCAL_MACHINE, a machine-wide hive that requires elevation to write. ContextCleaner requests elevation for that operation and logs the outcome rather than failing silently.

Is the system vs. third-party label always correct?

It is a strong heuristic based on whether the handler’s DLL resolves inside the Windows directory after environment-variable expansion. That reliably identifies Microsoft system components in practice, and the app warns before disabling them, but it is a heuristic rather than an absolute guarantee.

The bottom line

ContextCleaner customizes the right-click menu by adding small, documented overrides and block-list entries rather than deleting anything. Hiding sets a LegacyDisable value under a per-user override; reordering toggles an Extended marker; disabling an extension adds its CLSID to the Blocked list. Every write is preceded by an automatic backup and recorded in a verifiable log. That is why changes are cleanly reversible by construction. Read the technical specifications on the ContextCleaner product page.

🛍️ Get ContextCleaner on the Microsoft Store →

// release_radar

Unlock a $5 Credit Toward the Automata Ecosystem.

We build native, local-first tools for professionals who refuse SaaS fatigue. Drop your email to instantly receive a $5 credit code valid for the complete Windows Productivity Bundle, plus early access to future zero-telemetry releases.