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.
This commit is contained in:
bincxz committed 2026-08-03 11:14:33 +08:00
1 parent a010454e10
commit 604cbbdf20
1 file changed
+6 -1
+6 -1
View File
@@ -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 = {}) {