Explorer: sort drives by path name; ignore hidden attribute of NTFS
volumes
This resolves Bugzilla issue 1236
Modified: trunk/reactos/subsys/system/explorer/shell/entries.cpp
Modified: trunk/reactos/subsys/system/explorer/shell/shellfs.cpp
_____
Modified: trunk/reactos/subsys/system/explorer/shell/entries.cpp
--- trunk/reactos/subsys/system/explorer/shell/entries.cpp
2006-01-15 13:25:50 UTC (rev 20891)
+++ trunk/reactos/subsys/system/explorer/shell/entries.cpp
2006-01-15 13:44:14 UTC (rev 20892)
@@ -170,12 +170,12 @@
// 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,21 +198,21 @@
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;
+ // 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;
+ if (!(entry2->_shell_attribs & SFGAO_FILESYSTEM))
+ order2 = TO_VIRTUAL_FOLDER;
+ }
return order2==order1? 0: order1<order2? -1: 1;
}
_____
Modified: trunk/reactos/subsys/system/explorer/shell/shellfs.cpp
--- trunk/reactos/subsys/system/explorer/shell/shellfs.cpp
2006-01-15 13:25:50 UTC (rev 20891)
+++ trunk/reactos/subsys/system/explorer/shell/shellfs.cpp
2006-01-15 13:44:14 UTC (rev 20892)
@@ -72,8 +72,15 @@
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 @@
ShellItemEnumerator enumerator(_folder,
SHCONTF_FOLDERS|SHCONTF_NONFOLDERS|SHCONTF_INCLUDEHIDDEN|SHCONTF_SHAREAB
LE|SHCONTF_STORAGE);
TCHAR name[MAX_PATH];
+ TCHAR path[MAX_PATH];
HRESULT hr_next = S_OK;
do {
@@ -423,6 +431,11 @@
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);
Show replies by date