From 2c691b31ce7f44e63f9eb4f2ae6aae27d0962356 Mon Sep 17 00:00:00 2001 From: Ove Kaaven Date: Sat, 25 Nov 2000 03:06:03 +0000 Subject: [PATCH] Implemented Win16 behaviour of DDL_DRIVES in DlgDirList. --- controls/listbox.c | 64 ++++++++++++++++++++++++------------------- dlls/user/user.spec | 2 +- dlls/user/user32.spec | 4 +-- 3 files changed, 39 insertions(+), 31 deletions(-) diff --git a/controls/listbox.c b/controls/listbox.c index 5ebd4981d7d..91624bcca59 100644 --- a/controls/listbox.c +++ b/controls/listbox.c @@ -1661,42 +1661,47 @@ static LRESULT LISTBOX_Directory( WND *wnd, LB_DESCR *descr, UINT attrib, WIN32_FIND_DATAA entry; int pos; - if ((handle = FindFirstFileA(filespec,&entry)) == INVALID_HANDLE_VALUE) - { - if (GetLastError() != ERROR_NO_MORE_FILES) return LB_ERR; - } - else - { - do + /* don't scan directory if we just want drives exclusively */ + if (attrib != (DDL_DRIVES | DDL_EXCLUSIVE)) { + /* scan directory */ + if ((handle = FindFirstFileA(filespec,&entry)) == INVALID_HANDLE_VALUE) { - char buffer[270]; - if (entry.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) - { - if (!(attrib & DDL_DIRECTORY) || - !strcmp( entry.cAlternateFileName, "." )) continue; - if (long_names) sprintf( buffer, "[%s]", entry.cFileName ); - else sprintf( buffer, "[%s]", entry.cAlternateFileName ); - } - else /* not a directory */ + if (GetLastError() != ERROR_NO_MORE_FILES) return LB_ERR; + } + else + { + do { + char buffer[270]; + if (entry.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) + { + if (!(attrib & DDL_DIRECTORY) || + !strcmp( entry.cAlternateFileName, "." )) continue; + if (long_names) sprintf( buffer, "[%s]", entry.cFileName ); + else sprintf( buffer, "[%s]", entry.cAlternateFileName ); + } + else /* not a directory */ + { #define ATTRIBS (FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_HIDDEN | \ FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_ARCHIVE) - if ((attrib & DDL_EXCLUSIVE) && - ((attrib & ATTRIBS) != (entry.dwFileAttributes & ATTRIBS))) - continue; + if ((attrib & DDL_EXCLUSIVE) && + ((attrib & ATTRIBS) != (entry.dwFileAttributes & ATTRIBS))) + continue; #undef ATTRIBS - if (long_names) strcpy( buffer, entry.cFileName ); - else strcpy( buffer, entry.cAlternateFileName ); - } - if (!long_names) CharLowerA( buffer ); - pos = LISTBOX_FindFileStrPos( wnd, descr, buffer ); - if ((ret = LISTBOX_InsertString( wnd, descr, pos, buffer )) < 0) - break; - } while (FindNextFileA( handle, &entry )); - FindClose( handle ); + if (long_names) strcpy( buffer, entry.cFileName ); + else strcpy( buffer, entry.cAlternateFileName ); + } + if (!long_names) CharLowerA( buffer ); + pos = LISTBOX_FindFileStrPos( wnd, descr, buffer ); + if ((ret = LISTBOX_InsertString( wnd, descr, pos, buffer )) < 0) + break; + } while (FindNextFileA( handle, &entry )); + FindClose( handle ); + } } + /* scan drives */ if ((ret >= 0) && (attrib & DDL_DRIVES)) { char buffer[] = "[-a-]"; @@ -2689,6 +2694,9 @@ static inline LRESULT WINAPI ListBoxWndProc_locked( WND* wnd, UINT msg, return LB_OKAY; case LB_DIR16: + /* according to Win16 docs, DDL_DRIVES should make DDL_EXCLUSIVE + * be set automatically (this is different in Win32) */ + if (wParam & DDL_DRIVES) wParam |= DDL_EXCLUSIVE; return LISTBOX_Directory( wnd, descr, wParam, (LPCSTR)PTR_SEG_TO_LIN(lParam), FALSE ); diff --git a/dlls/user/user.spec b/dlls/user/user.spec index f7909d0b6cf..b85b729ab7c 100644 --- a/dlls/user/user.spec +++ b/dlls/user/user.spec @@ -102,7 +102,7 @@ owner user32 97 pascal16 CheckDlgButton(word word word) CheckDlgButton16 98 pascal16 IsDlgButtonChecked(word word) IsDlgButtonChecked16 99 pascal16 DlgDirSelect(word ptr word) DlgDirSelect16 -100 pascal16 DlgDirList(word ptr word word word) DlgDirList16 +100 pascal16 DlgDirList(word str word word word) DlgDirList16 101 pascal SendDlgItemMessage(word word word word long) SendDlgItemMessage16 102 pascal16 AdjustWindowRect(ptr long word) AdjustWindowRect16 103 pascal16 MapDialogRect(word ptr) MapDialogRect16 diff --git a/dlls/user/user32.spec b/dlls/user/user32.spec index e1b441c8376..0cf3f38b7d6 100644 --- a/dlls/user/user32.spec +++ b/dlls/user/user32.spec @@ -155,10 +155,10 @@ debug_channels (accel caret class clipboard combo cursor dc ddeml dialog driver @ stdcall DialogBoxParamW(long wstr long ptr long) DialogBoxParamW @ stdcall DispatchMessageA(ptr) DispatchMessageA @ stdcall DispatchMessageW(ptr) DispatchMessageW -@ stdcall DlgDirListA(long ptr long long long) DlgDirListA +@ stdcall DlgDirListA(long str long long long) DlgDirListA @ stdcall DlgDirListComboBoxA(long ptr long long long) DlgDirListComboBoxA @ stdcall DlgDirListComboBoxW(long ptr long long long) DlgDirListComboBoxW -@ stdcall DlgDirListW(long ptr long long long) DlgDirListW +@ stdcall DlgDirListW(long wstr long long long) DlgDirListW @ stdcall DlgDirSelectComboBoxExA(long ptr long long) DlgDirSelectComboBoxExA @ stdcall DlgDirSelectComboBoxExW(long ptr long long) DlgDirSelectComboBoxExW @ stdcall DlgDirSelectExA(long ptr long long) DlgDirSelectExA