Windows file system directory-entry. More...
#include <winfs.h>


Public Member Functions | |
| WinDirectory (LPCTSTR root_path) | |
| WinDirectory (Entry *parent, LPCTSTR path) | |
| ~WinDirectory () | |
| virtual void | read_directory (int scan_flags=0) |
| virtual const void * | get_next_path_component (const void *) const |
| virtual Entry * | find_entry (const void *) |
Windows file system directory-entry.
Definition at line 43 of file winfs.h.
| WinDirectory::WinDirectory | ( | LPCTSTR | root_path ) | [inline] |
Definition at line 45 of file winfs.h.
References Directory::_path.
Referenced by read_directory().

Definition at line 51 of file winfs.h.
References Directory::_path.
| WinDirectory::~WinDirectory | ( | ) | [inline] |
| Entry * WinDirectory::find_entry | ( | const void * | p ) | [virtual] |
Reimplemented from Entry.
Definition at line 208 of file winfs.cpp.
References Entry::_data, Entry::_down, Entry::_next, and TEXT.
{
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;
}
| const void * WinDirectory::get_next_path_component | ( | const void * | p ) | const [virtual] |
| void WinDirectory::read_directory | ( | int | scan_flags = 0 ) |
[virtual] |
Reimplemented from Entry.
Definition at line 121 of file winfs.cpp.
References Entry::_bhfi, Entry::_bhfi_valid, Entry::_data, Entry::_down, ExplorerGlobals::_ftype_mgr, Entry::_level, Entry::_next, Directory::_path, Entry::_scanned, CONTEXT, g_Globals, SCAN_DONT_ACCESS, ScanNTFSStreams(), FileTypeManager::set_type(), TEXT, WinDirectory(), and WinEntry::WinEntry().
{
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 {
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;
if (ScanNTFSStreams(entry, hFile))
entry->_scanned = true; // There exist named NTFS sub-streams in this file.
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;
}

|
ROS Explorer Source Code Documentation
generated on 02.01.2013 by
|