diff options
Diffstat (limited to 'win')
-rw-r--r-- | win/rfb_win32/Registry.cxx | 20 | ||||
-rw-r--r-- | win/rfb_win32/Registry.h | 4 | ||||
-rw-r--r-- | win/vncconfig/Legacy.cxx | 7 |
3 files changed, 12 insertions, 19 deletions
diff --git a/win/rfb_win32/Registry.cxx b/win/rfb_win32/Registry.cxx index cb4e6688..78879c3b 100644 --- a/win/rfb_win32/Registry.cxx +++ b/win/rfb_win32/Registry.cxx @@ -173,23 +173,17 @@ TCHAR* RegKey::getString(const TCHAR* valname, const TCHAR* def) const { } } -void RegKey::getBinary(const TCHAR* valname, void** data, size_t* length) const { +std::vector<uint8_t> RegKey::getBinary(const TCHAR* valname) const { TCharArray hex(getRepresentation(valname)); - *data = hexToBin(CStr(hex.buf), strlen(CStr(hex.buf))); - *length = strlen(CStr(hex.buf))/2; - if (*data == NULL) - throw rdr::Exception("getBinary failed"); + return hexToBin(CStr(hex.buf), strlen(CStr(hex.buf))); } -void RegKey::getBinary(const TCHAR* valname, void** data, size_t* length, void* def, size_t deflen) const { +std::vector<uint8_t> RegKey::getBinary(const TCHAR* valname, const uint8_t* def, size_t deflen) const { try { - getBinary(valname, data, length); + return getBinary(valname); } catch(rdr::Exception&) { - if (deflen) { - *data = new char[deflen]; - memcpy(*data, def, deflen); - } else - *data = 0; - *length = deflen; + std::vector<uint8_t> out(deflen); + memcpy(out.data(), def, deflen); + return out; } } diff --git a/win/rfb_win32/Registry.h b/win/rfb_win32/Registry.h index 2bb16911..3b87983b 100644 --- a/win/rfb_win32/Registry.h +++ b/win/rfb_win32/Registry.h @@ -78,8 +78,8 @@ namespace rfb { TCHAR* getString(const TCHAR* valname) const; TCHAR* getString(const TCHAR* valname, const TCHAR* def) const; - void getBinary(const TCHAR* valname, void** data, size_t* length) const; - void getBinary(const TCHAR* valname, void** data, size_t* length, void* def, size_t deflength) const; + std::vector<uint8_t> getBinary(const TCHAR* valname) const; + std::vector<uint8_t> getBinary(const TCHAR* valname, const uint8_t* def, size_t deflength) const; int getInt(const TCHAR* valname) const; int getInt(const TCHAR* valname, int def) const; diff --git a/win/vncconfig/Legacy.cxx b/win/vncconfig/Legacy.cxx index deba0ff3..3edfd4f7 100644 --- a/win/vncconfig/Legacy.cxx +++ b/win/vncconfig/Legacy.cxx @@ -19,7 +19,6 @@ #include <vncconfig/Legacy.h> #include <rfb/LogWriter.h> -#include <rfb/Password.h> #include <rfb_win32/CurrentUser.h> using namespace rfb; @@ -212,9 +211,9 @@ void LegacyPage::LoadPrefs() } regKey.setInt(_T("QueryTimeout"), key.getInt(_T("QueryTimeout"), 10)); - ObfuscatedPasswd passwd; - key.getBinary(_T("Password"), (void**)&passwd.buf, &passwd.length, 0, 0); - regKey.setBinary(_T("Password"), passwd.buf, passwd.length); + std::vector<uint8_t> passwd; + passwd = key.getBinary(_T("Password")); + regKey.setBinary(_T("Password"), passwd.data(), passwd.size()); bool enableInputs = key.getBool(_T("InputsEnabled"), true); regKey.setBool(_T("AcceptKeyEvents"), enableInputs); |