ReactOS  0.4.14-dev-77-gd9e7c48
explorerband.cpp File Reference
#include "precomp.h"
#include <commoncontrols.h>
#include <undocshell.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)
 

Macro Definition Documentation

◆ PT_GUID

#define PT_GUID   0x1F

Definition at line 44 of file explorerband.cpp.

◆ PT_SHELLEXT

#define PT_SHELLEXT   0x2E

Definition at line 45 of file explorerband.cpp.

◆ PT_YAGUID

#define PT_YAGUID   0x70

Definition at line 46 of file explorerband.cpp.

◆ UNIMPLEMENTED

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

Definition at line 28 of file explorerband.cpp.

Typedef Documentation

◆ LPPIDLDATA

◆ PIDLDATA

Function Documentation

◆ _ILIsSpecialFolder()

◆ _ReparsePIDL()

HRESULT _ReparsePIDL ( LPITEMIDLIST  buggyPidl,
LPITEMIDLIST cleanPidl 
)

Definition at line 88 of file explorerband.cpp.

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

Referenced by CExplorerBand::OnShellEvent().

◆ GetDisplayName()

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

Definition at line 57 of file explorerband.cpp.

58 {
59  IShellFolder *pShellFolder = NULL;
60  LPCITEMIDLIST pidlRelative = NULL;
61  STRRET str;
62  HRESULT hr;
63 
64  if (pidlDirectory == NULL || szDisplayName == NULL)
65  {
66  return E_FAIL;
67  }
68 
69  hr = SHBindToParent(pidlDirectory, IID_PPV_ARG(IShellFolder, &pShellFolder), &pidlRelative);
70 
71  if (SUCCEEDED(hr))
72  {
73  hr = pShellFolder->GetDisplayNameOf(pidlRelative,uFlags,&str);
74  if (SUCCEEDED(hr))
75  {
76  hr = StrRetToBuf(&str,pidlDirectory,szDisplayName,cchMax);
77  }
78  pShellFolder->Release();
79  }
80  return hr;
81 }
HRESULT hr
Definition: shlfolder.c:183
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
Definition: shtypes.idl:42
UINT uFlags
Definition: api.c:60
#define IID_PPV_ARG(Itype, ppType)
#define E_FAIL
Definition: ddrawi.h:102
HRESULT GetDisplayNameOf([in] PCUITEMID_CHILD pidl, [in] SHGDNF uFlags, [out] STRRET *lpName)
#define StrRetToBuf
Definition: shlwapi.h:1769
ULONG Release()
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
LONG HRESULT
Definition: typedefs.h:77
UINT cchMax
HRESULT WINAPI SHBindToParent(LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppv, LPCITEMIDLIST *ppidlLast)
Definition: pidl.c:1323
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by CExplorerBand::CompareTreeItems(), and CExplorerBand::RenameItem().