Author: tkreuzer
Date: Sat Jan 17 19:17:47 2009
New Revision: 38863
URL:
http://svn.reactos.org/svn/reactos?rev=38863&view=rev
Log:
user32: sync DIALOG_DlgDirSelect to wine 1.1.13:
Fixes crash of user32 winetest listbox
Modified:
trunk/reactos/dll/win32/user32/windows/dialog.c
Modified: trunk/reactos/dll/win32/user32/windows/dialog.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/d…
==============================================================================
--- trunk/reactos/dll/win32/user32/windows/dialog.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/user32/windows/dialog.c [iso-8859-1] Sat Jan 17 19:17:47 2009
@@ -1354,12 +1354,13 @@
BOOL ret;
HWND listbox = GetDlgItem( hwnd, id );
- TRACE("%p '%s' %d\n", hwnd, str, id );
+ TRACE("%p %s %d\n", hwnd, unicode ? debugstr_w(str) :
debugstr_a((LPSTR)str), id );
if (!listbox) return FALSE;
item = SendMessageW(listbox, combo ? CB_GETCURSEL : LB_GETCURSEL, 0, 0 );
if (item == LB_ERR) return FALSE;
- size = SendMessageW(listbox, combo ? CB_GETLBTEXTLEN : LB_GETTEXTLEN, 0, 0 );
+
+ size = SendMessageW(listbox, combo ? CB_GETLBTEXTLEN : LB_GETTEXTLEN, item, 0 );
if (size == LB_ERR) return FALSE;
if (!(buffer = HeapAlloc( GetProcessHeap(), 0, (size+2) * sizeof(WCHAR) ))) return
FALSE;
@@ -1396,11 +1397,9 @@
if (len > 0 && !WideCharToMultiByte( CP_ACP, 0, ptr, -1, (LPSTR)str,
len, 0, 0 ))
((LPSTR)str)[len-1] = 0;
}
- else
- lstrcpynW( str, ptr, len );
-
+ else lstrcpynW( str, ptr, len );
HeapFree( GetProcessHeap(), 0, buffer );
- TRACE("Returning %d '%s'\n", ret, str );
+ TRACE("Returning %d %s\n", ret, unicode ? debugstr_w(str) :
debugstr_a((LPSTR)str) );
return ret;
}