-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable 64-bit registry access with 32-bit nodejs #18
Comments
But before that, do a quick benchmark comparing 64-bit cscript with 32-bit cscript + ExecMethod. |
Benchmark (comment copied from node-regedit#7) See cscript-registry-benchmark and its output. Calling The relevant bit of the output is (the third column is the difference to the agnostic duration):
As the third row shows, a small speed gain can be made by reusing the method object: ' Initialize
set method = registry.Methods_("GetStringValue")
' Then later ..
Set params = method.Inparameters
params.hDefKey = .. Instead of doing PS. You might see "20000 sec" in the output, that's a formatting mistake, should be 2 seconds. |
On an x64 machine:
C:\Windows\Sysnative\cscript.exe
exists, use that for registry queries. Then the bitness of nodejs won't matter anymore, and the 64-bits registry can always be accessed (without resorting to the slower ExecMethod with ProviderArchitecture flag, like node-regedit does)process.arch == "x64"
, findcscript
inPATH
and assume it's 64-bitsprocess.arch == "ia32"
, findcscript
inPATH
and assume it's 32-bits: skip the additional Wow6432Node key searches, because the software keys will be redirected to the WoW64 registry anyway.Another solution is detecting the bitness of the
cscript
executable found inPATH
,with something similar to C++'s GetBinaryType or node'swithprocess.arch
PROCESSOR_ARCHITECTURE
which is set to "x86" under WoW64. But this would require additional interprocess communication and another spawned process - and in the end, probably wouldn't be faster than the ExecMethod way.Edit: let's not over-optimize. Note to self: beware of the second system effect. New plan:
cscript
with a preference for the native 64-bit version, so first in%SystemRoot%\Sysnative
then inPATH
. If%SystemRoot%\Sysnative\cscript.exe
doesn't exist, that's a problem with the user's configuration we can't fix or foresee - so not our concern.The text was updated successfully, but these errors were encountered: