Skip to content

armgit / orca

Public Imported from GitHub
0

Orca is the place for working with a fleet of agents (e.g. Grok Bot, Claude Code). Run any coding agent with your own subscription. Available on desktop, mobile and remote runtime.

849 B
Raw Blame
'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_registry.node')
  }
  return addon
}

const HK = {
  CR: 0x80000000,
  CU: 0x80000001,
  LM: 0x80000002,
  U: 0x80000003,
  PD: 0x80000004,
  CC: 0x80000005,
  DD: 0x80000006
}

function getRegistryKey(root, path) {
  const values = getAddon().getKey(root, path)
  if (!values) {
    return null
  }
  // Null-prototype: a value literally named __proto__ would otherwise reassign the prototype
  // instead of becoming an entry, and silently break the keyed-value contract.
  const byName = Object.create(null)
  for (const value of values) {
    byName[value.name] = value
  }
  return byName
}

module.exports = { HK, getRegistryKey }