ReactOS 0.4.16-dev-320-g3bd9ddc
shlfolder.cpp File Reference
#include "precomp.h"
Include dependency graph for shlfolder.cpp:

Go to the source code of this file.

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (shell)
 
SHCONTF SHELL_GetDefaultFolderEnumSHCONTF ()
 
BOOL SHELL_IncludeItemInFolderEnum (IShellFolder *pSF, PCUITEMID_CHILD pidl, SFGAOF Query, SHCONTF Flags)
 
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_CoCreateInitSF (LPCITEMIDLIST pidlRoot, PERSIST_FOLDER_TARGET_INFO *ppfti, LPCITEMIDLIST pidlChild, const GUID *clsid, REFIID riid, LPVOID *ppvOut)
 
HRESULT SHELL32_CoCreateInitSF (LPCITEMIDLIST pidlRoot, const GUID *clsid, int csidl, REFIID riid, LPVOID *ppvOut)
 
HRESULT SHELL32_BindToSF (LPCITEMIDLIST pidlRoot, PERSIST_FOLDER_TARGET_INFO *ppfti, LPCITEMIDLIST pidl, const GUID *clsid, REFIID riid, LPVOID *ppvOut)
 
HRESULT SHELL32_GetDisplayNameOfChild (IShellFolder2 *psf, LPCITEMIDLIST pidl, DWORD dwFlags, LPSTRRET strRet)
 
