Vitaliy Margolen : user: Fix LB_GETTEXT unmapping for A<->W.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Dec 19 14:22:07 CST 2005


Module: wine
Branch: refs/heads/master
Commit: a80d93c5e9f022a38ef41e4a1f96bf974f3392a4
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=a80d93c5e9f022a38ef41e4a1f96bf974f3392a4

Author: Vitaliy Margolen <wine-patch at kievinfo.com>
Date:   Mon Dec 19 18:16:18 2005 +0100

user: Fix LB_GETTEXT unmapping for A<->W.

---

 dlls/user/winproc.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/dlls/user/winproc.c b/dlls/user/winproc.c
index ff5ceaf..7cfc077 100644
--- a/dlls/user/winproc.c
+++ b/dlls/user/winproc.c
@@ -956,8 +956,9 @@ LRESULT WINPROC_UnmapMsg32ATo32W( HWND h
         if ( WINPROC_TestLBForStr( hwnd ))
         {
             LPARAM *ptr = (LPARAM *)lParam - 1;
-            result = WideCharToMultiByte( CP_ACP, 0, (LPWSTR)lParam, -1,
-                                          (LPSTR)*ptr, 0x7fffffff, NULL, NULL ) - 1;
+            if (result >= 0)
+                result = WideCharToMultiByte( CP_ACP, 0, (LPWSTR)lParam, -1,
+                                              (LPSTR)*ptr, 0x7fffffff, NULL, NULL ) - 1;
             HeapFree( GetProcessHeap(), 0, ptr );
         }
         break;
@@ -1224,7 +1225,8 @@ static LRESULT WINPROC_UnmapMsg32WTo32A(
         if ( WINPROC_TestLBForStr( hwnd ))
         {
             LPARAM *ptr = (LPARAM *)lParam - 1;
-            result = MultiByteToWideChar( CP_ACP, 0, (LPSTR)lParam, -1, (LPWSTR)*ptr, 0x7fffffff ) - 1;
+            if (result >= 0)
+                result = MultiByteToWideChar( CP_ACP, 0, (LPSTR)lParam, -1, (LPWSTR)*ptr, 0x7fffffff ) - 1;
             HeapFree( GetProcessHeap(), 0, ptr );
         }
         break;




More information about the wine-cvs mailing list