aboutsummaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
Diffstat (limited to 'win')
-rw-r--r--win/rfb_win32/AboutDialog.cxx5
-rw-r--r--win/rfb_win32/CleanDesktop.cxx12
-rw-r--r--win/rfb_win32/Clipboard.cxx15
-rw-r--r--win/rfb_win32/CompatibleBitmap.h4
-rw-r--r--win/rfb_win32/CurrentUser.cxx13
-rw-r--r--win/rfb_win32/DIBSectionBuffer.cxx10
-rw-r--r--win/rfb_win32/DIBSectionBuffer.h4
-rw-r--r--win/rfb_win32/DeviceContext.cxx22
-rw-r--r--win/rfb_win32/DeviceContext.h8
-rw-r--r--win/rfb_win32/DeviceFrameBuffer.cxx18
-rw-r--r--win/rfb_win32/DeviceFrameBuffer.h19
-rw-r--r--win/rfb_win32/Dialog.cxx13
-rw-r--r--win/rfb_win32/EventManager.cxx5
-rw-r--r--win/rfb_win32/IconInfo.h4
-rw-r--r--win/rfb_win32/IntervalTimer.h4
-rw-r--r--win/rfb_win32/LaunchProcess.cxx10
-rw-r--r--win/rfb_win32/LocalMem.h4
-rw-r--r--win/rfb_win32/MonitorInfo.cxx12
-rw-r--r--win/rfb_win32/MsgWindow.cxx12
-rw-r--r--win/rfb_win32/RegConfig.cxx22
-rw-r--r--win/rfb_win32/RegConfig.h8
-rw-r--r--win/rfb_win32/Registry.cxx46
-rw-r--r--win/rfb_win32/SDisplay.cxx21
-rw-r--r--win/rfb_win32/SDisplay.h25
-rw-r--r--win/rfb_win32/SDisplayCorePolling.cxx11
-rw-r--r--win/rfb_win32/SDisplayCorePolling.h4
-rw-r--r--win/rfb_win32/SDisplayCoreWMHooks.cxx4
-rw-r--r--win/rfb_win32/SInput.cxx8
-rw-r--r--win/rfb_win32/SInput.h12
-rw-r--r--win/rfb_win32/Security.cxx30
-rw-r--r--win/rfb_win32/SecurityPage.cxx8
-rw-r--r--win/rfb_win32/Service.cxx39
-rw-r--r--win/rfb_win32/SocketManager.cxx21
-rw-r--r--win/rfb_win32/TrayIcon.h2
-rw-r--r--win/rfb_win32/TsSessions.cxx12
-rw-r--r--win/rfb_win32/WMCursor.cxx11
-rw-r--r--win/rfb_win32/WMCursor.h2
-rw-r--r--win/rfb_win32/WMHooks.cxx51
-rw-r--r--win/rfb_win32/WMHooks.h5
-rw-r--r--win/rfb_win32/WMNotifier.cxx5
-rw-r--r--win/rfb_win32/WMPoller.cxx11
-rw-r--r--win/rfb_win32/WMPoller.h10
-rw-r--r--win/rfb_win32/WMShatter.cxx5
-rw-r--r--win/rfb_win32/WMWindowCopyRect.cxx9
-rw-r--r--win/rfb_win32/WMWindowCopyRect.h2
-rw-r--r--win/rfb_win32/Win32Util.cxx15
-rw-r--r--win/vncconfig/Authentication.h2
-rw-r--r--win/vncconfig/Connections.h18
-rw-r--r--win/vncconfig/Desktop.h10
-rw-r--r--win/vncconfig/Legacy.cxx12
-rw-r--r--win/vncconfig/vncconfig.cxx26
-rw-r--r--win/vncconfig/vncconfig.rc4
-rw-r--r--win/winvnc/ControlPanel.cxx6
-rw-r--r--win/winvnc/ControlPanel.h2
-rw-r--r--win/winvnc/ManagedListener.cxx4
-rw-r--r--win/winvnc/QueryConnectDialog.cxx22
-rw-r--r--win/winvnc/QueryConnectDialog.h10
-rw-r--r--win/winvnc/STrayIcon.cxx19
-rw-r--r--win/winvnc/STrayIcon.h20
-rw-r--r--win/winvnc/VNCServerService.cxx8
-rw-r--r--win/winvnc/VNCServerWin32.cxx50
-rw-r--r--win/winvnc/VNCServerWin32.h13
-rw-r--r--win/winvnc/winvnc.cxx31
-rw-r--r--win/winvnc/winvnc.rc4
-rw-r--r--win/wm_hooks/wm_hooks.cxx1
-rw-r--r--win/wm_hooks/wm_hooks.rc4
66 files changed, 475 insertions, 384 deletions
diff --git a/win/rfb_win32/AboutDialog.cxx b/win/rfb_win32/AboutDialog.cxx
index a41ceefd..ce876fe5 100644
--- a/win/rfb_win32/AboutDialog.cxx
+++ b/win/rfb_win32/AboutDialog.cxx
@@ -20,14 +20,15 @@
#include <config.h>
#endif
+#include <core/LogWriter.h>
+
#include <rfb_win32/AboutDialog.h>
#include <rfb_win32/Win32Util.h>
-#include <rfb/LogWriter.h>
using namespace rfb;
using namespace rfb::win32;
-static LogWriter vlog("AboutDialog");
+static core::LogWriter vlog("AboutDialog");
AboutDialog AboutDialog::instance;
diff --git a/win/rfb_win32/CleanDesktop.cxx b/win/rfb_win32/CleanDesktop.cxx
index 9713b2cd..5205ed2e 100644
--- a/win/rfb_win32/CleanDesktop.cxx
+++ b/win/rfb_win32/CleanDesktop.cxx
@@ -25,18 +25,20 @@
#include <windows.h>
#include <wininet.h>
#include <shlobj.h>
+
+#include <core/Exception.h>
+#include <core/LogWriter.h>
+
#include <rfb_win32/CleanDesktop.h>
#include <rfb_win32/CurrentUser.h>
#include <rfb_win32/Registry.h>
-#include <rfb/LogWriter.h>
-#include <rdr/Exception.h>
-#include <os/os.h>
+
#include <set>
using namespace rfb;
using namespace rfb::win32;
-static LogWriter vlog("CleanDesktop");
+static core::LogWriter vlog("CleanDesktop");
struct ActiveDesktop {
@@ -45,7 +47,7 @@ struct ActiveDesktop {
HRESULT result = CoCreateInstance(CLSID_ActiveDesktop, nullptr, CLSCTX_INPROC_SERVER,
IID_IActiveDesktop, (PVOID*)&handle);
if (result != S_OK)
- throw rdr::win32_error("Failed to contact Active Desktop", HRESULT_CODE(result));
+ throw core::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 8fdc79c8..faff6e3d 100644
--- a/win/rfb_win32/Clipboard.cxx
+++ b/win/rfb_win32/Clipboard.cxx
@@ -23,14 +23,15 @@
#include <config.h>
#endif
-#include <rdr/Exception.h>
+#include <core/LogWriter.h>
+#include <core/string.h>
+
+#include <core/Exception.h>
#include <rfb_win32/Clipboard.h>
#include <rfb_win32/WMShatter.h>
-#include <rfb/util.h>
-
-#include <rfb/LogWriter.h>
+using namespace core;
using namespace rfb;
using namespace rfb::win32;
@@ -129,7 +130,7 @@ Clipboard::setClipText(const char* text) {
// - Firstly, we must open the clipboard
if (!OpenClipboard(getHandle()))
- throw rdr::win32_error("Unable to open Win32 clipboard", GetLastError());
+ throw core::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 +145,11 @@ Clipboard::setClipText(const char* text) {
// - Next, we must clear out any existing data
if (!EmptyClipboard())
- throw rdr::win32_error("Unable to empty Win32 clipboard", GetLastError());
+ throw core::win32_error("Unable to empty Win32 clipboard", GetLastError());
// - Set the new clipboard data
if (!SetClipboardData(CF_UNICODETEXT, clip_handle))
- throw rdr::win32_error("Unable to set Win32 clipboard", GetLastError());
+ throw core::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 c8fdf829..4e00a35f 100644
--- a/win/rfb_win32/CompatibleBitmap.h
+++ b/win/rfb_win32/CompatibleBitmap.h
@@ -20,7 +20,7 @@
#define __RFB_WIN32_COMPAT_BITMAP_H__
#include <windows.h>
-#include <rdr/Exception.h>
+#include <core/Exception.h>
namespace rfb {
namespace win32 {
@@ -30,7 +30,7 @@ namespace rfb {
CompatibleBitmap(HDC hdc, int width, int height) {
hbmp = CreateCompatibleBitmap(hdc, width, height);
if (!hbmp)
- throw rdr::win32_error("CreateCompatibleBitmap() failed", GetLastError());
+ throw core::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 a9404c94..753967cb 100644
--- a/win/rfb_win32/CurrentUser.cxx
+++ b/win/rfb_win32/CurrentUser.cxx
@@ -23,16 +23,19 @@
#endif
#include <stdlib.h>
-#include <rfb/LogWriter.h>
+
+#include <core/LogWriter.h>
+
#include <rfb_win32/CurrentUser.h>
#include <rfb_win32/Service.h>
+
#include <lmcons.h>
#include <wtsapi32.h>
using namespace rfb;
using namespace win32;
-static LogWriter vlog("CurrentUser");
+static core::LogWriter vlog("CurrentUser");
const char* shellIconClass = "Shell_TrayWnd";
@@ -80,7 +83,7 @@ CurrentUserToken::CurrentUserToken() {
if (!OpenProcessToken(GetCurrentProcess(), GENERIC_ALL, &h)) {
DWORD err = GetLastError();
if (err != ERROR_CALL_NOT_IMPLEMENTED)
- throw rdr::win32_error("OpenProcessToken failed", err);
+ throw core::win32_error("OpenProcessToken failed", err);
h = INVALID_HANDLE_VALUE;
}
}
@@ -96,7 +99,7 @@ ImpersonateCurrentUser::ImpersonateCurrentUser() {
if (!ImpersonateLoggedOnUser(token)) {
DWORD err = GetLastError();
if (err != ERROR_CALL_NOT_IMPLEMENTED)
- throw rdr::win32_error("Failed to impersonate user", GetLastError());
+ throw core::win32_error("Failed to impersonate user", GetLastError());
}
}
@@ -114,7 +117,7 @@ UserName::UserName() {
char buf[UNLEN+1];
DWORD len = UNLEN+1;
if (!GetUserName(buf, &len))
- throw rdr::win32_error("GetUserName failed", GetLastError());
+ throw core::win32_error("GetUserName failed", GetLastError());
assign(buf);
}
diff --git a/win/rfb_win32/DIBSectionBuffer.cxx b/win/rfb_win32/DIBSectionBuffer.cxx
index 3ce99809..e706dd00 100644
--- a/win/rfb_win32/DIBSectionBuffer.cxx
+++ b/win/rfb_win32/DIBSectionBuffer.cxx
@@ -21,17 +21,17 @@
#include <config.h>
#endif
-#include <rdr/Exception.h>
+#include <core/Exception.h>
+#include <core/LogWriter.h>
#include <rfb_win32/DIBSectionBuffer.h>
#include <rfb_win32/DeviceContext.h>
#include <rfb_win32/BitmapInfo.h>
-#include <rfb/LogWriter.h>
using namespace rfb;
using namespace win32;
-static LogWriter vlog("DIBSectionBuffer");
+static core::LogWriter vlog("DIBSectionBuffer");
DIBSectionBuffer::DIBSectionBuffer(HWND window_)
@@ -87,7 +87,7 @@ void DIBSectionBuffer::initBuffer(const PixelFormat& pf, int w, int h) {
if (!new_bitmap) {
int err = GetLastError();
- throw rdr::win32_error("Unable to create DIB section", err);
+ throw core::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::win32_error("GetObject", GetLastError());
+ throw core::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/DIBSectionBuffer.h b/win/rfb_win32/DIBSectionBuffer.h
index 2f099f39..fa40c02f 100644
--- a/win/rfb_win32/DIBSectionBuffer.h
+++ b/win/rfb_win32/DIBSectionBuffer.h
@@ -26,8 +26,10 @@
#define __RFB_WIN32_DIB_SECTION_BUFFER_H__
#include <windows.h>
+
+#include <core/Region.h>
+
#include <rfb/PixelBuffer.h>
-#include <rfb/Region.h>
#include <rfb/Exception.h>
namespace rfb {
diff --git a/win/rfb_win32/DeviceContext.cxx b/win/rfb_win32/DeviceContext.cxx
index 092279fb..212e3bf1 100644
--- a/win/rfb_win32/DeviceContext.cxx
+++ b/win/rfb_win32/DeviceContext.cxx
@@ -21,12 +21,14 @@
#include <config.h>
#endif
+#include <core/Exception.h>
+#include <core/LogWriter.h>
+
#include <rfb_win32/DeviceContext.h>
#include <rfb_win32/CompatibleBitmap.h>
#include <rfb_win32/BitmapInfo.h>
-#include <rdr/Exception.h>
-#include <rfb/LogWriter.h>
+using namespace core;
using namespace rfb;
using namespace win32;
@@ -51,10 +53,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::win32_error("Unable to determine device pixel format", GetLastError());
+ throw core::win32_error("Unable to determine device pixel format", GetLastError());
}
if (!::GetDIBits(dc, bitmap, 0, 1, nullptr, (BITMAPINFO*)&bi, DIB_RGB_COLORS)) {
- throw rdr::win32_error("Unable to determine pixel shifts/palette", GetLastError());
+ throw core::win32_error("Unable to determine pixel shifts/palette", GetLastError());
}
// Set the initial format information
@@ -151,15 +153,15 @@ Rect DeviceContext::getClipBox(HDC dc) {
// Get the display dimensions
RECT cr;
if (!GetClipBox(dc, &cr))
- throw rdr::win32_error("GetClipBox", GetLastError());
- return Rect(cr.left, cr.top, cr.right, cr.bottom);
+ throw core::win32_error("GetClipBox", GetLastError());
+ return {cr.left, cr.top, cr.right, cr.bottom};
}
DeviceDC::DeviceDC(const char* deviceName) {
dc = ::CreateDC("DISPLAY", deviceName, nullptr, nullptr);
if (!dc)
- throw rdr::win32_error("Failed to create DeviceDC", GetLastError());
+ throw core::win32_error("Failed to create DeviceDC", GetLastError());
}
DeviceDC::~DeviceDC() {
@@ -171,7 +173,7 @@ DeviceDC::~DeviceDC() {
WindowDC::WindowDC(HWND wnd) : hwnd(wnd) {
dc = GetDC(wnd);
if (!dc)
- throw rdr::win32_error("GetDC failed", GetLastError());
+ throw core::win32_error("GetDC failed", GetLastError());
}
WindowDC::~WindowDC() {
@@ -183,7 +185,7 @@ WindowDC::~WindowDC() {
CompatibleDC::CompatibleDC(HDC existing) {
dc = CreateCompatibleDC(existing);
if (!dc)
- throw rdr::win32_error("CreateCompatibleDC failed", GetLastError());
+ throw core::win32_error("CreateCompatibleDC failed", GetLastError());
}
CompatibleDC::~CompatibleDC() {
@@ -195,7 +197,7 @@ CompatibleDC::~CompatibleDC() {
BitmapDC::BitmapDC(HDC hdc, HBITMAP hbitmap) : CompatibleDC(hdc){
oldBitmap = (HBITMAP)SelectObject(dc, hbitmap);
if (!oldBitmap)
- throw rdr::win32_error("SelectObject to CompatibleDC failed",
+ throw core::win32_error("SelectObject to CompatibleDC failed",
GetLastError());
}
diff --git a/win/rfb_win32/DeviceContext.h b/win/rfb_win32/DeviceContext.h
index 7e89723c..a04c80a0 100644
--- a/win/rfb_win32/DeviceContext.h
+++ b/win/rfb_win32/DeviceContext.h
@@ -24,8 +24,10 @@
#define __RFB_WIN32_DEVICECONTEXT_H__
#include <windows.h>
+
+#include <core/Rect.h>
+
#include <rfb/PixelFormat.h>
-#include <rfb/Rect.h>
namespace rfb {
@@ -40,8 +42,8 @@ namespace rfb {
operator HDC() const {return dc;}
PixelFormat getPF() const;
static PixelFormat getPF(HDC dc);
- Rect getClipBox() const;
- static Rect getClipBox(HDC dc);
+ core::Rect getClipBox() const;
+ static core::Rect getClipBox(HDC dc);
protected:
HDC dc;
};
diff --git a/win/rfb_win32/DeviceFrameBuffer.cxx b/win/rfb_win32/DeviceFrameBuffer.cxx
index 9d215041..8a7d50f9 100644
--- a/win/rfb_win32/DeviceFrameBuffer.cxx
+++ b/win/rfb_win32/DeviceFrameBuffer.cxx
@@ -27,12 +27,16 @@
#endif
#include <vector>
+
+#include <core/LogWriter.h>
+
#include <rfb_win32/DeviceFrameBuffer.h>
#include <rfb_win32/DeviceContext.h>
#include <rfb_win32/IconInfo.h>
+
#include <rfb/VNCServer.h>
-#include <rfb/LogWriter.h>
+using namespace core;
using namespace rfb;
using namespace win32;
@@ -102,7 +106,7 @@ DeviceFrameBuffer::grabRect(const Rect &rect) {
if (ignoreGrabErrors)
vlog.error("BitBlt failed:%ld", GetLastError());
else
- throw rdr::win32_error("BitBlt failed", GetLastError());
+ throw core::win32_error("BitBlt failed", GetLastError());
}
}
@@ -123,7 +127,7 @@ void DeviceFrameBuffer::setCursor(HCURSOR hCursor, VNCServer* server)
// - If hCursor is null then there is no cursor - clear the old one
if (hCursor == nullptr) {
- server->setCursor(0, 0, Point(), nullptr);
+ server->setCursor(0, 0, {}, nullptr);
return;
}
@@ -138,7 +142,7 @@ void DeviceFrameBuffer::setCursor(HCURSOR hCursor, VNCServer* server)
BITMAP maskInfo;
if (!GetObject(iconInfo.hbmMask, sizeof(BITMAP), &maskInfo))
- throw rdr::win32_error("GetObject() failed", GetLastError());
+ throw core::win32_error("GetObject() failed", GetLastError());
if (maskInfo.bmPlanes != 1)
throw std::invalid_argument("Unsupported multi-plane cursor");
if (maskInfo.bmBitsPixel != 1)
@@ -151,7 +155,7 @@ void DeviceFrameBuffer::setCursor(HCURSOR hCursor, VNCServer* server)
buffer.resize(width * height * 4);
- Point hotspot = Point(iconInfo.xHotspot, iconInfo.yHotspot);
+ Point hotspot(iconInfo.xHotspot, iconInfo.yHotspot);
if (iconInfo.hbmColor) {
// Colour cursor
@@ -174,7 +178,7 @@ void DeviceFrameBuffer::setCursor(HCURSOR hCursor, VNCServer* server)
if (!GetDIBits(dc, iconInfo.hbmColor, 0, height,
buffer.data(), (LPBITMAPINFO)&bi, DIB_RGB_COLORS))
- throw rdr::win32_error("GetDIBits", GetLastError());
+ throw core::win32_error("GetDIBits", GetLastError());
// We may not get the RGBA order we want, so shuffle things around
int ridx, gidx, bidx, aidx;
@@ -217,7 +221,7 @@ void DeviceFrameBuffer::setCursor(HCURSOR hCursor, VNCServer* server)
if (!GetBitmapBits(iconInfo.hbmMask,
maskInfo.bmWidthBytes * maskInfo.bmHeight, mask.data()))
- throw rdr::win32_error("GetBitmapBits", GetLastError());
+ throw core::win32_error("GetBitmapBits", GetLastError());
bool doOutline = false;
uint8_t* rwbuffer = buffer.data();
diff --git a/win/rfb_win32/DeviceFrameBuffer.h b/win/rfb_win32/DeviceFrameBuffer.h
index e9f06cb0..67b1cd87 100644
--- a/win/rfb_win32/DeviceFrameBuffer.h
+++ b/win/rfb_win32/DeviceFrameBuffer.h
@@ -27,11 +27,14 @@
#define __RFB_WIN32_DEVICE_FRAME_BUFFER_H__
#include <windows.h>
+
+#include <core/Configuration.h>
+#include <core/Region.h>
+
#include <rfb_win32/DIBSectionBuffer.h>
+
#include <rfb/Cursor.h>
-#include <rfb/Region.h>
#include <rfb/Exception.h>
-#include <rfb/Configuration.h>
namespace rfb {
@@ -63,13 +66,13 @@ namespace rfb {
class DeviceFrameBuffer : public DIBSectionBuffer {
public:
- DeviceFrameBuffer(HDC deviceContext, const Rect& area_=Rect());
+ DeviceFrameBuffer(HDC deviceContext, const core::Rect& area_={});
virtual ~DeviceFrameBuffer();
// - FrameBuffer overrides
- virtual void grabRect(const Rect &rect);
- void grabRegion(const Region &region) override;
+ virtual void grabRect(const core::Rect& rect);
+ void grabRegion(const core::Region& region) override;
// - DeviceFrameBuffer specific methods
@@ -79,15 +82,15 @@ namespace rfb {
// Only set this if you are sure you'll capture the errors some other way!
void setIgnoreGrabErrors(bool ie) {ignoreGrabErrors=ie;}
- static BoolParameter useCaptureBlt;
+ static core::BoolParameter useCaptureBlt;
protected:
// Translate supplied Desktop coordinates into Device-relative coordinates
// This translation may have been affected at start-time by the supplied sub-rect.
- Point desktopToDevice(const Point p) const {return p.translate(deviceCoords.tl);}
+ core::Point desktopToDevice(const core::Point p) const {return p.translate(deviceCoords.tl);}
HDC device;
- Rect deviceCoords;
+ core::Rect deviceCoords;
bool ignoreGrabErrors;
};
diff --git a/win/rfb_win32/Dialog.cxx b/win/rfb_win32/Dialog.cxx
index cf8b2475..264db3f8 100644
--- a/win/rfb_win32/Dialog.cxx
+++ b/win/rfb_win32/Dialog.cxx
@@ -25,9 +25,10 @@
#include <config.h>
#endif
+#include <core/Exception.h>
+#include <core/LogWriter.h>
+
#include <rfb_win32/Dialog.h>
-#include <rfb/LogWriter.h>
-#include <rdr/Exception.h>
#include <rfb_win32/Win32Util.h>
#ifdef _DIALOG_CAPTURE
@@ -43,8 +44,8 @@
using namespace rfb;
using namespace rfb::win32;
-static LogWriter dlog("Dialog");
-static LogWriter plog("PropSheet");
+static core::LogWriter dlog("Dialog");
+static core::LogWriter plog("PropSheet");
Dialog::Dialog(HINSTANCE inst_)
@@ -65,7 +66,7 @@ bool Dialog::showDialog(const char* resource, HWND owner)
INT_PTR result = DialogBoxParam(inst, resource, owner,
staticDialogProc, (LPARAM)this);
if (result<0)
- throw rdr::win32_error("DialogBoxParam failed", GetLastError());
+ throw core::win32_error("DialogBoxParam failed", GetLastError());
alreadyShowing = false;
return (result == 1);
}
@@ -275,7 +276,7 @@ bool PropSheet::showPropSheet(HWND owner_, bool showApply, bool showCtxtHelp, bo
handle = (HWND)PropertySheet(&header);
if ((handle == nullptr) || (handle == (HWND)-1))
- throw rdr::win32_error("PropertySheet failed", GetLastError());
+ throw core::win32_error("PropertySheet failed", GetLastError());
centerWindow(handle, owner_);
plog.info("Created %p", handle);
diff --git a/win/rfb_win32/EventManager.cxx b/win/rfb_win32/EventManager.cxx
index 995c4fe2..6f45a35c 100644
--- a/win/rfb_win32/EventManager.cxx
+++ b/win/rfb_win32/EventManager.cxx
@@ -25,8 +25,11 @@
#include <stdexcept>
#include <rfb_win32/EventManager.h>
-#include <rfb/LogWriter.h>
+#include <core/Exception.h>
+#include <core/LogWriter.h>
+
+using namespace core;
using namespace rfb;
using namespace rfb::win32;
diff --git a/win/rfb_win32/IconInfo.h b/win/rfb_win32/IconInfo.h
index 991a5a13..6348e7b2 100644
--- a/win/rfb_win32/IconInfo.h
+++ b/win/rfb_win32/IconInfo.h
@@ -20,7 +20,7 @@
#define __RFB_WIN32_ICONINFO_H__
#include <windows.h>
-#include <rdr/Exception.h>
+#include <core/Exception.h>
namespace rfb {
namespace win32 {
@@ -28,7 +28,7 @@ namespace rfb {
struct IconInfo : public ICONINFO {
IconInfo(HICON icon) {
if (!GetIconInfo(icon, this))
- throw rdr::win32_error("GetIconInfo() failed", GetLastError());
+ throw core::win32_error("GetIconInfo() failed", GetLastError());
}
~IconInfo() {
if (hbmColor)
diff --git a/win/rfb_win32/IntervalTimer.h b/win/rfb_win32/IntervalTimer.h
index b62040b3..2e15821c 100644
--- a/win/rfb_win32/IntervalTimer.h
+++ b/win/rfb_win32/IntervalTimer.h
@@ -23,6 +23,8 @@
#ifndef __RFB_WIN32_INTERVAL_TIMER_H__
#define __RFB_WIN32_INTERVAL_TIMER_H__
+#include <core/Exception.h>
+
namespace rfb {
namespace win32 {
@@ -41,7 +43,7 @@ namespace rfb {
if (!active || interval_ != interval) {
interval = interval_;
if (!SetTimer(hwnd, id, interval, nullptr))
- throw rdr::win32_error("SetTimer", GetLastError());
+ throw core::win32_error("SetTimer", GetLastError());
active = true;
}
}
diff --git a/win/rfb_win32/LaunchProcess.cxx b/win/rfb_win32/LaunchProcess.cxx
index 93bd21fe..a9e43fa6 100644
--- a/win/rfb_win32/LaunchProcess.cxx
+++ b/win/rfb_win32/LaunchProcess.cxx
@@ -22,10 +22,12 @@
#include <config.h>
#endif
+#include <core/Exception.h>
+
#include <rfb_win32/LaunchProcess.h>
#include <rfb_win32/ModuleFileName.h>
#include <rfb_win32/Win32Util.h>
-#include <rdr/Exception.h>
+
#include <stdio.h>
using namespace rfb;
@@ -53,7 +55,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::win32_error("Unable to launch process", GetLastError());
+ throw core::win32_error("Unable to launch process", GetLastError());
snprintf(desktopName, 256, "WinSta0\\%s", buf);
@@ -95,7 +97,7 @@ void LaunchProcess::start(HANDLE userToken, bool createConsole) {
flags, nullptr, nullptr,
&sinfo, &procInfo);
if (!success)
- throw rdr::win32_error("Unable to launch process", GetLastError());
+ throw core::win32_error("Unable to launch process", GetLastError());
// Wait for it to finish initialising
WaitForInputIdle(procInfo.hProcess, 15000);
@@ -119,7 +121,7 @@ bool LaunchProcess::await(DWORD timeoutMs) {
detach();
return true;
} else if (result == WAIT_FAILED) {
- throw rdr::win32_error("await() failed", GetLastError());
+ throw core::win32_error("await() failed", GetLastError());
}
return false;
}
diff --git a/win/rfb_win32/LocalMem.h b/win/rfb_win32/LocalMem.h
index 5280dea3..54ac896b 100644
--- a/win/rfb_win32/LocalMem.h
+++ b/win/rfb_win32/LocalMem.h
@@ -20,7 +20,7 @@
#define __RFB_WIN32_LOCALMEM_H__
#include <windows.h>
-#include <rdr/Exception.h>
+#include <core/Exception.h>
namespace rfb {
namespace win32 {
@@ -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::win32_error("LocalAlloc", GetLastError());
+ if (!ptr) throw core::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 5d715ef6..5b1f5533 100644
--- a/win/rfb_win32/MonitorInfo.cxx
+++ b/win/rfb_win32/MonitorInfo.cxx
@@ -20,10 +20,11 @@
#include <config.h>
#endif
+#include <core/Exception.h>
+#include <core/LogWriter.h>
+
#include <rfb_win32/MonitorInfo.h>
#include <rfb_win32/Win32Util.h>
-#include <rdr/Exception.h>
-#include <rfb/LogWriter.h>
#ifndef min
#define min(a,b) ((a)<(b)?(a):(b))
@@ -33,6 +34,7 @@
#define max(a,b) ((a)>(b)?(a):(b))
#endif
+using namespace core;
using namespace rfb;
using namespace win32;
@@ -44,7 +46,7 @@ static void fillMonitorInfo(HMONITOR monitor, MONITORINFOEXA* mi) {
memset(mi, 0, sizeof(MONITORINFOEXA));
mi->cbSize = sizeof(MONITORINFOEXA);
if (!GetMonitorInfo(monitor, mi))
- throw rdr::win32_error("Failed to GetMonitorInfo", GetLastError());
+ throw core::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 +59,7 @@ MonitorInfo::MonitorInfo(HWND window) {
HMONITOR monitor = MonitorFromWindow(window, MONITOR_DEFAULTTONEAREST);
if (!monitor)
- throw rdr::win32_error("Failed to get monitor", GetLastError());
+ throw core::win32_error("Failed to get monitor", GetLastError());
fillMonitorInfo(monitor, this);
}
@@ -67,7 +69,7 @@ MonitorInfo::MonitorInfo(const RECT& r) {
HMONITOR monitor = MonitorFromRect(&r, MONITOR_DEFAULTTONEAREST);
if (!monitor)
- throw rdr::win32_error("Failed to get monitor", GetLastError());
+ throw core::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 c89db851..4b20dc88 100644
--- a/win/rfb_win32/MsgWindow.cxx
+++ b/win/rfb_win32/MsgWindow.cxx
@@ -23,16 +23,18 @@
#include <config.h>
#endif
+#include <core/Exception.h>
+#include <core/LogWriter.h>
+
#include <rfb_win32/MsgWindow.h>
#include <rfb_win32/WMShatter.h>
-#include <rfb/LogWriter.h>
-#include <rdr/Exception.h>
+
#include <malloc.h>
using namespace rfb;
using namespace rfb::win32;
-static LogWriter vlog("MsgWindow");
+static core::LogWriter vlog("MsgWindow");
//
// -=- MsgWindowClass
@@ -82,7 +84,7 @@ MsgWindowClass::MsgWindowClass() : classAtom(0) {
wndClass.lpszClassName = "rfb::win32::MsgWindowClass";
classAtom = RegisterClass(&wndClass);
if (!classAtom) {
- throw rdr::win32_error("Unable to register MsgWindow window class", GetLastError());
+ throw core::win32_error("Unable to register MsgWindow window class", GetLastError());
}
}
@@ -104,7 +106,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::win32_error("Unable to create WMNotifier window instance", GetLastError());
+ throw core::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 d9835201..057882b9 100644
--- a/win/rfb_win32/RegConfig.cxx
+++ b/win/rfb_win32/RegConfig.cxx
@@ -24,15 +24,17 @@
#include <malloc.h>
+#include <core/LogWriter.h>
+
#include <rfb_win32/RegConfig.h>
-#include <rfb/LogWriter.h>
+
//#include <rdr/HexOutStream.h>
using namespace rfb;
using namespace rfb::win32;
-static LogWriter vlog("RegConfig");
+static core::LogWriter vlog("RegConfig");
RegConfig::RegConfig(EventManager* em)
@@ -66,10 +68,10 @@ void RegConfig::loadRegistryConfig(RegKey& key) {
const char *name = key.getValueName(i++);
if (!name) break;
std::string value = key.getRepresentation(name);
- if (!Configuration::setParam(name, value.c_str()))
+ if (!core::Configuration::setParam(name, value.c_str()))
vlog.info("Unable to process %s", name);
}
- } catch (rdr::win32_error& e) {
+ } catch (core::win32_error& e) {
if (e.err != ERROR_INVALID_HANDLE)
vlog.error("%s", e.what());
}
@@ -91,17 +93,21 @@ void RegConfig::processEvent(HANDLE /*event*/) {
}
-RegConfigThread::RegConfigThread() : config(&eventMgr), thread_id(-1) {
+RegConfigThread::RegConfigThread() : config(&eventMgr), thread(nullptr),
+ thread_id(-1) {
}
RegConfigThread::~RegConfigThread() {
PostThreadMessage(thread_id, WM_QUIT, 0, 0);
- wait();
+ if (thread != nullptr) {
+ thread->join();
+ delete thread;
+ }
}
bool RegConfigThread::start(const HKEY rootKey, const char* keyname) {
if (config.setKey(rootKey, keyname)) {
- Thread::start();
+ thread = new std::thread(&RegConfigThread::worker, this);
while (thread_id == (DWORD)-1)
Sleep(0);
return true;
@@ -115,5 +121,5 @@ void RegConfigThread::worker() {
thread_id = GetCurrentThreadId();
while ((result = eventMgr.getMessage(&msg, nullptr, 0, 0)) > 0) {}
if (result < 0)
- throw rdr::win32_error("RegConfigThread failed", GetLastError());
+ throw core::win32_error("RegConfigThread failed", GetLastError());
}
diff --git a/win/rfb_win32/RegConfig.h b/win/rfb_win32/RegConfig.h
index 401cb148..4a2f8ca8 100644
--- a/win/rfb_win32/RegConfig.h
+++ b/win/rfb_win32/RegConfig.h
@@ -24,9 +24,8 @@
#ifndef __RFB_WIN32_REG_CONFIG_H__
#define __RFB_WIN32_REG_CONFIG_H__
-#include <os/Thread.h>
+#include <thread>
-#include <rfb/Configuration.h>
#include <rfb_win32/Registry.h>
#include <rfb_win32/EventManager.h>
#include <rfb_win32/Handle.h>
@@ -64,7 +63,7 @@ namespace rfb {
RegKey key;
};
- class RegConfigThread : os::Thread {
+ class RegConfigThread {
public:
RegConfigThread();
~RegConfigThread();
@@ -72,9 +71,10 @@ namespace rfb {
// Start the thread, reading from the specified key
bool start(const HKEY rootkey, const char* keyname);
protected:
- void worker() override;
+ void worker();
EventManager eventMgr;
RegConfig config;
+ std::thread* thread;
DWORD thread_id;
};
diff --git a/win/rfb_win32/Registry.cxx b/win/rfb_win32/Registry.cxx
index d40c9016..aef15a1b 100644
--- a/win/rfb_win32/Registry.cxx
+++ b/win/rfb_win32/Registry.cxx
@@ -22,14 +22,17 @@
#include <config.h>
#endif
+#include <core/LogWriter.h>
+#include <core/string.h>
+
#include <rfb_win32/Registry.h>
#include <rfb_win32/Security.h>
+
#include <rdr/MemOutStream.h>
#include <rdr/HexOutStream.h>
#include <rdr/HexInStream.h>
+
#include <stdlib.h>
-#include <rfb/LogWriter.h>
-#include <rfb/util.h>
// These flags are required to control access control inheritance,
// but are not defined by VC6's headers. These definitions comes
@@ -42,6 +45,7 @@
#endif
+using namespace core;
using namespace rfb;
using namespace rfb::win32;
@@ -54,7 +58,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::win32_error("RegOpenKeyEx(HKEY)", result);
+ throw core::win32_error("RegOpenKeyEx(HKEY)", result);
vlog.debug("Duplicated %p to %p", k, key);
freeKey = true;
}
@@ -62,7 +66,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::win32_error("RegOpenKeyEx(RegKey&)", result);
+ throw core::win32_error("RegOpenKeyEx(RegKey&)", result);
vlog.debug("Duplicated %p to %p", k.key, key);
freeKey = true;
}
@@ -86,7 +90,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::win32_error("RegCreateKeyEx", result);
+ throw core::win32_error("RegCreateKeyEx", result);
}
vlog.debug("createKey(%p,%s) = %p", root.key, name, key);
freeKey = true;
@@ -97,7 +101,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::win32_error("RegOpenKeyEx (open)", result);
+ throw core::win32_error("RegOpenKeyEx (open)", result);
vlog.debug("openKey(%p,%s,%s) = %p", root.key, name,
readOnly ? "ro" : "rw", key);
freeKey = true;
@@ -109,7 +113,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::win32_error("RegKey::setDACL failed", result);
+ throw core::win32_error("RegKey::setDACL failed", result);
}
void RegKey::close() {
@@ -123,19 +127,19 @@ void RegKey::close() {
void RegKey::deleteKey(const char* name) const {
LONG result = RegDeleteKey(key, name);
if (result != ERROR_SUCCESS)
- throw rdr::win32_error("RegDeleteKey", result);
+ throw core::win32_error("RegDeleteKey", result);
}
void RegKey::deleteValue(const char* name) const {
LONG result = RegDeleteValue(key, name);
if (result != ERROR_SUCCESS)
- throw rdr::win32_error("RegDeleteValue", result);
+ throw core::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::win32_error("RegNotifyChangeKeyValue", result);
+ throw core::win32_error("RegNotifyChangeKeyValue", result);
}
@@ -144,22 +148,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::win32_error("setExpandString", result);
+ if (result != ERROR_SUCCESS) throw core::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::win32_error("setString", result);
+ if (result != ERROR_SUCCESS) throw core::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::win32_error("setBinary", result);
+ if (result != ERROR_SUCCESS) throw core::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::win32_error("setInt", result);
+ if (result != ERROR_SUCCESS) throw core::win32_error("setInt", result);
}
void RegKey::setBool(const char* valname, bool value) const {
@@ -214,11 +218,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::win32_error("Get registry value length", result);
+ throw core::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::win32_error("Get registry value", result);
+ throw core::win32_error("Get registry value", result);
switch (type) {
case REG_BINARY:
@@ -243,7 +247,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::win32_error("ExpandEnvironmentStrings", GetLastError());
+ throw core::win32_error("ExpandEnvironmentStrings", GetLastError());
std::vector<char> expanded(required);
length = ExpandEnvironmentStrings(str.c_str(), expanded.data(), required);
if (required<length)
@@ -271,7 +275,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::win32_error("RegQueryInfoKey", result);
+ throw core::win32_error("RegQueryInfoKey", result);
if (valueNameBufLen < maxValueNameLen + 1) {
valueNameBufLen = maxValueNameLen + 1;
delete [] valueName;
@@ -281,7 +285,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::win32_error("RegEnumValue", result);
+ throw core::win32_error("RegEnumValue", result);
return valueName;
}
@@ -289,7 +293,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::win32_error("RegQueryInfoKey", result);
+ throw core::win32_error("RegQueryInfoKey", result);
if (valueNameBufLen < maxValueNameLen + 1) {
valueNameBufLen = maxValueNameLen + 1;
delete [] valueName;
@@ -299,6 +303,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::win32_error("RegEnumKey", result);
+ throw core::win32_error("RegEnumKey", result);
return valueName;
}
diff --git a/win/rfb_win32/SDisplay.cxx b/win/rfb_win32/SDisplay.cxx
index b930328f..de986ead 100644
--- a/win/rfb_win32/SDisplay.cxx
+++ b/win/rfb_win32/SDisplay.cxx
@@ -27,6 +27,8 @@
#include <assert.h>
+#include <core/LogWriter.h>
+
#include <rfb_win32/SDisplay.h>
#include <rfb_win32/Service.h>
#include <rfb_win32/TsSessions.h>
@@ -35,10 +37,11 @@
#include <rfb_win32/MonitorInfo.h>
#include <rfb_win32/SDisplayCorePolling.h>
#include <rfb_win32/SDisplayCoreWMHooks.h>
-#include <rfb/LogWriter.h>
+#include <rfb/VNCServer.h>
#include <rfb/ledStates.h>
+using namespace core;
using namespace rdr;
using namespace rfb;
using namespace rfb::win32;
@@ -48,11 +51,13 @@ static LogWriter vlog("SDisplay");
// - SDisplay-specific configuration options
IntParameter rfb::win32::SDisplay::updateMethod("UpdateMethod",
- "How to discover desktop updates; 0 - Polling, 1 - Application hooking, 2 - Driver hooking.", 0);
+ "How to discover desktop updates; 0 - Polling, 1 - Application hooking, 2 - Driver hooking.",
+ 0, 0, 2);
BoolParameter rfb::win32::SDisplay::disableLocalInputs("DisableLocalInputs",
"Disable local keyboard and pointer input while the server is in use", false);
-StringParameter rfb::win32::SDisplay::disconnectAction("DisconnectAction",
- "Action to perform when all clients have disconnected. (None, Lock, Logoff)", "None");
+EnumParameter rfb::win32::SDisplay::disconnectAction("DisconnectAction",
+ "Action to perform when all clients have disconnected. (None, Lock, Logoff)",
+ {"None", "Lock", "Logoff"}, "None");
StringParameter displayDevice("DisplayDevice",
"Display device name of the monitor to be remoted, or empty to export the whole desktop.", "");
BoolParameter rfb::win32::SDisplay::removeWallpaper("RemoveWallpaper",
@@ -123,12 +128,12 @@ void SDisplay::stop()
// If we successfully start()ed then perform the DisconnectAction
if (core) {
CurrentUserToken cut;
- if (stricmp(disconnectAction, "Logoff") == 0) {
+ if (disconnectAction == "Logoff") {
if (!cut.h)
vlog.info("Ignoring DisconnectAction=Logoff - no current user");
else
ExitWindowsEx(EWX_LOGOFF, 0);
- } else if (stricmp(disconnectAction, "Lock") == 0) {
+ } else if (disconnectAction == "Lock") {
if (!cut.h) {
vlog.info("Ignoring DisconnectAction=Lock - no current user");
} else {
@@ -460,8 +465,8 @@ SDisplay::recreatePixelBuffer(bool force) {
Rect newScreenRect;
if (strlen(displayDevice) > 0) {
MonitorInfo info(displayDevice);
- newScreenRect = Rect(info.rcMonitor.left, info.rcMonitor.top,
- info.rcMonitor.right, info.rcMonitor.bottom);
+ newScreenRect = {info.rcMonitor.left, info.rcMonitor.top,
+ info.rcMonitor.right, info.rcMonitor.bottom};
} else {
newScreenRect = new_device->getClipBox();
}
diff --git a/win/rfb_win32/SDisplay.h b/win/rfb_win32/SDisplay.h
index aa1a69e5..e116b483 100644
--- a/win/rfb_win32/SDisplay.h
+++ b/win/rfb_win32/SDisplay.h
@@ -24,9 +24,11 @@
#ifndef __RFB_SDISPLAY_H__
#define __RFB_SDISPLAY_H__
+#include <core/Configuration.h>
+
#include <rfb/SDesktop.h>
#include <rfb/UpdateTracker.h>
-#include <rfb/Configuration.h>
+
#include <rfb_win32/Handle.h>
#include <rfb_win32/EventManager.h>
#include <rfb_win32/SInput.h>
@@ -48,7 +50,7 @@ namespace rfb {
class SDisplayCore {
public:
virtual ~SDisplayCore() {};
- virtual void setScreenRect(const Rect& screenRect_) = 0;
+ virtual void setScreenRect(const core::Rect& screenRect_) = 0;
virtual void flushUpdates() = 0;
virtual const char* methodName() const = 0;
};
@@ -80,7 +82,8 @@ namespace rfb {
void handleClipboardRequest() override;
void handleClipboardAnnounce(bool available) override;
void handleClipboardData(const char* data) override;
- void pointerEvent(const Point& pos, uint16_t buttonmask) override;
+ void pointerEvent(const core::Point& pos,
+ uint16_t buttonmask) override;
void keyEvent(uint32_t keysym, uint32_t keycode, bool down) override;
// -=- Clipboard events
@@ -107,11 +110,11 @@ namespace rfb {
queryConnectionHandler = qch;
}
- static IntParameter updateMethod;
- static BoolParameter disableLocalInputs;
- static StringParameter disconnectAction;
- static BoolParameter removeWallpaper;
- static BoolParameter disableEffects;
+ static core::IntParameter updateMethod;
+ static core::BoolParameter disableLocalInputs;
+ static core::EnumParameter disconnectAction;
+ static core::BoolParameter removeWallpaper;
+ static core::BoolParameter disableEffects;
// -=- Use by VNC Config to determine whether hooks are available
static bool areHooksAvailable();
@@ -133,7 +136,7 @@ namespace rfb {
DeviceContext* device;
// -=- The coordinates of Window's entire virtual Screen
- Rect screenRect;
+ core::Rect screenRect;
// -=- All changes are collected in UN-CLIPPED Display coords and merged
// When they are to be flushed to the VNCServer, they are changed
@@ -162,8 +165,8 @@ namespace rfb {
// Cursor
WMCursor* cursor;
WMCursor::Info old_cursor;
- Region old_cursor_region;
- Point cursor_renderpos;
+ core::Region old_cursor_region;
+ core::Point cursor_renderpos;
// -=- Event signalled to trigger an update to be flushed
Handle updateEvent;
diff --git a/win/rfb_win32/SDisplayCorePolling.cxx b/win/rfb_win32/SDisplayCorePolling.cxx
index bd8883e6..0a600c97 100644
--- a/win/rfb_win32/SDisplayCorePolling.cxx
+++ b/win/rfb_win32/SDisplayCorePolling.cxx
@@ -22,9 +22,11 @@
#include <config.h>
#endif
+#include <core/LogWriter.h>
+
#include <rfb_win32/SDisplayCorePolling.h>
-#include <rfb/LogWriter.h>
+using namespace core;
using namespace rfb;
using namespace rfb::win32;
@@ -37,7 +39,9 @@ const unsigned int SDisplayCorePolling::pollTimerId = 1;
SDisplayCorePolling::SDisplayCorePolling(SDisplay* d, UpdateTracker* ut, int pollInterval_)
: MsgWindow("rfb::win32::SDisplayCorePolling"),
pollTimer(getHandle(), pollTimerId), pollNextStrip(false), display(d), updateTracker(ut) {
- pollInterval = __rfbmax(10, (pollInterval_ / POLLING_SEGMENTS));
+ pollInterval = pollInterval_ / POLLING_SEGMENTS;
+ if (pollInterval < 10)
+ pollInterval = 10;
copyrect.setUpdateTracker(ut);
}
@@ -78,7 +82,8 @@ void SDisplayCorePolling::flushUpdates() {
// No. Poll the next section
pollrect.tl.y = pollNextY;
pollNextY += pollIncrementY;
- pollrect.br.y = __rfbmin(pollNextY, pollrect.br.y);
+ if (pollrect.br.y > pollNextY)
+ pollrect.br.y = pollNextY;
updateTracker->add_changed(pollrect);
}
}
diff --git a/win/rfb_win32/SDisplayCorePolling.h b/win/rfb_win32/SDisplayCorePolling.h
index 00de2d40..bfd72d74 100644
--- a/win/rfb_win32/SDisplayCorePolling.h
+++ b/win/rfb_win32/SDisplayCorePolling.h
@@ -40,7 +40,7 @@ namespace rfb {
~SDisplayCorePolling();
// - Called by SDisplay to inform Core of the screen size
- void setScreenRect(const Rect& screenRect_) override;
+ void setScreenRect(const core::Rect& screenRect_) override;
// - Called by SDisplay to flush updates to the specified tracker
void flushUpdates() override;
@@ -58,7 +58,7 @@ namespace rfb {
// - Background full screen polling fields
IntervalTimer pollTimer;
static const unsigned int pollTimerId;
- Rect screenRect;
+ core::Rect screenRect;
int pollInterval;
int pollNextY;
int pollIncrementY;
diff --git a/win/rfb_win32/SDisplayCoreWMHooks.cxx b/win/rfb_win32/SDisplayCoreWMHooks.cxx
index 056ff4cb..62ab8f75 100644
--- a/win/rfb_win32/SDisplayCoreWMHooks.cxx
+++ b/win/rfb_win32/SDisplayCoreWMHooks.cxx
@@ -22,9 +22,11 @@
#include <config.h>
#endif
+#include <core/LogWriter.h>
+
#include <rfb_win32/SDisplayCoreWMHooks.h>
-#include <rfb/LogWriter.h>
+using namespace core;
using namespace rfb;
using namespace rfb::win32;
diff --git a/win/rfb_win32/SInput.cxx b/win/rfb_win32/SInput.cxx
index 13ac9f26..2a772fe8 100644
--- a/win/rfb_win32/SInput.cxx
+++ b/win/rfb_win32/SInput.cxx
@@ -30,13 +30,15 @@
#define XK_CURRENCY
#include <rfb/keysymdef.h>
+#include <core/Exception.h>
+#include <core/LogWriter.h>
+
#include <rfb_win32/SInput.h>
#include <rfb_win32/MonitorInfo.h>
#include <rfb_win32/Service.h>
#include <rfb_win32/keymap.h>
-#include <rdr/Exception.h>
-#include <rfb/LogWriter.h>
+using namespace core;
using namespace rfb;
static LogWriter vlog("SInput");
@@ -126,7 +128,7 @@ win32::SPointer::pointerEvent(const Point& pos, uint16_t buttonmask)
evt.mi.mouseData = data;
evt.mi.time = 0;
if (SendInput(1, &evt, sizeof(evt)) != 1)
- throw rdr::win32_error("SendInput", GetLastError());
+ throw core::win32_error("SendInput", GetLastError());
}
}
diff --git a/win/rfb_win32/SInput.h b/win/rfb_win32/SInput.h
index 018bec55..6f1341ee 100644
--- a/win/rfb_win32/SInput.h
+++ b/win/rfb_win32/SInput.h
@@ -24,8 +24,8 @@
#ifndef __RFB_WIN32_INPUT_H__
#define __RFB_WIN32_INPUT_H__
-#include <rfb/Rect.h>
-#include <rfb/Configuration.h>
+#include <core/Configuration.h>
+#include <core/Rect.h>
#include <map>
#include <vector>
@@ -44,9 +44,9 @@ namespace rfb {
// - Create a pointer event at a the given coordinates, with the
// specified button state. The event must be specified using
// Screen coordinates.
- void pointerEvent(const Point& pos, uint16_t buttonmask);
+ void pointerEvent(const core::Point& pos, uint16_t buttonmask);
protected:
- Point last_position;
+ core::Point last_position;
uint16_t last_buttonmask;
};
@@ -56,8 +56,8 @@ namespace rfb {
public:
SKeyboard();
void keyEvent(uint32_t keysym, uint32_t keycode, bool down);
- static BoolParameter deadKeyAware;
- static BoolParameter rawKeyboard;
+ static core::BoolParameter deadKeyAware;
+ static core::BoolParameter rawKeyboard;
private:
std::map<uint32_t,uint8_t> vkMap;
std::map<uint32_t,bool> extendedMap;
diff --git a/win/rfb_win32/Security.cxx b/win/rfb_win32/Security.cxx
index 8f000e1b..eededb6a 100644
--- a/win/rfb_win32/Security.cxx
+++ b/win/rfb_win32/Security.cxx
@@ -22,13 +22,15 @@
#include <config.h>
#endif
+#include <core/LogWriter.h>
+
#include <rfb_win32/Security.h>
-#include <rfb/LogWriter.h>
#include <lmcons.h>
#include <accctrl.h>
#include <list>
+using namespace core;
using namespace rfb;
using namespace rfb::win32;
@@ -99,7 +101,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::win32_error("CopySid failed", GetLastError());
+ throw core::win32_error("CopySid failed", GetLastError());
return buf;
}
@@ -108,7 +110,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::win32_error("CopySid failed", GetLastError());
+ throw core::win32_error("CopySid failed", GetLastError());
}
void Sid::getUserNameAndDomain(char** name, char** domain) {
@@ -117,12 +119,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::win32_error("Unable to determine SID name lengths", GetLastError());
+ throw core::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::win32_error("Unable to lookup account SID", GetLastError());
+ throw core::win32_error("Unable to lookup account SID", GetLastError());
}
@@ -133,7 +135,7 @@ Sid::Administrators::Administrators() {
SECURITY_BUILTIN_DOMAIN_RID,
DOMAIN_ALIAS_RID_ADMINS,
0, 0, 0, 0, 0, 0, &sid))
- throw rdr::win32_error("Sid::Administrators", GetLastError());
+ throw core::win32_error("Sid::Administrators", GetLastError());
setSID(sid);
FreeSid(sid);
}
@@ -144,7 +146,7 @@ Sid::SYSTEM::SYSTEM() {
if (!AllocateAndInitializeSid(&ntAuth, 1,
SECURITY_LOCAL_SYSTEM_RID,
0, 0, 0, 0, 0, 0, 0, &sid))
- throw rdr::win32_error("Sid::SYSTEM", GetLastError());
+ throw core::win32_error("Sid::SYSTEM", GetLastError());
setSID(sid);
FreeSid(sid);
}
@@ -154,7 +156,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::win32_error("GetTokenInformation", GetLastError());
+ throw core::win32_error("GetTokenInformation", GetLastError());
TOKEN_USER* tokenUser = (TOKEN_USER*)tmp.data();
setSID(tokenUser->User.Sid);
}
@@ -164,7 +166,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::win32_error("SetEntriesInAcl", result);
+ throw core::win32_error("SetEntriesInAcl", result);
return new_dacl;
}
@@ -172,18 +174,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::win32_error("InitializeSecurityDescriptor", GetLastError());
+ throw core::win32_error("InitializeSecurityDescriptor", GetLastError());
Sid::SYSTEM owner;
if (!SetSecurityDescriptorOwner(&absSD, owner, FALSE))
- throw rdr::win32_error("SetSecurityDescriptorOwner", GetLastError());
+ throw core::win32_error("SetSecurityDescriptorOwner", GetLastError());
Sid::Administrators group;
if (!SetSecurityDescriptorGroup(&absSD, group, FALSE))
- throw rdr::win32_error("SetSecurityDescriptorGroupp", GetLastError());
+ throw core::win32_error("SetSecurityDescriptorGroupp", GetLastError());
if (!SetSecurityDescriptorDacl(&absSD, TRUE, dacl, FALSE))
- throw rdr::win32_error("SetSecurityDescriptorDacl", GetLastError());
+ throw core::win32_error("SetSecurityDescriptorDacl", GetLastError());
DWORD sdSize = GetSecurityDescriptorLength(&absSD);
SecurityDescriptorPtr sd(sdSize);
if (!MakeSelfRelativeSD(&absSD, (PSECURITY_DESCRIPTOR)sd.ptr, &sdSize))
- throw rdr::win32_error("MakeSelfRelativeSD", GetLastError());
+ throw core::win32_error("MakeSelfRelativeSD", GetLastError());
return sd.takeSD();
}
diff --git a/win/rfb_win32/SecurityPage.cxx b/win/rfb_win32/SecurityPage.cxx
index a6f026cf..94a88492 100644
--- a/win/rfb_win32/SecurityPage.cxx
+++ b/win/rfb_win32/SecurityPage.cxx
@@ -21,9 +21,8 @@
#include <config.h>
#endif
-#include <rdr/Exception.h>
+#include <core/LogWriter.h>
-#include <rfb/LogWriter.h>
#include <rfb/Security.h>
#include <rfb_win32/resource.h>
@@ -31,7 +30,7 @@
#include <list>
-using namespace rdr;
+using namespace core;
using namespace rfb;
using namespace rfb::win32;
using namespace std;
@@ -124,9 +123,6 @@ SecurityPage::onOk() {
bool vnc_loaded = false;
list<uint32_t> secTypes;
- /* Keep same priorities as in common/rfb/SecurityClient::secTypes */
- secTypes.push_back(secTypeVeNCrypt);
-
#ifdef HAVE_GNUTLS
/* X509Plain */
if (authMethodEnabled(IDC_ENC_X509, IDC_AUTH_PLAIN)) {
diff --git a/win/rfb_win32/Service.cxx b/win/rfb_win32/Service.cxx
index bc9875e5..d28fdb75 100644
--- a/win/rfb_win32/Service.cxx
+++ b/win/rfb_win32/Service.cxx
@@ -22,18 +22,19 @@
#include <config.h>
#endif
+#include <core/Exception.h>
+#include <core/LogWriter.h>
+#include <core/string.h>
+
#include <rfb_win32/Service.h>
#include <rfb_win32/MsgWindow.h>
#include <rfb_win32/ModuleFileName.h>
#include <rfb_win32/Registry.h>
#include <rfb_win32/Handle.h>
-#include <logmessages/messages.h>
-#include <rdr/Exception.h>
-#include <rfb/LogWriter.h>
-#include <rfb/util.h>
+#include <logmessages/messages.h>
-using namespace rdr;
+using namespace core;
using namespace rfb;
using namespace win32;
@@ -335,7 +336,7 @@ bool rfb::win32::registerService(const char* name,
// - Open the SCM
ServiceHandle scm = OpenSCManager(nullptr, nullptr, SC_MANAGER_CREATE_SERVICE);
if (!scm)
- throw rdr::win32_error("Unable to open Service Control Manager", GetLastError());
+ throw core::win32_error("Unable to open Service Control Manager", GetLastError());
// - Add the service
ServiceHandle handle = CreateService(scm,
@@ -344,7 +345,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::win32_error("Unable to create service", GetLastError());
+ throw core::win32_error("Unable to create service", GetLastError());
// - Set a description
SERVICE_DESCRIPTION sdesc = {(LPTSTR)desc};
@@ -380,14 +381,14 @@ bool rfb::win32::unregisterService(const char* name) {
// - Open the SCM
ServiceHandle scm = OpenSCManager(nullptr, nullptr, SC_MANAGER_CREATE_SERVICE);
if (!scm)
- throw rdr::win32_error("Unable to open Service Control Manager", GetLastError());
+ throw core::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::win32_error("Unable to locate the service", GetLastError());
+ throw core::win32_error("Unable to locate the service", GetLastError());
if (!DeleteService(handle))
- throw rdr::win32_error("Unable to remove the service", GetLastError());
+ throw core::win32_error("Unable to remove the service", GetLastError());
// - Register the event log source
RegKey hk;
@@ -407,16 +408,16 @@ bool rfb::win32::startService(const char* name) {
// - Open the SCM
ServiceHandle scm = OpenSCManager(nullptr, nullptr, SC_MANAGER_CONNECT);
if (!scm)
- throw rdr::win32_error("Unable to open Service Control Manager", GetLastError());
+ throw core::win32_error("Unable to open Service Control Manager", GetLastError());
// - Locate the service
ServiceHandle handle = OpenService(scm, name, SERVICE_START);
if (!handle)
- throw rdr::win32_error("Unable to open the service", GetLastError());
+ throw core::win32_error("Unable to open the service", GetLastError());
// - Start the service
if (!StartService(handle, 0, nullptr))
- throw rdr::win32_error("Unable to start the service", GetLastError());
+ throw core::win32_error("Unable to start the service", GetLastError());
Sleep(500);
@@ -427,17 +428,17 @@ bool rfb::win32::stopService(const char* name) {
// - Open the SCM
ServiceHandle scm = OpenSCManager(nullptr, nullptr, SC_MANAGER_CONNECT);
if (!scm)
- throw rdr::win32_error("Unable to open Service Control Manager", GetLastError());
+ throw core::win32_error("Unable to open Service Control Manager", GetLastError());
// - Locate the service
ServiceHandle handle = OpenService(scm, name, SERVICE_STOP);
if (!handle)
- throw rdr::win32_error("Unable to open the service", GetLastError());
+ throw core::win32_error("Unable to open the service", GetLastError());
// - Start the service
SERVICE_STATUS status;
if (!ControlService(handle, SERVICE_CONTROL_STOP, &status))
- throw rdr::win32_error("Unable to stop the service", GetLastError());
+ throw core::win32_error("Unable to stop the service", GetLastError());
Sleep(500);
@@ -448,17 +449,17 @@ DWORD rfb::win32::getServiceState(const char* name) {
// - Open the SCM
ServiceHandle scm = OpenSCManager(nullptr, nullptr, SC_MANAGER_CONNECT);
if (!scm)
- throw rdr::win32_error("Unable to open Service Control Manager", GetLastError());
+ throw core::win32_error("Unable to open Service Control Manager", GetLastError());
// - Locate the service
ServiceHandle handle = OpenService(scm, name, SERVICE_INTERROGATE);
if (!handle)
- throw rdr::win32_error("Unable to open the service", GetLastError());
+ throw core::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::win32_error("Unable to query the service", GetLastError());
+ throw core::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 7f6d1773..9a22ee14 100644
--- a/win/rfb_win32/SocketManager.cxx
+++ b/win/rfb_win32/SocketManager.cxx
@@ -25,16 +25,19 @@
#include <winsock2.h>
#include <list>
-#include <rdr/Exception.h>
+#include <core/Exception.h>
+#include <core/LogWriter.h>
+#include <core/Timer.h>
+#include <core/time.h>
+
+#include <rdr/FdOutStream.h>
#include <network/Socket.h>
-#include <rfb/LogWriter.h>
-#include <rfb/Timer.h>
#include <rfb/VNCServer.h>
-#include <rfb/util.h>
#include <rfb_win32/SocketManager.h>
+using namespace core;
using namespace rfb;
using namespace rfb::win32;
@@ -69,7 +72,7 @@ void SocketManager::addListener(network::SocketListener* sock_,
flags |= FD_ADDRESS_LIST_CHANGE;
try {
if (event && (WSAEventSelect(sock_->getFd(), event, flags) == SOCKET_ERROR))
- throw rdr::socket_error("Unable to select on listener", WSAGetLastError());
+ throw core::socket_error("Unable to select on listener", WSAGetLastError());
// requestAddressChangeEvents MUST happen after WSAEventSelect, so that the socket is non-blocking
if (acn)
@@ -186,7 +189,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::socket_error("unable to adjust WSAEventSelect:%u", WSAGetLastError());
+ throw core::socket_error("unable to adjust WSAEventSelect:%u", WSAGetLastError());
}
}
@@ -236,11 +239,11 @@ void SocketManager::processEvent(HANDLE event) {
// Fetch why this event notification triggered
if (WSAEnumNetworkEvents(ci.sock->getFd(), event, &network_events) == SOCKET_ERROR)
- throw rdr::socket_error("Unable to get WSAEnumNetworkEvents:%u", WSAGetLastError());
+ throw core::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::socket_error("unable to disable WSAEventSelect:%u", WSAGetLastError());
+ throw core::socket_error("unable to disable WSAEventSelect:%u", WSAGetLastError());
// Reset the event object
WSAResetEvent(event);
@@ -268,7 +271,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::socket_error("unable to re-enable WSAEventSelect:%u", WSAGetLastError());
+ throw core::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/TrayIcon.h b/win/rfb_win32/TrayIcon.h
index b4e75ea5..9eccc937 100644
--- a/win/rfb_win32/TrayIcon.h
+++ b/win/rfb_win32/TrayIcon.h
@@ -25,8 +25,8 @@
#include <windows.h>
#include <shellapi.h>
+
#include <rfb_win32/MsgWindow.h>
-#include <rdr/Exception.h>
namespace rfb {
diff --git a/win/rfb_win32/TsSessions.cxx b/win/rfb_win32/TsSessions.cxx
index faf83e89..77d6cc52 100644
--- a/win/rfb_win32/TsSessions.cxx
+++ b/win/rfb_win32/TsSessions.cxx
@@ -20,12 +20,14 @@
#include <config.h>
#endif
+#include <core/Exception.h>
+#include <core/LogWriter.h>
+
#include <rfb_win32/TsSessions.h>
-#include <rfb/LogWriter.h>
-#include <rdr/Exception.h>
+
#include <wtsapi32.h>
-static rfb::LogWriter vlog("TsSessions");
+static core::LogWriter vlog("TsSessions");
namespace rfb {
namespace win32 {
@@ -35,7 +37,7 @@ namespace win32 {
if (processId == (DWORD)-1)
processId = GetCurrentProcessId();
if (!ProcessIdToSessionId(GetCurrentProcessId(), &id))
- throw rdr::win32_error("ProcessIdToSessionId", GetLastError());
+ throw core::win32_error("ProcessIdToSessionId", GetLastError());
}
ProcessSessionId mySessionId;
@@ -57,7 +59,7 @@ namespace win32 {
ConsoleSessionId console;
vlog.info("Console session is %lu", console.id);
if (!WTSConnectSession(sessionId, console.id, (PTSTR)"", 0))
- throw rdr::win32_error("Unable to connect session to Console", GetLastError());
+ throw core::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 65d7a9d7..4481f3f7 100644
--- a/win/rfb_win32/WMCursor.cxx
+++ b/win/rfb_win32/WMCursor.cxx
@@ -22,11 +22,14 @@
#include <config.h>
#endif
+#include <core/Exception.h>
+#include <core/LogWriter.h>
+
#include <rfb_win32/WMCursor.h>
+
#include <rfb/Exception.h>
-#include <rfb/LogWriter.h>
-using namespace rdr;
+using namespace core;
using namespace rfb;
using namespace rfb::win32;
@@ -45,9 +48,9 @@ WMCursor::getCursorInfo() {
CURSORINFO info;
info.cbSize = sizeof(CURSORINFO);
if (!GetCursorInfo(&info))
- throw rdr::win32_error("GetCursorInfo failed", GetLastError());
+ throw core::win32_error("GetCursorInfo failed", GetLastError());
result.cursor = info.hCursor;
- result.position = Point(info.ptScreenPos.x, info.ptScreenPos.y);
+ result.position = {info.ptScreenPos.x, info.ptScreenPos.y};
result.visible = info.flags & CURSOR_SHOWING;
return result;
}
diff --git a/win/rfb_win32/WMCursor.h b/win/rfb_win32/WMCursor.h
index 465331de..1df50741 100644
--- a/win/rfb_win32/WMCursor.h
+++ b/win/rfb_win32/WMCursor.h
@@ -38,7 +38,7 @@ namespace rfb {
struct Info {
HCURSOR cursor;
- Point position;
+ core::Point position;
bool visible;
Info() : cursor(nullptr), visible(false) {}
bool operator!=(const Info& info) {
diff --git a/win/rfb_win32/WMHooks.cxx b/win/rfb_win32/WMHooks.cxx
index e1840eef..e3285948 100644
--- a/win/rfb_win32/WMHooks.cxx
+++ b/win/rfb_win32/WMHooks.cxx
@@ -22,17 +22,19 @@
#include <config.h>
#endif
-#include <os/Mutex.h>
-#include <os/Thread.h>
+#include <mutex>
+#include <thread>
+
+#include <core/LogWriter.h>
#include <rfb_win32/WMHooks.h>
#include <rfb_win32/Service.h>
#include <rfb_win32/MsgWindow.h>
#include <rfb_win32/IntervalTimer.h>
-#include <rfb/LogWriter.h>
#include <list>
+using namespace core;
using namespace rfb;
using namespace rfb::win32;
@@ -114,21 +116,23 @@ error:
}
-class WMHooksThread : public os::Thread {
+class WMHooksThread {
public:
- WMHooksThread() : active(true), thread_id(-1) { }
+ WMHooksThread() : active(true), thread(WMHooksThread::worker, this),
+ thread_id(-1) { }
void stop();
DWORD getThreadId() { return thread_id; }
protected:
- void worker() override;
+ void worker();
protected:
bool active;
+ std::thread thread;
DWORD thread_id;
};
static WMHooksThread* hook_mgr = nullptr;
static std::list<WMHooks*> hooks;
-static os::Mutex hook_mgr_lock;
+static std::mutex hook_mgr_lock;
static bool StartHookThread() {
@@ -138,7 +142,6 @@ static bool StartHookThread() {
return false;
vlog.debug("Creating thread");
hook_mgr = new WMHooksThread();
- hook_mgr->start();
while (hook_mgr->getThreadId() == (DWORD)-1)
Sleep(0);
vlog.debug("Installing hooks");
@@ -166,7 +169,7 @@ static void StopHookThread() {
static bool AddHook(WMHooks* hook) {
vlog.debug("Adding hook");
- os::AutoMutex a(&hook_mgr_lock);
+ const std::lock_guard<std::mutex> lock(hook_mgr_lock);
if (!StartHookThread())
return false;
hooks.push_back(hook);
@@ -176,7 +179,7 @@ static bool AddHook(WMHooks* hook) {
static bool RemHook(WMHooks* hook) {
{
vlog.debug("Removing hook");
- os::AutoMutex a(&hook_mgr_lock);
+ const std::lock_guard<std::mutex> lock(hook_mgr_lock);
hooks.remove(hook);
}
StopHookThread();
@@ -184,7 +187,7 @@ static bool RemHook(WMHooks* hook) {
}
static void NotifyHooksRegion(const Region& r) {
- os::AutoMutex a(&hook_mgr_lock);
+ const std::lock_guard<std::mutex> lock(hook_mgr_lock);
std::list<WMHooks*>::iterator i;
for (i=hooks.begin(); i!=hooks.end(); i++)
(*i)->NotifyHooksRegion(r);
@@ -236,8 +239,8 @@ WMHooksThread::worker() {
hwnd = (HWND) msg.lParam;
if (IsWindow(hwnd) && IsWindowVisible(hwnd) && !IsIconic(hwnd) &&
GetWindowRect(hwnd, &wrect) && !IsRectEmpty(&wrect)) {
- updates[activeRgn].assign_union(Rect(wrect.left, wrect.top,
- wrect.right, wrect.bottom));
+ updates[activeRgn].assign_union({{wrect.left, wrect.top,
+ wrect.right, wrect.bottom}});
updateDelayTimer.start(updateDelayMs);
}
@@ -249,8 +252,8 @@ WMHooksThread::worker() {
{
POINT pt = {0,0};
if (ClientToScreen(hwnd, &pt)) {
- updates[activeRgn].assign_union(Rect(wrect.left+pt.x, wrect.top+pt.y,
- wrect.right+pt.x, wrect.bottom+pt.y));
+ updates[activeRgn].assign_union({{wrect.left+pt.x, wrect.top+pt.y,
+ wrect.right+pt.x, wrect.bottom+pt.y}});
updateDelayTimer.start(updateDelayMs);
}
}
@@ -260,14 +263,14 @@ WMHooksThread::worker() {
if (IsWindow(hwnd) && IsWindowVisible(hwnd) && !IsIconic(hwnd) &&
GetWindowRect(hwnd, &wrect) && !IsRectEmpty(&wrect))
{
- Region changed(Rect(wrect.left, wrect.top, wrect.right, wrect.bottom));
+ Region changed({wrect.left, wrect.top, wrect.right, wrect.bottom});
RECT crect;
POINT pt = {0,0};
if (GetClientRect(hwnd, &crect) && ClientToScreen(hwnd, &pt) &&
!IsRectEmpty(&crect))
{
- changed.assign_subtract(Rect(crect.left+pt.x, crect.top+pt.y,
- crect.right+pt.x, crect.bottom+pt.y));
+ changed.assign_subtract({{crect.left+pt.x, crect.top+pt.y,
+ crect.right+pt.x, crect.bottom+pt.y}});
}
if (!changed.is_empty()) {
updates[activeRgn].assign_union(changed);
@@ -275,8 +278,8 @@ WMHooksThread::worker() {
}
}
} else if (msg.message == rectangleMsg) {
- Rect r = Rect(LOWORD(msg.wParam), HIWORD(msg.wParam),
- LOWORD(msg.lParam), HIWORD(msg.lParam));
+ Rect r(LOWORD(msg.wParam), HIWORD(msg.wParam),
+ LOWORD(msg.lParam), HIWORD(msg.lParam));
if (!r.is_empty()) {
updates[activeRgn].assign_union(r);
updateDelayTimer.start(updateDelayMs);
@@ -301,7 +304,7 @@ WMHooksThread::stop() {
active = false;
PostThreadMessage(thread_id, WM_QUIT, 0, 0);
vlog.debug("Waiting for WMHooks thread");
- wait();
+ thread.join();
}
// -=- WMHooks class
@@ -323,7 +326,7 @@ bool rfb::win32::WMHooks::setEvent(HANDLE ue) {
bool rfb::win32::WMHooks::getUpdates(UpdateTracker* ut) {
if (!updatesReady) return false;
- os::AutoMutex a(&hook_mgr_lock);
+ const std::lock_guard<std::mutex> lock(hook_mgr_lock);
updates.copyTo(ut);
updates.clear();
updatesReady = false;
@@ -375,12 +378,12 @@ static bool blockRealInputs(bool block_) {
return block_ == blocking;
}
-static os::Mutex blockMutex;
+static std::mutex blockMutex;
static int blockCount = 0;
bool rfb::win32::WMBlockInput::blockInputs(bool on) {
if (active == on) return true;
- os::AutoMutex a(&blockMutex);
+ const std::lock_guard<std::mutex> lock(blockMutex);
int newCount = on ? blockCount+1 : blockCount-1;
if (!blockRealInputs(newCount > 0))
return false;
diff --git a/win/rfb_win32/WMHooks.h b/win/rfb_win32/WMHooks.h
index c1dbd5f3..0a729239 100644
--- a/win/rfb_win32/WMHooks.h
+++ b/win/rfb_win32/WMHooks.h
@@ -22,8 +22,9 @@
#define __RFB_WIN32_WM_HOOKS_H__
#include <windows.h>
+
#include <rfb/UpdateTracker.h>
-#include <rdr/Exception.h>
+
#include <rfb_win32/Win32Util.h>
namespace rfb {
@@ -53,7 +54,7 @@ namespace rfb {
#endif
// * INTERNAL NOTIFICATION FUNCTION *
- void NotifyHooksRegion(const Region& r);
+ void NotifyHooksRegion(const core::Region& r);
protected:
HANDLE updateEvent;
bool updatesReady;
diff --git a/win/rfb_win32/WMNotifier.cxx b/win/rfb_win32/WMNotifier.cxx
index 894add1c..3fda81e7 100644
--- a/win/rfb_win32/WMNotifier.cxx
+++ b/win/rfb_win32/WMNotifier.cxx
@@ -22,12 +22,13 @@
#include <config.h>
#endif
+#include <core/LogWriter.h>
+
#include <rfb_win32/WMNotifier.h>
#include <rfb_win32/WMShatter.h>
#include <rfb_win32/MsgWindow.h>
-#include <rfb/LogWriter.h>
-
+using namespace core;
using namespace rfb;
using namespace rfb::win32;
diff --git a/win/rfb_win32/WMPoller.cxx b/win/rfb_win32/WMPoller.cxx
index e2ff0ac6..e1efc447 100644
--- a/win/rfb_win32/WMPoller.cxx
+++ b/win/rfb_win32/WMPoller.cxx
@@ -22,12 +22,13 @@
#include <config.h>
#endif
-#include <rdr/Exception.h>
+#include <core/Configuration.h>
+#include <core/Exception.h>
+#include <core/LogWriter.h>
#include <rfb_win32/WMPoller.h>
-#include <rfb/LogWriter.h>
-#include <rfb/Configuration.h>
+using namespace core;
using namespace rfb;
using namespace rfb::win32;
@@ -58,7 +59,7 @@ bool
rfb::win32::WMPoller::checkPollWindow(HWND w) {
char buffer[128];
if (!GetClassName(w, buffer, 128))
- throw rdr::win32_error("Unable to get window class:%u", GetLastError());
+ throw core::win32_error("Unable to get window class:%u", GetLastError());
if ((strcmp(buffer, "tty") != 0) &&
(strcmp(buffer, "ConsoleWindowClass") != 0)) {
return false;
@@ -71,7 +72,7 @@ rfb::win32::WMPoller::pollWindow(HWND w, PollInfo* i) {
RECT r;
if (IsWindowVisible(w) && GetWindowRect(w, &r)) {
if (IsRectEmpty(&r)) return;
- Region wrgn(Rect(r.left, r.top, r.right, r.bottom));
+ Region wrgn({r.left, r.top, r.right, r.bottom});
if (checkPollWindow(w)) {
wrgn.assign_subtract(i->poll_exclude);
i->poll_include.assign_union(wrgn);
diff --git a/win/rfb_win32/WMPoller.h b/win/rfb_win32/WMPoller.h
index 0783e4ff..7fa896f0 100644
--- a/win/rfb_win32/WMPoller.h
+++ b/win/rfb_win32/WMPoller.h
@@ -29,8 +29,10 @@
#define __RFB_WIN32_WM_POLLER_H__
#include <windows.h>
+
+#include <core/Configuration.h>
+
#include <rfb/UpdateTracker.h>
-#include <rfb/Configuration.h>
namespace rfb {
@@ -43,11 +45,11 @@ namespace rfb {
bool processEvent();
bool setUpdateTracker(UpdateTracker* ut);
- static BoolParameter poll_console_windows;
+ static core::BoolParameter poll_console_windows;
protected:
struct PollInfo {
- Region poll_include;
- Region poll_exclude;
+ core::Region poll_include;
+ core::Region poll_exclude;
};
static bool checkPollWindow(HWND w);
static void pollWindow(HWND w, PollInfo* info);
diff --git a/win/rfb_win32/WMShatter.cxx b/win/rfb_win32/WMShatter.cxx
index ede80e91..0965da86 100644
--- a/win/rfb_win32/WMShatter.cxx
+++ b/win/rfb_win32/WMShatter.cxx
@@ -22,10 +22,11 @@
#include <config.h>
#endif
-#include <rfb_win32/WMShatter.h>
+#include <core/LogWriter.h>
-#include <rfb/LogWriter.h>
+#include <rfb_win32/WMShatter.h>
+using namespace core;
using namespace rfb;
using namespace rfb::win32;
diff --git a/win/rfb_win32/WMWindowCopyRect.cxx b/win/rfb_win32/WMWindowCopyRect.cxx
index ec6e1fdc..d64c0e31 100644
--- a/win/rfb_win32/WMWindowCopyRect.cxx
+++ b/win/rfb_win32/WMWindowCopyRect.cxx
@@ -22,10 +22,13 @@
#include <config.h>
#endif
+#include <core/LogWriter.h>
+
#include <rfb_win32/WMWindowCopyRect.h>
-#include <rfb/LogWriter.h>
+
#include <windows.h>
+using namespace core;
using namespace rfb;
using namespace rfb::win32;
@@ -49,8 +52,8 @@ rfb::win32::WMCopyRect::processEvent() {
// Window has moved - mark both the previous and new position as changed
// (we can't use add_copied() here because we aren't that properly synced
// with the actual state of the framebuffer)
- ut->add_changed(Region(winrect));
- ut->add_changed(Region(fg_window_rect));
+ ut->add_changed(winrect);
+ ut->add_changed(fg_window_rect);
}
}
fg_window = window;
diff --git a/win/rfb_win32/WMWindowCopyRect.h b/win/rfb_win32/WMWindowCopyRect.h
index 5a0e876d..d3ed7881 100644
--- a/win/rfb_win32/WMWindowCopyRect.h
+++ b/win/rfb_win32/WMWindowCopyRect.h
@@ -43,7 +43,7 @@ namespace rfb {
protected:
UpdateTracker* ut;
void* fg_window;
- Rect fg_window_rect;
+ core::Rect fg_window_rect;
};
};
diff --git a/win/rfb_win32/Win32Util.cxx b/win/rfb_win32/Win32Util.cxx
index b35bf629..f4220e32 100644
--- a/win/rfb_win32/Win32Util.cxx
+++ b/win/rfb_win32/Win32Util.cxx
@@ -22,15 +22,20 @@
#include <config.h>
#endif
+#include <core/Exception.h>
+#include <core/string.h>
+
#include <rfb_win32/ModuleFileName.h>
#include <rfb_win32/Win32Util.h>
#include <rfb_win32/MonitorInfo.h>
#include <rfb_win32/Handle.h>
+
#include <rdr/HexOutStream.h>
-#include <rdr/Exception.h>
-#include <rfb/util.h>
+
#include <stdio.h>
+using namespace core;
+
namespace rfb {
namespace win32 {
@@ -46,19 +51,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::win32_error("Failed to open file", GetLastError());
+ throw core::win32_error("Failed to open file", GetLastError());
}
// Get version info size
DWORD handle;
int size = GetFileVersionInfoSize((char*)filename, &handle);
if (!size)
- throw rdr::win32_error("GetVersionInfoSize failed", GetLastError());
+ throw core::win32_error("GetVersionInfoSize failed", GetLastError());
// Get version info
buf = new char[size];
if (!GetFileVersionInfo((char*)filename, handle, size, buf))
- throw rdr::win32_error("GetVersionInfo failed", GetLastError());
+ throw core::win32_error("GetVersionInfo failed", GetLastError());
}
FileVersionInfo::~FileVersionInfo() {
diff --git a/win/vncconfig/Authentication.h b/win/vncconfig/Authentication.h
index 1123678f..2bf44dee 100644
--- a/win/vncconfig/Authentication.h
+++ b/win/vncconfig/Authentication.h
@@ -33,7 +33,7 @@
#include <rfb/SSecurityTLS.h>
#endif
-static rfb::BoolParameter queryOnlyIfLoggedOn("QueryOnlyIfLoggedOn",
+static core::BoolParameter queryOnlyIfLoggedOn("QueryOnlyIfLoggedOn",
"Only prompt for a local user to accept incoming connections if there is a user logged on", false);
namespace rfb {
diff --git a/win/vncconfig/Connections.h b/win/vncconfig/Connections.h
index 9ec78c07..17c685ea 100644
--- a/win/vncconfig/Connections.h
+++ b/win/vncconfig/Connections.h
@@ -20,19 +20,23 @@
#include <vector>
+#include <core/Configuration.h>
+#include <core/string.h>
+
#include <rfb_win32/Registry.h>
#include <rfb_win32/Dialog.h>
#include <rfb_win32/ModuleFileName.h>
-#include <rfb/Configuration.h>
+
#include <rfb/Blacklist.h>
-#include <rfb/util.h>
+
#include <network/TcpSocket.h>
-static rfb::IntParameter port_number("PortNumber",
- "TCP/IP port on which the server will accept connections", 5900);
-static rfb::StringParameter hosts("Hosts",
+static core::IntParameter port_number("PortNumber",
+ "TCP/IP port on which the server will accept connections",
+ 5900, 0, 65535);
+static core::StringParameter hosts("Hosts",
"Filter describing which hosts are allowed access to this server", "+");
-static rfb::BoolParameter localHost("LocalHost",
+static core::BoolParameter localHost("LocalHost",
"Only accept connections from via the local loop-back network interface", false);
namespace rfb {
@@ -100,7 +104,7 @@ namespace rfb {
SendMessage(listBox, LB_DELETESTRING, 0, 0);
std::vector<std::string> hostv;
- hostv = split(hosts, ',');
+ hostv = core::split(hosts, ',');
for (size_t i = 0; i < hostv.size(); i++) {
if (!hostv[i].empty())
SendMessage(listBox, LB_ADDSTRING, 0, (LPARAM)hostv[i].c_str());
diff --git a/win/vncconfig/Desktop.h b/win/vncconfig/Desktop.h
index a5058389..c7b97533 100644
--- a/win/vncconfig/Desktop.h
+++ b/win/vncconfig/Desktop.h
@@ -31,9 +31,8 @@ namespace rfb {
DesktopPage(const RegKey& rk)
: PropSheetPage(GetModuleHandle(nullptr), MAKEINTRESOURCE(IDD_DESKTOP)), regKey(rk) {}
void initDialog() override {
- const char *action(rfb::win32::SDisplay::disconnectAction);
- bool disconnectLock = stricmp(action, "Lock") == 0;
- bool disconnectLogoff = stricmp(action, "Logoff") == 0;
+ bool disconnectLock = rfb::win32::SDisplay::disconnectAction == "Lock";
+ bool disconnectLogoff = rfb::win32::SDisplay::disconnectAction == "Logoff";
setItemChecked(IDC_DISCONNECT_LOGOFF, disconnectLogoff);
setItemChecked(IDC_DISCONNECT_LOCK, disconnectLock);
setItemChecked(IDC_DISCONNECT_NONE, !disconnectLock && !disconnectLogoff);
@@ -47,9 +46,8 @@ namespace rfb {
case IDC_DISCONNECT_NONE:
case IDC_REMOVE_WALLPAPER:
case IDC_DISABLE_EFFECTS:
- const char *action(rfb::win32::SDisplay::disconnectAction);
- bool disconnectLock = stricmp(action, "Lock") == 0;
- bool disconnectLogoff = stricmp(action, "Logoff") == 0;
+ bool disconnectLock = rfb::win32::SDisplay::disconnectAction == "Lock";
+ bool disconnectLogoff = rfb::win32::SDisplay::disconnectAction == "Logoff";
setChanged((disconnectLogoff != isItemChecked(IDC_DISCONNECT_LOGOFF)) ||
(disconnectLock != isItemChecked(IDC_DISCONNECT_LOCK)) ||
(isItemChecked(IDC_REMOVE_WALLPAPER) != rfb::win32::SDisplay::removeWallpaper) ||
diff --git a/win/vncconfig/Legacy.cxx b/win/vncconfig/Legacy.cxx
index 3280eaef..bf073fd7 100644
--- a/win/vncconfig/Legacy.cxx
+++ b/win/vncconfig/Legacy.cxx
@@ -18,10 +18,12 @@
#include <vncconfig/Legacy.h>
-#include <rfb/LogWriter.h>
-#include <rfb/util.h>
+#include <core/LogWriter.h>
+#include <core/string.h>
+
#include <rfb_win32/CurrentUser.h>
+using namespace core;
using namespace rfb;
using namespace win32;
@@ -42,7 +44,7 @@ void LegacyPage::LoadPrefs()
std::string username;
try {
username = UserName();
- } catch (rdr::win32_error& e) {
+ } catch (core::win32_error& e) {
if (e.err != ERROR_NOT_LOGGED_ON)
throw;
}
@@ -70,7 +72,7 @@ void LegacyPage::LoadPrefs()
try {
// Split the AuthHosts string into patterns to match
std::vector<std::string> patterns;
- patterns = rfb::split(authHosts.c_str(), ':');
+ patterns = split(authHosts.c_str(), ':');
for (size_t i = 0; i < patterns.size(); i++) {
if (!patterns[i].empty()) {
int bits = 0;
@@ -80,7 +82,7 @@ void LegacyPage::LoadPrefs()
// Split the pattern into IP address parts and process
std::vector<std::string> parts;
- parts = rfb::split(&patterns[i][1], '.');
+ parts = split(&patterns[i][1], '.');
for (size_t j = 0; j < parts.size(); j++) {
if (bits)
strcat(pattern, ".");
diff --git a/win/vncconfig/vncconfig.cxx b/win/vncconfig/vncconfig.cxx
index fffdea18..da594435 100644
--- a/win/vncconfig/vncconfig.cxx
+++ b/win/vncconfig/vncconfig.cxx
@@ -22,12 +22,15 @@
#include <string.h>
#include "resource.h"
-#include <rfb/Logger_stdio.h>
-#include <rfb/LogWriter.h>
+
+#include <core/Logger_stdio.h>
+#include <core/LogWriter.h>
+
#include <rfb_win32/Dialog.h>
#include <rfb_win32/RegConfig.h>
#include <rfb_win32/CurrentUser.h>
+using namespace core;
using namespace rfb;
using namespace rfb::win32;
@@ -61,15 +64,12 @@ processParams(int argc, char* argv[]) {
} else if (strcasecmp(argv[i], "-user") == 0) {
configKey = HKEY_CURRENT_USER;
} else {
- // Try to process <option>=<value>, or -<bool>
- if (Configuration::setParam(argv[i], true))
+ int ret;
+
+ ret = Configuration::handleParamArg(argc, argv, i);
+ if (ret > 0) {
+ i += ret - 1;
continue;
- // Try to process -<option> <value>
- if ((argv[i][0] == '-') && (i+1 < argc)) {
- if (Configuration::setParam(&argv[i][1], argv[i+1], true)) {
- i++;
- continue;
- }
}
}
}
@@ -90,8 +90,6 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE /*prev*/, char* /*cmdLine*/, int /*
vlog.info("Starting vncconfig applet");
#endif
- Configuration::enableServerParams();
-
try {
try {
// Process command-line args
@@ -125,7 +123,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::win32_error& e) {
+ } catch (core::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 +167,7 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE /*prev*/, char* /*cmdLine*/, int /*
#else
sheet.showPropSheet(nullptr, true, false);
#endif
- } catch (rdr::win32_error& e) {
+ } catch (core::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/vncconfig/vncconfig.rc b/win/vncconfig/vncconfig.rc
index ca188bcf..e8b50ed1 100644
--- a/win/vncconfig/vncconfig.rc
+++ b/win/vncconfig/vncconfig.rc
@@ -459,7 +459,7 @@ BEGIN
BLOCK "080904b0"
BEGIN
VALUE "Comments", "\0"
- VALUE "CompanyName", "TigerVNC project\0"
+ VALUE "CompanyName", "TigerVNC team\0"
#ifdef WIN64
VALUE "FileDescription", "TigerVNC server configuration applet for Win64\0"
VALUE "ProductName", "TigerVNC server configuration applet for Win64\0"
@@ -469,7 +469,7 @@ BEGIN
#endif
VALUE "FileVersion", __RCVERSIONSTR
VALUE "InternalName", "vncconfig\0"
- VALUE "LegalCopyright", "Copyright (C) 1999-2024 TigerVNC team and many others (see README.rst)\0"
+ VALUE "LegalCopyright", "Copyright (C) 1999-2025 TigerVNC team and many others (see README.rst)\0"
VALUE "LegalTrademarks", "TigerVNC\0"
VALUE "OriginalFilename", "vncconfig.exe\0"
VALUE "PrivateBuild", "\0"
diff --git a/win/winvnc/ControlPanel.cxx b/win/winvnc/ControlPanel.cxx
index 6c593c45..9041d81f 100644
--- a/win/winvnc/ControlPanel.cxx
+++ b/win/winvnc/ControlPanel.cxx
@@ -31,9 +31,9 @@ void ControlPanel::initDialog()
SendCommand(4, -1);
}
-bool ControlPanel::onCommand(int cmd)
+bool ControlPanel::onCommand(int item, int /*cmd*/)
{
- switch (cmd) {
+ switch (item) {
case IDC_PROPERTIES:
SendMessage(m_hSTIcon, WM_COMMAND, ID_OPTIONS, 0);
return false;
@@ -122,7 +122,7 @@ BOOL ControlPanel::dialogProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM /*lPara
EndDialog(hwnd, 0);
return TRUE;
default:
- return onCommand(LOWORD(wParam));
+ return onCommand(LOWORD(wParam), HIWORD(wParam));
}
}
return FALSE;
diff --git a/win/winvnc/ControlPanel.h b/win/winvnc/ControlPanel.h
index 23aff0a5..3b994a59 100644
--- a/win/winvnc/ControlPanel.h
+++ b/win/winvnc/ControlPanel.h
@@ -26,7 +26,7 @@ namespace winvnc {
};
virtual bool showDialog();
void initDialog() override;
- virtual bool onCommand(int cmd);
+ bool onCommand(int item, int cmd) override;
void UpdateListView(ListConnInfo* LCInfo);
HWND GetHandle() {return handle;};
void SendCommand(DWORD command, int data);
diff --git a/win/winvnc/ManagedListener.cxx b/win/winvnc/ManagedListener.cxx
index 6690f364..7362b57c 100644
--- a/win/winvnc/ManagedListener.cxx
+++ b/win/winvnc/ManagedListener.cxx
@@ -20,10 +20,12 @@
#include <config.h>
#endif
+#include <core/LogWriter.h>
+
#include <winvnc/ManagedListener.h>
-#include <rfb/LogWriter.h>
using namespace winvnc;
+using namespace core;
using namespace rfb;
using namespace win32;
diff --git a/win/winvnc/QueryConnectDialog.cxx b/win/winvnc/QueryConnectDialog.cxx
index e1df584d..1b03af5d 100644
--- a/win/winvnc/QueryConnectDialog.cxx
+++ b/win/winvnc/QueryConnectDialog.cxx
@@ -23,10 +23,13 @@
#include <winvnc/VNCServerWin32.h>
#include <winvnc/QueryConnectDialog.h>
#include <winvnc/resource.h>
+
+#include <core/LogWriter.h>
+
#include <rfb_win32/Win32Util.h>
#include <rfb_win32/Service.h>
-#include <rfb/LogWriter.h>
+using namespace core;
using namespace rfb;
using namespace win32;
using namespace winvnc;
@@ -36,7 +39,7 @@ static LogWriter vlog("QueryConnectDialog");
static IntParameter timeout("QueryConnectTimeout",
"Number of seconds to show the Accept connection dialog before "
"rejecting the connection",
- 10);
+ 10, 0, INT_MAX);
// - Visible methods
@@ -45,12 +48,21 @@ QueryConnectDialog::QueryConnectDialog(network::Socket* sock_,
const char* userName_,
VNCServerWin32* s)
: Dialog(GetModuleHandle(nullptr)),
- sock(sock_), peerIp(sock->getPeerAddress()), userName(userName_),
+ thread(nullptr), sock(sock_), peerIp(sock->getPeerAddress()),
+ userName(userName_?userName_:""),
approve(false), server(s) {
}
+QueryConnectDialog::~QueryConnectDialog()
+{
+ if (thread != nullptr) {
+ thread->join();
+ delete thread;
+ }
+}
+
void QueryConnectDialog::startDialog() {
- start();
+ thread = new std::thread(&QueryConnectDialog::worker, this);
}
@@ -74,7 +86,7 @@ void QueryConnectDialog::worker() {
void QueryConnectDialog::initDialog() {
if (!SetTimer(handle, 1, 1000, nullptr))
- throw rdr::win32_error("SetTimer", GetLastError());
+ throw core::win32_error("SetTimer", GetLastError());
setItemString(IDC_QUERY_HOST, peerIp.c_str());
if (userName.empty())
userName = "(anonymous)";
diff --git a/win/winvnc/QueryConnectDialog.h b/win/winvnc/QueryConnectDialog.h
index 332e7439..102199af 100644
--- a/win/winvnc/QueryConnectDialog.h
+++ b/win/winvnc/QueryConnectDialog.h
@@ -21,9 +21,9 @@
#ifndef __WINVNC_QUERY_CONNECT_DIALOG_H__
#define __WINVNC_QUERY_CONNECT_DIALOG_H__
-#include <rfb_win32/Dialog.h>
+#include <thread>
-namespace os { class Thread; }
+#include <rfb_win32/Dialog.h>
namespace network { class Socket; }
@@ -31,15 +31,16 @@ namespace winvnc {
class VNCServerWin32;
- class QueryConnectDialog : public os::Thread, rfb::win32::Dialog {
+ class QueryConnectDialog : rfb::win32::Dialog {
public:
QueryConnectDialog(network::Socket* sock, const char* userName, VNCServerWin32* s);
+ ~QueryConnectDialog();
virtual void startDialog();
network::Socket* getSock() {return sock;}
bool isAccepted() const {return approve;}
protected:
// Thread methods
- void worker() override;
+ void worker();
// Dialog methods (protected)
void initDialog() override;
@@ -48,6 +49,7 @@ namespace winvnc {
// Custom internal methods
void setCountdownLabel();
+ std::thread* thread;
int countdown;
network::Socket* sock;
std::string peerIp;
diff --git a/win/winvnc/STrayIcon.cxx b/win/winvnc/STrayIcon.cxx
index b64634b3..fc079e76 100644
--- a/win/winvnc/STrayIcon.cxx
+++ b/win/winvnc/STrayIcon.cxx
@@ -26,11 +26,8 @@
#include <winvnc/VNCServerService.h>
#include <winvnc/resource.h>
-#include <os/Mutex.h>
-#include <os/Thread.h>
-
-#include <rfb/LogWriter.h>
-#include <rfb/Configuration.h>
+#include <core/Configuration.h>
+#include <core/LogWriter.h>
#include <rfb_win32/LaunchProcess.h>
#include <rfb_win32/TrayIcon.h>
@@ -41,6 +38,7 @@
#include <winvnc/ControlPanel.h>
+using namespace core;
using namespace rfb;
using namespace win32;
using namespace winvnc;
@@ -217,7 +215,7 @@ public:
case WM_SET_TOOLTIP:
{
- os::AutoMutex a(thread.lock);
+ const std::lock_guard<std::mutex> a(thread.lock);
if (!thread.toolTip.empty())
setToolTip(thread.toolTip.c_str());
}
@@ -239,12 +237,11 @@ protected:
STrayIconThread::STrayIconThread(VNCServerWin32& sm, UINT inactiveIcon_, UINT activeIcon_,
UINT dis_inactiveIcon_, UINT dis_activeIcon_, UINT menu_)
-: thread_id(-1), windowHandle(nullptr), server(sm),
+: thread(&STrayIconThread::worker, this), thread_id(-1),
+ windowHandle(nullptr), server(sm),
inactiveIcon(inactiveIcon_), activeIcon(activeIcon_),
dis_inactiveIcon(dis_inactiveIcon_), dis_activeIcon(dis_activeIcon_),
menu(menu_), runTrayIcon(true) {
- lock = new os::Mutex;
- start();
while (thread_id == (DWORD)-1)
Sleep(0);
}
@@ -252,7 +249,7 @@ STrayIconThread::STrayIconThread(VNCServerWin32& sm, UINT inactiveIcon_, UINT ac
STrayIconThread::~STrayIconThread() {
runTrayIcon = false;
PostThreadMessage(thread_id, WM_QUIT, 0, 0);
- delete lock;
+ thread.join();
}
void STrayIconThread::worker() {
@@ -277,7 +274,7 @@ void STrayIconThread::worker() {
void STrayIconThread::setToolTip(const char* text) {
if (!windowHandle) return;
- os::AutoMutex a(lock);
+ const std::lock_guard<std::mutex> a(lock);
toolTip = text;
PostMessage(windowHandle, WM_SET_TOOLTIP, 0, 0);
}
diff --git a/win/winvnc/STrayIcon.h b/win/winvnc/STrayIcon.h
index 1aa7bfbc..0398757c 100644
--- a/win/winvnc/STrayIcon.h
+++ b/win/winvnc/STrayIcon.h
@@ -19,17 +19,16 @@
#ifndef WINVNC_TRAYICON_H
#define WINVNC_TRAYICON_H
+#include <mutex>
+#include <thread>
+
#include <winvnc/VNCServerWin32.h>
-#include <rfb/Configuration.h>
-namespace os {
- class Mutex;
- class Thread;
-}
+#include <core/Configuration.h>
namespace winvnc {
- class STrayIconThread : os::Thread {
+ class STrayIconThread {
public:
STrayIconThread(VNCServerWin32& sm, UINT inactiveIcon,
UINT activeIcon, UINT dis_inactiveIcon, UINT dis_activeIcon, UINT menu);
@@ -37,14 +36,15 @@ namespace winvnc {
void setToolTip(const char* text);
- static rfb::BoolParameter disableOptions;
- static rfb::BoolParameter disableClose;
+ static core::BoolParameter disableOptions;
+ static core::BoolParameter disableClose;
friend class STrayIcon;
protected:
- void worker() override;
+ void worker();
- os::Mutex* lock;
+ std::mutex lock;
+ std::thread thread;
DWORD thread_id;
HWND windowHandle;
std::string toolTip;
diff --git a/win/winvnc/VNCServerService.cxx b/win/winvnc/VNCServerService.cxx
index 8ae4b747..4da0a5dc 100644
--- a/win/winvnc/VNCServerService.cxx
+++ b/win/winvnc/VNCServerService.cxx
@@ -23,15 +23,19 @@
#endif
#include <winvnc/VNCServerService.h>
-#include <rfb/LogWriter.h>
-#include <rfb/util.h>
+
+#include <core/LogWriter.h>
+#include <core/string.h>
+
#include <rfb_win32/TsSessions.h>
#include <rfb_win32/ModuleFileName.h>
+
#include <windows.h>
#include <wtsapi32.h>
#include <tlhelp32.h>
using namespace winvnc;
+using namespace core;
using namespace rfb;
using namespace win32;
diff --git a/win/winvnc/VNCServerWin32.cxx b/win/winvnc/VNCServerWin32.cxx
index ee6c60a7..b09b6706 100644
--- a/win/winvnc/VNCServerWin32.cxx
+++ b/win/winvnc/VNCServerWin32.cxx
@@ -27,15 +27,17 @@
#include <winvnc/ListConnInfo.h>
#include <winvnc/STrayIcon.h>
-#include <os/Mutex.h>
+#include <core/LogWriter.h>
+
+#include <network/TcpSocket.h>
#include <rfb_win32/ComputerName.h>
#include <rfb_win32/CurrentUser.h>
#include <rfb_win32/Service.h>
-#include <rfb/Hostname.h>
-#include <rfb/LogWriter.h>
+#include <rfb/SConnection.h>
+using namespace core;
using namespace rfb;
using namespace win32;
using namespace winvnc;
@@ -48,7 +50,8 @@ const char* winvnc::VNCServerWin32::RegConfigPath = "Software\\TigerVNC\\WinVNC4
static IntParameter port_number("PortNumber",
- "TCP/IP port on which the server will accept connections", 5900);
+ "TCP/IP port on which the server will accept connections",
+ 5900, 0, 65535);
static StringParameter hosts("Hosts",
"Filter describing which hosts are allowed access to this server", "+");
static BoolParameter localHost("LocalHost",
@@ -69,11 +72,6 @@ VNCServerWin32::VNCServerWin32()
config(&sockMgr), rfbSock(&sockMgr), trayIcon(nullptr),
queryConnectDialog(nullptr)
{
- commandLock = new os::Mutex;
- commandSig = new os::Condition(commandLock);
-
- runLock = new os::Mutex;
-
// Initialise the desktop
desktop.setStatusLocation(&isDesktopStarted);
desktop.setQueryConnectionHandler(this);
@@ -95,15 +93,8 @@ VNCServerWin32::~VNCServerWin32() {
desktop.setStatusLocation(nullptr);
// Join the Accept/Reject dialog thread
- if (queryConnectDialog) {
- queryConnectDialog->wait();
+ if (queryConnectDialog)
delete queryConnectDialog;
- }
-
- delete runLock;
-
- delete commandSig;
- delete commandLock;
}
@@ -158,7 +149,7 @@ void VNCServerWin32::regConfigChanged() {
int VNCServerWin32::run() {
{
- os::AutoMutex a(runLock);
+ const std::lock_guard<std::mutex> a(runLock);
thread_id = GetCurrentThreadId();
runServer = true;
}
@@ -188,7 +179,7 @@ int VNCServerWin32::run() {
while (runServer) {
result = sockMgr.getMessage(&msg, nullptr, 0, 0);
if (result < 0)
- throw rdr::win32_error("getMessage", GetLastError());
+ throw core::win32_error("getMessage", GetLastError());
if (!isServiceProcess() && (result == 0))
break;
TranslateMessage(&msg);
@@ -196,7 +187,7 @@ int VNCServerWin32::run() {
}
vlog.debug("Server exited cleanly");
- } catch (rdr::win32_error &s) {
+ } catch (core::win32_error &s) {
vlog.error("%s", s.what());
result = s.err;
} catch (std::exception &e) {
@@ -204,7 +195,7 @@ int VNCServerWin32::run() {
}
{
- os::AutoMutex a(runLock);
+ const std::lock_guard<std::mutex> a(runLock);
runServer = false;
thread_id = (DWORD)-1;
}
@@ -213,7 +204,7 @@ int VNCServerWin32::run() {
}
void VNCServerWin32::stop() {
- os::AutoMutex a(runLock);
+ const std::lock_guard<std::mutex> a(runLock);
runServer = false;
if (thread_id != (DWORD)-1)
PostThreadMessage(thread_id, WM_QUIT, 0, 0);
@@ -270,17 +261,17 @@ void VNCServerWin32::queryConnectionComplete() {
bool VNCServerWin32::queueCommand(Command cmd, const void* data, int len, bool wait) {
- os::AutoMutex a(commandLock);
+ std::unique_lock<std::mutex> lock(commandLock);
while (command != NoCommand)
- commandSig->wait();
+ commandSig.wait(lock);
command = cmd;
commandData = data;
commandDataLen = len;
SetEvent(commandEvent);
if (wait) {
while (command != NoCommand)
- commandSig->wait();
- commandSig->signal();
+ commandSig.wait(lock);
+ commandSig.notify_one();
}
return true;
}
@@ -291,7 +282,7 @@ void VNCServerWin32::processEvent(HANDLE event_) {
if (event_ == commandEvent.h) {
// If there is no command queued then return immediately
{
- os::AutoMutex a(commandLock);
+ const std::lock_guard<std::mutex> a(commandLock);
if (command == NoCommand)
return;
}
@@ -321,7 +312,6 @@ void VNCServerWin32::processEvent(HANDLE event_) {
vncServer.approveConnection(queryConnectDialog->getSock(),
queryConnectDialog->isAccepted(),
"Connection rejected by user");
- queryConnectDialog->wait();
delete queryConnectDialog;
queryConnectDialog = nullptr;
break;
@@ -332,9 +322,9 @@ void VNCServerWin32::processEvent(HANDLE event_) {
// Clear the command and signal completion
{
- os::AutoMutex a(commandLock);
+ std::unique_lock<std::mutex> lock(commandLock);
command = NoCommand;
- commandSig->signal();
+ commandSig.notify_one();
}
} else if ((event_ == sessionEvent.h) ||
(event_ == desktop.getTerminateEvent())) {
diff --git a/win/winvnc/VNCServerWin32.h b/win/winvnc/VNCServerWin32.h
index 4fcc66d5..656e2cfa 100644
--- a/win/winvnc/VNCServerWin32.h
+++ b/win/winvnc/VNCServerWin32.h
@@ -19,6 +19,9 @@
#ifndef __VNCSERVER_WIN32_H__
#define __VNCSERVER_WIN32_H__
+#include <condition_variable>
+#include <mutex>
+
#include <winsock2.h>
#include <network/TcpSocket.h>
#include <rfb/VNCServerST.h>
@@ -28,9 +31,7 @@
#include <winvnc/QueryConnectDialog.h>
#include <winvnc/ManagedListener.h>
-namespace os {
- class Mutex;
- class Condition;
+namespace core {
class Thread;
}
@@ -106,15 +107,15 @@ namespace winvnc {
Command command;
const void* commandData;
int commandDataLen;
- os::Mutex* commandLock;
- os::Condition* commandSig;
+ std::mutex commandLock;
+ std::condition_variable commandSig;
rfb::win32::Handle commandEvent;
rfb::win32::Handle sessionEvent;
// VNCServerWin32 Server-internal state
rfb::win32::SDisplay desktop;
rfb::VNCServerST vncServer;
- os::Mutex* runLock;
+ std::mutex runLock;
DWORD thread_id;
bool runServer;
bool isDesktopStarted;
diff --git a/win/winvnc/winvnc.cxx b/win/winvnc/winvnc.cxx
index 299e1fa1..58665005 100644
--- a/win/winvnc/winvnc.cxx
+++ b/win/winvnc/winvnc.cxx
@@ -28,15 +28,18 @@
#include <winvnc/VNCServerService.h>
#include <winvnc/AddNewClientDialog.h>
-#include <rfb/Logger_stdio.h>
-#include <rfb/Logger_file.h>
-#include <rfb/LogWriter.h>
-#include <rfb/util.h>
+#include <core/Logger_file.h>
+#include <core/Logger_stdio.h>
+#include <core/LogWriter.h>
+#include <core/string.h>
+
#include <rfb_win32/AboutDialog.h>
#include <rfb_win32/MsgBox.h>
+
#include <network/TcpSocket.h>
using namespace winvnc;
+using namespace core;
using namespace rfb;
using namespace win32;
@@ -177,13 +180,13 @@ static void processParams(int argc, char** argv) {
// Try to clean up earlier services we've had
try {
rfb::win32::unregisterService("WinVNC4");
- } catch (rdr::win32_error&) {
+ } catch (core::win32_error&) {
// Do nothing as we might fail simply because there was no
// service to remove
}
try {
rfb::win32::unregisterService("TigerVNC Server");
- } catch (rdr::win32_error&) {
+ } catch (core::win32_error&) {
}
if (rfb::win32::registerService(VNCServerService::Name,
@@ -212,16 +215,14 @@ static void processParams(int argc, char** argv) {
break;
} else {
- // Try to process <option>=<value>, or -<bool>
- if (Configuration::setParam(argv[i], true))
+ int ret;
+
+ ret = Configuration::handleParamArg(argc, argv, i);
+ if (ret > 0) {
+ i += ret - 1;
continue;
- // Try to process -<option> <value>
- if ((argv[i][0] == '-') && (i+1 < argc)) {
- if (Configuration::setParam(&argv[i][1], argv[i+1], true)) {
- i++;
- continue;
- }
}
+
// Nope. Show them usage and don't run the server
runServer = false;
programUsage();
@@ -260,8 +261,6 @@ int WINAPI WinMain(HINSTANCE /*inst*/, HINSTANCE /*prevInst*/, char* /*cmdLine*/
#endif
rfb::win32::initEventLogLogger(VNCServerService::Name);
- Configuration::enableServerParams();
-
// - By default, just log errors to stderr
diff --git a/win/winvnc/winvnc.rc b/win/winvnc/winvnc.rc
index 807114d0..acaa0dbd 100644
--- a/win/winvnc/winvnc.rc
+++ b/win/winvnc/winvnc.rc
@@ -76,12 +76,12 @@ BEGIN
BLOCK "080904b0"
BEGIN
VALUE "Comments", "\0"
- VALUE "CompanyName", "TigerVNC project\0"
+ VALUE "CompanyName", "TigerVNC team\0"
VALUE "FileDescription", "TigerVNC server\0"
VALUE "ProductName", "TigerVNC server\0"
VALUE "FileVersion", __RCVERSIONSTR
VALUE "InternalName", "winvnc\0"
- VALUE "LegalCopyright", "Copyright (C) 1999-2024 TigerVNC Team and many others (see README.rst)\0"
+ VALUE "LegalCopyright", "Copyright (C) 1999-2025 TigerVNC team and many others (see README.rst)\0"
VALUE "LegalTrademarks", "TigerVNC\0"
VALUE "OriginalFilename", "winvnc4.exe\0"
VALUE "PrivateBuild", "\0"
diff --git a/win/wm_hooks/wm_hooks.cxx b/win/wm_hooks/wm_hooks.cxx
index a48a1738..2f04b851 100644
--- a/win/wm_hooks/wm_hooks.cxx
+++ b/win/wm_hooks/wm_hooks.cxx
@@ -25,7 +25,6 @@
#endif
#include <wm_hooks/wm_hooks.h>
-#include <os/os.h>
#define SHARED __attribute__((section ("shared"), shared))
diff --git a/win/wm_hooks/wm_hooks.rc b/win/wm_hooks/wm_hooks.rc
index ae56b314..2bf38f3d 100644
--- a/win/wm_hooks/wm_hooks.rc
+++ b/win/wm_hooks/wm_hooks.rc
@@ -72,12 +72,12 @@ BEGIN
BLOCK "080904b0"
BEGIN
VALUE "Comments", "\0"
- VALUE "CompanyName", "TigerVNC project\0"
+ VALUE "CompanyName", "TigerVNC team\0"
VALUE "FileDescription", "TigerVNC server hooking DLL\0"
VALUE "ProductName", "TigerVNC server hooking DLL\0"
VALUE "FileVersion", __RCVERSIONSTR
VALUE "InternalName", "\0"
- VALUE "LegalCopyright", "Copyright (C) 1999-2005 [many holders]\0"
+ VALUE "LegalCopyright", "Copyright (C) 1999-2025 TigerVNC team and many others (see README.rst)\0"
VALUE "LegalTrademarks", "TigerVNC\0"
VALUE "OriginalFilename", "wm_hooks.dll\0"
VALUE "PrivateBuild", "\0"