ReactOS 0.4.15-dev-8413-gc1c91f2
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 SHFSF_COL_NAME   0
 
#define SHFSF_COL_SIZE   1
 
#define SHFSF_COL_TYPE   2
 
#define SHFSF_COL_MDATE   3
 
#define SHFSF_COL_FATTS   4
 
#define SHFSF_COL_COMMENT   5
 
#define GET_SHGDN_FOR(dwFlags)   ((DWORD)dwFlags & (DWORD)0x0000FF00)
 
#define GET_SHGDN_RELATION(dwFlags)   ((DWORD)dwFlags & (DWORD)0x000000FF)
 
#define IS_SHGDN_FOR_PARSING(flags)   ( ((flags) & (SHGDN_FORADDRESSBAR | SHGDN_FORPARSING)) == SHGDN_FORPARSING)
 
#define IS_SHGDN_DESKTOPABSOLUTEPARSING(flags)   ( ((flags) & (SHGDN_FORADDRESSBAR | SHGDN_FORPARSING | 0xFF)) == SHGDN_FORPARSING)
 

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)
 
LSTATUS AddClsidKeyToArray (REFCLSID clsid, 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 50 of file shfldr.h.

◆ GET_SHGDN_RELATION

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

Definition at line 51 of file shfldr.h.

◆ IS_SHGDN_DESKTOPABSOLUTEPARSING

#define IS_SHGDN_DESKTOPABSOLUTEPARSING (   flags)    ( ((flags) & (SHGDN_FORADDRESSBAR | SHGDN_FORPARSING | 0xFF)) == SHGDN_FORPARSING)

Definition at line 53 of file shfldr.h.

◆ IS_SHGDN_FOR_PARSING

#define IS_SHGDN_FOR_PARSING (   flags)    ( ((flags) & (SHGDN_FORADDRESSBAR | SHGDN_FORPARSING)) == SHGDN_FORPARSING)

Definition at line 52 of file shfldr.h.

◆ SHFSF_COL_COMMENT

#define SHFSF_COL_COMMENT   5

Definition at line 48 of file shfldr.h.

◆ SHFSF_COL_FATTS

#define SHFSF_COL_FATTS   4

Definition at line 47 of file shfldr.h.

◆ SHFSF_COL_MDATE

#define SHFSF_COL_MDATE   3

Definition at line 46 of file shfldr.h.

◆ SHFSF_COL_NAME

#define SHFSF_COL_NAME   0

Definition at line 43 of file shfldr.h.

◆ SHFSF_COL_SIZE

#define SHFSF_COL_SIZE   1

Definition at line 44 of file shfldr.h.

◆ SHFSF_COL_TYPE

#define SHFSF_COL_TYPE   2

Definition at line 45 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 AddClsidKeyToArray(), AddFSClassKeysToArray(), CDrivesContextMenu_CreateInstance(), CGuidItemContextMenu_CreateInstance(), CDesktopFolder::CreateViewObject(), CDrivesFolder::CreateViewObject(), CFSFolder::CreateViewObject(), CDesktopFolder::GetUIObjectOf(), and CNetFolder::GetUIObjectOf().

◆ AddClsidKeyToArray()

LSTATUS AddClsidKeyToArray ( REFCLSID  clsid,
HKEY array,
UINT cKeys 
)

Definition at line 292 of file shlfolder.cpp.

293{
294 WCHAR path[6 + 38 + 1] = L"CLSID\\";
295 StringFromGUID2(clsid, path + 6, 38 + 1);
296 return AddClassKeyToArray(path, array, cKeys);
297}
INT WINAPI StringFromGUID2(REFGUID id, LPOLESTR str, INT cmax)
Definition: compobj.c:2434
REFCLSID clsid
Definition: msctf.c:82
#define L(x)
Definition: ntvdm.h:50
LSTATUS AddClassKeyToArray(const WCHAR *szClass, HKEY *array, UINT *cKeys)
Definition: shlfolder.cpp:277
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by CDesktopFolder::GetUIObjectOf().

◆ AddFSClassKeysToArray()

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

Definition at line 299 of file shlfolder.cpp.

300{
301 // This function opens the association array keys in canonical order for filesystem items.
302 // The order is documented: learn.microsoft.com/en-us/windows/win32/shell/fa-associationarray
303
304 ASSERT(cidl >= 1 && apidl);
305 PCUITEMID_CHILD pidl = apidl[0];
306 if (_ILIsValue(pidl))
307 {
309 PWSTR name;
310 FileStructW* pFileData = _ILGetFileStructW(pidl);
311 if (pFileData)
312 {
313 name = pFileData->wszName;
314 }
315 else
316 {
318 name = buf;
319 }
320 LPCWSTR extension = PathFindExtension(name);
321
322 if (extension)
323 {
324 WCHAR wszClass[MAX_PATH], wszSFA[23 + _countof(wszClass)];
325 DWORD dwSize = sizeof(wszClass);
326 if (RegGetValueW(HKEY_CLASSES_ROOT, extension, NULL, RRF_RT_REG_SZ, NULL, wszClass, &dwSize) != ERROR_SUCCESS ||
327 !*wszClass || AddClassKeyToArray(wszClass, array, cKeys) != ERROR_SUCCESS)
328 {
329 // Only add the extension key if the ProgId is not valid
330 AddClassKeyToArray(extension, array, cKeys);
331
332 // "Open With" becomes the default when there are no verbs in the above keys
333 if (cidl == 1)
334 AddClassKeyToArray(L"Unknown", array, cKeys);
335 }
336
337 swprintf(wszSFA, L"SystemFileAssociations\\%s", extension);
338 AddClassKeyToArray(wszSFA, array, cKeys);
339
340 dwSize = sizeof(wszClass);
341 if (RegGetValueW(HKEY_CLASSES_ROOT, extension, L"PerceivedType ", RRF_RT_REG_SZ, NULL, wszClass, &dwSize) == ERROR_SUCCESS)
342 {
343 swprintf(wszSFA, L"SystemFileAssociations\\%s", wszClass);
344 AddClassKeyToArray(wszSFA, array, cKeys);
345 }
346 }
347
348 AddClassKeyToArray(L"*", array, cKeys);
349 AddClassKeyToArray(L"AllFilesystemObjects", array, cKeys);
350 }
351 else if (_ILIsFolder(pidl))
352 {
353 // FIXME: Directory > Folder > AFO is the correct order and it's
354 // the order Windows reports in its undocumented association array
355 // but it is somehow not the order Windows adds the items to its menu!
356 // Until the correct algorithm in CDefaultContextMenu can be determined,
357 // we add the folder keys in "menu order".
358 AddClassKeyToArray(L"Folder", array, cKeys);
359 AddClassKeyToArray(L"AllFilesystemObjects", array, cKeys);
360 AddClassKeyToArray(L"Directory", array, cKeys);
361 }
362 else
363 {
364 ERR("Got non FS pidl\n");
365 }
366}
#define ERR(fmt,...)
Definition: precomp.h:57
#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
FileStructW * _ILGetFileStructW(LPCITEMIDLIST pidl)
Definition: pidl.c:2328
BOOL _ILIsFolder(LPCITEMIDLIST pidl)
Definition: pidl.c:2015
BOOL _ILIsValue(LPCITEMIDLIST pidl)
Definition: pidl.c:2024
DWORD _ILSimpleGetTextW(LPCITEMIDLIST pidl, LPWSTR szOut, UINT uOutSize)
Definition: pidl.c:2074
#define PathFindExtension
Definition: shlwapi.h:907
const ITEMID_CHILD UNALIGNED * PCUITEMID_CHILD
Definition: shtypes.idl:70
#define _countof(array)
Definition: sndvol32.h:70
WCHAR wszName[1]
Definition: shlfolder.c:1555
Definition: name.c:39
uint16_t * PWSTR
Definition: typedefs.h:56
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 330 of file CDefViewBckgrndMenu.cpp.

331{
332 return ShellObjectCreatorInit<CDefViewBckgrndMenu>(psf, riid, ppv);
333}
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 368 of file shlfolder.cpp.

369{
370 CDataObjectHIDA cida(pDataObject);
371
372 if (FAILED_UNEXPECTEDLY(cida.hr()))
373 return cida.hr();
374
375 /* convert the data into pidl */
376 LPITEMIDLIST pidl;
377 LPITEMIDLIST *apidl = _ILCopyCidaToaPidl(&pidl, cida);
378 if (!apidl)
379 {
380 return E_OUTOFMEMORY;
381 }
382
383 *ppidlfolder = pidl;
384 *apidlItems = apidl;
385 *pcidl = cida->cidl;
386
387 return S_OK;
388}
#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:2632
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)
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:940
LPITEMIDLIST WINAPI ILCloneFirst(LPCITEMIDLIST pidl)
Definition: pidl.c:262
LPITEMIDLIST WINAPI ILGetNext(LPCITEMIDLIST pidl)
Definition: pidl.c:866
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:607
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 580 of file CFSFolder.cpp.

