From a9aa3c164b5bf5be36caae1b51cf3deec9f1a21c Mon Sep 17 00:00:00 2001 From: Micke Prag Date: Wed, 29 Oct 2008 11:23:36 +0000 Subject: [PATCH] Bugfix when storing values in the windows registry --- .../libtelldus-core/settings/TelldusSettingsWinRegistry.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/telldus-core/driver/libtelldus-core/settings/TelldusSettingsWinRegistry.cpp b/telldus-core/driver/libtelldus-core/settings/TelldusSettingsWinRegistry.cpp index 841090a4..426bb931 100644 --- a/telldus-core/driver/libtelldus-core/settings/TelldusSettingsWinRegistry.cpp +++ b/telldus-core/driver/libtelldus-core/settings/TelldusSettingsWinRegistry.cpp @@ -295,10 +295,11 @@ bool TelldusSettings::setIntSetting(int intDeviceId, const char* name, int value std::ostringstream ssRegPath; ssRegPath << d->strRegPathDevice << intDeviceId; string strCompleteRegPath = ssRegPath.str(); - long lnExists = RegOpenKeyEx(d->rootKey, strCompleteRegPath.c_str(), 0, KEY_QUERY_VALUE, &d->hk); + long lnExists = RegOpenKeyEx(d->rootKey, strCompleteRegPath.c_str(), 0, KEY_WRITE, &d->hk); if (lnExists == ERROR_SUCCESS) { DWORD dwVal = value; - if (RegSetValueEx (d->hk, name, 0L, REG_DWORD, (CONST BYTE*) &dwVal, sizeof(DWORD)) == ERROR_SUCCESS) { + lnExists = RegSetValueEx (d->hk, name, 0L, REG_DWORD, (CONST BYTE*) &dwVal, sizeof(DWORD)); + if (lnExists == ERROR_SUCCESS) { blnReturn = true; } }