ReactOS 0.4.15-dev-5895-g2687c1b
ShellPath Struct Reference

wrapper class for item ID lists More...

#include <shellclasses.h>

Inheritance diagram for ShellPath:
Collaboration diagram for ShellPath:

Public Types

typedef SShellPtr< ITEMIDLISTsuper
 

Public Member Functions

 ShellPath ()
 
 ShellPath (IShellFolder *folder, LPCWSTR path)
 
 ShellPath (LPCWSTR path)
 
 ShellPath (IShellFolder *folder, LPCSTR path)
 
 ShellPath (LPCSTR path)
 
 ShellPath (const ShellPath &o)
 
 ShellPath (LPITEMIDLIST p)
 
 ShellPath (LPCITEMIDLIST p)
 
void operator= (const ShellPath &o)
 
void operator= (ITEMIDLIST *p)
 
void operator= (const SHITEMID &o)
 
void operator+= (const SHITEMID &o)
 
void assign (LPCITEMIDLIST pidl, size_t size)
 
void assign (LPCITEMIDLIST pidl)
 
void split (ShellPath &parent, ShellPath &obj) const
 
void GetUIObjectOf (REFIID riid, LPVOID *ppvOut, HWND hWnd=0, ShellFolder &sf=GetDesktopFolder())
 
ShellFolder get_folder ()
 
ShellFolder get_folder (IShellFolder *parent)
 
ShellPath create_absolute_pidl (LPCITEMIDLIST parent_pidl) const
 
- Public Member Functions inherited from SShellPtr< ITEMIDLIST >
 ~SShellPtr ()
 
ITEMIDLISToperator-> ()
 
ITEMIDLIST constoperator-> () const
 
 operator ITEMIDLIST const * () const
 
const ITEMIDLISToperator* () const
 
ITEMIDLISToperator* ()
 

Friends

bool operator< (const ShellPath &a, const ShellPath &b)
 

Additional Inherited Members

- Protected Member Functions inherited from SShellPtr< ITEMIDLIST >
 SShellPtr ()
 
 SShellPtr (ITEMIDLIST *p)
 
void Free ()
 
- Protected Attributes inherited from SShellPtr< ITEMIDLIST >
ITEMIDLIST_p
 
ShellMalloc _malloc
 

Detailed Description

wrapper class for item ID lists

Definition at line 651 of file shellclasses.h.

Member Typedef Documentation

◆ super

Definition at line 653 of file shellclasses.h.

Constructor & Destructor Documentation

◆ ShellPath() [1/8]

ShellPath::ShellPath ( )
inline

Definition at line 655 of file shellclasses.h.

656 {
657 }

◆ ShellPath() [2/8]

ShellPath::ShellPath ( IShellFolder folder,
LPCWSTR  path 
)
inline

Definition at line 659 of file shellclasses.h.

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 }
#define NULL
Definition: types.h:112
static LPOLESTR
Definition: stg_prop.c:27
struct _CONTEXT CONTEXT
#define CHECKERROR(hr)
Definition: shellclasses.h:162
Definition: fci.c:116

◆ ShellPath() [3/8]

ShellPath::ShellPath ( LPCWSTR  path)
inline

Definition at line 669 of file shellclasses.h.

670 {
671 OBJ_CONTEXT("ShellPath::ShellPath(LPCWSTR)", path);
672
673 if (path)
675 else
676 _p = NULL;
677 }
static IParseDisplayName ParseDisplayName
Definition: moniker.c:816
ShellFolder & GetDesktopFolder()

◆ ShellPath() [4/8]

ShellPath::ShellPath ( IShellFolder folder,
LPCSTR  path 
)
inline

Definition at line 679 of file shellclasses.h.

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 }
#define CP_ACP
Definition: compat.h:109
#define MAX_PATH
Definition: compat.h:34
#define MultiByteToWideChar
Definition: compat.h:110
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
#define COUNTOF(x)
Definition: utility.h:93
__wchar_t WCHAR
Definition: xmlstorage.h:180

◆ ShellPath() [5/8]

ShellPath::ShellPath ( LPCSTR  path)
inline

Definition at line 692 of file shellclasses.h.

693 {
694 CONTEXT("ShellPath::ShellPath(LPCSTR)");
695
697
698 if (path) {
701 } else
702 _p = NULL;
703 }

◆ ShellPath() [6/8]

ShellPath::ShellPath ( const ShellPath o)
inline

Definition at line 705 of file shellclasses.h.

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 }
r l[0]
Definition: byte_order.h:167
LPVOID Alloc([in] SIZE_T cb)
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define ILGetSize
Definition: shellclasses.h:638
SShellPtr< ITEMIDLIST > super
Definition: shellclasses.h:653

◆ ShellPath() [7/8]

ShellPath::ShellPath ( LPITEMIDLIST  p)
inlineexplicit

Definition at line 717 of file shellclasses.h.

718 : super(p)
719 {
720 }
GLfloat GLfloat p
Definition: glext.h:8902

◆ ShellPath() [8/8]

ShellPath::ShellPath ( LPCITEMIDLIST  p)
inline

Definition at line 722 of file shellclasses.h.

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 }

Member Function Documentation

◆ assign() [1/2]

void ShellPath::assign ( LPCITEMIDLIST  pidl)
inline

Definition at line 822 of file shellclasses.h.

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 }
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
void Free([in] LPVOID pv)

◆ assign() [2/2]

