ReactOS 0.4.15-dev-7907-g95bf896
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

HRESULT Shell_NextElement (_Inout_ LPWSTR *ppch, _Out_ LPWSTR pszOut, _In_ INT cchOut, _In_ BOOL bValidate)
 
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)
 
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 (UINT cidl, PCUITEMID_CHILD_ARRAY apidl, 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 (LPCWSTR pwszPath)
 
LSTATUS 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()

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

Definition at line 277 of file shlfolder.cpp.

278{
279 if (*cKeys >= 16)
280 return ERROR_MORE_DATA;
281
282 HKEY hkey;
284 if (result == ERROR_SUCCESS)
285 {
286 array[*cKeys] = hkey;
287 *cKeys += 1;
288 }
289 return result;
290}
#define ERROR_MORE_DATA
Definition: dderror.h:13
#define ERROR_SUCCESS
Definition: deptool.c:10
static LSTATUS(WINAPI *pRegDeleteTreeW)(HKEY
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3333
GLuint64EXT * result
Definition: glext.h:11304
#define KEY_READ
Definition: nt_native.h:1023
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10

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

◆ AddFSClassKeysToArray()

void AddFSClassKeysToArray ( UINT  cidl,
PCUITEMID_CHILD_ARRAY  apidl,
HKEY array,
UINT cKeys 
)

Definition at line 292 of file shlfolder.cpp.

293{
294 // This function opens the association array keys in canonical order for filesystem items.
295 // The order is documented: learn.microsoft.com/en-us/windows/win32/shell/fa-associationarray
296
297 ASSERT(cidl >= 1 && apidl);
298 PCUITEMID_CHILD pidl = apidl[0];
299 if (_ILIsValue(pidl))
300 {
302 PWSTR name;
303 FileStructW* pFileData = _ILGetFileStructW(pidl);
304 if (pFileData)
305 {
306 name = pFileData->wszName;
307 }
308 else
309 {
311 name = buf;
312 }
313 LPCWSTR extension = PathFindExtension(name);
314
315 if (extension)
316 {
317 WCHAR wszClass[MAX_PATH], wszSFA[23 + _countof(wszClass)];
318 DWORD dwSize = sizeof(wszClass);
319 if (RegGetValueW(HKEY_CLASSES_ROOT, extension, NULL, RRF_RT_REG_SZ, NULL, wszClass, &dwSize) != ERROR_SUCCESS ||
320 !*wszClass || AddClassKeyToArray(wszClass, array, cKeys) != ERROR_SUCCESS)
321 {
322 // Only add the extension key if the ProgId is not valid
323 AddClassKeyToArray(extension, array, cKeys);
324
325 // "Open With" becomes the default when there are no verbs in the above keys
326 if (cidl == 1)
327 AddClassKeyToArray(L"Unknown", array, cKeys);
328 }
329
330 swprintf(wszSFA, L"SystemFileAssociations\\%s", extension);
331 AddClassKeyToArray(wszSFA, array, cKeys);
332
333 dwSize = sizeof(wszClass);
334 if (RegGetValueW(HKEY_CLASSES_ROOT, extension, L"PerceivedType ", RRF_RT_REG_SZ, NULL, wszClass, &dwSize) == ERROR_SUCCESS)
335 {
336 swprintf(wszSFA, L"SystemFileAssociations\\%s", wszClass);
337 AddClassKeyToArray(wszSFA, array, cKeys);
338 }
339 }
340
341 AddClassKeyToArray(L"*", array, cKeys);
342 AddClassKeyToArray(L"AllFilesystemObjects", array, cKeys);
343 }
344 else if (_ILIsFolder(pidl))
345 {
346 // FIXME: Directory > Folder > AFO is the correct order and it's
347 // the order Windows reports in its undocumented association array
348 // but it is somehow not the order Windows adds the items to its menu!
349 // Until the correct algorithm in CDefaultContextMenu can be determined,
350 // we add the folder keys in "menu order".
351 AddClassKeyToArray(L"Folder", array, cKeys);
352 AddClassKeyToArray(L"AllFilesystemObjects", array, cKeys);
353 AddClassKeyToArray(L"Directory", array, cKeys);
354 }
355 else
356 {
357 ERR("Got non FS pidl\n");
358 }
359}
#define ERR(fmt,...)
Definition: debug.h:110
#define NULL
Definition: types.h:112
LSTATUS WINAPI RegGetValueW(HKEY hKey, LPCWSTR pszSubKey, LPCWSTR pszValue, DWORD dwFlags, LPDWORD pdwType, PVOID pvData, LPDWORD pcbData)
Definition: reg.c:1931
#define MAX_PATH
Definition: compat.h:34
#define RRF_RT_REG_SZ
Definition: driver.c:575
#define swprintf
Definition: precomp.h:40
unsigned long DWORD
Definition: ntddk_ex.h:95
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define ASSERT(a)
Definition: mode.c:44
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
#define L(x)
Definition: ntvdm.h:50
FileStructW * _ILGetFileStructW(LPCITEMIDLIST pidl)
Definition: pidl.c:2405
BOOL _ILIsFolder(LPCITEMIDLIST pidl)
Definition: pidl.c:2020
BOOL _ILIsValue(LPCITEMIDLIST pidl)
Definition: pidl.c:2029
DWORD _ILSimpleGetTextW(LPCITEMIDLIST pidl, LPWSTR szOut, UINT uOutSize)
Definition: pidl.c:2151
LSTATUS AddClassKeyToArray(const WCHAR *szClass, HKEY *array, UINT *cKeys)
Definition: shlfolder.cpp:277
#define PathFindExtension
Definition: shlwapi.h:907
const ITEMID_CHILD UNALIGNED * PCUITEMID_CHILD
Definition: shtypes.idl:70
#define _countof(array)
Definition: sndvol32.h:68
WCHAR wszName[1]
Definition: shlfolder.c:1555
Definition: name.c:39
uint16_t * PWSTR
Definition: typedefs.h:56
__wchar_t WCHAR
Definition: xmlstorage.h:180
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185

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

◆ CDefViewBckgrndMenu_CreateInstance()

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

Definition at line 334 of file CDefViewBckgrndMenu.cpp.

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

Referenced by CDefView::GetItemObject().

◆ HCR_RegOpenClassIDKey()

BOOL HCR_RegOpenClassIDKey ( REFIID  riid,
HKEY hkey 
)

Definition at line 230 of file classes.c.

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

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 361 of file shlfolder.cpp.

362{
363 CDataObjectHIDA cida(pDataObject);
364
365 if (FAILED_UNEXPECTEDLY(cida.hr()))
366 return cida.hr();
367
368 /* convert the data into pidl */
369 LPITEMIDLIST pidl;
370 LPITEMIDLIST *apidl = _ILCopyCidaToaPidl(&pidl, cida);
371 if (!apidl)
372 {
373 return E_OUTOFMEMORY;
374 }
375
376 *ppidlfolder = pidl;
377 *apidlItems = apidl;
378 *pcidl = cida->cidl;
379
380 return S_OK;
381}
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define FAILED_UNEXPECTEDLY(hr)
Definition: precomp.h:121
#define S_OK
Definition: intsafe.h:52
LPITEMIDLIST * _ILCopyCidaToaPidl(LPITEMIDLIST *pidl, const CIDA *cida)
Definition: pidl.c:2728
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41

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

◆ SHELL32_BindToSF()

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

Definition at line 168 of file shlfolder.cpp.

170{
171 PITEMID_CHILD pidlChild = ILCloneFirst (pidl);
172 if (!pidlChild)
173 return E_FAIL;
174
177 ppfti,
178 pidlChild,
179 clsid,
181 ILFree(pidlChild);
182
184 return hr;
185
186 if (_ILIsPidlSimple (pidl))
187 return psf->QueryInterface(riid, ppvOut);
188 else
189 return psf->BindToObject(ILGetNext (pidl), NULL, riid, ppvOut);
190}
#define E_FAIL
Definition: ddrawi.h:102
BOOL WINAPI _ILIsPidlSimple(LPCITEMIDLIST pidl)
REFCLSID clsid
Definition: msctf.c:82
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:938
LPITEMIDLIST WINAPI ILCloneFirst(LPCITEMIDLIST pidl)
Definition: pidl.c:262
LPITEMIDLIST WINAPI ILGetNext(LPCITEMIDLIST pidl)
Definition: pidl.c:864
HRESULT hr
Definition: shlfolder.c:183
HRESULT SHELL32_CoCreateInitSF(LPCITEMIDLIST pidlRoot, PERSIST_FOLDER_TARGET_INFO *ppfti, LPCITEMIDLIST pidlChild, const GUID *clsid, REFIID riid, LPVOID *ppvOut)
Definition: shlfolder.cpp:130
#define IID_PPV_ARG(Itype, ppType)

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

◆ SHELL32_CompareChildren()

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

Definition at line 224 of file shlfolder.cpp.

225{
226 PUIDLIST_RELATIVE nextpidl1 = ILGetNext (pidl1);
227 PUIDLIST_RELATIVE nextpidl2 = ILGetNext (pidl2);
228
229 bool isEmpty1 = _ILIsDesktop(nextpidl1);
230 bool isEmpty2 = _ILIsDesktop(nextpidl2);
231 if (isEmpty1 || isEmpty2)
232 return MAKE_COMPARE_HRESULT(isEmpty2 - isEmpty1);
233
234 PITEMID_CHILD firstpidl = ILCloneFirst (pidl1);
235 if (!firstpidl)
236 return E_OUTOFMEMORY;
237
239 HRESULT hr = psf->BindToObject(firstpidl, 0, IID_PPV_ARG(IShellFolder, &psf2));
240 ILFree(firstpidl);
241 if (FAILED(hr))
242 return MAKE_COMPARE_HRESULT(0);
243
244 return psf2->CompareIDs(lParam, nextpidl1, nextpidl2);
245}
BOOL _ILIsDesktop(LPCITEMIDLIST pidl)
Definition: CBandSite.h:24
LPARAM lParam
Definition: combotst.c:139
HRESULT BindToObject([in] PCUIDLIST_RELATIVE pidl, [in] LPBC pbcReserved, [in] REFIID riid, [out, iid_is(riid)] void **ppvOut)
#define FAILED(hr)
Definition: intsafe.h:51
#define MAKE_COMPARE_HRESULT(x)
Definition: shellutils.h:579
ITEMIDLIST_RELATIVE UNALIGNED * PUIDLIST_RELATIVE
Definition: shtypes.idl:55

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 247 of file shlfolder.cpp.

248{
250 WCHAR wszItem1[MAX_PATH], wszItem2[MAX_PATH];
252 UINT col = LOWORD(lParam); // Column index without SHCIDS_* flags
253
254 hres = isf->GetDetailsOf(pidl1, col, &sd);
255 if (FAILED(hres))
256 return MAKE_COMPARE_HRESULT(1);
257
258 hres = StrRetToBufW(&sd.str, pidl1, wszItem1, MAX_PATH);
259 if (FAILED(hres))
260 return MAKE_COMPARE_HRESULT(1);
261
262 hres = isf->GetDetailsOf(pidl2, col, &sd);
263 if (FAILED(hres))
264 return MAKE_COMPARE_HRESULT(1);
265
266 hres = StrRetToBufW(&sd.str, pidl2, wszItem2, MAX_PATH);
267 if (FAILED(hres))
268 return MAKE_COMPARE_HRESULT(1);
269
270 int ret = wcsicmp(wszItem1, wszItem2);
271 if (ret == 0)
272 return SHELL32_CompareChildren(isf, lParam, pidl1, pidl2);
273
275}
#define wcsicmp
Definition: compat.h:15
HRESULT WINAPI StrRetToBufW(LPSTRRET src, const ITEMIDLIST *pidl, LPWSTR dest, UINT len)
Definition: string.c:1530
HRESULT GetDetailsOf([in] PCUITEMID_CHILD pidl, [in] UINT iColumn, [out] SHELLDETAILS *psd)
HRESULT hres
Definition: protocol.c:465
static const WCHAR sd[]
Definition: suminfo.c:286
unsigned int UINT
Definition: ndis.h:50
#define LOWORD(l)
Definition: pedump.c:82
HRESULT SHELL32_CompareChildren(IShellFolder2 *psf, LPARAM lParam, LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
Definition: shlfolder.cpp:224
int ret

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

◆ SHELL32_GetDisplayNameOfChild()

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

Definition at line 206 of file shlfolder.cpp.

208{
209 LPITEMIDLIST pidlFirst = ILCloneFirst(pidl);
210 if (!pidlFirst)
211 return E_OUTOFMEMORY;
212
213 CComPtr<IShellFolder> psfChild;
214 HRESULT hr = psf->BindToObject(pidlFirst, NULL, IID_PPV_ARG(IShellFolder, &psfChild));
215 if (SUCCEEDED (hr))
216 {
217 hr = psfChild->GetDisplayNameOf(ILGetNext (pidl), dwFlags, strRet);
218 }
219 ILFree (pidlFirst);
220
221 return hr;
222}
#define SUCCEEDED(hr)
Definition: intsafe.h:50
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1176

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

◆ SHELL32_GetFSItemAttributes()

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

Definition at line 562 of file CFSFolder.cpp.

563{
564 DWORD dwFileAttributes, dwShellAttributes;
565
566 if (!_ILIsFolder(pidl) && !_ILIsValue(pidl))
567 {
568 ERR("Got wrong type of pidl!\n");
569 *pdwAttributes &= SFGAO_CANLINK;
570 return S_OK;
571 }
572
574
575 /* Set common attributes */
576 dwShellAttributes = SFGAO_CANCOPY | SFGAO_CANMOVE | SFGAO_CANLINK | SFGAO_CANRENAME | SFGAO_CANDELETE |
577 SFGAO_HASPROPSHEET | SFGAO_DROPTARGET | SFGAO_FILESYSTEM;
578
579 BOOL bDirectory = (dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0;
580
581 if (!bDirectory)
582 {
583 // https://git.reactos.org/?p=reactos.git;a=blob;f=dll/shellext/zipfldr/res/zipfldr.rgs;hb=032b5aacd233cd7b83ab6282aad638c161fdc400#l9
584 WCHAR szFileName[MAX_PATH];
585 LPWSTR pExtension;
586
587 if (_ILSimpleGetTextW(pidl, szFileName, _countof(szFileName)) && (pExtension = PathFindExtensionW(szFileName)))
588 {
589 CLSID clsidFile;
590 // FIXME: Cache this?
591 HRESULT hr = GetCLSIDForFileTypeFromExtension(pExtension, L"CLSID", &clsidFile);
592 if (hr == S_OK)
593 {
594 HKEY hkey;
595 hr = SHRegGetCLSIDKeyW(clsidFile, L"ShellFolder", FALSE, FALSE, &hkey);
596 if (SUCCEEDED(hr))
597 {
599 DWORD dwSize = sizeof(dwAttributes);
601
603 if (Status == STATUS_SUCCESS)
604 {
605 TRACE("Augmenting '%S' with dwAttributes=0x%x\n", szFileName, dwAttributes);
606 dwShellAttributes |= dwAttributes;
607 }
608 ::RegCloseKey(hkey);
609
610 // This should be presented as directory!
611 bDirectory = TRUE;
612 TRACE("Treating '%S' as directory!\n", szFileName);
613 }
614 }
615 }
616 }
617
618 // This is a directory
619 if (bDirectory)
620 {
621 dwShellAttributes |= (SFGAO_FOLDER | /*SFGAO_HASSUBFOLDER |*/ SFGAO_STORAGE);
622
623 // Is this a real directory?
625 {
626 dwShellAttributes |= (SFGAO_FILESYSANCESTOR | SFGAO_STORAGEANCESTOR);
627 }
628 }
629 else
630 {
631 dwShellAttributes |= SFGAO_STREAM;
632 }
633
635 dwShellAttributes |= SFGAO_HIDDEN;
636
638 dwShellAttributes |= SFGAO_READONLY;
639
640 if (SFGAO_LINK & *pdwAttributes)
641 {
642 char ext[MAX_PATH];
643
644 if (_ILGetExtension(pidl, ext, MAX_PATH) && !lstrcmpiA(ext, "lnk"))
645 dwShellAttributes |= SFGAO_LINK;
646 }
647
648 if (SFGAO_HASSUBFOLDER & *pdwAttributes)
649 {
650 CComPtr<IShellFolder> psf2;
651 if (SUCCEEDED(psf->BindToObject(pidl, 0, IID_PPV_ARG(IShellFolder, &psf2))))
652 {
653 CComPtr<IEnumIDList> pEnumIL;
654 if (SUCCEEDED(psf2->EnumObjects(0, SHCONTF_FOLDERS, &pEnumIL)))
655 {
656 if (pEnumIL->Skip(1) == S_OK)
657 dwShellAttributes |= SFGAO_HASSUBFOLDER;
658 }
659 }
660 }
661
662 *pdwAttributes = dwShellAttributes;
663
664 TRACE ("-- 0x%08x\n", *pdwAttributes);
665 return S_OK;
666}
DWORD dwFileAttributes
#define RegCloseKey(hKey)
Definition: registry.h:49
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
static const WCHAR *const ext[]
Definition: module.c:53
#define RRF_RT_REG_DWORD
Definition: driver.c:578
HRESULT GetCLSIDForFileTypeFromExtension(LPWSTR pExtension, LPCWSTR KeyName, CLSID *pclsid)
Definition: CFSFolder.cpp:72
LPWSTR WINAPI PathFindExtensionW(LPCWSTR lpszPath)
Definition: path.c:447
HRESULT WINAPI SHRegGetCLSIDKeyW(REFGUID, LPCWSTR, BOOL, BOOL, PHKEY)
Definition: reg.c:2422
unsigned int BOOL
Definition: ntddk_ex.h:94
Status
Definition: gdiplustypes.h:25
int WINAPI lstrcmpiA(LPCSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:42
#define FILE_ATTRIBUTE_READONLY
Definition: nt_native.h:702
#define FILE_ATTRIBUTE_HIDDEN
Definition: nt_native.h:703
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
DWORD _ILGetFileAttributes(LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize)
Definition: pidl.c:2650
BOOL _ILGetExtension(LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize)
Definition: pidl.c:2531
#define STATUS_SUCCESS
Definition: shellext.h:65
LSTATUS WINAPI SHRegGetValueW(_In_ HKEY hkey, _In_opt_ LPCWSTR pszSubKey, _In_opt_ LPCWSTR pszValue, _In_ SRRF srrfFlags, _Out_opt_ LPDWORD pdwType, _Out_writes_bytes_to_opt_(*pcbData, *pcbData) LPVOID pvData, _Inout_opt_ LPDWORD pcbData)
DWORD dwAttributes
Definition: vdmdbg.h:34
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by CFSFolder::GetAttributesOf().

◆ SHELL32_GUIDToStringA()

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

Definition at line 77 of file shfldr.h.

78{
79 return sprintf(str, "{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
80 guid.Data1, guid.Data2, guid.Data3,
81 guid.Data4[0], guid.Data4[1], guid.Data4[2], guid.Data4[3],
82 guid.Data4[4], guid.Data4[5], guid.Data4[6], guid.Data4[7]);
83}
const GUID * guid
const WCHAR * str

◆ SHELL32_GUIDToStringW()

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

Definition at line 85 of file shfldr.h.

86{
87 static const WCHAR fmtW[] =
88 { '{','%','0','8','l','X','-','%','0','4','X','-','%','0','4','X','-',
89 '%','0','2','X','%','0','2','X','-',
90 '%','0','2','X','%','0','2','X','%','0','2','X','%','0','2','X',
91 '%','0','2','X','%','0','2','X','}',0 };
92 return swprintf(str, fmtW,
93 guid.Data1, guid.Data2, guid.Data3,
94 guid.Data4[0], guid.Data4[1], guid.Data4[2], guid.Data4[3],
95 guid.Data4[4], guid.Data4[5], guid.Data4[6], guid.Data4[7]);
96}

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 79 of file shlfolder.cpp.

81{
83 LPITEMIDLIST pidlIn = pidlInOut ? *pidlInOut : NULL;
84 LPITEMIDLIST pidlOut = NULL;
85 LPITEMIDLIST pidlTemp = NULL;
86 CComPtr<IShellFolder> psfChild;
87
88 TRACE ("(%p, %p, %p, %s)\n", psf, pbc, pidlIn, debugstr_w (szNext));
89
90 /* get the shellfolder for the child pidl and let it analyse further */
91 hr = psf->BindToObject(pidlIn, pbc, IID_PPV_ARG(IShellFolder, &psfChild));
92 if (FAILED(hr))
93 return hr;
94
95 hr = psfChild->ParseDisplayName(hwndOwner, pbc, szNext, pEaten, &pidlOut, pdwAttributes);
96 if (FAILED(hr))
97 return hr;
98
99 pidlTemp = ILCombine (pidlIn, pidlOut);
100 if (!pidlTemp)
101 {
103 if (pidlOut)
104 ILFree(pidlOut);
105 return hr;
106 }
107
108 if (pidlOut)
109 ILFree (pidlOut);
110
111 if (pidlIn)
112 ILFree (pidlIn);
113
114 *pidlInOut = pidlTemp;
115
116 TRACE ("-- pidl=%p ret=0x%08x\n", pidlInOut ? *pidlInOut : NULL, hr);
117 return S_OK;
118}
#define E_INVALIDARG
Definition: ddrawi.h:101
#define debugstr_w
Definition: kernel32.h:32
LPITEMIDLIST WINAPI ILCombine(LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
Definition: pidl.c:712

Referenced by CRegFolder::ParseDisplayName().

◆ SHELL_FS_HideExtension()

BOOL SHELL_FS_HideExtension ( LPCWSTR  pwszPath)

Definition at line 1330 of file CFSFolder.cpp.

1331{
1332 HKEY hKey;
1333 DWORD dwData, dwDataSize = sizeof(DWORD);
1334 BOOL doHide = FALSE; /* The default value is FALSE (win98 at least) */
1335 LONG lError;
1336
1337 lError = RegCreateKeyExW(HKEY_CURRENT_USER, L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced",
1338 0, NULL, 0, KEY_ALL_ACCESS, NULL,
1339 &hKey, NULL);
1340 if (lError == ERROR_SUCCESS)
1341 {
1342 lError = RegQueryValueExW(hKey, L"HideFileExt", NULL, NULL, (LPBYTE)&dwData, &dwDataSize);
1343 if (lError == ERROR_SUCCESS)
1344 doHide = dwData;
1346 }
1347
1348 if (!doHide)
1349 {
1351 if (*DotExt != 0)
1352 {
1354 LONG classlen = sizeof(classname);
1355 lError = RegQueryValueW(HKEY_CLASSES_ROOT, DotExt, classname, &classlen);
1356 if (lError == ERROR_SUCCESS)
1357 {
1359 if (lError == ERROR_SUCCESS)
1360 {
1361 lError = RegQueryValueExW(hKey, L"NeverShowExt", NULL, NULL, NULL, NULL);
1362 if (lError == ERROR_SUCCESS)
1363 doHide = TRUE;
1364
1366 }
1367 }
1368 }
1369 }
1370
1371 return doHide;
1372}
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:1096
LONG WINAPI RegOpenKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3268
LSTATUS WINAPI RegQueryValueW(HKEY hkey, LPCWSTR name, LPWSTR data, LPLONG count)
Definition: reg.c:4241
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4103
FxAutoRegKey hKey
LPCWSTR szPath
Definition: env.c:37
static HANDLE ULONG_PTR dwData
Definition: file.c:35
#define KEY_ALL_ACCESS
Definition: nt_native.h:1041
#define DWORD
Definition: nt_native.h:44
long LONG
Definition: pedump.c:60
WCHAR classname[128]
Definition: startup.c:15
unsigned char * LPBYTE
Definition: typedefs.h:53
#define HKEY_CURRENT_USER
Definition: winreg.h:11

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

◆ SHELL_FS_ProcessDisplayFilename()

void SHELL_FS_ProcessDisplayFilename ( LPWSTR  szPath,
DWORD  dwFlags 
)

Definition at line 1374 of file CFSFolder.cpp.

1375{
1376 /*FIXME: MSDN also mentions SHGDN_FOREDITING which is not yet handled. */
1377 if (!(dwFlags & SHGDN_FORPARSING) &&
1378 ((dwFlags & SHGDN_INFOLDER) || (dwFlags == SHGDN_NORMAL))) {
1379 if (SHELL_FS_HideExtension(szPath) && szPath[0] != '.')
1381 }
1382}
BOOL SHELL_FS_HideExtension(LPCWSTR szPath)
Definition: CFSFolder.cpp:1330
void WINAPI PathRemoveExtensionW(LPWSTR lpszPath)
Definition: path.c:823

Referenced by CFSFolder::GetDisplayNameOf().

◆ Shell_NextElement()

HRESULT Shell_NextElement ( _Inout_ LPWSTR ppch,
_Out_ LPWSTR  pszOut,
_In_ INT  cchOut,
_In_ BOOL  bValidate 
)

Definition at line 30 of file shlfolder.cpp.

35{
36 *pszOut = UNICODE_NULL;
37
38 if (!*ppch)
39 return S_FALSE;
40
41 HRESULT hr;
42 LPWSTR pchNext = wcschr(*ppch, L'\\');
43 if (pchNext)
44 {
45 if (*ppch < pchNext)
46 {
47 /* Get an element */
48 StringCchCopyNW(pszOut, cchOut, *ppch, pchNext - *ppch);
49 ++pchNext;
50
51 if (!*pchNext)
52 pchNext = NULL; /* No next */
53
54 hr = S_OK;
55 }
56 else /* Double backslashes found? */
57 {
58 pchNext = NULL;
60 }
61 }
62 else /* No more next */
63 {
64 StringCchCopyW(pszOut, cchOut, *ppch);
65 hr = S_OK;
66 }
67
68 *ppch = pchNext; /* Go next */
69
70 if (hr == S_OK && bValidate && !PathIsValidElement(pszOut))
71 {
72 *pszOut = UNICODE_NULL;
74 }
75
76 return hr;
77}
#define wcschr
Definition: compat.h:17
BOOL PathIsValidElement(_In_ LPCWSTR pszPath)
Definition: utils.cpp:24
#define UNICODE_NULL
STRSAFEAPI StringCchCopyW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:149
STRSAFEAPI StringCchCopyNW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc, size_t cchToCopy)
Definition: strsafe.h:236
#define S_FALSE
Definition: winerror.h:2357

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