diff --git a/reactos/subsys/system/explorer/shell/entries.cpp b/reactos/subsys/system/explorer/shell/entries.cpp index 67821ec9afe..d6004f94a66 100644 --- a/reactos/subsys/system/explorer/shell/entries.cpp +++ b/reactos/subsys/system/explorer/shell/entries.cpp @@ -170,12 +170,12 @@ Root::~Root() // sort order for different directory/file types enum TYPE_ORDER { - TO_DIR = 0, - TO_DOT = 1, - TO_DOTDOT = 2, - TO_OTHER_DIR= 3, - TO_FILE = 4, - TO_VIRTUAL = 8 + TO_DIR, + TO_DOT, + TO_DOTDOT, + TO_OTHER_DIR, + TO_VIRTUAL_FOLDER, + TO_FILE }; // distinguish between ".", ".." and any other directory names @@ -198,22 +198,22 @@ static int compareType(const Entry* entry1, const Entry* entry2) const WIN32_FIND_DATA* fd1 = &entry1->_data; const WIN32_FIND_DATA* fd2 = &entry2->_data; - int order1 = fd1->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY? TO_DIR: TO_FILE; - int order2 = fd2->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY? TO_DIR: TO_FILE; + TYPE_ORDER order1 = fd1->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY? TO_DIR: TO_FILE; + TYPE_ORDER order2 = fd2->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY? TO_DIR: TO_FILE; // Handle "." and ".." as special case and move them at the very first beginning. if (order1==TO_DIR && order2==TO_DIR) { order1 = TypeOrderFromDirname(fd1->cFileName); order2 = TypeOrderFromDirname(fd2->cFileName); + + // Move virtual folders after physical folders + if (!(entry1->_shell_attribs & SFGAO_FILESYSTEM)) + order1 = TO_VIRTUAL_FOLDER; + + if (!(entry2->_shell_attribs & SFGAO_FILESYSTEM)) + order2 = TO_VIRTUAL_FOLDER; } - // Move virtual folders after physical folders - if (!(entry1->_shell_attribs & SFGAO_FILESYSTEM)) - order1 |= TO_VIRTUAL; - - if (!(entry2->_shell_attribs & SFGAO_FILESYSTEM)) - order2 |= TO_VIRTUAL; - return order2==order1? 0: order1ftLastWriteTime = fad.ftLastWriteTime; if (!(fad.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) { + // copy file size pw32fdata->nFileSizeLow = fad.nFileSizeLow; pw32fdata->nFileSizeHigh = fad.nFileSizeHigh; + } else { + // ignore FILE_ATTRIBUTE_HIDDEN attribute of NTFS drives - this would hide those drives in ShellBrowser + if (pw32fdata->dwFileAttributes & FILE_ATTRIBUTE_HIDDEN) { + if (path[1]==':' && path[2]=='\\' && !path[3]) // Is it a drive path? + pw32fdata->dwFileAttributes &= ~FILE_ATTRIBUTE_HIDDEN; + } } } @@ -355,6 +362,7 @@ void ShellDirectory::read_directory(int scan_flags) ShellItemEnumerator enumerator(_folder, SHCONTF_FOLDERS|SHCONTF_NONFOLDERS|SHCONTF_INCLUDEHIDDEN|SHCONTF_SHAREABLE|SHCONTF_STORAGE); TCHAR name[MAX_PATH]; + TCHAR path[MAX_PATH]; HRESULT hr_next = S_OK; do { @@ -423,6 +431,11 @@ void ShellDirectory::read_directory(int scan_flags) if (bhfi_valid) memcpy(&entry->_bhfi, &bhfi, sizeof(BY_HANDLE_FILE_INFORMATION)); + // store path in entry->_data.cFileName in case fill_w32fdata_shell() didn't already fill it + if (!entry->_data.cFileName[0]) + if (SUCCEEDED(path_from_pidl(_folder, pidls[n], path, COUNTOF(path)))) + _tcscpy(entry->_data.cFileName, path); + if (SUCCEEDED(name_from_pidl(_folder, pidls[n], name, COUNTOF(name), SHGDN_INFOLDER|0x2000/*0x2000=SHGDN_INCLUDE_NONFILESYS*/))) { if (!entry->_data.cFileName[0]) _tcscpy(entry->_data.cFileName, name);