lean explorer: remove WINFS Modified: branches/lean-explorer/reactos/subsys/system/explorer/Make-rosshell.MinG W Modified: branches/lean-explorer/reactos/subsys/system/explorer/Make-rosshell.mak Modified: branches/lean-explorer/reactos/subsys/system/explorer/Makefile Modified: branches/lean-explorer/reactos/subsys/system/explorer/Makefile.MinGW Modified: branches/lean-explorer/reactos/subsys/system/explorer/Makefile.PCH Modified: branches/lean-explorer/reactos/subsys/system/explorer/explorer.dsp Modified: branches/lean-explorer/reactos/subsys/system/explorer/explorer.h Modified: branches/lean-explorer/reactos/subsys/system/explorer/shell/entries.cpp Modified: branches/lean-explorer/reactos/subsys/system/explorer/shell/entries.h Modified: branches/lean-explorer/reactos/subsys/system/explorer/shell/mainframe.cp p Modified: branches/lean-explorer/reactos/subsys/system/explorer/shell/shellbrowser .cpp Modified: branches/lean-explorer/reactos/subsys/system/explorer/shell/shellfs.cpp Modified: branches/lean-explorer/reactos/subsys/system/explorer/shell/shellfs.h Deleted: branches/lean-explorer/reactos/subsys/system/explorer/shell/winfs.cpp Deleted: branches/lean-explorer/reactos/subsys/system/explorer/shell/winfs.h Modified: branches/lean-explorer/reactos/subsys/system/explorer/taskbar/startmenu. cpp _____
Modified: branches/lean-explorer/reactos/subsys/system/explorer/Make-rosshell.MinG W --- branches/lean-explorer/reactos/subsys/system/explorer/Make-rosshell.MinG W 2005-12-31 13:37:09 UTC (rev 20481) +++ branches/lean-explorer/reactos/subsys/system/explorer/Make-rosshell.MinG W 2005-12-31 14:24:43 UTC (rev 20482) @@ -53,7 +53,6 @@
shellbrowserimpl.o \ explorer.o \ entries.o \ - winfs.o \ shellfs.o \ desktop.o \ desktopbar.o \ _____
Modified: branches/lean-explorer/reactos/subsys/system/explorer/Make-rosshell.mak --- branches/lean-explorer/reactos/subsys/system/explorer/Make-rosshell.mak 2005-12-31 13:37:09 UTC (rev 20481) +++ branches/lean-explorer/reactos/subsys/system/explorer/Make-rosshell.mak 2005-12-31 14:24:43 UTC (rev 20482) @@ -78,7 +78,6 @@
shellbrowserimpl.o \ explorer.o \ entries.o \ - winfs.o \ shellfs.o \ desktop.o \ desktopbar.o \ _____
Modified: branches/lean-explorer/reactos/subsys/system/explorer/Makefile --- branches/lean-explorer/reactos/subsys/system/explorer/Makefile 2005-12-31 13:37:09 UTC (rev 20481) +++ branches/lean-explorer/reactos/subsys/system/explorer/Makefile 2005-12-31 14:24:43 UTC (rev 20482) @@ -78,7 +78,6 @@
shellbrowserimpl.o \ explorer.o \ entries.o \ - winfs.o \ shellfs.o \ mainframe.o \ shellbrowser.o \ _____
Modified: branches/lean-explorer/reactos/subsys/system/explorer/Makefile.MinGW --- branches/lean-explorer/reactos/subsys/system/explorer/Makefile.MinGW 2005-12-31 13:37:09 UTC (rev 20481) +++ branches/lean-explorer/reactos/subsys/system/explorer/Makefile.MinGW 2005-12-31 14:24:43 UTC (rev 20482) @@ -52,7 +52,6 @@
shellbrowserimpl.o \ explorer.o \ entries.o \ - winfs.o \ shellfs.o \ mainframe.o \ shellbrowser.o \ _____
Modified: branches/lean-explorer/reactos/subsys/system/explorer/Makefile.PCH --- branches/lean-explorer/reactos/subsys/system/explorer/Makefile.PCH 2005-12-31 13:37:09 UTC (rev 20481) +++ branches/lean-explorer/reactos/subsys/system/explorer/Makefile.PCH 2005-12-31 14:24:43 UTC (rev 20482) @@ -53,7 +53,6 @@
shellbrowserimpl.o \ explorer.o \ entries.o \ - winfs.o \ shellfs.o \ mainframe.o \ shellbrowser.o \ _____
Modified: branches/lean-explorer/reactos/subsys/system/explorer/explorer.dsp --- branches/lean-explorer/reactos/subsys/system/explorer/explorer.dsp 2005-12-31 13:37:09 UTC (rev 20481) +++ branches/lean-explorer/reactos/subsys/system/explorer/explorer.dsp 2005-12-31 14:24:43 UTC (rev 20482) @@ -413,15 +413,6 @@
SOURCE=.\shell\startup.c # SUBTRACT CPP /YX /Yc /Yu # End Source File -# Begin Source File - -SOURCE=.\shell\winfs.cpp -# PROP Exclude_From_Build 1 -# End Source File -# Begin Source File - -SOURCE=.\shell\winfs.h -# End Source File # End Group # Begin Group "dialogs"
_____
Modified: branches/lean-explorer/reactos/subsys/system/explorer/explorer.h --- branches/lean-explorer/reactos/subsys/system/explorer/explorer.h 2005-12-31 13:37:09 UTC (rev 20481) +++ branches/lean-explorer/reactos/subsys/system/explorer/explorer.h 2005-12-31 14:24:43 UTC (rev 20482) @@ -29,17 +29,11 @@
#define _LIGHT_STARTMENU //#define _LAZY_ICONEXTRACT //#define _SINGLE_ICONEXTRACT -#define _NO_WIN_FS
#include "utility/shellclasses.h"
#include "shell/entries.h" - -#ifndef _NO_WIN_FS -#include "shell/winfs.h" -#endif - #include "shell/shellfs.h"
#include "utility/window.h" _____
Modified: branches/lean-explorer/reactos/subsys/system/explorer/shell/entries.cpp --- branches/lean-explorer/reactos/subsys/system/explorer/shell/entries.cpp 2005-12-31 13:37:09 UTC (rev 20481) +++ branches/lean-explorer/reactos/subsys/system/explorer/shell/entries.cpp 2005-12-31 14:24:43 UTC (rev 20482) @@ -30,12 +30,7 @@
// allocate and initialise a directory entry -#ifndef _NO_WIN_FS -Entry::Entry(ENTRY_TYPE etype) - : _etype(etype) -#else Entry::Entry() -#endif { _up = NULL; _next = NULL; @@ -50,14 +45,8 @@ _content = NULL; }
-#ifndef _NO_WIN_FS -Entry::Entry(Entry* parent, ENTRY_TYPE etype) - : _up(parent), - _etype(etype) -#else Entry::Entry(Entry* parent) : _up(parent) -#endif { _next = NULL; _down = NULL; @@ -92,9 +81,6 @@ _type_name = other._type_name? _tcsdup(other._type_name): NULL; _content = other._content? _tcsdup(other._content): NULL;
-#ifndef _NO_WIN_FS - _etype = other._etype; -#endif _icon_id = other._icon_id;
_bhfi = other._bhfi; _____
Modified: branches/lean-explorer/reactos/subsys/system/explorer/shell/entries.h --- branches/lean-explorer/reactos/subsys/system/explorer/shell/entries.h 2005-12-31 13:37:09 UTC (rev 20481) +++ branches/lean-explorer/reactos/subsys/system/explorer/shell/entries.h 2005-12-31 14:24:43 UTC (rev 20482) @@ -26,13 +26,6 @@
//
-#ifndef _NO_WIN_FS -enum ENTRY_TYPE { - ET_WINDOWS, - ET_SHELL -}; -#endif - enum SORT_ORDER { SORT_NONE, SORT_NAME, @@ -59,13 +52,8 @@ struct Entry { protected: -#ifndef _NO_WIN_FS - Entry(ENTRY_TYPE etype); - Entry(Entry* parent, ENTRY_TYPE etype); -#else Entry(); Entry(Entry* parent); -#endif Entry(const Entry&);
public: @@ -86,9 +74,6 @@ LPTSTR _type_name; LPTSTR _content;
-#ifndef _NO_WIN_FS - ENTRY_TYPE _etype; -#endif int /*ICON_ID*/ _icon_id;
BY_HANDLE_FILE_INFORMATION _bhfi; _____
Modified: branches/lean-explorer/reactos/subsys/system/explorer/shell/mainframe.cp p --- branches/lean-explorer/reactos/subsys/system/explorer/shell/mainframe.cp p 2005-12-31 13:37:09 UTC (rev 20481) +++ branches/lean-explorer/reactos/subsys/system/explorer/shell/mainframe.cp p 2005-12-31 14:24:43 UTC (rev 20482) @@ -1,5 +1,5 @@
/* - * Copyright 2003, 2004 Martin Fuchs + * Copyright 2003, 2004, 2005 Martin Fuchs * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public _____
Modified: branches/lean-explorer/reactos/subsys/system/explorer/shell/shellbrowser .cpp --- branches/lean-explorer/reactos/subsys/system/explorer/shell/shellbrowser .cpp 2005-12-31 13:37:09 UTC (rev 20481) +++ branches/lean-explorer/reactos/subsys/system/explorer/shell/shellbrowser .cpp 2005-12-31 14:24:43 UTC (rev 20482) @@ -1,5 +1,5 @@
/* - * Copyright 2003, 2004 Martin Fuchs + * Copyright 2003, 2004, 2005 Martin Fuchs * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -194,66 +194,6 @@ } }
- // local replacement implementation for SHBindToParent() - // (derived from http://www.geocities.com/SiliconValley/2060/articles/shell-helpers.html) -static HRESULT my_SHBindToParent(LPCITEMIDLIST pidl, REFIID riid, VOID** ppv, LPCITEMIDLIST* ppidlLast) -{ - HRESULT hr; - - if (!ppv) - return E_POINTER; - - // There must be at least one item ID. - if (!pidl || !pidl->mkid.cb) - return E_INVALIDARG; - - // Get the desktop folder as root. - ShellFolder desktop; -/* IShellFolderPtr desktop; - hr = SHGetDesktopFolder(&desktop); - if (FAILED(hr)) - return hr; */ - - // Walk to the penultimate item ID. - LPCITEMIDLIST marker = pidl; - for (;;) - { - LPCITEMIDLIST next = reinterpret_cast<LPCITEMIDLIST>( - marker->mkid.abID - sizeof(marker->mkid.cb) + marker->mkid.cb); - if (!next->mkid.cb) - break; - marker = next; - } - - if (marker == pidl) - { - // There was only a single item ID, so bind to the root folder. - hr = desktop->QueryInterface(riid, ppv); - } - else - { - // Copy the ID list, truncating the last item. - int length = marker->mkid.abID - pidl->mkid.abID; - if (LPITEMIDLIST parent_id = reinterpret_cast<LPITEMIDLIST>( - malloc(length + sizeof(pidl->mkid.cb)))) - { - LPBYTE raw_data = reinterpret_cast<LPBYTE>(parent_id); - memcpy(raw_data, pidl, length); - memset(raw_data + length, 0, sizeof(pidl->mkid.cb)); - hr = desktop->BindToObject(parent_id, 0, riid, ppv); - free(parent_id); - } - else - return E_OUTOFMEMORY; - } - - // Return a pointer to the last item ID. - if (ppidlLast) - *ppidlLast = marker; - - return hr; -} - void ShellBrowserChild::Tree_DoItemMenu(HWND hwndTreeView, HTREEITEM hItem, LPPOINT pptScreen) { CONTEXT("ShellBrowserChild::Tree_DoItemMenu()"); @@ -263,36 +203,11 @@ if (itemData) { Entry* entry = (Entry*)itemData;
-#ifndef _NO_WIN_FS - if (entry->_etype == ET_SHELL) -#endif - { - ShellDirectory* dir = static_cast<ShellDirectory*>(entry->_up); - ShellFolder folder = dir? dir->_folder: GetDesktopFolder(); - LPCITEMIDLIST pidl = static_cast<ShellEntry*>(entry)->_pidl; + ShellDirectory* dir = static_cast<ShellDirectory*>(entry->_up); + ShellFolder folder = dir? dir->_folder: GetDesktopFolder(); + LPCITEMIDLIST pidl = static_cast<ShellEntry*>(entry)->_pidl;
- CHECKERROR(ShellFolderContextMenu(folder, _hwnd, 1, &pidl, pptScreen->x, pptScreen->y, _cm_ifs)); - } -#ifndef _NO_WIN_FS - else { - ShellPath shell_path = entry->create_absolute_pidl(); - LPCITEMIDLIST pidl_abs = shell_path; - - IShellFolder* parentFolder; - LPCITEMIDLIST pidlLast; - - // get and use the parent folder to display correct context menu in all cases -> correct "Properties" dialog for directories, ... - HRESULT hr = my_SHBindToParent(pidl_abs, IID_IShellFolder, (LPVOID*)&parentFolder, &pidlLast); - - if (SUCCEEDED(hr)) { - hr = ShellFolderContextMenu(parentFolder, _hwnd, 1, &pidlLast, pptScreen->x, pptScreen->y, _cm_ifs); - - parentFolder->Release(); - } - - CHECKERROR(hr); - } -#endif + CHECKERROR(ShellFolderContextMenu(folder, _hwnd, 1, &pidl, pptScreen->x, pptScreen->y, _cm_ifs)); } }
@@ -671,11 +586,8 @@ Entry* entry = parent->find_entry(pidl);
if (entry && (entry->_data.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY)) -#ifndef _NO_WIN_FS - if (entry->_etype == ET_SHELL) -#endif - if (expand_folder(static_cast<ShellDirectory*>(entry))) - return S_OK; + if (expand_folder(static_cast<ShellDirectory*>(entry))) + return S_OK; } //@@} } else { // no tree control @@ -766,30 +678,25 @@
void ShellBrowserChild::jump_to(Entry* entry) { -#ifndef _NO_WIN_FS - if (entry->_etype == ET_SHELL) -#endif - { - IShellFolder* folder; - ShellDirectory* se = static_cast<ShellDirectory*>(entry); + IShellFolder* folder; + ShellDirectory* se = static_cast<ShellDirectory*>(entry);
- if (se->_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) - folder = static_cast<ShellDirectory*>(se)->_folder; - else - folder = se->get_parent_folder(); + if (se->_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) + folder = static_cast<ShellDirectory*>(se)->_folder; + else + folder = se->get_parent_folder();
- if (!folder) { - assert(folder); - return; - } + if (!folder) { + assert(folder); + return; + }
- if (_create_info._open_mode & OWM_EXPLORE) { + if (_create_info._open_mode & OWM_EXPLORE) {
- //@@ todo + //@@ todo
- } else; - UpdateFolderView(folder); + } else; + UpdateFolderView(folder);
- _cur_dir = se; - } + _cur_dir = se; } _____
Modified: branches/lean-explorer/reactos/subsys/system/explorer/shell/shellfs.cpp --- branches/lean-explorer/reactos/subsys/system/explorer/shell/shellfs.cpp 2005-12-31 13:37:09 UTC (rev 20481) +++ branches/lean-explorer/reactos/subsys/system/explorer/shell/shellfs.cpp 2005-12-31 14:24:43 UTC (rev 20482) @@ -1,5 +1,5 @@
/* - * Copyright 2003, 2004 Martin Fuchs + * Copyright 2003, 2004, 2005 Martin Fuchs * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -109,20 +109,12 @@ { CONTEXT("ShellEntry::create_absolute_pidl()");
- if (_up) -#ifndef _NO_WIN_FS - if (_up->_etype == ET_SHELL) -#endif - { - ShellDirectory* dir = static_cast<ShellDirectory*>(_up); + if (_up) { + ShellDirectory* dir = static_cast<ShellDirectory*>(_up);
- if (dir->_pidl->mkid.cb) // Caching of absolute PIDLs could enhance performance. - return _pidl.create_absolute_pidl(dir->create_absolute_pidl()); - } -#ifndef _NO_WIN_FS - else - return _pidl.create_absolute_pidl(_up->create_absolute_pidl()); -#endif + if (dir->_pidl->mkid.cb) // Caching of absolute PIDLs could enhance performance. + return _pidl.create_absolute_pidl(dir->create_absolute_pidl()); + }
return _pidl; } @@ -223,38 +215,65 @@ /*if (_folder.empty()) return;*/
-#ifndef _NO_WIN_FS - TCHAR buffer[MAX_PATH]; + ShellItemEnumerator enumerator(_folder, SHCONTF_FOLDERS|SHCONTF_NONFOLDERS|SHCONTF_INCLUDEHIDDEN|SHCONTF_SHAREAB LE|SHCONTF_STORAGE);
- if (get_path(buffer)) { - Entry* entry = NULL; // eliminate useless GCC warning by initializing entry + TCHAR name[MAX_PATH]; + HRESULT hr_next = S_OK;
- LPTSTR p = buffer + _tcslen(buffer); + do { +#define FETCH_ITEM_COUNT 32 + LPITEMIDLIST pidls[FETCH_ITEM_COUNT]; + ULONG cnt = 0;
- lstrcpy(p, TEXT("\*")); + memset(pidls, 0, sizeof(pidls));
- WIN32_FIND_DATA w32fd; - HANDLE hFind = FindFirstFile(buffer, &w32fd); + hr_next = enumerator->Next(FETCH_ITEM_COUNT, pidls, &cnt);
- if (hFind != INVALID_HANDLE_VALUE) { - do { - // ignore hidden files (usefull in the start menu) - if (w32fd.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN) - continue; + /* don't break yet now: Registry Explorer Plugin returns E_FAIL! + if (!SUCCEEDED(hr_next)) + break; */
- // ignore directory entries "." and ".." - if ((w32fd.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY) && - w32fd.cFileName[0]==TEXT('.') && - (w32fd.cFileName[1]==TEXT('\0') || - (w32fd.cFileName[1]==TEXT('.') && w32fd.cFileName[2]==TEXT('\0')))) - continue; + if (hr_next == S_FALSE) + break;
- lstrcpy(p+1, w32fd.cFileName); + for(ULONG n=0; n<cnt; ++n) { + WIN32_FIND_DATA w32fd; + BY_HANDLE_FILE_INFORMATION bhfi; + bool bhfi_valid = false;
+ memset(&w32fd, 0, sizeof(WIN32_FIND_DATA)); + + SFGAOF attribs_before = ~SFGAO_READONLY & ~SFGAO_VALIDATE; + SFGAOF attribs = attribs_before; + HRESULT hr = _folder->GetAttributesOf(1, (LPCITEMIDLIST*)&pidls[n], &attribs); + bool removeable = false; + + if (SUCCEEDED(hr) && attribs!=attribs_before) { + // avoid accessing floppy drives when browsing "My Computer" + if (attribs & SFGAO_REMOVABLE) { + attribs |= SFGAO_HASSUBFOLDER; + removeable = true; + } else if (!(scan_flags & SCAN_DONT_ACCESS)) { + DWORD attribs2 = SFGAO_READONLY; + + HRESULT hr = _folder->GetAttributesOf(1, (LPCITEMIDLIST*)&pidls[n], &attribs2); + + if (SUCCEEDED(hr)) + attribs |= attribs2; + } + } else + attribs = 0; + + bhfi_valid = fill_w32fdata_shell(pidls[n], attribs, &w32fd, &bhfi, + !(scan_flags&SCAN_DONT_ACCESS) && !removeable); + + try { + Entry* entry = NULL; // eliminate useless GCC warning by initializing entry + if (w32fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) - entry = new WinDirectory(this, buffer); + entry = new ShellDirectory(this, pidls[n], _hwnd); else - entry = new WinEntry(this); + entry = new ShellEntry(this, pidls[n]);
if (!first_entry) first_entry = entry; @@ -264,166 +283,43 @@
memcpy(&entry->_data, &w32fd, sizeof(WIN32_FIND_DATA));
- entry->_level = level; + if (bhfi_valid) + memcpy(&entry->_bhfi, &bhfi, sizeof(BY_HANDLE_FILE_INFORMATION));
- if (!(scan_flags & SCAN_DONT_ACCESS)) { - HANDLE hFile = CreateFile(buffer, GENERIC_READ, FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, - 0, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0); - - if (hFile != INVALID_HANDLE_VALUE) { - if (GetFileInformationByHandle(hFile, &entry->_bhfi)) - entry->_bhfi_valid = true; - - CloseHandle(hFile); - } + if (SUCCEEDED(name_from_pidl(_folder, pidls[n], name, MAX_PATH, SHGDN_INFOLDER|0x2000/*0x2000=SHGDN_INCLUDE_NONFILESYS*/))) { + if (!entry->_data.cFileName[0]) + _tcscpy(entry->_data.cFileName, name); + else if (_tcscmp(entry->_display_name, name)) + entry->_display_name = _tcsdup(name); // store display name separate from file name; sort display by file name }
- // set file type name - LPCTSTR ext = g_Globals._ftype_mgr.set_type(entry); - - DWORD attribs = SFGAO_FILESYSTEM; - - if (w32fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) - attribs |= SFGAO_FOLDER|SFGAO_HASSUBFOLDER; - - if (w32fd.dwFileAttributes & FILE_ATTRIBUTE_READONLY) - attribs |= SFGAO_READONLY; - - //if (w32fd.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN) - // attribs |= SFGAO_HIDDEN; - - if (w32fd.dwFileAttributes & FILE_ATTRIBUTE_COMPRESSED) - attribs |= SFGAO_COMPRESSED; - - if (ext && !_tcsicmp(ext, _T(".lnk"))) { - attribs |= SFGAO_LINK; + if (attribs & SFGAO_LINK) w32fd.dwFileAttributes |= ATTRIBUTE_SYMBOLIC_LINK; - }
+ entry->_level = level; entry->_shell_attribs = attribs; + entry->_bhfi_valid = bhfi_valid;
- if (w32fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) + // set file type name + g_Globals._ftype_mgr.set_type(entry); + + // get icons for files and virtual objects + if (!(entry->_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) || + !(attribs & SFGAO_FILESYSTEM)) { + if (!(scan_flags & SCAN_DONT_EXTRACT_ICONS)) + entry->_icon_id = entry->safe_extract_icon(); + } else if (entry->_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) entry->_icon_id = ICID_FOLDER; - else if (!(scan_flags & SCAN_DONT_EXTRACT_ICONS)) - entry->_icon_id = entry->safe_extract_icon(); + else + entry->_icon_id = ICID_NONE; // don't try again later
last = entry; - } while(FindNextFile(hFind, &w32fd)); - - FindClose(hFind); + } catch(COMException& e) { + HandleException(e, _hwnd); + } } + } while(SUCCEEDED(hr_next));
- } - else // no file system path -#endif - { - - ShellItemEnumerator enumerator(_folder, SHCONTF_FOLDERS|SHCONTF_NONFOLDERS|SHCONTF_INCLUDEHIDDEN|SHCONTF_SHAREAB LE|SHCONTF_STORAGE); - - TCHAR name[MAX_PATH]; - HRESULT hr_next = S_OK; - - do { -#define FETCH_ITEM_COUNT 32 - LPITEMIDLIST pidls[FETCH_ITEM_COUNT]; - ULONG cnt = 0; - - memset(pidls, 0, sizeof(pidls)); - - hr_next = enumerator->Next(FETCH_ITEM_COUNT, pidls, &cnt); - - /* don't break yet now: Registry Explorer Plugin returns E_FAIL! - if (!SUCCEEDED(hr_next)) - break; */ - - if (hr_next == S_FALSE) - break; - - for(ULONG n=0; n<cnt; ++n) { - WIN32_FIND_DATA w32fd; - BY_HANDLE_FILE_INFORMATION bhfi; - bool bhfi_valid = false; - - memset(&w32fd, 0, sizeof(WIN32_FIND_DATA)); - - SFGAOF attribs_before = ~SFGAO_READONLY & ~SFGAO_VALIDATE; - SFGAOF attribs = attribs_before; - HRESULT hr = _folder->GetAttributesOf(1, (LPCITEMIDLIST*)&pidls[n], &attribs); - bool removeable = false; - - if (SUCCEEDED(hr) && attribs!=attribs_before) { - // avoid accessing floppy drives when browsing "My Computer" - if (attribs & SFGAO_REMOVABLE) { - attribs |= SFGAO_HASSUBFOLDER; - removeable = true; - } else if (!(scan_flags & SCAN_DONT_ACCESS)) { - DWORD attribs2 = SFGAO_READONLY; - - HRESULT hr = _folder->GetAttributesOf(1, (LPCITEMIDLIST*)&pidls[n], &attribs2); - - if (SUCCEEDED(hr)) - attribs |= attribs2; - } - } else - attribs = 0; - - bhfi_valid = fill_w32fdata_shell(pidls[n], attribs, &w32fd, &bhfi, - !(scan_flags&SCAN_DONT_ACCESS) && !removeable); - - try { - Entry* entry = NULL; // eliminate useless GCC warning by initializing entry - - if (w32fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) - entry = new ShellDirectory(this, pidls[n], _hwnd); - else - entry = new ShellEntry(this, pidls[n]); - - if (!first_entry) - first_entry = entry; - - if (last) - last->_next = entry; - - memcpy(&entry->_data, &w32fd, sizeof(WIN32_FIND_DATA)); - - if (bhfi_valid) - memcpy(&entry->_bhfi, &bhfi, sizeof(BY_HANDLE_FILE_INFORMATION)); - - if (SUCCEEDED(name_from_pidl(_folder, pidls[n], name, MAX_PATH, SHGDN_INFOLDER|0x2000/*0x2000=SHGDN_INCLUDE_NONFILESYS*/))) { - if (!entry->_data.cFileName[0]) - _tcscpy(entry->_data.cFileName, name); - else if (_tcscmp(entry->_display_name, name)) - entry->_display_name = _tcsdup(name); // store display name separate from file name; sort display by file name - } - - if (attribs & SFGAO_LINK) - w32fd.dwFileAttributes |= ATTRIBUTE_SYMBOLIC_LINK; - - entry->_level = level; - entry->_shell_attribs = attribs; - entry->_bhfi_valid = bhfi_valid; - - // set file type name - g_Globals._ftype_mgr.set_type(entry); - - // get icons for files and virtual objects - if (!(entry->_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) || - !(attribs & SFGAO_FILESYSTEM)) { - if (!(scan_flags & SCAN_DONT_EXTRACT_ICONS)) - entry->_icon_id = entry->safe_extract_icon(); - } else if (entry->_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) - entry->_icon_id = ICID_FOLDER; - else - entry->_icon_id = ICID_NONE; // don't try again later - - last = entry; - } catch(COMException& e) { - HandleException(e, _hwnd); - } - } - } while(SUCCEEDED(hr_next)); - } - if (last) last->_next = NULL;
@@ -448,16 +344,12 @@ { LPITEMIDLIST pidl = (LPITEMIDLIST) p;
- for(Entry*entry=_down; entry; entry=entry->_next) -#ifndef _NO_WIN_FS - if (entry->_etype == ET_SHELL) -#endif - { - ShellEntry* se = static_cast<ShellEntry*>(entry); + for(Entry*entry=_down; entry; entry=entry->_next) { + ShellEntry* se = static_cast<ShellEntry*>(entry);
- if (se->_pidl && se->_pidl->mkid.cb==pidl->mkid.cb && !memcmp(se->_pidl, pidl, se->_pidl->mkid.cb)) - return entry; - } + if (se->_pidl && se->_pidl->mkid.cb==pidl->mkid.cb && !memcmp(se->_pidl, pidl, se->_pidl->mkid.cb)) + return entry; + }
return NULL; } _____
Modified: branches/lean-explorer/reactos/subsys/system/explorer/shell/shellfs.h --- branches/lean-explorer/reactos/subsys/system/explorer/shell/shellfs.h 2005-12-31 13:37:09 UTC (rev 20481) +++ branches/lean-explorer/reactos/subsys/system/explorer/shell/shellfs.h 2005-12-31 14:24:43 UTC (rev 20482) @@ -29,13 +29,8 @@
/// shell file/directory entry struct ShellEntry : public Entry { -#ifndef _NO_WIN_FS - ShellEntry(Entry* parent, LPITEMIDLIST shell_path) : Entry(parent, ET_SHELL), _pidl(shell_path) {} - ShellEntry(Entry* parent, const ShellPath& shell_path) : Entry(parent, ET_SHELL), _pidl(shell_path) {} -#else ShellEntry(Entry* parent, LPITEMIDLIST shell_path) : Entry(parent), _pidl(shell_path) {} ShellEntry(Entry* parent, const ShellPath& shell_path) : Entry(parent), _pidl(shell_path) {} -#endif
virtual bool get_path(PTSTR path) const; virtual ShellPath create_absolute_pidl() const; @@ -47,13 +42,8 @@ ShellPath _pidl; // parent relative PIDL
protected: -#ifndef _NO_WIN_FS - ShellEntry(LPITEMIDLIST shell_path) : Entry(ET_SHELL), _pidl(shell_path) {} - ShellEntry(const ShellPath& shell_path) : Entry(ET_SHELL), _pidl(shell_path) {} -#else ShellEntry(LPITEMIDLIST shell_path) : _pidl(shell_path) {} ShellEntry(const ShellPath& shell_path) : _pidl(shell_path) {} -#endif };
_____
Deleted: branches/lean-explorer/reactos/subsys/system/explorer/shell/winfs.cpp --- branches/lean-explorer/reactos/subsys/system/explorer/shell/winfs.cpp 2005-12-31 13:37:09 UTC (rev 20481) +++ branches/lean-explorer/reactos/subsys/system/explorer/shell/winfs.cpp 2005-12-31 14:24:43 UTC (rev 20482) @@ -1,227 +0,0 @@
-/* - * Copyright 2003, 2004 Martin Fuchs - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - - - // - // Explorer clone, lean version - // - // winfs.cpp - // - // Martin Fuchs, 23.07.2003 - // - - -#include "precomp.h" - - -void WinDirectory::read_directory(int scan_flags) -{ - CONTEXT("WinDirectory::read_directory()"); - - int level = _level + 1; - - Entry* first_entry = NULL; - Entry* last = NULL; - Entry* entry; - - LPCTSTR path = (LPCTSTR)_path; - TCHAR buffer[MAX_PATH], *pname; - for(pname=buffer; *path; ) - *pname++ = *path++; - - lstrcpy(pname, TEXT("\*")); - - WIN32_FIND_DATA w32fd; - HANDLE hFind = FindFirstFile(buffer, &w32fd); - - if (hFind != INVALID_HANDLE_VALUE) { - do { - // ignore hidden files (usefull in the start menu) - if (w32fd.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN) - continue; - - // ignore directory entries "." and ".." - if ((w32fd.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY) && - w32fd.cFileName[0]==TEXT('.') && - (w32fd.cFileName[1]==TEXT('\0') || - (w32fd.cFileName[1]==TEXT('.') && w32fd.cFileName[2]==TEXT('\0')))) - continue; - - lstrcpy(pname+1, w32fd.cFileName); - - if (w32fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) - entry = new WinDirectory(this, buffer); - else - entry = new WinEntry(this); - - if (!first_entry) - first_entry = entry; - - if (last) - last->_next = entry; - - memcpy(&entry->_data, &w32fd, sizeof(WIN32_FIND_DATA)); - entry->_level = level; - - // display file type names, but don't hide file extensions - g_Globals._ftype_mgr.set_type(entry, true); - - if (!(scan_flags & SCAN_DONT_ACCESS)) { - HANDLE hFile = CreateFile(buffer, GENERIC_READ, FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, - 0, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0); - - if (hFile != INVALID_HANDLE_VALUE) { - if (GetFileInformationByHandle(hFile, &entry->_bhfi)) - entry->_bhfi_valid = true; - - CloseHandle(hFile); - } - } - - last = entry; // There is always at least one entry, because FindFirstFile() succeeded and we don't filter the file entries. - } while(FindNextFile(hFind, &w32fd)); - - if (last) - last->_next = NULL; - - FindClose(hFind); - } - - _down = first_entry; - _scanned = true; -} - - -const void* WinDirectory::get_next_path_component(const void* p) const -{ - LPCTSTR s = (LPCTSTR) p; - - while(*s && *s!=TEXT('\') && *s!=TEXT('/')) - ++s; - - while(*s==TEXT('\') || *s==TEXT('/')) - ++s; - - if (!*s) - return NULL; - - return s; -} - - -Entry* WinDirectory::find_entry(const void* p) -{ - LPCTSTR name = (LPCTSTR)p; - - for(Entry*entry=_down; entry; entry=entry->_next) { - LPCTSTR p = name; - LPCTSTR q = entry->_data.cFileName; - - do { - if (!*p || *p==TEXT('\') || *p==TEXT('/')) - return entry; - } while(tolower(*p++) == tolower(*q++)); - - p = name; - q = entry->_data.cAlternateFileName; - - do { - if (!*p || *p==TEXT('\') || *p==TEXT('/')) - return entry; - } while(tolower(*p++) == tolower(*q++)); - } - - return NULL; -} - - - // get full path of specified directory entry -bool WinEntry::get_path(PTSTR path) const -{ - int level = 0; - int len = 0; - int l = 0; - LPCTSTR name = NULL; - TCHAR buffer[MAX_PATH]; - - const Entry* entry; - for(entry=this; entry; level++) { - l = 0; - - if (entry->_etype == ET_WINDOWS) { - name = entry->_data.cFileName; - - for(LPCTSTR s=name; *s && *s!=TEXT('/') && *s!=TEXT('\'); s++) - ++l; - - if (!entry->_up) - break; - } else { - if (entry->get_path(buffer)) { - l = _tcslen(buffer); - name = buffer; - - /* special handling of drive names */ - if (l>0 && buffer[l-1]=='\' && path[0]=='\') - --l; - - memmove(path+l, path, len*sizeof(TCHAR)); - memcpy(path, name, l*sizeof(TCHAR)); - len += l; - } - - entry = NULL; - break; - } - - if (l > 0) { - memmove(path+l+1, path, len*sizeof(TCHAR)); - memcpy(path+1, name, l*sizeof(TCHAR)); - len += l+1; - - path[0] = TEXT('\'); - } - - entry = entry->_up; - } - - if (entry) { - memmove(path+l, path, len*sizeof(TCHAR)); - memcpy(path, name, l*sizeof(TCHAR)); - len += l; - } - - if (!level) - path[len++] = TEXT('\'); - - path[len] = TEXT('\0'); - - return true; -} - -ShellPath WinEntry::create_absolute_pidl() const -{ - CONTEXT("WinEntry::create_absolute_pidl()"); - - TCHAR path[MAX_PATH]; - - if (get_path(path)) - return ShellPath(path); - - return ShellPath(); -} _____
Deleted: branches/lean-explorer/reactos/subsys/system/explorer/shell/winfs.h --- branches/lean-explorer/reactos/subsys/system/explorer/shell/winfs.h 2005-12-31 13:37:09 UTC (rev 20481) +++ branches/lean-explorer/reactos/subsys/system/explorer/shell/winfs.h 2005-12-31 14:24:43 UTC (rev 20482) @@ -1,66 +0,0 @@
-/* - * Copyright 2003, 2004 Martin Fuchs - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA [truncated at 1000 lines; 89 more skipped]