ReactOS  r74244
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::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;
47  _type_name = NULL;
48  _content = NULL;
49 }
Entry * _next
Definition: entries.h:92
Entry * _up
Definition: entries.h:94
WIN32_FIND_DATA _data
Definition: entries.h:100
int _icon_id
Definition: entries.h:108
bool _expanded
Definition: entries.h:96
bool _bhfi_valid
Definition: entries.h:111
LPTSTR _content
Definition: entries.h:105
smooth NULL
Definition: ftsmooth.c:464
ENTRY_TYPE _etype
Definition: entries.h:107
Entry * _down
Definition: entries.h:93
int _level
Definition: entries.h:98
LPTSTR _type_name
Definition: entries.h:104
bool _scanned
Definition: entries.h:97
LPTSTR _display_name
Definition: entries.h:103
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;
62  _shell_attribs = 0;
63  _display_name = _data.cFileName;
64  _type_name = NULL;
65  _content = NULL;
66 }
Entry * _next
Definition: entries.h:92
Entry * _up
Definition: entries.h:94
WIN32_FIND_DATA _data
Definition: entries.h:100
int _icon_id
Definition: entries.h:108
bool _expanded
Definition: entries.h:96
bool _bhfi_valid
Definition: entries.h:111
LPTSTR _content
Definition: entries.h:105
smooth NULL
Definition: ftsmooth.c:464
ENTRY_TYPE _etype
Definition: entries.h:107
Entry * _down
Definition: entries.h:93
SFGAOF _shell_attribs
Definition: entries.h:102
int _level
Definition: entries.h:98
LPTSTR _type_name
Definition: entries.h:104
bool _scanned
Definition: entries.h:97
LPTSTR _display_name
Definition: entries.h:103
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 
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 }
Entry * _next
Definition: entries.h:92
Entry * _up
Definition: entries.h:94
WIN32_FIND_DATA _data
Definition: entries.h:100
BY_HANDLE_FILE_INFORMATION _bhfi
Definition: entries.h:110
#define assert(x)
Definition: debug.h:53
#define _tcsdup
Definition: tchar.h:625
int _icon_id
Definition: entries.h:108
bool _expanded
Definition: entries.h:96
bool _bhfi_valid
Definition: entries.h:111
LPTSTR _content
Definition: entries.h:105
smooth NULL
Definition: ftsmooth.c:464
ENTRY_TYPE _etype
Definition: entries.h:107
Entry * _down
Definition: entries.h:93
SFGAOF _shell_attribs
Definition: entries.h:102
int _level
Definition: entries.h:98
LPTSTR _type_name
Definition: entries.h:104
bool _scanned
Definition: entries.h:97
LPTSTR _display_name
Definition: entries.h:103
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)
108  free(_type_name);
109 
110  if (_content)
111  free(_content);
112 
113  if (_down)
114  delete _down;
115 }
WIN32_FIND_DATA _data
Definition: entries.h:100
#define free
Definition: debug_ros.c:5
int _icon_id
Definition: entries.h:108
void free_icon(int icon_id)
Definition: explorer.cpp:650
LPTSTR _content
Definition: entries.h:105
Entry * _down
Definition: entries.h:93
ExplorerGlobals g_Globals
Definition: explorer.cpp:52
LPTSTR _type_name
Definition: entries.h:104
void free_subentries()
Definition: entries.cpp:743
IconCache _icon_cache
Definition: globals.h:285
LPTSTR _display_name
Definition: entries.h:103

Member Function Documentation

virtual ShellPath Entry::create_absolute_pidl ( ) const
inlinevirtual

Reimplemented in WinEntry, FATEntry, and ShellEntry.

Definition at line 126 of file entries.h.

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

126 {return (LPCITEMIDLIST)NULL;}
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
Definition: shtypes.idl:42
smooth NULL
Definition: ftsmooth.c:464
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.

