function registerProtocolHandlerWin32 (protocol, name, icon, command) {
    const protocolKey = new Registry({
      hive: Registry.HKCU, // HKEY_CURRENT_USER
      key: '\\Software\\Classes\\' + protocol
    })

    setProtocol()

    function setProtocol (err) {
      if (err) return log.error(err.message)
      protocolKey.set('', Registry.REG_SZ, name, setURLProtocol)
    }

    function setURLProtocol (err) {
      if (err) return log.error(err.message)
      protocolKey.set('URL Protocol', Registry.REG_SZ, '', setIcon)
    }

    function setIcon (err) {
      if (err) return log.error(err.message)

      const iconKey = new Registry({
        hive: Registry.HKCU,
        key: `\\Software\\Classes\\${protocol}\\DefaultIcon`
      })
      iconKey.set('', Registry.REG_SZ, icon, setCommand)
    }

    function setCommand (err) {
      if (err) return log.error(err.message)

      const commandKey = new Registry({
        hive: Registry.HKCU,
        key: `\\Software\\Classes\\${protocol}\\shell\\open\\command`
      })
      commandKey.set('', Registry.REG_SZ, `${commandToArgs(command)} "%1"`, done)
    }

    function done (err) {
      if (err) return log.error(err.message)
    }
  }
To add a protocol handler, the following keys must be added to the Windows registry:

HKEY_CLASSES_ROOT
  $PROTOCOL
    (Default) = "$NAME"
    URL Protocol = ""
    DefaultIcon
      (Default) = "$ICON"
    shell
      open
        command
          (Default) = "$COMMAND" "%1"

Source: https://msdn.microsoft.com/en-us/library/aa767914.aspx

However, the "HKEY_CLASSES_ROOT" key can only be written by the Administrator user.
So, we instead write to "HKEY_CURRENT_USER\Software\Classes", which is inherited by
"HKEY_CLASSES_ROOT" anyway, and can be written by unprivileged users.