VC runtime detection changes
This commit is contained in:
@@ -173,6 +173,13 @@ class App extends IPCContainer {
|
|||||||
<MountItems remoteSupported={remoteSupported}/>
|
<MountItems remoteSupported={remoteSupported}/>
|
||||||
</Box>
|
</Box>
|
||||||
));
|
));
|
||||||
|
} else if(selectedVersion !== 'unavailable') {
|
||||||
|
mainContent.push((
|
||||||
|
<Box dxStyle={{padding: 'var(--default_spacing)', height: '173px'}}
|
||||||
|
key={'md_' + key++}>
|
||||||
|
<Loading/>
|
||||||
|
</Box>
|
||||||
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import {downloadItem} from '../../redux/actions/download_actions';
|
|||||||
|
|
||||||
const mapStateToProps = state => {
|
const mapStateToProps = state => {
|
||||||
return {
|
return {
|
||||||
|
AllowMount: state.common.AllowMount,
|
||||||
AppPlatform: state.common.AppPlatform,
|
AppPlatform: state.common.AppPlatform,
|
||||||
DismissDependencies: state.install.DismissDependencies,
|
DismissDependencies: state.install.DismissDependencies,
|
||||||
DownloadActive: state.download.DownloadActive,
|
DownloadActive: state.download.DownloadActive,
|
||||||
@@ -35,6 +36,12 @@ const mapDispatchToProps = dispatch => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default connect(mapStateToProps, mapDispatchToProps)(props => {
|
export default connect(mapStateToProps, mapDispatchToProps)(props => {
|
||||||
|
const getSelectedVersion = () => {
|
||||||
|
return (props.ReleaseVersion === -1) ?
|
||||||
|
'unavailable' :
|
||||||
|
props.VersionLookup[Constants.RELEASE_TYPES[props.Release]][props.ReleaseVersion];
|
||||||
|
};
|
||||||
|
|
||||||
const handleDownloadRelease = () => {
|
const handleDownloadRelease = () => {
|
||||||
const fileName = props.version + '.zip';
|
const fileName = props.version + '.zip';
|
||||||
props.downloadItem(fileName, Constants.INSTALL_TYPES.Release, props.LocationsLookup[props.version].urls);
|
props.downloadItem(fileName, Constants.INSTALL_TYPES.Release, props.LocationsLookup[props.version].urls);
|
||||||
@@ -52,7 +59,10 @@ export default connect(mapStateToProps, mapDispatchToProps)(props => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const text = props.InstalledVersion + ' [' + props.AppPlatform + ']';
|
const text = props.InstalledVersion + ' [' + props.AppPlatform + ']';
|
||||||
const disabled = props.DownloadActive || props.InstallActive || props.MountsBusy;
|
const disabled = props.DownloadActive ||
|
||||||
|
props.InstallActive ||
|
||||||
|
props.MountsBusy ||
|
||||||
|
(!props.AllowMount && (getSelectedVersion() !== 'unavailable')) ;
|
||||||
const releaseExtracting = (props.InstallType === Constants.INSTALL_TYPES.Release);
|
const releaseExtracting = (props.InstallType === Constants.INSTALL_TYPES.Release);
|
||||||
|
|
||||||
let optionsDisplay = [];
|
let optionsDisplay = [];
|
||||||
|
|||||||
144
src/helpers.js
144
src/helpers.js
@@ -8,6 +8,60 @@ const spawn = require('child_process').spawn;
|
|||||||
const Constants = require('./constants');
|
const Constants = require('./constants');
|
||||||
const RandomString = require('randomstring');
|
const RandomString = require('randomstring');
|
||||||
|
|
||||||
|
let vcRuntimeExists;
|
||||||
|
|
||||||
|
const _vcRuntimeExists = () => {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
if (os.platform() !== 'win32') {
|
||||||
|
reject('Windows OS is not being used');
|
||||||
|
} else {
|
||||||
|
if (vcRuntimeExists) {
|
||||||
|
resolve(true);
|
||||||
|
} else {
|
||||||
|
const cmd = path.join(process.env.windir, 'system32', 'reg.exe');
|
||||||
|
const args = ["QUERY", "HKLM\\SOFTWARE\\WOW6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall"];
|
||||||
|
_execProcessGetOutput(cmd, null, args)
|
||||||
|
.then(lines => {
|
||||||
|
const parseLine = index => {
|
||||||
|
if (index < lines.length) {
|
||||||
|
const line = lines[index];
|
||||||
|
if (line.startsWith('HKEY_LOCAL_MACHINE\\')) {
|
||||||
|
let args2 = JSON.parse(JSON.stringify(args));
|
||||||
|
args2[1] = 'HKLM\\' + line.substr(19);
|
||||||
|
args2.push('/v');
|
||||||
|
args2.push('DisplayName');
|
||||||
|
args2.push('/t');
|
||||||
|
args2.push('REG_SZ');
|
||||||
|
_execProcessGetOutput(cmd, null, args2)
|
||||||
|
.then(lines => {
|
||||||
|
const value = lines[2].trim().substr(args2[3].length).trim().substr(6).trim();
|
||||||
|
if (value.includes('Microsoft Visual C++ 2015-2019 Redistributable (x64)')) {
|
||||||
|
vcRuntimeExists = true;
|
||||||
|
resolve(true);
|
||||||
|
} else {
|
||||||
|
parseLine(++index);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
parseLine(++index);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
parseLine(++index);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
resolve(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
parseLine(0);
|
||||||
|
})
|
||||||
|
.catch(err => {
|
||||||
|
reject(err);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
const _executeProcess = (command, working, args=[]) => {
|
const _executeProcess = (command, working, args=[]) => {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
let processOptions = {
|
let processOptions = {
|
||||||
@@ -542,51 +596,65 @@ module.exports.getMissingDependencies = dependencies => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const Registry = require('winreg');
|
const Registry = require('winreg');
|
||||||
const checkRegistry = (dep, index) => {
|
const checkRegistry = (dep, index, legacyRuntimeDetection) => {
|
||||||
if (index >= dep.registry.length) {
|
if (index >= dep.registry.length) {
|
||||||
missing.push(dep);
|
missing.push(dep);
|
||||||
resolveIfComplete();
|
resolveIfComplete();
|
||||||
} else {
|
} else {
|
||||||
let hive = null;
|
if (!legacyRuntimeDetection && (dep.display === 'VC Runtime 2015-2019')) {
|
||||||
const hiveName = dep.registry[index].split('\\')[0];
|
_vcRuntimeExists()
|
||||||
switch (hiveName) {
|
.then(exists => {
|
||||||
case 'HKEY_CLASSES_ROOT':
|
if (exists) {
|
||||||
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();
|
resolveIfComplete();
|
||||||
|
} else {
|
||||||
|
checkRegistry(dep, 0, true);
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
} else {
|
.catch (() => {
|
||||||
resolveIfComplete();
|
checkRegistry(dep, 0, true);
|
||||||
|
})
|
||||||
|
} 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();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user