How to use the regedit.createKey function in regedit

To help you get started, we’ve selected a few regedit examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github soapdog / patchfox / scripts / setup-win.js View on Github external
} else {
  console.log("[OK] Application found at the correct location", applicationLauncherPath)
}

// This now involves writing to the registry, I am a bit scared of that...

var valuesToPut = {
  'HKCU\\Software\\Mozilla\\NativeMessagingHosts\\patchfox': {
    'patchfox': {
      value: appManifestFile,
      type: 'REG_DEFAULT'
    }
  }
}

regedit.createKey('HKCU\\Software\\Mozilla\\NativeMessagingHosts\\patchfox', function (a, b) {
  regedit.putValue(valuesToPut, function (err) {
    if (err) {
      console.log("[ERROR] Problem writing to registry.", err)
      process.exit(1)
    } else {
      console.log("[OK] Wrote manifest path to registry.\n[INFO] Try: npm run check-win")
      process.exit(0)
    }
  })
})
github soapdog / patchfox / host_app / tools / setup-win.js View on Github external
} else {
  console.log("[OK] Application found at the correct location", applicationLauncherPath)
}

// This now involves writing to the registry, I am a bit scared of that...

var valuesToPut = {
  'HKCU\\Software\\Mozilla\\NativeMessagingHosts\\patchfox': {
    'patchfox': {
      value: appManifestFile,
      type: 'REG_DEFAULT'
    }
  }
}

regedit.createKey('HKCU\\Software\\Mozilla\\NativeMessagingHosts\\patchfox', function (a, b) {
  regedit.putValue(valuesToPut, function (err) {
    if (err) {
      console.log("[ERROR] Problem writing to registry.", err)
      process.exit(1)
    } else {
      console.log("[OK] Wrote manifest path to registry.\n[INFO] Try: npm run check-win")
      process.exit(0)
    }
  })
})
github ssbc / scuttle-shell / scripts / setup.js View on Github external
// This now involves writing to the registry, I am a bit scared of that...
  if (process.platform !== 'win32') {
    return cb(null)
  }

  let valuesToPut = {}
  valuesToPut[APPPaths.regKey] = {
    'scuttleshell': {
      value: manifestLocation,
      type: 'REG_DEFAULT'
    }
  }

  var RE = require('regedit')

  RE.createKey(APPPaths.regKey, function (err, data) {
    // great.. node-regedit doesn't seem to adhere to cb(err, data)...?
    // https://github.com/ironSource/node-regedit/issues/10
    // https://github.com/ironSource/node-regedit/issues/44
    // https://github.com/ironSource/node-regedit/issues/4
    // ps: it also has problems when embedded in an electron asar since it generates scripts on the fly
    console.log('[DEBUG] regedit.createKey result arguments:', arguments.length)
    console.dir(arguments)
    if (arguments.length === 2 && err !== null) return cb(err)
    RE.putValue(valuesToPut, function (err) {
      if (err) {
        console.error(err)
        return cb(new Error('[ERROR] Problem writing to registry. ' + err.message))
      }
      console.log('[OK] Wrote manifest path to registry.\n[INFO] Try: npm run check-win')
      cb(null)
    })
github ssbc / scuttle-shell / scripts / setup-win.js View on Github external
manifestTemplate.path = appPath
  fs.writeFileSync(appManifestFile, JSON.stringify(manifestTemplate))


  // This now involves writing to the registry, I am a bit scared of that...

  var valuesToPut = {
    'HKCU\\Software\\Mozilla\\NativeMessagingHosts\\scuttleshell': {
      'scuttleshell': {
        value: appManifestFile,
        type: 'REG_DEFAULT'
      }
    }
  }

  regedit.createKey('HKCU\\Software\\Mozilla\\NativeMessagingHosts\\scuttleshell', function (a, b) {
    regedit.putValue(valuesToPut, function (err) {
      if (err) {
        console.log("[ERROR] Problem writing to registry.", err)
        cb(1)
      } else {
        console.log("[OK] Wrote manifest path to registry.\n[INFO] Try: npm run check-win")
        cb(0)
      }
    })
  })
}
github prey / prey-node-client / lib / agent / utils / storage / windows.js View on Github external
exports.save_command = function(db_path, str, cb) {
  logger.info("SAVE COMMAND!!!!");
  values[db_path] = {
    'Prey_Command': {
      value: str,
      type: 'REG_SZ'
    }
  };
  regedit.createKey(db_path, function(err){
    if (err) {
      logger.info("ERROR CREATEKEY: " + err);
    }
    regedit.putValue(values, function(err) {
      if (err) {
        logger.info("ERROR regedit: " + err);
      }   
    })
    return cb();
  })
}
github minbrowser / min / main / registryConfig.js View on Github external
return new Promise(function (resolve, reject) {
      regedit.createKey(keysToCreate, function (err) {
        regedit.putValue(registryConfig, function (err) {
          if (err) {
            reject()
          } else {
            resolve()
          }
        })
      })
    })
  },

regedit

Read, Write, List and do all sorts of funky stuff to the windows registry using node.js and windows script host

MIT
Latest version published 2 months ago

Package Health Score

71 / 100
Full package analysis