ReactOS 0.4.15-dev-8138-g1e75ea8
explorerband.cpp File Reference
#include "precomp.h"
#include <commoncontrols.h>
#include <undocshell.h>
#include "utility.h"
Include dependency graph for explorerband.cpp:

Go to the source code of this file.

Classes

struct  _PIDLDATA
 

Macros

#define UNIMPLEMENTED   DbgPrint("%s is UNIMPLEMENTED!\n", __FUNCTION__)
 
#define PT_GUID   0x1F
 
#define PT_SHELLEXT   0x2E
 
#define PT_YAGUID   0x70
 

Typedefs

typedef struct _PIDLDATA PIDLDATA
 
typedef struct _PIDLDATALPPIDLDATA
 

Functions

static BOOL _ILIsSpecialFolder (LPCITEMIDLIST pidl)
 
HRESULT GetDisplayName (LPCITEMIDLIST pidlDirectory, TCHAR *szDisplayName, UINT cchMax, DWORD uFlags)
 
HRESULT _ReparsePIDL (LPITEMIDLIST buggyPidl, LPITEMIDLIST *cleanPidl)
 
static HRESULT GetCurrentLocationFromView (IShellView &View, PIDLIST_ABSOLUTE &pidl)
 

Macro Definition Documentation

◆ PT_GUID

#define PT_GUID   0x1F

Definition at line 46 of file explorerband.cpp.

◆ PT_SHELLEXT

#define PT_SHELLEXT   0x2E

Definition at line 47 of file explorerband.cpp.

◆ PT_YAGUID

#define PT_YAGUID   0x70

Definition at line 48 of file explorerband.cpp.

◆ UNIMPLEMENTED

#define UNIMPLEMENTED   DbgPrint("%s is UNIMPLEMENTED!\n", __FUNCTION__)

Definition at line 30 of file explorerband.cpp.

Typedef Documentation

◆ LPPIDLDATA

◆ PIDLDATA

Function Documentation

◆ _ILIsSpecialFolder()

◆ _ReparsePIDL()

HRESULT _ReparsePIDL ( LPITEMIDLIST  buggyPidl,
LPITEMIDLIST cleanPidl 
)

Definition at line 90 of file explorerband.cpp.

91{
92 HRESULT hr;
95 CComPtr<IEnumIDList> pEnumIDList;
96 LPITEMIDLIST childPidl;
97 LPITEMIDLIST correctChild;
98 LPITEMIDLIST correctParent;
99 ULONG fetched;
100 DWORD EnumFlags;
101
102
103 EnumFlags = SHCONTF_FOLDERS | SHCONTF_INCLUDEHIDDEN;
104 hr = SHBindToParent(buggyPidl, IID_PPV_ARG(IShellFolder, &folder), (LPCITEMIDLIST*)&childPidl);
105 *cleanPidl = NULL;
106 if (!SUCCEEDED(hr))
107 {
108 ERR("Can't bind to parent folder\n");
109 return hr;
110 }
111 hr = folder->QueryInterface(IID_PPV_ARG(IPersistFolder2, &persist));
112 if (!SUCCEEDED(hr))
113 {
114 ERR("PIDL doesn't belong to the shell namespace, aborting\n");
115 return hr;
116 }
117
118 hr = persist->GetCurFolder(&correctParent);
119 if (!SUCCEEDED(hr))
120 {
121 ERR("Unable to get current folder\n");
122 return hr;
123 }
124
125 hr = folder->EnumObjects(NULL,EnumFlags,&pEnumIDList);
126 // avoid broken IShellFolder implementations that return null pointer with success
127 if (!SUCCEEDED(hr) || !pEnumIDList)
128 {
129 ERR("Can't enum the folder !\n");
130 return hr;
131 }
132
133 while(SUCCEEDED(pEnumIDList->Next(1, &correctChild, &fetched)) && correctChild && fetched)
134 {
135 if (!folder->CompareIDs(0, childPidl, correctChild))
136 {
137 *cleanPidl = ILCombine(correctParent, correctChild);
138 ILFree(correctChild);
139 goto Cleanup;
140 }
141 ILFree(correctChild);
142 }
143Cleanup:
144 ILFree(correctParent);
145 return hr;
146}
#define ERR(fmt,...)
Definition: debug.h:113
#define NULL
Definition: types.h:112
static const WCHAR Cleanup[]
Definition: register.c:80
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SUCCEEDED(hr)
Definition: intsafe.h:50
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:940
LPITEMIDLIST WINAPI ILCombine(LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
Definition: pidl.c:712
HRESULT WINAPI SHBindToParent(LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppv, LPCITEMIDLIST *ppidlLast)
Definition: pidl.c:1350
HRESULT hr
Definition: shlfolder.c:183
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
Definition: shtypes.idl:42
Definition: fci.c:116
uint32_t ULONG
Definition: typedefs.h:59
#define IID_PPV_ARG(Itype, ppType)

Referenced by CExplorerBand::OnShellEvent().

◆ GetCurrentLocationFromView()

static HRESULT GetCurrentLocationFromView ( IShellView View,
PIDLIST_ABSOLUTE pidl 
)
static

Definition at line 265 of file explorerband.cpp.

266{
270 if (SUCCEEDED(hr) && SUCCEEDED(hr = pfv->GetFolder(IID_PPV_ARG(IShellFolder, &psf))))
271 hr = SHELL_GetIDListFromObject(psf, &pidl);
272 return hr;
273}
HRESULT SHELL_GetIDListFromObject(IUnknown *punk, PIDLIST_ABSOLUTE *ppidl)
Definition: utility.cpp:21
HRESULT QueryInterface([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)

Referenced by CExplorerBand::GetCurrentLocation().

◆ GetDisplayName()

HRESULT GetDisplayName ( LPCITEMIDLIST  pidlDirectory,
TCHAR szDisplayName,
UINT  cchMax,
DWORD  uFlags 
)

Definition at line 59 of file explorerband.cpp.

60{
61 IShellFolder *pShellFolder = NULL;
62 LPCITEMIDLIST pidlRelative = NULL;
63 STRRET str;
64 HRESULT hr;
65
66 if (pidlDirectory == NULL || szDisplayName == NULL)
67 {
68 return E_FAIL;
69 }
70
71 hr = SHBindToParent(pidlDirectory, IID_PPV_ARG(IShellFolder, &pShellFolder), &pidlRelative);
72
73 if (SUCCEEDED(hr))
74 {
75 hr = pShellFolder->GetDisplayNameOf(pidlRelative,uFlags,&str);
76 if (SUCCEEDED(hr))
77 {
78 hr = StrRetToBuf(&str,pidlDirectory,szDisplayName,cchMax);
79 }
80 pShellFolder->Release();
81 }
82 return hr;
83}
UINT cchMax
#define E_FAIL
Definition: ddrawi.h:102
UINT uFlags
Definition: api.c:59
HRESULT GetDisplayNameOf([in] PCUITEMID_CHILD pidl, [in] SHGDNF uFlags, [out] STRRET *lpName)
ULONG Release()
const WCHAR * str
#define StrRetToBuf
Definition: shlwapi.h:1769