static void usage()
{
- fprintf(stderr,"usage: %s [parameters]\n",
+ fprintf(stderr,"Usage: %s [parameters]\n",
programName);
fprintf(stderr," %s [parameters] -connect "
"[-view-only] <host>[:<port>]\n", programName);
}
if (i >= argc) usage();
if (!XVncExtConnect(dpy, argv[i], viewOnly)) {
- fprintf(stderr,"connecting to %s failed\n",argv[i]);
+ fprintf(stderr, "Connecting to %s failed\n",argv[i]);
}
} else if (strcmp(argv[i], "-disconnect") == 0) {
if (!XVncExtConnect(dpy, "", False)) {
- fprintf(stderr,"disconnecting all clients failed\n");
+ fprintf(stderr, "Disconnecting all clients failed\n");
}
} else if (strcmp(argv[i], "-get") == 0) {
i++;
if (XVncExtGetParam(dpy, argv[i], &data, &len)) {
printf("%.*s\n",len,data);
} else {
- fprintf(stderr,"getting param %s failed\n",argv[i]);
+ fprintf(stderr, "Getting param %s failed\n",argv[i]);
}
XFree(data);
} else if (strcmp(argv[i], "-desc") == 0) {
if (desc) {
printf("%s\n",desc);
} else {
- fprintf(stderr,"getting description for param %s failed\n",argv[i]);
+ fprintf(stderr, "Getting description for param %s failed\n",argv[i]);
}
XFree(desc);
} else if (strcmp(argv[i], "-list") == 0) {
i++;
if (i >= argc) usage();
if (!XVncExtSetParam(dpy, argv[i])) {
- fprintf(stderr,"setting param %s failed\n",argv[i]);
+ fprintf(stderr, "Setting param %s failed\n",argv[i]);
}
} else if (XVncExtSetParam(dpy, argv[i])) {
- fprintf(stderr,"set parameter %s\n",argv[i]);
+ fprintf(stderr, "Set parameter %s\n",argv[i]);
} else {
usage();
}
static void usage()
{
- fprintf(stderr,"usage: %s [file]\n", prog);
+ fprintf(stderr,"Usage: %s [file]\n", prog);
fprintf(stderr," %s -f\n", prog);
exit(1);
}
"Only allow connections from localhost",
false);
StringParameter interface("interface",
- "listen on the specified network address",
+ "Listen on the specified network address",
"all");
static const char* defaultDesktopName()
bool verifyConnection(Socket* s) override
{
if (!reloadRules()) {
- vlog.error("Could not read IP filtering rules: rejecting all clients");
+ vlog.error("Could not read IP filtering rules, rejecting all clients");
filter.clear();
filter.push_back(parsePattern("-"));
return false;
if (!(dpy = XOpenDisplay(displayname))) {
// FIXME: Why not vlog.error(...)?
- fprintf(stderr,"%s: unable to open display \"%s\"\r\n",
+ fprintf(stderr,"%s: Unable to open display \"%s\"\r\n",
programName, XDisplayName(displayname));
exit(1);
}
"Only allow connections from localhost",
false);
rfb::StringParameter interface("interface",
- "listen on the specified network address",
+ "Listen on the specified network address",
"all");
rfb::BoolParameter avoidShiftNumLock("AvoidShiftNumLock",
"Avoid fake Shift presses for keys affected by NumLock.",
void vncExtensionInit(void)
{
if (vncExtGeneration == vncGetServerGeneration()) {
- vlog.error("vncExtensionInit: called twice in same generation?");
+ vlog.error("vncExtensionInit: Called twice in same generation?");
return;
}
vncExtGeneration = vncGetServerGeneration();
if (vncGetScreenCount() > MAXSCREENS)
- vncFatalError("vncExtensionInit: too many screens\n");
+ vncFatalError("vncExtensionInit: Too many screens\n");
vncAddExtension();
unwrap(vncHooksScreen, rp, rrCrtcSet);
}
- DBGPRINT((stderr,"vncHooksCloseScreen: unwrapped screen functions\n"));
+ DBGPRINT((stderr,"vncHooksCloseScreen: Unwrapped screen functions\n"));
return (*pScreen->CloseScreen)(pScreen);
}
(*pGC->funcs->ValidateGC) (pGC, changes, pDrawable);
if (is_visible(pDrawable)) {
pGCPriv->ops = pGC->ops;
- DBGPRINT((stderr,"vncHooksValidateGC: wrapped GC ops\n"));
+ DBGPRINT((stderr,"vncHooksValidateGC: Wrapped GC ops\n"));
} else {
pGCPriv->ops = NULL;
}
if ((vncInetdSock = dup(0)) == -1)
FatalError
- ("Xvnc error: failed to allocate a new file descriptor for -inetd: %s\n", strerror(errno));
+ ("Xvnc error: Failed to allocate a new file descriptor for -inetd: %s\n", strerror(errno));
/* Avoid xserver >= 1.19's epoll-fd becoming fd 2 / stderr only to be
if (displayNum == 100)
FatalError
- ("Xvnc error: no free display number for -inetd\n");
+ ("Xvnc error: No free display number for -inetd\n");
}
display = displayNumStr;
fprintf(stderr,
"\n"
- "usage: %s [parameters] [host][:displayNum]\n"
+ "Usage: %s [parameters] [host][:displayNum]\n"
" %s [parameters] [host][::port]\n"
#ifndef WIN32
" %s [parameters] [unix socket]\n"
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 rdr::win32_error("Failed to contact Active Desktop", HRESULT_CODE(result));
}
~ActiveDesktop() {
if (handle)
// - Firstly, we must open the clipboard
if (!OpenClipboard(getHandle()))
- throw rdr::win32_error("unable to open Win32 clipboard", GetLastError());
+ throw rdr::win32_error("Unable to open Win32 clipboard", GetLastError());
// - Convert the supplied clipboard text into UTF-16 format with CRLF
std::string filtered(convertCRLF(text));
// - Next, we must clear out any existing data
if (!EmptyClipboard())
- throw rdr::win32_error("unable to empty Win32 clipboard", GetLastError());
+ throw rdr::win32_error("Unable to empty Win32 clipboard", GetLastError());
// - Set the new clipboard data
if (!SetClipboardData(CF_UNICODETEXT, clip_handle))
- throw rdr::win32_error("unable to set Win32 clipboard", GetLastError());
+ throw rdr::win32_error("Unable to set Win32 clipboard", GetLastError());
clip_handle = nullptr;
vlog.debug("Set clipboard");
uint8_t* new_data = nullptr;
if (!pf.trueColour)
- throw std::invalid_argument("palette format not supported");
+ throw std::invalid_argument("Palette format not supported");
format = pf;
if (!new_bitmap) {
int err = GetLastError();
- throw rdr::win32_error("unable to create DIB section", err);
+ throw rdr::win32_error("Unable to create DIB section", err);
}
vlog.debug("recreateBuffer()");
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 rdr::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 rdr::win32_error("Unable to determine pixel shifts/palette", GetLastError());
}
// Set the initial format information
break;
default:
vlog.error("Bits per pixel %u not supported", bi.bmiHeader.biBitCount);
- throw std::invalid_argument("unknown bits per pixel specified");
+ throw std::invalid_argument("Unknown bits per pixel specified");
};
break;
case BI_BITFIELDS:
// Check that the depth & bpp are valid
if (depth > bpp) {
- vlog.error("depth exceeds bits per pixel!");
+ vlog.error("Depth exceeds bits per pixel!");
bpp = depth;
}
DeviceDC::DeviceDC(const char* deviceName) {
dc = ::CreateDC("DISPLAY", deviceName, nullptr, nullptr);
if (!dc)
- throw rdr::win32_error("failed to create DeviceDC", GetLastError());
+ throw rdr::win32_error("Failed to create DeviceDC", GetLastError());
}
DeviceDC::~DeviceDC() {
int capabilities = GetDeviceCaps(device, RASTERCAPS);
if (!(capabilities & RC_BITBLT)) {
- throw std::invalid_argument("device does not support BitBlt");
+ throw std::invalid_argument("Device does not support BitBlt");
}
if (!(capabilities & RC_DI_BITMAP)) {
- throw std::invalid_argument("device does not support GetDIBits");
+ throw std::invalid_argument("Device does not support GetDIBits");
}
/*
if (GetDeviceCaps(device, PLANES) != 1) {
- throw std::invalid_argument("device does not support planar displays");
+ throw std::invalid_argument("Device does not support planar displays");
}
*/
if (!GetObject(iconInfo.hbmMask, sizeof(BITMAP), &maskInfo))
throw rdr::win32_error("GetObject() failed", GetLastError());
if (maskInfo.bmPlanes != 1)
- throw std::invalid_argument("unsupported multi-plane cursor");
+ throw std::invalid_argument("Unsupported multi-plane cursor");
if (maskInfo.bmBitsPixel != 1)
- throw std::invalid_argument("unsupported cursor mask format");
+ throw std::invalid_argument("Unsupported cursor mask format");
width = maskInfo.bmWidth;
height = maskInfo.bmHeight;
if ((bi.bV5RedMask != ((unsigned)0xff << ridx*8)) ||
(bi.bV5GreenMask != ((unsigned)0xff << gidx*8)) ||
(bi.bV5BlueMask != ((unsigned)0xff << bidx*8)))
- throw std::invalid_argument("unsupported cursor colour format");
+ throw std::invalid_argument("Unsupported cursor colour format");
uint8_t* rwbuffer = buffer.data();
for (int y = 0; y < height; y++) {
BOOL trans;
int result = GetDlgItemInt(handle, id, &trans, TRUE);
if (!trans)
- throw std::runtime_error("unable to read dialog Int");
+ throw std::runtime_error("Unable to read dialog Int");
return result;
}
const char* Dialog::getItemString(int id) {
if ((handle == nullptr) || (handle == (HWND)-1))
throw rdr::win32_error("PropertySheet failed", GetLastError());
centerWindow(handle, owner_);
- plog.info("created %p", handle);
+ plog.info("Created %p", handle);
(void)capture;
#ifdef _DIALOG_CAPTURE
if (capture) {
- plog.info("capturing \"%s\"", title.c_str());
+ plog.info("Capturing \"%s\"", title.c_str());
char* tmpdir = getenv("TEMP");
HDC dc = GetWindowDC(handle);
DeviceFrameBuffer fb(dc);
}
#endif
- plog.info("finished %p", handle);
+ plog.info("Finished %p", handle);
DestroyWindow(handle);
handle = nullptr;
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 rdr::win32_error("Unable to launch process", GetLastError());
snprintf(desktopName, 256, "WinSta0\\%s", buf);
flags, nullptr, nullptr,
&sinfo, &procInfo);
if (!success)
- throw rdr::win32_error("unable to launch process", GetLastError());
+ throw rdr::win32_error("Unable to launch process", GetLastError());
// Wait for it to finish initialising
WaitForInputIdle(procInfo.hProcess, 15000);
memset(mi, 0, sizeof(MONITORINFOEXA));
mi->cbSize = sizeof(MONITORINFOEXA);
if (!GetMonitorInfo(monitor, mi))
- throw rdr::win32_error("failed to GetMonitorInfo", GetLastError());
+ throw rdr::win32_error("Failed to GetMonitorInfo", GetLastError());
vlog.debug("Monitor is %ld,%ld-%ld,%ld", mi->rcMonitor.left, mi->rcMonitor.top, mi->rcMonitor.right, mi->rcMonitor.bottom);
vlog.debug("Work area is %ld,%ld-%ld,%ld", mi->rcWork.left, mi->rcWork.top, mi->rcWork.right, mi->rcWork.bottom);
vlog.debug("Device is \"%s\"", mi->szDevice);
HMONITOR monitor = MonitorFromWindow(window, MONITOR_DEFAULTTONEAREST);
if (!monitor)
- throw rdr::win32_error("failed to get monitor", GetLastError());
+ throw rdr::win32_error("Failed to get monitor", GetLastError());
fillMonitorInfo(monitor, this);
}
HMONITOR monitor = MonitorFromRect(&r, MONITOR_DEFAULTTONEAREST);
if (!monitor)
- throw rdr::win32_error("failed to get monitor", GetLastError());
+ throw rdr::win32_error("Failed to get monitor", GetLastError());
fillMonitorInfo(monitor, this);
}
wndClass.lpszClassName = "rfb::win32::MsgWindowClass";
classAtom = RegisterClass(&wndClass);
if (!classAtom) {
- throw rdr::win32_error("unable to register MsgWindow window class", GetLastError());
+ throw rdr::win32_error("Unable to register MsgWindow window class", GetLastError());
}
}
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 rdr::win32_error("Unable to create WMNotifier window instance", GetLastError());
}
vlog.debug("Created window \"%s\" (%p)", name.c_str(), handle);
}
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 rdr::win32_error("Get registry value length", result);
std::vector<uint8_t> data(length);
result = RegQueryValueEx(key, valname, nullptr, &type, (BYTE*)data.data(), &length);
if (result != ERROR_SUCCESS)
- throw rdr::win32_error("get registry value", result);
+ throw rdr::win32_error("Get registry value", result);
switch (type) {
case REG_BINARY:
std::vector<char> expanded(required);
length = ExpandEnvironmentStrings(str.c_str(), expanded.data(), required);
if (required<length)
- throw std::runtime_error("unable to expand environment strings");
+ throw std::runtime_error("Unable to expand environment strings");
return expanded.data();
} else {
return "";
}
}
default:
- throw std::logic_error("unsupported registry type");
+ throw std::logic_error("Unsupported registry type");
}
}
// Switch to the current input desktop
if (rfb::win32::desktopChangeRequired()) {
if (!rfb::win32::changeDesktop())
- throw std::runtime_error("unable to switch into input desktop");
+ throw std::runtime_error("Unable to switch into input desktop");
}
// Initialise the change tracker and clipper
} catch (std::exception& e) {
delete core; core = nullptr;
if (tryMethod == 0)
- throw std::runtime_error("unable to access desktop");
+ throw std::runtime_error("Unable to access desktop");
tryMethod--;
vlog.error("%s", e.what());
}
consolePollTimer(getHandle(), consolePollTimerId),
pollConsoles(false) {
if (!hooks.setEvent(display->getUpdateEvent()))
- throw std::runtime_error("hook subsystem failed to initialise");
+ throw std::runtime_error("Hook subsystem failed to initialise");
poller.setUpdateTracker(updateTracker);
cursorTimer.start(20);
consolePollTimer.start(200);
PSID Sid::copySID(const PSID sid) {
if (!IsValidSid(sid))
- throw std::invalid_argument("invalid SID in copyPSID");
+ throw std::invalid_argument("Invalid SID in copyPSID");
PSID buf = (PSID)new uint8_t[GetLengthSid(sid)];
if (!CopySid(GetLengthSid(sid), buf, sid))
throw rdr::win32_error("CopySid failed", GetLastError());
void Sid::setSID(const PSID sid) {
if (!IsValidSid(sid))
- throw std::invalid_argument("invalid SID in copyPSID");
+ throw std::invalid_argument("Invalid SID in copyPSID");
resize(GetLengthSid(sid));
if (!CopySid(GetLengthSid(sid), data(), sid))
throw rdr::win32_error("CopySid failed", GetLastError());
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 rdr::win32_error("Unable to get window class:%u", GetLastError());
if ((strcmp(buffer, "tty") != 0) &&
(strcmp(buffer, "ConsoleWindowClass") != 0)) {
return false;