Fix mismatches between format string and arguments
diff --git a/common/rfb/KeyRemapper.cxx b/common/rfb/KeyRemapper.cxx
index 05f0763..d33f0a4 100644
--- a/common/rfb/KeyRemapper.cxx
+++ b/common/rfb/KeyRemapper.cxx
@@ -50,7 +50,7 @@
       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])
diff --git a/tests/decperf.cxx b/tests/decperf.cxx
index 1d0c80c..5763976 100644
--- a/tests/decperf.cxx
+++ b/tests/decperf.cxx
@@ -211,7 +211,7 @@
   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;
 }
diff --git a/vncviewer/CConn.cxx b/vncviewer/CConn.cxx
index ab5c9cc..f8b45af 100644
--- a/vncviewer/CConn.cxx
+++ b/vncviewer/CConn.cxx
@@ -411,7 +411,7 @@
   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.
diff --git a/vncviewer/Viewport.cxx b/vncviewer/Viewport.cxx
index 6c77e58..3d6f4a8 100644
--- a/vncviewer/Viewport.cxx
+++ b/vncviewer/Viewport.cxx
@@ -351,7 +351,7 @@
                      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);
diff --git a/vncviewer/parameters.cxx b/vncviewer/parameters.cxx
index 29a5397..713ac07 100644
--- a/vncviewer/parameters.cxx
+++ b/vncviewer/parameters.cxx
@@ -303,7 +303,7 @@
 
   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;
   }
@@ -324,7 +324,7 @@
   
   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;
   }
@@ -348,7 +348,7 @@
     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;
@@ -387,7 +387,7 @@
     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;
@@ -407,7 +407,7 @@
                              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;
   }
 
@@ -428,7 +428,7 @@
 
   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);
   }
 }
 
@@ -444,7 +444,7 @@
     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;
   }
@@ -477,7 +477,7 @@
 
   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;
diff --git a/win/rfb_win32/CleanDesktop.cxx b/win/rfb_win32/CleanDesktop.cxx
index bad95f0..90b3451 100644
--- a/win/rfb_win32/CleanDesktop.cxx
+++ b/win/rfb_win32/CleanDesktop.cxx
@@ -148,7 +148,7 @@
   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;
 }
diff --git a/win/rfb_win32/Clipboard.cxx b/win/rfb_win32/Clipboard.cxx
index 482519e..70f52ad 100644
--- a/win/rfb_win32/Clipboard.cxx
+++ b/win/rfb_win32/Clipboard.cxx
@@ -87,7 +87,7 @@
 }
 
 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);
 }
 
@@ -111,7 +111,7 @@
       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())) {
@@ -190,7 +190,7 @@
 
   // - 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) {
diff --git a/win/rfb_win32/DeviceContext.cxx b/win/rfb_win32/DeviceContext.cxx
index 26721a6..ad5e6b1 100644
--- a/win/rfb_win32/DeviceContext.cxx
+++ b/win/rfb_win32/DeviceContext.cxx
@@ -91,7 +91,7 @@
       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;
     };
diff --git a/win/rfb_win32/Dialog.cxx b/win/rfb_win32/Dialog.cxx
index 70a5fb5..6b52244 100644
--- a/win/rfb_win32/Dialog.cxx
+++ b/win/rfb_win32/Dialog.cxx
@@ -278,7 +278,7 @@
     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) {
@@ -336,7 +336,7 @@
     }
 #endif
 
-    plog.info("finished %lx", handle);
+    plog.info("finished %p", handle);
 
     DestroyWindow(handle);
     handle = 0;
@@ -361,7 +361,7 @@
 }
 
 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)
