ReactOS 0.4.15-dev-8236-g99f0937
shellclasses.h File Reference
#include <shellapi.h>
#include <shlobj.h>
Include dependency graph for shellclasses.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  COMExceptionBase
 COM ExceptionBase class as replacement for _com_error. More...
 
struct  COMException
 Exception with context information. More...
 
struct  ComInit
 COM Initialisation. More...
 
struct  OleInit
 OLE initialisation for drag drop support. More...
 
struct  CommonShellMalloc
 We use a common IMalloc object for all shell memory allocations. More...
 
struct  ShellMalloc
 wrapper class for IMalloc with usage of common allocator More...
 
struct  SShellPtr< T >
 wrapper template class for pointers to shell objects managed by IMalloc More...
 
struct  SIfacePtr< T >
 wrapper class for COM interface pointers More...
 
struct  ComSrvObject
 
struct  SimpleComObject
 
struct  IComSrvQI< BASE >
 
struct  IComSrvQI< IUnknown >
 
class  IComSrvBase< BASE, OBJ >
 
struct  CommonDesktop
 caching of desktop ShellFolder object More...
 
struct  ShellFolder
 IShellFolder smart pointer. More...
 
struct  ShellLinkPtr
 IShellLink smart pointer. More...
 
struct  ShellPath
 wrapper class for item ID lists More...
 
struct  StrRetA
 easy retrieval of multi byte strings out of STRRET structures More...
 
struct  StrRetW
 easy retrieval of wide char strings out of STRRET structures More...
 
class  FileSysShellPath
 Retrieval of file system paths of ShellPath objects. More...
 
struct  FolderBrowser
 Browse dialog operating on shell namespace. More...
 
struct  SpecialFolderPath
 Retrieval of special shell folder paths. More...
 
struct  DesktopFolderPath
 Shell folder path of the desktop. More...
 
struct  SpecialFolder
 Retrieval of special shell folder. More...
 
struct  DesktopFolder
 Shell folder of the desktop. More...
 
struct  SpecialFolderFSPath
 file system path of special folder More...
 
struct  ShellItemEnumerator
 wrapper class for enumerating shell namespace objects More...
 
struct  PIDList
 list of PIDLs More...
 
struct  CtxMenuInterfaces
 
struct  ExtContextMenuHandlerT< BASE >
 

Macros

#define NOVTABLE
 
#define ANSUNC
 
#define THROW_EXCEPTION(hr)   throw COMException(hr, __FILE__, __LINE__)
 
#define CHECKERROR(hr)   ((void)(FAILED(hr)? THROW_EXCEPTION(hr): 0))
 
#define path_from_pidl   path_from_pidlA
 
#define ILGetSize   ILGetSize_local
 
#define UNION_MEMBER(x)   x
 
#define StrRet   StrRetA
 

Functions

void CheckError (HRESULT hr)
 
void HandleException (COMException &e, HWND hwnd)
 Exception Handler for COM exceptions.
 
ShellFolderGetDesktopFolder ()
 
HRESULT path_from_pidlA (IShellFolder *folder, LPCITEMIDLIST pidl, LPSTR buffer, int len)
 
HRESULT path_from_pidlW (IShellFolder *folder, LPCITEMIDLIST pidl, LPWSTR buffer, int len)
 
HRESULT name_from_pidl (IShellFolder *folder, LPCITEMIDLIST pidl, LPTSTR buffer, int len, SHGDNF flags)
 
UINT ILGetSize_local (LPCITEMIDLIST pidl)
 
HRESULT ShellFolderContextMenu (IShellFolder *shell_folder, HWND hwndParent, int cidl, LPCITEMIDLIST *ppidl, int x, int y, CtxMenuInterfaces &cm_ifs)
 

Macro Definition Documentation

◆ ANSUNC

#define ANSUNC

Definition at line 60 of file shellclasses.h.

◆ CHECKERROR

#define CHECKERROR (   hr)    ((void)(FAILED(hr)? THROW_EXCEPTION(hr): 0))

Definition at line 162 of file shellclasses.h.

◆ ILGetSize

#define ILGetSize   ILGetSize_local

Definition at line 638 of file shellclasses.h.

◆ NOVTABLE

#define NOVTABLE

Definition at line 58 of file shellclasses.h.

◆ path_from_pidl

#define path_from_pidl   path_from_pidlA

Definition at line 628 of file shellclasses.h.

◆ StrRet

#define StrRet   StrRetA

Definition at line 871 of file shellclasses.h.

◆ THROW_EXCEPTION

#define THROW_EXCEPTION (   hr)    throw COMException(hr, __FILE__, __LINE__)