581{
582 DWORD dwFileAttributes, dwShellAttributes;
583
584 if (!_ILIsFolder(pidl) && !_ILIsValue(pidl))
585 {
586 ERR("Got wrong type of pidl!\n");
587 *pdwAttributes &= SFGAO_CANLINK;
588 return S_OK;
589 }
590
592
593 /* Set common attributes */
594 dwShellAttributes = SFGAO_CANCOPY | SFGAO_CANMOVE | SFGAO_CANLINK | SFGAO_CANRENAME | SFGAO_CANDELETE |
595 SFGAO_HASPROPSHEET | SFGAO_DROPTARGET | SFGAO_FILESYSTEM;
596
597 BOOL bDirectory = (dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0;
598
599 if (!bDirectory)
600 {
601 // https://git.reactos.org/?p=reactos.git;a=blob;f=dll/shellext/zipfldr/res/zipfldr.rgs;hb=032b5aacd233cd7b83ab6282aad638c161fdc400#l9
602 WCHAR szFileName[MAX_PATH];
603 LPWSTR pExtension;
604
605 if (_ILSimpleGetTextW(pidl, szFileName, _countof(szFileName)) && (pExtension = PathFindExtensionW(szFileName)))
606 {
607 CLSID clsidFile;
608 // FIXME: Cache this?
609 HRESULT hr = GetCLSIDForFileTypeFromExtension(pExtension, L"CLSID", &clsidFile);
610 if (hr == S_OK)
611 {
612 HKEY hkey;
613 hr = SHRegGetCLSIDKeyW(clsidFile, L"ShellFolder", FALSE, FALSE, &hkey);
614 if (SUCCEEDED(hr))
615 {
617 DWORD dwSize = sizeof(dwAttributes);
619
621 if (Status == STATUS_SUCCESS)
622 {
623 TRACE("Augmenting '%S' with dwAttributes=0x%x\n", szFileName, dwAttributes);
624 dwShellAttributes |= dwAttributes;
625 }
626 ::RegCloseKey(hkey);
627
628 // This should be presented as directory!
629 bDirectory = TRUE;
630 TRACE("Treating '%S' as directory!\n", szFileName);
631 }
632 }
633 }
634 }
635
636 // This is a directory
637 if (bDirectory)
638 {
639 dwShellAttributes |= (SFGAO_FOLDER | /*SFGAO_HASSUBFOLDER |*/ SFGAO_STORAGE);
640
641 // Is this a real directory?
643 {
644 dwShellAttributes |= (SFGAO_FILESYSANCESTOR | SFGAO_STORAGEANCESTOR);
645 }
646 }
647 else
648 {
649 dwShellAttributes |= SFGAO_STREAM;
650 }
651
653 dwShellAttributes |= SFGAO_HIDDEN;
654
656 dwShellAttributes |= SFGAO_READONLY;
657
658 if (SFGAO_LINK & *pdwAttributes)
659 {
661
662 if (_ILGetExtension(pidl, ext, _countof(ext)) && !lstrcmpiW(ext, L"lnk"))
663 dwShellAttributes |= SFGAO_LINK;
664 }
665
666 if (SFGAO_HASSUBFOLDER & *pdwAttributes)
667 {
668 CComPtr<IShellFolder> psf2;
669 if (SUCCEEDED(psf->BindToObject(pidl, 0, IID_PPV_ARG(IShellFolder, &psf2))))
670 {
671 CComPtr<IEnumIDList> pEnumIL;
672 if (SUCCEEDED(psf2->EnumObjects(0, SHCONTF_FOLDERS, &pEnumIL)))
673 {
674 if (pEnumIL->Skip(1) == S_OK)
675 dwShellAttributes |= SFGAO_HASSUBFOLDER;
676 }
677 }
678 }
679
680 *pdwAttributes = dwShellAttributes;
681
682 TRACE ("-- 0x%08x\n", *pdwAttributes);
683 return S_OK;
684}
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
int WINAPI lstrcmpiW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4261
#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
#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, LPWSTR pOut, UINT uOutSize)
Definition: pidl.c:2554
BOOL _ILGetExtension(LPCITEMIDLIST pidl, LPWSTR pOut, UINT uOutSize)
Definition: pidl.c:2454
#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 93 of file shfldr.h.

94{
95 return sprintf(str, "{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
96 guid.Data1, guid.Data2, guid.Data3,
97 guid.Data4[0], guid.Data4[1], guid.Data4[2], guid.Data4[3],
98 guid.Data4[4], guid.Data4[5], guid.Data4[6], guid.Data4[7]);
99}
const GUID * guid
const WCHAR * str

◆ SHELL32_GUIDToStringW()

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

Definition at line 101 of file shfldr.h.

102{
103 static const WCHAR fmtW[] =
104 { '{','%','0','8','l','X','-','%','0','4','X','-','%','0','4','X','-',
105 '%','0','2','X','%','0','2','X','-',
106 '%','0','2','X','%','0','2','X','%','0','2','X','%','0','2','X',
107 '%','0','2','X','%','0','2','X','}',0 };
108 return swprintf(str, fmtW,
109 guid.Data1, guid.Data2, guid.Data3,
110 guid.Data4[0], guid.Data4[1], guid.Data4[2], guid.Data4[3],
111 guid.Data4[4], guid.Data4[5], guid.Data4[6], guid.Data4[7]);
112}

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 1355 of file CFSFolder.cpp.

1356{
1357 HKEY hKey;
1358 BOOL doHide = FALSE; /* The default value is FALSE (win98 at least) */
1359 LONG lError;
1360
1361 doHide = !SHELL_GetSetting(SSF_SHOWEXTENSIONS, fShowExtensions);
1362
1363 if (!doHide)
1364 {
1366 if (*DotExt != 0)
1367 {
1369 LONG classlen = sizeof(classname);
1370 lError = RegQueryValueW(HKEY_CLASSES_ROOT, DotExt, classname, &classlen);
1371 if (lError == ERROR_SUCCESS)
1372 {
1374 if (lError == ERROR_SUCCESS)
1375 {
1376 lError = RegQueryValueExW(hKey, L"NeverShowExt", NULL, NULL, NULL, NULL);
1377 if (lError == ERROR_SUCCESS)
1378 doHide = TRUE;
1379
1381 }
1382 }
1383 }
1384 }
1385
1386 return doHide;
1387}
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
long LONG
Definition: pedump.c:60
WCHAR classname[128]
Definition: startup.c:15
#define SHELL_GetSetting(pss, ssf, field)
Definition: shellutils.h:795
#define SSF_SHOWEXTENSIONS
Definition: shlobj.h:1605

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

◆ SHELL_FS_ProcessDisplayFilename()

void SHELL_FS_ProcessDisplayFilename ( LPWSTR  szPath,
DWORD  dwFlags 
)

Definition at line 1389 of file CFSFolder.cpp.

1390{
1391 /*FIXME: MSDN also mentions SHGDN_FOREDITING which is not yet handled. */
1392 if (!(dwFlags & SHGDN_FORPARSING) &&
1393 ((dwFlags & SHGDN_INFOLDER) || (dwFlags == SHGDN_NORMAL))) {
1394 if (SHELL_FS_HideExtension(szPath) && szPath[0] != '.')
1396 }
1397}
BOOL SHELL_FS_HideExtension(LPCWSTR szPath)
Definition: CFSFolder.cpp:1355
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:38
#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().