ReactOS  0.4.13-dev-100-gc8611ae
entries.cpp
Go to the documentation of this file.
1 /*
2  * Copyright 2003, 2004, 2005 Martin Fuchs
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17  */
18 
19 
20  //
21  // Explorer clone
22  //
23  // entries.cpp
24  //
25  // Martin Fuchs, 23.07.2003
26  //
27 
28 
29 #include <precomp.h>
30 
31 //#include "entries.h"
32 
33 
34  // allocate and initialise a directory entry
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 }
50 
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 }
67 
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 }
95 
96  // free a directory entry
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 }
116 
117 
118  // read directory tree and expand to the given location
119 Entry* Entry::read_tree(const void* path, SORT_ORDER sortOrder, int scan_flags)
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 }
141 
142 
143 void Entry::read_directory_base(SORT_ORDER sortOrder, int scan_flags)
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 }
162 
163 
165 {
166  memset(this, 0, sizeof(Root));
167 }
168 
170 {
171  if (_entry) {
173  delete _entry;
174  }
175 }
176 
177 
178  // sort order for different directory/file types
186 };
187 
188  // distinguish between ".", ".." and any other directory names
190 {
191  if (name[0] == '.') {
192  if (name[1] == '\0')
193  return TO_DOT; // "."
194 
195  if (name[1]=='.' && name[2]=='\0')
196  return TO_DOTDOT; // ".."
197  }
198 
199  return TO_OTHER_DIR; // any other directory
200 }
201 
202  // directories first...
203 static int compareType(const Entry* entry1, const Entry* entry2)
204 {
205  const WIN32_FIND_DATA* fd1 = &entry1->_data;
206  const WIN32_FIND_DATA* fd2 = &entry2->_data;
207 
208  TYPE_ORDER order1 = fd1->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY? TO_DIR: TO_FILE;
209  TYPE_ORDER order2 = fd2->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY? TO_DIR: TO_FILE;
210 
211  // Handle "." and ".." as special case and move them at the very first beginning.
212  if (order1==TO_DIR && order2==TO_DIR) {
213  order1 = TypeOrderFromDirname(fd1->cFileName);
214  order2 = TypeOrderFromDirname(fd2->cFileName);
215 
216  // Move virtual folders after physical folders
217  if (!(entry1->_shell_attribs & SFGAO_FILESYSTEM))
218  order1 = TO_VIRTUAL_FOLDER;
219 
220  if (!(entry2->_shell_attribs & SFGAO_FILESYSTEM))
221  order2 = TO_VIRTUAL_FOLDER;
222  }
223 
224  return order2==order1? 0: order1<order2? -1: 1;
225 }
226 
227 
228 static int compareNothing(const void* arg1, const void* arg2)
229 {
230  return -1;
231 }
232 
233 static int compareName(const void* arg1, const void* arg2)
234 {
235  const Entry* entry1 = *(const Entry**)arg1;
236  const Entry* entry2 = *(const Entry**)arg2;
237 
238  int cmp = compareType(entry1, entry2);
239  if (cmp)
240  return cmp;
241 
242  return lstrcmpi(entry1->_data.cFileName, entry2->_data.cFileName);
243 }
244 
245 static int compareExt(const void* arg1, const void* arg2)
246 {
247  const Entry* entry1 = *(const Entry**)arg1;
248  const Entry* entry2 = *(const Entry**)arg2;
249  const TCHAR *name1, *name2, *ext1, *ext2;
250 
251  int cmp = compareType(entry1, entry2);
252  if (cmp)
253  return cmp;
254 
255  name1 = entry1->_data.cFileName;
256  name2 = entry2->_data.cFileName;
257 
258  ext1 = _tcsrchr(name1, TEXT('.'));
259  ext2 = _tcsrchr(name2, TEXT('.'));
260 
261  if (ext1)
262  ++ext1;
263  else
264  ext1 = TEXT("");
265 
266  if (ext2)
267  ++ext2;
268  else
269  ext2 = TEXT("");
270 
271  cmp = lstrcmpi(ext1, ext2);
272  if (cmp)
273  return cmp;
274 
275  return lstrcmpi(name1, name2);
276 }
277 
278 static int compareSize(const void* arg1, const void* arg2)
279 {
280  const Entry* entry1 = *(const Entry**)arg1;
281  const Entry* entry2 = *(const Entry**)arg2;
282 
283  int cmp = compareType(entry1, entry2);
284  if (cmp)
285  return cmp;
286 
287  cmp = entry2->_data.nFileSizeHigh - entry1->_data.nFileSizeHigh;
288 
289  if (cmp < 0)
290  return -1;
291  else if (cmp > 0)
292  return 1;
293 
294  cmp = entry2->_data.nFileSizeLow - entry1->_data.nFileSizeLow;
295 
296  return cmp<0? -1: cmp>0? 1: 0;
297 }
298 
299 static int compareDate(const void* arg1, const void* arg2)
300 {
301  const Entry* entry1 = *(const Entry**)arg1;
302  const Entry* entry2 = *(const Entry**)arg2;
303 
304  int cmp = compareType(entry1, entry2);
305  if (cmp)
306  return cmp;
307 
308  return CompareFileTime(&entry2->_data.ftLastWriteTime, &entry1->_data.ftLastWriteTime);
309 }
310 
311 
312 static int (*sortFunctions[])(const void* arg1, const void* arg2) = {
313  compareNothing, // SORT_NONE
314  compareName, // SORT_NAME
315  compareExt, // SORT_EXT
316  compareSize, // SORT_SIZE
317  compareDate // SORT_DATE
318 };
319 
320 
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 }
351 
352 
353 void Entry::smart_scan(SORT_ORDER sortOrder, int scan_flags)
354 {
355  CONTEXT("Entry::smart_scan()");
356 
357  if (!_scanned) {
358  free_subentries();
359  read_directory_base(sortOrder, scan_flags);
360  }
361 }
362 
363 
364 
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 }
430 
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 }
441 
442 
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 }
456 
457 
458  // local replacement implementation for SHBindToParent()
459  // (derived from http://www.geocities.com/SiliconValley/2060/articles/shell-helpers.html)
461 {
462  HRESULT hr;
463 
464  if (!ppv)
465  return E_POINTER;
466 
467  // There must be at least one item ID.
468  if (!pidl || !pidl->mkid.cb)
469  return E_INVALIDARG;
470 
471  // Get the desktop folder as root.
472  ShellFolder desktop;
473 /* IShellFolderPtr desktop;
474  hr = SHGetDesktopFolder(&desktop);
475  if (FAILED(hr))
476  return hr; */
477 
478  // Walk to the penultimate item ID.
479  LPCITEMIDLIST marker = pidl;
480  for (;;)
481  {
482  LPCITEMIDLIST next = reinterpret_cast<LPCITEMIDLIST>(
483  marker->mkid.abID - sizeof(marker->mkid.cb) + marker->mkid.cb);
484  if (!next->mkid.cb)
485  break;
486  marker = next;
487  }
488 
489  if (marker == pidl)
490  {
491  // There was only a single item ID, so bind to the root folder.
492  hr = desktop->QueryInterface(riid, ppv);
493  }
494  else
495  {
496  // Copy the ID list, truncating the last item.
497  int length = marker->mkid.abID - pidl->mkid.abID;
498  if (LPITEMIDLIST parent_id = reinterpret_cast<LPITEMIDLIST>(
499  malloc(length + sizeof(pidl->mkid.cb))))
500  {
501  LPBYTE raw_data = reinterpret_cast<LPBYTE>(parent_id);
502  memcpy(raw_data, pidl, length);
503  memset(raw_data + length, 0, sizeof(pidl->mkid.cb));
504  hr = desktop->BindToObject(parent_id, 0, riid, ppv);
505  free(parent_id);
506  }
507  else
508  return E_OUTOFMEMORY;
509  }
510 
511  // Return a pointer to the last item ID.
512  if (ppidlLast)
513  *ppidlLast = marker;
514 
515  return hr;
516 }
517 #define USE_MY_SHBINDTOPARENT
518 
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 }
579 
580 
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 }
636 
637 
638  // get full path of specified directory entry
639 bool Entry::get_path_base ( PTSTR path, size_t path_count, ENTRY_TYPE etype ) const
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 }
741 
742  // recursively free all child entries
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 }
759 
760 
762 {
763  Entry* entry;
764 
765  if (path && *path)
767  else {
769 
770  _entry->smart_scan();
771 
772  if (_entry->_down)
773  _entry->_expanded = true;
774  }
775 
776  return entry;
777 }
778 
779 
780 Entry* Root::read_tree(LPCITEMIDLIST pidl, int scan_flags)
781 {
782  return _entry->read_tree(pidl, _sort_order);
783 }
Entry * _entry
Definition: entries.h:152
virtual ShellPath create_absolute_pidl() const
Definition: entries.h:126
#define HRESULT
Definition: msvc.h:9
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
Entry * _next
Definition: entries.h:92
GLint level
Definition: gl.h:1546
#define memmove(s1, s2, n)
Definition: mkisofs.h:881
struct _CONTEXT CONTEXT
#define REFIID
Definition: guiddef.h:113
const CHAR * LPCTSTR
Definition: xmlstorage.h:193
BOOL launch_file(HWND hwnd, LPCTSTR cmd, UINT nCmdShow, LPCTSTR parameters)
Definition: utility.cpp:189
void read_directory_base(SORT_ORDER sortOrder=SORT_NAME, int scan_flags=0)
Definition: entries.cpp:143
#define lstrcmpi
Definition: winbase.h:3687
ENTRY_TYPE
Definition: entries.h:29
HRESULT hr
Definition: shlfolder.c:183
void Free([in] LPVOID pv)
Entry * _up
Definition: entries.h:94
virtual HRESULT GetUIObjectOf(HWND hWnd, REFIID riid, LPVOID *ppvOut)
Definition: entries.cpp:581
WIN32_FIND_DATA _data
Definition: entries.h:100
static int compareDate(const void *arg1, const void *arg2)
Definition: entries.cpp:299
Definition: ftp_var.h:139
REFIID riid
Definition: precomp.h:44
ICON_ID
Definition: globals.h:62
#define CP_ACP
Definition: compat.h:99
int other
Definition: msacm.c:1364
BY_HANDLE_FILE_INFORMATION _bhfi
Definition: entries.h:110
#define free
Definition: debug_ros.c:5
TYPE_ORDER
Definition: entries.cpp:179
uint8_t entry
Definition: isohybrid.c:63
static int compareType(const Entry *entry1, const Entry *entry2)
Definition: entries.cpp:203
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
Definition: shtypes.idl:42
HWND hWnd
Definition: settings.c:17
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define assert(x)
Definition: debug.h:53
GLuint buffer
Definition: glext.h:5915
#define _tcsdup
Definition: tchar.h:625
IShellFolder smart pointer.
Definition: shellclasses.h:593
virtual bool get_path(PTSTR path, size_t path_count) const =0
#define cmp(status, error)
Definition: error.c:114
virtual HRESULT do_context_menu(HWND hwnd, const POINT &pos, CtxMenuInterfaces &cm_ifs)
Definition: entries.cpp:519
Entry * read_tree(LPCTSTR path, int scan_flags=0)
Definition: entries.cpp:761
static WCHAR name1[]
Definition: record.c:34
#define E_FAIL
Definition: ddrawi.h:102
static int compareName(const void *arg1, const void *arg2)
Definition: entries.cpp:233
int _icon_id
Definition: entries.h:108
#define IID_IExtractIcon
Definition: shlguid.h:129
#define alloca
Definition: malloc.h:361
bool _expanded
Definition: entries.h:96
SORT_ORDER _sort_order
Definition: entries.h:158
Exception with context information.
Definition: shellclasses.h:113
GLuint GLuint GLuint GLuint GLuint GLuint GLuint arg2
Definition: glext.h:9514
const Icon & extract(LPCTSTR path, ICONCACHE_FLAGS flags=ICF_NORMAL)
Definition: explorer.cpp:416
int extract_icon(ICONCACHE_FLAGS flags=ICF_NORMAL)
Definition: entries.cpp:365
void free_icon(int icon_id)
Definition: explorer.cpp:650
unsigned char * LPBYTE
Definition: typedefs.h:52
void WINAPI SHAddToRecentDocs(UINT uFlags, LPCVOID pv)
Definition: shellord.c:669
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
unsigned int BOOL
Definition: ntddk_ex.h:94
bool _bhfi_valid
Definition: entries.h:111
virtual void read_directory(int scan_flags=0)
Definition: entries.h:122
GLuint GLuint GLuint GLuint arg1
Definition: glext.h:9513
static DWORD parent_id
Definition: cursoricon.c:2153
virtual ~Entry()
Definition: entries.cpp:97
Entry(ENTRY_TYPE etype)
Definition: entries.cpp:35
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 *))
unsigned int idx
Definition: utils.c:41
ULONG Release()
#define S_FALSE
Definition: winerror.h:2357
#define SHARD_PATH
Definition: shlobj.h:1095
#define E_INVALIDARG
Definition: ddrawi.h:101
LPTSTR _content
Definition: entries.h:105
size_t __cdecl _tcslen(const _TCHAR *str)
Definition: tcslen.h:9
smooth NULL
Definition: ftsmooth.c:416
static HRESULT my_SHBindToParent(LPCITEMIDLIST pidl, REFIID riid, VOID **ppv, LPCITEMIDLIST *ppidlLast)
Definition: entries.cpp:460
Entry entry
Definition: winefile.c:89
int marker
Definition: jpeglib.h:1027
void sort_directory(SORT_ORDER sortOrder)
Definition: entries.cpp:321
SORT_ORDER
Definition: entries.h:44
CHAR * PTSTR
Definition: xmlstorage.h:191
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
r l[0]
Definition: byte_order.h:167
char TCHAR
Definition: xmlstorage.h:189
root entry for file system trees
Definition: entries.h:148
int safe_extract_icon(ICONCACHE_FLAGS flags=ICF_NORMAL)
Definition: entries.cpp:431
LONG WINAPI CompareFileTime(IN CONST FILETIME *lpFileTime1, IN CONST FILETIME *lpFileTime2)
Definition: time.c:106
ENTRY_TYPE _etype
Definition: entries.h:107
r parent
Definition: btrfs.c:2659
void smart_scan(SORT_ORDER sortOrder=SORT_NAME, int scan_flags=0)
Definition: entries.cpp:353
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
Entry * read_tree(const void *path, SORT_ORDER sortOrder=SORT_NAME, int scan_flags=0)
Definition: entries.cpp:119
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
Entry * _down
Definition: entries.h:93
#define MAX_PATH
Definition: compat.h:26
#define WINAPI
Definition: msvc.h:8
static const BYTE ext1[]
Definition: encode.c:2697
static int compareNothing(const void *arg1, const void *arg2)
Definition: entries.cpp:228
Root()
Definition: entries.cpp:164
bool _prescan_nodes
Definition: globals.h:277
nsrefcnt Release()
~Root()
Definition: entries.cpp:169
HRESULT QueryInterface(REFIID riid, I *p)
Definition: shellclasses.h:417
GLbitfield flags
Definition: glext.h:7161
static const BYTE ext2[]
Definition: encode.c:2699
static int compareExt(const void *arg1, const void *arg2)
Definition: entries.cpp:245
SFGAOF _shell_attribs
Definition: entries.h:102
ICONCACHE_FLAGS
Definition: entries.h:66
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722
ExplorerGlobals g_Globals
Definition: explorer.cpp:52
GLdouble s
Definition: gl.h:2039
int _level
Definition: entries.h:98
ShellFolder & GetDesktopFolder()
virtual BOOL launch_entry(HWND hwnd, UINT nCmdShow=SW_SHOWNORMAL)
Definition: entries.cpp:443
LPTSTR _type_name
Definition: entries.h:104
#define TEXT(s)
Definition: k32.h:26
static unsigned __int64 next
Definition: rand_nt.c:6
bool get_path_base(PTSTR path, size_t path_count, ENTRY_TYPE etype) const
Definition: entries.cpp:639
static int(* sortFunctions[])(const void *arg1, const void *arg2)
Definition: entries.cpp:312
HRESULT WINAPI SHBindToParent(LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppv, LPCITEMIDLIST *ppidlLast)
Definition: pidl.c:1323
Definition: services.c:325
static int compareSize(const void *arg1, const void *arg2)
Definition: entries.cpp:278
void free_subentries()
Definition: entries.cpp:743
unsigned int UINT
Definition: ndis.h:50
#define MultiByteToWideChar
Definition: compat.h:100
bool _scanned
Definition: entries.h:97
Definition: name.c:36
static TYPE_ORDER TypeOrderFromDirname(LPCTSTR name)
Definition: entries.cpp:189
_TCHAR * _tcsrchr(const _TCHAR *s, _XINT c)
Definition: tcsrchr.h:4
static WCHAR name2[]
Definition: record.c:35
#define malloc
Definition: debug_ros.c:4
#define COUNTOF(x)
Definition: utility.h:93
GLfloat GLfloat p
Definition: glext.h:8902
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define E_POINTER
Definition: winerror.h:2365
wrapper class for IMalloc with usage of common allocator
Definition: shellclasses.h:252
#define memset(x, y, z)
Definition: compat.h:39
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
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
base of all file and directory entries
Definition: entries.h:82
#define SUCCEEDED(hr)
Definition: intsafe.h:57
GLsizei GLenum const GLvoid GLsizei GLenum 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 const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint GLenum GLenum GLenum GLint GLuint GLenum GLenum GLfloat GLenum GLfloat GLenum GLint const GLfloat GLenum GLint const GLushort GLint GLint GLsizei GLsizei GLenum GLsizei GLsizei GLenum GLenum const GLvoid GLenum GLdouble GLenum GLint GLenum GLenum GLint GLenum GLenum GLfloat GLenum GLenum GLfloat GLenum GLfloat GLenum GLushort const GLubyte GLenum GLenum GLenum GLint GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLvoid GLenum GLenum GLint GLenum GLint GLenum GLint GLuint GLdouble GLdouble GLdouble GLdouble GLdouble GLdouble const GLfloat GLenum const GLdouble GLdouble GLdouble GLdouble GLdouble GLdouble GLdouble GLdouble GLdouble GLdouble GLdouble GLint GLint GLsizei GLsizei GLenum GLuint GLenum array
Definition: glfuncs.h:320
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
IconCache _icon_cache
Definition: globals.h:285
LPTSTR _display_name
Definition: entries.h:103