Module: wine Branch: master Commit: c4a77bd51047fb7c2b6ad1c441db8ea111eae320 URL: http://source.winehq.org/git/wine.git/?a=commit;h=c4a77bd51047fb7c2b6ad1c441...
Author: Alex Villacís Lasso a_villacis@palosanto.com Date: Sat Nov 10 18:09:08 2007 -0500
user32: DlgDirSelect tacks on a period on filenames without ext.
---
dlls/user32/dialog.c | 13 +++++++++++-- 1 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/dlls/user32/dialog.c b/dlls/user32/dialog.c index c716969..e7f55de 100644 --- a/dlls/user32/dialog.c +++ b/dlls/user32/dialog.c @@ -1683,7 +1683,7 @@ static BOOL DIALOG_DlgDirSelect( HWND hwnd, LPWSTR str, INT len, size = SendMessageW(listbox, combo ? CB_GETLBTEXTLEN : LB_GETTEXTLEN, item, 0 ); if (size == LB_ERR) return FALSE;
- if (!(buffer = HeapAlloc( GetProcessHeap(), 0, (size+1) * sizeof(WCHAR) ))) return FALSE; + if (!(buffer = HeapAlloc( GetProcessHeap(), 0, (size+2) * sizeof(WCHAR) ))) return FALSE;
SendMessageW( listbox, combo ? CB_GETLBTEXT : LB_GETTEXT, item, (LPARAM)buffer );
@@ -1701,7 +1701,16 @@ static BOOL DIALOG_DlgDirSelect( HWND hwnd, LPWSTR str, INT len, ptr = buffer + 1; } } - else ptr = buffer; + else + { + /* Filenames without a dot extension must have one tacked at the end */ + if (strchrW(buffer, '.') == NULL) + { + buffer[strlenW(buffer)+1] = '\0'; + buffer[strlenW(buffer)] = '.'; + } + ptr = buffer; + }
if (!unicode) {