mirror of
https://github.com/reactos/reactos.git
synced 2025-01-02 20:43:18 +00:00
Explorer: sort drives by path name; ignore hidden attribute of NTFS volumes
This resolves Bugzilla issue 1236 svn path=/trunk/; revision=20892
This commit is contained in:
parent
88a9cea5ae
commit
7548ba36d1
2 changed files with 28 additions and 15 deletions
|
@ -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: order1<order2? -1: 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -72,8 +72,15 @@ bool ShellDirectory::fill_w32fdata_shell(LPCITEMIDLIST pidl, SFGAOF attribs, WIN
|
|||
pw32fdata->ftLastWriteTime = 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);
|
||||
|
|
Loading…
Reference in a new issue