ReactOS 0.4.15-dev-7788-g1ad9096
Entry Struct Referenceabstract

base of all file and directory entries More...

#include <entries.h>

Inheritance diagram for Entry:
Collaboration diagram for Entry:

Public Member Functions

virtual ~Entry ()
 
void free_subentries ()
 
void read_directory_base (SORT_ORDER sortOrder=SORT_NAME, int scan_flags=0)
 
Entryread_tree (const void *path, SORT_ORDER sortOrder=SORT_NAME, int scan_flags=0)
 
void sort_directory (SORT_ORDER sortOrder)
 
void smart_scan (SORT_ORDER sortOrder=SORT_NAME, int scan_flags=0)
 
int extract_icon (ICONCACHE_FLAGS flags=ICF_NORMAL)
 
int safe_extract_icon (ICONCACHE_FLAGS flags=ICF_NORMAL)
 
virtual void read_directory (int scan_flags=0)
 
virtual const voidget_next_path_component (const void *) const
 
virtual Entryfind_entry (const void *)
 
virtual bool get_path (PTSTR path, size_t path_count) const =0
 
virtual ShellPath create_absolute_pidl () const
 
virtual HRESULT GetUIObjectOf (HWND hWnd, REFIID riid, LPVOID *ppvOut)
 
virtual ShellFolder get_shell_folder () const
 
virtual BOOL launch_entry (HWND hwnd, UINT nCmdShow=SW_SHOWNORMAL)
 
virtual HRESULT do_context_menu (HWND hwnd, const POINT &pos, CtxMenuInterfaces &cm_ifs)
 

Public Attributes

Entry_next
 
Entry_down
 
Entry_up
 
bool _expanded
 
bool _scanned
 
int _level
 
WIN32_FIND_DATA _data
 
SFGAOF _shell_attribs
 
LPTSTR _display_name
 
LPTSTR _type_name
 
LPTSTR _content
 
ENTRY_TYPE _etype
 
int _icon_id
 
BY_HANDLE_FILE_INFORMATION _bhfi
 
bool _bhfi_valid
 

Protected Member Functions

 Entry (ENTRY_TYPE etype)
 
 Entry (Entry *parent, ENTRY_TYPE etype)
 
 Entry (const Entry &)
 
bool get_path_base (PTSTR path, size_t path_count, ENTRY_TYPE etype) const
 

Detailed Description

base of all file and directory entries

Definition at line 82 of file entries.h.

Constructor & Destructor Documentation

◆ Entry() [1/3]

Entry::Entry ( ENTRY_TYPE  etype)
protected

Definition at line 35 of file entries.cpp.

36 : _etype(etype)
37{
38 _up = NULL;
39 _next = NULL;
40 _down = NULL;
41 _expanded = false;
42 _scanned = false;
43 _bhfi_valid = false;
44 _level = 0;
46 _display_name = _data.cFileName;
48 _content = NULL;
49}
#define NULL
Definition: types.h:112
@ ICID_UNKNOWN
Definition: globals.h:63
LPTSTR _display_name
Definition: entries.h:103
int _icon_id
Definition: entries.h:108
LPTSTR _type_name
Definition: entries.h:104
ENTRY_TYPE _etype
Definition: entries.h:107
bool _expanded
Definition: entries.h:96
LPTSTR _content
Definition: entries.h:105
bool _bhfi_valid
Definition: entries.h:111
Entry * _down
Definition: entries.h:93
WIN32_FIND_DATA _data
Definition: entries.h:100
Entry * _up
Definition: entries.h:94
Entry * _next
Definition: entries.h:92
int _level
Definition: entries.h:98
bool _scanned
Definition: entries.h:97

Referenced by AppendGenericListEntry(), CenterCurrentListItem(), ClasspInsertCScanList(), DoLAYOUT(), EventCallback(), GetNextListEntry(), KspAddCreateItemToList(), KspCreateDeviceReference(), KspQueryBusRelations(), ScrollDownGenericList(), ScrollToPositionGenericList(), ScrollUpGenericList(), SmpConfigureSubSystems(), SmpSaveRegistryValue(), WdmAudOpenSysAudioDeviceInterfaces(), and WdmAudOpenSysAudioDevices().

◆ Entry() [2/3]