@@ -370,7 +370,7 @@
 }
 
 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++) {
@@ -383,7 +383,7 @@
 
 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
diff --git a/win/rfb_win32/DynamicFn.cxx b/win/rfb_win32/DynamicFn.cxx
index 033971d..97d17ff 100644
--- a/win/rfb_win32/DynamicFn.cxx
+++ b/win/rfb_win32/DynamicFn.cxx
@@ -29,12 +29,12 @@
 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() {
diff --git a/win/rfb_win32/MonitorInfo.cxx b/win/rfb_win32/MonitorInfo.cxx
index c57cd26..d639ac5 100644
--- a/win/rfb_win32/MonitorInfo.cxx
+++ b/win/rfb_win32/MonitorInfo.cxx
@@ -50,15 +50,15 @@
 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
diff --git a/win/rfb_win32/MsgWindow.cxx b/win/rfb_win32/MsgWindow.cxx
index 4c50c2f..1d58561 100644
--- a/win/rfb_win32/MsgWindow.cxx
+++ b/win/rfb_win32/MsgWindow.cxx
@@ -52,7 +52,7 @@
     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);
   }
 
@@ -102,13 +102,13 @@
   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
diff --git a/win/rfb_win32/Registry.cxx b/win/rfb_win32/Registry.cxx
index b278576..70083f4 100644
--- a/win/rfb_win32/Registry.cxx
+++ b/win/rfb_win32/Registry.cxx
@@ -51,7 +51,7 @@
   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;
 }
 
@@ -59,7 +59,7 @@
   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;
 }
 
@@ -69,7 +69,7 @@
 
 
 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;
@@ -80,10 +80,10 @@
   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;
 }
@@ -93,7 +93,7 @@
   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;
 }
@@ -113,7 +113,7 @@
 
 void RegKey::close() {
   if (freeKey) {
-    vlog.debug("RegCloseKey(%x)", key);
+    vlog.debug("RegCloseKey(%p)", key);
     RegCloseKey(key);
     key = 0;
   }
diff --git a/win/rfb_win32/SInput.cxx b/win/rfb_win32/SInput.cxx
index aa8a21b..f634566 100644
--- a/win/rfb_win32/SInput.cxx
+++ b/win/rfb_win32/SInput.cxx
@@ -151,7 +151,7 @@
         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);
@@ -266,7 +266,7 @@
 // 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);
 }
 
diff --git a/win/rfb_win32/Security.cxx b/win/rfb_win32/Security.cxx
index 95ef1d8..b4e9353 100644
--- a/win/rfb_win32/Security.cxx
+++ b/win/rfb_win32/Security.cxx
@@ -112,7 +112,7 @@
   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))
diff --git a/win/rfb_win32/Service.cxx b/win/rfb_win32/Service.cxx
index 89be92e..99b3eaa 100644
--- a/win/rfb_win32/Service.cxx
+++ b/win/rfb_win32/Service.cxx
@@ -99,7 +99,7 @@
     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);
@@ -132,7 +132,7 @@
     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());
@@ -176,9 +176,9 @@
   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() {
@@ -200,11 +200,11 @@
 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;
 }
 
@@ -218,7 +218,7 @@
 		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;
   }
 
@@ -227,17 +227,17 @@
   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;
@@ -254,7 +254,7 @@
 		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;
   }
 
diff --git a/win/rfb_win32/Threading.cxx b/win/rfb_win32/Threading.cxx
index 7960766..5873b58 100644
--- a/win/rfb_win32/Threading.cxx
+++ b/win/rfb_win32/Threading.cxx
@@ -34,11 +34,11 @@
 
 
 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);
 }
 
 
diff --git a/win/rfb_win32/TsSessions.cxx b/win/rfb_win32/TsSessions.cxx
index a4fac2f..b02f619 100644
--- a/win/rfb_win32/TsSessions.cxx
+++ b/win/rfb_win32/TsSessions.cxx
@@ -77,7 +77,7 @@
 
     // 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());
 
diff --git a/win/winvnc/winvnc.cxx b/win/winvnc/winvnc.cxx
index 17b3a91..c2abd89 100644
--- a/win/winvnc/winvnc.cxx
+++ b/win/winvnc/winvnc.cxx
@@ -182,7 +182,7 @@
         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) ||