HRESULT SHELL32_CompareChildren (IShellFolder2 *psf, LPARAM lParam, LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
 
HRESULT SHELL32_CompareDetails (IShellFolder2 *isf, LPARAM lParam, LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
 
void CloseRegKeyArray (HKEY *array, UINT cKeys)
 
LSTATUS AddClassKeyToArray (const WCHAR *szClass, HKEY *array, UINT *cKeys)
 
LSTATUS AddClsidKeyToArray (REFCLSID clsid, HKEY *array, UINT *cKeys)
 
void AddFSClassKeysToArray (UINT cidl, PCUITEMID_CHILD_ARRAY apidl, HKEY *array, UINT *cKeys)
 
HRESULT SH_GetApidlFromDataObject (IDataObject *pDataObject, PIDLIST_ABSOLUTE *ppidlfolder, PUITEMID_CHILD **apidlItems, UINT *pcidl)
 
HRESULT WINAPI SHCreateLinks (HWND hWnd, LPCSTR lpszDir, IDataObject *lpDataObject, UINT uFlags, LPITEMIDLIST *lppidlLinks)
 
EXTERN_C HRESULT WINAPI SHOpenFolderAndSelectItems (PCIDLIST_ABSOLUTE pidlFolder, UINT cidl, PCUITEMID_CHILD_ARRAY apidl, DWORD dwFlags)
 
HRESULT SHELL32_ShowPropertiesDialog (IDataObject *pdtobj)
 
HRESULT SHELL32_DefaultContextMenuCallBack (IShellFolder *psf, IDataObject *pdo, UINT msg)
 

Function Documentation

◆ AddClassKeyToArray()

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

Definition at line 311 of file shlfolder.cpp.

312{
313 if (*cKeys >= 16)
314 return ERROR_MORE_DATA;
315
316 HKEY hkey;
318 if (result == ERROR_SUCCESS)
319 {
320 array[*cKeys] = hkey;
321 *cKeys += 1;
322 }
323 return result;
324}
#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(), ClassPropDialogInitCallback(), CDesktopFolder::CreateViewObject(), CFSFolder::CreateViewObject(), CRegItemContextMenu_CreateInstance(), CDesktopFolder::GetUIObjectOf(), and CNetFolder::GetUIObjectOf().

◆ AddClsidKeyToArray()

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

Definition at line 326 of file shlfolder.cpp.

327{
328 WCHAR path[6 + 38 + 1] = L"CLSID\\";
329 StringFromGUID2(clsid, path + 6, 38 + 1);
330 return AddClassKeyToArray(path, array, cKeys);
331}
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:311
__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 333 of file shlfolder.cpp.

334{
335 // This function opens the association array keys in canonical order for filesystem items.
336 // The order is documented: learn.microsoft.com/en-us/windows/win32/shell/fa-associationarray
337
338 ASSERT(cidl >= 1 && apidl);
339 PCUITEMID_CHILD pidl = apidl[0];
340 if (_ILIsValue(pidl))
341 {
343 PWSTR name;
344 FileStructW* pFileData = _ILGetFileStructW(pidl);
345 if (pFileData)
346 {
347 name = pFileData->wszName;
348 }
349 else
350 {
352 name = buf;
353 }
354 LPCWSTR extension = PathFindExtension(name);
355
356 if (extension)
357 {
358 WCHAR wszClass[MAX_PATH], wszSFA[23 + _countof(wszClass)];
359 DWORD dwSize = sizeof(wszClass);
360 if (RegGetValueW(HKEY_CLASSES_ROOT, extension, NULL, RRF_RT_REG_SZ, NULL, wszClass, &dwSize) != ERROR_SUCCESS ||
361 !*wszClass || AddClassKeyToArray(wszClass, array, cKeys) != ERROR_SUCCESS)
362 {
363 // Only add the extension key if the ProgId is not valid
364 AddClassKeyToArray(extension, array, cKeys);
365
366 // "Open With" becomes the default when there are no verbs in the above keys
367 if (cidl == 1)
368 AddClassKeyToArray(L"Unknown", array, cKeys);
369 }
370
371 swprintf(wszSFA, L"SystemFileAssociations\\%s", extension);
372 AddClassKeyToArray(wszSFA, array, cKeys);
373
374 dwSize = sizeof(wszClass);
375 if (RegGetValueW(HKEY_CLASSES_ROOT, extension, L"PerceivedType ", RRF_RT_REG_SZ, NULL, wszClass, &dwSize) == ERROR_SUCCESS)
376 {
377 swprintf(wszSFA, L"SystemFileAssociations\\%s", wszClass);
378 AddClassKeyToArray(wszSFA, array, cKeys);
379 }
380 }
381
382 AddClassKeyToArray(L"*", array, cKeys);
383 AddClassKeyToArray(L"AllFilesystemObjects", array, cKeys);
384 }
385 else if (_ILIsFolder(pidl))
386 {
387 // FIXME: Directory > Folder > AFO is the correct order and it's
388 // the order Windows reports in its undocumented association array
389 // but it is somehow not the order Windows adds the items to its menu!
390 // Until the correct algorithm in CDefaultContextMenu can be determined,
391 // we add the folder keys in "menu order".
392 AddClassKeyToArray(L"Folder", array, cKeys);
393 AddClassKeyToArray(L"AllFilesystemObjects", array, cKeys);
394 AddClassKeyToArray(L"Directory", array, cKeys);
395 }
396 else
397 {
398 ERR("Got non FS pidl\n");
399 }
400}
#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:2438
BOOL _ILIsFolder(LPCITEMIDLIST pidl)
Definition: pidl.c:2125
BOOL _ILIsValue(LPCITEMIDLIST pidl)
Definition: pidl.c:2134
DWORD _ILSimpleGetTextW(LPCITEMIDLIST pidl, LPWSTR szOut, UINT uOutSize)
Definition: pidl.c:2184
#define PathFindExtension
Definition: shlwapi.h:933
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 FSFolderItemPropDialogInitCallback(), CDesktopFolder::GetUIObjectOf(), and CFSFolder::GetUIObjectOf().

◆ CloseRegKeyArray()

void CloseRegKeyArray ( HKEY array,
UINT  cKeys 
)

Definition at line 305 of file shlfolder.cpp.

306{
307 for (UINT i = 0; i < cKeys; ++i)
309}
#define RegCloseKey(hKey)
Definition: registry.h:49
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned int UINT
Definition: ndis.h:50

◆ SH_GetApidlFromDataObject()

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

Definition at line 402 of file shlfolder.cpp.

403{
404 CDataObjectHIDA cida(pDataObject);
405
406 if (FAILED_UNEXPECTEDLY(cida.hr()))
407 return cida.hr();
408
409 /* convert the data into pidl */
410 LPITEMIDLIST pidl;
411 LPITEMIDLIST *apidl = _ILCopyCidaToaPidl(&pidl, cida);
412 if (!apidl)
413 {
414 return E_OUTOFMEMORY;
415 }
416
417 *ppidlfolder = pidl;
418 *apidlItems = apidl;
419 *pcidl = cida->cidl;
420
421 return S_OK;
422}
#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:2689
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41

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

◆ SHCreateLinks()

HRESULT WINAPI SHCreateLinks ( HWND  hWnd,
LPCSTR  lpszDir,
IDataObject lpDataObject,
UINT  uFlags,
LPITEMIDLIST lppidlLinks 
)

Definition at line 429 of file shlfolder.cpp.

431{
432 FIXME("%p %s %p %08x %p\n", hWnd, lpszDir, lpDataObject, uFlags, lppidlLinks);
433 return E_NOTIMPL;
434}
HWND hWnd
Definition: settings.c:17
#define FIXME(fmt,...)
Definition: precomp.h:53
#define E_NOTIMPL
Definition: ddrawi.h:99
UINT uFlags
Definition: api.c:59

◆ SHELL32_BindToSF()

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

Definition at line 196 of file shlfolder.cpp.

198{
199 PITEMID_CHILD pidlChild = ILCloneFirst (pidl);
200 if (!pidlChild)
201 return E_FAIL;
202
205 ppfti,
206 pidlChild,
207 clsid,
209 ILFree(pidlChild);
210
212 return hr;
213
214 if (_ILIsPidlSimple (pidl))
215 return psf->QueryInterface(riid, ppvOut);
216 else
217 return psf->BindToObject(ILGetNext (pidl), NULL, riid, ppvOut);
218}
#define E_FAIL
Definition: ddrawi.h:102
BOOL WINAPI _ILIsPidlSimple(LPCITEMIDLIST pidl)
REFIID riid
Definition: atlbase.h:39
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:1042
LPITEMIDLIST WINAPI ILCloneFirst(LPCITEMIDLIST pidl)
Definition: pidl.c:262
LPITEMIDLIST WINAPI ILGetNext(LPCITEMIDLIST pidl)
Definition: pidl.c:968
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:158
#define IID_PPV_ARG(Itype, ppType)

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

◆ SHELL32_CoCreateInitSF() [1/2]

HRESULT SHELL32_CoCreateInitSF ( LPCITEMIDLIST  pidlRoot,
const GUID clsid,
int  csidl,
REFIID  riid,
LPVOID ppvOut 
)

Definition at line 185 of file shlfolder.cpp.

187{
188 /* fill the PERSIST_FOLDER_TARGET_INFO */
189 PERSIST_FOLDER_TARGET_INFO pfti = {0};
190 pfti.dwAttributes = -1;
191 pfti.csidl = csidl;
192
193 return SHELL32_CoCreateInitSF(pidlRoot, &pfti, NULL, clsid, riid, ppvOut);
194}

◆ SHELL32_CoCreateInitSF() [2/2]

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

Definition at line 158 of file shlfolder.cpp.

160{
161 HRESULT hr;
162 CComPtr<IShellFolder> pShellFolder;
163
165 if (FAILED(hr))
166 return hr;
167
168 LPITEMIDLIST pidlAbsolute = ILCombine (pidlRoot, pidlChild);
171
172 if (ppfti && SUCCEEDED(pShellFolder->QueryInterface(IID_PPV_ARG(IPersistFolder3, &ppf3))))
173 {
174 ppf3->InitializeEx(NULL, pidlAbsolute, ppfti);
175 }
176 else if (SUCCEEDED(pShellFolder->QueryInterface(IID_PPV_ARG(IPersistFolder, &ppf))))
177 {
178 ppf->Initialize(pidlAbsolute);
179 }
180 ILFree (pidlAbsolute);
181
182 return pShellFolder->QueryInterface(riid, ppvOut);
183}
HRESULT WINAPI SHCoCreateInstance(LPCWSTR aclsid, const CLSID *clsid, LPUNKNOWN pUnkOuter, REFIID refiid, LPVOID *ppv)
Definition: shellole.c:105
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define FAILED(hr)
Definition: intsafe.h:51
LPITEMIDLIST WINAPI ILCombine(LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
Definition: pidl.c:814

Referenced by SHELL32_BindToSF(), and SHELL32_CoCreateInitSF().

◆ SHELL32_CompareChildren()

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

Definition at line 252 of file shlfolder.cpp.

253{
254 PUIDLIST_RELATIVE nextpidl1 = ILGetNext (pidl1);
255 PUIDLIST_RELATIVE nextpidl2 = ILGetNext (pidl2);
256
257 bool isEmpty1 = _ILIsDesktop(nextpidl1);
258 bool isEmpty2 = _ILIsDesktop(nextpidl2);
259 if (isEmpty1 || isEmpty2)
260 return MAKE_COMPARE_HRESULT(isEmpty2 - isEmpty1);
261
262 PITEMID_CHILD firstpidl = ILCloneFirst (pidl1);
263 if (!firstpidl)
264 return E_OUTOFMEMORY;
265
267 HRESULT hr = psf->BindToObject(firstpidl, 0, IID_PPV_ARG(IShellFolder, &psf2));
268 ILFree(firstpidl);
269 if (FAILED(hr))
270 return MAKE_COMPARE_HRESULT(0);
271
272 return psf2->CompareIDs(lParam, nextpidl1, nextpidl2);
273}
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 MAKE_COMPARE_HRESULT(x)
Definition: shellutils.h:619
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 275 of file shlfolder.cpp.

276{
278 WCHAR wszItem1[MAX_PATH], wszItem2[MAX_PATH];
280 UINT col = LOWORD(lParam); // Column index without SHCIDS_* flags
281
282 hres = isf->GetDetailsOf(pidl1, col, &sd);
283 if (FAILED(hres))
284 return MAKE_COMPARE_HRESULT(1);
285
286 hres = StrRetToBufW(&sd.str, pidl1, wszItem1, MAX_PATH);
287 if (FAILED(hres))
288 return MAKE_COMPARE_HRESULT(1);
289
290 hres = isf->GetDetailsOf(pidl2, col, &sd);
291 if (FAILED(hres))
292 return MAKE_COMPARE_HRESULT(1);
293
294 hres = StrRetToBufW(&sd.str, pidl2, wszItem2, MAX_PATH);
295 if (FAILED(hres))
296 return MAKE_COMPARE_HRESULT(1);
297
298 int ret = _wcsicmp(wszItem1, wszItem2);
299 if (ret == 0)
300 return SHELL32_CompareChildren(isf, lParam, pidl1, pidl2);
301
303}
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
#define LOWORD(l)
Definition: pedump.c:82
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
HRESULT SHELL32_CompareChildren(IShellFolder2 *psf, LPARAM lParam, LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
Definition: shlfolder.cpp:252
int ret

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

◆ SHELL32_DefaultContextMenuCallBack()

HRESULT SHELL32_DefaultContextMenuCallBack ( IShellFolder psf,
IDataObject pdo,
UINT  msg 
)

Definition at line 525 of file shlfolder.cpp.

526{
527 switch (msg)
528 {
530 return S_OK; // Yes, I want verbs
532 return S_FALSE; // Do it for me please
534 return S_FALSE; // Supposedly "required for Windows 7 to pick a default"
535 }
536 return E_NOTIMPL;
537}
#define msg(x)
Definition: auth_time.c:54
#define DFM_GETDEFSTATICID
Definition: precomp.h:47
#define DFM_MERGECONTEXTMENU
Definition: precomp.h:44
#define DFM_INVOKECOMMAND
Definition: precomp.h:45
#define S_FALSE
Definition: winerror.h:2357

Referenced by CDesktopFolder::CallBack(), CDrivesFolder::CallBack(), CFSFolder::CallBack(), CNetFolderBackgroundMenuCB(), DrivesContextMenuCallback(), NetFolderMenuCallback(), and RegFolderContextMenuCallback().

◆ SHELL32_GetDisplayNameOfChild()

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

Definition at line 234 of file shlfolder.cpp.

236{
237 LPITEMIDLIST pidlFirst = ILCloneFirst(pidl);
238 if (!pidlFirst)
239 return E_OUTOFMEMORY;
240
241 CComPtr<IShellFolder> psfChild;
242 HRESULT hr = psf->BindToObject(pidlFirst, NULL, IID_PPV_ARG(IShellFolder, &psfChild));
243 if (SUCCEEDED (hr))
244 {
245 hr = psfChild->GetDisplayNameOf(ILGetNext (pidl), dwFlags, strRet);
246 }
247 ILFree (pidlFirst);
248
249 return hr;
250}
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1176

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

◆ SHELL32_ParseNextElement()

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

Definition at line 107 of file shlfolder.cpp.

109{
111 LPITEMIDLIST pidlIn = pidlInOut ? *pidlInOut : NULL;
112 LPITEMIDLIST pidlOut = NULL;
113 LPITEMIDLIST pidlTemp = NULL;
114 CComPtr<IShellFolder> psfChild;
115
116 TRACE ("(%p, %p, %p, %s)\n", psf, pbc, pidlIn, debugstr_w (szNext));
117
118 /* get the shellfolder for the child pidl and let it analyse further */
119 hr = psf->BindToObject(pidlIn, pbc, IID_PPV_ARG(IShellFolder, &psfChild));
120 if (FAILED(hr))
121 return hr;
122
123 hr = psfChild->ParseDisplayName(hwndOwner, pbc, szNext, pEaten, &pidlOut, pdwAttributes);
124 if (FAILED(hr))
125 return hr;
126
127 pidlTemp = ILCombine (pidlIn, pidlOut);
128 if (!pidlTemp)
129 {
131 if (pidlOut)
132 ILFree(pidlOut);
133 return hr;
134 }
135
136 if (pidlOut)
137 ILFree (pidlOut);
138
139 if (pidlIn)
140 ILFree (pidlIn);
141
142 *pidlInOut = pidlTemp;
143
144 TRACE ("-- pidl=%p ret=0x%08x\n", pidlInOut ? *pidlInOut : NULL, hr);
145 return S_OK;
146}
#define E_INVALIDARG
Definition: ddrawi.h:101
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4

Referenced by CRegFolder::ParseDisplayName().

◆ SHELL32_ShowPropertiesDialog()

HRESULT SHELL32_ShowPropertiesDialog ( IDataObject pdtobj)

Definition at line 508 of file shlfolder.cpp.

509{
510 if (!pdtobj)
511 return E_INVALIDARG;
512
513 CDataObjectHIDA cida(pdtobj);
514 if (FAILED_UNEXPECTEDLY(cida.hr()))
515 return cida.hr();
516 if (cida->cidl > 1)
517 {
518 ERR("SHMultiFileProperties is not yet implemented\n");
519 return E_FAIL;
520 }
522}
HRESULT SHELL32_ShowFilesystemItemPropertiesDialogAsync(IDataObject *pDO)
Definition: item_prop.cpp:126

Referenced by CDefaultContextMenu::DoProperties(), and SHMultiFileProperties().

◆ SHELL_GetDefaultFolderEnumSHCONTF()

SHCONTF SHELL_GetDefaultFolderEnumSHCONTF ( )

Definition at line 29 of file shlfolder.cpp.

30{
31 SHCONTF Flags = SHCONTF_FOLDERS | SHCONTF_NONFOLDERS;
34 if (ss.fShowAllObjects)
35 Flags |= SHCONTF_INCLUDEHIDDEN;
36 if (ss.fShowSuperHidden)
37 Flags |= SHCONTF_INCLUDESUPERHIDDEN;
38 return Flags;
39}
#define FALSE
Definition: types.h:117
#define ss
Definition: i386-dis.c:441
static SHCONTF
Definition: ordinal.c:64
VOID WINAPI SHGetSetSettings(LPSHELLSTATE lpss, DWORD dwMask, BOOL bSet)
Definition: shellord.c:225
#define SSF_SHOWSUPERHIDDEN
Definition: shlobj.h:1621
#define SSF_SHOWALLOBJECTS
Definition: shlobj.h:1605
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170

Referenced by SHELL32_GetFSItemAttributes().

◆ SHELL_IncludeItemInFolderEnum()

BOOL SHELL_IncludeItemInFolderEnum ( IShellFolder pSF,
PCUITEMID_CHILD  pidl,
SFGAOF  Query,
SHCONTF  Flags 
)

Definition at line 41 of file shlfolder.cpp.

42{
43 if (SUCCEEDED(pSF->GetAttributesOf(1, &pidl, &Query)))
44 {
45 if (Query & SFGAO_NONENUMERATED)
46 return FALSE;
47 if ((Query & SFGAO_HIDDEN) && !(Flags & SHCONTF_INCLUDEHIDDEN))
48 return FALSE;
49 if ((Query & (SFGAO_HIDDEN | SFGAO_SYSTEM)) == (SFGAO_HIDDEN | SFGAO_SYSTEM) && !(Flags & SHCONTF_INCLUDESUPERHIDDEN))
50 return FALSE;
51 if ((Flags & (SHCONTF_FOLDERS | SHCONTF_NONFOLDERS)) != (SHCONTF_FOLDERS | SHCONTF_NONFOLDERS))
52 return (Flags & SHCONTF_FOLDERS) ? (Query & SFGAO_FOLDER) : !(Query & SFGAO_FOLDER);
53 }
54 return TRUE;
55}
BOOL Query(LPCTSTR *ServiceArgs, DWORD ArgCount, BOOL bExtended)
Definition: query.c:292
#define TRUE
Definition: types.h:120
HRESULT GetAttributesOf([in] UINT cidl, [in, size_is(cidl)] PCUITEMID_CHILD_ARRAY apidl, [in, out] SFGAOF *rgfInOut)

Referenced by CRegFolderEnum::AddItemsFromKey(), and CRegFolderEnum::Initialize().

◆ Shell_NextElement()

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

Definition at line 58 of file shlfolder.cpp.

63{
64 *pszOut = UNICODE_NULL;
65
66 if (!*ppch)
67 return S_FALSE;
68
69 HRESULT hr;
70 LPWSTR pchNext = wcschr(*ppch, L'\\');
71 if (pchNext)
72 {
73 if (*ppch < pchNext)
74 {
75 /* Get an element */
76 StringCchCopyNW(pszOut, cchOut, *ppch, pchNext - *ppch);
77 ++pchNext;
78
79 if (!*pchNext)
80 pchNext = NULL; /* No next */
81
82 hr = S_OK;
83 }
84 else /* Double backslashes found? */
85 {
86 pchNext = NULL;
88 }
89 }
90 else /* No more next */
91 {
92 StringCchCopyW(pszOut, cchOut, *ppch);
93 hr = S_OK;
94 }
95
96 *ppch = pchNext; /* Go next */
97
98 if (hr == S_OK && bValidate && !PathIsValidElement(pszOut))
99 {
100 *pszOut = UNICODE_NULL;
102 }
103
104 return hr;
105}
#define wcschr
Definition: compat.h:17
BOOL PathIsValidElement(_In_ LPCWSTR pszPath)
Definition: utils.cpp:71
#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
WCHAR * LPWSTR
Definition: xmlstorage.h:184

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

◆ SHOpenFolderAndSelectItems()

EXTERN_C HRESULT WINAPI SHOpenFolderAndSelectItems ( PCIDLIST_ABSOLUTE  pidlFolder,
UINT  cidl,
PCUITEMID_CHILD_ARRAY  apidl,
DWORD  dwFlags 
)

Definition at line 443 of file shlfolder.cpp.

447{
448 ERR("SHOpenFolderAndSelectItems() is hackplemented\n");
450 PCIDLIST_ABSOLUTE pidlItem;
451 if (cidl)
452 {
453 /* Firefox sends a full pidl here dispite the fact it is a PCUITEMID_CHILD_ARRAY -_- */
454 if (!ILIsSingle(apidl[0]))
455 {
456 pidlItem = apidl[0];
457 }
458 else
459 {
460 HRESULT hr = SHILCombine(pidlFolder, apidl[0], &pidlItem);
462 return hr;
463 freeItem.Attach(const_cast<PIDLIST_ABSOLUTE>(pidlItem));
464 }
465 }
466 else
467 {
468 pidlItem = pidlFolder;
469 }
470
471 CComPtr<IShellFolder> psfDesktop;
472
473 HRESULT hr = SHGetDesktopFolder(&psfDesktop);
475 return hr;
476
477 STRRET strret;
478 hr = psfDesktop->GetDisplayNameOf(pidlItem, SHGDN_FORPARSING, &strret);
480 return hr;
481
482 WCHAR wszBuf[MAX_PATH];
483 hr = StrRetToBufW(&strret, pidlItem, wszBuf, _countof(wszBuf));
485 return hr;
486
487 WCHAR wszParams[MAX_PATH];
488 wcscpy(wszParams, L"/select,");
489 wcscat(wszParams, wszBuf);
490
492 memset(&sei, 0, sizeof sei);
493 sei.cbSize = sizeof sei;
495 sei.lpFile = L"explorer.exe";
496 sei.lpParameters = wszParams;
497
498 if (ShellExecuteExW(&sei))
499 return S_OK;
500 else
501 return E_FAIL;
502}
HRESULT WINAPI SHGetDesktopFolder(IShellFolder **psf)
void Attach(T *lp)
Definition: atlalloc.h:162
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
_CRTIMP wchar_t *__cdecl wcscat(_Inout_updates_z_(_String_length_(_Dest)+_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
#define memset(x, y, z)
Definition: compat.h:39
#define SEE_MASK_WAITFORINPUTIDLE
Definition: shellapi.h:58
static BOOL ILIsSingle(LPCITEMIDLIST pidl)
Definition: shellutils.h:627
BOOL WINAPI DECLSPEC_HOTPATCH ShellExecuteExW(LPSHELLEXECUTEINFOW sei)
Definition: shlexec.cpp:2434
LPCWSTR lpParameters
Definition: shellapi.h:334

Referenced by CFindFolderContextMenu::InvokeCommand(), and CShellLink::OnCommand().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( shell  )