Entry::Entry ( Entry parent,
ENTRY_TYPE  etype 
)
protected

Definition at line 51 of file entries.cpp.

52 : _up(parent),
53 _etype(etype)
54{
55 _next = NULL;
56 _down = NULL;
57 _expanded = false;
58 _scanned = false;
59 _bhfi_valid = false;
60 _level = 0;
63 _display_name = _data.cFileName;
65 _content = NULL;
66}
r parent
Definition: btrfs.c:3010
SFGAOF _shell_attribs
Definition: entries.h:102

◆ Entry() [3/3]

Entry::Entry ( const Entry other)
protected

Definition at line 68 of file entries.cpp.

69{
70 _next = NULL;
71 _down = NULL;
72 _up = NULL;
73
74 assert(!other._next);
75 assert(!other._down);
76 assert(!other._up);
77
78 _expanded = other._expanded;
79 _scanned = other._scanned;
80 _level = other._level;
81
82 _data = other._data;
83
84 _shell_attribs = other._shell_attribs;
85 _display_name = other._display_name==other._data.cFileName? _data.cFileName: _tcsdup(other._display_name);
86 _type_name = other._type_name? _tcsdup(other._type_name): NULL;
87 _content = other._content? _tcsdup(other._content): NULL;
88
89 _etype = other._etype;
90 _icon_id = other._icon_id;
91
92 _bhfi = other._bhfi;
93 _bhfi_valid = other._bhfi_valid;
94}
#define assert(x)
Definition: debug.h:53
#define _tcsdup
Definition: tchar.h:625
int other
Definition: msacm.c:1376
BY_HANDLE_FILE_INFORMATION _bhfi
Definition: entries.h:110

◆ ~Entry()

Entry::~Entry ( )
virtual

Definition at line 97 of file entries.cpp.

98{
100
101 if (_icon_id > ICID_NONE)
103
104 if (_display_name != _data.cFileName)
106
107 if (_type_name)
109
110 if (_content)
111 free(_content);
112
113 if (_down)
114 delete _down;
115}
#define free
Definition: debug_ros.c:5
ExplorerGlobals g_Globals
Definition: explorer.cpp:52
@ ICID_NONE
Definition: globals.h:64
void free_subentries()
Definition: entries.cpp:743
IconCache _icon_cache
Definition: globals.h:285
void free_icon(int icon_id)
Definition: explorer.cpp:650

Member Function Documentation

◆ create_absolute_pidl()

virtual ShellPath Entry::create_absolute_pidl ( ) const
inlinevirtual

Reimplemented in FATEntry, ShellEntry, and WinEntry.

Definition at line 126 of file entries.h.

126{return (LPCITEMIDLIST)NULL;}
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
Definition: shtypes.idl:42

Referenced by ShellEntry::create_absolute_pidl(), do_context_menu(), extract_icon(), and get_shell_folder().

◆ do_context_menu()

HRESULT Entry::do_context_menu ( HWND  hwnd,
const POINT pos,
CtxMenuInterfaces cm_ifs 
)
virtual

Reimplemented in ShellEntry.

Definition at line 519 of file entries.cpp.

520{
521 ShellPath shell_path = create_absolute_pidl();
522 LPCITEMIDLIST pidl_abs = shell_path;
523
524 if (!pidl_abs)
525 return S_FALSE; // no action for registry entries, etc.
526
527#ifdef USE_MY_SHBINDTOPARENT
528 IShellFolder* parentFolder;
529 LPCITEMIDLIST pidlLast;
530
531 // get and use the parent folder to display correct context menu in all cases -> correct "Properties" dialog for directories, ...
532 HRESULT hr = my_SHBindToParent(pidl_abs, IID_IShellFolder, (LPVOID*)&parentFolder, &pidlLast);
533
534 if (SUCCEEDED(hr)) {
535 hr = ShellFolderContextMenu(parentFolder, hwnd, 1, &pidlLast, pos.x, pos.y, cm_ifs);
536
537 parentFolder->Release();
538 }
539
540 return hr;
541#else
542 static DynamicFct<HRESULT(WINAPI*)(LPCITEMIDLIST, REFIID, LPVOID*, LPCITEMIDLIST*)> SHBindToParent(TEXT("SHELL32"), "SHBindToParent");
543
544 if (SHBindToParent) {
545 IShellFolder* parentFolder;
546 LPCITEMIDLIST pidlLast;
547
548 // get and use the parent folder to display correct context menu in all cases -> correct "Properties" dialog for directories, ...
549 HRESULT hr = (*SHBindToParent)(pidl_abs, IID_IShellFolder, (LPVOID*)&parentFolder, &pidlLast);
550
551 if (SUCCEEDED(hr)) {
552 hr = ShellFolderContextMenu(parentFolder, hwnd, 1, &pidlLast, pos.x, pos.y, cm_ifs);
553
554 parentFolder->Release();
555 }
556
557 return hr;
558 } else {
575 return ShellFolderContextMenu(GetDesktopFolder(), hwnd, 1, &pidl_abs, pos.x, pos.y, cm_ifs);
576 }
577#endif
578}
static HRESULT my_SHBindToParent(LPCITEMIDLIST pidl, REFIID riid, VOID **ppv, LPCITEMIDLIST *ppidlLast)
Definition: entries.cpp:460
ULONG Release()
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define TEXT(s)
Definition: k32.h:26
HRESULT WINAPI SHBindToParent(LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppv, LPCITEMIDLIST *ppidlLast)
Definition: pidl.c:1352
#define REFIID
Definition: guiddef.h:118
ShellFolder & GetDesktopFolder()
HRESULT ShellFolderContextMenu(IShellFolder *shell_folder, HWND hwndParent, int cidl, LPCITEMIDLIST *apidl, int x, int y, CtxMenuInterfaces &cm_ifs)
HRESULT hr
Definition: shlfolder.c:183
virtual ShellPath create_absolute_pidl() const
Definition: entries.h:126
wrapper class for item ID lists
Definition: shellclasses.h:652
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
#define HRESULT
Definition: msvc.h:7
#define WINAPI
Definition: msvc.h:6
#define S_FALSE
Definition: winerror.h:2357

◆ extract_icon()

int Entry::extract_icon ( ICONCACHE_FLAGS  flags = ICF_NORMAL)

Definition at line 365 of file entries.cpp.

366{
368
369 ICON_ID icon_id = ICID_NONE;
370
371 if (_etype!=ET_SHELL && get_path(path, COUNTOF(path))) // not for ET_SHELL to display the correct desktop icon
372 if (!(flags & ICF_MIDDLE)) // not for ICF_MIDDLE to extract 24x24 icons because SHGetFileInfo() doesn't support this icon size
374
375 if (icon_id == ICID_NONE) {
376 if (!(flags & ICF_OVERLAYS)) {
377 IExtractIcon* pExtract;
378 if (SUCCEEDED(GetUIObjectOf(0, IID_IExtractIcon, (LPVOID*)&pExtract))) {
379 unsigned gil_flags = 0;
380 int idx;
381
382 if (flags & ICF_OPEN)
383 gil_flags |= GIL_OPENICON;
384
385 if (SUCCEEDED(pExtract->GetIconLocation(GIL_FORSHELL, path, COUNTOF(path), &idx, &gil_flags))) {
386 if (gil_flags & GIL_NOTFILENAME)
387 icon_id = g_Globals._icon_cache.extract(pExtract, path, idx, flags);
388 else {
389 if (idx == -1)
390 idx = 0; // special case for some control panel applications ("System")
391
393 }
394
395 /* using create_absolute_pidl() [see below] results in more correct icons for some control panel applets (NVidia display driver).
396 if (icon_id == ICID_NONE) {
397 SHFILEINFO sfi;
398
399 if (SHGetFileInfo(path, 0, &sfi, sizeof(sfi), SHGFI_ICON|SHGFI_SMALLICON))
400 icon_id = g_Globals._icon_cache.add(sfi.hIcon)._id;
401 } */
402 /*
403 if (icon_id == ICID_NONE) {
404 LPBYTE b = (LPBYTE) alloca(0x10000);
405 SHFILEINFO sfi;
406
407 FILE* file = fopen(path, "rb");
408 if (file) {
409 int l = fread(b, 1, 0x10000, file);
410 fclose(file);
411
412 if (l)
413 icon_id = g_Globals._icon_cache.add(CreateIconFromResourceEx(b, l, TRUE, 0x00030000, 16, 16, LR_DEFAULTCOLOR));
414 }
415 } */
416 }
417 }
418 }
419
420 if (icon_id == ICID_NONE) {
421 const ShellPath& pidl_abs = create_absolute_pidl();
422 LPCITEMIDLIST pidl = pidl_abs;
423
424 icon_id = g_Globals._icon_cache.extract(pidl, flags);
425 }
426 }
427
428 return icon_id;
429}
unsigned int idx
Definition: utils.c:41
#define MAX_PATH
Definition: compat.h:34
@ ICF_MIDDLE
Definition: entries.h:68
@ ICF_OVERLAYS
Definition: entries.h:71
@ ICF_OPEN
Definition: entries.h:70
@ ET_SHELL
Definition: entries.h:37
GLbitfield flags
Definition: glext.h:7161
ICON_ID
Definition: globals.h:62
#define COUNTOF(x)
Definition: utility.h:93
#define IID_IExtractIcon
Definition: shlguid.h:132
virtual HRESULT GetUIObjectOf(HWND hWnd, REFIID riid, LPVOID *ppvOut)
Definition: entries.cpp:581
virtual bool get_path(PTSTR path, size_t path_count) const =0
const Icon & extract(LPCTSTR path, ICONCACHE_FLAGS flags=ICF_NORMAL)
Definition: explorer.cpp:416
char TCHAR
Definition: xmlstorage.h:189

