Re: [Tigervnc-devel] [PATCH] building with Visual Studio C++ 2008 v9.0

2009-10-13 Thread Pierre Ossman
On Thu, 8 Oct 2009 13:51:58 +0200
Adam Tkac at...@redhat.com wrote:

 On Thu, Oct 08, 2009 at 06:30:10PM +0700, Antoine Martin wrote:
  -BEGIN PGP SIGNED MESSAGE-
  Hash: SHA512
  
   please check my comments directly in the patch. Note I can't
   test winvnc bits because currently I don't have any VC++
   environment but changes there look fine for me. You don't have to
   attach new patch, only let us know if changes suggested below works
   for you
  ACK
  Everything compiled fine, briefly tested too.
 
 Thanks, commited as r3912 to both 1_0 branch and trunk.
 

I'd prefer if this was backed out. As I said, this just hides the
obvious unicode handling errors without actually verifying that the
rest of the code can handle it. We would need a huge audit to remove
all references to the normal string handling functions for that*.

* Something which I don't support. We should be using UTF-8 for
  unicode, not UTF-16.

Rgds
-- 
Pierre OssmanOpenSource-based Thin Client Technology
System Developer Telephone: +46-13-21 46 00
Cendio ABWeb: http://www.cendio.com


signature.asc
Description: PGP signature
--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference___
Tigervnc-devel mailing list
Tigervnc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tigervnc-devel


Re: [Tigervnc-devel] [PATCH] building with Visual Studio C++ 2008 v9.0

2009-10-13 Thread DRC
I would tend to agree.  Also, we're going to start building with MinGW
at some point in the not-so-distant future.

Pierre Ossman wrote:
 I'd prefer if this was backed out. As I said, this just hides the
 obvious unicode handling errors without actually verifying that the
 rest of the code can handle it. We would need a huge audit to remove
 all references to the normal string handling functions for that*.
 
 * Something which I don't support. We should be using UTF-8 for
   unicode, not UTF-16.
 
 Rgds


--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
___
Tigervnc-devel mailing list
Tigervnc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tigervnc-devel


Re: [Tigervnc-devel] [PATCH] building with Visual Studio C++ 2008 v9.0

2009-10-08 Thread Adam Tkac
On Thu, Oct 08, 2009 at 03:33:53AM +0700, Antoine Martin wrote:
  Antoine Martin wrote:
  Hi,

Hi,

please check my comments directly in the patch. Note I can't
test winvnc bits because currently I don't have any VC++
environment but changes there look fine for me. You don't have to
attach new patch, only let us know if changes suggested below works
for you (those changes is not a pedantry, they are actually needed to
make code compilable via MinGW).

Regards, Adam

 
  I eventually managed to build TigerVNC with VC++ 9
  Attached are the trivial changes that I had to make.
  Can anyone suggest a better way of fixing those compilation errors?
  What sort of a patch would be acceptable for merging?
 
  Mostly, just:
  * casts
  * afxres.h - windows.h (and add #define IDC_STATIC -1)
 
  FYI: I also had to comment out this line in VC's stdio.h:
  _Check_return_opt_ _CRT_INSECURE_DEPRECATE(vsnprintf_s) _CRTIMP int
  __cdecl vsnprintf(_Out_cap_(_MaxCount) char * _DstBuf, _In_ size_t
  _MaxCount, _In_z_ _Printf_format_string_ const char * _Format, va_list
  _ArgList);
  Which gives me lots of warnings, but at least it builds...
 
  Now at least I can try to solve my real problems (PasswordFile, etc..)
 
  Cheers
  Antoine
 
 
  
 
  --
  Come build with us! The BlackBerry(R) Developer Conference in SF, CA
  is the only developer event you need to attend this year. Jumpstart your
  developing skills, take BlackBerry mobile applications to market and stay 
  ahead of the curve. Join us from November 9 - 12, 2009. Register now!
  http://p.sf.net/sfu/devconference
 
 
  
 
  ___
  Tigervnc-devel mailing list
  Tigervnc-devel@lists.sourceforge.net
  https://lists.sourceforge.net/lists/listinfo/tigervnc-devel

 diff -ur a/rfb_win32/CKeyboard.cxx b/rfb_win32/CKeyboard.cxx
 --- a/rfb_win32/CKeyboard.cxx 2009-08-20 16:46:42.0 +0700
 +++ b/rfb_win32/CKeyboard.cxx 2009-10-08 01:39:22.0 +0700
 @@ -64,7 +64,7 @@
  // be a comma and a DECIMAL to be a dot. 
  if (extendedVkey == VK_DECIMAL || extendedVkey == VK_SEPARATOR) {
char buf[4];
 -  if (!GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SDECIMAL, buf, 
 sizeof(buf))) {
 +  if (!GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SDECIMAL, (LPWSTR) buf, 
 sizeof(buf))) {

Per http://msdn.microsoft.com/en-us/library/dd318101(VS.85).aspx
(GetLocaleInfo description) the third argument is LPTSTR, not LPWSTR.

   vlog.debug(failed to retrieve LOCALE_SDECIMAL);
} else {
   switch (buf[0]) {
 diff -ur a/vncconfig/vncconfig.rc b/vncconfig/vncconfig.rc
 --- a/vncconfig/vncconfig.rc  2009-08-20 16:46:42.0 +0700
 +++ b/vncconfig/vncconfig.rc  2009-10-08 03:29:50.0 +0700
 @@ -7,7 +7,11 @@
  //
  // Generated from the TEXTINCLUDE 2 resource.
  //
 -#include afxres.h
 +#include windows.h
 +
 +#ifndef IDC_STATIC
 +#define IDC_STATIC -1
 +#endif
  
  /
  #undef APSTUDIO_READONLY_SYMBOLS
 @@ -34,7 +38,7 @@
  
  2 TEXTINCLUDE DISCARDABLE 
  BEGIN
 -#include afxres.h\r\n
 +#include windows.h\r\n
  \0
  END
  
 diff -ur a/vncviewer/DesktopWindow.cxx b/vncviewer/DesktopWindow.cxx
 --- a/vncviewer/DesktopWindow.cxx 2009-08-20 16:46:42.0 +0700
 +++ b/vncviewer/DesktopWindow.cxx 2009-10-08 01:42:30.0 +0700
 @@ -75,7 +75,7 @@
try {
  result = _this-processMessage(msg, wParam, lParam);
} catch (rfb::UnsupportedPixelFormatException e) {
 -MsgBox(0, e.str(), MB_OK | MB_ICONINFORMATION);
 +MsgBox(0, (TCHAR *) e.str(), MB_OK | MB_ICONINFORMATION);
  _this-getCallback()-closeWindow();
} catch (rdr::Exception e) {
  vlog.error(untrapped: %s, e.str());
 diff -ur a/vncviewer/OptionsDialog.cxx b/vncviewer/OptionsDialog.cxx
 --- a/vncviewer/OptionsDialog.cxx 2009-08-20 16:46:42.0 +0700
 +++ b/vncviewer/OptionsDialog.cxx 2009-10-08 01:43:06.0 +0700
 @@ -175,7 +175,7 @@
  (WPARAM)i, (LPARAM)(int FAR*)scale_values[i]);
  }
  if (dlg-options.autoScaling) {
 -  SetDlgItemText(handle, IDC_COMBO_SCALE, Auto);
 +  SetDlgItemText(handle, IDC_COMBO_SCALE, (LPWSTR) Auto);

Per http://msdn.microsoft.com/en-us/library/ms645521(VS.85).aspx the
third parameter is LPCTSTR.

  } else {
SetDlgItemInt(handle, IDC_COMBO_SCALE, dlg-options.scale, FALSE);
  }
 @@ -195,8 +195,8 @@
dlg-options.autoScaling = false;
  } else {
char scaleStr[20];
 -  GetDlgItemText(handle, IDC_COMBO_SCALE, scaleStr, 20);
 -  if (strcmp(scaleStr, Auto) == 0) {
 +  GetDlgItemText(handle, IDC_COMBO_SCALE, (LPWSTR) scaleStr, 20);

LPWSTR - LPTSTR.

 +  if (strcmp(scaleStr, (const char *) Auto) == 0) 

Re: [Tigervnc-devel] [PATCH] building with Visual Studio C++ 2008 v9.0

2009-10-08 Thread Antoine Martin
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA512

 please check my comments directly in the patch. Note I can't
 test winvnc bits because currently I don't have any VC++
 environment but changes there look fine for me. You don't have to
 attach new patch, only let us know if changes suggested below works
 for you
ACK
Everything compiled fine, briefly tested too.

 (those changes is not a pedantry, they are actually needed to
 make code compilable via MinGW).
Understood.


I have noticed one very minor difference with my build (not changed by
the minor tweaks you just suggested): the first few lines of text
normally look like this:
TigerVNC Viewer - TigerVnc Viewer for Win32, Version 1.0.0
But on my build it looks like this:
T i g e r  V i e w e r  -  ...
Looks like a UTF encoding issue. This only affects the first 3 lines,
the usage:  onwards is not affected. I'll try to take a look at it
when I get a chance.

Cheers
Antoine

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEAREKAAYFAkrNzTwACgkQGK2zHPGK1rtZAwCePNOrWLEsLpS29BAJtcttvGBC
nW0An0xQqhJHCul4vKk8wzTKJTEP2umq
=sBat
-END PGP SIGNATURE-

--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
___
Tigervnc-devel mailing list
Tigervnc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tigervnc-devel


Re: [Tigervnc-devel] [PATCH] building with Visual Studio C++ 2008 v9.0

2009-10-08 Thread Adam Tkac
On Thu, Oct 08, 2009 at 06:30:10PM +0700, Antoine Martin wrote:
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA512
 
  please check my comments directly in the patch. Note I can't
  test winvnc bits because currently I don't have any VC++
  environment but changes there look fine for me. You don't have to
  attach new patch, only let us know if changes suggested below works
  for you
 ACK
 Everything compiled fine, briefly tested too.

Thanks, commited as r3912 to both 1_0 branch and trunk.

Regards, Adam

-- 
Adam Tkac, Red Hat, Inc.

--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
___
Tigervnc-devel mailing list
Tigervnc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tigervnc-devel


Re: [Tigervnc-devel] [PATCH] building with Visual Studio C++ 2008 v9.0

2009-10-08 Thread Pierre Ossman
On Thu, 08 Oct 2009 03:06:49 +0700
Antoine Martin anto...@nagafix.co.uk wrote:

 Hi,
 
 I eventually managed to build TigerVNC with VC++ 9
 Attached are the trivial changes that I had to make.
 Can anyone suggest a better way of fixing those compilation errors?
 What sort of a patch would be acceptable for merging?
 
 Mostly, just:
 * casts
 * afxres.h - windows.h (and add #define IDC_STATIC -1)
 
 FYI: I also had to comment out this line in VC's stdio.h:
 _Check_return_opt_ _CRT_INSECURE_DEPRECATE(vsnprintf_s) _CRTIMP int
 __cdecl vsnprintf(_Out_cap_(_MaxCount) char * _DstBuf, _In_ size_t
 _MaxCount, _In_z_ _Printf_format_string_ const char * _Format, va_list
 _ArgList);
 Which gives me lots of warnings, but at least it builds...
 
 Now at least I can try to solve my real problems (PasswordFile, etc..)
 

It looks like you're building a unicode version of the software. The
system is not really designed for that, so even if you get it to
compile I suspect you'll get subtle and hard to debug problems.

(Using LPTSTR would make things compiler both with and without unicode,
but it really only hides the problem)

Rgds
-- 
Pierre OssmanOpenSource-based Thin Client Technology
System Developer Telephone: +46-13-21 46 00
Cendio ABWeb: http://www.cendio.com


signature.asc
Description: PGP signature
--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference___
Tigervnc-devel mailing list
Tigervnc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tigervnc-devel


[Tigervnc-devel] [PATCH] building with Visual Studio C++ 2008 v9.0

2009-10-07 Thread Antoine Martin
Hi,

I eventually managed to build TigerVNC with VC++ 9
Attached are the trivial changes that I had to make.
Can anyone suggest a better way of fixing those compilation errors?
What sort of a patch would be acceptable for merging?

Mostly, just:
* casts
* afxres.h - windows.h (and add #define IDC_STATIC -1)

FYI: I also had to comment out this line in VC's stdio.h:
_Check_return_opt_ _CRT_INSECURE_DEPRECATE(vsnprintf_s) _CRTIMP int
__cdecl vsnprintf(_Out_cap_(_MaxCount) char * _DstBuf, _In_ size_t
_MaxCount, _In_z_ _Printf_format_string_ const char * _Format, va_list
_ArgList);
Which gives me lots of warnings, but at least it builds...

Now at least I can try to solve my real problems (PasswordFile, etc..)

Cheers
Antoine
diff -ur a/rfb_win32/CKeyboard.cxx b/rfb_win32/CKeyboard.cxx
--- a/rfb_win32/CKeyboard.cxx	2009-08-20 16:46:42.0 +0700
+++ b/rfb_win32/CKeyboard.cxx	2009-10-08 01:39:22.0 +0700
@@ -64,7 +64,7 @@
 // be a comma and a DECIMAL to be a dot. 
 if (extendedVkey == VK_DECIMAL || extendedVkey == VK_SEPARATOR) {
   char buf[4];
-  if (!GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SDECIMAL, buf, sizeof(buf))) {
+  if (!GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SDECIMAL, (LPWSTR) buf, sizeof(buf))) {
 	vlog.debug(failed to retrieve LOCALE_SDECIMAL);
   } else {
 	switch (buf[0]) {
diff -ur a/vncconfig/vncconfig.rc b/vncconfig/vncconfig.rc
--- a/vncconfig/vncconfig.rc	2009-08-20 16:46:42.0 +0700
+++ b/vncconfig/vncconfig.rc	2009-10-08 02:45:30.0 +0700
@@ -7,7 +7,9 @@
 //
 // Generated from the TEXTINCLUDE 2 resource.
 //
-#include afxres.h
+#include windows.h
+
+#define IDC_STATIC -1
 
 /
 #undef APSTUDIO_READONLY_SYMBOLS
@@ -34,7 +36,7 @@
 
 2 TEXTINCLUDE DISCARDABLE 
 BEGIN
-#include afxres.h\r\n
+#include windows.h\r\n
 \0
 END
 
diff -ur a/vncviewer/DesktopWindow.cxx b/vncviewer/DesktopWindow.cxx
--- a/vncviewer/DesktopWindow.cxx	2009-08-20 16:46:42.0 +0700
+++ b/vncviewer/DesktopWindow.cxx	2009-10-08 01:42:30.0 +0700
@@ -75,7 +75,7 @@
   try {
 result = _this-processMessage(msg, wParam, lParam);
   } catch (rfb::UnsupportedPixelFormatException e) {
-MsgBox(0, e.str(), MB_OK | MB_ICONINFORMATION);
+MsgBox(0, (TCHAR *) e.str(), MB_OK | MB_ICONINFORMATION);
 _this-getCallback()-closeWindow();
   } catch (rdr::Exception e) {
 vlog.error(untrapped: %s, e.str());
diff -ur a/vncviewer/OptionsDialog.cxx b/vncviewer/OptionsDialog.cxx
--- a/vncviewer/OptionsDialog.cxx	2009-08-20 16:46:42.0 +0700
+++ b/vncviewer/OptionsDialog.cxx	2009-10-08 01:43:06.0 +0700
@@ -175,7 +175,7 @@
 (WPARAM)i, (LPARAM)(int FAR*)scale_values[i]);
 }
 if (dlg-options.autoScaling) {
-  SetDlgItemText(handle, IDC_COMBO_SCALE, Auto);
+  SetDlgItemText(handle, IDC_COMBO_SCALE, (LPWSTR) Auto);
 } else {
   SetDlgItemInt(handle, IDC_COMBO_SCALE, dlg-options.scale, FALSE);
 }
@@ -195,8 +195,8 @@
   dlg-options.autoScaling = false;
 } else {
   char scaleStr[20];
-  GetDlgItemText(handle, IDC_COMBO_SCALE, scaleStr, 20);
-  if (strcmp(scaleStr, Auto) == 0) {
+  GetDlgItemText(handle, IDC_COMBO_SCALE, (LPWSTR) scaleStr, 20);
+  if (strcmp(scaleStr, (const char *) Auto) == 0) {
 dlg-options.autoScaling = true;
   }
 }
@@ -212,7 +212,7 @@
   int index = SendMessage(handleComboScale, CB_GETCURSEL, 0, 0);
   SendMessage(handleComboScale, CB_GETLBTEXT, (WPARAM)index, (LPARAM)scaleStr);
 } else {
-  GetDlgItemText(handle, IDC_COMBO_SCALE, scaleStr, 20);
+  GetDlgItemText(handle, IDC_COMBO_SCALE, (LPWSTR) scaleStr, 20);
 }
 return true;
   }
diff -ur a/vncviewer/ViewerToolBar.cxx b/vncviewer/ViewerToolBar.cxx
--- a/vncviewer/ViewerToolBar.cxx	2009-08-20 16:46:42.0 +0700
+++ b/vncviewer/ViewerToolBar.cxx	2009-10-08 01:37:19.0 +0700
@@ -63,34 +63,34 @@
 
   switch (TTStr-hdr.idFrom) {
   case ID_OPTIONS:
-TTStr-lpszText = Connection options...;
+TTStr-lpszText = (LPWSTR) Connection options...;
 break;
   case ID_INFO:
-TTStr-lpszText = Connection info;
+TTStr-lpszText = (LPWSTR) Connection info;
 break;
   case ID_FULLSCREEN:
-TTStr-lpszText = Full screen;
+TTStr-lpszText = (LPWSTR) Full screen;
 break;
   case ID_REQUEST_REFRESH:
-TTStr-lpszText = Request screen refresh;
+TTStr-lpszText = (LPWSTR) Request screen refresh;
 break;
   case ID_SEND_CAD:
-TTStr-lpszText = Send Ctrl-Alt-Del;
+TTStr-lpszText = (LPWSTR) Send Ctrl-Alt-Del;
 break;
   case ID_SEND_CTLESC:
-TTStr-lpszText = Send Ctrl-Esc;
+TTStr-lpszText = (LPWSTR) Send Ctrl-Esc;
 break;
   case ID_CTRL_KEY:
-TTStr-lpszText = Send Ctrl key press/release;
+

Re: [Tigervnc-devel] [PATCH] building with Visual Studio C++ 2008 v9.0

2009-10-07 Thread Antoine Martin
DRC wrote:
 It shouldn't be necessary to comment out anything in stdio.h.  You can
 pass the following arguments to cl to turn off the secure deprecation
 warnings:
 
 -wd4996 -D_CRT_SECURE_NO_DEPRECATE
Hah, I'll have to figure out where that goes... (new to VC++)

 Other than that, I would change
 
 #define IDC_STATIC -1
 
 to
 
 #ifndef IDC_STATIC
 #define IDC_STATIC -1
 #endif
 
 but everything else looks fine to me.
Great. Updated patch attached.

Antoine


 
 DRC
 
 Antoine Martin wrote:
 Hi,

 I eventually managed to build TigerVNC with VC++ 9
 Attached are the trivial changes that I had to make.
 Can anyone suggest a better way of fixing those compilation errors?
 What sort of a patch would be acceptable for merging?

 Mostly, just:
 * casts
 * afxres.h - windows.h (and add #define IDC_STATIC -1)

 FYI: I also had to comment out this line in VC's stdio.h:
 _Check_return_opt_ _CRT_INSECURE_DEPRECATE(vsnprintf_s) _CRTIMP int
 __cdecl vsnprintf(_Out_cap_(_MaxCount) char * _DstBuf, _In_ size_t
 _MaxCount, _In_z_ _Printf_format_string_ const char * _Format, va_list
 _ArgList);
 Which gives me lots of warnings, but at least it builds...

 Now at least I can try to solve my real problems (PasswordFile, etc..)

 Cheers
 Antoine


 

 --
 Come build with us! The BlackBerry(R) Developer Conference in SF, CA
 is the only developer event you need to attend this year. Jumpstart your
 developing skills, take BlackBerry mobile applications to market and stay 
 ahead of the curve. Join us from November 9 - 12, 2009. Register now!
 http://p.sf.net/sfu/devconference


 

 ___
 Tigervnc-devel mailing list
 Tigervnc-devel@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/tigervnc-devel
diff -ur a/rfb_win32/CKeyboard.cxx b/rfb_win32/CKeyboard.cxx
--- a/rfb_win32/CKeyboard.cxx	2009-08-20 16:46:42.0 +0700
+++ b/rfb_win32/CKeyboard.cxx	2009-10-08 01:39:22.0 +0700
@@ -64,7 +64,7 @@
 // be a comma and a DECIMAL to be a dot. 
 if (extendedVkey == VK_DECIMAL || extendedVkey == VK_SEPARATOR) {
   char buf[4];
-  if (!GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SDECIMAL, buf, sizeof(buf))) {
+  if (!GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SDECIMAL, (LPWSTR) buf, sizeof(buf))) {
 	vlog.debug(failed to retrieve LOCALE_SDECIMAL);
   } else {
 	switch (buf[0]) {
diff -ur a/vncconfig/vncconfig.rc b/vncconfig/vncconfig.rc
--- a/vncconfig/vncconfig.rc	2009-08-20 16:46:42.0 +0700
+++ b/vncconfig/vncconfig.rc	2009-10-08 03:29:50.0 +0700
@@ -7,7 +7,11 @@
 //
 // Generated from the TEXTINCLUDE 2 resource.
 //
-#include afxres.h
+#include windows.h
+
+#ifndef IDC_STATIC
+#define IDC_STATIC -1
+#endif
 
 /
 #undef APSTUDIO_READONLY_SYMBOLS
@@ -34,7 +38,7 @@
 
 2 TEXTINCLUDE DISCARDABLE 
 BEGIN
-#include afxres.h\r\n
+#include windows.h\r\n
 \0
 END
 
diff -ur a/vncviewer/DesktopWindow.cxx b/vncviewer/DesktopWindow.cxx
--- a/vncviewer/DesktopWindow.cxx	2009-08-20 16:46:42.0 +0700
+++ b/vncviewer/DesktopWindow.cxx	2009-10-08 01:42:30.0 +0700
@@ -75,7 +75,7 @@
   try {
 result = _this-processMessage(msg, wParam, lParam);
   } catch (rfb::UnsupportedPixelFormatException e) {
-MsgBox(0, e.str(), MB_OK | MB_ICONINFORMATION);
+MsgBox(0, (TCHAR *) e.str(), MB_OK | MB_ICONINFORMATION);
 _this-getCallback()-closeWindow();
   } catch (rdr::Exception e) {
 vlog.error(untrapped: %s, e.str());
diff -ur a/vncviewer/OptionsDialog.cxx b/vncviewer/OptionsDialog.cxx
--- a/vncviewer/OptionsDialog.cxx	2009-08-20 16:46:42.0 +0700
+++ b/vncviewer/OptionsDialog.cxx	2009-10-08 01:43:06.0 +0700
@@ -175,7 +175,7 @@
 (WPARAM)i, (LPARAM)(int FAR*)scale_values[i]);
 }
 if (dlg-options.autoScaling) {
-  SetDlgItemText(handle, IDC_COMBO_SCALE, Auto);
+  SetDlgItemText(handle, IDC_COMBO_SCALE, (LPWSTR) Auto);
 } else {
   SetDlgItemInt(handle, IDC_COMBO_SCALE, dlg-options.scale, FALSE);
 }
@@ -195,8 +195,8 @@
   dlg-options.autoScaling = false;
 } else {
   char scaleStr[20];
-  GetDlgItemText(handle, IDC_COMBO_SCALE, scaleStr, 20);
-  if (strcmp(scaleStr, Auto) == 0) {
+  GetDlgItemText(handle, IDC_COMBO_SCALE, (LPWSTR) scaleStr, 20);
+  if (strcmp(scaleStr, (const char *) Auto) == 0) {
 dlg-options.autoScaling = true;
   }
 }
@@ -212,7 +212,7 @@
   int index = SendMessage(handleComboScale, CB_GETCURSEL, 0, 0);
   SendMessage(handleComboScale, CB_GETLBTEXT, (WPARAM)index, (LPARAM)scaleStr);
 } else {
-  GetDlgItemText(handle, IDC_COMBO_SCALE, scaleStr, 20);
+  GetDlgItemText(handle,