Windows: register protocol handler without needing Admin privledges
This commit is contained in:
@@ -8,15 +8,15 @@ function registerProtocolHandler (protocol, name, command) {
|
|||||||
var Registry = require('winreg')
|
var Registry = require('winreg')
|
||||||
|
|
||||||
var protocolKey = new Registry({
|
var protocolKey = new Registry({
|
||||||
hive: Registry.HKCR, // HKEY_CLASSES_ROOT
|
hive: Registry.HKCU, // HKEY_CURRENT_USER
|
||||||
key: '\\' + protocol
|
key: '\\Software\\Classes\\' + protocol
|
||||||
})
|
})
|
||||||
protocolKey.set('', Registry.REG_SZ, name, callback)
|
protocolKey.set('', Registry.REG_SZ, name, callback)
|
||||||
protocolKey.set('URL Protocol', Registry.REG_SZ, '', callback)
|
protocolKey.set('URL Protocol', Registry.REG_SZ, '', callback)
|
||||||
|
|
||||||
var commandKey = new Registry({
|
var commandKey = new Registry({
|
||||||
hive: Registry.HKCR,
|
hive: Registry.HKCU,
|
||||||
key: '\\' + protocol + '\\shell\\open\\command'
|
key: '\\Software\\Classes\\' + protocol + '\\shell\\open\\command'
|
||||||
})
|
})
|
||||||
commandKey.set('', Registry.REG_SZ, '"' + command + '" "%1"', callback)
|
commandKey.set('', Registry.REG_SZ, '"' + command + '" "%1"', callback)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user