Referenced by ShellBrowser::OnTreeItemRClick(), QuickLaunchBar::WndProc(), FileChildWindow::WndProc(), and StartMenu::WndProc().

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 }
virtual ShellPath create_absolute_pidl() const
Definition: entries.h:126
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
Definition: shtypes.idl:42
ULONG Release()
#define S_FALSE
Definition: winerror.h:2357
static HRESULT my_SHBindToParent(LPCITEMIDLIST pidl, REFIID riid, VOID **ppv, LPCITEMIDLIST *ppidlLast)
Definition: entries.cpp:460
LONG HRESULT
Definition: typedefs.h:78
ShellFolder & GetDesktopFolder()
#define TEXT(s)
Definition: k32.h:26
HRESULT WINAPI SHBindToParent(LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppv, LPCITEMIDLIST *ppidlLast)
Definition: pidl.c:1288
HRESULT ShellFolderContextMenu(IShellFolder *shell_folder, HWND hwndParent, int cidl, LPCITEMIDLIST *apidl, int x, int y, CtxMenuInterfaces &cm_ifs)
wrapper class for item ID lists
Definition: shellclasses.h:651
#define SUCCEEDED(hr)
Definition: intsafe.h:57
int Entry::extract_icon ( ICONCACHE_FLAGS  flags = ICF_NORMAL)

Definition at line 365 of file entries.cpp.

Referenced by safe_extract_icon().

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
373  icon_id = g_Globals._icon_cache.extract(path, flags);
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 
392  icon_id = g_Globals._icon_cache.extract(path, idx, flags);
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 }
virtual ShellPath create_absolute_pidl() const
Definition: entries.h:126
virtual HRESULT GetUIObjectOf(HWND hWnd, REFIID riid, LPVOID *ppvOut)
Definition: entries.cpp:581
ICON_ID
Definition: globals.h:62
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
Definition: shtypes.idl:42
virtual bool get_path(PTSTR path, size_t path_count) const =0
#define IID_IExtractIcon
Definition: shlguid.h:120
const Icon & extract(LPCTSTR path, ICONCACHE_FLAGS flags=ICF_NORMAL)
Definition: explorer.cpp:416
unsigned int idx
Definition: utils.c:36
char TCHAR
Definition: xmlstorage.h:189
ENTRY_TYPE _etype
Definition: entries.h:107
#define MAX_PATH
Definition: compat.h:26
GLbitfield flags
Definition: glext.h:7161
ExplorerGlobals g_Globals
Definition: explorer.cpp:52
Definition: services.c:311
#define COUNTOF(x)
Definition: utility.h:93
wrapper class for item ID lists
Definition: shellclasses.h:651
#define SUCCEEDED(hr)
Definition: intsafe.h:57
IconCache _icon_cache
Definition: globals.h:285
virtual Entry* Entry::find_entry ( const void )
inlinevirtual

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

Definition at line 124 of file entries.h.

Referenced by ShellBrowser::jump_to_pidl(), and read_tree().

124 {return NULL;}
smooth NULL
Definition: ftsmooth.c:464
void Entry::free_subentries ( )

Definition at line 743 of file entries.cpp.

Referenced by CollectProgramsThread::free_dirs(), free_subentries(), FileChildWindow::scan_entry(), smart_scan(), ~Entry(), Root::~Root(), and StartMenuDirectory::~StartMenuDirectory().

744 {
745  Entry *entry, *next=_down;
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 }
Entry * _next
Definition: entries.h:92
uint8_t entry
Definition: isohybrid.c:63
Entry * _down
Definition: entries.h:93
static unsigned __int64 next
Definition: rand_nt.c:6
void free_subentries()
Definition: entries.cpp:743
base of all file and directory entries
Definition: entries.h:82
virtual const void* Entry::get_next_path_component ( const void ) const
inlinevirtual

Reimplemented in ShellDirectory, WinDirectory, FATDirectory, and RegDirectory.

Definition at line 123 of file entries.h.

Referenced by ShellBrowser::jump_to_pidl(), and read_tree().

123 {return NULL;}
smooth NULL
Definition: ftsmooth.c:464
bool Entry::get_path_base ( PTSTR  path,
size_t  path_count,
ENTRY_TYPE  etype 
) const
protected

Definition at line 639 of file entries.cpp.

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

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 }
GLint level
Definition: gl.h:1546
#define memmove(s1, s2, n)
Definition: mkisofs.h:881
const CHAR * LPCTSTR
Definition: xmlstorage.h:193
Entry * _up
Definition: entries.h:94
WIN32_FIND_DATA _data
Definition: entries.h:100
uint8_t entry
Definition: isohybrid.c:63
GLuint buffer
Definition: glext.h:5915
virtual bool get_path(PTSTR path, size_t path_count) const =0
size_t __cdecl _tcslen(const _TCHAR *str)
Definition: tcslen.h:9
smooth NULL
Definition: ftsmooth.c:464
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
r l[0]
Definition: byte_order.h:167
char TCHAR
Definition: xmlstorage.h:189
ENTRY_TYPE _etype
Definition: entries.h:107
#define MAX_PATH
Definition: compat.h:26
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLdouble s
Definition: gl.h:2039
GLenum GLsizei len
Definition: glext.h:6722
#define TEXT(s)
Definition: k32.h:26
Definition: services.c:311
Definition: name.c:23
#define COUNTOF(x)
Definition: utility.h:93
base of all file and directory entries
Definition: entries.h:82
ShellFolder Entry::get_shell_folder ( ) const
virtual

Reimplemented in ShellDirectory, and ShellEntry.

Definition at line 237 of file shellfs.cpp.

Referenced by SDIMainFrame::entry_selected(), and MDIShellBrowserChild::entry_selected().

238 {
240 }
virtual ShellPath create_absolute_pidl() const
Definition: entries.h:126
static IShellFolder ShellFolder
Definition: ordinal.c:2754
HRESULT Entry::GetUIObjectOf ( HWND  hWnd,
REFIID  riid,
LPVOID ppvOut 
)
virtual

Reimplemented in ShellEntry.

Definition at line 581 of file entries.cpp.

Referenced by FindProgramDlg::collect_programs_callback(), and extract_icon().

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 }
void Free([in] LPVOID pv)
Entry * _up
Definition: entries.h:94
WIN32_FIND_DATA _data
Definition: entries.h:100
__wchar_t WCHAR
Definition: xmlstorage.h:180
REFIID riid
Definition: precomp.h:44
#define CP_ACP
Definition: compat.h:99
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
Definition: shtypes.idl:42
HWND hWnd
Definition: settings.c:17
IShellFolder smart pointer.
Definition: shellclasses.h:593
virtual bool get_path(PTSTR path, size_t path_count) const =0
#define E_FAIL
Definition: ddrawi.h:102
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:464
char TCHAR
Definition: xmlstorage.h:189
LONG HRESULT
Definition: typedefs.h:78
#define MAX_PATH
Definition: compat.h:26
Definition: services.c:311
#define MultiByteToWideChar
Definition: compat.h:100
#define COUNTOF(x)
Definition: utility.h:93
wrapper class for IMalloc with usage of common allocator
Definition: shellclasses.h:252
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
WCHAR * LPWSTR
Definition: xmlstorage.h:184
wrapper class for item ID lists
Definition: shellclasses.h:651
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.

Referenced by FileChildWindow::activate_entry(), QuickLaunchBar::Command(), and FindProgramDlg::LaunchSelected().

444 {
445  TCHAR cmd[MAX_PATH];
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 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
BOOL launch_file(HWND hwnd, LPCTSTR cmd, UINT nCmdShow, LPCTSTR parameters)
Definition: utility.cpp:189
Definition: ftp_var.h:139
virtual bool get_path(PTSTR path, size_t path_count) const =0
void WINAPI SHAddToRecentDocs(UINT uFlags, LPCVOID pv)
Definition: shellord.c:669
#define SHARD_PATH
Definition: shlobj.h:951
char TCHAR
Definition: xmlstorage.h:189
#define MAX_PATH
Definition: compat.h:26
#define FALSE
Definition: numbers.c:16
#define COUNTOF(x)
Definition: utility.h:93
virtual void Entry::read_directory ( int  scan_flags = 0)
inlinevirtual

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

Definition at line 122 of file entries.h.

Referenced by read_directory_base().

122 {}
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.

Referenced by FileChildWindow::scan_entry(), and smart_scan().

144 {
145  CONTEXT("Entry::read_directory_base()");
146 
147  // call into subclass
148  read_directory(scan_flags);
149 
150 #ifndef ROSSHELL
151  if (g_Globals._prescan_nodes) {
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
uint8_t entry
Definition: isohybrid.c:63
virtual void read_directory(int scan_flags=0)
Definition: entries.h:122
void sort_directory(SORT_ORDER sortOrder)
Definition: entries.cpp:321
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
Entry * _down
Definition: entries.h:93
bool _prescan_nodes
Definition: globals.h:277
ExplorerGlobals g_Globals
Definition: explorer.cpp:52
base of all file and directory entries
Definition: entries.h:82
Entry * Entry::read_tree ( const void path,
SORT_ORDER  sortOrder = SORT_NAME,
int  scan_flags = 0 
)

Definition at line 119 of file entries.cpp.

Referenced by Root::read_tree().

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 }
struct _CONTEXT CONTEXT
uint8_t entry
Definition: isohybrid.c:63
virtual Entry * find_entry(const void *)
Definition: entries.h:124
virtual const void * get_next_path_component(const void *) const
Definition: entries.h:123
GLfloat GLfloat p
Definition: glext.h:8902
base of all file and directory entries
Definition: entries.h:82
int Entry::safe_extract_icon ( ICONCACHE_FLAGS  flags = ICF_NORMAL)

Definition at line 431 of file entries.cpp.

Referenced by ShellBrowser::OnTreeGetDispInfo(), and ShellDirectory::read_directory().

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:113
int extract_icon(ICONCACHE_FLAGS flags=ICF_NORMAL)
Definition: entries.cpp:365
GLbitfield flags
Definition: glext.h:7161
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.

Referenced by StartMenu::AddEntries(), RecentStartMenu::AddEntries(), QuickLaunchBar::AddShortcuts(), CollectProgramsThread::collect_programs(), BookmarkList::import_IE_favorites(), ShellBrowser::InsertSubitems(), ShellBrowser::jump_to(), ShellBrowser::jump_to_pidl(), ShellBrowser::OnDefaultCommand(), and Root::read_tree().

354 {
355  CONTEXT("Entry::smart_scan()");
356 
357  if (!_scanned) {
358  free_subentries();
359  read_directory_base(sortOrder, scan_flags);
360  }
361 }
struct _CONTEXT CONTEXT
void read_directory_base(SORT_ORDER sortOrder=SORT_NAME, int scan_flags=0)
Definition: entries.cpp:143
void free_subentries()
Definition: entries.cpp:743
bool _scanned
Definition: entries.h:97
void Entry::sort_directory ( SORT_ORDER  sortOrder)

Definition at line 321 of file entries.cpp.

Referenced by RecentStartMenu::AddEntries(), and read_directory_base().

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 }
Entry * _next
Definition: entries.h:92
uint8_t entry
Definition: isohybrid.c:63
#define alloca
Definition: malloc.h:361
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 *))
GLenum GLclampf GLint GLenum GLuint GLenum GLenum GLsizei GLenum const GLvoid GLfloat GLfloat GLfloat GLfloat GLclampd GLint GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean GLboolean GLboolean GLboolean GLint GLenum GLsizei const GLvoid GLenum GLint GLenum GLint GLint GLsizei GLint GLenum GLint GLint GLint GLint GLsizei GLenum GLsizei const GLuint GLboolean GLenum GLenum GLint GLsizei GLenum GLsizei GLenum const GLvoid GLboolean const GLboolean GLenum array
Definition: glfuncs.h:84
Entry * _down
Definition: entries.h:93
GLenum GLsizei len
Definition: glext.h:6722
static int(* sortFunctions[])(const void *arg1, const void *arg2)
Definition: entries.cpp:312
GLfloat GLfloat p
Definition: glext.h:8902
base of all file and directory entries
Definition: entries.h:82

Member Data Documentation

LPTSTR Entry::_content
int Entry::_icon_id

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