ReactOS 0.4.15-dev-7958-gcd0bb1a
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
44
45
46extern "C" int initialize_gdb_stub(); // start up GDB stub
47
48
49DynamicLoadLibFct<void(__stdcall*)(BOOL)> g_SHDOCVW_ShellDDEInit(TEXT("SHDOCVW"), 118);
50
51
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;
72 _hwndDesktop = 0;
73}
74
75
77{
79 _SHRestricted = (DWORD(STDAPICALLTYPE*)(RESTRICTIONS)) GetProcAddress(GetModuleHandle(TEXT("SHELL32")), "SHRestricted");
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()) {
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
139void _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
249Icon::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),
260{
261}
262
264 : _id((ICON_ID)id),
265 _itype(itype),
266 _hicon(hIcon)
267{
268}
269
270Icon::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
277void 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)
280 ImageList_DrawEx(g_Globals._icon_cache.get_sys_imagelist(), _sys_idx, hdc, x, y, cx, cy, bk_color, CLR_DEFAULT, ILD_NORMAL);
281 else
283}
284
285HBITMAP Icon::create_bitmap(COLORREF bk_color, HBRUSH hbrBkgnd, HDC hdc_wnd) const
286{
287 if (_itype == IT_SYSCACHE) {
288 HIMAGELIST himl = g_Globals._icon_cache.get_sys_imagelist();
289
290 int cx, cy;
292
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) {
311 HIMAGELIST himl = g_Globals._icon_cache.get_sys_imagelist();
312
313 int cx, cy;
315
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
332HBITMAP 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;
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
350{
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
366int 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
518const 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
618const 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
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
650void 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{
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
707void explorer_show_frame(int cmdShow, LPTSTR lpCmdLine)
708{
710
711 if (g_Globals._hMainWnd) {
714 else
716
717 return;
718 }
719
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")))
794 // option /root for rooted explorer windows
795 else if (!_tcsicmp(option, TEXT("root")))
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;
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
850void 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
861PopupMenu::PopupMenu(UINT nid)
862{
864 _hmenu = GetSubMenu(hMenu, 0);
865 RemoveMenu(hMenu, 0, MF_BYPOSITION);
866 DestroyMenu(hMenu);
867}
868
869
871struct ExplorerAboutDlg : public
873 OwnerDrawParent<Dialog>
874 >
875{
876 typedef CtlColorParent<
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
891
894
895 HWND hwnd_winver = GetDlgItem(hwnd, IDC_WIN_VERSION);
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
930protected:
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
961int 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
987 Window::MessageLoop();
988
989 return 1;
990}
991
992
993static bool SetShellReadyEvent(LPCTSTR evtName)
994{
996 if (!hEvent)
997 return false;
998
1001
1002 return true;
1003}
1004
1005
1006int 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
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
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}
@ lparam
Definition: SystemMenu.c:31
@ wparam
Definition: SystemMenu.c:30
pair< _T1, _T2 > _STLP_CALL make_pair(_T1 __x, _T2 __y)
Definition: _pair.h:124
int toupper(int c)
Definition: utclib.c:881
static void startup(void)
#define ok(value,...)
Definition: atltest.h:57
#define msg(x)
Definition: auth_time.c:54
VOID WaitCursor(BOOL bBegin)
Definition: dialog.c:114
#define IDI_APPS
Definition: resource.h:11
static VOID CenterWindow(HWND hWnd)
Definition: reactos.c:48
HANDLE WINAPI GetStdHandle(IN DWORD nStdHandle)
Definition: console.c:203
BOOL WINAPI AllocConsole(VOID)
Definition: console.c:74
#define IDI_PRINTER
Definition: resource.h:11
#define IDI_COMPUTER
Definition: resource.h:19
#define IDI_FOLDER
Definition: resource.h:22
#define RegCloseKey(hKey)
Definition: registry.h:49
HBITMAP hbmp
HIMAGELIST himl
r l[0]
Definition: byte_order.h:168
HINSTANCE hInstance
Definition: charmap.c:19
_Rep_type::iterator iterator
Definition: _map.h:85
static HWND hwndParent
Definition: cryptui.c:300
static TAGID TAGID find
Definition: db.cpp:155
#define free
Definition: debug_ros.c:5
#define malloc
Definition: debug_ros.c:4
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
static const WCHAR quote[]
Definition: reg.c:40
#define _O_RDONLY
Definition: cabinet.h:37
INT WINAPI ImageList_Add(HIMAGELIST himl, HBITMAP hbmImage, HBITMAP hbmMask)
Definition: imagelist.c:448
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
BOOL WINAPI ImageList_GetIconSize(HIMAGELIST himl, INT *cx, INT *cy)
Definition: imagelist.c:2037
#define CloseHandle
Definition: compat.h:739
#define GetProcAddress(x, y)
Definition: compat.h:753
#define MAX_PATH
Definition: compat.h:34
static const WCHAR *const ext[]
Definition: module.c:53
BOOL WINAPI TerminateProcess(IN HANDLE hProcess, IN UINT uExitCode)
Definition: proc.c:1532
HANDLE WINAPI OpenProcess(IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN DWORD dwProcessId)
Definition: proc.c:1227
BOOL WINAPI SetProcessShutdownParameters(IN DWORD dwLevel, IN DWORD dwFlags)
Definition: proc.c:949
#define IDI_SHUTDOWN
Definition: resource.h:83
#define IDI_LOGOFF
Definition: resource.h:82
#define IDI_NETWORK
Definition: resource.h:4
#define assert(x)
Definition: debug.h:53
#define RGB(r, g, b)
Definition: precomp.h:71
#define STDAPICALLTYPE
Definition: guid.c:3
#define INFINITE
Definition: serial.h:102
ICONCACHE_FLAGS
Definition: entries.h:66
@ ICF_MIDDLE
Definition: entries.h:68
@ ICF_HICON
Definition: entries.h:72
@ ICF_LARGE
Definition: entries.h:69
@ ICF_SYSCACHE
Definition: entries.h:73
@ ICF_OVERLAYS
Definition: entries.h:71
@ ICF_OPEN
Definition: entries.h:70
#define SHGFI_ADDOVERLAYS
Definition: entries.h:77
#define ATTRIBUTE_EXECUTABLE
Definition: entries.h:63
#define CLASSNAME_CHILDWND
Definition: explorer.h:75
#define CLASSNAME_FRAME
Definition: explorer.h:73
#define CLASSNAME_WINEFILETREE
Definition: explorer.h:76
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
Definition: fltkernel.h:2653
pKey DeleteObject()
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLdouble s
Definition: gl.h:2039
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLuint GLuint end
Definition: gl.h:1545
GLuint buffer
Definition: glext.h:5915
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLbitfield flags
Definition: glext.h:7161
GLfloat GLfloat p
Definition: glext.h:8902
GLenum GLsizei len
Definition: glext.h:6722
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
GLuint id
Definition: glext.h:5910
const GLint * attribs
Definition: glext.h:10538
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
#define LC_COLLATE
Definition: locale.h:18
#define _IONBF
Definition: stdio.h:129
_Check_return_ _CRTIMP FILE *__cdecl _fdopen(_In_ int _FileHandle, _In_z_ const char *_Mode)
_Check_return_opt_ _CRTIMP int __cdecl setvbuf(_Inout_ FILE *_File, _Inout_updates_opt_z_(_Size) char *_Buf, _In_ int _Mode, _In_ size_t _Size)
_CRTIMP void __cdecl _wsplitpath(_In_z_ const wchar_t *_FullPath, _Pre_maybenull_ _Post_z_ wchar_t *_Drive, _Pre_maybenull_ _Post_z_ wchar_t *_Dir, _Pre_maybenull_ _Post_z_ wchar_t *_Filename, _Pre_maybenull_ _Post_z_ wchar_t *_Ext)
#define _istspace
Definition: tchar.h:1504
#define _fputts
Definition: tchar.h:569
#define _tWinMain
Definition: tchar.h:498
#define _tcsdup
Definition: tchar.h:625
void __cdecl __debugbreak(void)
Definition: intrin_ppc.h:698
uint32_t entry
Definition: isohybrid.c:63
#define TEXT(s)
Definition: k32.h:26
#define d
Definition: ke_i.h:81
#define e
Definition: ke_i.h:82
#define b
Definition: ke_i.h:79
#define REG_SZ
Definition: layer.c:22
if(dx< 0)
Definition: linetemp.h:194
NOTIFYICONDATA nid
Definition: magnifier.c:44
@ OWM_EXPLORE
Definition: mainframe.h:32
@ OWM_ROOTED
window in explore mode
Definition: mainframe.h:33
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:71
BOOL IsAnyDesktopRunning()
Definition: desktop.cpp:248
void SetWindowIcon(HWND hwnd, UINT nid)
set big and small icons out of the resources for a window
Definition: explorer.cpp:689
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
ExplorerGlobals g_Globals
Definition: explorer.cpp:52
static bool SetShellReadyEvent(LPCTSTR evtName)
Definition: explorer.cpp:993
DynamicLoadLibFct< void(__stdcall *)(BOOL)> g_SHDOCVW_ShellDDEInit(TEXT("SHDOCVW"), 118)
boolean SelectOpt
Definition: explorer.cpp:53
HBITMAP create_small_bitmap_from_icon(HICON hIcon, HBRUSH hbrush_bkgnd, HDC hdc_wnd)
Definition: explorer.cpp:349
void _log_(LPCTSTR txt)
Definition: explorer.cpp:139
void explorer_show_frame(int cmdShow, LPTSTR lpCmdLine)
Definition: explorer.cpp:707
int explorer_main(HINSTANCE hInstance, LPTSTR lpCmdLine, int cmdShow)
Definition: explorer.cpp:961
int initialize_gdb_stub()
HBITMAP create_bitmap_from_icon(HICON hIcon, HBRUSH hbrush_bkgnd, HDC hdc_wnd)
create a bitmap from an icon
Definition: explorer.cpp:332
void explorer_about(HWND hwndParent)
Definition: explorer.cpp:934
static void InitInstance(HINSTANCE hInstance)
Definition: explorer.cpp:940
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
ICON_ID
Definition: globals.h:62
@ ICID_INFO
Definition: globals.h:74
@ ICID_NETWORK
Definition: globals.h:80
@ ICID_DOCUMENTS
Definition: globals.h:72
@ ICID_DYNAMIC
Definition: globals.h:93
@ ICID_RECENT
Definition: globals.h:91
@ ICID_PRINTER
Definition: globals.h:79
@ ICID_CONTROLPAN
Definition: globals.h:87
@ ICID_RESTART
Definition: globals.h:84
@ ICID_SHUTDOWN
Definition: globals.h:83
@ ICID_EXPLORER
Definition: globals.h:69
@ ICID_SEARCH_DOC
Definition: globals.h:78
@ ICID_ACTION
Definition: globals.h:77
@ ICID_CONFIG
Definition: globals.h:71
@ ICID_FAVORITES
Definition: globals.h:73
@ ICID_COMPUTER
Definition: globals.h:81
@ ICID_SEARCH
Definition: globals.h:76
@ ICID_ADMIN
Definition: globals.h:90
@ ICID_DESKSETTING
Definition: globals.h:88
@ ICID_LOGOFF
Definition: globals.h:82
@ ICID_BOOKMARK
Definition: globals.h:85
@ ICID_UNKNOWN
Definition: globals.h:63
@ ICID_MINIMIZE
Definition: globals.h:86
@ ICID_NONE
Definition: globals.h:64
@ ICID_FOLDER
Definition: globals.h:66
@ ICID_APPS
Definition: globals.h:75
@ ICID_NETCONNS
Definition: globals.h:89
#define ICON_SIZE_FROM_ICF(flags)
Definition: globals.h:175
#define STARTMENUROOT_ICON_SIZE
Definition: globals.h:173
ICON_TYPE
Definition: globals.h:55
@ IT_SYSCACHE
Definition: globals.h:59
@ IT_STATIC
Definition: globals.h:56
@ IT_CACHED
Definition: globals.h:57
struct ExplorerGlobals g_Globals
HBITMAP create_bitmap_from_icon(HICON hIcon, HBRUSH hbrush_bkgnd, HDC hdc_wnd)
create a bitmap from an icon
Definition: explorer.cpp:332
#define ICON_SIZE_SMALL
Definition: globals.h:169
#define IDI_CONTROLPAN
Definition: resource.h:125
#define IDS_VERSION_STR
Definition: resource.h:185
#define IDI_INFO
Definition: resource.h:86
#define IDC_WIN_VERSION
Definition: resource.h:178
#define IDI_SEARCH_DOC
Definition: resource.h:91
#define IDI_REACTOS_BIG
Definition: resource.h:82
#define IDI_MINIMIZE
Definition: resource.h:124
#define IDI_RECENT
Definition: resource.h:129
#define IDI_FAVORITES
Definition: resource.h:85
#define IDC_ROS_EXPLORER
Definition: resource.h:142
#define IDI_SEARCH
Definition: resource.h:88
#define IDD_ABOUT_EXPLORER
Definition: resource.h:81
#define IDI_CONFIG
Definition: resource.h:84
#define IDC_WWW
Definition: resource.h:161
#define IDC_VERSION_TXT
Definition: resource.h:177
#define IDI_NETCONNS
Definition: resource.h:127
#define IDI_DESKSETTING
Definition: resource.h:126
#define IDI_RESTART
Definition: resource.h:130
#define IDI_ACTION
Definition: resource.h:89
#define IDI_DOT_TRANS
Definition: resource.h:116
#define IDI_EXPLORER
Definition: resource.h:56
#define IDI_DOCUMENTS
Definition: resource.h:83
#define IDS_EXPLORER_VERSION_STR
Definition: resource.h:186
#define IDI_ADMIN
Definition: resource.h:128
BOOL RecursiveCreateDirectory(LPCTSTR path_in)
Definition: utility.cpp:394
BOOL launch_file(HWND hwnd, LPCTSTR cmd, UINT nCmdShow, LPCTSTR parameters)
Definition: utility.cpp:189
String get_windows_version_str()
Definition: utility.cpp:248
#define BUFFER_LEN
Definition: utility.h:97
#define LOG(txt)
Definition: utility.h:102
#define COUNTOF(x)
Definition: utility.h:93
#define _MAX_EXT
Definition: utility.h:76
#define Window_SetIcon(hwnd, type, hicon)
Definition: utility.h:155
#define _tcsrchr
Definition: utility.h:116
#define WINDOW_CREATOR(WND_CLASS)
Definition: window.h:202
HDC hdc
Definition: main.c:9
static HBITMAP
Definition: button.c:44
static HDC
Definition: imagelist.c:92
static HICON
Definition: imagelist.c:84
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
static HANDLE hEvent
Definition: comm.c:54
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:63
#define argv
Definition: mplay32.c:18
HICON hIcon
Definition: msconfig.c:44
unsigned int UINT
Definition: ndis.h:50
#define BOOL
Definition: nt_native.h:43
struct _CONTEXT CONTEXT
#define PROCESS_ALL_ACCESS
Definition: nt_native.h:1324
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
#define DWORD
Definition: nt_native.h:44
#define IDI_REACTOS
Definition: osk_res.h:21
long LONG
Definition: pedump.c:60
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:586
#define ILD_NORMAL
Definition: commctrl.h:417
struct _IMAGELIST * HIMAGELIST
Definition: commctrl.h:324
_Out_opt_ int * cx
Definition: commctrl.h:585
#define CLR_DEFAULT
Definition: commctrl.h:320
_Check_return_ _CRTIMP int __cdecl _dup2(_In_ int _FileHandleSrc, _In_ int _FileHandleDst)
_CRTIMP int __cdecl _open_osfhandle(_In_ intptr_t _OSFileHandle, _In_ int _Flags)
_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 SHGFI_OPENICON
Definition: shellapi.h:178
#define SHGetFileInfo
Definition: shellapi.h:697
#define SHGFI_SYSICONINDEX
Definition: shellapi.h:171
#define SHGFI_ICON
Definition: shellapi.h:164
#define ExtractIconEx
Definition: shellapi.h:689
#define SHGFI_SMALLICON
Definition: shellapi.h:176
#define SHGFI_PIDL
Definition: shellapi.h:180
void HandleException(COMException &e, HWND hwnd)
Exception Handler for COM exceptions.
HRESULT hr
Definition: shlfolder.c:183
#define CFSTR_FILENAME
Definition: shlobj.h:548
#define CSIDL_APPDATA
Definition: shlobj.h:2183
RESTRICTIONS
Definition: shlobj.h:1626
#define PathRemoveBackslash
Definition: shlwapi.h:1023
#define PathFileExists
Definition: shlwapi.h:899
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
Definition: shtypes.idl:42
iconPos iconPos icon_size
Definition: startmenu.cpp:1416
& rect
Definition: startmenu.cpp:1413
COLORREF bk_color
Definition: startmenu.cpp:1409
HBRUSH bk_brush
Definition: startmenu.cpp:1410
Exception with context information.
Definition: shellclasses.h:114
LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
Definition: window.h:602
static HWND Create()
Definition: desktop.cpp:326
void init()
Definition: desktop.cpp:77
static int DoModal(UINT nid, CREATORFUNC creator, HWND hwndParent=0)
Definition: window.cpp:701
base of all file and directory entries
Definition: entries.h:83
"About Explorer" Dialog
Definition: explorer.cpp:875
LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
Definition: explorer.cpp:907
CtlColorParent< OwnerDrawParent< Dialog > > super
Definition: explorer.cpp:878
ExplorerAboutDlg(HWND hwnd)
Definition: explorer.cpp:880
Explorer command line parser.
Definition: explorer.h:90
int _flags
Definition: explorer.h:114
bool IsValidPath() const
Definition: explorer.cpp:834
bool EvaluateOption(LPCTSTR option)
Definition: explorer.cpp:777
bool _mdi
Definition: explorer.h:116
WCHAR szPath[MAX_PATH]
Definition: explorer.h:113
String _path
Definition: explorer.h:112
bool ParseCmdLine(LPCTSTR lpCmdLine)
Definition: explorer.cpp:733
structure containing global variables of Explorer
Definition: globals.h:259
void init(HINSTANCE hInstance)
Definition: explorer.cpp:76
HINSTANCE _hInstance
Definition: globals.h:270
IconCache _icon_cache
Definition: globals.h:285
HWND _hwndDesktopBar
Definition: globals.h:287
Desktops _desktops
Definition: globals.h:291
String _favorites_path
Definition: globals.h:298
String _cfg_dir
Definition: globals.h:294
ATOM _hframeClass
Definition: globals.h:274
bool _prescan_nodes
Definition: globals.h:277
XMLDoc _cfg
Definition: globals.h:293
void write_persistent()
Definition: explorer.cpp:109
FILE * _log
Definition: globals.h:280
UINT _cfStrFName
Definition: globals.h:271
void read_persistent()
Definition: explorer.cpp:84
bool _desktop_mode
Definition: globals.h:276
String _cfg_path
Definition: globals.h:295
HWND _hwndShellView
Definition: globals.h:288
XMLPos get_cfg()
Definition: explorer.cpp:119
Favorites _favorites
Definition: globals.h:297
HWND _hwndDesktop
Definition: globals.h:289
HWND _hMainWnd
Definition: globals.h:275
bool read(LPCTSTR path)
read XBEL bookmark file
Definition: favorites.cpp:425
bool import_IE_favorites(HWND hwnd)
import Internet Explorer bookmarks from Favorites folder
Definition: favorites.cpp:465
void write(LPCTSTR path) const
write XBEL bookmark file
Definition: favorites.cpp:448
management of file types
Definition: globals.h:37
String _classname
Definition: globals.h:38
bool _neverShowExt
Definition: globals.h:40
String _displayname
Definition: globals.h:39
static bool is_exe_file(LPCTSTR ext)
Definition: explorer.cpp:150
const FileTypeInfo & operator[](String ext)
Definition: explorer.cpp:179
LPCTSTR set_type(struct Entry *entry, bool dont_hide_ext=false)
Definition: explorer.cpp:213
Hyperlink Controls.
Definition: window.h:817
static int s_next_id
Definition: globals.h:148
void init()
Definition: explorer.cpp:381
virtual ~IconCache()
Definition: explorer.cpp:630
PathCacheMap _pathCache
Definition: globals.h:155
IdxCacheMap _idxCache
Definition: globals.h:159
const Icon & add(HICON hIcon, ICON_TYPE type=IT_DYNAMIC)
Definition: explorer.cpp:611
PidlCacheMap _pidlcache
Definition: globals.h:163
const Icon & extract(LPCTSTR path, ICONCACHE_FLAGS flags=ICF_NORMAL)
Definition: explorer.cpp:416
const Icon & get_icon(int icon_id)
Definition: explorer.cpp:625
IconMap _icons
Definition: globals.h:151
HIMAGELIST _himlSys_small
Definition: globals.h:165
void free_icon(int icon_id)
Definition: explorer.cpp:650
window class with specified icon from resources
Definition: window.h:259
Definition: globals.h:96
void draw(HDC hdc, int x, int y, int cx, int cy, COLORREF bk_color, HBRUSH bk_brush) const
Definition: explorer.cpp:277
Icon()
Definition: explorer.cpp:242
HBITMAP create_bitmap(COLORREF bk_color, HBRUSH hbrBkgnd, HDC hdc_wnd) const
Definition: explorer.cpp:285
ICON_TYPE _itype
Definition: globals.h:117
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 destroy()
Definition: globals.h:113
HICON _hicon
Definition: globals.h:118
int _sys_idx
Definition: globals.h:119
static HWND Create(const ExplorerCmd &cmd)
Definition: mainframe.cpp:40
OLE initialisation for drag drop support.
Definition: shellclasses.h:202
draw message routing for ColorButton and PictureButton
Definition: window.h:625
HBITMAP _hBmp
Definition: globals.h:353
ResBitmap(UINT nid)
Definition: explorer.cpp:699
convenient loading of icon resources with specified sizes
Definition: globals.h:332
HICON _hicon
Definition: globals.h:338
ResIconEx(UINT nid, int w, int h)
Definition: explorer.cpp:683
convenient loading of standard (32x32) icon resources
Definition: globals.h:310
HICON _hicon
Definition: globals.h:316
ResIcon(UINT nid)
Definition: explorer.cpp:673
convenient loading of string resources
Definition: globals.h:304
ResString(UINT nid)
Definition: explorer.cpp:663
convenient loading of small (16x16) icon resources
Definition: globals.h:321
HICON _hicon
Definition: globals.h:327
SmallIcon(UINT nid)
Definition: explorer.cpp:678
file system path of special folder
ATOM Register()
Definition: window.h:230
bool write_file(LPCTSTR path, WRITE_MODE mode=FORMAT_SMART) const
Definition: xmlstorage.h:2820
bool read_file(LPCTSTR path)
Definition: xmlstorage.h:2741
XMLErrorList _errors
Definition: xmlstorage.h:2835
XS_String str() const
return merged error strings
Definition: xmlstorage.cpp:820
iterator for XML trees
Definition: xmlstorage.h:1494
void smart_create(const XS_String &child_name)
create node if not already existing and move to it
Definition: xmlstorage.h:1657
bool create_relative(const XPath &xpath)
create child nodes using XPath notation and move to the deepest child
Definition: xmlstorage.h:1632
HICON hIcon
Definition: shellapi.h:365
Definition: ftp_var.h:139
Definition: copy.c:22
Definition: getopt.h:109
Definition: _pair.h:47
_T2 second
Definition: _pair.h:52
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:733
#define ICON_BIG
Definition: tnclass.cpp:51
#define ICON_SMALL
Definition: tnclass.cpp:48
#define setlocale(n, s)
Definition: locale.h:46
unsigned char * LPBYTE
Definition: typedefs.h:53
#define __stdcall
Definition: typedefs.h:25
#define MAKELONG(a, b)
Definition: typedefs.h:249
Definition: pdh_main.c:94
#define INVALID_FILE_ATTRIBUTES
Definition: vfdcmd.c:23
int ret
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFSTRING String
Definition: wdfdevice.h:2433
HWND WINAPI GetShellWindow(VOID)
Definition: desktop.c:651
#define lstrcpyn
Definition: winbase.h:3875
#define STD_OUTPUT_HANDLE
Definition: winbase.h:268
#define STD_INPUT_HANDLE
Definition: winbase.h:267
#define GetFileAttributes
Definition: winbase.h:3815
#define lstrcmp
Definition: winbase.h:3872
#define EVENT_MODIFY_STATE
Definition: winbase.h:163
#define STD_ERROR_HANDLE
Definition: winbase.h:269
DWORD WINAPI GetWindowThreadProcessId(HWND hWnd, PDWORD lpdwProcessId)
#define GetModuleHandle
Definition: winbase.h:3827
#define OutputDebugString
Definition: winbase.h:3890
#define OpenEvent
Definition: winbase.h:3885
#define GetModuleFileName
Definition: winbase.h:3831
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
_In_ ULONG_PTR _In_ ULONG _Out_ ULONG_PTR * pid
Definition: winddi.h:3837
LONG_PTR LPARAM
Definition: windef.h:208
LONG_PTR LRESULT
Definition: windef.h:209
UINT_PTR WPARAM
Definition: windef.h:207
DWORD COLORREF
Definition: windef.h:300
#define WINAPI
Definition: msvc.h:6
#define SetWindowFont(hwnd, hfont, fRedraw)
Definition: windowsx.h:533
#define SelectBitmap(hdc, hbm)
Definition: windowsx.h:514
#define GetStockFont(i)
Definition: windowsx.h:308
#define NOERROR
Definition: winerror.h:2354
#define FW_BOLD
Definition: wingdi.h:378
#define DEFAULT_GUI_FONT
Definition: wingdi.h:909
#define DI_NORMAL
Definition: wingdi.h:72
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
#define CreateFont
Definition: wingdi.h:4443
HBITMAP WINAPI CreateCompatibleBitmap(_In_ HDC hdc, _In_ INT cx, _In_ INT cy)
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
BOOL WINAPI DeleteDC(_In_ HDC)
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define HKEY_CURRENT_USER
Definition: winreg.h:11
#define RegSetValueEx
Definition: winreg.h:533
#define RegQueryValueEx
Definition: winreg.h:524
#define RegOpenKey
Definition: winreg.h:519
#define RegQueryValue
Definition: winreg.h:523
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10
#define WM_PAINT
Definition: winuser.h:1620
#define SW_HIDE
Definition: winuser.h:768
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define IMAGE_ICON
Definition: winuser.h:212
int WINAPI MessageBoxA(_In_opt_ HWND hWnd, _In_opt_ LPCSTR lpText, _In_opt_ LPCSTR lpCaption, _In_ UINT uType)
#define LoadBitmap
Definition: winuser.h:5811
BOOL WINAPI SetForegroundWindow(_In_ HWND)
#define RegisterClipboardFormat
Definition: winuser.h:5838
#define SM_CYSMICON
Definition: winuser.h:1013
#define CS_DBLCLKS
Definition: winuser.h:651
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
BOOL WINAPI IsIconic(_In_ HWND)
#define IDOK
Definition: winuser.h:830
HWND WINAPI GetDesktopWindow(void)
Definition: window.c:656
#define SM_CXSMICON
Definition: winuser.h:1012
HMENU WINAPI GetSubMenu(_In_ HMENU, _In_ int)
#define MF_BYPOSITION
Definition: winuser.h:203
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:2028
BOOL WINAPI RemoveMenu(_In_ HMENU, _In_ UINT, _In_ UINT)
#define LoadIcon
Definition: winuser.h:5813
#define LR_SHARED
Definition: winuser.h:1100
#define LoadMenu
Definition: winuser.h:5817
#define MB_OK
Definition: winuser.h:790
#define LoadImage
Definition: winuser.h:5815
BOOL WINAPI DestroyMenu(_In_ HMENU)
#define LoadString
Definition: winuser.h:5819
#define MessageBox
Definition: winuser.h:5822
#define SW_RESTORE
Definition: winuser.h:779
#define VK_SHIFT
Definition: winuser.h:2202
#define CS_CLASSDC
Definition: winuser.h:650
#define SetWindowText
Definition: winuser.h:5857
SHORT WINAPI GetAsyncKeyState(_In_ int)
#define SM_CXICON
Definition: winuser.h:972
BOOL WINAPI DestroyWindow(_In_ HWND)
#define MAKEINTRESOURCE
Definition: winuser.h:591
int WINAPI GetSystemMetrics(_In_ int)
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2053
char TCHAR
Definition: xmlstorage.h:189
__wchar_t WCHAR
Definition: xmlstorage.h:180
const CHAR * LPCTSTR
Definition: xmlstorage.h:193
CHAR * LPTSTR
Definition: xmlstorage.h:192
#define _tcsstr
Definition: xmlstorage.h:199
#define _tcsicmp
Definition: xmlstorage.h:205