Closed M1cr0M1nd closed 4 years ago
When trying to use DeleteValue
with the following values
:
{
"HKLM\\SOFTWARE\\Policies\\Google\\Chrome": {
"RestoreOnStartup": {
"value": "4",
"type": "REG_DWORD"
}
},
"HKLM\\SOFTWARE\\Policies\\Google\\Chrome\\RestoreOnStartupURLs": {
"1": {
"value": "https://www.google.com/",
"type": "REG_SZ"
}
}
}
The function fails at helper.js:18
:
Any clue as to what might be causing this? These values
work when using the putValue
function.
I also tried passing an array as an argument instead of an object, however, it just returns Error: vbscript process reported unknown error code 1
.
@LOHT03
Sorry, I'll update the readme in abit, but the usage is as follows: registry.deleteValue(['HKLM\SOFTWARE\Policies\Google\Chrome\RestoreOnStartup', 'HKLM\SOFTWARE\Policies\Google\Chrome\RestoreOnStartupURLs\1'])
@M1cr0M1nd, unfortunately, I am still unable to get it to work. Error: vbscript process reported unknown error code 1
is still being thrown.
Here is the function that I am using:
export function delVal(values) {
return new Promise((resolve, reject) => {
console.log(values);
deleteValue(values, err => {
if (err) {
reject(err);
} else {
resolve();
}
});
});
}
Values
(what is being logged), displays:
And I believe that is what is meant to be passed the function (If I read it correctly). The values do exist in the registry.
I also tried using the promisifed version that you included in your package but the result is the same. If it's of any help, the values
array, when the callback is being executed, is empty []
.
Am I implementing this wrong?
@LOHT03
tried this and it works (the only difference from my example is that i forgot the double '\' for escaping)
const registry = require('./index')
function delVal(values) {
return new Promise((resolve, reject) => {
console.log(values);
registry.deleteValue(values, err => {
if (err) {
reject(err);
} else {
resolve()
}
})
})
}
async function main () {
console.log('Start')
try {
await delVal(['HKLM\\SOFTWARE\\Policies\\Google\\Chrome\\RestoreOnStartup', 'HKLM\\SOFTWARE\\Policies\\Google\\Chrome\\RestoreOnStartupURLs\\1'])
} catch(e) {
console.log('err', e)
}
console.log('End')
}
main()
@M1cr0M1nd, thank you very much, managed to get it to work.
@kessler do you mind publishing it to npm? Latest version there is 3.0.3
@PickRelated certainly. We were actually meaning to do this anyway but since we don't have a proper CI setup yet we're doing the testing manually. Expect a release within 7 days.
@PickRelated published @4.0.0 Please let us know if you run into any issues, we've tested this thoroughly but still missed unit tests for the async api so that was manually tested for now
@kessler thanks a ton! I will try it out and post if something goes wrong.
deleteValue
operation to work, any documentation available for that @M1cr0M1nd?