FindFirstFile can return an empty short name if the long name is a
valid DOS name, fixed callers to handle that properly.
diff --git a/controls/listbox.c b/controls/listbox.c
index d72ecc3..5c5cca4 100644
--- a/controls/listbox.c
+++ b/controls/listbox.c
@@ -1766,10 +1766,12 @@
static const WCHAR bracketW[] = { ']',0 };
static const WCHAR dotW[] = { '.',0 };
if (!(attrib & DDL_DIRECTORY) ||
- !strcmpW( entry.cAlternateFileName, dotW )) continue;
+ !strcmpW( entry.cFileName, dotW )) continue;
buffer[0] = '[';
- if (long_names) strcpyW( buffer + 1, entry.cFileName );
- else strcpyW( buffer + 1, entry.cAlternateFileName );
+ if (!long_names && entry.cAlternateFileName[0])
+ strcpyW( buffer + 1, entry.cAlternateFileName );
+ else
+ strcpyW( buffer + 1, entry.cFileName );
strcatW(buffer, bracketW);
}
else /* not a directory */
@@ -1781,8 +1783,10 @@
((attrib & ATTRIBS) != (entry.dwFileAttributes & ATTRIBS)))
continue;
#undef ATTRIBS
- if (long_names) strcpyW( buffer, entry.cFileName );
- else strcpyW( buffer, entry.cAlternateFileName );
+ if (!long_names && entry.cAlternateFileName[0])
+ strcpyW( buffer + 1, entry.cAlternateFileName );
+ else
+ strcpyW( buffer + 1, entry.cFileName );
}
if (!long_names) CharLowerW( buffer );
pos = LISTBOX_FindFileStrPos( hwnd, descr, buffer );