Definition at line 161 of file shellclasses.h.

◆ UNION_MEMBER

#define UNION_MEMBER (   x)    x

Definition at line 861 of file shellclasses.h.

Function Documentation

◆ CheckError()

void CheckError ( HRESULT  hr)
inline

Definition at line 167 of file shellclasses.h.

168{
169 if (FAILED(hr))
170 throw COMException(hr);
171}
#define FAILED(hr)
Definition: intsafe.h:51
HRESULT hr
Definition: shlfolder.c:183
Exception with context information.
Definition: shellclasses.h:114

Referenced by ConnectionPoint< T >::ConnectionPoint(), EventConnection::EventConnection(), BrowserNavigator::navigated(), and FxIoTarget::SubmitLocked().

◆ GetDesktopFolder()

◆ HandleException()

void HandleException ( COMException e,
HWND  hwnd 
)

Exception Handler for COM exceptions.

Definition at line 93 of file shellclasses.cpp.

94{
95 String msg = e.toString();
96
97 SetLastError(0);
98
99 if (hwnd && !IsWindowVisible(hwnd))
100 hwnd = 0;
101
102 MessageBox(hwnd, msg, TEXT("ShellClasses Exception"), MB_ICONHAND|MB_OK);
103
104 // If displaying the error message box _with_ parent was not successfull, display it now without a parent window.
106 MessageBox(0, msg, TEXT("ShellClasses Exception"), MB_ICONHAND|MB_OK);
107}
#define msg(x)
Definition: auth_time.c:54
#define SetLastError(x)
Definition: compat.h:752
#define TEXT(s)
Definition: k32.h:26
#define e
Definition: ke_i.h:82
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFSTRING String
Definition: wdfdevice.h:2433
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
#define ERROR_INVALID_WINDOW_HANDLE
Definition: winerror.h:881
#define MB_ICONHAND
Definition: winuser.h:788
#define MB_OK
Definition: winuser.h:790
#define MessageBox
Definition: winuser.h:5831
BOOL WINAPI IsWindowVisible(_In_ HWND)

Referenced by PropertySheetDialog::DoModal(), explorer_main(), StartMenu::Init(), ShellBrowser::InsertSubitems(), Window::MessageLoop(), MainFrameBase::OpenShellFolders(), ShellDirectory::read_directory(), StartMenuRoot::TrackStartmenu(), and WebChildWindow::WndProc().

◆ ILGetSize_local()

UINT ILGetSize_local ( LPCITEMIDLIST  pidl)

Definition at line 428 of file shellclasses.cpp.

429{
430 if (!pidl)
431 return 0;
432
433 int l = sizeof(USHORT/*SHITEMID::cb*/);
434
435 while(pidl->mkid.cb) {
436 l += pidl->mkid.cb;
437 pidl = LPCITEMIDLIST((LPBYTE)pidl+pidl->mkid.cb);
438 }
439
440 return l;
441}
r l[0]
Definition: byte_order.h:168
unsigned short USHORT
Definition: pedump.c:61
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
Definition: shtypes.idl:42
unsigned char * LPBYTE
Definition: typedefs.h:53

◆ name_from_pidl()

HRESULT name_from_pidl ( IShellFolder folder,
LPCITEMIDLIST  pidl,
LPTSTR  buffer,
int  len,
SHGDNF  flags 
)

Definition at line 175 of file shellclasses.cpp.

176{
177 CONTEXT("name_from_pidl()");
178
179 StrRet str;
180
181 HRESULT hr = folder->GetDisplayNameOf(pidl, flags, &str);
182
183 if (SUCCEEDED(hr))
184 str.GetString(pidl->mkid, buffer, len);
185 else
186 buffer[0] = '\0';
187
188 return hr;
189}
GLuint buffer
Definition: glext.h:5915
GLbitfield flags
Definition: glext.h:7161
GLenum GLsizei len
Definition: glext.h:6722
#define SUCCEEDED(hr)
Definition: intsafe.h:50
struct _CONTEXT CONTEXT
const WCHAR * str
#define StrRet
Definition: shellclasses.h:871
Definition: fci.c:116

Referenced by ShellDirectory::read_directory().

◆ path_from_pidlA()

HRESULT path_from_pidlA ( IShellFolder folder,
LPCITEMIDLIST  pidl,
LPSTR  buffer,
int  len 
)

Definition at line 143 of file shellclasses.cpp.

144{
145 CONTEXT("path_from_pidlA()");
146
147 StrRetA str;
148
149 HRESULT hr = folder->GetDisplayNameOf(pidl, SHGDN_FORPARSING, &str);
150
151 if (SUCCEEDED(hr))
152 str.GetString(pidl->mkid, buffer, len);
153 else
154 buffer[0] = '\0';
155
156 return hr;
157}
easy retrieval of multi byte strings out of STRRET structures
Definition: shellclasses.h:880

