Files
orca/native/windows-security/index.js
T
Neil 3931660639 fix(windows): start the WSL holder outside Orca's jobs so a crash doesn't take it down (#36178)
* fix(windows): start the WSL holder outside Orca's jobs so a crash doesn't take it down

* test(windows): prove the job closed with a non-breakaway control before checking the holder
2026-10-29 18:57:42 -07:00

33 lines
1.6 KiB
JavaScript

'use strict'
// Load lazily because non-Windows installs have no addon, including during test collection.
let addon = null
function getAddon() {
if (!addon) {
addon = require('./build/Release/orca_windows_security.node')
}
return addon
}
module.exports = {
currentUserSid: () => getAddon().currentUserSid(),
getDaclAces: (path) => getAddon().getDaclAces(path),
setDaclSddl: (path, sddl) => getAddon().setDaclSddl(path, sddl),
setDaclSddlAsync: (path, sddl) => getAddon().setDaclSddlAsync(path, sddl),
createFileWithDacl: (path, sddl, data, strict) =>
getAddon().createFileWithDacl(path, sddl, data, strict),
readFileWithDacl: (path, maxBytes) => getAddon().readFileWithDacl(path, maxBytes),
readGenericCredential: (target) => getAddon().readGenericCredential(target),
writeGenericCredential: (target, user, data) =>
getAddon().writeGenericCredential(target, user, data),
grantAccess: (path, sid, mask, options) => getAddon().grantAccess(path, sid, mask, options),
grantAccessAsync: (path, sid, mask, options) =>
getAddon().grantAccessAsync(path, sid, mask, options),
clearStdHandleInheritance: () => getAddon().clearStdHandleInheritance(),
spawnDetachedIsolated: (file, commandLine, cwd, environmentBlock, onExit) =>
getAddon().spawnDetachedIsolated(file, commandLine, cwd, environmentBlock, onExit),
isolatedSpawnBreaksAwayFromJob: () => getAddon().isolatedSpawnBreaksAwayFromJob(),
// Reads the binding this package resolved, so a build probe tests the binary the app loads.
hasNativeExport: (name) => typeof getAddon()[name] === 'function'
}