Referenced by safe_extract_icon().

◆ find_entry()

virtual Entry * Entry::find_entry ( const void )
inlinevirtual

Reimplemented in FATDirectory, NtObjDirectory, RegDirectory, ShellDirectory, and WinDirectory.

Definition at line 124 of file entries.h.

124{return NULL;}

◆ free_subentries()

void Entry::free_subentries ( )

Definition at line 743 of file entries.cpp.

744{
746
747 if (next) {
748 _down = 0;
749
750 do {
751 entry = next;
752 next = entry->_next;
753
754 entry->free_subentries();
755 delete entry;
756 } while(next);
757 }
758}
uint32_t entry
Definition: isohybrid.c:63
static unsigned __int64 next
Definition: rand_nt.c:6
base of all file and directory entries
Definition: entries.h:83

Referenced by smart_scan(), ~Entry(), Root::~Root(), and StartMenuDirectory::~StartMenuDirectory().

◆ get_next_path_component()

virtual const void * Entry::get_next_path_component ( const void ) const
inlinevirtual

Reimplemented in FATDirectory, RegDirectory, ShellDirectory, and WinDirectory.

Definition at line 123 of file entries.h.

123{return NULL;}

◆ get_path()

virtual bool Entry::get_path ( PTSTR  path,
size_t  path_count 
) const
pure virtual

◆ get_path_base()

bool Entry::get_path_base ( PTSTR  path,
size_t  path_count,
ENTRY_TYPE  etype 
) const
protected

Definition at line 639 of file entries.cpp.