◆ path_from_pidlW()

HRESULT path_from_pidlW ( IShellFolder folder,
LPCITEMIDLIST  pidl,
LPWSTR  buffer,
int  len 
)

Definition at line 159 of file shellclasses.cpp.

160{
161 CONTEXT("path_from_pidlW()");
162
163 StrRetW str;
164
165 HRESULT hr = folder->GetDisplayNameOf(pidl, SHGDN_FORPARSING, &str);
166
167 if (SUCCEEDED(hr))
168 str.GetString(pidl->mkid, buffer, len);
169 else
170 buffer[0] = '\0';
171
172 return hr;
173}
easy retrieval of wide char strings out of STRRET structures
Definition: shellclasses.h:906

◆ ShellFolderContextMenu()

HRESULT ShellFolderContextMenu ( IShellFolder shell_folder,
HWND  hwndParent,
int  cidl,
LPCITEMIDLIST ppidl,
int  x,
int  y,
CtxMenuInterfaces cm_ifs 
)

Definition at line 524 of file shellclasses.cpp.

526{
527 IContextMenu* pcm;
528
529 HRESULT hr = shell_folder->GetUIObjectOf(hwndParent, cidl, apidl, IID_IContextMenu, NULL, (LPVOID*)&pcm);
530// HRESULT hr = CDefFolderMenu_Create2(dir?dir->_pidl:DesktopFolder(), hwndParent, 1, &pidl, shell_folder, NULL, 0, NULL, &pcm);
531
532 if (SUCCEEDED(hr)) {
533 pcm = cm_ifs.query_interfaces(pcm);
534
536
537 if (hmenu) {
538 hr = pcm->QueryContextMenu(hmenu, 0, FCIDM_SHVIEWFIRST, FCIDM_SHVIEWLAST, CMF_NORMAL|CMF_EXPLORE);
539
540 if (SUCCEEDED(hr)) {
542
543 cm_ifs.reset();
544
545 if (idCmd) {
546 CMINVOKECOMMANDINFO cmi;
547
548 cmi.cbSize = sizeof(CMINVOKECOMMANDINFO);
549 cmi.fMask = 0;
550 cmi.hwnd = hwndParent;
551 cmi.lpVerb = (LPCSTR)(INT_PTR)(idCmd - FCIDM_SHVIEWFIRST);
552 cmi.lpParameters = NULL;
553 cmi.lpDirectory = NULL;
554 cmi.nShow = SW_SHOWNORMAL;
555 cmi.dwHotKey = 0;
556 cmi.hIcon = 0;
557
558 hr = pcm->InvokeCommand(&cmi);
559 }
560 } else
561 cm_ifs.reset();
563 }
564
565 pcm->Release();
566 }
567
568 return hr;
569}
static HWND hwndParent
Definition: cryptui.c:300
#define NULL
Definition: types.h:112
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
HRESULT GetUIObjectOf([in] HWND hwndOwner, [in] UINT cidl, [in, size_is(cidl)] PCUITEMID_CHILD_ARRAY apidl, [in] REFIID riid, [in, out, unique] UINT *prgfInOut, [out, iid_is(riid)] void **ppvOut)
nsrefcnt Release()
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:63
unsigned int UINT
Definition: ndis.h:50
#define FCIDM_SHVIEWFIRST
Definition: shlobj.h:580
#define FCIDM_SHVIEWLAST
Definition: shlobj.h:614
IContextMenu * query_interfaces(IContextMenu *pcm1)
int32_t INT_PTR
Definition: typedefs.h:64
static HMENU hmenu
Definition: win.c:66
#define SW_SHOWNORMAL
Definition: winuser.h:770
HMENU WINAPI CreatePopupMenu(void)
Definition: menu.c:838
#define TPM_RIGHTBUTTON
Definition: winuser.h:2380
#define TPM_LEFTALIGN
Definition: winuser.h:2377
BOOL WINAPI DestroyMenu(_In_ HMENU)
BOOL WINAPI TrackPopupMenu(_In_ HMENU, _In_ UINT, _In_ int, _In_ int, _Reserved_ int, _In_ HWND, _Reserved_ LPCRECT)
#define TPM_RETURNCMD
Definition: winuser.h:2387
const char * LPCSTR
Definition: xmlstorage.h:183

Referenced by Entry::do_context_menu(), ShellEntry::do_context_menu(), and DesktopShellView::DoContextMenu().