Access Violation on getValue?
tomysshadow opened this issue · comments
This line of code in registry.js appears to be causing my NodeJS to abruptly terminate with an access violation.
// QUERY FOR VALUE SIZE & TYPE
var result = advApi.RegQueryValueExA(key.handle.deref(), valueName, null, pKeyType, null, pKeyDataLength);
This is my code...
var WindowsRegistry = require("windows-registry");
var internetSettingsKey = new WindowsRegistry.Key(WindowsRegistry.windef.HKEY.HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings", WindowsRegistry.windef.KEY_ACCESS.KEY_QUERY_VALUE | WindowsRegistry.windef.KEY_ACCESS.KEY_SET_VALUE);
local.internetSettings.proxyServer = internetSettingsKey.getValue("ProxyServer");
local.internetSettings.proxyEnable = internetSettingsKey.getValue("ProxyEnable");
In debug output, I can see it attempting to invoke the function...
ref allocating Buffer for type with "size" 4 +1ms
ref setting value on allocated buffer <Buffer@0x00000206B0DC16A0 00 00 00 00 00 00 00 00> +0ms
ref set(): (offset: 0) <Buffer@0x00000206B0DC16B0 00 00 00 00 00 00 00 00> <Buffer@0x00000206B0DC16A0 00 00 00 00 00 00 00 00> +1ms
ref writing pointer to buffer <Buffer@0x00000206B0DC16B0 00 00 00 00 00 00 00 00> 0 <Buffer@0x00000206B0DC16A0 00 00 00 00 00 00 00 00> +0ms
ref allocating Buffer for type with "size" 4 +0ms
ref setting value on allocated buffer <Buffer@0x00000206B0DC15B0 00 00 00 00 00 00 00 00> +0ms
ref set(): (offset: 0) <Buffer@0x00000206B0DC13D0 00 00 00 00 00 00 00 00> <Buffer@0x00000206B0DC15B0 00 00 00 00 00 00 00 00> +0ms
ref writing pointer to buffer <Buffer@0x00000206B0DC13D0 00 00 00 00 00 00 00 00> 0 <Buffer@0x00000206B0DC15B0 00 00 00 00 00 00 00 00> +0ms
ref dereferencing buffer <Buffer@0x00000206B0DC1710 10 04 00 00 00 00 00 00> +0ms
ref get(): (offset: 0) <Buffer@0x00000206B0DC1710 10 04 00 00 00 00 00 00> +1ms
ffi:_ForeignFunction invoking proxy function +8ms
ref allocating Buffer for type with "size" 0 +0ms
Am I using this wrong?
What version of Node are you using please, and what's in your registry there? In particular does that key exist, and are the values REG_SZ type of a reasonable length, or are they missing, or something else?
Do you get a stack trace with any information in it? You don't see an error code thrown by windows-registry-node? Thanks!
Hi RupW,
No, there is no error code thrown by windows-registry-node. Rather, the NodeJS process itself is getting terminated because of an Access Violation. The ProxyServer key does exist, it is a REG_SZ with a value of "127.0.0.1:8888". The expected behaviour is to receive this string.
To be sure, I updated to 10.14.2 LTS and I'm still having the problem.
Hi, adding on to this.
I've discovered that this issue only occurs with debugging on. If I start NodeJS with this command as I've been doing...
set DEBUG=* & node index.js
Then the crash occurs. If I instead use this command:
set DEBUG="" & node index.js
The issue no longer occurs and the value is found successfully.