From c4a77bd51047fb7c2b6ad1c441db8ea111eae320 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20Villac=C3=ADs=20Lasso?= Date: Sat, 10 Nov 2007 18:09:08 -0500 Subject: [PATCH] user32: DlgDirSelect tacks on a period on filenames without ext. --- dlls/user32/dialog.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/dlls/user32/dialog.c b/dlls/user32/dialog.c index c7169698134..e7f55de37ed 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) {