aboutsummaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
Diffstat (limited to 'win')
-rw-r--r--win/rfb_win32/CleanDesktop.cxx2
-rw-r--r--win/rfb_win32/Clipboard.cxx6
-rw-r--r--win/rfb_win32/CompatibleBitmap.h2
-rw-r--r--win/rfb_win32/CurrentUser.cxx6
-rw-r--r--win/rfb_win32/DIBSectionBuffer.cxx4
-rw-r--r--win/rfb_win32/DeviceContext.cxx14
-rw-r--r--win/rfb_win32/DeviceFrameBuffer.cxx8
-rw-r--r--win/rfb_win32/Dialog.cxx4
-rw-r--r--win/rfb_win32/IconInfo.h2
-rw-r--r--win/rfb_win32/IntervalTimer.h2
-rw-r--r--win/rfb_win32/LaunchProcess.cxx6
-rw-r--r--win/rfb_win32/LocalMem.h2
-rw-r--r--win/rfb_win32/MonitorInfo.cxx6
-rw-r--r--win/rfb_win32/MsgWindow.cxx4
-rw-r--r--win/rfb_win32/RegConfig.cxx4
-rw-r--r--win/rfb_win32/Registry.cxx38
-rw-r--r--win/rfb_win32/SInput.cxx2
-rw-r--r--win/rfb_win32/Security.cxx26
-rw-r--r--win/rfb_win32/Service.cxx30
-rw-r--r--win/rfb_win32/SocketManager.cxx10
-rw-r--r--win/rfb_win32/TsSessions.cxx4
-rw-r--r--win/rfb_win32/WMCursor.cxx2
-rw-r--r--win/rfb_win32/WMPoller.cxx2
-rw-r--r--win/rfb_win32/Win32Util.cxx6
-rw-r--r--win/vncconfig/Legacy.cxx2
-rw-r--r--win/vncconfig/vncconfig.cxx4
-rw-r--r--win/winvnc/QueryConnectDialog.cxx2
-rw-r--r--win/winvnc/VNCServerWin32.cxx4
-rw-r--r--win/winvnc/winvnc.cxx4
29 files changed, 104 insertions, 104 deletions
diff --git a/win/rfb_win32/CleanDesktop.cxx b/win/rfb_win32/CleanDesktop.cxx
index 6634d445..02fdd374 100644
--- a/win/rfb_win32/CleanDesktop.cxx
+++ b/win/rfb_win32/CleanDesktop.cxx
@@ -45,7 +45,7 @@ struct ActiveDesktop {
HRESULT result = CoCreateInstance(CLSID_ActiveDesktop, nullptr, CLSCTX_INPROC_SERVER,
IID_IActiveDesktop, (PVOID*)&handle);
if (result != S_OK)
- throw rdr::Win32Exception("failed to contact Active Desktop", HRESULT_CODE(result));
+ throw rdr::win32_error("failed to contact Active Desktop", HRESULT_CODE(result));
}
~ActiveDesktop() {
if (handle)
diff --git a/win/rfb_win32/Clipboard.cxx b/win/rfb_win32/Clipboard.cxx
index 72e8999e..8577df46 100644
--- a/win/rfb_win32/Clipboard.cxx
+++ b/win/rfb_win32/Clipboard.cxx
@@ -129,7 +129,7 @@ Clipboard::setClipText(const char* text) {
// - Firstly, we must open the clipboard
if (!OpenClipboard(getHandle()))
- throw rdr::Win32Exception("unable to open Win32 clipboard", GetLastError());
+ throw rdr::win32_error("unable to open Win32 clipboard", GetLastError());
// - Convert the supplied clipboard text into UTF-16 format with CRLF
std::string filtered(convertCRLF(text));
@@ -144,11 +144,11 @@ Clipboard::setClipText(const char* text) {
// - Next, we must clear out any existing data
if (!EmptyClipboard())
- throw rdr::Win32Exception("unable to empty Win32 clipboard", GetLastError());
+ throw rdr::win32_error("unable to empty Win32 clipboard", GetLastError());
// - Set the new clipboard data
if (!SetClipboardData(CF_UNICODETEXT, clip_handle))
- throw rdr::Win32Exception("unable to set Win32 clipboard", GetLastError());
+ throw rdr::win32_error("unable to set Win32 clipboard", GetLastError());
clip_handle = nullptr;
vlog.debug("set clipboard");
diff --git a/win/rfb_win32/CompatibleBitmap.h b/win/rfb_win32/CompatibleBitmap.h
index 0ecc6a3d..c8fdf829 100644
--- a/win/rfb_win32/CompatibleBitmap.h
+++ b/win/rfb_win32/CompatibleBitmap.h
@@ -30,7 +30,7 @@ namespace rfb {
CompatibleBitmap(HDC hdc, int width, int height) {
hbmp = CreateCompatibleBitmap(hdc, width, height);
if (!hbmp)
- throw rdr::Win32Exception("CreateCompatibleBitmap() failed", GetLastError());
+ throw rdr::win32_error("CreateCompatibleBitmap() failed", GetLastError());
}
virtual ~CompatibleBitmap() {
if (hbmp) DeleteObject(hbmp);
diff --git a/win/rfb_win32/CurrentUser.cxx b/win/rfb_win32/CurrentUser.cxx
index 2ca48dd6..be363682 100644
--- a/win/rfb_win32/CurrentUser.cxx
+++ b/win/rfb_win32/CurrentUser.cxx
@@ -80,7 +80,7 @@ CurrentUserToken::CurrentUserToken() {
if (!OpenProcessToken(GetCurrentProcess(), GENERIC_ALL, &h)) {
DWORD err = GetLastError();
if (err != ERROR_CALL_NOT_IMPLEMENTED)
- throw rdr::Win32Exception("OpenProcessToken failed", err);
+ throw rdr::win32_error("OpenProcessToken failed", err);
h = INVALID_HANDLE_VALUE;
}
}
@@ -96,7 +96,7 @@ ImpersonateCurrentUser::ImpersonateCurrentUser() {
if (!ImpersonateLoggedOnUser(token)) {
DWORD err = GetLastError();
if (err != ERROR_CALL_NOT_IMPLEMENTED)
- throw rdr::Win32Exception("Failed to impersonate user", GetLastError());
+ throw rdr::win32_error("Failed to impersonate user", GetLastError());
}
}
@@ -114,7 +114,7 @@ UserName::UserName() {
char buf[UNLEN+1];
DWORD len = UNLEN+1;
if (!GetUserName(buf, &len))
- throw rdr::Win32Exception("GetUserName failed", GetLastError());
+ throw rdr::win32_error("GetUserName failed", GetLastError());
assign(buf);
}
diff --git a/win/rfb_win32/DIBSectionBuffer.cxx b/win/rfb_win32/DIBSectionBuffer.cxx
index f6447b0d..440fe6b1 100644
--- a/win/rfb_win32/DIBSectionBuffer.cxx
+++ b/win/rfb_win32/DIBSectionBuffer.cxx
@@ -87,7 +87,7 @@ void DIBSectionBuffer::initBuffer(const PixelFormat& pf, int w, int h) {
if (!new_bitmap) {
int err = GetLastError();
- throw rdr::Win32Exception("unable to create DIB section", err);
+ throw rdr::win32_error("unable to create DIB section", err);
}
vlog.debug("recreateBuffer()");
@@ -130,7 +130,7 @@ void DIBSectionBuffer::initBuffer(const PixelFormat& pf, int w, int h) {
// Determine the *actual* DIBSection format
DIBSECTION ds;
if (!GetObject(bitmap, sizeof(ds), &ds))
- throw rdr::Win32Exception("GetObject", GetLastError());
+ throw rdr::win32_error("GetObject", GetLastError());
// Correct the "stride" of the DIB
// *** This code DWORD aligns each row - is that right???
diff --git a/win/rfb_win32/DeviceContext.cxx b/win/rfb_win32/DeviceContext.cxx
index 210bbf80..1c64e1f5 100644
--- a/win/rfb_win32/DeviceContext.cxx
+++ b/win/rfb_win32/DeviceContext.cxx
@@ -51,10 +51,10 @@ PixelFormat DeviceContext::getPF(HDC dc) {
bi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
bi.bmiHeader.biBitCount = 0;
if (!::GetDIBits(dc, bitmap, 0, 1, nullptr, (BITMAPINFO*)&bi, DIB_RGB_COLORS)) {
- throw rdr::Win32Exception("unable to determine device pixel format", GetLastError());
+ throw rdr::win32_error("unable to determine device pixel format", GetLastError());
}
if (!::GetDIBits(dc, bitmap, 0, 1, nullptr, (BITMAPINFO*)&bi, DIB_RGB_COLORS)) {
- throw rdr::Win32Exception("unable to determine pixel shifts/palette", GetLastError());
+ throw rdr::win32_error("unable to determine pixel shifts/palette", GetLastError());
}
// Set the initial format information
@@ -151,7 +151,7 @@ Rect DeviceContext::getClipBox(HDC dc) {
// Get the display dimensions
RECT cr;
if (!GetClipBox(dc, &cr))
- throw rdr::Win32Exception("GetClipBox", GetLastError());
+ throw rdr::win32_error("GetClipBox", GetLastError());
return Rect(cr.left, cr.top, cr.right, cr.bottom);
}
@@ -159,7 +159,7 @@ Rect DeviceContext::getClipBox(HDC dc) {
DeviceDC::DeviceDC(const char* deviceName) {
dc = ::CreateDC("DISPLAY", deviceName, nullptr, nullptr);
if (!dc)
- throw rdr::Win32Exception("failed to create DeviceDC", GetLastError());
+ throw rdr::win32_error("failed to create DeviceDC", GetLastError());
}
DeviceDC::~DeviceDC() {
@@ -171,7 +171,7 @@ DeviceDC::~DeviceDC() {
WindowDC::WindowDC(HWND wnd) : hwnd(wnd) {
dc = GetDC(wnd);
if (!dc)
- throw rdr::Win32Exception("GetDC failed", GetLastError());
+ throw rdr::win32_error("GetDC failed", GetLastError());
}
WindowDC::~WindowDC() {
@@ -183,7 +183,7 @@ WindowDC::~WindowDC() {
CompatibleDC::CompatibleDC(HDC existing) {
dc = CreateCompatibleDC(existing);
if (!dc)
- throw rdr::Win32Exception("CreateCompatibleDC failed", GetLastError());
+ throw rdr::win32_error("CreateCompatibleDC failed", GetLastError());
}
CompatibleDC::~CompatibleDC() {
@@ -195,7 +195,7 @@ CompatibleDC::~CompatibleDC() {
BitmapDC::BitmapDC(HDC hdc, HBITMAP hbitmap) : CompatibleDC(hdc){
oldBitmap = (HBITMAP)SelectObject(dc, hbitmap);
if (!oldBitmap)
- throw rdr::Win32Exception("SelectObject to CompatibleDC failed",
+ throw rdr::win32_error("SelectObject to CompatibleDC failed",
GetLastError());
}
diff --git a/win/rfb_win32/DeviceFrameBuffer.cxx b/win/rfb_win32/DeviceFrameBuffer.cxx
index 4da4d814..1c3e9575 100644
--- a/win/rfb_win32/DeviceFrameBuffer.cxx
+++ b/win/rfb_win32/DeviceFrameBuffer.cxx
@@ -102,7 +102,7 @@ DeviceFrameBuffer::grabRect(const Rect &rect) {
if (ignoreGrabErrors)
vlog.error("BitBlt failed:%ld", GetLastError());
else
- throw rdr::Win32Exception("BitBlt failed", GetLastError());
+ throw rdr::win32_error("BitBlt failed", GetLastError());
}
}
@@ -138,7 +138,7 @@ void DeviceFrameBuffer::setCursor(HCURSOR hCursor, VNCServer* server)
BITMAP maskInfo;
if (!GetObject(iconInfo.hbmMask, sizeof(BITMAP), &maskInfo))
- throw rdr::Win32Exception("GetObject() failed", GetLastError());
+ throw rdr::win32_error("GetObject() failed", GetLastError());
if (maskInfo.bmPlanes != 1)
throw std::invalid_argument("unsupported multi-plane cursor");
if (maskInfo.bmBitsPixel != 1)
@@ -174,7 +174,7 @@ void DeviceFrameBuffer::setCursor(HCURSOR hCursor, VNCServer* server)
if (!GetDIBits(dc, iconInfo.hbmColor, 0, height,
buffer.data(), (LPBITMAPINFO)&bi, DIB_RGB_COLORS))
- throw rdr::Win32Exception("GetDIBits", GetLastError());
+ throw rdr::win32_error("GetDIBits", GetLastError());
// We may not get the RGBA order we want, so shuffle things around
int ridx, gidx, bidx, aidx;
@@ -217,7 +217,7 @@ void DeviceFrameBuffer::setCursor(HCURSOR hCursor, VNCServer* server)
if (!GetBitmapBits(iconInfo.hbmMask,
maskInfo.bmWidthBytes * maskInfo.bmHeight, mask.data()))
- throw rdr::Win32Exception("GetBitmapBits", GetLastError());
+ throw rdr::win32_error("GetBitmapBits", GetLastError());
bool doOutline = false;
uint8_t* rwbuffer = buffer.data();
diff --git a/win/rfb_win32/Dialog.cxx b/win/rfb_win32/Dialog.cxx
index d5938e8d..e8af0846 100644
--- a/win/rfb_win32/Dialog.cxx
+++ b/win/rfb_win32/Dialog.cxx
@@ -65,7 +65,7 @@ bool Dialog::showDialog(const char* resource, HWND owner)
INT_PTR result = DialogBoxParam(inst, resource, owner,
staticDialogProc, (LPARAM)this);
if (result<0)
- throw rdr::Win32Exception("DialogBoxParam failed", GetLastError());
+ throw rdr::win32_error("DialogBoxParam failed", GetLastError());
alreadyShowing = false;
return (result == 1);
}
@@ -275,7 +275,7 @@ bool PropSheet::showPropSheet(HWND owner_, bool showApply, bool showCtxtHelp, bo
handle = (HWND)PropertySheet(&header);
if ((handle == nullptr) || (handle == (HWND)-1))
- throw rdr::Win32Exception("PropertySheet failed", GetLastError());
+ throw rdr::win32_error("PropertySheet failed", GetLastError());
centerWindow(handle, owner_);
plog.info("created %p", handle);
diff --git a/win/rfb_win32/IconInfo.h b/win/rfb_win32/IconInfo.h
index ca234514..991a5a13 100644
--- a/win/rfb_win32/IconInfo.h
+++ b/win/rfb_win32/IconInfo.h
@@ -28,7 +28,7 @@ namespace rfb {
struct IconInfo : public ICONINFO {
IconInfo(HICON icon) {
if (!GetIconInfo(icon, this))
- throw rdr::Win32Exception("GetIconInfo() failed", GetLastError());
+ throw rdr::win32_error("GetIconInfo() failed", GetLastError());
}
~IconInfo() {
if (hbmColor)
diff --git a/win/rfb_win32/IntervalTimer.h b/win/rfb_win32/IntervalTimer.h
index 5ced2c5e..b62040b3 100644
--- a/win/rfb_win32/IntervalTimer.h
+++ b/win/rfb_win32/IntervalTimer.h
@@ -41,7 +41,7 @@ namespace rfb {
if (!active || interval_ != interval) {
interval = interval_;
if (!SetTimer(hwnd, id, interval, nullptr))
- throw rdr::Win32Exception("SetTimer", GetLastError());
+ throw rdr::win32_error("SetTimer", GetLastError());
active = true;
}
}
diff --git a/win/rfb_win32/LaunchProcess.cxx b/win/rfb_win32/LaunchProcess.cxx
index beb7e6b7..38aa720f 100644
--- a/win/rfb_win32/LaunchProcess.cxx
+++ b/win/rfb_win32/LaunchProcess.cxx
@@ -53,7 +53,7 @@ void LaunchProcess::start(HANDLE userToken, bool createConsole) {
char buf[256];
HDESK desktop = GetThreadDesktop(GetCurrentThreadId());
if (!GetUserObjectInformation(desktop, UOI_NAME, buf, 256, &size))
- throw rdr::Win32Exception("unable to launch process", GetLastError());
+ throw rdr::win32_error("unable to launch process", GetLastError());
snprintf(desktopName, 256, "WinSta0\\%s", buf);
@@ -95,7 +95,7 @@ void LaunchProcess::start(HANDLE userToken, bool createConsole) {
flags, nullptr, nullptr,
&sinfo, &procInfo);
if (!success)
- throw rdr::Win32Exception("unable to launch process", GetLastError());
+ throw rdr::win32_error("unable to launch process", GetLastError());
// Wait for it to finish initialising
WaitForInputIdle(procInfo.hProcess, 15000);
@@ -119,7 +119,7 @@ bool LaunchProcess::await(DWORD timeoutMs) {
detach();
return true;
} else if (result == WAIT_FAILED) {
- throw rdr::Win32Exception("await() failed", GetLastError());
+ throw rdr::win32_error("await() failed", GetLastError());
}
return false;
}
diff --git a/win/rfb_win32/LocalMem.h b/win/rfb_win32/LocalMem.h
index e2dc80bd..5280dea3 100644
--- a/win/rfb_win32/LocalMem.h
+++ b/win/rfb_win32/LocalMem.h
@@ -28,7 +28,7 @@ namespace rfb {
// Allocate and/or manage LocalAlloc memory.
struct LocalMem {
LocalMem(int size) : ptr(LocalAlloc(LMEM_FIXED, size)) {
- if (!ptr) throw rdr::Win32Exception("LocalAlloc", GetLastError());
+ if (!ptr) throw rdr::win32_error("LocalAlloc", GetLastError());
}
LocalMem(void* p) : ptr(p) {}
~LocalMem() {LocalFree(ptr);}
diff --git a/win/rfb_win32/MonitorInfo.cxx b/win/rfb_win32/MonitorInfo.cxx
index 854b467a..84a8d501 100644
--- a/win/rfb_win32/MonitorInfo.cxx
+++ b/win/rfb_win32/MonitorInfo.cxx
@@ -44,7 +44,7 @@ static void fillMonitorInfo(HMONITOR monitor, MONITORINFOEXA* mi) {
memset(mi, 0, sizeof(MONITORINFOEXA));
mi->cbSize = sizeof(MONITORINFOEXA);
if (!GetMonitorInfo(monitor, mi))
- throw rdr::Win32Exception("failed to GetMonitorInfo", GetLastError());
+ throw rdr::win32_error("failed to GetMonitorInfo", GetLastError());
vlog.debug("monitor is %ld,%ld-%ld,%ld", mi->rcMonitor.left, mi->rcMonitor.top, mi->rcMonitor.right, mi->rcMonitor.bottom);
vlog.debug("work area is %ld,%ld-%ld,%ld", mi->rcWork.left, mi->rcWork.top, mi->rcWork.right, mi->rcWork.bottom);
vlog.debug("device is \"%s\"", mi->szDevice);
@@ -57,7 +57,7 @@ MonitorInfo::MonitorInfo(HWND window) {
HMONITOR monitor = MonitorFromWindow(window, MONITOR_DEFAULTTONEAREST);
if (!monitor)
- throw rdr::Win32Exception("failed to get monitor", GetLastError());
+ throw rdr::win32_error("failed to get monitor", GetLastError());
fillMonitorInfo(monitor, this);
}
@@ -67,7 +67,7 @@ MonitorInfo::MonitorInfo(const RECT& r) {
HMONITOR monitor = MonitorFromRect(&r, MONITOR_DEFAULTTONEAREST);
if (!monitor)
- throw rdr::Win32Exception("failed to get monitor", GetLastError());
+ throw rdr::win32_error("failed to get monitor", GetLastError());
fillMonitorInfo(monitor, this);
}
diff --git a/win/rfb_win32/MsgWindow.cxx b/win/rfb_win32/MsgWindow.cxx
index a5770e67..4908126e 100644
--- a/win/rfb_win32/MsgWindow.cxx
+++ b/win/rfb_win32/MsgWindow.cxx
@@ -82,7 +82,7 @@ MsgWindowClass::MsgWindowClass() : classAtom(0) {
wndClass.lpszClassName = "rfb::win32::MsgWindowClass";
classAtom = RegisterClass(&wndClass);
if (!classAtom) {
- throw rdr::Win32Exception("unable to register MsgWindow window class", GetLastError());
+ throw rdr::win32_error("unable to register MsgWindow window class", GetLastError());
}
}
@@ -104,7 +104,7 @@ MsgWindow::MsgWindow(const char* name_) : name(name_), handle(nullptr) {
name.c_str(), WS_OVERLAPPED, 0, 0, 10, 10,
nullptr, nullptr, baseClass.instance, this);
if (!handle) {
- throw rdr::Win32Exception("unable to create WMNotifier window instance", GetLastError());
+ throw rdr::win32_error("unable to create WMNotifier window instance", GetLastError());
}
vlog.debug("created window \"%s\" (%p)", name.c_str(), handle);
}
diff --git a/win/rfb_win32/RegConfig.cxx b/win/rfb_win32/RegConfig.cxx
index d93e8eb4..211570ca 100644
--- a/win/rfb_win32/RegConfig.cxx
+++ b/win/rfb_win32/RegConfig.cxx
@@ -69,7 +69,7 @@ void RegConfig::loadRegistryConfig(RegKey& key) {
if (!Configuration::setParam(name, value.c_str()))
vlog.info("unable to process %s", name);
}
- } catch (rdr::Win32Exception& e) {
+ } catch (rdr::win32_error& e) {
if (e.err != ERROR_INVALID_HANDLE)
vlog.error("%s", e.what());
}
@@ -115,5 +115,5 @@ void RegConfigThread::worker() {
thread_id = GetCurrentThreadId();
while ((result = eventMgr.getMessage(&msg, nullptr, 0, 0)) > 0) {}
if (result < 0)
- throw rdr::Win32Exception("RegConfigThread failed", GetLastError());
+ throw rdr::win32_error("RegConfigThread failed", GetLastError());
}
diff --git a/win/rfb_win32/Registry.cxx b/win/rfb_win32/Registry.cxx
index 54de8928..47756950 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::Win32Exception("RegOpenKeyEx(HKEY)", result);
+ throw rdr::win32_error("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::Win32Exception("RegOpenKeyEx(RegKey&)", result);
+ throw rdr::win32_error("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::Win32Exception("RegCreateKeyEx", result);
+ throw rdr::win32_error("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::Win32Exception("RegOpenKeyEx (open)", result);
+ throw rdr::win32_error("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::Win32Exception("RegKey::setDACL failed", result);
+ throw rdr::win32_error("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::Win32Exception("RegDeleteKey", result);
+ throw rdr::win32_error("RegDeleteKey", result);
}
void RegKey::deleteValue(const char* name) const {
LONG result = RegDeleteValue(key, name);
if (result != ERROR_SUCCESS)
- throw rdr::Win32Exception("RegDeleteValue", result);
+ throw rdr::win32_error("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::Win32Exception("RegNotifyChangeKeyValue", result);
+ throw rdr::win32_error("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::Win32Exception("setExpandString", result);
+ if (result != ERROR_SUCCESS) throw rdr::win32_error("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::Win32Exception("setString", result);
+ if (result != ERROR_SUCCESS) throw rdr::win32_error("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::Win32Exception("setBinary", result);
+ if (result != ERROR_SUCCESS) throw rdr::win32_error("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::Win32Exception("setInt", result);
+ if (result != ERROR_SUCCESS) throw rdr::win32_error("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::Win32Exception("get registry value length", result);
+ throw rdr::win32_error("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::Win32Exception("get registry value", result);
+ throw rdr::win32_error("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::Win32Exception("ExpandEnvironmentStrings", GetLastError());
+ throw rdr::win32_error("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::Win32Exception("RegQueryInfoKey", result);
+ throw rdr::win32_error("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::Win32Exception("RegEnumValue", result);
+ throw rdr::win32_error("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::Win32Exception("RegQueryInfoKey", result);
+ throw rdr::win32_error("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::Win32Exception("RegEnumKey", result);
+ throw rdr::win32_error("RegEnumKey", result);
return valueName;
}
diff --git a/win/rfb_win32/SInput.cxx b/win/rfb_win32/SInput.cxx
index 37144c29..f32ee1bd 100644
--- a/win/rfb_win32/SInput.cxx
+++ b/win/rfb_win32/SInput.cxx
@@ -126,7 +126,7 @@ win32::SPointer::pointerEvent(const Point& pos, uint8_t buttonmask)
evt.mi.mouseData = data;
evt.mi.time = 0;
if (SendInput(1, &evt, sizeof(evt)) != 1)
- throw rdr::Win32Exception("SendInput", GetLastError());
+ throw rdr::win32_error("SendInput", GetLastError());
}
}
diff --git a/win/rfb_win32/Security.cxx b/win/rfb_win32/Security.cxx
index 65153732..9f970aeb 100644
--- a/win/rfb_win32/Security.cxx
+++ b/win/rfb_win32/Security.cxx
@@ -99,7 +99,7 @@ PSID Sid::copySID(const PSID sid) {
throw std::invalid_argument("invalid SID in copyPSID");
PSID buf = (PSID)new uint8_t[GetLengthSid(sid)];
if (!CopySid(GetLengthSid(sid), buf, sid))
- throw rdr::Win32Exception("CopySid failed", GetLastError());
+ throw rdr::win32_error("CopySid failed", GetLastError());
return buf;
}
@@ -108,7 +108,7 @@ void Sid::setSID(const PSID sid) {
throw std::invalid_argument("invalid SID in copyPSID");
resize(GetLengthSid(sid));
if (!CopySid(GetLengthSid(sid), data(), sid))
- throw rdr::Win32Exception("CopySid failed", GetLastError());
+ throw rdr::win32_error("CopySid failed", GetLastError());
}
void Sid::getUserNameAndDomain(char** name, char** domain) {
@@ -117,12 +117,12 @@ void Sid::getUserNameAndDomain(char** name, char** domain) {
SID_NAME_USE use;
LookupAccountSid(nullptr, (PSID)*this, nullptr, &nameLen, nullptr, &domainLen, &use);
if (GetLastError() != ERROR_INSUFFICIENT_BUFFER)
- throw rdr::Win32Exception("Unable to determine SID name lengths", GetLastError());
+ throw rdr::win32_error("Unable to determine SID name lengths", GetLastError());
vlog.info("nameLen=%lu, domainLen=%lu, use=%d", nameLen, domainLen, use);
*name = new char[nameLen];
*domain = new char[domainLen];
if (!LookupAccountSid(nullptr, (PSID)*this, *name, &nameLen, *domain, &domainLen, &use))
- throw rdr::Win32Exception("Unable to lookup account SID", GetLastError());
+ throw rdr::win32_error("Unable to lookup account SID", GetLastError());
}
@@ -133,7 +133,7 @@ Sid::Administrators::Administrators() {
SECURITY_BUILTIN_DOMAIN_RID,
DOMAIN_ALIAS_RID_ADMINS,
0, 0, 0, 0, 0, 0, &sid))
- throw rdr::Win32Exception("Sid::Administrators", GetLastError());
+ throw rdr::win32_error("Sid::Administrators", GetLastError());
setSID(sid);
FreeSid(sid);
}
@@ -144,7 +144,7 @@ Sid::SYSTEM::SYSTEM() {
if (!AllocateAndInitializeSid(&ntAuth, 1,
SECURITY_LOCAL_SYSTEM_RID,
0, 0, 0, 0, 0, 0, 0, &sid))
- throw rdr::Win32Exception("Sid::SYSTEM", GetLastError());
+ throw rdr::win32_error("Sid::SYSTEM", GetLastError());
setSID(sid);
FreeSid(sid);
}
@@ -154,7 +154,7 @@ Sid::FromToken::FromToken(HANDLE h) {
GetTokenInformation(h, TokenUser, nullptr, 0, &required);
std::vector<uint8_t> tmp(required);
if (!GetTokenInformation(h, TokenUser, tmp.data(), tmp.size(), &required))
- throw rdr::Win32Exception("GetTokenInformation", GetLastError());
+ throw rdr::win32_error("GetTokenInformation", GetLastError());
TOKEN_USER* tokenUser = (TOKEN_USER*)tmp.data();
setSID(tokenUser->User.Sid);
}
@@ -164,7 +164,7 @@ PACL rfb::win32::CreateACL(const AccessEntries& ae, PACL existing_acl) {
PACL new_dacl;
DWORD result;
if ((result = SetEntriesInAcl(ae.entry_count, ae.entries, existing_acl, &new_dacl)) != ERROR_SUCCESS)
- throw rdr::Win32Exception("SetEntriesInAcl", result);
+ throw rdr::win32_error("SetEntriesInAcl", result);
return new_dacl;
}
@@ -172,18 +172,18 @@ PACL rfb::win32::CreateACL(const AccessEntries& ae, PACL existing_acl) {
PSECURITY_DESCRIPTOR rfb::win32::CreateSdWithDacl(const PACL dacl) {
SECURITY_DESCRIPTOR absSD;
if (!InitializeSecurityDescriptor(&absSD, SECURITY_DESCRIPTOR_REVISION))
- throw rdr::Win32Exception("InitializeSecurityDescriptor", GetLastError());
+ throw rdr::win32_error("InitializeSecurityDescriptor", GetLastError());
Sid::SYSTEM owner;
if (!SetSecurityDescriptorOwner(&absSD, owner, FALSE))
- throw rdr::Win32Exception("SetSecurityDescriptorOwner", GetLastError());
+ throw rdr::win32_error("SetSecurityDescriptorOwner", GetLastError());
Sid::Administrators group;
if (!SetSecurityDescriptorGroup(&absSD, group, FALSE))
- throw rdr::Win32Exception("SetSecurityDescriptorGroupp", GetLastError());
+ throw rdr::win32_error("SetSecurityDescriptorGroupp", GetLastError());
if (!SetSecurityDescriptorDacl(&absSD, TRUE, dacl, FALSE))
- throw rdr::Win32Exception("SetSecurityDescriptorDacl", GetLastError());
+ throw rdr::win32_error("SetSecurityDescriptorDacl", GetLastError());
DWORD sdSize = GetSecurityDescriptorLength(&absSD);
SecurityDescriptorPtr sd(sdSize);
if (!MakeSelfRelativeSD(&absSD, (PSECURITY_DESCRIPTOR)sd.ptr, &sdSize))
- throw rdr::Win32Exception("MakeSelfRelativeSD", GetLastError());
+ throw rdr::win32_error("MakeSelfRelativeSD", GetLastError());
return sd.takeSD();
}
diff --git a/win/rfb_win32/Service.cxx b/win/rfb_win32/Service.cxx
index be3381da..907e3214 100644
--- a/win/rfb_win32/Service.cxx
+++ b/win/rfb_win32/Service.cxx
@@ -115,7 +115,7 @@ Service::start() {
vlog.error("unable to set shutdown parameters: %lu", GetLastError());
service = this;
if (!StartServiceCtrlDispatcher(entry))
- throw Win32Exception("unable to start service", GetLastError());
+ throw win32_error("unable to start service", GetLastError());
}
void
@@ -335,7 +335,7 @@ bool rfb::win32::registerService(const char* name,
// - Open the SCM
ServiceHandle scm = OpenSCManager(nullptr, nullptr, SC_MANAGER_CREATE_SERVICE);
if (!scm)
- throw rdr::Win32Exception("unable to open Service Control Manager", GetLastError());
+ throw rdr::win32_error("unable to open Service Control Manager", GetLastError());
// - Add the service
ServiceHandle handle = CreateService(scm,
@@ -344,7 +344,7 @@ bool rfb::win32::registerService(const char* name,
SERVICE_AUTO_START, SERVICE_ERROR_IGNORE,
cmdline.c_str(), nullptr, nullptr, nullptr, nullptr, nullptr);
if (!handle)
- throw rdr::Win32Exception("unable to create service", GetLastError());
+ throw rdr::win32_error("unable to create service", GetLastError());
// - Set a description
SERVICE_DESCRIPTION sdesc = {(LPTSTR)desc};
@@ -380,14 +380,14 @@ bool rfb::win32::unregisterService(const char* name) {
// - Open the SCM
ServiceHandle scm = OpenSCManager(nullptr, nullptr, SC_MANAGER_CREATE_SERVICE);
if (!scm)
- throw rdr::Win32Exception("unable to open Service Control Manager", GetLastError());
+ throw rdr::win32_error("unable to open Service Control Manager", GetLastError());
// - Create the service
ServiceHandle handle = OpenService(scm, name, SC_MANAGER_ALL_ACCESS);
if (!handle)
- throw rdr::Win32Exception("unable to locate the service", GetLastError());
+ throw rdr::win32_error("unable to locate the service", GetLastError());
if (!DeleteService(handle))
- throw rdr::Win32Exception("unable to remove the service", GetLastError());
+ throw rdr::win32_error("unable to remove the service", GetLastError());
// - Register the event log source
RegKey hk;
@@ -407,16 +407,16 @@ bool rfb::win32::startService(const char* name) {
// - Open the SCM
ServiceHandle scm = OpenSCManager(nullptr, nullptr, SC_MANAGER_CONNECT);
if (!scm)
- throw rdr::Win32Exception("unable to open Service Control Manager", GetLastError());
+ throw rdr::win32_error("unable to open Service Control Manager", GetLastError());
// - Locate the service
ServiceHandle handle = OpenService(scm, name, SERVICE_START);
if (!handle)
- throw rdr::Win32Exception("unable to open the service", GetLastError());
+ throw rdr::win32_error("unable to open the service", GetLastError());
// - Start the service
if (!StartService(handle, 0, nullptr))
- throw rdr::Win32Exception("unable to start the service", GetLastError());
+ throw rdr::win32_error("unable to start the service", GetLastError());
Sleep(500);
@@ -427,17 +427,17 @@ bool rfb::win32::stopService(const char* name) {
// - Open the SCM
ServiceHandle scm = OpenSCManager(nullptr, nullptr, SC_MANAGER_CONNECT);
if (!scm)
- throw rdr::Win32Exception("unable to open Service Control Manager", GetLastError());
+ throw rdr::win32_error("unable to open Service Control Manager", GetLastError());
// - Locate the service
ServiceHandle handle = OpenService(scm, name, SERVICE_STOP);
if (!handle)
- throw rdr::Win32Exception("unable to open the service", GetLastError());
+ throw rdr::win32_error("unable to open the service", GetLastError());
// - Start the service
SERVICE_STATUS status;
if (!ControlService(handle, SERVICE_CONTROL_STOP, &status))
- throw rdr::Win32Exception("unable to stop the service", GetLastError());
+ throw rdr::win32_error("unable to stop the service", GetLastError());
Sleep(500);
@@ -448,17 +448,17 @@ DWORD rfb::win32::getServiceState(const char* name) {
// - Open the SCM
ServiceHandle scm = OpenSCManager(nullptr, nullptr, SC_MANAGER_CONNECT);
if (!scm)
- throw rdr::Win32Exception("unable to open Service Control Manager", GetLastError());
+ throw rdr::win32_error("unable to open Service Control Manager", GetLastError());
// - Locate the service
ServiceHandle handle = OpenService(scm, name, SERVICE_INTERROGATE);
if (!handle)
- throw rdr::Win32Exception("unable to open the service", GetLastError());
+ throw rdr::win32_error("unable to open the service", GetLastError());
// - Get the service status
SERVICE_STATUS status;
if (!ControlService(handle, SERVICE_CONTROL_INTERROGATE, (SERVICE_STATUS*)&status))
- throw rdr::Win32Exception("unable to query the service", GetLastError());
+ throw rdr::win32_error("unable to query the service", GetLastError());
return status.dwCurrentState;
}
diff --git a/win/rfb_win32/SocketManager.cxx b/win/rfb_win32/SocketManager.cxx
index 3d8c101e..b42c66cb 100644
--- a/win/rfb_win32/SocketManager.cxx
+++ b/win/rfb_win32/SocketManager.cxx
@@ -69,7 +69,7 @@ void SocketManager::addListener(network::SocketListener* sock_,
flags |= FD_ADDRESS_LIST_CHANGE;
try {
if (event && (WSAEventSelect(sock_->getFd(), event, flags) == SOCKET_ERROR))
- throw rdr::SocketException("Unable to select on listener", WSAGetLastError());
+ throw rdr::socket_error("Unable to select on listener", WSAGetLastError());
// requestAddressChangeEvents MUST happen after WSAEventSelect, so that the socket is non-blocking
if (acn)
@@ -186,7 +186,7 @@ int SocketManager::checkTimeouts() {
if (j->second.sock->outStream().hasBufferedData())
eventMask |= FD_WRITE;
if (WSAEventSelect(j->second.sock->getFd(), j->first, eventMask) == SOCKET_ERROR)
- throw rdr::SocketException("unable to adjust WSAEventSelect:%u", WSAGetLastError());
+ throw rdr::socket_error("unable to adjust WSAEventSelect:%u", WSAGetLastError());
}
}
@@ -236,11 +236,11 @@ void SocketManager::processEvent(HANDLE event) {
// Fetch why this event notification triggered
if (WSAEnumNetworkEvents(ci.sock->getFd(), event, &network_events) == SOCKET_ERROR)
- throw rdr::SocketException("unable to get WSAEnumNetworkEvents:%u", WSAGetLastError());
+ throw rdr::socket_error("unable to get WSAEnumNetworkEvents:%u", WSAGetLastError());
// Cancel event notification for this socket
if (WSAEventSelect(ci.sock->getFd(), event, 0) == SOCKET_ERROR)
- throw rdr::SocketException("unable to disable WSAEventSelect:%u", WSAGetLastError());
+ throw rdr::socket_error("unable to disable WSAEventSelect:%u", WSAGetLastError());
// Reset the event object
WSAResetEvent(event);
@@ -268,7 +268,7 @@ void SocketManager::processEvent(HANDLE event) {
if (ci.sock->outStream().hasBufferedData())
eventMask |= FD_WRITE;
if (WSAEventSelect(ci.sock->getFd(), event, eventMask) == SOCKET_ERROR)
- throw rdr::SocketException("unable to re-enable WSAEventSelect:%u", WSAGetLastError());
+ throw rdr::socket_error("unable to re-enable WSAEventSelect:%u", WSAGetLastError());
} catch (std::exception& e) {
vlog.error("%s", e.what());
remSocket(ci.sock);
diff --git a/win/rfb_win32/TsSessions.cxx b/win/rfb_win32/TsSessions.cxx
index a8602ad2..faf83e89 100644
--- a/win/rfb_win32/TsSessions.cxx
+++ b/win/rfb_win32/TsSessions.cxx
@@ -35,7 +35,7 @@ namespace win32 {
if (processId == (DWORD)-1)
processId = GetCurrentProcessId();
if (!ProcessIdToSessionId(GetCurrentProcessId(), &id))
- throw rdr::Win32Exception("ProcessIdToSessionId", GetLastError());
+ throw rdr::win32_error("ProcessIdToSessionId", GetLastError());
}
ProcessSessionId mySessionId;
@@ -57,7 +57,7 @@ namespace win32 {
ConsoleSessionId console;
vlog.info("Console session is %lu", console.id);
if (!WTSConnectSession(sessionId, console.id, (PTSTR)"", 0))
- throw rdr::Win32Exception("Unable to connect session to Console", GetLastError());
+ throw rdr::win32_error("Unable to connect session to Console", GetLastError());
// Lock the newly connected session, for security
LockWorkStation();
diff --git a/win/rfb_win32/WMCursor.cxx b/win/rfb_win32/WMCursor.cxx
index 603c7bc3..65d7a9d7 100644
--- a/win/rfb_win32/WMCursor.cxx
+++ b/win/rfb_win32/WMCursor.cxx
@@ -45,7 +45,7 @@ WMCursor::getCursorInfo() {
CURSORINFO info;
info.cbSize = sizeof(CURSORINFO);
if (!GetCursorInfo(&info))
- throw rdr::Win32Exception("GetCursorInfo failed", GetLastError());
+ throw rdr::win32_error("GetCursorInfo failed", GetLastError());
result.cursor = info.hCursor;
result.position = Point(info.ptScreenPos.x, info.ptScreenPos.y);
result.visible = info.flags & CURSOR_SHOWING;
diff --git a/win/rfb_win32/WMPoller.cxx b/win/rfb_win32/WMPoller.cxx
index db267269..98e8dce3 100644
--- a/win/rfb_win32/WMPoller.cxx
+++ b/win/rfb_win32/WMPoller.cxx
@@ -58,7 +58,7 @@ bool
rfb::win32::WMPoller::checkPollWindow(HWND w) {
char buffer[128];
if (!GetClassName(w, buffer, 128))
- throw rdr::Win32Exception("unable to get window class:%u", GetLastError());
+ throw rdr::win32_error("unable to get window class:%u", GetLastError());
if ((strcmp(buffer, "tty") != 0) &&
(strcmp(buffer, "ConsoleWindowClass") != 0)) {
return false;
diff --git a/win/rfb_win32/Win32Util.cxx b/win/rfb_win32/Win32Util.cxx
index b22311af..b35bf629 100644
--- a/win/rfb_win32/Win32Util.cxx
+++ b/win/rfb_win32/Win32Util.cxx
@@ -46,19 +46,19 @@ FileVersionInfo::FileVersionInfo(const char* filename) {
{
Handle file(CreateFile(filename, GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr));
if (file.h == INVALID_HANDLE_VALUE)
- throw rdr::Win32Exception("Failed to open file", GetLastError());
+ throw rdr::win32_error("Failed to open file", GetLastError());
}
// Get version info size
DWORD handle;
int size = GetFileVersionInfoSize((char*)filename, &handle);
if (!size)
- throw rdr::Win32Exception("GetVersionInfoSize failed", GetLastError());
+ throw rdr::win32_error("GetVersionInfoSize failed", GetLastError());
// Get version info
buf = new char[size];
if (!GetFileVersionInfo((char*)filename, handle, size, buf))
- throw rdr::Win32Exception("GetVersionInfo failed", GetLastError());
+ throw rdr::win32_error("GetVersionInfo failed", GetLastError());
}
FileVersionInfo::~FileVersionInfo() {
diff --git a/win/vncconfig/Legacy.cxx b/win/vncconfig/Legacy.cxx
index 1edc2bfa..c6b245cc 100644
--- a/win/vncconfig/Legacy.cxx
+++ b/win/vncconfig/Legacy.cxx
@@ -42,7 +42,7 @@ void LegacyPage::LoadPrefs()
std::string username;
try {
username = UserName();
- } catch (rdr::Win32Exception& e) {
+ } catch (rdr::win32_error& e) {
if (e.err != ERROR_NOT_LOGGED_ON)
throw;
}
diff --git a/win/vncconfig/vncconfig.cxx b/win/vncconfig/vncconfig.cxx
index de3a4620..7e692b9b 100644
--- a/win/vncconfig/vncconfig.cxx
+++ b/win/vncconfig/vncconfig.cxx
@@ -125,7 +125,7 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE /*prev*/, char* /*cmdLine*/, int /*
// Set the DACL, and don't allow the key to inherit its parent's DACL
rootKey.setDACL(acl, false);
- } catch (rdr::Win32Exception& e) {
+ } catch (rdr::win32_error& e) {
// Something weird happens on NT 4.0 SP5 but I can't reproduce it on other
// NT 4.0 service pack revisions.
if (e.err == ERROR_INVALID_PARAMETER) {
@@ -169,7 +169,7 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE /*prev*/, char* /*cmdLine*/, int /*
#else
sheet.showPropSheet(nullptr, true, false);
#endif
- } catch (rdr::Win32Exception& e) {
+ } catch (rdr::win32_error& e) {
switch (e.err) {
case ERROR_ACCESS_DENIED:
MsgBox(nullptr, "You do not have sufficient access rights to run the VNC Configuration applet",
diff --git a/win/winvnc/QueryConnectDialog.cxx b/win/winvnc/QueryConnectDialog.cxx
index 6ec62bbd..1ef26e63 100644
--- a/win/winvnc/QueryConnectDialog.cxx
+++ b/win/winvnc/QueryConnectDialog.cxx
@@ -74,7 +74,7 @@ void QueryConnectDialog::worker() {
void QueryConnectDialog::initDialog() {
if (!SetTimer(handle, 1, 1000, nullptr))
- throw rdr::Win32Exception("SetTimer", GetLastError());
+ throw rdr::win32_error("SetTimer", GetLastError());
setItemString(IDC_QUERY_HOST, peerIp.c_str());
if (userName.empty())
userName = "(anonymous)";
diff --git a/win/winvnc/VNCServerWin32.cxx b/win/winvnc/VNCServerWin32.cxx
index d98aaa10..cea0fe78 100644
--- a/win/winvnc/VNCServerWin32.cxx
+++ b/win/winvnc/VNCServerWin32.cxx
@@ -188,7 +188,7 @@ int VNCServerWin32::run() {
while (runServer) {
result = sockMgr.getMessage(&msg, nullptr, 0, 0);
if (result < 0)
- throw rdr::Win32Exception("getMessage", GetLastError());
+ throw rdr::win32_error("getMessage", GetLastError());
if (!isServiceProcess() && (result == 0))
break;
TranslateMessage(&msg);
@@ -196,7 +196,7 @@ int VNCServerWin32::run() {
}
vlog.debug("Server exited cleanly");
- } catch (rdr::Win32Exception &s) {
+ } catch (rdr::win32_error &s) {
vlog.error("%s", s.what());
result = s.err;
} catch (std::exception &e) {
diff --git a/win/winvnc/winvnc.cxx b/win/winvnc/winvnc.cxx
index 4feff6b2..1a370522 100644
--- a/win/winvnc/winvnc.cxx
+++ b/win/winvnc/winvnc.cxx
@@ -177,13 +177,13 @@ static void processParams(int argc, char** argv) {
// Try to clean up earlier services we've had
try {
rfb::win32::unregisterService("WinVNC4");
- } catch (rdr::Win32Exception&) {
+ } catch (rdr::win32_error&) {
// Do nothing as we might fail simply because there was no
// service to remove
}
try {
rfb::win32::unregisterService("TigerVNC Server");
- } catch (rdr::Win32Exception&) {
+ } catch (rdr::win32_error&) {
}
if (rfb::win32::registerService(VNCServerService::Name,