ReactOS  0.4.13-dev-257-gfabbd7c
shfldr.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  shvheader
 

Macros

#define CHARS_IN_GUID   39
 
#define GET_SHGDN_FOR(dwFlags)   ((DWORD)dwFlags & (DWORD)0x0000FF00)
 
#define GET_SHGDN_RELATION(dwFlags)   ((DWORD)dwFlags & (DWORD)0x000000FF)
 

Functions

LPCWSTR GetNextElementW (LPCWSTR pszNext, LPWSTR pszOut, DWORD dwOut)
 
HRESULT SHELL32_ParseNextElement (IShellFolder2 *psf, HWND hwndOwner, LPBC pbc, LPITEMIDLIST *pidlInOut, LPOLESTR szNext, DWORD *pEaten, DWORD *pdwAttributes)
 
HRESULT SHELL32_GetDisplayNameOfChild (IShellFolder2 *psf, LPCITEMIDLIST pidl, DWORD dwFlags, LPSTRRET strRet)
 
LPITEMIDLIST SHELL32_CreatePidlFromBindCtx (IBindCtx *pbc, LPCWSTR path)
 
HRESULT SHELL32_GetFSItemAttributes (IShellFolder *psf, LPCITEMIDLIST pidl, LPDWORD pdwAttributes)
 