640{
641 int level = 0;
642 size_t len = 0;
643 size_t l = 0;
644 LPCTSTR name = NULL;
646
647 if (!path || path_count==0)
648 return false;
649
650 const Entry* entry;
651 if ( path_count > 1 )
652 {
653 for(entry=this; entry; level++) {
654 l = 0;
655
656 if (entry->_etype == etype) {
657 name = entry->_data.cFileName;
658
659 for(LPCTSTR s=name; *s && *s!=TEXT('/') && *s!=TEXT('\\'); s++)
660 ++l;
661
662 if (!entry->_up)
663 break;
664 } else {
665 if (entry->get_path(buffer, COUNTOF(buffer))) {
666 l = _tcslen(buffer);
667 name = buffer;
668
669 /* special handling of drive names */
670 if (l>0 && buffer[l-1]=='\\' && path[0]=='\\')
671 --l;
672
673 if ( len+l >= path_count )
674 {
675 if ( l + 1 > path_count )
676 len = 0;
677 else
678 len = path_count - l - 1;
679 }
680 memmove(path+l, path, len*sizeof(TCHAR));
681 if ( l+1 >= path_count )
682 l = path_count - 1;
683 memcpy(path, name, l*sizeof(TCHAR));
684 len += l;
685 }
686
687 entry = NULL;
688 break;
689 }
690
691 if (l > 0) {
692 if ( len+l+1 >= path_count )
693 {
694 /* compare to 2 here because of terminator plus the '\\' we prepend */
695 if ( l + 2 > path_count )
696 len = 0;
697 else
698 len = path_count - l - 2;
699 }
700 memmove(path+l+1, path, len*sizeof(TCHAR));
701 /* compare to 2 here because of terminator plus the '\\' we prepend */
702 if ( l+2 >= path_count )
703 l = path_count - 2;
704 memcpy(path+1, name, l*sizeof(TCHAR));
705 len += l+1;
706
707#ifndef _NO_WIN_FS
708 if (etype == ET_WINDOWS && entry->_up && !(entry->_up->_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) // a NTFS stream?
709 path[0] = TEXT(':');
710 else
711#endif
712 path[0] = TEXT('\\');
713 }
714
715 entry = entry->_up;
716 }
717
718 if (entry) {
719 if ( len+l >= path_count )
720 {
721 if ( l + 1 > path_count )
722 len = 0;
723 else
724 len = path_count - l - 1;
725 }
726 memmove(path+l, path, len*sizeof(TCHAR));
727 if ( l+1 >= path_count )
728 l = path_count - 1;
729 memcpy(path, name, l*sizeof(TCHAR));
730 len += l;
731 }
732
733 if ( !level && (len+1 < path_count) )
734 path[len++] = TEXT('\\');
735 }
736
737 path[len] = TEXT('\0');
738
739 return true;
740}
r l[0]
Definition: byte_order.h:168
@ ET_WINDOWS
Definition: entries.h:32
GLint level
Definition: gl.h:1546
GLdouble s
Definition: gl.h:2039
GLuint buffer
Definition: glext.h:5915
GLenum GLsizei len
Definition: glext.h:6722
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define memmove(s1, s2, n)
Definition: mkisofs.h:881
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
Definition: name.c:39
const CHAR * LPCTSTR
Definition: xmlstorage.h:193
#define _tcslen
Definition: xmlstorage.h:198

Referenced by NtObjEntry::get_path(), RegEntry::get_path(), and WinEntry::get_path().

◆ get_shell_folder()

ShellFolder Entry::get_shell_folder ( ) const
virtual

Reimplemented in ShellEntry, and ShellDirectory.

Definition at line 237 of file shellfs.cpp.

238{
240}
IShellFolder smart pointer.
Definition: shellclasses.h:594

◆ GetUIObjectOf()

HRESULT Entry::GetUIObjectOf ( HWND  hWnd,
REFIID  riid,
LPVOID ppvOut 
)
virtual

Reimplemented in ShellEntry.

Definition at line 581 of file entries.cpp.

582{
584/*
585 if (!get_path(path, COUNTOF(path)))
586 return E_FAIL;
587
588 ShellPath shell_path(path);
589
590 IShellFolder* pFolder;
591 LPCITEMIDLIST pidl_last = NULL;
592
593 static DynamicFct<HRESULT(WINAPI*)(LPCITEMIDLIST, REFIID, LPVOID*, LPCITEMIDLIST*)> SHBindToParent(TEXT("SHELL32"), "SHBindToParent");
594
595 if (!SHBindToParent)
596 return E_NOTIMPL;
597
598 HRESULT hr = (*SHBindToParent)(shell_path, IID_IShellFolder, (LPVOID*)&pFolder, &pidl_last);
599 if (FAILED(hr))
600 return hr;
601
602 ShellFolder shell_folder(pFolder);
603
604 shell_folder->Release();
605
606 return shell_folder->GetUIObjectOf(hWnd, 1, &pidl_last, riid, NULL, ppvOut);
607*/
608 if (!_up)
609 return E_INVALIDARG;
610
611 if (!_up->get_path(path, COUNTOF(path)))
612 return E_FAIL;
613
614 ShellPath shell_path(path);
615 ShellFolder shell_folder(shell_path);
616
617#ifdef UNICODE
618 LPWSTR wname = _data.cFileName;
619#else
620 WCHAR wname[MAX_PATH];
621 MultiByteToWideChar(CP_ACP, 0, _data.cFileName, -1, wname, COUNTOF(wname));
622#endif
623
624 LPITEMIDLIST pidl_last = NULL;
625 HRESULT hr = shell_folder->ParseDisplayName(hWnd, NULL, wname, NULL, &pidl_last, NULL);
626
627 if (FAILED(hr))
628 return hr;
629
630 hr = shell_folder->GetUIObjectOf(hWnd, 1, (LPCITEMIDLIST*)&pidl_last, riid, NULL, ppvOut);
631
632 ShellMalloc()->Free((void*)pidl_last);
633
634 return hr;
635}
HWND hWnd
Definition: settings.c:17
#define E_INVALIDARG
Definition: ddrawi.h:101
#define E_FAIL
Definition: ddrawi.h:102
#define CP_ACP
Definition: compat.h:109
#define MultiByteToWideChar
Definition: compat.h:110
REFIID riid
Definition: atlbase.h:39
void Free([in] LPVOID pv)
#define FAILED(hr)
Definition: intsafe.h:51
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
wrapper class for IMalloc with usage of common allocator
Definition: shellclasses.h:253
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by extract_icon().

◆ launch_entry()

BOOL Entry::launch_entry ( HWND  hwnd,
UINT  nCmdShow = SW_SHOWNORMAL 
)
virtual

Reimplemented in NtObjEntry, RegEntry, and ShellEntry.

Definition at line 443 of file entries.cpp.

444{
446
447 if (!get_path(cmd, COUNTOF(cmd)))
448 return FALSE;
449
450 // add path to the recent file list
452
453 // start program, open document...
454 return launch_file(hwnd, cmd, nCmdShow);
455}
#define FALSE
Definition: types.h:117
BOOL launch_file(HWND hwnd, LPCTSTR cmd, UINT nCmdShow, LPCTSTR parameters)
Definition: utility.cpp:189
void WINAPI SHAddToRecentDocs(UINT uFlags, LPCVOID pv)
Definition: shellord.c:813
#define SHARD_PATH
Definition: shlobj.h:1170
Definition: ftp_var.h:139

Referenced by QuickLaunchBar::Command().

◆ read_directory()

virtual void Entry::read_directory ( int  scan_flags = 0)
inlinevirtual

Reimplemented in FATDirectory, NtObjDirectory, RegDirectory, RegistryRoot, ShellDirectory, and WinDirectory.

Definition at line 122 of file entries.h.

122{}

Referenced by read_directory_base().

◆ read_directory_base()

void Entry::read_directory_base ( SORT_ORDER  sortOrder = SORT_NAME,
int  scan_flags = 0 
)
Todo:
_prescan_nodes should not be used for reading the start menu.

Definition at line 143 of file entries.cpp.

144{
145 CONTEXT("Entry::read_directory_base()");
146
147 // call into subclass
148 read_directory(scan_flags);
149
150#ifndef ROSSHELL
152 for(Entry*entry=_down; entry; entry=entry->_next)
153 if (entry->_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
154 entry->read_directory(scan_flags);
155 entry->sort_directory(sortOrder);
156 }
157 }
158#endif
159
160 sort_directory(sortOrder);
161}
struct _CONTEXT CONTEXT
void sort_directory(SORT_ORDER sortOrder)
Definition: entries.cpp:321
virtual void read_directory(int scan_flags=0)
Definition: entries.h:122
bool _prescan_nodes
Definition: globals.h:277

Referenced by smart_scan().

◆ read_tree()

Entry * Entry::read_tree ( const void path,
SORT_ORDER  sortOrder = SORT_NAME,
int  scan_flags = 0 
)

Definition at line 119 of file entries.cpp.

120{
121 CONTEXT("Entry::read_tree()");
122
123 WaitCursor wait;
124
125 Entry* entry = this;
126
127 for(const void*p=path; p && entry; ) {
128 entry->smart_scan(sortOrder, scan_flags);
129
130 if (entry->_down)
131 entry->_expanded = true;
132
133 Entry* found = entry->find_entry(p);
134 p = entry->get_next_path_component(p);
135
136 entry = found;
137 }
138
139 return entry;
140}
VOID WaitCursor(BOOL bBegin)
Definition: dialog.c:114
GLfloat GLfloat p
Definition: glext.h:8902

Referenced by Root::read_tree().

◆ safe_extract_icon()

int Entry::safe_extract_icon ( ICONCACHE_FLAGS  flags = ICF_NORMAL)

Definition at line 431 of file entries.cpp.

432{
433 try {
434 return extract_icon(flags);
435 } catch(COMException&) {
436 // ignore unexpected exceptions while extracting icons
437 }
438
439 return ICID_NONE;
440}
Exception with context information.
Definition: shellclasses.h:114
int extract_icon(ICONCACHE_FLAGS flags=ICF_NORMAL)
Definition: entries.cpp:365

◆ smart_scan()

void Entry::smart_scan ( SORT_ORDER  sortOrder = SORT_NAME,
int  scan_flags = 0 
)
Todo:
We could use IShellFolder2::GetDefaultColumn to determine sort order.

Definition at line 353 of file entries.cpp.

354{
355 CONTEXT("Entry::smart_scan()");
356
357 if (!_scanned) {
359 read_directory_base(sortOrder, scan_flags);
360 }
361}
void read_directory_base(SORT_ORDER sortOrder=SORT_NAME, int scan_flags=0)
Definition: entries.cpp:143

Referenced by QuickLaunchBar::AddShortcuts(), ShellBrowser::jump_to(), and Root::read_tree().

◆ sort_directory()

void Entry::sort_directory ( SORT_ORDER  sortOrder)

Definition at line 321 of file entries.cpp.

322{
323 if (sortOrder != SORT_NONE) {
324 Entry* entry = _down;
325 Entry** array, **p;
326 int len;
327
328 len = 0;
329 for(entry=_down; entry; entry=entry->_next)
330 ++len;
331
332 if (len) {
333 array = (Entry**) alloca(len*sizeof(Entry*));
334
335 p = array;
336 for(entry=_down; entry; entry=entry->_next)
337 *p++ = entry;
338
339 // call qsort with the appropriate compare function
340 qsort(array, len, sizeof(array[0]), sortFunctions[sortOrder]);
341
342 _down = array[0];
343
344 for(p=array; --len; p++)
345 (*p)->_next = p[1];
346
347 (*p)->_next = 0;
348 }
349 }
350}
static int(* sortFunctions[])(const void *arg1, const void *arg2)
Definition: entries.cpp:312
@ SORT_NONE
Definition: entries.h:45
#define alloca
Definition: malloc.h:357
void __cdecl qsort(_Inout_updates_bytes_(_NumOfElements *_SizeOfElements) void *_Base, _In_ size_t _NumOfElements, _In_ size_t _SizeOfElements, _In_ int(__cdecl *_PtFuncCompare)(const void *, const void *))

Referenced by read_directory_base().

Member Data Documentation

◆ _bhfi

Definition at line 110 of file entries.h.

Referenced by Entry().

◆ _bhfi_valid

bool Entry::_bhfi_valid

Definition at line 111 of file entries.h.

Referenced by Entry().

◆ _content

LPTSTR Entry::_content

Definition at line 105 of file entries.h.

Referenced by Entry(), and ~Entry().

◆ _data

◆ _display_name

LPTSTR Entry::_display_name

Definition at line 103 of file entries.h.

Referenced by Entry(), and ~Entry().

◆ _down

◆ _etype

ENTRY_TYPE Entry::_etype

Definition at line 107 of file entries.h.

Referenced by ShellEntry::create_absolute_pidl(), Entry(), and extract_icon().

◆ _expanded

bool Entry::_expanded

Definition at line 96 of file entries.h.

Referenced by Entry(), Root::read_tree(), and FileChildWindow::refresh().

◆ _icon_id

int Entry::_icon_id

Definition at line 108 of file entries.h.

Referenced by Entry(), and ~Entry().

◆ _level

◆ _next

Entry* Entry::_next

Definition at line 92 of file entries.h.

Referenced by Entry().

◆ _scanned

◆ _shell_attribs

SFGAOF Entry::_shell_attribs

Definition at line 102 of file entries.h.

Referenced by compareType(), Entry(), and ShellDirectory::ShellDirectory().

◆ _type_name

LPTSTR Entry::_type_name

Definition at line 104 of file entries.h.

Referenced by Entry(), and ~Entry().

◆ _up


The documentation for this struct was generated from the following files: