ReactOS  0.4.14-dev-608-gd495a4f
explorer.cpp
Go to the documentation of this file.
1 /*
2  * Copyright 2003, 2004, 2005, 2006 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  // explorer.cpp
24  //
25  // Martin Fuchs, 23.07.2003
26  //
27  // Credits: Thanks to Leon Finker for his explorer cabinet window example
28  //
29 
30 
31 #include <precomp.h> // <precomp.h> instead of "precomp.h" because the ROS build system needs this to find the precompiled header file (*.gch) in the output directory tree
32 
33 #include <shlwapi.h>
34 #include <locale.h> // for setlocale()
35 
36 #ifndef __WINE__
37 #include <io.h> // for dup2()
38 #include <fcntl.h> // for _O_RDONLY
39 #endif
40 
41 //#include "dialogs/settings.h" // for MdiSdiDlg
42 
43 #include "services/shellservices.h"
44 
45 
46 extern "C" int initialize_gdb_stub(); // start up GDB stub
47 
48 
49 DynamicLoadLibFct<void(__stdcall*)(BOOL)> g_SHDOCVW_ShellDDEInit(TEXT("SHDOCVW"), 118);
50 
51 
53 boolean SelectOpt=FALSE;
54 
55 
57 {
58  _hInstance = 0;
59  _cfStrFName = 0;
60 
61 #ifndef ROSSHELL
62  _hframeClass = 0;
63  _hMainWnd = 0;
64  _desktop_mode = false;
65  _prescan_nodes = false;
66 #endif
67 
68  _log = NULL;
69  _SHRestricted = 0;
70  _hwndDesktopBar = 0;
71  _hwndShellView = 0;
72  _hwndDesktop = 0;
73 }
74 
75 
77 {
79  _SHRestricted = (DWORD(STDAPICALLTYPE*)(RESTRICTIONS)) GetProcAddress(GetModuleHandle(TEXT("SHELL32")), "SHRestricted");
80  _icon_cache.init();
81 }
82 
83 
85 {
86  // read configuration file
87  _cfg_dir.printf(TEXT("%s\\ReactOS"), (LPCTSTR)SpecialFolderFSPath(CSIDL_APPDATA,0));
88  _cfg_path.printf(TEXT("%s\\ros-explorer-cfg.xml"), _cfg_dir.c_str());
89 
90  if (!_cfg.read_file(_cfg_path)) {
91  if (!_cfg._errors.empty()) {
93  _cfg._errors.str(),
94  TEXT("ROS Explorer - reading user settings"),
95  MB_OK);
96  }
97  _cfg.read_file(TEXT("explorer-cfg-template.xml"));
98  }
99 
100  // read bookmarks
101  _favorites_path.printf(TEXT("%s\\ros-explorer-bookmarks.xml"), _cfg_dir.c_str());
102 
106  }
107 }
108 
110 {
111  // write configuration file
113 
116 }
117 
118 
120 {
121  XMLPos cfg_pos(&_cfg);
122 
123  cfg_pos.smart_create("explorer-cfg");
124 
125  return cfg_pos;
126 }
127 
129 {
130  XMLPos cfg_pos(&_cfg);
131 
132  cfg_pos.smart_create("explorer-cfg");
133  cfg_pos.create_relative(path);
134 
135  return cfg_pos;
136 }
137 
138 
139 void _log_(LPCTSTR txt)
140 {
141  FmtString msg(TEXT("%s\n"), txt);
142 
143  if (g_Globals._log)
145 
147 }
148 
149 
151 {
152  static const LPCTSTR s_executable_extensions[] = {
153  TEXT("COM"),
154  TEXT("EXE"),
155  TEXT("BAT"),
156  TEXT("CMD"),
157  TEXT("CMM"),
158  TEXT("BTM"),
159  TEXT("AWK"),
160  0
161  };
162 
163  TCHAR ext_buffer[_MAX_EXT];
164  const LPCTSTR* p;
165  LPCTSTR s;
166  LPTSTR d;
167 
168  for(s=ext+1,d=ext_buffer; (*d=toupper(*s)); s++)
169  ++d;
170 
171  for(p=s_executable_extensions; *p; p++)
172  if (!lstrcmp(ext_buffer, *p))
173  return true;
174 
175  return false;
176 }
177 
178 
180 {
181  ext.toLower();
182 
183  iterator found = find(ext);
184  if (found != end())
185  return found->second;
186 
187  FileTypeInfo& ftype = super::operator[](ext);
188 
189  ftype._neverShowExt = false;
190 
191  HKEY hkey;
192  TCHAR value[MAX_PATH], display_name[MAX_PATH];
193  LONG valuelen = sizeof(value);
194 
195  if (!RegQueryValue(HKEY_CLASSES_ROOT, ext, value, &valuelen)) {
196  ftype._classname = value;
197 
198  valuelen = sizeof(display_name);
199  if (!RegQueryValue(HKEY_CLASSES_ROOT, ftype._classname, display_name, &valuelen))
200  ftype._displayname = display_name;
201 
202  if (!RegOpenKey(HKEY_CLASSES_ROOT, ftype._classname, &hkey)) {
203  if (!RegQueryValueEx(hkey, TEXT("NeverShowExt"), 0, NULL, NULL, NULL))
204  ftype._neverShowExt = true;
205 
206  RegCloseKey(hkey);
207  }
208  }
209 
210  return ftype;
211 }
212 
214 {
215  LPCTSTR ext = _tcsrchr(entry->_data.cFileName, TEXT('.'));
216 
217  if (ext) {
218  const FileTypeInfo& type = (*this)[ext];
219 
220  if (!type._displayname.empty())
221  entry->_type_name = _tcsdup(type._displayname);
222 
223  // hide some file extensions
224  if (type._neverShowExt && !dont_hide_ext) {
225  int len = ext - entry->_data.cFileName;
226 
227  if (entry->_display_name != entry->_data.cFileName)
228  free(entry->_display_name);
229 
230  entry->_display_name = (LPTSTR) malloc((len+1)*sizeof(TCHAR));
231  lstrcpyn(entry->_display_name, entry->_data.cFileName, len + 1);
232  }
233 
234  if (is_exe_file(ext))
235  entry->_data.dwFileAttributes |= ATTRIBUTE_EXECUTABLE;
236  }
237 
238  return ext;
239 }
240 
241 
243  : _id(ICID_UNKNOWN),
244  _itype(IT_STATIC),
245  _hicon(0)
246 {
247 }
248 
249 Icon::Icon(ICON_ID id, UINT nid) //, int cx, int cy
250  : _id(id),
251  _itype(IT_STATIC),
252  _hicon(ResIcon(nid)) // ResIconEx(nid, cx, cy)
253 {
254 }
255 
257  : _id(id),
258  _itype(IT_STATIC),
259  _hicon(ResIconEx(nid, icon_size, icon_size))
260 {
261 }
262 
264  : _id((ICON_ID)id),
265  _itype(itype),
266  _hicon(hIcon)
267 {
268 }
269 
270 Icon::Icon(ICON_TYPE itype, int id, int sys_idx)
271  : _id((ICON_ID)id),
272  _itype(itype),
273  _sys_idx(sys_idx)
274 {
275 }
276 
277 void Icon::draw(HDC hdc, int x, int y, int cx, int cy, COLORREF bk_color, HBRUSH bk_brush) const
278 {
279  if (_itype == IT_SYSCACHE)
281  else
283 }
284 
285 HBITMAP Icon::create_bitmap(COLORREF bk_color, HBRUSH hbrBkgnd, HDC hdc_wnd) const
286 {
287  if (_itype == IT_SYSCACHE) {
289 
290  int cx, cy;
292 
293  HBITMAP hbmp = CreateCompatibleBitmap(hdc_wnd, cx, cy);
294  HDC hdc = CreateCompatibleDC(hdc_wnd);
295  HBITMAP hbmp_old = SelectBitmap(hdc, hbmp);
297  SelectBitmap(hdc, hbmp_old);
298  DeleteDC(hdc);
299 
300  return hbmp;
301  } else
302  return create_bitmap_from_icon(_hicon, hbrBkgnd, hdc_wnd);
303 }
304 
305 
307 {
308  int ret;
309 
310  if (_itype == IT_SYSCACHE) {
312 
313  int cx, cy;
315 
316  HBITMAP hbmp = CreateCompatibleBitmap(hdc_wnd, cx, cy);
317  HDC hdc = CreateCompatibleDC(hdc_wnd);
318  HBITMAP hbmp_old = SelectBitmap(hdc, hbmp);
320  SelectBitmap(hdc, hbmp_old);
321  DeleteDC(hdc);
322 
323  ret = ImageList_Add(himl, hbmp, 0);
324 
326  } else
328 
329  return ret;
330 }
331 
332 HBITMAP create_bitmap_from_icon(HICON hIcon, HBRUSH hbrush_bkgnd, HDC hdc_wnd/*, int icon_size*/)
333 {
334  int cx = ICON_SIZE_SMALL;
335  int cy = ICON_SIZE_SMALL;
336  HBITMAP hbmp = CreateCompatibleBitmap(hdc_wnd, cx, cy);
337 
338  MemCanvas canvas;
339  BitmapSelection sel(canvas, hbmp);
340 
341  RECT rect = {0, 0, cx, cy};
342  FillRect(canvas, &rect, hbrush_bkgnd);
343 
344  DrawIconEx(canvas, 0, 0, hIcon, cx, cy, 0, hbrush_bkgnd, DI_NORMAL);
345 
346  return hbmp;
347 }
348 
349 HBITMAP create_small_bitmap_from_icon(HICON hIcon, HBRUSH hbrush_bkgnd, HDC hdc_wnd)
350 {
353  HBITMAP hbmp = CreateCompatibleBitmap(hdc_wnd, cx, cy);
354 
355  MemCanvas canvas;
356  BitmapSelection sel(canvas, hbmp);
357 
358  RECT rect = {0, 0, cx, cy};
359  FillRect(canvas, &rect, hbrush_bkgnd);
360 
361  DrawIconEx(canvas, 0, 0, hIcon, cx, cy, 0, hbrush_bkgnd, DI_NORMAL);
362 
363  return hbmp;
364 }
365 
366 int ImageList_AddAlphaIcon(HIMAGELIST himl, HICON hIcon, HBRUSH hbrush_bkgnd, HDC hdc_wnd)
367 {
368  HBITMAP hbmp = create_bitmap_from_icon(hIcon, hbrush_bkgnd, hdc_wnd);
369 
370  int ret = ImageList_Add(himl, hbmp, 0);
371 
373 
374  return ret;
375 }
376 
377 
379 
380 
382 {
384 
386 
388  //_icons[ICID_DOCUMENT] = Icon(ICID_DOCUMENT, IDI_DOCUMENT);
390  //_icons[ICID_APP] = Icon(ICID_APP, IDI_APPICON);
391 
413 }
414 
415 
417 {
418  // search for matching icon with unchanged flags in the cache
419  CacheKey mapkey(path, flags);
420  PathCacheMap::iterator found = _pathCache.find(mapkey);
421 
422  if (found != _pathCache.end())
423  return _icons[found->second];
424 
425  // search for matching icon with handle
426  CacheKey mapkey_hicon(path, flags|ICF_HICON);
427  if (flags != mapkey_hicon.second) {
428  found = _pathCache.find(mapkey_hicon);
429 
430  if (found != _pathCache.end())
431  return _icons[found->second];
432  }
433 
434  // search for matching icon in the system image list cache
435  CacheKey mapkey_syscache(path, flags|ICF_SYSCACHE);
436  if (flags != mapkey_syscache.second) {
437  found = _pathCache.find(mapkey_syscache);
438 
439  if (found != _pathCache.end())
440  return _icons[found->second];
441  }
442 
443  SHFILEINFO sfi;
444 
445  int shgfi_flags = 0;
446 
447  if (flags & ICF_OPEN)
448  shgfi_flags |= SHGFI_OPENICON;
449 
451  shgfi_flags |= SHGFI_ICON;
452 
453  if (!(flags & (ICF_LARGE|ICF_MIDDLE)))
454  shgfi_flags |= SHGFI_SMALLICON;
455 
456  if (flags & ICF_OVERLAYS)
457  shgfi_flags |= SHGFI_ADDOVERLAYS;
458 
459  // get small/big icons with/without overlays
460  if (SHGetFileInfo(path, 0, &sfi, sizeof(sfi), shgfi_flags)) {
461  const Icon& icon = add(sfi.hIcon, IT_CACHED);
462 
464  _pathCache[mapkey_hicon] = icon;
465 
466  return icon;
467  }
468  } else {
470 
471  shgfi_flags |= SHGFI_SYSICONINDEX|SHGFI_SMALLICON;
472 
473  // use system image list - the "search program dialog" needs it
474  HIMAGELIST himlSys_small = (HIMAGELIST) SHGetFileInfo(path, 0, &sfi, sizeof(sfi), shgfi_flags);
475 
476  if (himlSys_small) {
477  _himlSys_small = himlSys_small;
478 
479  const Icon& icon = add(sfi.iIcon/*, IT_SYSCACHE*/);
480 
482  _pathCache[mapkey_syscache] = icon;
483 
484  return icon;
485  }
486  }
487 
488  return _icons[ICID_NONE];
489 }
490 
492 {
494 
495  key.first.toLower();
496 
497  IdxCacheMap::iterator found = _idxCache.find(key);
498 
499  if (found != _idxCache.end())
500  return _icons[found->second];
501 
502  HICON hIcon;
503 
504  if ((int)ExtractIconEx(path, icon_idx, NULL, &hIcon, 1) > 0) {
505  const Icon& icon = add(hIcon, IT_CACHED);
506 
507  _idxCache[key] = icon;
508 
509  return icon;
510  } else {
511 
513 
514  return _icons[ICID_NONE];
515  }
516 }
517 
518 const Icon& IconCache::extract(IExtractIcon* pExtract, LPCTSTR path, int icon_idx, ICONCACHE_FLAGS flags)
519 {
520  HICON hIconLarge = 0;
521  HICON hIcon;
522 
524  HRESULT hr = pExtract->Extract(path, icon_idx, &hIconLarge, &hIcon, MAKELONG(GetSystemMetrics(SM_CXICON), icon_size));
525 
526  if (hr == NOERROR) { //@@ oder SUCCEEDED(hr) ?
527  if (icon_size > ICON_SIZE_SMALL) { //@@ OK?
528  if (hIcon)
530 
531  hIcon = hIconLarge;
532  } else {
533  if (hIconLarge)
534  DestroyIcon(hIconLarge);
535  }
536 
537  if (hIcon)
538  return add(hIcon); //@@ When do we want not to free this icons?
539  }
540 
541  return _icons[ICID_NONE];
542 }
543 
545 {
546  // search for matching icon with unchanged flags in the cache
547  PidlCacheKey mapkey(pidl, flags);
548  PidlCacheMap::iterator found = _pidlcache.find(mapkey);
549 
550  if (found != _pidlcache.end())
551  return _icons[found->second];
552 
553  // search for matching icon with handle
554  PidlCacheKey mapkey_hicon(pidl, flags|ICF_HICON);
555  if (flags != mapkey_hicon.second) {
556  found = _pidlcache.find(mapkey_hicon);
557 
558  if (found != _pidlcache.end())
559  return _icons[found->second];
560  }
561 
562  // search for matching icon in the system image list cache
563  PidlCacheKey mapkey_syscache(pidl, flags|ICF_SYSCACHE);
564  if (flags != mapkey_syscache.second) {
565  found = _pidlcache.find(mapkey_syscache);
566 
567  if (found != _pidlcache.end())
568  return _icons[found->second];
569  }
570 
571  SHFILEINFO sfi;
572 
573  int shgfi_flags = SHGFI_PIDL;
574 
575  if (!(flags & (ICF_LARGE|ICF_MIDDLE)))
576  shgfi_flags |= SHGFI_SMALLICON;
577 
578  if (flags & ICF_OPEN)
579  shgfi_flags |= SHGFI_OPENICON;
580 
581  if (flags & ICF_SYSCACHE) {
583 
584  HIMAGELIST himlSys = (HIMAGELIST) SHGetFileInfo((LPCTSTR)pidl, 0, &sfi, sizeof(sfi), SHGFI_SYSICONINDEX|shgfi_flags);
585  if (himlSys) {
586  const Icon& icon = add(sfi.iIcon/*, IT_SYSCACHE*/);
587 
589  _pidlcache[mapkey_syscache] = icon;
590 
591  return icon;
592  }
593  } else {
594  if (flags & ICF_OVERLAYS)
595  shgfi_flags |= SHGFI_ADDOVERLAYS;
596 
597  if (SHGetFileInfo((LPCTSTR)pidl, 0, &sfi, sizeof(sfi), SHGFI_ICON|shgfi_flags)) {
598  const Icon& icon = add(sfi.hIcon, IT_CACHED);
599 
601  _pidlcache[mapkey_hicon] = icon;
602 
603  return icon;
604  }
605  }
606 
607  return _icons[ICID_NONE];
608 }
609 
610 
612 {
613  int id = ++s_next_id;
614 
615  return _icons[id] = Icon(type, id, hIcon);
616 }
617 
618 const Icon& IconCache::add(int sys_idx/*, ICON_TYPE type=IT_SYSCACHE*/)
619 {
620  int id = ++s_next_id;
621 
622  return _icons[id] = SysCacheIcon(id, sys_idx);
623 }
624 
625 const Icon& IconCache::get_icon(int id)
626 {
627  return _icons[id];
628 }
629 
631 {
632 /* We don't need to free cached resources - they are automatically freed at process termination
633  for (int index = s_next_id; index >= 0; index--) {
634  IconMap::iterator found = _icons.find(index);
635 
636  if (found != _icons.end()) {
637  Icon& icon = found->second;
638 
639  if ((icon.get_icontype() == IT_DYNAMIC) ||
640  (icon.get_icontype() == IT_CACHED))
641  {
642  DestroyIcon(icon.get_hicon());
643  _icons.erase(found);
644  }
645  }
646  }
647 */
648 }
649 
650 void IconCache::free_icon(int icon_id)
651 {
652  IconMap::iterator found = _icons.find(icon_id);
653 
654  if (found != _icons.end()) {
655  Icon& icon = found->second;
656 
657  if (icon.destroy())
658  _icons.erase(found);
659  }
660 }
661 
662 
664 {
666 
667  int len = LoadString(g_Globals._hInstance, nid, buffer, sizeof(buffer)/sizeof(TCHAR));
668 
669  super::assign(buffer, len);
670 }
671 
672 
674 {
676 }
677 
679 {
681 }
682 
684 {
686 }
687 
688 
690 {
691  HICON hIcon = ResIcon(nid);
693 
694  HICON hIconSmall = SmallIcon(nid);
695  (void)Window_SetIcon(hwnd, ICON_SMALL, hIconSmall);
696 }
697 
698 
700 {
702 }
703 
704 
705 #ifndef ROSSHELL
706 
707 void explorer_show_frame(int cmdShow, LPTSTR lpCmdLine)
708 {
710 
711  if (g_Globals._hMainWnd) {
714  else
716 
717  return;
718  }
719 
720  g_Globals._prescan_nodes = false;
721 
722  cmd._mdi = true;
723  cmd._cmdShow = cmdShow;
724 
725  // parse command line options, which may overwrite the MDI flag
726  if (lpCmdLine)
727  cmd.ParseCmdLine(lpCmdLine);
728 
729  // create main window
731 }
732 
734 {
735  bool ok = true;
736 
737  LPCTSTR b = lpCmdLine;
738  LPCTSTR p = b;
739 
740  while(*b) {
741  // remove leading space
742  while(_istspace((unsigned)*b))
743  ++b;
744 
745  p = b;
746 
747  bool quote = false;
748 
749  // options are separated by ','
750  for(; *p; ++p) {
751  if (*p == '"') // Quote characters may appear at any position in the command line.
752  quote = !quote;
753  else if (*p==',' && !quote)
754  break;
755  }
756 
757  if (p > b) {
758  int l = p - b;
759 
760  // remove trailing space
761  while(l>0 && _istspace((unsigned)b[l-1]))
762  --l;
763 
764  if (!EvaluateOption(String(b, l)))
765  ok = false;
766 
767  if (*p)
768  ++p;
769 
770  b = p;
771  }
772  }
773 
774  return ok;
775 }
776 
778 {
779  String opt_str;
780 
781  // Remove quote characters, as they are evaluated at this point.
782  for(; *option; ++option)
783  if (*option != '"')
784  opt_str += *option;
785 
786  option = opt_str;
787 
788  if (option[0] == '/') {
789  ++option;
790 
791  // option /e for windows in explorer mode
792  if (!_tcsicmp(option, TEXT("e")))
793  _flags |= OWM_EXPLORE;
794  // option /root for rooted explorer windows
795  else if (!_tcsicmp(option, TEXT("root")))
796  _flags |= OWM_ROOTED;
797  // non-standard options: /mdi, /sdi
798  else if (!_tcsicmp(option, TEXT("mdi")))
799  _mdi = true;
800  else if (!_tcsicmp(option, TEXT("sdi")))
801  _mdi = false;
802  else if (!_tcsicmp(option, TEXT("n")))
803  {
804  // Do nothing
805  }
806  else if (!_tcsicmp(option, TEXT("select")))
807  {
808  SelectOpt = TRUE;
809  }
810  else
811  return false;
812 
813  } else {
814  if (!_path.empty())
815  return false;
816 
817  if((SelectOpt == TRUE) && (PathFileExists(option)))
818  {
819  WCHAR szDir[MAX_PATH];
820 
821  _wsplitpath(option, szPath, szDir, NULL, NULL);
822  wcscat(szPath, szDir);
824  _path = szPath;
825  SelectOpt = FALSE;
826  }
827  else
828  _path = opt_str;
829  }
830 
831  return true;
832 }
833 
835 {
836  if (!_path.empty()) {
838 
840  return true; // file system path
841  else if (*_path==':' && _path.at(1)==':')
842  return true; // text encoded IDL
843  }
844 
845  return false;
846 }
847 
848 #else
849 
850 void explorer_show_frame(int cmdShow, LPTSTR lpCmdLine)
851 {
852  if (!lpCmdLine)
853  lpCmdLine = TEXT("explorer.exe");
854 
855  launch_file(GetDesktopWindow(), lpCmdLine, cmdShow);
856 }
857 
858 #endif
859 
860 
861 PopupMenu::PopupMenu(UINT nid)
862 {
864  _hmenu = GetSubMenu(hMenu, 0);
865  RemoveMenu(hMenu, 0, MF_BYPOSITION);
866  DestroyMenu(hMenu);
867 }
868 
869 
871 struct ExplorerAboutDlg : public
873  OwnerDrawParent<Dialog>
874  >
875 {
876  typedef CtlColorParent<
878  > super;
879 
881  : super(hwnd)
882  {
884 
885  new FlatButton(hwnd, IDOK);
886 
887  _hfont = CreateFont(20, 0, 0, 0, FW_BOLD, TRUE, 0, 0, 0, 0, 0, 0, 0, TEXT("Sans Serif"));
888  new ColorStatic(hwnd, IDC_ROS_EXPLORER, RGB(32,32,128), 0, _hfont);
889 
890  new HyperlinkCtrl(hwnd, IDC_WWW);
891 
894 
895  HWND hwnd_winver = GetDlgItem(hwnd, IDC_WIN_VERSION);
896  SetWindowText(hwnd_winver, get_windows_version_str());
898 
900  }
901 
903  {
905  }
906 
908  {
909  switch(nmsg) {
910  case WM_PAINT:
911  Paint();
912  break;
913 
914  default:
915  return super::WndProc(nmsg, wparam, lparam);
916  }
917 
918  return 0;
919  }
920 
921  void Paint()
922  {
923  PaintCanvas canvas(_hwnd);
924 
926 
927  DrawIconEx(canvas, 20, 10, hicon, 0, 0, 0, 0, DI_NORMAL);
928  }
929 
930 protected:
932 };
933 
935 {
937 }
938 
939 
941 {
942  CONTEXT("InitInstance");
943 
944  setlocale(LC_COLLATE, ""); // set collating rules to local settings for compareName
945 
946 #ifndef ROSSHELL
947  // register frame window class
949 
950  // register child window class
952 
953  // register tree window class
955 #endif
956 
958 }
959 
960 
961 int explorer_main(HINSTANCE hInstance, LPTSTR lpCmdLine, int cmdShow)
962 {
963  CONTEXT("explorer_main");
964 
965  // initialize Common Controls library
966  CommonControlInit usingCmnCtrl;
967 
968  try {
970  } catch(COMException& e) {
972  return -1;
973  }
974 
975 #ifndef ROSSHELL
976  if (cmdShow != SW_HIDE) {
977 /* // don't maximize if being called from the ROS desktop
978  if (cmdShow == SW_SHOWNORMAL)
980  cmdShow = SW_MAXIMIZE;
981 */
982 
983  explorer_show_frame(cmdShow, lpCmdLine);
984  }
985 #endif
986 
988 
989  return 1;
990 }
991 
992 
993 static bool SetShellReadyEvent(LPCTSTR evtName)
994 {
996  if (!hEvent)
997  return false;
998 
999  SetEvent(hEvent);
1001 
1002  return true;
1003 }
1004 
1005 
1006 int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nShowCmd)
1007 {
1008  CONTEXT("WinMain()");
1009 
1010  BOOL any_desktop_running = IsAnyDesktopRunning();
1011 
1012  BOOL startup_desktop;
1013 
1014  // strip extended options from the front of the command line
1015  String ext_options;
1016 
1017  while(*lpCmdLine == '-') {
1018  while(*lpCmdLine && !_istspace((unsigned)*lpCmdLine))
1019  ext_options += *lpCmdLine++;
1020 
1021  while(_istspace((unsigned)*lpCmdLine))
1022  ++lpCmdLine;
1023  }
1024 
1025  // command line option "-install" to replace previous shell application with ROS Explorer
1026  if (_tcsstr(ext_options,TEXT("-install"))) {
1027  // install ROS Explorer into the registry
1028  TCHAR path[MAX_PATH];
1029 
1030  int l = GetModuleFileName(0, path, COUNTOF(path));
1031  if (l) {
1032  HKEY hkey;
1033 
1034  if (!RegOpenKey(HKEY_LOCAL_MACHINE, TEXT("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon"), &hkey)) {
1035 
1037 
1038  RegSetValueEx(hkey, TEXT("Shell"), 0, REG_SZ, (LPBYTE)path, l*sizeof(TCHAR));
1039  RegCloseKey(hkey);
1040  }
1041 
1042  if (!RegOpenKey(HKEY_CURRENT_USER, TEXT("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon"), &hkey)) {
1043 
1045 
1046  RegSetValueEx(hkey, TEXT("Shell"), 0, REG_SZ, (LPBYTE)TEXT(""), l*sizeof(TCHAR));
1047  RegCloseKey(hkey);
1048  }
1049  }
1050 
1051  HWND shellWindow = GetShellWindow();
1052 
1053  if (shellWindow) {
1054  DWORD pid;
1055 
1056  // terminate shell process for NT like systems
1057  GetWindowThreadProcessId(shellWindow, &pid);
1059 
1060  // On Win 9x it's sufficient to destroy the shell window.
1061  DestroyWindow(shellWindow);
1062 
1063  if (TerminateProcess(hProcess, 0))
1065 
1067  }
1068 
1069  startup_desktop = TRUE;
1070  } else {
1071  // create desktop window and task bar only, if there is no other shell and we are
1072  // the first explorer instance
1073  // MS Explorer looks additionally into the registry entry HKCU\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\shell,
1074  // to decide wether it is currently configured as shell application.
1075  startup_desktop = !any_desktop_running;
1076  }
1077 
1078 
1079  bool autostart = !any_desktop_running;
1080 
1081  // disable autostart if the SHIFT key is pressed
1082  if (GetAsyncKeyState(VK_SHIFT) < 0)
1083  autostart = false;
1084 
1085 #ifdef _DEBUG //MF: disabled for debugging
1086  autostart = false;
1087 #endif
1088 
1089  // If there is given the command line option "-desktop", create desktop window anyways
1090  if (_tcsstr(ext_options,TEXT("-desktop")))
1091  startup_desktop = TRUE;
1092 #ifndef ROSSHELL
1093  else if (_tcsstr(ext_options,TEXT("-nodesktop")))
1094  startup_desktop = FALSE;
1095 
1096  // Don't display cabinet window in desktop mode
1097  if (startup_desktop && !_tcsstr(ext_options,TEXT("-explorer")))
1098  nShowCmd = SW_HIDE;
1099 #endif
1100 
1101  if (_tcsstr(ext_options,TEXT("-noautostart")))
1102  autostart = false;
1103  else if (_tcsstr(ext_options,TEXT("-autostart")))
1104  autostart = true;
1105 
1106 #ifndef __WINE__
1107  if (_tcsstr(ext_options,TEXT("-console"))) {
1108  AllocConsole();
1109 
1113 
1114  g_Globals._log = _fdopen(1, "w");
1115  setvbuf(g_Globals._log, 0, _IONBF, 0);
1116 
1117  LOG(TEXT("starting explorer debug log\n"));
1118  }
1119 #endif
1120 
1121 
1122  if (startup_desktop) {
1123  // hide the XP login screen (Credit to Nicolas Escuder)
1124  // another undocumented event: "Global\\msgina: ReturnToWelcome"
1125  if (!SetShellReadyEvent(TEXT("msgina: ShellReadyEvent")))
1126  SetShellReadyEvent(TEXT("Global\\msgina: ShellReadyEvent"));
1127  }
1128 #ifdef ROSSHELL
1129  else
1130  return 0; // no shell to launch, so exit immediatelly
1131 #endif
1132 
1133 
1134  if (!any_desktop_running) {
1135  // launch the shell DDE server
1137  (*g_SHDOCVW_ShellDDEInit)(TRUE);
1138  }
1139 
1140 
1141  bool use_gdb_stub = false; // !IsDebuggerPresent();
1142 
1143  if (_tcsstr(ext_options,TEXT("-debug")))
1144  use_gdb_stub = true;
1145 
1146  if (_tcsstr(ext_options,TEXT("-break"))) {
1147  LOG(TEXT("debugger breakpoint"));
1148  __debugbreak();
1149  }
1150 
1151 #ifdef _M_IX86
1152  // activate GDB remote debugging stub if no other debugger is running
1153  if (use_gdb_stub) {
1154  LOG(TEXT("waiting for debugger connection...\n"));
1155 
1157  }
1158 #endif
1159 
1161 
1162  // initialize COM and OLE before creating the desktop window
1163  OleInit usingCOM;
1164 
1165  // init common controls library
1166  CommonControlInit usingCmnCtrl;
1167 
1169 
1170  if (startup_desktop) {
1171  WaitCursor wait;
1172 
1174 
1176 #ifdef _USE_HDESK
1177  g_Globals._desktops.get_current_Desktop()->_hwndDesktop = g_Globals._hwndDesktop;
1178 #endif
1179  }
1180 
1181  if (_tcsstr(ext_options,TEXT("-?"))) {
1183  "/e open cabinet window in explorer mode\r\n"
1184  "/root open cabinet window in rooted mode\r\n"
1185  "/mdi open cabinet window in MDI mode\r\n"
1186  "/sdi open cabinet window in SDI mode\r\n"
1187  "\r\n"
1188  "-? display command line options\r\n"
1189  "\r\n"
1190  "-desktop start in desktop mode regardless of an already running shell\r\n"
1191  "-nodesktop disable desktop mode\r\n"
1192  "-explorer display cabinet window regardless of enabled desktop mode\r\n"
1193  "\r\n"
1194  "-install replace previous shell application with ROS Explorer\r\n"
1195  "\r\n"
1196  "-noautostart disable autostarts\r\n"
1197  "-autostart enable autostarts regardless of debug build\r\n"
1198  "\r\n"
1199  "-console open debug console\r\n"
1200  "\r\n"
1201  "-debug activate GDB remote debugging stub\r\n"
1202  "-break activate debugger breakpoint\r\n",
1203  "ROS Explorer - command line options", MB_OK);
1204  }
1205 
1206  /*
1207  * Set our shutdown parameters: we want to shutdown the very last,
1208  * but before any TaskMgr instance (which has a shutdown level of 1).
1209  */
1211 
1212  Thread* pSSOThread = NULL;
1213 
1214  if (startup_desktop) {
1215  // launch SSO thread to allow message processing independent from the explorer main thread
1216  pSSOThread = new SSOThread;
1217  pSSOThread->Start();
1218  }
1219 
1221  if (autostart) {
1222  const char* argv[] = {"", "s"}; // call startup routine in SESSION_START mode
1223  startup(2, argv);
1224  }
1225 
1226 #ifndef ROSSHELL
1227  if (g_Globals._hwndDesktop)
1228  g_Globals._desktop_mode = true;
1229 #endif
1230 
1231 
1232  int ret = explorer_main(hInstance, lpCmdLine, nShowCmd);
1233 
1234 
1235  // write configuration file
1237 
1238  if (pSSOThread) {
1239  pSSOThread->Stop();
1240  delete pSSOThread;
1241  }
1242 
1243  if (!any_desktop_running) {
1244  // shutdown the shell DDE server
1246  (*g_SHDOCVW_ShellDDEInit)(FALSE);
1247  }
1248 
1249  return ret;
1250 }
#define RegQueryValueEx
Definition: winreg.h:524
#define WINDOW_CREATOR(WND_CLASS)
Definition: window.h:202
void _wsplitpath(const WCHAR *path, WCHAR *drv, WCHAR *dir, WCHAR *name, WCHAR *ext)
Definition: splitpath.c:22
bool read(LPCTSTR path)
read XBEL bookmark file
Definition: favorites.cpp:425
BOOL IsAnyDesktopRunning()
Definition: desktop.cpp:248
#define ICON_SIZE_FROM_ICF(flags)
Definition: globals.h:175
#define IDI_FAVORITES
Definition: resource.h:85
Icon()
Definition: explorer.cpp:242
#define ATTRIBUTE_EXECUTABLE
Definition: entries.h:63
#define IDI_CONFIG
Definition: resource.h:84
management of file types
Definition: globals.h:37
String _cfg_path
Definition: globals.h:295
#define IDI_ADMIN
Definition: resource.h:128
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define MAKEINTRESOURCE
Definition: winuser.h:591
_In_ ULONG_PTR _In_ ULONG _Out_ ULONG_PTR * pid
Definition: winddi.h:3835
HWND WINAPI GetShellWindow(VOID)
Definition: desktop.c:651
ATOM _hframeClass
Definition: globals.h:274
bool ParseCmdLine(LPCTSTR lpCmdLine)
Definition: explorer.cpp:733
#define SHGFI_SYSICONINDEX
Definition: shellapi.h:169
static HICON
Definition: imagelist.c:84
convenient loading of standard (32x32) icon resources
Definition: globals.h:309
bool _neverShowExt
Definition: globals.h:40
#define TRUE
Definition: types.h:120
BOOL WINAPI AllocConsole(VOID)
Definition: console.c:48
Explorer command line parser.
Definition: explorer.h:89
const CHAR * LPCTSTR
Definition: xmlstorage.h:193
#define IDOK
Definition: winuser.h:824
#define IDC_VERSION_TXT
Definition: resource.h:177
file system path of special folder
#define CloseHandle
Definition: compat.h:406
#define LR_SHARED
Definition: winuser.h:1090
#define IDI_EXPLORER
Definition: resource.h:56
#define _O_RDONLY
Definition: cabinet.h:37
#define IMAGE_ICON
Definition: winuser.h:212
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
void init()
Definition: explorer.cpp:381
BOOL launch_file(HWND hwnd, LPCTSTR cmd, UINT nCmdShow, LPCTSTR parameters)
Definition: utility.cpp:189
ResString(UINT nid)
Definition: explorer.cpp:663
HWND _hwndShellView
Definition: globals.h:288
void explorer_show_frame(int cmdShow, LPTSTR lpCmdLine)
Definition: explorer.cpp:707
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
bool _desktop_mode
Definition: globals.h:276
int ImageList_AddAlphaIcon(HIMAGELIST himl, HICON hIcon, HBRUSH hbrush_bkgnd, HDC hdc_wnd)
add icon with alpha channel to imagelist using the specified background color
Definition: explorer.cpp:366
_Check_return_ _CRTIMP int __cdecl _dup2(_In_ int _FileHandleSrc, _In_ int _FileHandleDst)
#define PROCESS_ALL_ACCESS
Definition: nt_native.h:1324
String _cfg_dir
Definition: globals.h:294
HRESULT hr
Definition: shlfolder.c:183
INT WINAPI ImageList_Add(HIMAGELIST himl, HBITMAP hbmImage, HBITMAP hbmMask)
Definition: imagelist.c:448
bool EvaluateOption(LPCTSTR option)
Definition: explorer.cpp:777
bool create_relative(const XPath &xpath)
create child nodes using XPath notation and move to the deepest child
Definition: xmlstorage.h:1632
#define NOERROR
Definition: winerror.h:2354
#define _tcsicmp
Definition: xmlstorage.h:205
#define GetStockFont(i)
Definition: windowsx.h:283
#define CLASSNAME_WINEFILETREE
Definition: explorer.h:76
_Check_return_ _CRTIMP FILE *__cdecl _fdopen(_In_ int _FileHandle, _In_z_ const char *_Mode)
NOTIFYICONDATA nid
Definition: magnifier.c:44
HBITMAP WINAPI CreateCompatibleBitmap(_In_ HDC hdc, _In_ INT cx, _In_ INT cy)
Definition: ftp_var.h:139
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2022
HICON _hicon
Definition: globals.h:118
#define IDI_REACTOS_BIG
Definition: resource.h:82
#define SW_HIDE
Definition: winuser.h:762
ICON_ID
Definition: globals.h:62
const GLint * attribs
Definition: glext.h:10538
#define HKEY_CURRENT_USER
Definition: winreg.h:11
ICON_TYPE
Definition: globals.h:55
#define IDI_PRINTER
Definition: resource.h:11
#define IDI_RESTART
Definition: resource.h:130
#define free
Definition: debug_ros.c:5
ResIconEx(UINT nid, int w, int h)
Definition: explorer.cpp:683
void write_persistent()
Definition: explorer.cpp:109
int _sys_idx
Definition: globals.h:119
#define IDI_SHUTDOWN
Definition: resource.h:66
bool read_file(LPCTSTR path)
Definition: xmlstorage.h:2741
PathCacheMap _pathCache
Definition: globals.h:155
void read_persistent()
Definition: explorer.cpp:84
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
Definition: shtypes.idl:42
static HDC
Definition: imagelist.c:92
#define IDI_DESKSETTING
Definition: resource.h:126
#define _fputts
Definition: tchar.h:569
#define SetWindowFont(hwnd, hfont, fRedraw)
Definition: windowsx.h:508
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
SmallIcon(UINT nid)
Definition: explorer.cpp:678
#define assert(x)
Definition: debug.h:53
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:733
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
HANDLE WINAPI GetStdHandle(IN DWORD nStdHandle)
Definition: console.c:152
GLuint buffer
Definition: glext.h:5915
IconMap _icons
Definition: globals.h:151
#define SM_CYSMICON
Definition: winuser.h:1003
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
int startup(int argc, const char *argv[])
Definition: startup.c:430
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
#define _tcsdup
Definition: tchar.h:625
char * cmd
Definition: vfdcmd.c:85
pair< _T1, _T2 > _STLP_CALL make_pair(_T1 __x, _T2 __y)
Definition: _pair.h:124
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
static HWND Create()
Definition: desktop.cpp:326
HICON _hicon
Definition: globals.h:338
static WCHAR String[]
Definition: stringtable.c:55
UINT_PTR WPARAM
Definition: windef.h:207
GLuint GLuint end
Definition: gl.h:1545
String get_windows_version_str()
Definition: utility.cpp:248
#define IDI_NETWORK
Definition: resource.h:4
HBITMAP _hBmp
Definition: globals.h:353
int initialize_gdb_stub()
#define OutputDebugString
Definition: winbase.h:3724
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define argv
Definition: mplay32.c:18
#define SW_RESTORE
Definition: winuser.h:773
BOOL WINAPI IsIconic(_In_ HWND)
#define BOOL
Definition: nt_native.h:43
HIMAGELIST himl
BOOL WINAPI DestroyWindow(_In_ HWND)
#define IDI_FOLDER
Definition: resource.h:22
#define IDS_VERSION_STR
Definition: resource.h:185
#define SHGFI_SMALLICON
Definition: shellapi.h:174
void __cdecl __debugbreak(void)
Definition: intrin_ppc.h:698
#define OpenEvent
Definition: winbase.h:3719
struct _CONTEXT CONTEXT
& rect
Definition: startmenu.cpp:1413
iterator for XML trees
Definition: xmlstorage.h:1493
CHAR * LPTSTR
Definition: xmlstorage.h:192
static HWND Create(const ExplorerCmd &cmd)
Definition: mainframe.cpp:40
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
static HANDLE hEvent
Definition: comm.c:54
RESTRICTIONS
Definition: shlobj.h:1537
void explorer_about(HWND hwndParent)
Definition: explorer.cpp:934
#define ICON_SMALL
Definition: tnclass.cpp:48
HICON _hicon
Definition: globals.h:316
INT WINAPI _tWinMain(IN HINSTANCE hInstance, IN HINSTANCE hPrevInstance, IN LPTSTR lpCmdLine, IN INT nCmdShow)
Definition: explorer.cpp:196
static bool is_exe_file(LPCTSTR ext)
Definition: explorer.cpp:150
Exception with context information.
Definition: shellclasses.h:113
HIMAGELIST _himlSys_small
Definition: globals.h:165
BOOL WINAPI SetProcessShutdownParameters(IN DWORD dwLevel, IN DWORD dwFlags)
Definition: proc.c:949
int WINAPI MessageBoxA(_In_opt_ HWND, _In_opt_ LPCSTR, _In_opt_ LPCSTR, _In_ UINT)
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
#define IDI_CONTROLPAN
Definition: resource.h:125
const Icon & extract(LPCTSTR path, ICONCACHE_FLAGS flags=ICF_NORMAL)
Definition: explorer.cpp:416
HINSTANCE hInstance
Definition: charmap.c:20
void write(LPCTSTR path) const
write XBEL bookmark file
Definition: favorites.cpp:448
void free_icon(int icon_id)
Definition: explorer.cpp:650
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
int _flags
Definition: explorer.h:114
unsigned char * LPBYTE
Definition: typedefs.h:52
COLORREF bk_color
Definition: startmenu.cpp:1409
int explorer_main(HINSTANCE hInstance, LPTSTR lpCmdLine, int cmdShow)
Definition: explorer.cpp:961
ICON_TYPE _itype
Definition: globals.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
void smart_create(const XS_String &child_name)
create node if not already existing and move to it
Definition: xmlstorage.h:1657
#define e
Definition: ke_i.h:82
#define IDI_LOGOFF
Definition: resource.h:65
#define MF_BYPOSITION
Definition: winuser.h:203
void init()
Definition: desktop.cpp:77
static UINT WPARAM LPARAM lparam
Definition: combo.c:716
#define SHGFI_PIDL
Definition: shellapi.h:178
String _displayname
Definition: globals.h:39
#define quote
Definition: macro.lex.yy.c:531
LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
Definition: window.h:602
#define SM_CXICON
Definition: winuser.h:962
#define IDC_ROS_EXPLORER
Definition: resource.h:142
#define IDC_WIN_VERSION
Definition: resource.h:178
#define CreateFont
Definition: wingdi.h:4442
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:581
#define VK_SHIFT
Definition: winuser.h:2177
DWORD WINAPI GetWindowThreadProcessId(HWND, PDWORD)
#define CLASSNAME_CHILDWND
Definition: explorer.h:75
#define MAKELONG(a, b)
Definition: typedefs.h:248
convenient loading of icon resources with specified sizes
Definition: globals.h:331
"About Explorer" Dialog
Definition: explorer.cpp:871
smooth NULL
Definition: ftsmooth.c:416
HWND WINAPI GetDesktopWindow(void)
Definition: window.c:652
static HWND hwndParent
Definition: cryptui.c:300
char ext[3]
Definition: mkdosfs.c:358
Definition: getopt.h:108
#define BUFFER_LEN
Definition: utility.h:97
#define SHGFI_OPENICON
Definition: shellapi.h:176
#define SHGFI_ADDOVERLAYS
Definition: entries.h:77
LONG_PTR LPARAM
Definition: windef.h:208
#define IDI_DOCUMENTS
Definition: resource.h:83
#define Window_SetIcon(hwnd, type, hicon)
Definition: utility.h:155
const FileTypeInfo & operator[](String ext)
Definition: explorer.cpp:179
#define STD_INPUT_HANDLE
Definition: winbase.h:264
#define IDI_INFO
Definition: resource.h:86
#define CFSTR_FILENAME
Definition: shlobj.h:474
OLE initialisation for drag drop support.
Definition: shellclasses.h:201
#define b
Definition: ke_i.h:79
GLuint GLenum option
Definition: glext.h:11211
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
#define _tcsstr
Definition: xmlstorage.h:199
r l[0]
Definition: byte_order.h:167
HBITMAP hbmp
convenient loading of small (16x16) icon resources
Definition: globals.h:320
#define LoadBitmap
Definition: winuser.h:5786
void HandleException(COMException &e, HWND hwnd)
Exception Handler for COM exceptions.
ResIcon(UINT nid)
Definition: explorer.cpp:673
char TCHAR
Definition: xmlstorage.h:189
int toupper(int c)
Definition: utclib.c:881
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
#define IDS_EXPLORER_VERSION_STR
Definition: resource.h:186
#define d
Definition: ke_i.h:81
XMLDoc _cfg
Definition: globals.h:293
if(!(yy_init))
Definition: macro.lex.yy.c:714
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
__wchar_t WCHAR
Definition: xmlstorage.h:180
int add_to_imagelist(HIMAGELIST himl, HDC hdc_wnd, COLORREF bk_color=GetSysColor(COLOR_WINDOW), HBRUSH bk_brush=GetSysColorBrush(COLOR_WINDOW)) const
Definition: explorer.cpp:306
BOOL WINAPI DrawIconEx(_In_ HDC, _In_ int, _In_ int, _In_ HICON, _In_ int, _In_ int, _In_ UINT, _In_opt_ HBRUSH, _In_ UINT)
Definition: cursoricon.c:1997
#define IDC_WWW
Definition: resource.h:161
LONG HRESULT
Definition: typedefs.h:77
DWORD COLORREF
Definition: windef.h:300
#define PathRemoveBackslash
Definition: shlwapi.h:1023
LPCTSTR set_type(struct Entry *entry, bool dont_hide_ext=false)
Definition: explorer.cpp:213
#define STD_ERROR_HANDLE
Definition: winbase.h:266
#define CSIDL_APPDATA
Definition: shlobj.h:2028
Hyperlink Controls.
Definition: window.h:816
#define RGB(r, g, b)
Definition: wingdi.h:2939
#define MAX_PATH
Definition: compat.h:26
#define WINAPI
Definition: msvc.h:6
HWND _hwndDesktopBar
Definition: globals.h:287
bool _prescan_nodes
Definition: globals.h:277
int WINAPI GetSystemMetrics(_In_ int)
unsigned long DWORD
Definition: ntddk_ex.h:95
PidlCacheMap _pidlcache
Definition: globals.h:163
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
Definition: fltkernel.h:2653
#define IDI_MINIMIZE
Definition: resource.h:124
UINT _cfStrFName
Definition: globals.h:271
Favorites _favorites
Definition: globals.h:297
#define GetModuleFileName
Definition: winbase.h:3665
#define __stdcall
Definition: typedefs.h:25
#define ICON_SIZE_SMALL
Definition: globals.h:169
#define IDD_ABOUT_EXPLORER
Definition: resource.h:81
#define INVALID_FILE_ATTRIBUTES
Definition: vfdcmd.c:23
virtual ~IconCache()
Definition: explorer.cpp:630
GLbitfield flags
Definition: glext.h:7161
#define DEFAULT_GUI_FONT
Definition: wingdi.h:908
#define WM_PAINT
Definition: winuser.h:1602
#define SM_CXSMICON
Definition: winuser.h:1002
DynamicLoadLibFct< void(__stdcall *)(BOOL)> g_SHDOCVW_ShellDDEInit(TEXT("SHDOCVW"), 118)
Definition: explorer.cpp:49
int ret
#define IDI_REACTOS
Definition: osk_res.h:24
HINSTANCE _hInstance
Definition: globals.h:270
static bool SetShellReadyEvent(LPCTSTR evtName)
Definition: explorer.cpp:993
ICONCACHE_FLAGS
Definition: entries.h:66
HDC hdc
Definition: main.c:9
#define STDAPICALLTYPE
Definition: guid.c:3
struct _IMAGELIST * HIMAGELIST
Definition: commctrl.h:320
#define IDI_SEARCH
Definition: resource.h:88
HKEY key
Definition: reg.c:42
void init(HINSTANCE hInstance)
Definition: explorer.cpp:76
SHORT WINAPI GetAsyncKeyState(_In_ int)
uint32_t entry
Definition: isohybrid.c:63
#define DI_NORMAL
Definition: wingdi.h:72
GLenum GLsizei len
Definition: glext.h:6722
ExplorerGlobals g_Globals
Definition: explorer.cpp:52
#define IDI_ACTION
Definition: resource.h:89
GLdouble s
Definition: gl.h:2039
String _path
Definition: explorer.h:112
#define MessageBox
Definition: winuser.h:5797
const Icon & get_icon(int icon_id)
Definition: explorer.cpp:625
#define CS_DBLCLKS
Definition: winuser.h:646
#define STD_OUTPUT_HANDLE
Definition: winbase.h:265
HMENU WINAPI GetSubMenu(_In_ HMENU, _In_ int)
bool import_IE_favorites(HWND hwnd)
import Internet Explorer bookmarks from Favorites folder
Definition: favorites.cpp:465
GLsizei const GLfloat * value
Definition: glext.h:6069
#define GetFileAttributes
Definition: winbase.h:3649
#define lstrcmp
Definition: winbase.h:3706
#define IDI_SEARCH_DOC
Definition: resource.h:91
#define RegisterClipboardFormat
Definition: winuser.h:5813
#define IDI_COMPUTER
Definition: resource.h:19
CtlColorParent< OwnerDrawParent< Dialog > > super
Definition: explorer.cpp:878
BOOL WINAPI DestroyMenu(_In_ HMENU)
static VOID CenterWindow(HWND hWnd)
Definition: reactos.c:47
#define IDI_RECENT
Definition: resource.h:129
window class with specified icon from resources
Definition: window.h:258
#define LOG(txt)
Definition: utility.h:102
bool _mdi
Definition: explorer.h:116
const Icon & add(HICON hIcon, ICON_TYPE type=IT_DYNAMIC)
Definition: explorer.cpp:611
#define CS_CLASSDC
Definition: winuser.h:645
structure containing global variables of Explorer
Definition: globals.h:258
boolean SelectOpt
Definition: explorer.cpp:53
BOOL RecursiveCreateDirectory(LPCTSTR path_in)
Definition: utility.cpp:394
#define _MAX_EXT
Definition: utility.h:76
bool IsValidPath() const
Definition: explorer.cpp:834
void SetWindowIcon(HWND hwnd, UINT nid)
set big and small icons out of the resources for a window
Definition: explorer.cpp:689
HBITMAP create_bitmap(COLORREF bk_color, HBRUSH hbrBkgnd, HDC hdc_wnd) const
Definition: explorer.cpp:285
#define PathFileExists
Definition: shlwapi.h:899
HANDLE WINAPI OpenProcess(IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN DWORD dwProcessId)
Definition: proc.c:1227
#define CLASSNAME_FRAME
Definition: explorer.h:73
#define IDI_NETCONNS
Definition: resource.h:127
#define TEXT(s)
Definition: k32.h:26
#define FW_BOLD
Definition: wingdi.h:377
#define LoadMenu
Definition: winuser.h:5792
#define GetModuleHandle
Definition: winbase.h:3661
BOOL WINAPI DeleteDC(_In_ HDC)
HICON hIcon
Definition: msconfig.c:44
LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
Definition: explorer.cpp:907
BOOL WINAPI RemoveMenu(_In_ HMENU, _In_ UINT, _In_ UINT)
BOOL WINAPI TerminateProcess(IN HANDLE hProcess, IN UINT uExitCode)
Definition: proc.c:1532
#define STARTMENUROOT_ICON_SIZE
Definition: globals.h:173
#define ok(value,...)
Definition: atltest.h:57
WCHAR szPath[MAX_PATH]
Definition: explorer.h:113
XMLPos get_cfg()
Definition: explorer.cpp:119
static int MessageLoop()
Definition: window.cpp:629
HWND _hMainWnd
Definition: globals.h:275
_CRTIMP wchar_t *__cdecl wcscat(_Inout_updates_z_(_String_length_(_Dest)+_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
#define IDI_DOT_TRANS
Definition: resource.h:116
#define SetWindowText
Definition: winuser.h:5832
Definition: _pair.h:47
unsigned int UINT
Definition: ndis.h:50
#define SelectBitmap(hdc, hbm)
Definition: windowsx.h:489
#define MB_OK
Definition: winuser.h:784
#define LC_COLLATE
Definition: locale.h:26
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
_T2 second
Definition: _pair.h:52
#define CLR_DEFAULT
Definition: commctrl.h:316
IdxCacheMap _idxCache
Definition: globals.h:159
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
Definition: globals.h:96
#define msg(x)
Definition: auth_time.c:54
window in explore mode
Definition: mainframe.h:33
static TAGID TAGID find
Definition: db.cpp:153
ATOM Register()
Definition: window.h:230
bool destroy()
Definition: globals.h:113
_Out_opt_ int * cx
Definition: commctrl.h:581
static void InitInstance(HINSTANCE hInstance)
Definition: explorer.cpp:940
_TCHAR * _tcsrchr(const _TCHAR *s, _XINT c)
Definition: tcsrchr.h:4
BOOL WINAPI ImageList_GetIconSize(HIMAGELIST himl, INT *cx, INT *cy)
Definition: imagelist.c:2037
HICON _hicon
Definition: globals.h:327
#define SHGetFileInfo
Definition: shellapi.h:693
#define RegQueryValue
Definition: winreg.h:523
#define _istspace
Definition: tchar.h:1504
HICON hIcon
Definition: shellapi.h:363
static int DoModal(UINT nid, CREATORFUNC creator, HWND hwndParent=0)
Definition: window.cpp:701
Desktops _desktops
Definition: globals.h:291
GLenum GLuint id
Definition: glext.h:5579
#define EVENT_MODIFY_STATE
Definition: winbase.h:163
BOOL WINAPI SetForegroundWindow(_In_ HWND)
#define setlocale(n, s)
Definition: locale.h:46
HBITMAP create_small_bitmap_from_icon(HICON hIcon, HBRUSH hbrush_bkgnd, HDC hdc_wnd)
Definition: explorer.cpp:349
ExplorerAboutDlg(HWND hwnd)
Definition: explorer.cpp:880
#define GetProcAddress(x, y)
Definition: compat.h:418
_Check_return_opt_ _CRTIMP int __cdecl setvbuf(_Inout_ FILE *_File, _Inout_updates_opt_z_(_Size) char *_Buf, _In_ int _Mode, _In_ size_t _Size)
#define malloc
Definition: debug_ros.c:4
#define COUNTOF(x)
Definition: utility.h:93
#define LoadImage
Definition: winuser.h:5790
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10
static HBITMAP
Definition: button.c:44
#define _IONBF
Definition: stdio.h:130
#define ILD_NORMAL
Definition: commctrl.h:413
#define LoadIcon
Definition: winuser.h:5788
HBRUSH bk_brush
Definition: startmenu.cpp:1410
_CRTIMP int __cdecl _open_osfhandle(_In_ intptr_t _OSFileHandle, _In_ int _Flags)
HBITMAP create_bitmap_from_icon(HICON hIcon, HBRUSH hbrush_bkgnd, HDC hdc_wnd)
create a bitmap from an icon
Definition: explorer.cpp:332
void _log_(LPCTSTR txt)
Definition: explorer.cpp:139
convenient loading of string resources
Definition: globals.h:303
GLfloat GLfloat p
Definition: glext.h:8902
#define IDI_APPS
Definition: resource.h:11
LONG_PTR LRESULT
Definition: windef.h:209
#define INFINITE
Definition: serial.h:102
XMLErrorList _errors
Definition: xmlstorage.h:2835
#define RegOpenKey
Definition: winreg.h:519
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
#define SHGFI_ICON
Definition: shellapi.h:162
FILE * _log
Definition: globals.h:280
String _classname
Definition: globals.h:38
bool write_file(LPCTSTR path, WRITE_MODE mode=FORMAT_SMART) const
Definition: xmlstorage.h:2820
static int s_next_id
Definition: globals.h:148
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
HWND _hwndDesktop
Definition: globals.h:289
#define RegSetValueEx
Definition: winreg.h:533
#define LoadString
Definition: winuser.h:5794
base of all file and directory entries
Definition: entries.h:82
void draw(HDC hdc, int x, int y, int cx, int cy, COLORREF bk_color, HBRUSH bk_brush) const
Definition: explorer.cpp:277
ResBitmap(UINT nid)
Definition: explorer.cpp:699
String _favorites_path
Definition: globals.h:298
_Rep_type::iterator iterator
Definition: _map.h:85
#define ICON_BIG
Definition: tnclass.cpp:51
XS_String str() const
return merged error strings
Definition: xmlstorage.cpp:820
static UINT WPARAM wparam
Definition: combo.c:716
#define lstrcpyn
Definition: winbase.h:3709
Definition: path.c:41
BOOL WINAPI ImageList_DrawEx(HIMAGELIST himl, INT i, HDC hdc, INT x, INT y, INT dx, INT dy, COLORREF rgbBk, COLORREF rgbFg, UINT fStyle)
Definition: imagelist.c:1264
DWORD(STDAPICALLTYPE *_SHRestricted)(RESTRICTIONS)
IconCache _icon_cache
Definition: globals.h:285
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
iconPos iconPos icon_size
Definition: startmenu.cpp:1416
#define ExtractIconEx
Definition: shellapi.h:685
HIMAGELIST get_sys_imagelist() const
Definition: globals.h:143
#define REG_SZ
Definition: layer.c:22