Git Product home page Git Product logo

node-winreg's Introduction

NPM

Join the chat at https://gitter.im/fresc81/node-winreg

node-winreg

node module that provides access to the Windows Registry through the REG commandline tool

Installation

The following command installs node-winreg.

npm install winreg 

If you prefer to install without the development tools used to generate the HTML documentation (into a production environment for example) you should use the following command.

npm install winreg --production

Note that the development dependencies will not be installed if this package was installed as a dependency of another package.

Documentation

The documentation is generated using jsdoc with the docstrap template. You can view the API documentation online, download the latest documentation or generate it from the sourcecode.

Online Documentation

View the latest docs online.

Download Documentation

To download the latest docs from GIT the following command is used.

npm run-script download-docs

Generate Documentation

To generate the docs from the sources you can use the following command.

npm run-script generate-docs

Note that generating the docs requires the development dependencies to be installed.

Example Usage

Let's start with an example. The code below lists the autostart programs of the current user.

var Registry = require('winreg')
,   regKey = new Registry({                                       // new operator is optional
      hive: Registry.HKCU,                                        // open registry hive HKEY_CURRENT_USER
      key:  '\\Software\\Microsoft\\Windows\\CurrentVersion\\Run' // key containing autostart programs
    })

// list autostart programs
regKey.values(function (err, items /* array of RegistryItem */) {
  if (err)
    console.log('ERROR: '+err);
  else
    for (var i=0; i<items.length; i++)
      console.log('ITEM: '+items[i].name+'\t'+items[i].type+'\t'+items[i].value);
});

Troubleshooting

Access to restricted keys

Since Windows Vista access to certain Registry Hives (HKEY_LOCAL_MACHINE or short HKLM for example) is restricted to processes that run in a security elevated context even if the user that starts the process is an admin. You can start a console within that context by right clicking the console shortcut and selecting the item with the shield icon called "Run as administrator" from the context menu.

Under some rare circumstances access to Registry Hives or particular keys may also be blocked by some antivirus programs or the Windows Group Policy Editor (google for gpedit.msc).

You can also use the regedit.exe tool shipped with Windows to check if you actually have access.

Processing UTF-8 data

The Microsoft Windows console isn't capable of handling UTF-8 encoded text unless you set it up properly. If you see weird question marks for certain characters, it's probhably a problem with the encoding.

By default the console is setup to use an encoding that suits the language of the Windows operating system installation. Windows uses codepages to specify encodings for the console. The codepage is a unique number which is assigned to each encoding.

If you want to query the currently selected codepage you can type the command chcp (w/o parameters). To set a new codepage (UTF-8 for this example) you pass the codepage number as the only argument to chcp. The codepage value for UTF-8 is 65001.

You can easily do this from within your nodejs script by using the child_process.execSync(...) function like the following example shows.

var execSync = require('child_process').execSync;
console.log(execSync('chcp').toString());
console.log(execSync('chcp 65001').toString());

An even better approach would be to extract and store the value returned by a call to chcp prior setting the console to UTF-8 and resetting the codepage after your script is done.

License

This project is released under BSD 2-Clause License.

Copyright (c) 2016, Paul Bottin All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

node-winreg's People

Contributors

ceresith avatar charliehess avatar feross avatar fresc81 avatar galkon avatar gitter-badger avatar gpetrov avatar hawkins avatar justinmchase avatar mikeyoon avatar qwibbert avatar rosen-vladimirov avatar rx14 avatar teobugslayer avatar timotheejeannin avatar zren avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

node-winreg's Issues

Future maintenance?

@fresc81, I noticed that there are some pull requests, one of which is my own, that have been hanging around for a long time. If you are busy or no longer have interest in the project, any chance you can assign another contributor to the project? I'm willing to do it myself if needed.

