From 604cbbdf203be3be2f13c7a3f71de1c7dbcd42ce Mon Sep 17 00:00:00 2001 From: bincxz <16399091+binaricat@users.noreply.github.com> Date: Mon, 3 Aug 2026 11:14:33 +0800 Subject: [PATCH] fix(windows): roll back partial Explorer menu suppression writes Codex P2 on #2671: if only one ProgrammaticAccessOnly value is written during disable, delete the partial key so disable never leaves a single hidden verb while the other remains visible. --- electron/explorerContextMenu.cjs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/electron/explorerContextMenu.cjs b/electron/explorerContextMenu.cjs index ec6f1ff83..9e1aa4f94 100644 --- a/electron/explorerContextMenu.cjs +++ b/electron/explorerContextMenu.cjs @@ -260,6 +260,8 @@ function isUserSuppressed(options = {}) { function writeUserSuppression(options = {}) { // HKCU Classes values override HKLM for the same key path. Marking the verb // ProgrammaticAccessOnly hides it in Explorer for this user without elevation. + // Both writes must succeed; roll back a partial pair so disable never leaves + // only one Explorer entry hidden while the other remains visible. const folderOk = writeRegStr("HKCU", DIRECTORY_SHELL_KEY, SUPPRESSION_VALUE, "", options); const backgroundOk = writeRegStr( "HKCU", @@ -268,7 +270,10 @@ function writeUserSuppression(options = {}) { "", options, ); - return folderOk && backgroundOk; + if (folderOk && backgroundOk) return true; + if (folderOk) deleteRegKey("HKCU", DIRECTORY_SHELL_KEY, options); + if (backgroundOk) deleteRegKey("HKCU", DIRECTORY_BACKGROUND_SHELL_KEY, options); + return false; } function clearUserSuppression(options = {}) {