ReactOS  0.4.15-dev-425-gc40b086
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 45 of file explorerband.cpp.

◆ PT_SHELLEXT

#define PT_SHELLEXT   0x2E

Definition at line 46 of file explorerband.cpp.

◆ PT_YAGUID

#define PT_YAGUID   0x70

Definition at line 47 of file explorerband.cpp.

◆ UNIMPLEMENTED

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

Definition at line 29 of file explorerband.cpp.

Typedef Documentation

◆ LPPIDLDATA

◆ PIDLDATA

Function Documentation

◆ _ILIsSpecialFolder()

◆ _ReparsePIDL()

HRESULT _ReparsePIDL ( LPITEMIDLIST  buggyPidl,
LPITEMIDLIST cleanPidl 
)

Definition at line 89 of file explorerband.cpp.

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

59 {
60  IShellFolder *pShellFolder = NULL;
61  LPCITEMIDLIST pidlRelative = NULL;
62  STRRET str;
63  HRESULT hr;
64 
65  if (pidlDirectory == NULL || szDisplayName == NULL)
66  {
67  return E_FAIL;
68  }
69 
70  hr = SHBindToParent(pidlDirectory, IID_PPV_ARG(IShellFolder, &pShellFolder), &pidlRelative);
71 
72  if (SUCCEEDED(hr))
73  {
74  hr = pShellFolder->GetDisplayNameOf(pidlRelative,uFlags,&str);
75  if (SUCCEEDED(hr))
76  {
77  hr = StrRetToBuf(&str,pidlDirectory,szDisplayName,cchMax);
78  }
79  pShellFolder->Release();
80  }
81  return hr;
82 }
HRESULT hr
Definition: shlfolder.c:183
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
Definition: shtypes.idl:42
UINT uFlags
Definition: api.c:59
#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:78
UINT cchMax
HRESULT WINAPI SHBindToParent(LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppv, LPCITEMIDLIST *ppidlLast)
Definition: pidl.c:1331
#define SUCCEEDED(hr)
Definition: intsafe.h:57

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