error in proc.on('close', function (code)

when querying for the subkeys of a key
in

for (var i = 0, l = lines.length; i < l; i++)

the first line from the reg query contains only "\r"
to avoid returning this you apparently "skip" it with the code

   if (line.length > 0) {
      log(line);
      if (lineNumber != 0) {
        items.push(line);
      }
      ++lineNumber;
    }

but for lines with only "\r", trim removes them and so the line.length is 0 and lineNumber is not incremented and so the first line with something other than spaces or \r is skipped.

lines[0].length -> 1
lines[0].trim().length ->0

Have not done it yet but it would seem that just removing the if (lineNumber != 0) and simply pushing the line would work but am not sure it that is the only reason this was placed here.

In any case I am having other issues but found this along the way and easier to report now so perhaps its the other issue which I have not found yet

Issues with 0.0.14 (0.0.13 works)

I am using Node 5.3.0, NPM 3.3.12... (also tried in Node 4.2.3, NPM 2.14.7)

The following simple functional test works in 0.0.13, but fails with the error shown below in 0.0.14:

> var winreg = require('winreg');
undefined
> var regKey = winreg({hive:winreg.HKLM});
undefined
> regKey.keys(function (err, data) {console.log(data);});
TypeError: Cannot read property 'on' of null
    at captureOutput (C:\Users\Shawn\winreg-test\node_modules\winreg\lib\registry.js:50:15)
    at Registry.keys (C:\Users\Shawn\winreg-test\node_modules\winreg\lib\registry.js:304:16)
    at repl:1:8
    at REPLServer.defaultEval (repl.js:252:27)
    at bound (domain.js:287:14)
    at REPLServer.runBound [as eval] (domain.js:300:12)
    at REPLServer.<anonymous> (repl.js:417:12)
    at emitOne (events.js:82:20)
    at REPLServer.emit (events.js:169:7)
    at REPLServer.Interface._onLine (readline.js:210:10)
> .exit

Unable to set "(Default)" value

Windows creates a value for every key called "(Default)" and Im unable to change it.
If I create a key

var rootKey = new winreg({
      hive: winreg.HKCR,
      key:  '\\Test'
    });

At this point the value "(Default)" as been created by windows automatically set to nothing.
Using the code below I try and set the value to "Some value"
rootKey.set("(Default)", winreg.REG_SZ, "Some value", function() {});
This code just ends up creating a new one called "(Default)" rather then changing the value.

PATCH WinReg : ITEM_PATTERN is too restrictive

I found that your regex pattern is too restrictive (ITEM_PATTERN). Register name can have - and \ as well.

You can use
ITEM_PATTERN = /^([a-zA-Z0-9_\s-]+)\s(REG_SZ|REG_MULTI_SZ|REG_EXPAND_SZ|REG_DWORD|REG_QWORD|REG_BINARY|REG_NONE)\s+([^\s].*)$/

Unable to set value for a registry key

Hi,

I am trying to set a Registry key/value in windows 7 (32 Bit). However, I keep getting the error:

[Error: process exited with code 1]

The code I am using is:


var Winreg = require('winreg');

regKey = new Winreg({
hive: Winreg.HKLM,
key: '\System\CurrentControlSet\Control\Session Manager\Environment'
});

regKey.set('SOME_KEY', Winreg.REG_SZ, '1', function (err) {
console.log(err);
});


What am I doing wrong?

Other methods like regKey.values() and regKey.get() work fine.

Any help would be great. Thanks :)

Version 1.2.5 breaks on complex registry value

I am setting REG_SZ with "C:\Users\vilicvane\AppData\Roaming\npm\node_modules\desktop-matters\node_modules\startup-run\bin\hideexec.exe" "C:\Program Files\nodejs\node.exe" "C:\Users\vilicvane\AppData\Roaming\npm\node_modules\desktop-matters\node_modules\startup-run\bld\daemon\main.js" "{\"name\":\"desktop-matters\",\"command\":\"C:\\Program Files\\nodejs\\node.exe\",\"args\":[\"C:\\Users\\vilicvane\\AppData\\Roaming\\npm\\node_modules\\desktop-matters\\bld\\cli\\main.js\",\"--startup\"],\"cwd\":\"C:\\Users\\vilicvane\",\"env\":{},\"log\":\"C:\\Users\\vilicvane\\desktop-matters.log\",\"respawn\":1000}", and with 1.2.5 it no longer works.

Possibly due to the shell: false update.

Creating a key should use the force parameter

In the case that the key already exists, you get hit with a prompt that you can do nothing about.
So we should use the /f parameter in this case as well (it's already been added to the other methods).

@angular/cli

ERROR in ./~/winreg/lib/registry.js
Module not found: Error: Can't resolve 'child_process' in 'c:\Project\machine\node_modules\winreg\lib'

on a cleaned project in angular 2.

var Registry = require('winreg');

Unable to read some keys (Windows 8)

I am trying to Query Windows Install Date on a Windows 8.1 system

HKLM
\SOFTWARE\Microsoft\Windows NT\CurrentVersion
InstallDate

and for some reason it is coming up as 0. I am not sure if this is an access/permissions issue on Windows 8.1 or a bug here.

I tested on XP (with your header patch) and Windows 7 pro and it works fine.

I do know that if I query this key via a js file and Cscript it does show correctly.

var shell = new ActiveXObject("WScript.Shell");
var i = shell.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\InstallDate");
WScript.StdOut.Write(i);

Cannot write new registry value to HKLM.

I'm trying to write a string value to start up key in HKLM but nothing is written and no errors are shown. Can anyone shine some light on what is happening??? I can do the same to current user HKCU but not the HKLM. Do not know if there is some sort of privileges I need to set or something.
Here is code for HKCU that works:
var Winreg = require('winreg')
, regKey = new Winreg({
hive: Winreg.HKCU, // HKEY_CURRENT_USER
key: '\SOFTWARE\Microsoft\Windows\CurrentVersion\Run' // key containing autostart programs
})
Here is for HKLM that does not work
var Winreg = require('winreg')
, regKey = new Winreg({
hive: Winreg.HKLM, // HKEY_LOCAL_MACHINE
key: '\SOFTWARE\Microsoft\Windows\CurrentVersion\Run' // key containing autostart programs
})

My string value:
regKey.set('RunMyProg', 'REG_SZ', 'Some command ..... here', function () {});

Any help would be much appreciated.
Thanks in advance.

path error when using host option

The path getter has a bug in it
instead of (host):

this.defineGetter('path', function () { return (_host.length == 0 ? '' : '\\' + host + '\') + _hive + _key; });

it should be (_host)

this.defineGetter('path', function () { return (_host.length == 0 ? '' : '\\' + _host + '\') + _hive + _key; });

Problem with 'pkg'

It works with "node launcher". However if I use "pkg" to compile this node program and run it, Then..

{ ProcessUncleanExitError: QUERY command exited with code 1:

ERROR: The system was unable to find the specified registry key or value.
at mkErrorMsg (D:\snapshot\Maple\node_modules\winreg\lib\registry.js:111:12)
at ChildProcess. (D:\snapshot\Maple\node_modules\winreg\lib\registry.js:632:10)
at ChildProcess.emit (events.js:159:13)
at maybeClose (internal/child_process.js:943:16)
at Socket.stream.socket.on (internal/child_process.js:363:11)
at Socket.emit (events.js:159:13)
at Pipe._handle.close [as _onclose] (net.js:558:12) name: [Getter], message: [Getter], code: [Getter] }
TypeError: Cannot read property 'value' of null
at D:\snapshot\Maple\launcher.js:0:0
at ChildProcess. (D:\snapshot\Maple\node_modules\winreg\lib\registry.js:632:7)
at ChildProcess.emit (events.js:159:13)
at maybeClose (internal/child_process.js:943:16)
at Socket.stream.socket.on (internal/child_process.js:363:11)
at Socket.emit (events.js:159:13)
at Pipe._handle.close [as _onclose] (net.js:558:12)

Please check it, Thanks!

Particular key value is unreadable...

I cannot read this key with winreg:

var VS7 = new WinReg({
    hive: WinReg.HKLM,
    key: '\\' + path.join('SOFTWARE', wowNode, 'Microsoft', 'VisualStudio', 'SxS', 'VS7')
});
VS7.get('12.0', callback); // result is null

All of the other values in that key work fine just not that one. I'm assuming it has to do with the fact that it's a number? Or has a . perhaps? I don't know what's going wrong, there is no error its just null.

Registry.erase(cb) leaves behind the key (while deleting all the name/value pairs).

This is because you use the /va argument.

  /va        delete all values under this key.

Erase is a good name for this operation, so I'd suggest updating the docs that it doesn't actually delete the key, and make another function that deletes the key and all descendant keys.

Just leave out the /va argument for the Registry.delete() function. Eg: https://github.com/Zren/atom-windows-context-menu/blob/master/lib/registry.js#L506

WSL interop

winreg can still access reg.exe even when process.platform is not win32.

WSL runtime can be tested with package like is-wsl.

Default value on get

Hi,
how to specify the default value on registry.get method using Registry.DEFAULT_VALUE?
Found in documentation for get method this , but not sure how to use it:

the value name, use Registry.DEFAULT_VALUE or an empty string for the default value

For example:

ServerRegKey.get('serverName', function (err, item) {
  if(!err){
    serverName = item.value;
  } else {
    console.log('---bin.js--55-- Error on getting server name', err);
  }
})

Thanks!

Issue with Genymotion installation

Hi all,

Genymotion is a very popular Android emulator, which is preferred by developers due to its speed and ease to use. The issue is that it contains an "reg.exe". If the user manually adds its directories to the PATH before the Windows directory, node-winreg tries to use it.

The fix would be to always use %windir%\system32\reg.exe

if the value is chinese,it will be messy code

function getPath(callback){
var Winreg = require('winreg');
var regKey = new Winreg({
hive: Winreg.HKCU,
key: '\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders'
});
var myPath = regKey.values(function(err, items) {
for (var i in items) {
if (items[i].name === 'Personal') {
callback(items[i].value);
}
}
});
}

check this out
if the Personal value is in chinese, the value in the callback will be messy code.
does anybody know how to resolve this?

Cannot write to HKCR

I am trying to write some keys to HKCR - this does not seem to work:

ERROR: Access is denied.
    at mkErrorMsg (app\node_modules\winreg\lib\registry.js:117:12)
    at ChildProcess.<anonymous> (app\node_modules\winreg\lib\registry.js:735:10)

Is this expected? Should access to HKCR be restricted for an application NOT running in admin mode (even if the user is an admin)?

Promises

I am finding this library quite hard to use with all the asynchronous callbacks. I am trying to compile a list of installed software and patches which requires looping through multiple keys and stepping down into each one to retrieve multiple subkeys. Therefore I need some way to guarantee I can append all this data to my lists after all callbacks are completed. So, is there anyway I can do this? Does this library perhaps support promises?

keyExists does not throw error when Registry editing has been disabled by your administrator.

Current behaviour

When registry editing is prohibited, then keyExists return false.

Expected behaviour

keyExists should throw same ProcessUncleanExitError like other functions:

C: ADD command exited with code 1:

ERROR: Registry editing has been disabled by your administrator.

Proposed solution

keyExists should check for error message "The system was unable to find the specified registry key or value." too. Since reg.exe fails with error code 1 for various reasons. Note: seems to me, that reg.exe does not localize messages (while regedit.exe does localize).

How to simulate

See https://www.online-tech-tips.com/windows-xp/registry-disabled-by-administrator/ :

  1. Run gpedit.msc,
  2. Navigate to User Configuration – Administrative Templates – System,
  3. Change Prevent access to registry editing tools.
  4. Optional: run gpupdate.exe from command line.

process.env.windir is undefined in some shells

running node in a bash shell, for example, function getRegExePath() (in registry.js) fails calling path.join because process.env.windir is undefined. As a workaround, i added the following at the top of my main code:

// hack to allow reg to run in other shells
process.env.windir ||= "C:\\Windows"

Error at SET if space in key or value

Hello

we get the following ERROR if a space is in the key or value of the set method
ProcessUncleanExitError: ADD command exited with code 1:
FEHLER: Ungültige Syntax.
Geben Sie "REG ADD /?" ein, um die Syntax anzuzeigen.

method call:
key.set("URL Protocol", WinReg.REG_SZ, '', (err)=> {
});

or

key2.set(WinReg.DEFAULT_VALUE, WinReg.REG_SZ, '"ExeFileFolder\ExeFileName" "--deeplink=%1"', (err)=> {
});

Info:
it works on CMD
`
C:>reg add HKCU\SOFTWARE\Classes\testKB /v "URL Protocol" /t REG_SZ /d "" /f
Der Vorgang wurde erfolgreich beendet.

C:>reg query HKCU\SOFTWARE\Classes\testKB /v "URL Protocol"
HKEY_CURRENT_USER\SOFTWARE\Classes\testKB
URL Protocol REG_SZ
`

update 1:
key.set("\"URL Protocol\"",..
results in exteme cpu usage and forever running thread

update 2:
version 1.2.4 works!!! (with pure NodeJS and in my electron v18 app)
version 1.2.5 also NOT ok if I took the set method from 1.2.4 (very strange)
so I do not close the issue because 1.2.5 should also work

RangeError: Invalid string length

I have a eletron app which used this lib to get/set ProxyServer on windows and everything works fine when try get/set the reg value.

But the strange thing is that when my program runs for a while it always crashes, stacktrace as below:

RangeError: Invalid string length
    at Socket.<anonymous> (d:\Workspace\dssToolbox\node_modules\winreg\lib\registry.js:98:34)
    at Socket.emit (d:\Workspace\dssToolbox\lib\events.js:526:35)
    at addChunk (d:\Workspace\dssToolbox\lib\internal\streams\readable.js:324:12)
    at readableAddChunk (d:\Workspace\dssToolbox\lib\internal\streams\readable.js:297:9)
    at Socket.push (d:\Workspace\dssToolbox\lib\internal\streams\readable.js:234:10)
    at Pipe.onStreamRead (d:\Workspace\dssToolbox\lib\internal\stream_base_commons.js:190:23)
    at Pipe.callbackTrampoline (node:internal/async_hooks:130:17) {stack: 'RangeError: Invalid string length
    at Sock…Trampoline (node:internal/async_hooks:130:17)', message: 'Invalid string length'}

I located the code in registry.js,:

function captureOutput(child) {
  // Use a mutable data structure so we can append as we get new data and have
  // the calling context see the new data
  var output = {'stdout': '', 'stderr': ''};

  child.stdout.on('data', function(data) { output["stdout"] += data.toString(); });
  child.stderr.on('data', function(data) { output["stderr"] += data.toString(); });

  return output;
}

And add some log:

function captureOutput(child) {
  // Use a mutable data structure so we can append as we get new data and have
  // the calling context see the new data
  var output = {'stdout': '', 'stderr': ''};

  child.stdout.on('data', function(data) { 
    try {
        output["stdout"] += data.toString(); 
    } catch (error) {
        console.log(error);
        console.log(output["stdout"].length);
        console.log(data.toString());
        throw error;
    }
  });
  child.stderr.on('data', function(data) { output["stderr"] += data.toString(); });

  return output;
}

After crash, i got:

RangeError: Invalid string length
    at Socket.<anonymous> (d:\Workspace\dssToolbox\node_modules\winreg\lib\registry.js:98:34)
    at Socket.emit (d:\Workspace\dssToolbox\lib\events.js:526:35)
    at addChunk (d:\Workspace\dssToolbox\lib\internal\streams\readable.js:324:12)
    at readableAddChunk (d:\Workspace\dssToolbox\lib\internal\streams\readable.js:297:9)
    at Socket.push (d:\Workspace\dssToolbox\lib\internal\streams\readable.js:234:10)
    at Pipe.onStreamRead (d:\Workspace\dssToolbox\lib\internal\stream_base_commons.js:190:23)
    at Pipe.callbackTrampoline (node:internal/async_hooks:130:17) {stack: 'RangeError: Invalid string length
    at Sock…Trampoline (node:internal/async_hooks:130:17)', message: 'Invalid string length'}

registry.js:100
536870814
registry.js:101
ֵ ProxyServer �Ѵ��ڣ�Ҫ������(Yes/No)? ֵ ProxyServer �Ѵ��ڣ�Ҫ������(Yes/No)? ֵ ProxyServer �Ѵ��ڣ�Ҫ������(Yes/No)? ֵ ProxyServer �Ѵ��ڣ�Ҫ������(Yes/No)? ֵ ProxyServer �Ѵ��ڣ�Ҫ������(Yes/No)? 

It seems that the length of the output.stdout keeps increasing until it exceeds the upper limit.

How should I solve it (or just try-catch it)?

Any help will be very appreciated.

Accessing 32-bit registry view

Is there a way to force accessing a specific registry view?

The REG.EXE command allows the following switches:

  /reg:32  Specifies the key should be accessed using the 32-bit registry view.
  /reg:64  Specifies the key should be accessed using the 64-bit registry view.

I'm specifically trying to access a key under HKLM\Software\Wow6432Node\...

Error when packaged in electron app

Hi,

I get the following error when I run this library in electron(after I pack it into a .exe via electron-builder)

{ Error\n at mkErrorMsg (C:\\Users\\denimuser\\AppData\\Local\\Programs\\my-events\\resources\\app\\webpack:\\src\\uninstaller\\registry.js:111:12)\n at ChildProcess.<anonymous> (C:\\Users\\denimuser\\AppData\\Local\\Programs\\my-events\\resources\\app\\webpack:\\src\\uninstaller\\registry.js:541:10)\n at emitTwo (events.js:106:13)\n at ChildProcess.emit (events.js:194:7)\n at maybeClose (internal/child_process.js:899:16)\n at Socket.<anonymous> (internal/child_process.js:342:11)\n at emitOne (events.js:96:13)\n at Socket.emit (events.js:191:7)\n at Pipe._handle.close [as _onclose] (net.js:510:12) name: [Getter], message: [Getter], code: [Getter] }","timestamp":"2018-03-05 04:03:38"}

Cannot write key to HKLM even as Admin

Might be a duplicate of #16 but for the sake of consistency i'll add it here as well.

I'm running as admin (the title of the window says Administrator: Command Prompt).

I can't view and/or edit the key with the Regedit either, even when running as admin.
I can't even change the permissions of the key with Regedit.

My guess is our system admins have locked it down in a way I can't override but that's just a guess so far.

No License file

No license file associated with this project - can you use MIT License? That would help others using/modifying this.

Snippet of code that was previously working no longer works with latest update.

After the 0.0.14 update today, a portion of code we were using to get the path of ms build no longer returns any values. The version specified in our packages.json is version 0.0.11, but there are no other releases available besides 0.0.14.

The snippet that's broken is pasted below:

    var regKey = new Winreg({
        hive: Winreg.HKLM,
        key: "\\SOFTWARE\\Microsoft\\MSBuild\\ToolsVersions\\4.0"
    });

    var pathValueName = gulp.isOSWin64() ? "MsBuildToolsPath" : "MsBuildToolsPath32";

    //BROKEN LINE
    regKey.get(pathValueName, function (err, item) {
        if (err) {
            deferred.reject(err);
        }

        var msBuildPath = item.value + 'MSBuild.exe';

Is there a place which has previous releases of winreg hosted? Or are we using the function incorrectly?

Stubbing Registry method

First of all, thank you for this useful module.

I am currently using it and I would like to stub some Registry instance methods with sinonjs in my tests.
Unfortunatly I can't do it as the Registry's prototype is frozen.

Would you consider unfrozing ? And if not, what approach would you suggest to stub Registry methods ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.