Fixed: Remove \SystemRoot\ from path returned from Registry
This commit is contained in:
parent
4827dcd60e
commit
8a43c01e52
1 changed files with 10 additions and 1 deletions
|
@ -1442,6 +1442,7 @@ bool CSystemInfo::getVideoInfo (std::string &deviceName, uint64 &driverVersion)
|
||||||
DWORD valueType;
|
DWORD valueType;
|
||||||
char value[512];
|
char value[512];
|
||||||
DWORD size = 512;
|
DWORD size = 512;
|
||||||
|
string driverName;
|
||||||
if (RegQueryValueExA(baseKey, keyName.c_str(), NULL, &valueType, (unsigned char *)value, &size) == ERROR_SUCCESS)
|
if (RegQueryValueExA(baseKey, keyName.c_str(), NULL, &valueType, (unsigned char *)value, &size) == ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
// Null ?
|
// Null ?
|
||||||
|
@ -1459,6 +1460,15 @@ bool CSystemInfo::getVideoInfo (std::string &deviceName, uint64 &driverVersion)
|
||||||
{
|
{
|
||||||
if (value[0] != 0)
|
if (value[0] != 0)
|
||||||
{
|
{
|
||||||
|
static const std::string s_systemRoot = "\\SystemRoot\\";
|
||||||
|
|
||||||
|
driverName = value;
|
||||||
|
|
||||||
|
if (driverName.substr(0, s_systemRoot.length()) == s_systemRoot)
|
||||||
|
{
|
||||||
|
driverName = driverName.substr(s_systemRoot.length());
|
||||||
|
}
|
||||||
|
|
||||||
ok = true;
|
ok = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1484,7 +1494,6 @@ bool CSystemInfo::getVideoInfo (std::string &deviceName, uint64 &driverVersion)
|
||||||
if (_VerQueryValue && _GetFileVersionInfoSize && _GetFileVersionInfo)
|
if (_VerQueryValue && _GetFileVersionInfoSize && _GetFileVersionInfo)
|
||||||
{
|
{
|
||||||
// value got the path to the driver
|
// value got the path to the driver
|
||||||
string driverName = value;
|
|
||||||
if (atleastNT4)
|
if (atleastNT4)
|
||||||
{
|
{
|
||||||
nlverify (GetWindowsDirectoryA(value, 512) != 0);
|
nlverify (GetWindowsDirectoryA(value, 512) != 0);
|
||||||
|
|
Loading…
Reference in a new issue