From 9b6cb4bf5f7dbfd17bf5582eeb97db7bc1d7704e Mon Sep 17 00:00:00 2001 From: "flamingo[bot]" <277372822+flamingo[bot]@users.noreply.github.com> Date: Mon, 14 Sep 2026 05:14:36 +0000 Subject: [PATCH] fix(MESHCENT-005): win-bcd.js exports two different function sets for the two branches, breaking the caller-agnostic contract of MESHCENT-005/MESHCENT-006-2 --- modules/win-bcd.js | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/modules/win-bcd.js b/modules/win-bcd.js index bc812e093..a90c6595f 100644 --- a/modules/win-bcd.js +++ b/modules/win-bcd.js @@ -120,16 +120,34 @@ function restart(delay) child.waitExit(); } +// +// Stub used on the 32-bit agent on 64-bit windows branch, where bcdedit cannot be invoked from a 32 bit process +// +function notSupported() +{ + throw ('win-bcd: this function is not supported when running a 32 bit agent on 64 bit windows'); +} + if (require('_GenericMarshal').PointerSize == 4 && require('os').arch() == 'x64') { // // 32 bit agent running on 64 bit windows, we do not expose BCD functions, because bcdedit does not work from a 32 bit process on 64 bit windows + // We still export the full API surface, but the unsupported functions throw a descriptive error instead of being undefined // module.exports = { + getKeys: notSupported, setKey: notSupported, deleteKey: notSupported, getKey: notSupported, enableSafeModeService: enableSafeModeService, disableSafeModeService: disableSafeModeService, restart: restart, isSafeModeService: isSafeModeService }; + + Object.defineProperty(module.exports, "bootMode", + { + get: function () + { + return ('NORMAL'); + } + }); } else { @@ -166,4 +184,4 @@ else } } }); -} \ No newline at end of file +}