diff options
Diffstat (limited to 'win')
-rw-r--r-- | win/rfb_win32/CurrentUser.cxx | 2 | ||||
-rw-r--r-- | win/rfb_win32/DIBSectionBuffer.cxx | 4 | ||||
-rw-r--r-- | win/rfb_win32/DeviceContext.cxx | 2 | ||||
-rw-r--r-- | win/rfb_win32/DeviceFrameBuffer.cxx | 12 | ||||
-rw-r--r-- | win/rfb_win32/Dialog.cxx | 2 | ||||
-rw-r--r-- | win/rfb_win32/EventManager.cxx | 5 | ||||
-rw-r--r-- | win/rfb_win32/Registry.cxx | 4 | ||||
-rw-r--r-- | win/rfb_win32/SDisplay.cxx | 9 | ||||
-rw-r--r-- | win/rfb_win32/SDisplayCoreWMHooks.cxx | 2 | ||||
-rw-r--r-- | win/rfb_win32/Security.cxx | 4 | ||||
-rw-r--r-- | win/rfb_win32/SocketManager.cxx | 12 | ||||
-rw-r--r-- | win/rfb_win32/Win32Util.cxx | 2 | ||||
-rw-r--r-- | win/vncconfig/Legacy.cxx | 2 | ||||
-rw-r--r-- | win/winvnc/QueryConnectDialog.cxx | 2 | ||||
-rw-r--r-- | win/winvnc/winvnc.cxx | 4 |
15 files changed, 35 insertions, 33 deletions
diff --git a/win/rfb_win32/CurrentUser.cxx b/win/rfb_win32/CurrentUser.cxx index fc0f689e..2ca48dd6 100644 --- a/win/rfb_win32/CurrentUser.cxx +++ b/win/rfb_win32/CurrentUser.cxx @@ -92,7 +92,7 @@ ImpersonateCurrentUser::ImpersonateCurrentUser() { if (!isServiceProcess()) return; if (!token.canImpersonate()) - throw rdr::Exception("Cannot impersonate unsafe or null token"); + throw std::runtime_error("Cannot impersonate unsafe or null token"); if (!ImpersonateLoggedOnUser(token)) { DWORD err = GetLastError(); if (err != ERROR_CALL_NOT_IMPLEMENTED) diff --git a/win/rfb_win32/DIBSectionBuffer.cxx b/win/rfb_win32/DIBSectionBuffer.cxx index ca6f3c9a..62b917c0 100644 --- a/win/rfb_win32/DIBSectionBuffer.cxx +++ b/win/rfb_win32/DIBSectionBuffer.cxx @@ -56,7 +56,7 @@ void DIBSectionBuffer::initBuffer(const PixelFormat& pf, int w, int h) { uint8_t* new_data = nullptr; if (!pf.trueColour) - throw rfb::Exception("palette format not supported"); + throw std::invalid_argument("palette format not supported"); format = pf; @@ -158,7 +158,7 @@ void DIBSectionBuffer::initBuffer(const PixelFormat& pf, int w, int h) { bits = bits >> 1; } if (depth > bpp) - throw Exception("Bad DIBSection format (depth exceeds bpp)"); + throw std::runtime_error("Bad DIBSection format (depth exceeds bpp)"); format = PixelFormat(bpp, depth, false, true, redMax, greenMax, blueMax, diff --git a/win/rfb_win32/DeviceContext.cxx b/win/rfb_win32/DeviceContext.cxx index fa0beaf9..210bbf80 100644 --- a/win/rfb_win32/DeviceContext.cxx +++ b/win/rfb_win32/DeviceContext.cxx @@ -87,7 +87,7 @@ PixelFormat DeviceContext::getPF(HDC dc) { break; default: vlog.error("bits per pixel %u not supported", bi.bmiHeader.biBitCount); - throw rdr::Exception("unknown bits per pixel specified"); + throw std::invalid_argument("unknown bits per pixel specified"); }; break; case BI_BITFIELDS: diff --git a/win/rfb_win32/DeviceFrameBuffer.cxx b/win/rfb_win32/DeviceFrameBuffer.cxx index 752aeb4c..4da4d814 100644 --- a/win/rfb_win32/DeviceFrameBuffer.cxx +++ b/win/rfb_win32/DeviceFrameBuffer.cxx @@ -54,14 +54,14 @@ DeviceFrameBuffer::DeviceFrameBuffer(HDC deviceContext, const Rect& wRect) int capabilities = GetDeviceCaps(device, RASTERCAPS); if (!(capabilities & RC_BITBLT)) { - throw Exception("device does not support BitBlt"); + throw std::invalid_argument("device does not support BitBlt"); } if (!(capabilities & RC_DI_BITMAP)) { - throw Exception("device does not support GetDIBits"); + throw std::invalid_argument("device does not support GetDIBits"); } /* if (GetDeviceCaps(device, PLANES) != 1) { - throw Exception("device does not support planar displays"); + throw std::invalid_argument("device does not support planar displays"); } */ @@ -140,9 +140,9 @@ void DeviceFrameBuffer::setCursor(HCURSOR hCursor, VNCServer* server) if (!GetObject(iconInfo.hbmMask, sizeof(BITMAP), &maskInfo)) throw rdr::Win32Exception("GetObject() failed", GetLastError()); if (maskInfo.bmPlanes != 1) - throw rdr::Exception("unsupported multi-plane cursor"); + throw std::invalid_argument("unsupported multi-plane cursor"); if (maskInfo.bmBitsPixel != 1) - throw rdr::Exception("unsupported cursor mask format"); + throw std::invalid_argument("unsupported cursor mask format"); width = maskInfo.bmWidth; height = maskInfo.bmHeight; @@ -188,7 +188,7 @@ void DeviceFrameBuffer::setCursor(HCURSOR hCursor, VNCServer* server) if ((bi.bV5RedMask != ((unsigned)0xff << ridx*8)) || (bi.bV5GreenMask != ((unsigned)0xff << gidx*8)) || (bi.bV5BlueMask != ((unsigned)0xff << bidx*8))) - throw rdr::Exception("unsupported cursor colour format"); + throw std::invalid_argument("unsupported cursor colour format"); uint8_t* rwbuffer = buffer.data(); for (int y = 0; y < height; y++) { diff --git a/win/rfb_win32/Dialog.cxx b/win/rfb_win32/Dialog.cxx index 3fcb96f7..d5938e8d 100644 --- a/win/rfb_win32/Dialog.cxx +++ b/win/rfb_win32/Dialog.cxx @@ -78,7 +78,7 @@ int Dialog::getItemInt(int id) { BOOL trans; int result = GetDlgItemInt(handle, id, &trans, TRUE); if (!trans) - throw rdr::Exception("unable to read dialog Int"); + throw std::runtime_error("unable to read dialog Int"); return result; } const char* Dialog::getItemString(int id) { diff --git a/win/rfb_win32/EventManager.cxx b/win/rfb_win32/EventManager.cxx index f034d36d..995c4fe2 100644 --- a/win/rfb_win32/EventManager.cxx +++ b/win/rfb_win32/EventManager.cxx @@ -22,8 +22,9 @@ #include <windows.h> +#include <stdexcept> + #include <rfb_win32/EventManager.h> -#include <rdr/Exception.h> #include <rfb/LogWriter.h> using namespace rfb; @@ -59,7 +60,7 @@ void EventManager::removeEvent(HANDLE event) { return; } } - throw rdr::Exception("Event not registered"); + throw std::runtime_error("Event not registered"); } diff --git a/win/rfb_win32/Registry.cxx b/win/rfb_win32/Registry.cxx index 15b25776..54de8928 100644 --- a/win/rfb_win32/Registry.cxx +++ b/win/rfb_win32/Registry.cxx @@ -247,14 +247,14 @@ std::string RegKey::getRepresentation(const char* valname) const { std::vector<char> expanded(required); length = ExpandEnvironmentStrings(str.c_str(), expanded.data(), required); if (required<length) - throw rdr::Exception("unable to expand environment strings"); + throw std::runtime_error("unable to expand environment strings"); return expanded.data(); } else { return ""; } } default: - throw rdr::Exception("unsupported registry type"); + throw std::logic_error("unsupported registry type"); } } diff --git a/win/rfb_win32/SDisplay.cxx b/win/rfb_win32/SDisplay.cxx index 703334f3..94b02a6d 100644 --- a/win/rfb_win32/SDisplay.cxx +++ b/win/rfb_win32/SDisplay.cxx @@ -35,7 +35,6 @@ #include <rfb_win32/MonitorInfo.h> #include <rfb_win32/SDisplayCorePolling.h> #include <rfb_win32/SDisplayCoreWMHooks.h> -#include <rfb/Exception.h> #include <rfb/LogWriter.h> #include <rfb/ledStates.h> @@ -172,12 +171,12 @@ void SDisplay::startCore() { // Currently, we just check whether we're in the console session, and // fail if not if (!inConsoleSession()) - throw rdr::Exception("Console is not session zero - oreconnect to restore Console sessin"); + throw std::runtime_error("Console is not session zero - oreconnect to restore Console sessin"); // Switch to the current input desktop if (rfb::win32::desktopChangeRequired()) { if (!rfb::win32::changeDesktop()) - throw rdr::Exception("unable to switch into input desktop"); + throw std::runtime_error("unable to switch into input desktop"); } // Initialise the change tracker and clipper @@ -200,7 +199,7 @@ void SDisplay::startCore() { } catch (std::exception& e) { delete core; core = nullptr; if (tryMethod == 0) - throw rdr::Exception("unable to access desktop"); + throw std::runtime_error("unable to access desktop"); tryMethod--; vlog.error("%s", e.what()); } @@ -435,7 +434,7 @@ SDisplay::processEvent(HANDLE event) { } return; } - throw rdr::Exception("No such event"); + throw std::runtime_error("No such event"); } diff --git a/win/rfb_win32/SDisplayCoreWMHooks.cxx b/win/rfb_win32/SDisplayCoreWMHooks.cxx index 8165be3d..4c307600 100644 --- a/win/rfb_win32/SDisplayCoreWMHooks.cxx +++ b/win/rfb_win32/SDisplayCoreWMHooks.cxx @@ -40,7 +40,7 @@ SDisplayCoreWMHooks::SDisplayCoreWMHooks(SDisplay* d, UpdateTracker* ut) consolePollTimer(getHandle(), consolePollTimerId), pollConsoles(false) { if (!hooks.setEvent(display->getUpdateEvent())) - throw rdr::Exception("hook subsystem failed to initialise"); + throw std::runtime_error("hook subsystem failed to initialise"); poller.setUpdateTracker(updateTracker); cursorTimer.start(20); consolePollTimer.start(200); diff --git a/win/rfb_win32/Security.cxx b/win/rfb_win32/Security.cxx index 04f92402..65153732 100644 --- a/win/rfb_win32/Security.cxx +++ b/win/rfb_win32/Security.cxx @@ -96,7 +96,7 @@ void AccessEntries::addEntry(const PSID sid, PSID Sid::copySID(const PSID sid) { if (!IsValidSid(sid)) - throw rdr::Exception("invalid SID in copyPSID"); + 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()); @@ -105,7 +105,7 @@ PSID Sid::copySID(const PSID sid) { void Sid::setSID(const PSID sid) { if (!IsValidSid(sid)) - throw rdr::Exception("invalid SID in copyPSID"); + throw std::invalid_argument("invalid SID in copyPSID"); resize(GetLengthSid(sid)); if (!CopySid(GetLengthSid(sid), data(), sid)) throw rdr::Win32Exception("CopySid failed", GetLastError()); diff --git a/win/rfb_win32/SocketManager.cxx b/win/rfb_win32/SocketManager.cxx index 6226e033..3d8c101e 100644 --- a/win/rfb_win32/SocketManager.cxx +++ b/win/rfb_win32/SocketManager.cxx @@ -25,6 +25,8 @@ #include <winsock2.h> #include <list> +#include <rdr/Exception.h> + #include <network/Socket.h> #include <rfb/LogWriter.h> @@ -75,7 +77,7 @@ void SocketManager::addListener(network::SocketListener* sock_, // addEvent is the last thing we do, so that the event is NOT registered if previous steps fail if (!event || !addEvent(event, this)) - throw rdr::Exception("Unable to add listener"); + throw std::runtime_error("Unable to add listener"); } catch (std::exception& e) { if (event) WSACloseEvent(event); @@ -103,7 +105,7 @@ void SocketManager::remListener(network::SocketListener* sock) { return; } } - throw rdr::Exception("Listener not registered"); + throw std::runtime_error("Listener not registered"); } @@ -136,7 +138,7 @@ void SocketManager::remSocket(network::Socket* sock_) { return; } } - throw rdr::Exception("Socket not registered"); + throw std::runtime_error("Socket not registered"); } bool SocketManager::getDisable(VNCServer* srvr) @@ -147,7 +149,7 @@ bool SocketManager::getDisable(VNCServer* srvr) return i->second.disable; } } - throw rdr::Exception("Listener not registered"); + throw std::runtime_error("Listener not registered"); } void SocketManager::setDisable(VNCServer* srvr, bool disable) @@ -163,7 +165,7 @@ void SocketManager::setDisable(VNCServer* srvr, bool disable) } } if (!found) - throw rdr::Exception("Listener not registered"); + throw std::runtime_error("Listener not registered"); } int SocketManager::checkTimeouts() { diff --git a/win/rfb_win32/Win32Util.cxx b/win/rfb_win32/Win32Util.cxx index f7b5b6c7..b22311af 100644 --- a/win/rfb_win32/Win32Util.cxx +++ b/win/rfb_win32/Win32Util.cxx @@ -81,7 +81,7 @@ const char* FileVersionInfo::getVerString(const char* name, DWORD langId) { UINT length = 0; if (!VerQueryValue(buf, infoName.c_str(), (void**)&buffer, &length)) { printf("unable to find %s version string", infoName.c_str()); - throw rdr::Exception("VerQueryValue failed"); + throw std::runtime_error("VerQueryValue failed"); } return buffer; } diff --git a/win/vncconfig/Legacy.cxx b/win/vncconfig/Legacy.cxx index 855d7363..1edc2bfa 100644 --- a/win/vncconfig/Legacy.cxx +++ b/win/vncconfig/Legacy.cxx @@ -85,7 +85,7 @@ void LegacyPage::LoadPrefs() if (bits) strcat(pattern, "."); if (parts[j].size() > 3) - throw rdr::Exception("Invalid IP address part"); + throw std::invalid_argument("Invalid IP address part"); if (!parts[j].empty()) { strcat(pattern, parts[j].c_str()); bits += 8; diff --git a/win/winvnc/QueryConnectDialog.cxx b/win/winvnc/QueryConnectDialog.cxx index 24918b2a..6ec62bbd 100644 --- a/win/winvnc/QueryConnectDialog.cxx +++ b/win/winvnc/QueryConnectDialog.cxx @@ -60,7 +60,7 @@ void QueryConnectDialog::worker() { countdown = timeout; try { if (desktopChangeRequired() && !changeDesktop()) - throw rdr::Exception("changeDesktop failed"); + throw std::runtime_error("changeDesktop failed"); approve = Dialog::showDialog(MAKEINTRESOURCE(IDD_QUERY_CONNECT)); server->queryConnectionComplete(); } catch (...) { diff --git a/win/winvnc/winvnc.cxx b/win/winvnc/winvnc.cxx index 25e6875f..4feff6b2 100644 --- a/win/winvnc/winvnc.cxx +++ b/win/winvnc/winvnc.cxx @@ -119,7 +119,7 @@ static void processParams(int argc, char** argv) { if (host != nullptr) { HWND hwnd = FindWindow(nullptr, "winvnc::IPC_Interface"); if (!hwnd) - throw rdr::Exception("Unable to locate existing VNC Server."); + throw std::runtime_error("Unable to locate existing VNC Server."); COPYDATASTRUCT copyData; copyData.dwData = 1; // *** AddNewClient copyData.cbData = strlen(host); @@ -132,7 +132,7 @@ static void processParams(int argc, char** argv) { runServer = false; HWND hwnd = FindWindow(nullptr, "winvnc::IPC_Interface"); if (!hwnd) - throw rdr::Exception("Unable to locate existing VNC Server."); + throw std::runtime_error("Unable to locate existing VNC Server."); COPYDATASTRUCT copyData; copyData.dwData = 2; // *** DisconnectClients copyData.lpData = nullptr; |