[Fix VC runtime detection] [Remote mount changes]

This commit is contained in:
2019-10-07 16:18:03 -05:00
parent 52cd85ca6f
commit 522626e808
5 changed files with 101 additions and 62 deletions

View File

@@ -488,46 +488,56 @@ module.exports.getMissingDependencies = dependencies => {
};
const Registry = require('winreg');
for (const dep of dependencies) {
let hive = null;
const hiveName = dep.registry[0].split('\\')[0];
switch (hiveName) {
case 'HKEY_CLASSES_ROOT':
hive = Registry.HKCR;
break;
case 'HKEY_CURRENT_CONFIG':
hive = Registry.HKCC;
break;
case 'HKEY_CURRENT_USER':
hive = Registry.HKCU;
break;
case 'HKEY_LOCAL_MACHINE':
hive = Registry.HKLM;
break;
case 'HKEY_USERS':
hive = Registry.HKU;
break;
default:
throw Error('Invalid registry hive: ' + hiveName);
}
const key = dep.registry[0].substr(hiveName.length);
const regKey = new Registry({
hive: hive,
key: key
});
regKey.valueExists('DisplayName', (err, exists) => {
if (err || !exists) {
regKey.valueExists('ProductName', (err, exists) => {
if (err || !exists) {
missing.push(dep);
}
resolveIfComplete();
});
} else {
resolveIfComplete();
const checkRegistry = (dep, index) => {
if (index >= dep.registry.length) {
missing.push(dep);
resolveIfComplete();
} else {
let hive = null;
const hiveName = dep.registry[index].split('\\')[0];
switch (hiveName) {
case 'HKEY_CLASSES_ROOT':
hive = Registry.HKCR;
break;
case 'HKEY_CURRENT_CONFIG':
hive = Registry.HKCC;
break;
case 'HKEY_CURRENT_USER':
hive = Registry.HKCU;
break;
case 'HKEY_LOCAL_MACHINE':
hive = Registry.HKLM;
break;
case 'HKEY_USERS':
hive = Registry.HKU;
break;
default:
throw Error('Invalid registry hive: ' + hiveName);
}
});
const key = dep.registry[index].substr(hiveName.length);
const regKey = new Registry({
hive: hive,
key: key
});
regKey.valueExists('DisplayName', (err, exists) => {
if (err || !exists) {
regKey.valueExists('ProductName', (err, exists) => {
if (err || !exists) {
checkRegistry(dep, ++index);
} else {
resolveIfComplete();
}
});
} else {
resolveIfComplete();
}
});
}
};
for (const dependency of dependencies) {
checkRegistry(dependency,0);
}
} else {
for (const dep of dependencies) {