aboutsummaryrefslogtreecommitdiffstats
path: root/win/rfb_win32/Registry.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'win/rfb_win32/Registry.cxx')
-rw-r--r--win/rfb_win32/Registry.cxx38
1 files changed, 19 insertions, 19 deletions
diff --git a/win/rfb_win32/Registry.cxx b/win/rfb_win32/Registry.cxx
index bcb98704..bbe15f47 100644
--- a/win/rfb_win32/Registry.cxx
+++ b/win/rfb_win32/Registry.cxx
@@ -54,7 +54,7 @@ RegKey::RegKey() : key(nullptr), freeKey(false), valueName(nullptr), valueNameBu
RegKey::RegKey(const HKEY k) : key(nullptr), freeKey(false), valueName(nullptr), valueNameBufLen(0) {
LONG result = RegOpenKeyEx(k, nullptr, 0, KEY_ALL_ACCESS, &key);
if (result != ERROR_SUCCESS)
- throw rdr::SystemException("RegOpenKeyEx(HKEY)", result);
+ throw rdr::Win32Exception("RegOpenKeyEx(HKEY)", result);
vlog.debug("duplicated %p to %p", k, key);
freeKey = true;
}
@@ -62,7 +62,7 @@ RegKey::RegKey(const HKEY k) : key(nullptr), freeKey(false), valueName(nullptr),
RegKey::RegKey(const RegKey& k) : key(nullptr), freeKey(false), valueName(nullptr), valueNameBufLen(0) {
LONG result = RegOpenKeyEx(k.key, nullptr, 0, KEY_ALL_ACCESS, &key);
if (result != ERROR_SUCCESS)
- throw rdr::SystemException("RegOpenKeyEx(RegKey&)", result);
+ throw rdr::Win32Exception("RegOpenKeyEx(RegKey&)", result);
vlog.debug("duplicated %p to %p", k.key, key);
freeKey = true;
}
@@ -86,7 +86,7 @@ bool RegKey::createKey(const RegKey& root, const char* name) {
LONG result = RegCreateKey(root.key, name, &key);
if (result != ERROR_SUCCESS) {
vlog.error("RegCreateKey(%p, %s): %lx", root.key, name, result);
- throw rdr::SystemException("RegCreateKeyEx", result);
+ throw rdr::Win32Exception("RegCreateKeyEx", result);
}
vlog.debug("createKey(%p,%s) = %p", root.key, name, key);
freeKey = true;
@@ -97,7 +97,7 @@ void RegKey::openKey(const RegKey& root, const char* name, bool readOnly) {
close();
LONG result = RegOpenKeyEx(root.key, name, 0, readOnly ? KEY_READ : KEY_ALL_ACCESS, &key);
if (result != ERROR_SUCCESS)
- throw rdr::SystemException("RegOpenKeyEx (open)", result);
+ throw rdr::Win32Exception("RegOpenKeyEx (open)", result);
vlog.debug("openKey(%p,%s,%s) = %p", root.key, name,
readOnly ? "ro" : "rw", key);
freeKey = true;
@@ -109,7 +109,7 @@ void RegKey::setDACL(const PACL acl, bool inherit) {
DACL_SECURITY_INFORMATION |
(inherit ? UNPROTECTED_DACL_SECURITY_INFORMATION : PROTECTED_DACL_SECURITY_INFORMATION),
nullptr, nullptr, acl, nullptr)) != ERROR_SUCCESS)
- throw rdr::SystemException("RegKey::setDACL failed", result);
+ throw rdr::Win32Exception("RegKey::setDACL failed", result);
}
void RegKey::close() {
@@ -123,19 +123,19 @@ void RegKey::close() {
void RegKey::deleteKey(const char* name) const {
LONG result = RegDeleteKey(key, name);
if (result != ERROR_SUCCESS)
- throw rdr::SystemException("RegDeleteKey", result);
+ throw rdr::Win32Exception("RegDeleteKey", result);
}
void RegKey::deleteValue(const char* name) const {
LONG result = RegDeleteValue(key, name);
if (result != ERROR_SUCCESS)
- throw rdr::SystemException("RegDeleteValue", result);
+ throw rdr::Win32Exception("RegDeleteValue", result);
}
void RegKey::awaitChange(bool watchSubTree, DWORD filter, HANDLE event) const {
LONG result = RegNotifyChangeKeyValue(key, watchSubTree, filter, event, event != nullptr);
if (result != ERROR_SUCCESS)
- throw rdr::SystemException("RegNotifyChangeKeyValue", result);
+ throw rdr::Win32Exception("RegNotifyChangeKeyValue", result);
}
@@ -144,22 +144,22 @@ RegKey::operator HKEY() const {return key;}
void RegKey::setExpandString(const char* valname, const char* value) const {
LONG result = RegSetValueEx(key, valname, 0, REG_EXPAND_SZ, (const BYTE*)value, (strlen(value)+1)*sizeof(char));
- if (result != ERROR_SUCCESS) throw rdr::SystemException("setExpandString", result);
+ if (result != ERROR_SUCCESS) throw rdr::Win32Exception("setExpandString", result);
}
void RegKey::setString(const char* valname, const char* value) const {
LONG result = RegSetValueEx(key, valname, 0, REG_SZ, (const BYTE*)value, (strlen(value)+1)*sizeof(char));
- if (result != ERROR_SUCCESS) throw rdr::SystemException("setString", result);
+ if (result != ERROR_SUCCESS) throw rdr::Win32Exception("setString", result);
}
void RegKey::setBinary(const char* valname, const void* value, size_t length) const {
LONG result = RegSetValueEx(key, valname, 0, REG_BINARY, (const BYTE*)value, length);
- if (result != ERROR_SUCCESS) throw rdr::SystemException("setBinary", result);
+ if (result != ERROR_SUCCESS) throw rdr::Win32Exception("setBinary", result);
}
void RegKey::setInt(const char* valname, int value) const {
LONG result = RegSetValueEx(key, valname, 0, REG_DWORD, (const BYTE*)&value, sizeof(value));
- if (result != ERROR_SUCCESS) throw rdr::SystemException("setInt", result);
+ if (result != ERROR_SUCCESS) throw rdr::Win32Exception("setInt", result);
}
void RegKey::setBool(const char* valname, bool value) const {
@@ -214,11 +214,11 @@ std::string RegKey::getRepresentation(const char* valname) const {
DWORD type, length;
LONG result = RegQueryValueEx(key, valname, nullptr, &type, nullptr, &length);
if (result != ERROR_SUCCESS)
- throw rdr::SystemException("get registry value length", result);
+ throw rdr::Win32Exception("get registry value length", result);
std::vector<uint8_t> data(length);
result = RegQueryValueEx(key, valname, nullptr, &type, (BYTE*)data.data(), &length);
if (result != ERROR_SUCCESS)
- throw rdr::SystemException("get registry value", result);
+ throw rdr::Win32Exception("get registry value", result);
switch (type) {
case REG_BINARY:
@@ -243,7 +243,7 @@ std::string RegKey::getRepresentation(const char* valname) const {
std::string str((char*)data.data(), length);
DWORD required = ExpandEnvironmentStrings(str.c_str(), nullptr, 0);
if (required==0)
- throw rdr::SystemException("ExpandEnvironmentStrings", GetLastError());
+ throw rdr::Win32Exception("ExpandEnvironmentStrings", GetLastError());
std::vector<char> expanded(required);
length = ExpandEnvironmentStrings(str.c_str(), expanded.data(), required);
if (required<length)
@@ -271,7 +271,7 @@ const char* RegKey::getValueName(int i) {
DWORD maxValueNameLen;
LONG result = RegQueryInfoKey(key, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, &maxValueNameLen, nullptr, nullptr, nullptr);
if (result != ERROR_SUCCESS)
- throw rdr::SystemException("RegQueryInfoKey", result);
+ throw rdr::Win32Exception("RegQueryInfoKey", result);
if (valueNameBufLen < maxValueNameLen + 1) {
valueNameBufLen = maxValueNameLen + 1;
delete [] valueName;
@@ -281,7 +281,7 @@ const char* RegKey::getValueName(int i) {
result = RegEnumValue(key, i, valueName, &length, nullptr, nullptr, nullptr, nullptr);
if (result == ERROR_NO_MORE_ITEMS) return nullptr;
if (result != ERROR_SUCCESS)
- throw rdr::SystemException("RegEnumValue", result);
+ throw rdr::Win32Exception("RegEnumValue", result);
return valueName;
}
@@ -289,7 +289,7 @@ const char* RegKey::getKeyName(int i) {
DWORD maxValueNameLen;
LONG result = RegQueryInfoKey(key, nullptr, nullptr, nullptr, nullptr, &maxValueNameLen, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr);
if (result != ERROR_SUCCESS)
- throw rdr::SystemException("RegQueryInfoKey", result);
+ throw rdr::Win32Exception("RegQueryInfoKey", result);
if (valueNameBufLen < maxValueNameLen + 1) {
valueNameBufLen = maxValueNameLen + 1;
delete [] valueName;
@@ -299,6 +299,6 @@ const char* RegKey::getKeyName(int i) {
result = RegEnumKeyEx(key, i, valueName, &length, nullptr, nullptr, nullptr, nullptr);
if (result == ERROR_NO_MORE_ITEMS) return nullptr;
if (result != ERROR_SUCCESS)
- throw rdr::SystemException("RegEnumKey", result);
+ throw rdr::Win32Exception("RegEnumKey", result);
return valueName;
}