HRESULT SHELL32_CompareDetails (IShellFolder2 *isf, LPARAM lParam, LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
 
HRESULT SHELL32_CompareChildren (IShellFolder2 *psf, LPARAM lParam, LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
 
HRESULT SHELL32_BindToSF (LPCITEMIDLIST pidlRoot, PERSIST_FOLDER_TARGET_INFO *ppfti, LPCITEMIDLIST pidl, const GUID *clsid, REFIID riid, LPVOID *ppvOut)
 
BOOL HCR_RegOpenClassIDKey (REFIID riid, HKEY *hkey)
 
void AddFSClassKeysToArray (PCUITEMID_CHILD pidl, HKEY *array, UINT *cKeys)
 
HRESULT CDefViewBckgrndMenu_CreateInstance (IShellFolder *psf, REFIID riid, void **ppv)
 
HRESULT SH_GetApidlFromDataObject (IDataObject *pDataObject, PIDLIST_ABSOLUTE *ppidlfolder, PUITEMID_CHILD **apidlItems, UINT *pcidl)
 
static __inline int SHELL32_GUIDToStringA (REFGUID guid, LPSTR str)
 
static __inline int SHELL32_GUIDToStringW (REFGUID guid, LPWSTR str)
 
void SHELL_FS_ProcessDisplayFilename (LPWSTR szPath, DWORD dwFlags)
 
BOOL SHELL_FS_HideExtension (LPWSTR pwszPath)
 
void AddClassKeyToArray (const WCHAR *szClass, HKEY *array, UINT *cKeys)
 

Macro Definition Documentation

◆ CHARS_IN_GUID

#define CHARS_IN_GUID   39

Definition at line 27 of file shfldr.h.

◆ GET_SHGDN_FOR

#define GET_SHGDN_FOR (   dwFlags)    ((DWORD)dwFlags & (DWORD)0x0000FF00)

Definition at line 36 of file shfldr.h.

◆ GET_SHGDN_RELATION

#define GET_SHGDN_RELATION (   dwFlags)    ((DWORD)dwFlags & (DWORD)0x000000FF)

Definition at line 37 of file shfldr.h.

Function Documentation

◆ AddClassKeyToArray()

void AddClassKeyToArray ( const WCHAR szClass,
HKEY array,
UINT cKeys 
)

Definition at line 267 of file shlfolder.cpp.

268 {
269  if (*cKeys >= 16)
270  return;
271 
272  HKEY hkey;
274  if (result != ERROR_SUCCESS)
275  return;
276 
277  array[*cKeys] = hkey;
278  *cKeys += 1;
279 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define KEY_READ
Definition: nt_native.h:1023
static LSTATUS(WINAPI *pRegDeleteTreeW)(HKEY
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3381
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10
GLuint64EXT * result
Definition: glext.h:11304

Referenced by AddFSClassKeysToArray(), CDrivesContextMenu_CreateInstance(), CGuidItemContextMenu_CreateInstance(), CDrivesFolder::CreateViewObject(), CDesktopFolder::CreateViewObject(), CFSFolder::CreateViewObject(), and CNetFolder::GetUIObjectOf().

◆ AddFSClassKeysToArray()

void AddFSClassKeysToArray ( PCUITEMID_CHILD  pidl,
HKEY array,
UINT cKeys 
)

Definition at line 281 of file shlfolder.cpp.

282 {
283  if (_ILIsValue(pidl))
284  {
285  FileStructW* pFileData = _ILGetFileStructW(pidl);
286  LPWSTR extension = PathFindExtension(pFileData->wszName);
287 
288  if (extension)
289  {
290  AddClassKeyToArray(extension, array, cKeys);
291 
292  WCHAR wszClass[MAX_PATH], wszClass2[MAX_PATH];
293  DWORD dwSize = sizeof(wszClass);
294  if (RegGetValueW(HKEY_CLASSES_ROOT, extension, NULL, RRF_RT_REG_SZ, NULL, wszClass, &dwSize) == ERROR_SUCCESS)
295  {
296  swprintf(wszClass2, L"%s//%s", extension, wszClass);
297 
298  AddClassKeyToArray(wszClass, array, cKeys);
299  AddClassKeyToArray(wszClass2, array, cKeys);
300  }
301 
302  swprintf(wszClass2, L"SystemFileAssociations//%s", extension);
303  AddClassKeyToArray(wszClass2, array, cKeys);
304 
305  if (RegGetValueW(HKEY_CLASSES_ROOT, extension, L"PerceivedType ", RRF_RT_REG_SZ, NULL, wszClass, &dwSize) == ERROR_SUCCESS)
306  {
307  swprintf(wszClass2, L"SystemFileAssociations//%s", wszClass);
308  AddClassKeyToArray(wszClass2, array, cKeys);
309  }
310  }
311 
312  AddClassKeyToArray(L"AllFilesystemObjects", array, cKeys);
313  AddClassKeyToArray(L"*", array, cKeys);
314  }
315  else if (_ILIsFolder(pidl))
316  {
317  AddClassKeyToArray(L"AllFilesystemObjects", array, cKeys);
318  AddClassKeyToArray(L"Directory", array, cKeys);
319  AddClassKeyToArray(L"Folder", array, cKeys);
320  }
321  else
322  {
323  ERR("Got non FS pidl\n");
324  }
325 }
LSTATUS WINAPI RegGetValueW(HKEY hKey, LPCWSTR pszSubKey, LPCWSTR pszValue, DWORD dwFlags, LPDWORD pdwType, PVOID pvData, LPDWORD pcbData)
Definition: reg.c:1975
#define ERROR_SUCCESS
Definition: deptool.c:10
WCHAR wszName[1]
Definition: shlfolder.c:1555
void AddClassKeyToArray(const WCHAR *szClass, HKEY *array, UINT *cKeys)
Definition: shlfolder.cpp:267
#define RRF_RT_REG_SZ
Definition: driver.c:575
BOOL _ILIsFolder(LPCITEMIDLIST pidl)
Definition: pidl.c:1951
smooth NULL
Definition: ftsmooth.c:416
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
#define swprintf(buf, format,...)
Definition: sprintf.c:56
unsigned long DWORD
Definition: ntddk_ex.h:95
#define PathFindExtension
Definition: shlwapi.h:907
static const WCHAR L[]
Definition: oid.c:1250
BOOL _ILIsValue(LPCITEMIDLIST pidl)
Definition: pidl.c:1960
#define ERR(fmt,...)
Definition: debug.h:109
FileStructW * _ILGetFileStructW(LPCITEMIDLIST pidl)
Definition: pidl.c:2336
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10
WCHAR * LPWSTR
Definition: xmlstorage.h:184
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54

Referenced by CDesktopFolder::GetUIObjectOf(), and CFSFolder::GetUIObjectOf().

◆ CDefViewBckgrndMenu_CreateInstance()

HRESULT CDefViewBckgrndMenu_CreateInstance ( IShellFolder psf,
REFIID  riid,
void **  ppv 
)

Definition at line 333 of file CDefViewBckgrndMenu.cpp.

334 {
335  return ShellObjectCreatorInit<CDefViewBckgrndMenu>(psf, riid, ppv);
336 }
REFIID riid
Definition: precomp.h:44
REFIID LPVOID * ppv
Definition: atlbase.h:39

Referenced by CDefView::GetItemObject().

◆ GetNextElementW()

LPCWSTR GetNextElementW ( LPCWSTR  pszNext,
LPWSTR  pszOut,
DWORD  dwOut 
)

Definition at line 43 of file shlfolder.cpp.

44 {
45  LPCWSTR pszTail = pszNext;
46  DWORD dwCopy;
47 
48  TRACE ("(%s %p 0x%08x)\n", debugstr_w (pszNext), pszOut, dwOut);
49 
50  *pszOut = 0x0000;
51 
52  if (!pszNext || !*pszNext)
53  return NULL;
54 
55  while (*pszTail && (*pszTail != (WCHAR) '\\'))
56  pszTail++;
57 
58  dwCopy = pszTail - pszNext + 1;
59  lstrcpynW (pszOut, pszNext, (dwOut < dwCopy) ? dwOut : dwCopy);
60 
61  if (*pszTail)
62  pszTail++;
63  else
64  pszTail = NULL;
65 
66  TRACE ("--(%s %s 0x%08x %p)\n", debugstr_w (pszNext), debugstr_w (pszOut), dwOut, pszTail);
67  return pszTail;
68 }
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define lstrcpynW
Definition: compat.h:397
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95

Referenced by CFSFolder::ParseDisplayName().

◆ HCR_RegOpenClassIDKey()

BOOL HCR_RegOpenClassIDKey ( REFIID  riid,
HKEY hkey 
)

Definition at line 233 of file classes.c.

234 {
235  char xriid[50];
236  sprintf( xriid, "CLSID\\{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
237  riid->Data1, riid->Data2, riid->Data3,
238  riid->Data4[0], riid->Data4[1], riid->Data4[2], riid->Data4[3],
239  riid->Data4[4], riid->Data4[5], riid->Data4[6], riid->Data4[7] );
240 
241  TRACE("%s\n",xriid );
242 
243  return !RegOpenKeyExA(HKEY_CLASSES_ROOT, xriid, 0, KEY_READ, hkey);
244 }
#define KEY_READ
Definition: nt_native.h:1023
REFIID riid
Definition: precomp.h:44
LONG WINAPI RegOpenKeyExA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey, _In_ DWORD ulOptions, _In_ REGSAM samDesired, _Out_ PHKEY phkResult)
Definition: reg.c:3346
#define sprintf(buf, format,...)
Definition: sprintf.c:55
#define TRACE(s)
Definition: solgame.cpp:4
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10

Referenced by CRegFolder::GetDetailsOf(), CRegFolder::GetDisplayNameOf(), HCR_GetClassNameA(), and HCR_GetClassNameW().

◆ SH_GetApidlFromDataObject()

HRESULT SH_GetApidlFromDataObject ( IDataObject pDataObject,
PIDLIST_ABSOLUTE ppidlfolder,
PUITEMID_CHILD **  apidlItems,
UINT pcidl 
)

Definition at line 327 of file shlfolder.cpp.

328 {
330  if (!cfShellIDList)
331  return E_FAIL;
332 
333  FORMATETC fmt;
334  InitFormatEtc (fmt, cfShellIDList, TYMED_HGLOBAL);
335 
336  HRESULT hr = pDataObject->QueryGetData(&fmt);
337  if (FAILED_UNEXPECTEDLY(hr))
338  return hr;
339 
340  STGMEDIUM medium;
341  hr = pDataObject->GetData(&fmt, &medium);
342  if (FAILED_UNEXPECTEDLY(hr))
343  return hr;
344 
345  /* lock the handle */
346  LPIDA lpcida = (LPIDA)GlobalLock(medium.hGlobal);
347  if (!lpcida)
348  {
349  ReleaseStgMedium(&medium);
350  return E_FAIL;
351  }
352 
353  /* convert the data into pidl */
354  LPITEMIDLIST pidl;
355  LPITEMIDLIST *apidl = _ILCopyCidaToaPidl(&pidl, lpcida);
356  if (!apidl)
357  {
358  ReleaseStgMedium(&medium);
359  return E_OUTOFMEMORY;
360  }
361 
362  *ppidlfolder = pidl;
363  *apidlItems = apidl;
364  *pcidl = lpcida->cidl;
365 
366  ReleaseStgMedium(&medium);
367  return S_OK;
368 }
#define CFSTR_SHELLIDLIST
Definition: shlobj.h:469
HRESULT hr
Definition: shlfolder.c:183
#define InitFormatEtc(fe, cf, med)
Definition: editor.h:33
void WINAPI ReleaseStgMedium(STGMEDIUM *pmedium)
Definition: ole2.c:2036
UINT WINAPI RegisterClipboardFormatW(_In_ LPCWSTR)
const char * fmt
Definition: wsprintf.c:30
HRESULT GetData([in, unique] FORMATETC *pformatetcIn, [out] STGMEDIUM *pmedium)
#define E_FAIL
Definition: ddrawi.h:102
LPITEMIDLIST * _ILCopyCidaToaPidl(LPITEMIDLIST *pidl, const CIDA *cida)
Definition: pidl.c:2659
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
LONG HRESULT
Definition: typedefs.h:77
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:35
struct CIDA * LPIDA
UINT cidl
Definition: shlobj.h:491
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
#define S_OK
Definition: intsafe.h:59
HRESULT QueryGetData([in, unique] FORMATETC *pformatetc)
unsigned int UINT
Definition: ndis.h:50
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
Definition: dsound.c:943
Definition: shlobj.h:490

Referenced by CFSDropTarget::_RepositionItems(), DrivesContextMenuCallback(), RegFolderContextMenuCallback(), and Shell_DefaultContextMenuCallBack().

◆ SHELL32_BindToSF()

HRESULT SHELL32_BindToSF ( LPCITEMIDLIST  pidlRoot,
PERSIST_FOLDER_TARGET_INFO *  ppfti,
LPCITEMIDLIST  pidl,
const GUID clsid,
REFIID  riid,
LPVOID ppvOut 
)

Definition at line 159 of file shlfolder.cpp.

161 {
162  PITEMID_CHILD pidlChild = ILCloneFirst (pidl);
163  if (!pidlChild)
164  return E_FAIL;
165 
167  HRESULT hr = SHELL32_CoCreateInitSF(pidlRoot,
168  ppfti,
169  pidlChild,
170  clsid,
171  IID_PPV_ARG(IShellFolder, &psf));
172  ILFree(pidlChild);
173 
174  if (FAILED_UNEXPECTEDLY(hr))
175  return hr;
176 
177  if (_ILIsPidlSimple (pidl))
178  return psf->QueryInterface(riid, ppvOut);
179  else
180  return psf->BindToObject(ILGetNext (pidl), NULL, riid, ppvOut);
181 }
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:925
HRESULT hr
Definition: shlfolder.c:183
REFIID riid
Definition: precomp.h:44
LPITEMIDLIST WINAPI ILGetNext(LPCITEMIDLIST pidl)
Definition: pidl.c:851
#define IID_PPV_ARG(Itype, ppType)
#define E_FAIL
Definition: ddrawi.h:102
smooth NULL
Definition: ftsmooth.c:416
HRESULT SHELL32_CoCreateInitSF(LPCITEMIDLIST pidlRoot, PERSIST_FOLDER_TARGET_INFO *ppfti, LPCITEMIDLIST pidlChild, const GUID *clsid, REFIID riid, LPVOID *ppvOut)
Definition: shlfolder.cpp:121
BOOL WINAPI _ILIsPidlSimple(LPCITEMIDLIST pidl)
LONG HRESULT
Definition: typedefs.h:77
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:35
REFCLSID clsid
Definition: msctf.c:84
LPITEMIDLIST WINAPI ILCloneFirst(LPCITEMIDLIST pidl)
Definition: pidl.c:253

Referenced by CNetFolder::BindToObject(), CDrivesFolder::BindToObject(), CFSFolder::BindToObject(), and CRegFolder::BindToObject().

◆ SHELL32_CompareChildren()

HRESULT SHELL32_CompareChildren ( IShellFolder2 psf,
LPARAM  lParam,
LPCITEMIDLIST  pidl1,
LPCITEMIDLIST  pidl2 
)

Definition at line 215 of file shlfolder.cpp.

216 {
217  PUIDLIST_RELATIVE nextpidl1 = ILGetNext (pidl1);
218  PUIDLIST_RELATIVE nextpidl2 = ILGetNext (pidl2);
219 
220  bool isEmpty1 = _ILIsDesktop(nextpidl1);
221  bool isEmpty2 = _ILIsDesktop(nextpidl2);
222  if (isEmpty1 || isEmpty2)
223  return MAKE_COMPARE_HRESULT(isEmpty2 - isEmpty1);
224 
225  PITEMID_CHILD firstpidl = ILCloneFirst (pidl1);
226  if (!firstpidl)
227  return E_OUTOFMEMORY;
228 
230  HRESULT hr = psf->BindToObject(firstpidl, 0, IID_PPV_ARG(IShellFolder, &psf2));
231  ILFree(firstpidl);
232  if (FAILED(hr))
233  return MAKE_COMPARE_HRESULT(0);
234 
235  return psf2->CompareIDs(lParam, nextpidl1, nextpidl2);
236 }
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:925
HRESULT hr
Definition: shlfolder.c:183
LPITEMIDLIST WINAPI ILGetNext(LPCITEMIDLIST pidl)
Definition: pidl.c:851
ITEMIDLIST_RELATIVE UNALIGNED * PUIDLIST_RELATIVE
Definition: shtypes.idl:55
#define MAKE_COMPARE_HRESULT(x)
Definition: shellutils.h:380
#define IID_PPV_ARG(Itype, ppType)
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
HRESULT BindToObject([in] PCUIDLIST_RELATIVE pidl, [in] LPBC pbcReserved, [in] REFIID riid, [out, iid_is(riid)] void **ppvOut)
BOOL _ILIsDesktop(LPCITEMIDLIST pidl)
Definition: CBandSite.h:24
LONG HRESULT
Definition: typedefs.h:77
LPITEMIDLIST WINAPI ILCloneFirst(LPCITEMIDLIST pidl)
Definition: pidl.c:253
LPARAM lParam
Definition: combotst.c:139

Referenced by CDrivesFolder::CompareIDs(), CFSFolder::CompareIDs(), CRegFolder::CompareIDs(), and SHELL32_CompareDetails().

◆ SHELL32_CompareDetails()

HRESULT SHELL32_CompareDetails ( IShellFolder2 isf,
LPARAM  lParam,
LPCITEMIDLIST  pidl1,
LPCITEMIDLIST  pidl2 
)

Definition at line 238 of file shlfolder.cpp.

239 {
241  WCHAR wszItem1[MAX_PATH], wszItem2[MAX_PATH];
242  HRESULT hres;
243 
244  hres = isf->GetDetailsOf(pidl1, lParam, &sd);
245  if (FAILED(hres))
246  return MAKE_COMPARE_HRESULT(1);
247 
248  hres = StrRetToBufW(&sd.str, pidl1, wszItem1, MAX_PATH);
249  if (FAILED(hres))
250  return MAKE_COMPARE_HRESULT(1);
251 
252  hres = isf->GetDetailsOf(pidl2, lParam, &sd);
253  if (FAILED(hres))
254  return MAKE_COMPARE_HRESULT(1);
255 
256  hres = StrRetToBufW(&sd.str, pidl2, wszItem2, MAX_PATH);
257  if (FAILED(hres))
258  return MAKE_COMPARE_HRESULT(1);
259 
260  int ret = wcsicmp(wszItem1, wszItem2);
261  if (ret == 0)
262  return SHELL32_CompareChildren(isf, lParam, pidl1, pidl2);
263 
264  return MAKE_COMPARE_HRESULT(ret);
265 }
HRESULT WINAPI StrRetToBufW(LPSTRRET src, const ITEMIDLIST *pidl, LPWSTR dest, UINT len)
Definition: string.c:1522
#define MAKE_COMPARE_HRESULT(x)
Definition: shellutils.h:380
HRESULT SHELL32_CompareChildren(IShellFolder2 *psf, LPARAM lParam, LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
Definition: shlfolder.cpp:215
HRESULT GetDetailsOf([in] PCUITEMID_CHILD pidl, [in] UINT iColumn, [out] SHELLDETAILS *psd)
HRESULT hres
Definition: protocol.c:465
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
#define MAX_PATH
Definition: compat.h:26
static const WCHAR sd[]
Definition: suminfo.c:287
int ret
#define wcsicmp
Definition: string.h:1152
LPARAM lParam
Definition: combotst.c:139

Referenced by CControlPanelFolder::CompareIDs(), CDrivesFolder::CompareIDs(), CPrinterFolder::CompareIDs(), CFSFolder::CompareIDs(), and CRegFolder::CompareIDs().

◆ SHELL32_CreatePidlFromBindCtx()

LPITEMIDLIST SHELL32_CreatePidlFromBindCtx ( IBindCtx pbc,
LPCWSTR  path 
)

Definition at line 460 of file CFSFolder.cpp.

461 {
463  LPITEMIDLIST pidl = NULL;
464  IUnknown *param = NULL;
465  WIN32_FIND_DATAW wfd;
466  HRESULT r;
467 
468  TRACE("%p %s\n", pbc, debugstr_w(path));
469 
470  if (!pbc)
471  return NULL;
472 
473  /* see if the caller bound File System Bind Data */
474  r = pbc->GetObjectParam((LPOLESTR)STR_FILE_SYS_BIND_DATA, &param);
475  if (FAILED(r))
476  return NULL;
477 
478  r = param->QueryInterface(IID_PPV_ARG(IFileSystemBindData,&fsbd));
479  if (SUCCEEDED(r))
480  {
481  r = fsbd->GetFindData(&wfd);
482  if (SUCCEEDED(r))
483  {
484  lstrcpynW(&wfd.cFileName[0], path, MAX_PATH);
485  pidl = _ILCreateFromFindDataW(&wfd);
486  }
487  fsbd->Release();
488  }
489 
490  return pidl;
491 }
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
static LPOLESTR
Definition: stg_prop.c:27
HRESULT GetFindData([out] WIN32_FIND_DATAW *pfd)
#define IID_PPV_ARG(Itype, ppType)
#define lstrcpynW
Definition: compat.h:397
#define debugstr_w
Definition: kernel32.h:32
ULONG Release()
smooth NULL
Definition: ftsmooth.c:416
HRESULT GetObjectParam([in] LPOLESTR pszKey, [out] IUnknown **ppunk)
static IFileSystemBindData fsbd
Definition: shlfolder.c:4672
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
GLfloat param
Definition: glext.h:5796
#define MAX_PATH
Definition: compat.h:26
Definition: services.c:325
LPITEMIDLIST _ILCreateFromFindDataW(const WIN32_FIND_DATAW *wfd)
Definition: pidl.c:1727
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by CDesktopFolder::ParseDisplayName(), and CFSFolder::ParseDisplayName().

◆ SHELL32_GetDisplayNameOfChild()

HRESULT SHELL32_GetDisplayNameOfChild ( IShellFolder2 psf,
LPCITEMIDLIST  pidl,
DWORD  dwFlags,
LPSTRRET  strRet 
)

Definition at line 197 of file shlfolder.cpp.

199 {
200  LPITEMIDLIST pidlFirst = ILCloneFirst(pidl);
201  if (!pidlFirst)
202  return E_OUTOFMEMORY;
203 
204  CComPtr<IShellFolder> psfChild;
205  HRESULT hr = psf->BindToObject(pidlFirst, NULL, IID_PPV_ARG(IShellFolder, &psfChild));
206  if (SUCCEEDED (hr))
207  {
208  hr = psfChild->GetDisplayNameOf(ILGetNext (pidl), dwFlags, strRet);
209  }
210  ILFree (pidlFirst);
211 
212  return hr;
213 }
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:925
HRESULT hr
Definition: shlfolder.c:183
LPITEMIDLIST WINAPI ILGetNext(LPCITEMIDLIST pidl)
Definition: pidl.c:851
#define IID_PPV_ARG(Itype, ppType)
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
smooth NULL
Definition: ftsmooth.c:416
HRESULT BindToObject([in] PCUIDLIST_RELATIVE pidl, [in] LPBC pbcReserved, [in] REFIID riid, [out, iid_is(riid)] void **ppvOut)
LONG HRESULT
Definition: typedefs.h:77
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
LPITEMIDLIST WINAPI ILCloneFirst(LPCITEMIDLIST pidl)
Definition: pidl.c:253
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by CDrivesFolder::GetDisplayNameOf(), CDesktopFolder::GetDisplayNameOf(), CFSFolder::GetDisplayNameOf(), and CRegFolder::GetDisplayNameOf().

◆ SHELL32_GetFSItemAttributes()

HRESULT SHELL32_GetFSItemAttributes ( IShellFolder psf,
LPCITEMIDLIST  pidl,
LPDWORD  pdwAttributes 
)

Definition at line 511 of file CFSFolder.cpp.

512 {
513  DWORD dwFileAttributes, dwShellAttributes;
514 
515  if (!_ILIsFolder(pidl) && !_ILIsValue(pidl))
516  {
517  ERR("Got wrong type of pidl!\n");
518  *pdwAttributes &= SFGAO_CANLINK;
519  return S_OK;
520  }
521 
523 
524  /* Set common attributes */
525  dwShellAttributes = SFGAO_CANCOPY | SFGAO_CANMOVE | SFGAO_CANLINK | SFGAO_CANRENAME | SFGAO_CANDELETE |
526  SFGAO_HASPROPSHEET | SFGAO_DROPTARGET | SFGAO_FILESYSTEM;
527 
529  dwShellAttributes |= (SFGAO_FOLDER | SFGAO_HASSUBFOLDER | SFGAO_FILESYSANCESTOR | SFGAO_STORAGEANCESTOR | SFGAO_STORAGE);
530  else
531  dwShellAttributes |= SFGAO_STREAM;
532 
534  dwShellAttributes |= SFGAO_HIDDEN;
535 
537  dwShellAttributes |= SFGAO_READONLY;
538 
539  if (SFGAO_LINK & *pdwAttributes)
540  {
541  char ext[MAX_PATH];
542 
543  if (_ILGetExtension(pidl, ext, MAX_PATH) && !lstrcmpiA(ext, "lnk"))
544  dwShellAttributes |= SFGAO_LINK;
545  }
546 
547  if (SFGAO_HASSUBFOLDER & *pdwAttributes)
548  {
549  CComPtr<IShellFolder> psf2;
550  if (SUCCEEDED(psf->BindToObject(pidl, 0, IID_PPV_ARG(IShellFolder, &psf2))))
551  {
552  CComPtr<IEnumIDList> pEnumIL;
553  if (SUCCEEDED(psf2->EnumObjects(0, SHCONTF_FOLDERS, &pEnumIL)))
554  {
555  if (pEnumIL->Skip(1) == S_OK)
556  dwShellAttributes |= SFGAO_HASSUBFOLDER;
557  }
558  }
559  }
560 
561  *pdwAttributes = dwShellAttributes;
562 
563  TRACE ("-- 0x%08x\n", *pdwAttributes);
564  return S_OK;
565 }
int WINAPI lstrcmpiA(LPCSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:42
DWORD _ILGetFileAttributes(LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize)
Definition: pidl.c:2581
#define IID_PPV_ARG(Itype, ppType)
BOOL _ILIsFolder(LPCITEMIDLIST pidl)
Definition: pidl.c:1951
smooth NULL
Definition: ftsmooth.c:416
char ext[3]
Definition: mkdosfs.c:358
BOOL _ILGetExtension(LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize)
Definition: pidl.c:2462
HRESULT BindToObject([in] PCUIDLIST_RELATIVE pidl, [in] LPBC pbcReserved, [in] REFIID riid, [out, iid_is(riid)] void **ppvOut)
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
#define TRACE(s)
Definition: solgame.cpp:4
#define MAX_PATH
Definition: compat.h:26
#define FILE_ATTRIBUTE_READONLY
Definition: nt_native.h:702
unsigned long DWORD
Definition: ntddk_ex.h:95
BOOL _ILIsValue(LPCITEMIDLIST pidl)
Definition: pidl.c:1960
#define ERR(fmt,...)
Definition: debug.h:109
#define S_OK
Definition: intsafe.h:59
#define FILE_ATTRIBUTE_HIDDEN
Definition: nt_native.h:703
DWORD dwFileAttributes
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by CFSFolder::GetAttributesOf(), and CFSFolder::ParseDisplayName().

◆ SHELL32_GUIDToStringA()

static __inline int SHELL32_GUIDToStringA ( REFGUID  guid,
LPSTR  str 
)
static

Definition at line 73 of file shfldr.h.

74 {
75  return sprintf(str, "{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
76  guid.Data1, guid.Data2, guid.Data3,
77  guid.Data4[0], guid.Data4[1], guid.Data4[2], guid.Data4[3],
78  guid.Data4[4], guid.Data4[5], guid.Data4[6], guid.Data4[7]);
79 }
#define sprintf(buf, format,...)
Definition: sprintf.c:55
const GUID * guid
const WCHAR * str

◆ SHELL32_GUIDToStringW()

static __inline int SHELL32_GUIDToStringW ( REFGUID  guid,
LPWSTR  str 
)
static

Definition at line 81 of file shfldr.h.

82 {
83  static const WCHAR fmtW[] =
84  { '{','%','0','8','l','x','-','%','0','4','x','-','%','0','4','x','-',
85  '%','0','2','x','%','0','2','x','-',
86  '%','0','2','x','%','0','2','x','%','0','2','x','%','0','2','x',
87  '%','0','2','x','%','0','2','x','}',0 };
88  return swprintf(str, fmtW,
89  guid.Data1, guid.Data2, guid.Data3,
90  guid.Data4[0], guid.Data4[1], guid.Data4[2], guid.Data4[3],
91  guid.Data4[4], guid.Data4[5], guid.Data4[6], guid.Data4[7]);
92 }
const GUID * guid
const WCHAR * str
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define swprintf(buf, format,...)
Definition: sprintf.c:56

Referenced by CRegFolder::GetDisplayNameOf(), and IsNamespaceExtensionHidden().

◆ SHELL32_ParseNextElement()

HRESULT SHELL32_ParseNextElement ( IShellFolder2 psf,
HWND  hwndOwner,
LPBC  pbc,
LPITEMIDLIST pidlInOut,
LPOLESTR  szNext,
DWORD pEaten,
DWORD pdwAttributes 
)

Definition at line 70 of file shlfolder.cpp.

72 {
74  LPITEMIDLIST pidlIn = pidlInOut ? *pidlInOut : NULL;
75  LPITEMIDLIST pidlOut = NULL;
76  LPITEMIDLIST pidlTemp = NULL;
77  CComPtr<IShellFolder> psfChild;
78 
79  TRACE ("(%p, %p, %p, %s)\n", psf, pbc, pidlIn, debugstr_w (szNext));
80 
81  /* get the shellfolder for the child pidl and let it analyse further */
82  hr = psf->BindToObject(pidlIn, pbc, IID_PPV_ARG(IShellFolder, &psfChild));
83  if (FAILED(hr))
84  return hr;
85 
86  hr = psfChild->ParseDisplayName(hwndOwner, pbc, szNext, pEaten, &pidlOut, pdwAttributes);
87  if (FAILED(hr))
88  return hr;
89 
90  pidlTemp = ILCombine (pidlIn, pidlOut);
91  if (!pidlTemp)
92  {
93  hr = E_OUTOFMEMORY;
94  if (pidlOut)
95  ILFree(pidlOut);
96  return hr;
97  }
98 
99  if (pidlOut)
100  ILFree (pidlOut);
101 
102  if (pidlIn)
103  ILFree (pidlIn);
104 
105  *pidlInOut = pidlTemp;
106 
107  TRACE ("-- pidl=%p ret=0x%08x\n", pidlInOut ? *pidlInOut : NULL, hr);
108  return S_OK;
109 }
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:925
HRESULT hr
Definition: shlfolder.c:183
LPITEMIDLIST WINAPI ILCombine(LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
Definition: pidl.c:699
#define IID_PPV_ARG(Itype, ppType)
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define debugstr_w
Definition: kernel32.h:32
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
HRESULT BindToObject([in] PCUIDLIST_RELATIVE pidl, [in] LPBC pbcReserved, [in] REFIID riid, [out, iid_is(riid)] void **ppvOut)
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
#define S_OK
Definition: intsafe.h:59
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41

Referenced by CDrivesFolder::ParseDisplayName(), CDesktopFolder::ParseDisplayName(), CFSFolder::ParseDisplayName(), and CRegFolder::ParseDisplayName().

◆ SHELL_FS_HideExtension()

BOOL SHELL_FS_HideExtension ( LPWSTR  pwszPath)

Definition at line 1074 of file CFSFolder.cpp.

1075 {
1076  HKEY hKey;
1077  DWORD dwData;
1078  DWORD dwDataSize = sizeof (DWORD);
1079  BOOL doHide = FALSE; /* The default value is FALSE (win98 at least) */
1080 
1081  if (!RegCreateKeyExW(HKEY_CURRENT_USER, AdvancedW, 0, 0, 0, KEY_ALL_ACCESS, 0, &hKey, 0)) {
1082  if (!RegQueryValueExW(hKey, HideFileExtW, 0, 0, (LPBYTE) &dwData, &dwDataSize))
1083  doHide = dwData;
1084  RegCloseKey (hKey);
1085  }
1086 
1087  if (!doHide) {
1089 
1090  if (*ext != '\0') {
1092  LONG classlen = sizeof(classname);
1093 
1094  if (!RegQueryValueW(HKEY_CLASSES_ROOT, ext, classname, &classlen))
1095  if (!RegOpenKeyW(HKEY_CLASSES_ROOT, classname, &hKey)) {
1096  if (!RegQueryValueExW(hKey, NeverShowExtW, 0, NULL, NULL, NULL))
1097  doHide = TRUE;
1098  RegCloseKey(hKey);
1099  }
1100  }
1101  }
1102  return doHide;
1103 }
#define TRUE
Definition: types.h:120
#define HKEY_CURRENT_USER
Definition: winreg.h:11
static const WCHAR NeverShowExtW[]
Definition: CFSFolder.cpp:1059
static HANDLE ULONG_PTR dwData
Definition: file.c:35
WCHAR classname[128]
Definition: startup.c:15
#define DWORD
Definition: nt_native.h:44
LONG WINAPI RegCreateKeyExW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey, _In_ DWORD Reserved, _In_opt_ LPWSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_opt_ LPDWORD lpdwDisposition)
Definition: reg.c:1094
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:52
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
LONG WINAPI RegOpenKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3311
smooth NULL
Definition: ftsmooth.c:416
char ext[3]
Definition: mkdosfs.c:358
LPWSTR WINAPI PathFindExtensionW(LPCWSTR lpszPath)
Definition: path.c:442
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4134
__wchar_t WCHAR
Definition: xmlstorage.h:180
LSTATUS WINAPI RegQueryValueW(HKEY hkey, LPCWSTR name, LPWSTR data, LPLONG count)
Definition: reg.c:4272
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
static const WCHAR HideFileExtW[]
Definition: CFSFolder.cpp:1058
LPCWSTR szPath
Definition: env.c:35
#define KEY_ALL_ACCESS
Definition: nt_native.h:1041
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10
static const WCHAR AdvancedW[]
Definition: CFSFolder.cpp:1057
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by CFSFolder::SetNameOf(), and SHELL_FS_ProcessDisplayFilename().

◆ SHELL_FS_ProcessDisplayFilename()

void SHELL_FS_ProcessDisplayFilename ( LPWSTR  szPath,
DWORD  dwFlags 
)

Definition at line 1105 of file CFSFolder.cpp.

1106 {
1107  /*FIXME: MSDN also mentions SHGDN_FOREDITING which is not yet handled. */
1108  if (!(dwFlags & SHGDN_FORPARSING) &&
1109  ((dwFlags & SHGDN_INFOLDER) || (dwFlags == SHGDN_NORMAL))) {
1110  if (SHELL_FS_HideExtension(szPath) && szPath[0] != '.')
1112  }
1113 }
void WINAPI PathRemoveExtensionW(LPWSTR lpszPath)
Definition: path.c:818
BOOL SHELL_FS_HideExtension(LPWSTR szPath)
Definition: CFSFolder.cpp:1074
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
LPCWSTR szPath
Definition: env.c:35

Referenced by CFSFolder::GetDisplayNameOf().