fresc81 / node-winreg

node module that provides access to the Windows Registry through the REG commandline tool
211 stars 60 forks source link

On Windows, always use reg.exe from System32 directory #31

Closed teobugslayer closed 8 years ago

teobugslayer commented 8 years ago

See https://github.com/fresc81/node-winreg/issues/17

teobugslayer commented 8 years ago

@justinmchase,

reg.exe is subject to Windows File Protection since Windows 2000, and it would be extremely hard for the file to disappear.

Furthermore, on a multi-user, multiprocess OS, the "file exists" checks are pointless (even Node.js v5 deprecates FS.exists() API). That's because the file can cease to exist after the check was made but before the actual use.

RX14 commented 8 years ago

@teobugslayer Regarding your comment that file exists checks are pointless, this is certainly untrue. The time between the file exists check and it being used is so short that the chance of it being deleted in that small time is incredibly tiny. Node 5 deprecates that API in favour of better ones, not because it is useless.

justinmchase commented 8 years ago

Ok let's not debate the merits of checking files before attempting to read them here :)

I was merely thinking, if reg.exe wasn't at the default place then changing the behavior to use standard path rules might make sense. But based on @teobugslayer's comments it should be assumable that the file is always there and if its not then you probably have a big problem anyway. So in that case, I think its fine to assume the file location and not have backup behavior.

fresc81 commented 8 years ago

Works fine, thank you for your contribution.

teobugslayer commented 8 years ago

When can we expect to release this in the npm?

fresc81 commented 8 years ago

I just published it.

teobugslayer commented 8 years ago

Great news, thank you! I'll update to it as soon as possible.