mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 21:36:11 +00:00
user32: sync DIALOG_DlgDirSelect to wine 1.1.13:
Fixes crash of user32 winetest listbox svn path=/trunk/; revision=38863
This commit is contained in:
parent
62957c3cb4
commit
843defae4d
1 changed files with 5 additions and 6 deletions
|
@ -1354,12 +1354,13 @@ static BOOL DIALOG_DlgDirSelect( HWND hwnd, LPWSTR str, INT len,
|
||||||
BOOL ret;
|
BOOL ret;
|
||||||
HWND listbox = GetDlgItem( hwnd, id );
|
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;
|
if (!listbox) return FALSE;
|
||||||
|
|
||||||
item = SendMessageW(listbox, combo ? CB_GETCURSEL : LB_GETCURSEL, 0, 0 );
|
item = SendMessageW(listbox, combo ? CB_GETCURSEL : LB_GETCURSEL, 0, 0 );
|
||||||
if (item == LB_ERR) return FALSE;
|
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 (size == LB_ERR) return FALSE;
|
||||||
|
|
||||||
if (!(buffer = HeapAlloc( GetProcessHeap(), 0, (size+2) * sizeof(WCHAR) ))) return FALSE;
|
if (!(buffer = HeapAlloc( GetProcessHeap(), 0, (size+2) * sizeof(WCHAR) ))) return FALSE;
|
||||||
|
@ -1396,11 +1397,9 @@ static BOOL DIALOG_DlgDirSelect( HWND hwnd, LPWSTR str, INT len,
|
||||||
if (len > 0 && !WideCharToMultiByte( CP_ACP, 0, ptr, -1, (LPSTR)str, len, 0, 0 ))
|
if (len > 0 && !WideCharToMultiByte( CP_ACP, 0, ptr, -1, (LPSTR)str, len, 0, 0 ))
|
||||||
((LPSTR)str)[len-1] = 0;
|
((LPSTR)str)[len-1] = 0;
|
||||||
}
|
}
|
||||||
else
|
else lstrcpynW( str, ptr, len );
|
||||||
lstrcpynW( str, ptr, len );
|
|
||||||
|
|
||||||
HeapFree( GetProcessHeap(), 0, buffer );
|
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;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue