if (bidi == '<')
mapping[to] = from;
} else {
- vlog.error("warning: bad mapping %.*s", nextComma-m, m);
+ vlog.error("warning: bad mapping %.*s", (int)(nextComma-m), m);
}
m = nextComma;
if (nextComma[0])
sort(dev, runCount);
meddev = dev[runCount/2];
- printf("CPU time: %g s (+/- %g %)\n", median, meddev);
+ printf("CPU time: %g s (+/- %g %%)\n", median, meddev);
return 0;
}
ret = fl_utf8froma(buffer, size, str, len);
assert(ret < size);
- vlog.debug("Got clipboard data (%d bytes)", strlen(buffer));
+ vlog.debug("Got clipboard data (%d bytes)", (int)strlen(buffer));
// RFB doesn't have separate selection and clipboard concepts, so we
// dump the data into both variants.
Fl::event_length() + 1);
assert(ret < (Fl::event_length() + 1));
- vlog.debug("Sending clipboard data (%d bytes)", strlen(buffer));
+ vlog.debug("Sending clipboard data (%d bytes)", (int)strlen(buffer));
try {
cc->writer()->clientCutText(buffer, ret);
LONG res = RegSetValueExW(*hKey, name, 0, REG_SZ, (BYTE*)&value, (wcslen(value)+1)*2);
if (res != ERROR_SUCCESS) {
- vlog.error(_("Failed to write parameter %s of type %s to the registry: %d"),
+ vlog.error(_("Failed to write parameter %s of type %s to the registry: %ld"),
_name, "REG_SZ", res);
return;
}
LONG res = RegSetValueExW(*hKey, name, 0, REG_DWORD, (BYTE*)&value, sizeof(DWORD));
if (res != ERROR_SUCCESS) {
- vlog.error(_("Failed to write parameter %s of type %s to the registry: %d"),
+ vlog.error(_("Failed to write parameter %s of type %s to the registry: %ld"),
_name, "REG_DWORD", res);
return;
}
if (res == ERROR_FILE_NOT_FOUND) {
// The value does not exist, defaults will be used.
} else {
- vlog.error(_("Failed to read parameter %s from the registry: %d"),
+ vlog.error(_("Failed to read parameter %s from the registry: %ld"),
_name, res);
}
return false;
if (res == ERROR_FILE_NOT_FOUND) {
// The value does not exist, defaults will be used.
} else {
- vlog.error(_("Failed to read parameter %s from the registry: %d"),
+ vlog.error(_("Failed to read parameter %s from the registry: %ld"),
_name, res);
}
return false;
REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL,
&hKey, NULL);
if (res != ERROR_SUCCESS) {
- vlog.error(_("Failed to create registry key: %d"), res);
+ vlog.error(_("Failed to create registry key: %ld"), res);
return;
}
res = RegCloseKey(hKey);
if (res != ERROR_SUCCESS) {
- vlog.error(_("Failed to close registry key: %d"), res);
+ vlog.error(_("Failed to close registry key: %ld"), res);
}
}
if (res == ERROR_FILE_NOT_FOUND) {
// The key does not exist, defaults will be used.
} else {
- vlog.error(_("Failed to open registry key: %d"), res);
+ vlog.error(_("Failed to open registry key: %ld"), res);
}
return NULL;
}
res = RegCloseKey(hKey);
if (res != ERROR_SUCCESS){
- vlog.error(_("Failed to close registry key: %d"), res);
+ vlog.error(_("Failed to close registry key: %ld"), res);
}
return servername;
DWORD r = ERROR_SUCCESS;
if (!SystemParametersInfo(action, param, ptr, ini)) {
r = GetLastError();
- vlog.info("SPI error: %d", r);
+ vlog.info("SPI error: %lu", r);
}
return r;
}
}
Clipboard::~Clipboard() {
- vlog.debug("removing %x from chain (next is %x)", getHandle(), next_window);
+ vlog.debug("removing %p from chain (next is %p)", getHandle(), next_window);
ChangeClipboardChain(getHandle(), next_window);
}
if (owner == getHandle()) {
vlog.debug("local clipboard changed by me");
} else {
- vlog.debug("local clipboard changed by %x", owner);
+ vlog.debug("local clipboard changed by %p", owner);
// Open the clipboard
if (OpenClipboard(getHandle())) {
// - Close the clipboard
if (!CloseClipboard())
- vlog.debug("unable to close Win32 clipboard: %u", GetLastError());
+ vlog.debug("unable to close Win32 clipboard: %lu", GetLastError());
else
vlog.debug("closed clipboard");
if (clip_handle) {
rMask = bi.mask.red;
gMask = bi.mask.green;
bMask = bi.mask.blue;
- vlog.info("%lu-bit BitFields: (%lx, %lx, %lx)",
+ vlog.info("%d-bit BitFields: (%lx, %lx, %lx)",
bi.bmiHeader.biBitCount, rMask, gMask, bMask);
break;
};
if ((handle == 0) || (handle == (HWND)-1))
throw rdr::SystemException("PropertySheet failed", GetLastError());
centerWindow(handle, owner);
- plog.info("created %lx", handle);
+ plog.info("created %p", handle);
#ifdef _DIALOG_CAPTURE
if (capture) {
}
#endif
- plog.info("finished %lx", handle);
+ plog.info("finished %p", handle);
DestroyWindow(handle);
handle = 0;
}
void PropSheet::reInitPages() {
- plog.debug("reInitPages %lx", handle);
+ plog.debug("reInitPages %p", handle);
std::list<PropSheetPage*>::iterator pspi;
for (pspi=pages.begin(); pspi!=pages.end(); pspi++) {
if ((*pspi)->handle)
}
bool PropSheet::commitPages() {
- plog.debug("commitPages %lx", handle);
+ plog.debug("commitPages %p", handle);
bool result = true;
std::list<PropSheetPage*>::iterator pspi;
for (pspi=pages.begin(); pspi!=pages.end(); pspi++) {
void PropSheetPage::setChanged(bool changed) {
if (propSheet) {
- plog.debug("setChanged[%lx(%lx)]=%d", handle, propSheet->handle, (int)changed);
+ plog.debug("setChanged[%p(%p)]=%d", handle, propSheet->handle, (int)changed);
if (changed)
PropSheet_Changed(propSheet->handle, handle);
else
DynamicFnBase::DynamicFnBase(const TCHAR* dllName, const char* fnName) : fnPtr(0), dllHandle(0) {
dllHandle = LoadLibrary(dllName);
if (!dllHandle) {
- vlog.info("DLL %s not found (%d)", (const char*)CStr(dllName), GetLastError());
+ vlog.info("DLL %s not found (%lu)", (const char*)CStr(dllName), GetLastError());
return;
}
fnPtr = (void*) GetProcAddress(dllHandle, fnName);
if (!fnPtr)
- vlog.info("proc %s not found in %s (%d)", fnName, (const char*)CStr(dllName), GetLastError());
+ vlog.info("proc %s not found in %s (%lu)", fnName, (const char*)CStr(dllName), GetLastError());
}
DynamicFnBase::~DynamicFnBase() {
typedef BOOL (WINAPI *_EnumDisplayMonitors_proto)(HDC, LPCRECT, MONITORENUMPROC, LPARAM);
static rfb::win32::DynamicFn<_EnumDisplayMonitors_proto> _EnumDisplayMonitors(_T("user32.dll"), "EnumDisplayMonitors");
static void fillMonitorInfo(HMONITOR monitor, MonitorInfo* mi) {
- vlog.debug("monitor=%lx", monitor);
+ vlog.debug("monitor=%p", monitor);
if (!_GetMonitorInfo.isValid())
throw rdr::Exception("no GetMonitorInfo");
memset(mi, 0, sizeof(MONITORINFOEXA));
mi->cbSize = sizeof(MONITORINFOEXA);
if (!(*_GetMonitorInfo)(monitor, mi))
throw rdr::SystemException("failed to GetMonitorInfo", GetLastError());
- vlog.debug("monitor is %d,%d-%d,%d", mi->rcMonitor.left, mi->rcMonitor.top, mi->rcMonitor.right, mi->rcMonitor.bottom);
- vlog.debug("work area is %d,%d-%d,%d", mi->rcWork.left, mi->rcWork.top, mi->rcWork.right, mi->rcWork.bottom);
+ 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);
}
#else
SetWindowLongPtr(wnd, GWLP_USERDATA, 0);
MsgWindow* _this = (MsgWindow*) GetWindowLongPtr(wnd, GWLP_USERDATA);
if (!_this) {
- vlog.info("null _this in %x, message %x", wnd, msg);
+ vlog.info("null _this in %p, message %x", wnd, msg);
return SafeDefWindowProc(wnd, msg, wParam, lParam);
}
if (!handle) {
throw rdr::SystemException("unable to create WMNotifier window instance", GetLastError());
}
- vlog.debug("created window \"%s\" (%x)", (const char*)CStr(name.buf), handle);
+ vlog.debug("created window \"%s\" (%p)", (const char*)CStr(name.buf), handle);
}
MsgWindow::~MsgWindow() {
if (handle)
DestroyWindow(handle);
- vlog.debug("destroyed window \"%s\" (%x)", (const char*)CStr(name.buf), handle);
+ vlog.debug("destroyed window \"%s\" (%p)", (const char*)CStr(name.buf), handle);
}
LRESULT
LONG result = RegOpenKeyEx(k, 0, 0, KEY_ALL_ACCESS, &key);
if (result != ERROR_SUCCESS)
throw rdr::SystemException("RegOpenKeyEx(HKEY)", result);
- vlog.debug("duplicated %x to %x", k, key);
+ vlog.debug("duplicated %p to %p", k, key);
freeKey = true;
}
LONG result = RegOpenKeyEx(k.key, 0, 0, KEY_ALL_ACCESS, &key);
if (result != ERROR_SUCCESS)
throw rdr::SystemException("RegOpenKeyEx(RegKey&)", result);
- vlog.debug("duplicated %x to %x", k.key, key);
+ vlog.debug("duplicated %p to %p", k.key, key);
freeKey = true;
}
void RegKey::setHKEY(HKEY k, bool fK) {
- vlog.debug("setHKEY(%x,%d)", k, (int)fK);
+ vlog.debug("setHKEY(%p,%d)", k, (int)fK);
close();
freeKey = fK;
key = k;
close();
LONG result = RegCreateKey(root.key, name, &key);
if (result != ERROR_SUCCESS) {
- vlog.error("RegCreateKey(%x, %s): %x", root.key, name, result);
+ vlog.error("RegCreateKey(%p, %s): %lx", root.key, name, result);
throw rdr::SystemException("RegCreateKeyEx", result);
}
- vlog.debug("createKey(%x,%s) = %x", root.key, (const char*)CStr(name), key);
+ vlog.debug("createKey(%p,%s) = %p", root.key, (const char*)CStr(name), key);
freeKey = true;
return true;
}
LONG result = RegOpenKeyEx(root.key, name, 0, readOnly ? KEY_READ : KEY_ALL_ACCESS, &key);
if (result != ERROR_SUCCESS)
throw rdr::SystemException("RegOpenKeyEx (open)", result);
- vlog.debug("openKey(%x,%s,%s) = %x", root.key, (const char*)CStr(name),
+ vlog.debug("openKey(%p,%s,%s) = %p", root.key, (const char*)CStr(name),
readOnly ? "ro" : "rw", key);
freeKey = true;
}
void RegKey::close() {
if (freeKey) {
- vlog.debug("RegCloseKey(%x)", key);
+ vlog.debug("RegCloseKey(%p)", key);
RegCloseKey(key);
key = 0;
}
flags &= ~MOUSEEVENTF_ABSOLUTE;
SystemParametersInfo(SPI_GETMOUSE, 0, &mouseInfo, 0);
SystemParametersInfo(SPI_GETMOUSESPEED, 0, &oldSpeed, 0);
- vlog.debug("SPI_GETMOUSE %d, %d, %d, speed %d", mouseInfo[0], mouseInfo[1], mouseInfo[2], oldSpeed);
+ vlog.debug("SPI_GETMOUSE %lu, %lu, %lu, speed %lu", mouseInfo[0], mouseInfo[1], mouseInfo[2], oldSpeed);
ULONG idealMouseInfo[] = {10, 0, 0};
SystemParametersInfo(SPI_SETMOUSESPEED, 0, &newSpeed, 0);
SystemParametersInfo(SPI_SETMOUSE, 0, &idealMouseInfo, 0);
// the appropriate scancode corresponding to the supplied virtual keycode.
inline void doKeyboardEvent(BYTE vkCode, DWORD flags) {
- vlog.debug("vkCode 0x%x flags 0x%x", vkCode, flags);
+ vlog.debug("vkCode 0x%x flags 0x%lx", vkCode, flags);
keybd_event(vkCode, MapVirtualKey(vkCode, 0), flags, 0);
}
LookupAccountSid(0, (PSID)buf, 0, &nameLen, 0, &domainLen, &use);
if (GetLastError() != ERROR_INSUFFICIENT_BUFFER)
throw rdr::SystemException("Unable to determine SID name lengths", GetLastError());
- vlog.info("nameLen=%d, domainLen=%d, use=%d", nameLen, domainLen, use);
+ vlog.info("nameLen=%lu, domainLen=%lu, use=%d", nameLen, domainLen, use);
*name = new TCHAR[nameLen];
*domain = new TCHAR[domainLen];
if (!LookupAccountSid(0, (PSID)buf, *name, &nameLen, *domain, &domainLen, &use))
vlog.error("failed to register handler: %lu", err);
ExitProcess(err);
}
- vlog.debug("registered handler (%lx)", service->status_handle);
+ vlog.debug("registered handler (%p)", service->status_handle);
service->setStatus(SERVICE_START_PENDING);
vlog.debug("entering %s serviceMain", service->getName());
service->status.dwWin32ExitCode = service->serviceMain(dwArgc, lpszArgv);
entry[1].lpServiceProc = NULL;
vlog.debug("entering dispatcher");
if (!SetProcessShutdownParameters(0x100, 0))
- vlog.error("unable to set shutdown parameters: %d", GetLastError());
+ vlog.error("unable to set shutdown parameters: %lu", GetLastError());
service = this;
if (!StartServiceCtrlDispatcher(entry))
throw SystemException("unable to start service", GetLastError());
if (!SetServiceStatus(status_handle, &status)) {
status.dwCurrentState = SERVICE_STOPPED;
status.dwWin32ExitCode = GetLastError();
- vlog.error("unable to set service status:%u", status.dwWin32ExitCode);
+ vlog.error("unable to set service status:%lu", status.dwWin32ExitCode);
}
- vlog.debug("set status to %u(%u)", state, status.dwCheckPoint);
+ vlog.debug("set status to %lu(%lu)", state, status.dwCheckPoint);
}
Service::~Service() {
switchToDesktop(HDESK desktop) {
HDESK old_desktop = GetThreadDesktop(GetCurrentThreadId());
if (!SetThreadDesktop(desktop)) {
- vlog.debug("switchToDesktop failed:%u", GetLastError());
+ vlog.debug("switchToDesktop failed:%lu", GetLastError());
return false;
}
if (!CloseDesktop(old_desktop))
- vlog.debug("unable to close old desktop:%u", GetLastError());
+ vlog.debug("unable to close old desktop:%lu", GetLastError());
return true;
}
DESKTOP_WRITEOBJECTS | DESKTOP_READOBJECTS |
DESKTOP_SWITCHDESKTOP | GENERIC_WRITE);
if (!input) {
- vlog.debug("unable to OpenInputDesktop(1):%u", GetLastError());
+ vlog.debug("unable to OpenInputDesktop(1):%lu", GetLastError());
return false;
}
char inputname[256];
if (!GetUserObjectInformation(current, UOI_NAME, currentname, 256, &size)) {
- vlog.debug("unable to GetUserObjectInformation(1):%u", GetLastError());
+ vlog.debug("unable to GetUserObjectInformation(1):%lu", GetLastError());
CloseDesktop(input);
return false;
}
if (!GetUserObjectInformation(input, UOI_NAME, inputname, 256, &size)) {
- vlog.debug("unable to GetUserObjectInformation(2):%u", GetLastError());
+ vlog.debug("unable to GetUserObjectInformation(2):%lu", GetLastError());
CloseDesktop(input);
return false;
}
if (!CloseDesktop(input))
- vlog.debug("unable to close input desktop:%u", GetLastError());
+ vlog.debug("unable to close input desktop:%lu", GetLastError());
// *** vlog.debug("current=%s, input=%s", currentname, inputname);
bool result = strcmp(currentname, inputname) == 0;
DESKTOP_WRITEOBJECTS | DESKTOP_READOBJECTS |
DESKTOP_SWITCHDESKTOP | GENERIC_WRITE);
if (!desktop) {
- vlog.debug("unable to OpenInputDesktop(2):%u", GetLastError());
+ vlog.debug("unable to OpenInputDesktop(2):%lu", GetLastError());
return false;
}
inline void logAction(Thread* t, const char* action) {
- vlog.debug("%-16.16s %s(%lx)", action, t->getName(), t);
+ vlog.debug("%-16.16s %s(%p)", action, t->getName(), t);
}
inline void logError(Thread* t, const char* err) {
- vlog.error("%-16.16s %s(%lx):%s", "failed", t->getName(), t, err);
+ vlog.error("%-16.16s %s(%p):%s", "failed", t->getName(), t, err);
}
// Try to reconnect our session to the console
ConsoleSessionId console;
- vlog.info("Console session is %d", console.id);
+ vlog.info("Console session is %lu", console.id);
if (!(*_WinStationConnect)(0, sessionId, console.id, L"", 0))
throw rdr::SystemException("Unable to connect session to Console", GetLastError());
close_console = true;
vlog.info("closing console");
if (!FreeConsole())
- vlog.info("unable to close console:%u", GetLastError());
+ vlog.info("unable to close console:%lu", GetLastError());
} else if ((strcasecmp(argv[i], "-help") == 0) ||
(strcasecmp(argv[i], "--help") == 0) ||