ReactOS 0.4.15-dev-7958-gcd0bb1a
shellclasses.h
Go to the documentation of this file.
1/*
2 * Copyright 2003, 2004, 2005 Martin Fuchs
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18
19
20 //
21 // Explorer clone
22 //
23 // shellclasses.h
24 //
25 // C++ wrapper classes for COM interfaces and shell objects
26 //
27 // Martin Fuchs, 20.07.2003
28 //
29
30
31 // windows shell headers
32#include <shellapi.h>
33#include <shlobj.h>
34
35/*@@
36#if _MSC_VER>=1300 // VS.Net
37#include <comdefsp.h>
38using namespace _com_util;
39#endif
40*/
41
42#ifndef _INC_COMUTIL // is comutil.h of MS headers not available?
43#ifndef _NO_COMUTIL
44#define _NO_COMUTIL
45#endif
46#endif
47
48 // work around GCC's wide string constant bug when compiling inline functions
49#ifdef __GNUC__
50extern const LPCTSTR sCFSTR_SHELLIDLIST;
51#undef CFSTR_SHELLIDLIST
52#define CFSTR_SHELLIDLIST sCFSTR_SHELLIDLIST
53#endif
54
55#ifdef _MSC_VER
56#define NOVTABLE __declspec(novtable)
57#else
58#define NOVTABLE
59#endif
60#define ANSUNC
61
62
63 // Exception Handling
64
65#ifndef _NO_COMUTIL
66
67#define COMExceptionBase _com_error
68
69#else
70
73{
75 : _hr(hr)
76 {
77 }
78
79 HRESULT Error() const
80 {
81 return _hr;
82 }
83
85 {
86 if (_msg.empty()) {
87 LPTSTR pBuf;
88
91 _msg = pBuf;
92 LocalFree(pBuf);
93 } else {
94 TCHAR buffer[128];
95 _sntprintf(buffer, COUNTOF(buffer), TEXT("unknown Exception: 0x%08lX"), _hr);
96 _msg = buffer;
97 }
98 }
99
100 return _msg;
101 }
102
103protected:
105 mutable String _msg;
106};
107
108#endif
109
110
112
114{
116
118 : super(hr),
119 _context(CURRENT_CONTEXT),
120 _file(NULL), _line(0)
121 {
122 LOG(toString());
123 LOG(CURRENT_CONTEXT.getStackTrace());
124 }
125
126 COMException(HRESULT hr, const char* file, int line)
127 : super(hr),
128 _context(CURRENT_CONTEXT),
130 {
131 LOG(toString());
132 LOG(CURRENT_CONTEXT.getStackTrace());
133 }
134
136 : super(hr),
137 _context(CURRENT_CONTEXT),
138 _file(NULL), _line(0)
139 {
140 LOG(toString());
141 LOG(CURRENT_CONTEXT.getStackTrace());
142 }
143
144 COMException(HRESULT hr, const String& obj, const char* file, int line)
145 : super(hr),
146 _context(CURRENT_CONTEXT),
148 {
149 LOG(toString());
150 LOG(CURRENT_CONTEXT.getStackTrace());
151 }
152
153 String toString() const;
154
156
157 const char* _file;
158 int _line;
159};
160
161#define THROW_EXCEPTION(hr) throw COMException(hr, __FILE__, __LINE__)
162#define CHECKERROR(hr) ((void)(FAILED(hr)? THROW_EXCEPTION(hr): 0))
163
164
165#ifdef _NO_COMUTIL
166
168{
169 if (FAILED(hr))
170 throw COMException(hr);
171}
172
173#endif
174
175
177
179{
181 {
183 }
184
185#if (_WIN32_WINNT>=0x0400) || defined(_WIN32_DCOM)
187 {
189 }
190#endif
191
193 {
195 }
196};
197
198
200
202{
204 {
206 }
207
209 {
211 }
212};
213
214
216
217extern void HandleException(COMException& e, HWND hwnd);
218
219
221
223{
225 {
226 _p = NULL;
227 }
228
229 void init()
230 {
231 if (!_p)
233 }
234
236 {
237 if (_p)
238 _p->Release();
239 }
240
241 operator IMalloc*()
242 {
243 return _p;
244 }
245
247};
248
249
251
253{
255 {
256 // initialize s_cmn_shell_malloc
258 }
259
261 {
262 return s_cmn_shell_malloc;
263 }
264
266};
267
268
270
271template<typename T> struct SShellPtr
272{
274 {
275 _malloc->Free(_p);
276 }
277
279 {
280 return _p;
281 }
282
283 T const* operator->() const
284 {
285 return _p;
286 }
287
288 operator T const *() const
289 {
290 return _p;
291 }
292
293 const T& operator*() const
294 {
295 return *_p;
296 }
297
299 {
300 return *_p;
301 }
302
303protected:
305 : _p(0)
306 {
307 }
308
310 : _p(p)
311 {
312 }
313
314 void Free()
315 {
316 _malloc->Free(_p);
317 _p = NULL;
318 }
319
321 mutable ShellMalloc _malloc; // IMalloc memory management object
322
323private:
324 // disallow copying of SShellPtr objects
326 void operator=(SShellPtr const&) {}
327};
328
329
331
332template<typename T> struct SIfacePtr
333{
335 : _p(0)
336 {
337 }
338
340 : _p(p)
341 {
342 if (p)
343 p->AddRef();
344 }
345
347 {
348 CHECKERROR(unknown->QueryInterface(riid, (LPVOID*)&_p));
349 }
350
352 {
353 Free();
354 }
355
357 {
358 return _p;
359 }
360
361 const T* operator->() const
362 {
363 return _p;
364 }
365
366/* not GCC compatible
367 operator const T*() const
368 {
369 return _p;
370 } */
371
372 operator T*()
373 {
374 return _p;
375 }
376
378 {
379 return &_p;
380 }
381
382 bool empty() const //NOTE: GCC seems not to work correctly when defining operator bool() AND operator T*() at one time
383 {
384 return !_p;
385 }
386
388 {
389 Free();
390
391 if (p) {
392 p->AddRef();
393 _p = p;
394 }
395
396 return *this;
397 }
398
399 void operator=(SIfacePtr const& o)
400 {
401 T* h = _p;
402
403 if (o._p)
404 o._p->AddRef();
405
406 _p = o._p;
407
408 if (h)
409 h->Release();
410 }
411
413 {
414 return CoCreateInstance(clsid, NULL, CLSCTX_INPROC_SERVER, riid, (LPVOID*)&_p);
415 }
416
417 template<typename I> HRESULT QueryInterface(REFIID riid, I* p)
418 {
419 return _p->QueryInterface(riid, (LPVOID*)p);
420 }
421
423 {
424 return _p;
425 }
426
427 void Free()
428 {
429 T* h = _p;
430 _p = NULL;
431
432 if (h)
433 h->Release();
434 }
435
436protected:
438 : _p(o._p)
439 {
440 if (_p)
441 _p->AddRef();
442 }
443
445};
446
447
448struct NOVTABLE ComSrvObject // NOVTABLE erlaubt, da protected Destruktor
449{
450protected:
451 ComSrvObject() : _ref(1) {}
452 virtual ~ComSrvObject() {}
453
455};
456
458{
459 ULONG IncRef() {return ++_ref;}
460 ULONG DecRef() {ULONG ref=--_ref; if (!ref) {_ref++; delete this;} return ref;}
461};
462
463
464 // server object interfaces
465
466template<typename BASE> struct IComSrvQI : public BASE
467{
468 IComSrvQI(REFIID uuid_base)
469 : _uuid_base(uuid_base)
470 {
471 }
472
474 {
475 *ppv = NULL;
476
478 {*ppv=static_cast<BASE*>(this); this->AddRef(); return S_OK;}
479
480 return E_NOINTERFACE;
481 }
482
483protected:
485 virtual ~IComSrvQI() {}
486
488};
489
490template<> struct IComSrvQI<IUnknown> : public IUnknown
491{
493 {
494 *ppv = NULL;
495
497 {*ppv=this; AddRef(); return S_OK;}
498
499 return E_NOINTERFACE;
500 }
501
502protected:
504 virtual ~IComSrvQI<IUnknown>() {}
505};
506
507
508template<typename BASE, typename OBJ>
509 class IComSrvBase : public IComSrvQI<BASE>
510{
512
513protected:
515 : super(uuid_base)
516 {
517 }
518
519public:
520 STDMETHODIMP_(ULONG) AddRef() {return static_cast<OBJ*>(this)->IncRef();}
521 STDMETHODIMP_(ULONG) Release() {return static_cast<OBJ*>(this)->DecRef();}
522};
523
524
525
526struct ShellFolder;
527
528
530
532{
534 {
535 _desktop = 0;
536 }
537
539
540 void init();
541
542 operator ShellFolder&()
543 {
544 return *_desktop;
545 }
546
547protected:
549};
550
551
552#ifndef _NO_COMUTIL // _com_ptr available?
553
555struct ShellFolder : public IShellFolderPtr // IShellFolderPtr uses intrinsic extensions of the VC++ compiler.
556{
557 typedef IShellFolderPtr super;
558
559 ShellFolder(); // desktop folder
563
565 String get_name(LPCITEMIDLIST pidl=NULL, SHGDNF flags=SHGDN_NORMAL) const;
566
567 bool empty() const {return !operator bool();} //NOTE: see SIfacePtr::empty()
568};
569
570#ifdef UNICODE
571#define IShellLinkPtr IShellLinkWPtr
572#else
573#define IShellLinkPtr IShellLinkAPtr
574#endif
575
577struct ShellLinkPtr : public IShellLinkPtr
578{
579 typedef IShellLinkPtr super;
580
581 ShellLinkPtr(IShellLink* p)
582 : super(p)
583 {
584 p->AddRef();
585 }
586
587 bool empty() const {return !operator bool();} //NOTE: see SIfacePtr::empty()
588};
589
590#else // _com_ptr not available -> use SIfacePtr
591
593struct ShellFolder : public SIfacePtr<IShellFolder>
594{
596
597 ShellFolder();
601
603 String get_name(LPCITEMIDLIST pidl, SHGDNF flags=SHGDN_NORMAL) const;
604};
605
607struct ShellLinkPtr : public SIfacePtr<IShellLink>
608{
610
611 ShellLinkPtr(IShellLink* p)
612 : super(p)
613 {
614 _p->AddRef();
615 }
616
617};
618
619#endif
620
621
623
624
625#ifdef UNICODE
626#define path_from_pidl path_from_pidlW
627#else
628#define path_from_pidl path_from_pidlA
629#endif
630
634
635
636 // ILGetSize() was missing in previous versions of MinGW and is not exported from shell32.dll on Windows 2000.
637extern "C" UINT ILGetSize_local(LPCITEMIDLIST pidl);
638#define ILGetSize ILGetSize_local
639
640#if 0
641#ifdef UNICODE // CFSTR_FILENAME was defined wrong in previous versions of MinGW.
642#define CFSTR_FILENAMEW TEXT("FileNameW")
643#undef CFSTR_FILENAME
644#define CFSTR_FILENAME CFSTR_FILENAMEW
645#endif
646#endif
647
648
650
651struct ShellPath : public SShellPtr<ITEMIDLIST>
652{
654
656 {
657 }
658
660 {
661 CONTEXT("ShellPath::ShellPath(IShellFolder*, LPCWSTR)");
662
663 if (path)
664 CHECKERROR(folder->ParseDisplayName(0, NULL, (LPOLESTR)path, NULL, &_p, NULL));
665 else
666 _p = NULL;
667 }
668
670 {
671 OBJ_CONTEXT("ShellPath::ShellPath(LPCWSTR)", path);
672
673 if (path)
675 else
676 _p = NULL;
677 }
678
680 {
681 CONTEXT("ShellPath::ShellPath(IShellFolder*, LPCSTR)");
682
684
685 if (path) {
687 CHECKERROR(folder->ParseDisplayName(0, NULL, b, NULL, &_p, NULL));
688 } else
689 _p = NULL;
690 }
691
693 {
694 CONTEXT("ShellPath::ShellPath(LPCSTR)");
695
697
698 if (path) {
701 } else
702 _p = NULL;
703 }
704
706 : super(NULL)
707 {
708 //CONTEXT("ShellPath::ShellPath(const ShellPath&)");
709
710 if (o._p) {
711 int l = ILGetSize(o._p);
712 _p = (ITEMIDLIST*) _malloc->Alloc(l);
713 if (_p) memcpy(_p, o._p, l);
714 }
715 }
716
718 : super(p)
719 {
720 }
721
723 {
724 //CONTEXT("ShellPath::ShellPath(LPCITEMIDLIST)");
725
726 if (p) {
727 int l = ILGetSize(p);
728 _p = (ITEMIDLIST*) _malloc->Alloc(l);
729 if (_p) memcpy(_p, p, l);
730 }
731 }
732
733 void operator=(const ShellPath& o)
734 {
735 //CONTEXT("ShellPath::operator=(const ShellPath&)");
736
737 ITEMIDLIST* h = _p;
738
739 if (o._p) {
740 int l = ILGetSize(o._p);
741
742 _p = (ITEMIDLIST*) _malloc->Alloc(l);
743 if (_p) memcpy(_p, o._p, l);
744 }
745 else
746 _p = NULL;
747
748 _malloc->Free(h);
749 }
750
752 {
753 //CONTEXT("ShellPath::operator=(ITEMIDLIST*)");
754
755 ITEMIDLIST* h = _p;
756
757 if (p) {
758 int l = ILGetSize(p);
759 _p = (ITEMIDLIST*) _malloc->Alloc(l);
760 if (_p) memcpy(_p, p, l);
761 }
762 else
763 _p = NULL;
764
765 _malloc->Free(h);
766 }
767
768 void operator=(const SHITEMID& o)
769 {
770 ITEMIDLIST* h = _p;
771
772 LPBYTE p = (LPBYTE)_malloc->Alloc(o.cb+2);
773 if (p) *(PWORD)((LPBYTE)memcpy(p, &o, o.cb)+o.cb) = 0;
774 _p = (ITEMIDLIST*)p;
775
776 _malloc->Free(h);
777 }
778
779 void operator+=(const SHITEMID& o)
780 {
781 int l0 = ILGetSize(_p);
782 LPBYTE p = (LPBYTE)_malloc->Alloc(l0+o.cb);
783 int l = l0 - 2;
784
785 if (p) {
786 memcpy(p, _p, l);
787 *(PWORD)((LPBYTE)memcpy(p+l, &o, o.cb)+o.cb) = 0;
788 }
789
790 _malloc->Free(_p);
791 _p = (ITEMIDLIST*)p;
792 }
793
794 friend bool operator<(const ShellPath& a, const ShellPath& b)
795 {
796 int la = ILGetSize(a._p);
797 int lb = ILGetSize(b._p);
798
799 int r = memcmp(a._p, b._p, min(la, lb));
800 if (r)
801 return r < 0;
802 else
803 return la < lb;
804 }
805
806 void assign(LPCITEMIDLIST pidl, size_t size)
807 {
808 //CONTEXT("ShellPath::assign(LPCITEMIDLIST, size_t)");
809
810 ITEMIDLIST* h = _p;
811
812 _p = (ITEMIDLIST*) _malloc->Alloc(size+sizeof(USHORT/*SHITEMID::cb*/));
813
814 if (_p) {
815 memcpy(_p, pidl, size);
816 ((ITEMIDLIST*)((LPBYTE)_p+size))->mkid.cb = 0; // terminator
817 }
818
819 _malloc->Free(h);
820 }
821
823 {
824 //CONTEXT("ShellPath::assign(LPCITEMIDLIST)");
825
826 ITEMIDLIST* h = _p;
827
828 if (pidl) {
829 int l = ILGetSize(pidl);
830 _p = (ITEMIDLIST*) _malloc->Alloc(l);
831 if (_p) memcpy(_p, pidl, l);
832 } else
833 _p = NULL;
834
835 _malloc->Free(h);
836 }
837
838 void split(ShellPath& parent, ShellPath& obj) const;
839
841
843 {
844 return ShellFolder(_p);
845 }
846
848 {
849 CONTEXT("ShellPath::get_folder()");
850 return ShellFolder(parent, _p);
851 }
852
853 // convert an item id list from relative to absolute (=relative to the desktop) format
855};
856
857
858#if defined(__WINE__) && defined(NONAMELESSUNION) // Wine doesn't know of unnamed union members and uses some macros instead.
859#define UNION_MEMBER(x) DUMMYUNIONNAME.##x
860#else
861#define UNION_MEMBER(x) x
862#endif
863
864
865 // encapsulation of STRRET structure for easy string retrieval with conversion
866
867#ifdef UNICODE
868#define StrRet StrRetW
869//#define tcscpyn wcscpyn
870#else
871#define StrRet StrRetA
872//#define tcscpyn strcpyn
873#endif
874
875//extern LPSTR strcpyn(LPSTR dest, LPCSTR source, size_t count);
876//extern LPWSTR wcscpyn(LPWSTR dest, LPCWSTR source, size_t count);
877
879struct StrRetA : public STRRET
880{
882 {
883 if (uType == STRRET_WSTR)
885 }
886
887 void GetString(const SHITEMID& shiid, LPSTR b, int l)
888 {
889 switch(uType) {
890 case STRRET_WSTR:
892 break;
893
894 case STRRET_OFFSET:
896 break;
897
898 case STRRET_CSTR:
900 }
901 }
902};
903
905struct StrRetW : public STRRET
906{
908 {
909 if (uType == STRRET_WSTR)
911 }
912
913 void GetString(const SHITEMID& shiid, LPWSTR b, int l)
914 {
915 switch(uType) {
916 case STRRET_WSTR:
918 break;
919
920 case STRRET_OFFSET:
922 break;
923
924 case STRRET_CSTR:
926 }
927 }
928};
929
930
933{
935
936protected:
938
939public:
940 FileSysShellPath(const ShellPath& o) : ShellPath(o) {_fullpath[0] = '\0';}
941
942 operator LPCTSTR() {if (!SHGetPathFromIDList(_p, _fullpath)) return NULL; return _fullpath;}
943};
944
945
948{
950 {
951 _displayname[0] = '\0';
952 _browseinfo.hwndOwner = owner;
953 _browseinfo.pidlRoot = root;
954 _browseinfo.pszDisplayName = _displayname;
955 _browseinfo.lpszTitle = title;
956 _browseinfo.ulFlags = flags;
957 _browseinfo.lpfn = 0;
958 _browseinfo.lParam = 0;
959 _browseinfo.iImage = 0;
960
962 }
963
965 {
966 return _displayname;
967 }
968
969 bool IsOK()
970 {
971 return _p != 0;
972 }
973
974private:
977};
978
979
982{
984 {
986 CHECKERROR(hr);
987 }
988};
989
992{
995 {
996 }
997};
998
1001{
1004 {
1005 }
1006};
1007
1010{
1011};
1012
1013
1016{
1017 SpecialFolderFSPath(int folder/*e.g. CSIDL_DESKTOP*/, HWND hwnd);
1018
1019 operator LPCTSTR()
1020 {
1021 return _fullpath;
1022 }
1023
1024protected:
1026};
1027
1028/*
1030struct SpecialFolderFSPath : public FileSysShellPath
1031{
1032 SpecialFolderFSPath(int folder, HWND hwnd)
1033 {
1034 CONTEXT("SpecialFolderFSPath::SpecialFolderFSPath()");
1035
1036 HRESULT hr = SHGetSpecialFolderLocation(hwnd, folder, &_p);
1037 CHECKERROR(hr);
1038 }
1039};
1040*/
1041
1042
1044
1045struct ShellItemEnumerator : public SIfacePtr<IEnumIDList>
1046{
1047 ShellItemEnumerator(IShellFolder* folder, DWORD flags=SHCONTF_FOLDERS|SHCONTF_NONFOLDERS|SHCONTF_INCLUDEHIDDEN)
1048 {
1049 CONTEXT("ShellItemEnumerator::ShellItemEnumerator()");
1050
1051 CHECKERROR(folder->EnumObjects(0, flags, &_p));
1052 }
1053};
1054
1055
1058{
1060 {
1061 memset(&_stgm, 0, sizeof(STGMEDIUM));
1062 }
1063
1065 {
1066 if (_stgm.hGlobal) {
1067 GlobalUnlock(_stgm.hGlobal);
1069 }
1070 }
1071
1073 {
1075
1076 FORMATETC fetc;
1077 fetc.cfFormat = CF_IDLIST;
1078 fetc.ptd = NULL;
1079 fetc.dwAspect = DVASPECT_CONTENT;
1080 fetc.lindex = -1;
1081 fetc.tymed = TYMED_HGLOBAL;
1082
1083 HRESULT hr = selection->QueryGetData(&fetc);
1084 if (FAILED(hr))
1085 return hr;
1086
1087 hr = selection->GetData(&fetc, &_stgm);
1088 if (FAILED(hr))
1089 return hr;
1090
1091 _pIDList = (LPIDA)GlobalLock(_stgm.hGlobal);
1092
1093 return hr;
1094 }
1095
1096 operator LPIDA() {return _pIDList;}
1097
1098protected:
1099 STGMEDIUM _stgm;
1101};
1102
1103
1105{
1107 {
1108 reset();
1109 }
1110
1111 void reset();
1114
1116
1118};
1119
1120template<typename BASE> struct ExtContextMenuHandlerT
1121 : public BASE
1122{
1123 typedef BASE super;
1124
1126 : super(hwnd)
1127 {
1128 }
1129
1130 template<typename PARA> ExtContextMenuHandlerT(HWND hwnd, const PARA& info)
1131 : super(hwnd, info)
1132 {
1133 }
1134
1136 {
1137 switch(nmsg) {
1138 case WM_DRAWITEM:
1139 case WM_MEASUREITEM:
1140 if (!wparam) // Is the message menu-related?
1141 if (_cm_ifs.HandleMenuMsg(nmsg, wparam, lparam))
1142 return TRUE;
1143
1144 break;
1145
1146 case WM_INITMENUPOPUP:
1147 if (_cm_ifs.HandleMenuMsg(nmsg, wparam, lparam))
1148 return 0;
1149
1150 break;
1151
1152 case WM_MENUCHAR: // only supported by IContextMenu3
1153 if (_cm_ifs._pctxmenu3) {
1154 LRESULT lResult = 0;
1155
1156 _cm_ifs._pctxmenu3->HandleMenuMsg2(nmsg, wparam, lparam, &lResult);
1157
1158 return lResult;
1159 }
1160
1161 return 0;
1162 }
1163
1164 return super::WndProc(nmsg, wparam, lparam);
1165 }
1166
1167protected:
1169};
1170
1171
1172extern HRESULT ShellFolderContextMenu(IShellFolder* shell_folder, HWND hwndParent, int cidl,
1173 LPCITEMIDLIST* ppidl, int x, int y, CtxMenuInterfaces& cm_ifs);
@ lparam
Definition: SystemMenu.c:31
@ wparam
Definition: SystemMenu.c:30
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
HWND hWnd
Definition: settings.c:17
#define STDMETHODIMP
Definition: basetyps.h:43
const GUID IID_IUnknown
struct _root root
r l[0]
Definition: byte_order.h:168
_In_ BOOLEAN Release
Definition: cdrom.h:920
Retrieval of file system paths of ShellPath objects.
Definition: shellclasses.h:933
TCHAR _fullpath[MAX_PATH]
Definition: shellclasses.h:934
FileSysShellPath(const ShellPath &o)
Definition: shellclasses.h:940
STDMETHODIMP_(ULONG) AddRef()
Definition: shellclasses.h:520
STDMETHODIMP_(ULONG) Release()
Definition: shellclasses.h:521
IComSrvBase(REFIID uuid_base)
Definition: shellclasses.h:514
IComSrvQI< BASE > super
Definition: shellclasses.h:511
static HWND hwndParent
Definition: cryptui.c:300
int selection
Definition: ctm.c:92
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
static WCHAR unknown[MAX_STRING_RESOURCE_LEN]
Definition: object.c:1605
#define CP_ACP
Definition: compat.h:109
#define lstrcpynA
Definition: compat.h:751
#define MAX_PATH
Definition: compat.h:34
#define WideCharToMultiByte
Definition: compat.h:111
#define MultiByteToWideChar
Definition: compat.h:110
#define lstrcpynW
Definition: compat.h:738
#define BASE
Definition: inflate.c:58
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3325
HRESULT WINAPI DECLSPEC_HOTPATCH CoInitializeEx(LPVOID lpReserved, DWORD dwCoInit)
Definition: compobj.c:2002
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
Definition: compobj.c:1964
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:2067
HRESULT WINAPI DECLSPEC_HOTPATCH OleInitialize(LPVOID reserved)
Definition: ole2.c:169
void WINAPI ReleaseStgMedium(STGMEDIUM *pmedium)
Definition: ole2.c:2033
void WINAPI DECLSPEC_HOTPATCH OleUninitialize(void)
Definition: ole2.c:230
HRESULT WINAPI SHGetMalloc(LPMALLOC *lpmal)
Definition: shellole.c:285
HRESULT WINAPI SHGetSpecialFolderLocation(HWND hwndOwner, INT nFolder, LPITEMIDLIST *ppidl)
Definition: shellpath.c:3225
r parent
Definition: btrfs.c:3010
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLsizeiptr size
Definition: glext.h:5919
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
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean flag
Definition: glfuncs.h:52
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1594
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39
HRESULT HandleMenuMsg2([in] UINT uMsg, [in] WPARAM wParam, [in] LPARAM lParam, [out] LRESULT *plResult)
LPVOID Alloc([in] SIZE_T cb)
void Free([in] LPVOID pv)
ULONG Release()
#define S_OK
Definition: intsafe.h:52
#define FAILED(hr)
Definition: intsafe.h:51
#define I(s)
#define TEXT(s)
Definition: k32.h:26
#define e
Definition: ke_i.h:82
#define T
Definition: mbstring.h:31
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define LOG(txt)
Definition: utility.h:102
#define COUNTOF(x)
Definition: utility.h:93
static IParseDisplayName ParseDisplayName
Definition: moniker.c:816
static LPOLESTR
Definition: stg_prop.c:27
static ULONG WINAPI AddRef(IStream *iface)
Definition: clist.c:90
#define min(a, b)
Definition: monoChain.cc:55
REFCLSID clsid
Definition: msctf.c:82
unsigned int UINT
Definition: ndis.h:50
#define bool
Definition: nsiface.idl:72
struct _CONTEXT CONTEXT
WORD * PWORD
Definition: pedump.c:67
unsigned short USHORT
Definition: pedump.c:61
static char title[]
Definition: ps.c:92
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
#define REFIID
Definition: guiddef.h:118
#define LANG_NEUTRAL
Definition: nls.h:22
#define MAKELANGID(p, s)
Definition: nls.h:15
#define SUBLANG_DEFAULT
Definition: nls.h:168
#define memset(x, y, z)
Definition: compat.h:39
ShellFolder & GetDesktopFolder()
#define CHECKERROR(hr)
Definition: shellclasses.h:162
HRESULT name_from_pidl(IShellFolder *folder, LPCITEMIDLIST pidl, LPTSTR buffer, int len, SHGDNF flags)
#define UNION_MEMBER(x)
Definition: shellclasses.h:861
#define NOVTABLE
Definition: shellclasses.h:58
#define ILGetSize
Definition: shellclasses.h:638
UINT ILGetSize_local(LPCITEMIDLIST pidl)
HRESULT ShellFolderContextMenu(IShellFolder *shell_folder, HWND hwndParent, int cidl, LPCITEMIDLIST *ppidl, int x, int y, CtxMenuInterfaces &cm_ifs)
HRESULT path_from_pidlA(IShellFolder *folder, LPCITEMIDLIST pidl, LPSTR buffer, int len)
HRESULT path_from_pidlW(IShellFolder *folder, LPCITEMIDLIST pidl, LPWSTR buffer, int len)
void CheckError(HRESULT hr)
Definition: shellclasses.h:167
void HandleException(COMException &e, HWND hwnd)
Exception Handler for COM exceptions.
HRESULT hr
Definition: shlfolder.c:183
#define CFSTR_SHELLIDLIST
Definition: shlobj.h:543
struct CIDA * LPIDA
#define BROWSEINFO
Definition: shlobj.h:1203
#define SHBrowseForFolder
Definition: shlobj.h:1246
#define CSIDL_DESKTOP
Definition: shlobj.h:2158
#define SHGetPathFromIDList
Definition: shlobj.h:237
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
@ STRRET_CSTR
Definition: shtypes.idl:87
@ STRRET_OFFSET
Definition: shtypes.idl:86
@ STRRET_WSTR
Definition: shtypes.idl:85
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
Definition: shtypes.idl:42
Definition: shlobj.h:565
COM ExceptionBase class as replacement for _com_error.
Definition: shellclasses.h:73
COMExceptionBase(HRESULT hr)
Definition: shellclasses.h:74
HRESULT Error() const
Definition: shellclasses.h:79
LPCTSTR ErrorMessage() const
Definition: shellclasses.h:84
Exception with context information.
Definition: shellclasses.h:114
const char * _file
Definition: shellclasses.h:157
Context _context
Definition: shellclasses.h:155
COMException(HRESULT hr, const String &obj, const char *file, int line)
Definition: shellclasses.h:144
COMExceptionBase super
Definition: shellclasses.h:115
COMException(HRESULT hr)
Definition: shellclasses.h:117
String toString() const
COMException(HRESULT hr, const String &obj)
Definition: shellclasses.h:135
COMException(HRESULT hr, const char *file, int line)
Definition: shellclasses.h:126
COM Initialisation.
Definition: shellclasses.h:179
virtual ~ComSrvObject()
Definition: shellclasses.h:452
caching of desktop ShellFolder object
Definition: shellclasses.h:532
ShellFolder * _desktop
Definition: shellclasses.h:548
We use a common IMalloc object for all shell memory allocations.
Definition: shellclasses.h:223
bool HandleMenuMsg(UINT nmsg, WPARAM wparam, LPARAM lparam)
IContextMenu * query_interfaces(IContextMenu *pcm1)
IContextMenu2 * _pctxmenu2
IContextMenu3 * _pctxmenu3
Shell folder path of the desktop.
Definition: shellclasses.h:992
Shell folder of the desktop.
ExtContextMenuHandlerT(HWND hwnd, const PARA &info)
CtxMenuInterfaces _cm_ifs
LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
ExtContextMenuHandlerT(HWND hwnd)
Browse dialog operating on shell namespace.
Definition: shellclasses.h:948
BROWSEINFO _browseinfo
Definition: shellclasses.h:975
FolderBrowser(HWND owner, UINT flags, LPCTSTR title, LPCITEMIDLIST root=0)
Definition: shellclasses.h:949
TCHAR _displayname[MAX_PATH]
Definition: shellclasses.h:976
LPCTSTR GetDisplayName()
Definition: shellclasses.h:964
IComSrvQI(REFIID uuid_base)
Definition: shellclasses.h:468
virtual ~IComSrvQI()
Definition: shellclasses.h:485
STDMETHODIMP QueryInterface(REFIID riid, LPVOID *ppv)
Definition: shellclasses.h:473
REFIID _uuid_base
Definition: shellclasses.h:487
OLE initialisation for drag drop support.
Definition: shellclasses.h:202
list of PIDLs
LPIDA _pIDList
HRESULT GetData(IDataObject *selection)
STGMEDIUM _stgm
WORD cb
Definition: shtypes.idl:27
wrapper class for COM interface pointers
Definition: shellclasses.h:333
void Free()
Definition: shellclasses.h:427
SIfacePtr & operator=(T *p)
Definition: shellclasses.h:387
void operator=(SIfacePtr const &o)
Definition: shellclasses.h:399
SIfacePtr(T *p)
Definition: shellclasses.h:339
const T * operator->() const
Definition: shellclasses.h:361
T * operator->()
Definition: shellclasses.h:356
bool empty() const
Definition: shellclasses.h:382
T ** operator&()
Definition: shellclasses.h:377
HRESULT QueryInterface(REFIID riid, I *p)
Definition: shellclasses.h:417
SIfacePtr(const SIfacePtr &o)
Definition: shellclasses.h:437
SIfacePtr(IUnknown *unknown, REFIID riid)
Definition: shellclasses.h:346
HRESULT CreateInstance(REFIID clsid, REFIID riid)
Definition: shellclasses.h:412
wrapper template class for pointers to shell objects managed by IMalloc
Definition: shellclasses.h:272
ShellMalloc _malloc
Definition: shellclasses.h:321
T const * operator->() const
Definition: shellclasses.h:283
SShellPtr(const SShellPtr &)
Definition: shellclasses.h:325
const T & operator*() const
Definition: shellclasses.h:293
T * operator->()
Definition: shellclasses.h:278
T & operator*()
Definition: shellclasses.h:298
void operator=(SShellPtr const &)
Definition: shellclasses.h:326
SShellPtr(T *p)
Definition: shellclasses.h:309
void Free()
Definition: shellclasses.h:314
IShellFolder smart pointer.
Definition: shellclasses.h:594
String get_name(LPCITEMIDLIST pidl, SHGDNF flags=SHGDN_NORMAL) const
void attach(IShellFolder *parent, LPCITEMIDLIST pidl)
SIfacePtr< IShellFolder > super
Definition: shellclasses.h:595
wrapper class for enumerating shell namespace objects
ShellItemEnumerator(IShellFolder *folder, DWORD flags=SHCONTF_FOLDERS|SHCONTF_NONFOLDERS|SHCONTF_INCLUDEHIDDEN)
IShellLink smart pointer.
Definition: shellclasses.h:608
ShellLinkPtr(IShellLink *p)
Definition: shellclasses.h:611
SIfacePtr< IShellLink > super
Definition: shellclasses.h:609
wrapper class for IMalloc with usage of common allocator
Definition: shellclasses.h:253
IMalloc * operator->()
Definition: shellclasses.h:260
static CommonShellMalloc s_cmn_shell_malloc
Definition: shellclasses.h:265
wrapper class for item ID lists
Definition: shellclasses.h:652
ShellPath create_absolute_pidl(LPCITEMIDLIST parent_pidl) const
friend bool operator<(const ShellPath &a, const ShellPath &b)
Definition: shellclasses.h:794
SShellPtr< ITEMIDLIST > super
Definition: shellclasses.h:653
void assign(LPCITEMIDLIST pidl, size_t size)
Definition: shellclasses.h:806
ShellPath(IShellFolder *folder, LPCSTR path)
Definition: shellclasses.h:679
ShellFolder get_folder()
Definition: shellclasses.h:842
void operator=(const ShellPath &o)
Definition: shellclasses.h:733
void GetUIObjectOf(REFIID riid, LPVOID *ppvOut, HWND hWnd=0, ShellFolder &sf=GetDesktopFolder())
void operator=(const SHITEMID &o)
Definition: shellclasses.h:768
void split(ShellPath &parent, ShellPath &obj) const
ShellPath(LPCWSTR path)
Definition: shellclasses.h:669
ShellPath(LPCSTR path)
Definition: shellclasses.h:692
void assign(LPCITEMIDLIST pidl)
Definition: shellclasses.h:822
void operator=(ITEMIDLIST *p)
Definition: shellclasses.h:751
ShellPath(const ShellPath &o)
Definition: shellclasses.h:705
ShellFolder get_folder(IShellFolder *parent)
Definition: shellclasses.h:847
ShellPath(IShellFolder *folder, LPCWSTR path)
Definition: shellclasses.h:659
void operator+=(const SHITEMID &o)
Definition: shellclasses.h:779
ShellPath(LPCITEMIDLIST p)
Definition: shellclasses.h:722
ShellPath(LPITEMIDLIST p)
Definition: shellclasses.h:717
file system path of special folder
TCHAR _fullpath[MAX_PATH]
Retrieval of special shell folder paths.
Definition: shellclasses.h:982
SpecialFolderPath(int folder, HWND hwnd)
Definition: shellclasses.h:983
Retrieval of special shell folder.
SpecialFolder(int folder, HWND hwnd)
easy retrieval of multi byte strings out of STRRET structures
Definition: shellclasses.h:880
void GetString(const SHITEMID &shiid, LPSTR b, int l)
Definition: shellclasses.h:887
easy retrieval of wide char strings out of STRRET structures
Definition: shellclasses.h:906
void GetString(const SHITEMID &shiid, LPWSTR b, int l)
Definition: shellclasses.h:913
char cStr[MAX_PATH]
Definition: shtypes.idl:98
UINT uType
Definition: shtypes.idl:93
LPWSTR pOleStr
Definition: shtypes.idl:96
UINT uOffset
Definition: shtypes.idl:97
Definition: fci.c:127
Definition: fci.c:116
Definition: parser.c:49
Definition: send.c:48
unsigned char * LPBYTE
Definition: typedefs.h:53
uint32_t ULONG
Definition: typedefs.h:59
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFSTRING String
Definition: wdfdevice.h:2433
#define FormatMessage
Definition: winbase.h:3795
#define FORMAT_MESSAGE_FROM_SYSTEM
Definition: winbase.h:423
#define FORMAT_MESSAGE_ALLOCATE_BUFFER
Definition: winbase.h:419
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
LONG_PTR LPARAM
Definition: windef.h:208
LONG_PTR LRESULT
Definition: windef.h:209
UINT_PTR WPARAM
Definition: windef.h:207
#define E_NOINTERFACE
Definition: winerror.h:2364
#define RegisterClipboardFormat
Definition: winuser.h:5838
#define WM_DRAWITEM
Definition: winuser.h:1645
#define WM_MENUCHAR
Definition: winuser.h:1748
#define WM_INITMENUPOPUP
Definition: winuser.h:1746
#define WM_MEASUREITEM
Definition: winuser.h:1646
char TCHAR
Definition: xmlstorage.h:189
const char * LPCSTR
Definition: xmlstorage.h:183
char * LPSTR
Definition: xmlstorage.h:182
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184
const CHAR * LPCTSTR
Definition: xmlstorage.h:193
#define _sntprintf
Definition: xmlstorage.h:201
CHAR * LPTSTR
Definition: xmlstorage.h:192
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define const
Definition: zconf.h:233