Pass full registry path to DriverInfoWindows constructor

Related-To: NEO-4457
Change-Id: I6b417b3a571349947bbbfc94b10c478b8793c2de
Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
Mateusz Jablonski
2020-03-16 10:11:27 +01:00
committed by sys_ocldev
parent e55d4bf234
commit 2dbee6d7c1
3 changed files with 25 additions and 6 deletions

View File

@@ -15,6 +15,8 @@
namespace NEO {
DriverInfoWindows::DriverInfoWindows(std::string &&fullPath) : path(DriverInfoWindows::trimRegistryKey(fullPath)) {}
DriverInfo *DriverInfo::create(OSInterface *osInterface) {
if (osInterface) {
auto wddm = osInterface->get()->getWddm();
@@ -22,11 +24,10 @@ DriverInfo *DriverInfo::create(OSInterface *osInterface) {
std::string path(wddm->getDeviceRegistryPath());
auto result = new DriverInfoWindows();
path = result->trimRegistryKey(path);
auto driverInfo = new DriverInfoWindows(std::move(path));
result->setRegistryReader(new RegistryReader(false, path));
return result;
driverInfo->setRegistryReader(new RegistryReader(false, driverInfo->getRegistryPath()));
return driverInfo;
}
return nullptr;
@@ -52,4 +53,9 @@ std::string DriverInfoWindows::getDeviceName(std::string defaultName) {
std::string DriverInfoWindows::getVersion(std::string defaultVersion) {
return registryReader.get()->getSetting("DriverVersion", defaultVersion);
};
const std::string &DriverInfoWindows::getRegistryPath() const {
return path;
}
} // namespace NEO

View File

@@ -18,13 +18,16 @@ class SettingsReader;
class DriverInfoWindows : public DriverInfo {
public:
DriverInfoWindows(std::string &&path);
std::string getDeviceName(std::string defaultName);
std::string getVersion(std::string defaultVersion);
void setRegistryReader(SettingsReader *reader);
std::string trimRegistryKey(std::string key);
const std::string &getRegistryPath() const;
protected:
static std::string trimRegistryKey(std::string key);
const std::string path;
std::unique_ptr<SettingsReader> registryReader;
};