void ShellPath::assign ( LPCITEMIDLIST  pidl,
size_t  size 
)
inline

Definition at line 806 of file shellclasses.h.

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 }
GLsizeiptr size
Definition: glext.h:5919
unsigned short USHORT
Definition: pedump.c:61
unsigned char * LPBYTE
Definition: typedefs.h:53

Referenced by MDIMainFrame::WndProc(), and SDIMainFrame::WndProc().

◆ create_absolute_pidl()

ShellPath ShellPath::create_absolute_pidl ( LPCITEMIDLIST  parent_pidl) const

Definition at line 404 of file shellclasses.cpp.

405{
406 CONTEXT("ShellPath::create_absolute_pidl()");
407
408 static DynamicFct<LPITEMIDLIST(WINAPI*)(LPCITEMIDLIST, LPCITEMIDLIST)> ILCombine(TEXT("SHELL32"), 25);
409
410 if (ILCombine)
411 return (*ILCombine)(parent_pidl, _p);
412
413 // create a new item id list with _p append behind parent_pidl
414 int l1 = ILGetSize(parent_pidl) - sizeof(USHORT/*SHITEMID::cb*/);
415 int l2 = ILGetSize(_p);
416
418
419 memcpy(p, parent_pidl, l1);
420 memcpy((LPBYTE)p+l1, _p, l2);
421
422 return p;
423}
#define TEXT(s)
Definition: k32.h:26
LPITEMIDLIST WINAPI ILCombine(LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
Definition: pidl.c:699
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
Definition: shtypes.idl:42
#define WINAPI
Definition: msvc.h:6

Referenced by ShellEntry::create_absolute_pidl(), and MainFrameBase::OpenShellFolders().

◆ get_folder() [1/2]

ShellFolder ShellPath::get_folder ( )
inline

Definition at line 842 of file shellclasses.h.

843 {
844 return ShellFolder(_p);
845 }
IShellFolder smart pointer.
Definition: shellclasses.h:594

◆ get_folder() [2/2]

ShellFolder ShellPath::get_folder ( IShellFolder parent)
inline

Definition at line 847 of file shellclasses.h.

848 {
849 CONTEXT("ShellPath::get_folder()");
850 return ShellFolder(parent, _p);
851 }
r parent
Definition: btrfs.c:3010

◆ GetUIObjectOf()

void ShellPath::GetUIObjectOf ( REFIID  riid,
LPVOID ppvOut,
HWND  hWnd = 0,
ShellFolder sf = GetDesktopFolder() 
)

Definition at line 362 of file shellclasses.cpp.

363{
364 CONTEXT("ShellPath::GetUIObjectOf()");
365
367
368 split(parent, obj);
369
370 LPCITEMIDLIST idl = obj;
371
372 if (parent && parent->mkid.cb)
373 // use the IShellFolder of the parent
374 CHECKERROR(ShellFolder((IShellFolder*)sf,parent)->GetUIObjectOf(hWnd, 1, &idl, riid, 0, ppvOut));
375 else // else use desktop folder
376 CHECKERROR(sf->GetUIObjectOf(hWnd, 1, &idl, riid, 0, ppvOut));
377}
HWND hWnd
Definition: settings.c:17
REFIID riid
Definition: atlbase.h:39
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)
wrapper class for item ID lists
Definition: shellclasses.h:652
void GetUIObjectOf(REFIID riid, LPVOID *ppvOut, HWND hWnd=0, ShellFolder &sf=GetDesktopFolder())
void split(ShellPath &parent, ShellPath &obj) const

Referenced by GetUIObjectOf().

◆ operator+=()

void ShellPath::operator+= ( const SHITEMID o)
inline

Definition at line 779 of file shellclasses.h.

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 }
WORD * PWORD
Definition: pedump.c:67
WORD cb
Definition: shtypes.idl:27

◆ operator=() [1/3]

void ShellPath::operator= ( const ShellPath o)
inline

Definition at line 733 of file shellclasses.h.

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 }

◆ operator=() [2/3]

void ShellPath::operator= ( const SHITEMID o)
inline

Definition at line 768 of file shellclasses.h.

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 }

◆ operator=() [3/3]

void ShellPath::operator= ( ITEMIDLIST p)
inline

Definition at line 751 of file shellclasses.h.

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 }

◆ split()

void ShellPath::split ( ShellPath parent,
ShellPath obj 
) const

Definition at line 340 of file shellclasses.cpp.

341{
342 SHITEMID *piid, *piidLast;
343 int size = 0;
344
345 // find last item-id and calculate total size of pidl
346 for(piid=piidLast=&_p->mkid; piid->cb; ) {
347 piidLast = piid;
348 size += (piid->cb);
349 piid = (SHITEMID*)((LPBYTE)piid + (piid->cb));
350 }
351
352 // copy parent folder portion
353 size -= piidLast->cb; // don't count "object" item-id
354
355 if (size > 0)
356 parent.assign(_p, size);
357
358 // copy "object" portion
359 obj.assign((ITEMIDLIST*)piidLast, piidLast->cb);
360}
SHITEMID mkid
Definition: shtypes.idl:34

Referenced by ShellDirectory::get_path(), and GetUIObjectOf().

Friends And Related Function Documentation

◆ operator<

bool operator< ( const ShellPath a,
const ShellPath b 
)
friend

Definition at line 794 of file shellclasses.h.

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 }
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
#define min(a, b)
Definition: monoChain.cc:55

The documentation for this struct was generated from the following files: