From a632af00fc687bbcd7a8aca2542bd579ee60576a Mon Sep 17 00:00:00 2001 From: kervala Date: Sun, 6 Dec 2015 16:42:49 +0100 Subject: [PATCH] Fixed: Remove \SystemRoot\ from path returned from Registry --- code/nel/src/misc/system_info.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/code/nel/src/misc/system_info.cpp b/code/nel/src/misc/system_info.cpp index a5b78c08b..0aa559e89 100644 --- a/code/nel/src/misc/system_info.cpp +++ b/code/nel/src/misc/system_info.cpp @@ -1442,6 +1442,7 @@ bool CSystemInfo::getVideoInfo (std::string &deviceName, uint64 &driverVersion) DWORD valueType; char value[512]; DWORD size = 512; + string driverName; if (RegQueryValueExA(baseKey, keyName.c_str(), NULL, &valueType, (unsigned char *)value, &size) == ERROR_SUCCESS) { // Null ? @@ -1459,6 +1460,15 @@ bool CSystemInfo::getVideoInfo (std::string &deviceName, uint64 &driverVersion) { 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; } else @@ -1484,7 +1494,6 @@ bool CSystemInfo::getVideoInfo (std::string &deviceName, uint64 &driverVersion) if (_VerQueryValue && _GetFileVersionInfoSize && _GetFileVersionInfo) { // value got the path to the driver - string driverName = value; if (atleastNT4) { nlverify (GetWindowsDirectoryA(value, 512) != 0);