ReactOS 0.4.15-dev-8393-g61b7fb9
CDesktopFolder Class Reference

#include <CDesktopFolder.h>

Inheritance diagram for CDesktopFolder:
Collaboration diagram for CDesktopFolder:

Public Member Functions

 CDesktopFolder ()
 
 ~CDesktopFolder ()
 
HRESULT WINAPI FinalConstruct ()
 
STDMETHOD() ParseDisplayName (HWND hwndOwner, LPBC pbc, LPOLESTR lpszDisplayName, DWORD *pchEaten, PIDLIST_RELATIVE *ppidl, DWORD *pdwAttributes) override
 
STDMETHOD() EnumObjects (HWND hwndOwner, DWORD dwFlags, LPENUMIDLIST *ppEnumIDList) override
 
STDMETHOD() BindToObject (PCUIDLIST_RELATIVE pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut) override
 
STDMETHOD() BindToStorage (PCUIDLIST_RELATIVE pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut) override
 
STDMETHOD() CompareIDs (LPARAM lParam, PCUIDLIST_RELATIVE pidl1, PCUIDLIST_RELATIVE pidl2) override
 
STDMETHOD() CreateViewObject (HWND hwndOwner, REFIID riid, LPVOID *ppvOut) override
 
STDMETHOD() GetAttributesOf (UINT cidl, PCUITEMID_CHILD_ARRAY apidl, DWORD *rgfInOut) override
 
STDMETHOD() GetUIObjectOf (HWND hwndOwner, UINT cidl, PCUITEMID_CHILD_ARRAY apidl, REFIID riid, UINT *prgfInOut, LPVOID *ppvOut) override
 
STDMETHOD() GetDisplayNameOf (PCUITEMID_CHILD pidl, DWORD dwFlags, LPSTRRET strRet) override
 
STDMETHOD() SetNameOf (HWND hwndOwner, PCUITEMID_CHILD pidl, LPCOLESTR lpName, DWORD dwFlags, PITEMID_CHILD *pPidlOut) override
 
STDMETHOD() GetDefaultSearchGUID (GUID *pguid) override
 
STDMETHOD() EnumSearches (IEnumExtraSearch **ppenum) override
 
STDMETHOD() GetDefaultColumn (DWORD dwRes, ULONG *pSort, ULONG *pDisplay) override
 
STDMETHOD() GetDefaultColumnState (UINT iColumn, DWORD *pcsFlags) override
 
STDMETHOD() GetDetailsEx (PCUITEMID_CHILD pidl, const SHCOLUMNID *pscid, VARIANT *pv) override
 
STDMETHOD() GetDetailsOf (PCUITEMID_CHILD pidl, UINT iColumn, SHELLDETAILS *psd) override
 
STDMETHOD() MapColumnToSCID (UINT column, SHCOLUMNID *pscid) override
 
STDMETHOD() GetClassID (CLSID *lpClassId) override
 
STDMETHOD() Initialize (PCIDLIST_ABSOLUTE pidl) override
 
STDMETHOD() GetCurFolder (PIDLIST_ABSOLUTE *pidl) override
 
STDMETHOD() CallBack (IShellFolder *psf, HWND hwndOwner, IDataObject *pdtobj, UINT uMsg, WPARAM wParam, LPARAM lParam) override
 
STDMETHODIMP GetMaxLength (LPCWSTR pszName, int *piMaxNameLen) override
 
STDMETHODIMP GetValidCharacters (LPWSTR *ppwszValidChars, LPWSTR *ppwszInvalidChars) override
 
- Public Member Functions inherited from ATL::CComObjectRootEx< CComMultiThreadModelNoCS >
 ~CComObjectRootEx ()
 
ULONG InternalAddRef ()
 
ULONG InternalRelease ()
 
void Lock ()
 
void Unlock ()
 
HRESULT _AtlInitialConstruct ()
 
- Public Member Functions inherited from ATL::CComObjectRootBase
 CComObjectRootBase ()
 
 ~CComObjectRootBase ()
 
void SetVoid (void *)
 
HRESULT _AtlFinalConstruct ()
 
HRESULT FinalConstruct ()
 
void InternalFinalConstructAddRef ()
 
void InternalFinalConstructRelease ()
 
void FinalRelease ()
 
HRESULT GetDefaultSearchGUID ([out] GUID *lpguid)
 
HRESULT EnumSearches ([out] IEnumExtraSearch **ppenum)
 
HRESULT GetDefaultColumn ([in] DWORD dwReserved, [out] ULONG *pSort, [out] ULONG *pDisplay)
 
HRESULT GetDefaultColumnState ([in] UINT iColumn, [out] SHCOLSTATEF *pcsFlags)
 
HRESULT GetDetailsEx ([in] PCUITEMID_CHILD pidl, [in] const SHCOLUMNID *pscid, [out] VARIANT *pv)
 
HRESULT GetDetailsOf ([in] PCUITEMID_CHILD pidl, [in] UINT iColumn, [out] SHELLDETAILS *psd)
 
HRESULT MapColumnToSCID ([in] UINT iColumn, [in] SHCOLUMNID *pscid)
 
- Public Member Functions inherited from IShellFolder
HRESULT ParseDisplayName ([in] HWND hwndOwner, [in] LPBC pbcReserved, [in, string] LPOLESTR lpszDisplayName, [out] ULONG *pchEaten, [out] PIDLIST_RELATIVE *ppidl, [in, out, unique] ULONG *pdwAttributes)
 
HRESULT EnumObjects ([in] HWND hwndOwner, [in] SHCONTF grfFlags, [out] IEnumIDList **ppenumIDList)
 
HRESULT BindToObject ([in] PCUIDLIST_RELATIVE pidl, [in] LPBC pbcReserved, [in] REFIID riid, [out, iid_is(riid)] void **ppvOut)
 
HRESULT BindToStorage ([in] PCUIDLIST_RELATIVE pidl, [in] LPBC pbcReserved, [in] REFIID riid, [out, iid_is(riid)] void **ppvObj)
 
HRESULT CompareIDs ([in] LPARAM lParam, [in] PCUIDLIST_RELATIVE pidl1, [in] PCUIDLIST_RELATIVE pidl2)
 
HRESULT CreateViewObject ([in] HWND hwndOwner, [in] REFIID riid, [out, iid_is(riid)] void **ppvOut)
 
HRESULT GetAttributesOf ([in] UINT cidl, [in, size_is(cidl)] PCUITEMID_CHILD_ARRAY apidl, [in, out] SFGAOF *rgfInOut)
 
HRESULT GetUIObjectOf ([in] HWND hwndOwner, [in] UINT cidl, [in, size_is(cidl)] PCUITEMID_CHILD_ARRAY apidl, [in] REFIID riid, [in, out, unique] UINT *prgfInOut, [out, iid_is(riid)] void **ppvOut)
 
HRESULT GetDisplayNameOf ([in] PCUITEMID_CHILD pidl, [in] SHGDNF uFlags, [out] STRRET *lpName)
 
HRESULT SetNameOf ([in] HWND hwnd, [in] PCUITEMID_CHILD pidl, [in, string] LPCOLESTR lpszName, [in] SHGDNF uFlags, [out] PITEMID_CHILD *ppidlOut)
 
- Public Member Functions inherited from IUnknown
HRESULT QueryInterface ([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
 
ULONG AddRef ()
 
ULONG Release ()
 
HRESULT GetCurFolder ([out] PIDLIST_ABSOLUTE *ppidl)
 
HRESULT Initialize ([in] PCIDLIST_ABSOLUTE pidl)
 
HRESULT GetClassID ([out] CLSID *pClassID)
 
HRESULT CallBack ([in] IShellFolder *psf, [in] HWND hwndOwner, [in] IDataObject *pdtobj, [in] UINT uMsg, [in] WPARAM wParam, [in] LPARAM lParam)
 

Private Member Functions

HRESULT _GetSFFromPidl (LPCITEMIDLIST pidl, IShellFolder2 **psf)
 
HRESULT _ParseDisplayNameByParent (HWND hwndOwner, LPBC pbc, LPOLESTR pszPath, DWORD *pchEaten, PIDLIST_RELATIVE *ppidl, DWORD *pdwAttributes)
 
STDMETHODIMP ShellUrlParseDisplayName (HWND hwndOwner, LPBC pbc, LPOLESTR lpszDisplayName, DWORD *pchEaten, PIDLIST_RELATIVE *ppidl, DWORD *pdwAttributes)
 
STDMETHODIMP HttpUrlParseDisplayName (HWND hwndOwner, LPBC pbc, LPOLESTR lpszDisplayName, DWORD *pchEaten, PIDLIST_RELATIVE *ppidl, DWORD *pdwAttributes)
 

Static Private Member Functions

static HRESULT GetColumnDetails (UINT iColumn, SHELLDETAILS &sd)
 

Private Attributes

CComPtr< IShellFolder2m_DesktopFSFolder
 
CComPtr< IShellFolder2m_SharedDesktopFSFolder
 
CComPtr< IShellFolder2m_regFolder
 
LPWSTR sPathTarget
 
LPITEMIDLIST pidlRoot
 

Additional Inherited Members

- Public Types inherited from IShellFolder2
typedef struct IShellFolder2::SHCOLUMNIDLPSHCOLUMNID
 
typedef const SHCOLUMNIDLPCSHCOLUMNID
 
- Public Types inherited from IShellFolder
enum  tagSHGDN {
  SHGDN_NORMAL = 0 , SHGDN_INFOLDER = 1 , SHGDN_FOREDITING = 0x1000 , SHGDN_INCLUDE_NONFILESYS = 0x2000 ,
  SHGDN_FORADDRESSBAR = 0x4000 , SHGDN_FORPARSING = 0x8000
}
 
enum  tagSHCONTF {
  SHCONTF_FOLDERS = 32 , SHCONTF_NONFOLDERS = 64 , SHCONTF_INCLUDEHIDDEN = 128 , SHCONTF_INIT_ON_FIRST_NEXT = 256 ,
  SHCONTF_NETPRINTERSRCH = 512 , SHCONTF_SHAREABLE = 1024 , SHCONTF_STORAGE = 2048 , SHCONTF_NAVIGATION_ENUM = 0x01000 ,
  SHCONTF_FASTITEMS = 0x02000 , SHCONTF_FLATLIST = 0x04000 , SHCONTF_ENABLE_ASYNC = 0x08000 , SHCONTF_INCLUDESUPERHIDDEN = 0x10000
}
 
typedef IShellFolderLPSHELLFOLDER
 
typedef enum IShellFolder::tagSHGDN SHGNO
 
typedef DWORD SHGDNF
 
typedef DWORD SHCONTF
 
typedef ULONG SFGAOF
 
- Public Types inherited from IUnknown
typedef IUnknownLPUNKNOWN
 
- Public Types inherited from IPersistFolder2
typedef IPersistFolder2LPPERSISTFOLDER2
 
- Public Types inherited from IPersistFolder
typedef IPersistFolderLPPERSISTFOLDER
 
- Public Types inherited from IPersist
typedef IPersistLPPERSIST
 
- Static Public Member Functions inherited from ATL::CComObjectRootBase
static void WINAPI ObjectMain (bool)
 
static const struct _ATL_CATMAP_ENTRYGetCategoryMap ()
 
static HRESULT WINAPI InternalQueryInterface (void *pThis, const _ATL_INTMAP_ENTRY *pEntries, REFIID iid, void **ppvObject)
 
- Public Attributes inherited from ATL::CComObjectRootBase
LONG m_dwRef
 

Detailed Description

Definition at line 26 of file CDesktopFolder.h.

Constructor & Destructor Documentation

◆ CDesktopFolder()

CDesktopFolder::CDesktopFolder ( )

Definition at line 303 of file CDesktopFolder.cpp.

303 :
306{
307}
LPITEMIDLIST pidlRoot
#define NULL
Definition: types.h:112

◆ ~CDesktopFolder()

CDesktopFolder::~CDesktopFolder ( )

Definition at line 309 of file CDesktopFolder.cpp.

310{
311}

Member Function Documentation

◆ _GetSFFromPidl()

HRESULT CDesktopFolder::_GetSFFromPidl ( LPCITEMIDLIST  pidl,
IShellFolder2 **  psf 
)
private

Definition at line 360 of file CDesktopFolder.cpp.

361{
362 WCHAR szFileName[MAX_PATH];
363
364 if (_ILIsSpecialFolder(pidl))
365 return m_regFolder->QueryInterface(IID_PPV_ARG(IShellFolder2, psf));
366
367 lstrcpynW(szFileName, sPathTarget, MAX_PATH - 1);
368 PathAddBackslashW(szFileName);
369 int cLen = wcslen(szFileName);
370
371 if (!_ILSimpleGetTextW(pidl, szFileName + cLen, MAX_PATH - cLen))
372 return E_FAIL;
373
375 return m_SharedDesktopFSFolder->QueryInterface(IID_PPV_ARG(IShellFolder2, psf));
376 else
377 return m_DesktopFSFolder->QueryInterface(IID_PPV_ARG(IShellFolder2, psf));
378}
CComPtr< IShellFolder2 > m_SharedDesktopFSFolder
CComPtr< IShellFolder2 > m_DesktopFSFolder
CComPtr< IShellFolder2 > m_regFolder
#define E_FAIL
Definition: ddrawi.h:102
#define MAX_PATH
Definition: compat.h:34
#define lstrcpynW
Definition: compat.h:738
static BOOL _ILIsSpecialFolder(LPCITEMIDLIST pidl)
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define PathAddBackslashW
Definition: pathcch.h:301
DWORD _ILSimpleGetTextW(LPCITEMIDLIST pidl, LPWSTR szOut, UINT uOutSize)
Definition: pidl.c:2074
#define INVALID_FILE_ATTRIBUTES
Definition: vfdcmd.c:23
#define GetFileAttributes
Definition: winbase.h:3815
#define IID_PPV_ARG(Itype, ppType)
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by BindToObject(), GetAttributesOf(), GetDetailsOf(), GetDisplayNameOf(), GetUIObjectOf(), and SetNameOf().

◆ _ParseDisplayNameByParent()

HRESULT CDesktopFolder::_ParseDisplayNameByParent ( HWND  hwndOwner,
LPBC  pbc,
LPOLESTR  pszPath,
DWORD pchEaten,
PIDLIST_RELATIVE ppidl,
DWORD pdwAttributes 
)
private

Definition at line 380 of file CDesktopFolder.cpp.

387{
388 if (pchEaten)
389 *pchEaten = 0;
390
391 CComHeapPtr<ITEMIDLIST> pidlParent;
392 BOOL bPath = FALSE;
393 WCHAR wch = *lpszDisplayName;
394 if (((L'A' <= wch && wch <= L'Z') || (L'a' <= wch && wch <= L'z')) &&
395 (lpszDisplayName[1] == L':'))
396 {
397 // "C:..."
398 bPath = TRUE;
399 pidlParent.Attach(_ILCreateMyComputer());
400 }
401 else if (PathIsUNCW(lpszDisplayName)) // "\\\\..."
402 {
403 bPath = TRUE;
404 pidlParent.Attach(_ILCreateNetwork());
405 }
406
407 if (bPath)
408 {
409 if (!pidlParent)
410 return E_OUTOFMEMORY;
411
412 CComPtr<IShellFolder> pParentFolder;
413 SHBindToObject(NULL, pidlParent, IID_PPV_ARG(IShellFolder, &pParentFolder));
414
415 CComHeapPtr<ITEMIDLIST> pidlChild;
416 HRESULT hr = pParentFolder->ParseDisplayName(hwndOwner, pbc, lpszDisplayName,
417 pchEaten, &pidlChild, pdwAttributes);
418 if (FAILED(hr))
419 return hr;
420
421 *ppidl = ILCombine(pidlParent, pidlChild);
422 return (*ppidl ? S_OK : E_OUTOFMEMORY);
423 }
424
425 if (!UrlIsW(lpszDisplayName, URLIS_URL) || SHSkipJunctionBinding(pbc, NULL))
426 return E_INVALIDARG;
427
428 // Now lpszDisplayName is a URL
429 PARSEDURLW ParsedURL = { sizeof(ParsedURL) };
430 ::ParseURLW(lpszDisplayName, &ParsedURL);
431
432 switch (ParsedURL.nScheme)
433 {
434 case URL_SCHEME_FILE: // "file:..."
435 {
436 // Convert "file://..." to a normal path
438 DWORD cchPath = _countof(szPath);
439 HRESULT hr = PathCreateFromUrlW(lpszDisplayName, szPath, &cchPath, 0);
441 return hr;
442
443 CComPtr<IShellFolder> psfDesktop;
444 hr = SHGetDesktopFolder(&psfDesktop);
446 return hr;
447
448 // Parse by desktop folder
449 return psfDesktop->ParseDisplayName(hwndOwner, pbc, szPath, pchEaten, ppidl,
450 pdwAttributes);
451 }
452 case URL_SCHEME_HTTP: // "http:..."
453 case URL_SCHEME_HTTPS: // "https:..."
454 {
455 if (!BindCtx_ContainsObject(pbc, STR_PARSE_PREFER_FOLDER_BROWSING))
456 return E_INVALIDARG;
457
458 return HttpUrlParseDisplayName(hwndOwner,
459 pbc,
460 lpszDisplayName,
461 pchEaten,
462 ppidl,
463 pdwAttributes);
464 }
465 case URL_SCHEME_SHELL: // "shell:..."
466 {
467 return ShellUrlParseDisplayName(hwndOwner,
468 pbc,
469 lpszDisplayName,
470 pchEaten,
471 ppidl,
472 pdwAttributes);
473 }
476 {
477 WARN("We don't support 'ms-shell-rooted:' and 'ms-shell-idlist:' schemes\n");
478 break;
479 }
480 default:
481 {
482 TRACE("Scheme: %u\n", ParsedURL.nScheme);
483 break;
484 }
485 }
486
487 return E_INVALIDARG;
488}
HRESULT WINAPI SHGetDesktopFolder(IShellFolder **psf)
#define WARN(fmt,...)
Definition: precomp.h:61
STDMETHODIMP HttpUrlParseDisplayName(HWND hwndOwner, LPBC pbc, LPOLESTR lpszDisplayName, DWORD *pchEaten, PIDLIST_RELATIVE *ppidl, DWORD *pdwAttributes)
STDMETHODIMP ShellUrlParseDisplayName(HWND hwndOwner, LPBC pbc, LPOLESTR lpszDisplayName, DWORD *pchEaten, PIDLIST_RELATIVE *ppidl, DWORD *pdwAttributes)
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define E_INVALIDARG
Definition: ddrawi.h:101
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define FAILED_UNEXPECTEDLY(hr)
Definition: precomp.h:121
BOOL BindCtx_ContainsObject(_In_ IBindCtx *pBindCtx, _In_ LPCWSTR pszName)
Definition: utils.cpp:120
EXTERN_C HRESULT SHBindToObject(_In_opt_ IShellFolder *psf, _In_ LPCITEMIDLIST pidl, _In_ REFIID riid, _Out_ void **ppvObj)
Definition: utils.cpp:220
BOOL SHSkipJunctionBinding(_In_ IBindCtx *pbc, _In_ CLSID *pclsid)
Definition: utils.cpp:141
HRESULT WINAPI PathCreateFromUrlW(LPCWSTR pszUrl, LPWSTR pszPath, LPDWORD pcchPath, DWORD dwReserved)
Definition: path.c:3355
BOOL WINAPI PathIsUNCW(LPCWSTR lpszPath)
Definition: path.c:2266
HRESULT WINAPI ParseURLW(LPCWSTR x, PARSEDURLW *y)
Definition: url.c:197
BOOL WINAPI UrlIsW(LPCWSTR pszUrl, URLIS Urlis)
Definition: url.c:1933
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
#define S_OK
Definition: intsafe.h:52
#define FAILED(hr)
Definition: intsafe.h:51
LPCWSTR szPath
Definition: env.c:37
#define L(x)
Definition: ntvdm.h:50
LPITEMIDLIST _ILCreateMyComputer(void)
Definition: pidl.c:1646
LPITEMIDLIST WINAPI ILCombine(LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
Definition: pidl.c:712
LPITEMIDLIST _ILCreateNetwork(void)
Definition: pidl.c:1710
HRESULT hr
Definition: shlfolder.c:183
@ URL_SCHEME_MSSHELLROOTED
Definition: shlwapi.h:1165
@ URL_SCHEME_HTTPS
Definition: shlwapi.h:1157
@ URL_SCHEME_MSSHELLIDLIST
Definition: shlwapi.h:1166
@ URL_SCHEME_HTTP
Definition: shlwapi.h:1148
@ URL_SCHEME_FILE
Definition: shlwapi.h:1155
@ URL_SCHEME_SHELL
Definition: shlwapi.h:1158
@ URLIS_URL
Definition: shlwapi.h:1191
#define _countof(array)
Definition: sndvol32.h:70
#define TRACE(s)
Definition: solgame.cpp:4
UINT nScheme
Definition: shlwapi.h:1437

Referenced by ParseDisplayName().

◆ BindToObject()

HRESULT WINAPI CDesktopFolder::BindToObject ( PCUIDLIST_RELATIVE  pidl,
LPBC  pbcReserved,
REFIID  riid,
LPVOID ppvOut 
)
override

Definition at line 630 of file CDesktopFolder.cpp.

635{
636 if (!pidl)
637 return E_INVALIDARG;
638
639 CComPtr<IShellFolder2> psf;
640 HRESULT hr = _GetSFFromPidl(pidl, &psf);
642 return hr;
643
644 return psf->BindToObject(pidl, pbcReserved, riid, ppvOut);
645}
HRESULT _GetSFFromPidl(LPCITEMIDLIST pidl, IShellFolder2 **psf)
REFIID riid
Definition: atlbase.h:39

Referenced by GetUIObjectOf().

◆ BindToStorage()

HRESULT WINAPI CDesktopFolder::BindToStorage ( PCUIDLIST_RELATIVE  pidl,
LPBC  pbcReserved,
REFIID  riid,
LPVOID ppvOut 
)
override

Definition at line 650 of file CDesktopFolder.cpp.

655{
656 FIXME ("(%p)->(pidl=%p,%p,%s,%p) stub\n",
657 this, pidl, pbcReserved, shdebugstr_guid (&riid), ppvOut);
658
659 *ppvOut = NULL;
660 return E_NOTIMPL;
661}
#define FIXME(fmt,...)
Definition: precomp.h:53
#define E_NOTIMPL
Definition: ddrawi.h:99
const char * shdebugstr_guid(const struct _GUID *id)
Definition: debughlp.cpp:428

◆ CallBack()

HRESULT WINAPI CDesktopFolder::CallBack ( IShellFolder psf,
HWND  hwndOwner,
IDataObject pdtobj,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
override

Implements IContextMenuCB.

Definition at line 1086 of file CDesktopFolder.cpp.

1087{
1088 enum { IDC_PROPERTIES };
1089 if (uMsg == DFM_INVOKECOMMAND && wParam == (pdtobj ? DFM_CMD_PROPERTIES : IDC_PROPERTIES))
1090 {
1091 return SHELL_ExecuteControlPanelCPL(hwndOwner, L"desk.cpl") ? S_OK : E_FAIL;
1092 }
1093 else if (uMsg == DFM_MERGECONTEXTMENU && !pdtobj) // Add Properties item when called for directory background
1094 {
1095 QCMINFO *pqcminfo = (QCMINFO *)lParam;
1096 HMENU hpopup = CreatePopupMenu();
1098 pqcminfo->idCmdFirst = Shell_MergeMenus(pqcminfo->hmenu, hpopup, pqcminfo->indexMenu, pqcminfo->idCmdFirst, pqcminfo->idCmdLast, MM_ADDSEPARATOR);
1099 DestroyMenu(hpopup);
1100 return S_OK;
1101 }
1102 return SHELL32_DefaultContextMenuCallBack(psf, pdtobj, uMsg);
1103}
#define IDS_PROPERTIES
Definition: resource.h:102
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define IDC_PROPERTIES
Definition: resource.h:32
#define DFM_MERGECONTEXTMENU
Definition: precomp.h:44
#define DFM_INVOKECOMMAND
Definition: precomp.h:45
#define SHELL_ExecuteControlPanelCPL(hwnd, cpl)
Definition: precomp.h:156
HRESULT SHELL32_DefaultContextMenuCallBack(IShellFolder *psf, IDataObject *pdo, UINT msg)
Definition: shlfolder.cpp:522
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:63
void WINAPI _InsertMenuItemW(HMENU hmenu, UINT indexMenu, BOOL fByPosition, UINT wID, UINT fType, LPCWSTR dwTypeData, UINT fState)
UINT WINAPI Shell_MergeMenus(HMENU hmDst, HMENU hmSrc, UINT uInsert, UINT uIDAdjust, UINT uIDAdjustMax, ULONG uFlags)
Definition: shlmenu.c:856
#define MM_ADDSEPARATOR
Definition: shlobj.h:2527
#define DFM_CMD_PROPERTIES
Definition: shlobj.h:2611
HMENU hmenu
Definition: shlobj.h:1389
UINT idCmdLast
Definition: shlobj.h:1392
UINT idCmdFirst
Definition: shlobj.h:1391
UINT indexMenu
Definition: shlobj.h:1390
HMENU WINAPI CreatePopupMenu(void)
Definition: menu.c:838
#define MFS_ENABLED
Definition: winuser.h:750
BOOL WINAPI DestroyMenu(_In_ HMENU)
#define MFT_STRING
Definition: winuser.h:746
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582

◆ CompareIDs()

HRESULT WINAPI CDesktopFolder::CompareIDs ( LPARAM  lParam,
PCUIDLIST_RELATIVE  pidl1,
PCUIDLIST_RELATIVE  pidl2 
)
override

Implements IShellFolder.

Definition at line 666 of file CDesktopFolder.cpp.

667{
668 bool bIsDesktopFolder1, bIsDesktopFolder2;
669
670 if (!pidl1 || !pidl2)
671 {
672 ERR("Got null pidl pointer (%Ix %p %p)!\n", lParam, pidl1, pidl2);
673 return E_INVALIDARG;
674 }
675
676 bIsDesktopFolder1 = _ILIsDesktop(pidl1);
677 bIsDesktopFolder2 = _ILIsDesktop(pidl2);
678 if (bIsDesktopFolder1 || bIsDesktopFolder2)
679 return MAKE_COMPARE_HRESULT(bIsDesktopFolder1 - bIsDesktopFolder2);
680
681 if (_ILIsSpecialFolder(pidl1) || _ILIsSpecialFolder(pidl2))
682 return m_regFolder->CompareIDs(lParam, pidl1, pidl2);
683
684 return m_DesktopFSFolder->CompareIDs(lParam, pidl1, pidl2);
685}
BOOL _ILIsDesktop(LPCITEMIDLIST pidl)
Definition: CBandSite.h:24
#define ERR(fmt,...)
Definition: precomp.h:57
#define MAKE_COMPARE_HRESULT(x)
Definition: shellutils.h:607

◆ CreateViewObject()

HRESULT WINAPI CDesktopFolder::CreateViewObject ( HWND  hwndOwner,
REFIID  riid,
LPVOID ppvOut 
)
override

Definition at line 690 of file CDesktopFolder.cpp.

694{
696
697 TRACE ("(%p)->(hwnd=%p,%s,%p)\n",
698 this, hwndOwner, shdebugstr_guid (&riid), ppvOut);
699
700 if (!ppvOut)
701 return hr;
702
703 *ppvOut = NULL;
704
705 if (IsEqualIID (riid, IID_IDropTarget))
706 {
707 hr = m_DesktopFSFolder->CreateViewObject(hwndOwner, riid, ppvOut);
708 }
709 else if (IsEqualIID (riid, IID_IContextMenu))
710 {
711 HKEY hKeys[16];
712 UINT cKeys = 0;
713 AddClassKeyToArray(L"Directory\\Background", hKeys, &cKeys);
714
715 DEFCONTEXTMENU dcm;
716 dcm.hwnd = hwndOwner;
717 dcm.pcmcb = this;
718 dcm.pidlFolder = pidlRoot;
719 dcm.psf = this;
720 dcm.cidl = 0;
721 dcm.apidl = NULL;
722 dcm.cKeys = cKeys;
723 dcm.aKeys = hKeys;
725 hr = SHCreateDefaultContextMenu (&dcm, riid, ppvOut);
726 }
727 else if (IsEqualIID (riid, IID_IShellView))
728 {
729 SFV_CREATE sfvparams = {sizeof(SFV_CREATE), this};
730 hr = SHCreateShellFolderView(&sfvparams, (IShellView**)ppvOut);
731 }
732 TRACE ("-- (%p)->(interface=%p)\n", this, ppvOut);
733 return hr;
734}
HRESULT WINAPI SHCreateShellFolderView(const SFV_CREATE *pcsfv, IShellView **ppsv)
Definition: CDefView.cpp:4380
HRESULT WINAPI SHCreateDefaultContextMenu(const DEFCONTEXTMENU *pdcm, REFIID riid, void **ppv)
unsigned int UINT
Definition: ndis.h:50
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
LSTATUS AddClassKeyToArray(const WCHAR *szClass, HKEY *array, UINT *cKeys)
Definition: shlfolder.cpp:277
struct _SFV_CREATE SFV_CREATE
IContextMenuCB * pcmcb
Definition: shlobj.h:2549
IShellFolder * psf
Definition: shlobj.h:2551
IUnknown * punkAssociationInfo
Definition: shlobj.h:2554
PCUITEMID_CHILD_ARRAY apidl
Definition: shlobj.h:2553
const HKEY * aKeys
Definition: shlobj.h:2556
PCIDLIST_ABSOLUTE pidlFolder
Definition: shlobj.h:2550

◆ EnumObjects()

HRESULT WINAPI CDesktopFolder::EnumObjects ( HWND  hwndOwner,
DWORD  dwFlags,
LPENUMIDLIST *  ppEnumIDList 
)
override

Definition at line 605 of file CDesktopFolder.cpp.

606{
607 CComPtr<IEnumIDList> pRegEnumerator;
608 CComPtr<IEnumIDList> pDesktopEnumerator;
609 CComPtr<IEnumIDList> pCommonDesktopEnumerator;
610 HRESULT hr;
611
612 hr = m_regFolder->EnumObjects(hwndOwner, dwFlags, &pRegEnumerator);
613 if (FAILED(hr))
614 ERR("EnumObjects for reg folder failed\n");
615
616 hr = m_DesktopFSFolder->EnumObjects(hwndOwner, dwFlags, &pDesktopEnumerator);
617 if (FAILED(hr))
618 ERR("EnumObjects for desktop fs folder failed\n");
619
620 hr = m_SharedDesktopFSFolder->EnumObjects(hwndOwner, dwFlags, &pCommonDesktopEnumerator);
621 if (FAILED(hr))
622 ERR("EnumObjects for shared desktop fs folder failed\n");
623
624 return ShellObjectCreatorInit<CDesktopFolderEnum>(dwFlags,pRegEnumerator, pDesktopEnumerator, pCommonDesktopEnumerator, IID_PPV_ARG(IEnumIDList, ppEnumIDList));
625}
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1176

◆ EnumSearches()

HRESULT WINAPI CDesktopFolder::EnumSearches ( IEnumExtraSearch **  ppenum)
override

Implements IShellFolder2.

Definition at line 964 of file CDesktopFolder.cpp.

965{
966 FIXME ("(%p)\n", this);
967 return E_NOTIMPL;
968}

◆ FinalConstruct()

HRESULT WINAPI CDesktopFolder::FinalConstruct ( )

Definition at line 313 of file CDesktopFolder.cpp.

314{
315 WCHAR szMyPath[MAX_PATH];
316 HRESULT hr;
317
318 /* Create the root pidl */
320 if (!pidlRoot)
321 return E_OUTOFMEMORY;
322
323 /* Create the inner fs folder */
325 &CLSID_ShellFSFolder,
329 return hr;
330
331 /* Create the inner shared fs folder. Dont fail on failure. */
333 &CLSID_ShellFSFolder,
337 return hr;
338
339 /* Create the inner reg folder */
340 hr = CRegFolder_CreateInstance(&CLSID_ShellDesktop,
341 pidlRoot,
342 L"",
343 L"Desktop",
346 return hr;
347
348 /* Cache the path to the user desktop directory */
350 return E_UNEXPECTED;
351
352 sPathTarget = (LPWSTR)SHAlloc((wcslen(szMyPath) + 1) * sizeof(WCHAR));
353 if (!sPathTarget)
354 return E_OUTOFMEMORY;
355
356 wcscpy(sPathTarget, szMyPath);
357 return S_OK;
358}
static HRESULT SHELL32_CoCreateInitSF(LPCITEMIDLIST pidlRoot, PERSIST_FOLDER_TARGET_INFO *ppfti, LPCITEMIDLIST pidlChild, const GUID *clsid, REFIID riid, LPVOID *ppvOut)
Definition: CFindFolder.cpp:13
HRESULT CRegFolder_CreateInstance(const GUID *pGuid, LPCITEMIDLIST pidlRoot, LPCWSTR lpszPath, LPCWSTR lpszEnumKeyName, REFIID riid, void **ppv)
Definition: CRegFolder.cpp:865
LPVOID WINAPI SHAlloc(SIZE_T len)
Definition: shellole.c:304
BOOL WINAPI SHGetSpecialFolderPathW(HWND hwndOwner, LPWSTR szPath, int nFolder, BOOL bCreate)
Definition: shellpath.c:3092
LPITEMIDLIST _ILCreateDesktop(void)
Definition: pidl.c:1635
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
#define CSIDL_COMMON_DESKTOPDIRECTORY
Definition: shlobj.h:2196
#define CSIDL_DESKTOPDIRECTORY
Definition: shlobj.h:2187
#define E_UNEXPECTED
Definition: winerror.h:2456
WCHAR * LPWSTR
Definition: xmlstorage.h:184

◆ GetAttributesOf()

HRESULT WINAPI CDesktopFolder::GetAttributesOf ( UINT  cidl,
PCUITEMID_CHILD_ARRAY  apidl,
DWORD rgfInOut 
)
override

Definition at line 739 of file CDesktopFolder.cpp.

743{
744 HRESULT hr = S_OK;
745
746 TRACE("(%p)->(cidl=%d apidl=%p mask=%p (0x%08x))\n",
747 this, cidl, apidl, rgfInOut, rgfInOut ? *rgfInOut : 0);
748
749 if (cidl && !apidl)
750 return E_INVALIDARG;
751
752 if (*rgfInOut == 0)
753 *rgfInOut = ~0;
754
755 if(cidl == 0)
756 *rgfInOut &= dwDesktopAttributes;
757 else
758 {
759 /* TODO: always add SFGAO_CANLINK */
760 for (UINT i = 0; i < cidl; ++i)
761 {
762 pdump(*apidl);
763 if (_ILIsDesktop(*apidl))
764 *rgfInOut &= dwDesktopAttributes;
765 else if (_ILIsMyComputer(apidl[i]))
766 *rgfInOut &= dwMyComputerAttributes;
767 else if (_ILIsNetHood(apidl[i]))
768 *rgfInOut &= dwMyNetPlacesAttributes;
769 else if (_ILIsFolder(apidl[i]) || _ILIsValue(apidl[i]) || _ILIsSpecialFolder(apidl[i]))
770 {
771 CComPtr<IShellFolder2> psf;
772 HRESULT hr = _GetSFFromPidl(apidl[i], &psf);
774 continue;
775
776 psf->GetAttributesOf(1, &apidl[i], rgfInOut);
777 }
778 else
779 ERR("Got an unknown pidl type!!!\n");
780 }
781 }
782 /* make sure SFGAO_VALIDATE is cleared, some apps depend on that */
783 *rgfInOut &= ~SFGAO_VALIDATE;
784
785 TRACE("-- result=0x%08x\n", *rgfInOut);
786
787 return hr;
788}
static const DWORD dwMyComputerAttributes
static const DWORD dwDesktopAttributes
static DWORD dwMyNetPlacesAttributes
void pdump(LPCITEMIDLIST pidl)
Definition: debughlp.cpp:311
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
BOOL _ILIsFolder(LPCITEMIDLIST pidl)
Definition: pidl.c:2015
BOOL _ILIsMyComputer(LPCITEMIDLIST pidl)
Definition: pidl.c:1970
BOOL _ILIsNetHood(LPCITEMIDLIST pidl)
Definition: pidl.c:1948
BOOL _ILIsValue(LPCITEMIDLIST pidl)
Definition: pidl.c:2024

◆ GetClassID()

HRESULT WINAPI CDesktopFolder::GetClassID ( CLSID lpClassId)
override

Implements IPersist.

Definition at line 1054 of file CDesktopFolder.cpp.

1055{
1056 TRACE ("(%p)\n", this);
1057
1058 if (!lpClassId)
1059 return E_POINTER;
1060
1061 *lpClassId = CLSID_ShellDesktop;
1062
1063 return S_OK;
1064}
#define E_POINTER
Definition: winerror.h:2365

◆ GetColumnDetails()

HRESULT CDesktopFolder::GetColumnDetails ( UINT  iColumn,
SHELLDETAILS sd 
)
staticprivate

Definition at line 1017 of file CDesktopFolder.cpp.

1018{
1019 /* CDesktopFolder may override the flags and/or name if desired */
1020 return CFSFolder::GetFSColumnDetails(iColumn, sd);
1021}
static HRESULT GetFSColumnDetails(UINT iColumn, SHELLDETAILS &sd)
Definition: CFSFolder.cpp:541
static const WCHAR sd[]
Definition: suminfo.c:286

Referenced by GetDetailsOf().

◆ GetCurFolder()

HRESULT WINAPI CDesktopFolder::GetCurFolder ( PIDLIST_ABSOLUTE pidl)
override

Implements IPersistFolder2.

Definition at line 1076 of file CDesktopFolder.cpp.

1077{
1078 TRACE ("(%p)->(%p)\n", this, pidl);
1079
1080 if (!pidl)
1081 return E_INVALIDARG; /* xp doesn't have this check and crashes on NULL */
1082 *pidl = ILClone (pidlRoot);
1083 return S_OK;
1084}
LPITEMIDLIST WINAPI ILClone(LPCITEMIDLIST pidl)
Definition: pidl.c:237

◆ GetDefaultColumn()

HRESULT WINAPI CDesktopFolder::GetDefaultColumn ( DWORD  dwRes,
ULONG pSort,
ULONG pDisplay 
)
override

Implements IShellFolder2.

Definition at line 970 of file CDesktopFolder.cpp.

971{
972 TRACE ("(%p)\n", this);
973
974 if (pSort)
975 *pSort = 0;
976 if (pDisplay)
977 *pDisplay = 0;
978
979 return S_OK;
980}

◆ GetDefaultColumnState()

HRESULT WINAPI CDesktopFolder::GetDefaultColumnState ( UINT  iColumn,
DWORD pcsFlags 
)
override

Implements IShellFolder2.

Definition at line 982 of file CDesktopFolder.cpp.

983{
984 HRESULT hr;
985 TRACE ("(%p)\n", this);
986
987 if (!pcsFlags)
988 return E_INVALIDARG;
989
990 hr = CFSFolder::GetDefaultFSColumnState(iColumn, *pcsFlags);
991 /*
992 // CDesktopFolder may override the flags if desired (future)
993 switch(iColumn)
994 {
995 case SHFSF_COL_FATTS:
996 *pcsFlags &= ~SHCOLSTATE_ONBYDEFAULT;
997 break;
998 }
999 */
1000 return hr;
1001}
static HRESULT GetDefaultFSColumnState(UINT iColumn, SHCOLSTATEF &csFlags)
Definition: CFSFolder.cpp:551

◆ GetDefaultSearchGUID()

HRESULT WINAPI CDesktopFolder::GetDefaultSearchGUID ( GUID pguid)
override

Implements IShellFolder2.

Definition at line 958 of file CDesktopFolder.cpp.

959{
960 FIXME ("(%p)\n", this);
961 return E_NOTIMPL;
962}

◆ GetDetailsEx()

HRESULT WINAPI CDesktopFolder::GetDetailsEx ( PCUITEMID_CHILD  pidl,
const SHCOLUMNID pscid,
VARIANT pv 
)
override

Implements IShellFolder2.

Definition at line 1003 of file CDesktopFolder.cpp.

1007{
1008 FIXME ("(%p)\n", this);
1009
1010 return E_NOTIMPL;
1011}

◆ GetDetailsOf()

HRESULT WINAPI CDesktopFolder::GetDetailsOf ( PCUITEMID_CHILD  pidl,
UINT  iColumn,
SHELLDETAILS psd 
)
override

Implements IShellFolder2.

Definition at line 1023 of file CDesktopFolder.cpp.

1027{
1028 if (!psd)
1029 return E_INVALIDARG;
1030
1031 if (!pidl)
1032 {
1033 return GetColumnDetails(iColumn, *psd);
1034 }
1035
1036 CComPtr<IShellFolder2> psf;
1037 HRESULT hr = _GetSFFromPidl(pidl, &psf);
1039 return hr;
1040
1041 hr = psf->GetDetailsOf(pidl, iColumn, psd);
1043 return hr;
1044
1045 return hr;
1046}
static HRESULT GetColumnDetails(UINT iColumn, SHELLDETAILS &sd)

◆ GetDisplayNameOf()

HRESULT WINAPI CDesktopFolder::GetDisplayNameOf ( PCUITEMID_CHILD  pidl,
DWORD  dwFlags,
LPSTRRET  strRet 
)
override

Definition at line 902 of file CDesktopFolder.cpp.

903{
904 TRACE ("(%p)->(pidl=%p,0x%08x,%p)\n", this, pidl, dwFlags, strRet);
905 pdump (pidl);
906
907 if (!strRet)
908 return E_INVALIDARG;
909
910 if (!_ILIsPidlSimple (pidl))
911 {
912 return SHELL32_GetDisplayNameOfChild(this, pidl, dwFlags, strRet);
913 }
914 else if (_ILIsDesktop(pidl))
915 {
917 return SHSetStrRet(strRet, sPathTarget);
918 else
919 return m_regFolder->GetDisplayNameOf(pidl, dwFlags, strRet);
920 }
921
922 /* file system folder or file rooted at the desktop */
923 CComPtr<IShellFolder2> psf;
924 HRESULT hr = _GetSFFromPidl(pidl, &psf);
926 return hr;
927
928 return psf->GetDisplayNameOf(pidl, dwFlags, strRet);
929}
BOOL WINAPI _ILIsPidlSimple(LPCITEMIDLIST pidl)
#define IS_SHGDN_DESKTOPABSOLUTEPARSING(flags)
Definition: shfldr.h:53
HRESULT SHELL32_GetDisplayNameOfChild(IShellFolder2 *psf, LPCITEMIDLIST pidl, DWORD dwFlags, LPSTRRET strRet)
Definition: shlfolder.cpp:206

◆ GetMaxLength()

STDMETHODIMP CDesktopFolder::GetMaxLength ( LPCWSTR  pszName,
int piMaxNameLen 
)
inlineoverride

Definition at line 114 of file CDesktopFolder.h.

115 {
116 return E_NOTIMPL;
117 }

◆ GetUIObjectOf()

HRESULT WINAPI CDesktopFolder::GetUIObjectOf ( HWND  hwndOwner,
UINT  cidl,
PCUITEMID_CHILD_ARRAY  apidl,
REFIID  riid,
UINT prgfInOut,
LPVOID ppvOut 
)
override

Definition at line 802 of file CDesktopFolder.cpp.

809{
810 LPVOID pObj = NULL;
812
813 TRACE ("(%p)->(%p,%u,apidl=%p,%s,%p,%p)\n",
814 this, hwndOwner, cidl, apidl, shdebugstr_guid (&riid), prgfInOut, ppvOut);
815
816 if (!ppvOut)
817 return hr;
818 *ppvOut = NULL;
819
820 BOOL self = IsSelf(cidl, apidl);
821 if (cidl == 1 && !_ILIsSpecialFolder(apidl[0]) && !self)
822 {
823 CComPtr<IShellFolder2> psf;
824 HRESULT hr = _GetSFFromPidl(apidl[0], &psf);
826 return hr;
827
828 return psf->GetUIObjectOf(hwndOwner, cidl, apidl, riid, prgfInOut, ppvOut);
829 }
830
831 if (IsEqualIID (riid, IID_IContextMenu))
832 {
833 // FIXME: m_regFolder vs AddFSClassKeysToArray is incorrect when the selection includes both regitems and FS items
834 if (!self && cidl > 0 && _ILIsSpecialFolder(apidl[0]))
835 {
836 hr = m_regFolder->GetUIObjectOf(hwndOwner, cidl, apidl, riid, prgfInOut, &pObj);
837 }
838 else
839 {
840 /* Do not use the context menu of the CFSFolder here. */
841 /* We need to pass a pointer of the CDesktopFolder so as the data object that the context menu gets is rooted to the desktop */
842 /* Otherwise operations like that involve items from both user and shared desktop will not work */
843 HKEY hKeys[16];
844 UINT cKeys = 0;
845 if (self)
846 {
847 AddClsidKeyToArray(CLSID_ShellDesktop, hKeys, &cKeys);
848 AddClassKeyToArray(L"Folder", hKeys, &cKeys);
849 }
850 else if (cidl > 0)
851 {
852 AddFSClassKeysToArray(cidl, apidl, hKeys, &cKeys);
853 }
854
855 DEFCONTEXTMENU dcm;
856 dcm.hwnd = hwndOwner;
857 dcm.pcmcb = this;
858 dcm.pidlFolder = pidlRoot;
859 dcm.psf = this;
860 dcm.cidl = cidl;
861 dcm.apidl = apidl;
862 dcm.cKeys = cKeys;
863 dcm.aKeys = hKeys;
865 hr = SHCreateDefaultContextMenu (&dcm, riid, &pObj);
866 }
867 }
868 else if (IsEqualIID (riid, IID_IDataObject) && (cidl >= 1))
869 {
870 hr = IDataObject_Constructor( hwndOwner, pidlRoot, apidl, cidl, TRUE, (IDataObject **)&pObj);
871 }
872 else if ((IsEqualIID (riid, IID_IExtractIconA) || IsEqualIID (riid, IID_IExtractIconW)) && (cidl == 1))
873 {
874 hr = m_regFolder->GetUIObjectOf(hwndOwner, cidl, apidl, riid, prgfInOut, &pObj);
875 }
876 else if (IsEqualIID (riid, IID_IDropTarget) && (cidl == 1))
877 {
878 CComPtr<IShellFolder> psfChild;
879 hr = this->BindToObject(apidl[0], NULL, IID_PPV_ARG(IShellFolder, &psfChild));
881 return hr;
882
883 return psfChild->CreateViewObject(NULL, riid, ppvOut);
884 }
885 else
887
888 if (SUCCEEDED(hr) && !pObj)
890
891 *ppvOut = pObj;
892 TRACE ("(%p)->hr=0x%08x\n", this, hr);
893 return hr;
894}
static BOOL IsSelf(UINT cidl, PCUITEMID_CHILD_ARRAY apidl)
HRESULT IDataObject_Constructor(HWND hwndOwner, PCIDLIST_ABSOLUTE pMyPidl, PCUIDLIST_RELATIVE_ARRAY apidl, UINT cidl, BOOL bExtendedObject, IDataObject **dataObject)
STDMETHOD() BindToObject(PCUIDLIST_RELATIVE pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut) override
#define SUCCEEDED(hr)
Definition: intsafe.h:50
const GUID IID_IDataObject
void AddFSClassKeysToArray(UINT cidl, PCUITEMID_CHILD_ARRAY apidl, HKEY *array, UINT *cKeys)
Definition: shlfolder.cpp:299
LSTATUS AddClsidKeyToArray(REFCLSID clsid, HKEY *array, UINT *cKeys)
Definition: shlfolder.cpp:292
#define E_NOINTERFACE
Definition: winerror.h:2364

◆ GetValidCharacters()

STDMETHODIMP CDesktopFolder::GetValidCharacters ( LPWSTR ppwszValidChars,
LPWSTR ppwszInvalidChars 
)
inlineoverride

Definition at line 120 of file CDesktopFolder.h.

121 {
122 if (ppwszValidChars)
123 {
124 *ppwszValidChars = NULL;
125 }
126 if (ppwszInvalidChars)
127 {
128 SHStrDupW(INVALID_FILETITLE_CHARACTERSW, ppwszInvalidChars);
129 }
130 return S_OK;
131 }
HRESULT WINAPI SHStrDupW(LPCWSTR src, LPWSTR *dest)
Definition: string.c:2012
#define INVALID_FILETITLE_CHARACTERSW
Definition: undocshell.h:911

◆ HttpUrlParseDisplayName()

STDMETHODIMP CDesktopFolder::HttpUrlParseDisplayName ( HWND  hwndOwner,
LPBC  pbc,
LPOLESTR  lpszDisplayName,
DWORD pchEaten,
PIDLIST_RELATIVE ppidl,
DWORD pdwAttributes 
)
private

Definition at line 133 of file CDesktopFolder.cpp.

140{
141 FIXME("\n");
142 return E_NOTIMPL; // FIXME
143}

Referenced by _ParseDisplayNameByParent().

◆ Initialize()

HRESULT WINAPI CDesktopFolder::Initialize ( PCIDLIST_ABSOLUTE  pidl)
override

Implements IPersistFolder.

Definition at line 1066 of file CDesktopFolder.cpp.

1067{
1068 TRACE ("(%p)->(%p)\n", this, pidl);
1069
1070 if (!pidl)
1071 return S_OK;
1072
1073 return E_INVALIDARG;
1074}

◆ MapColumnToSCID()

HRESULT WINAPI CDesktopFolder::MapColumnToSCID ( UINT  column,
SHCOLUMNID pscid 
)
override

Implements IShellFolder2.

Definition at line 1048 of file CDesktopFolder.cpp.

1049{
1050 FIXME ("(%p)\n", this);
1051 return E_NOTIMPL;
1052}

◆ ParseDisplayName()

HRESULT WINAPI CDesktopFolder::ParseDisplayName ( HWND  hwndOwner,
LPBC  pbc,
LPOLESTR  lpszDisplayName,
DWORD pchEaten,
PIDLIST_RELATIVE ppidl,
DWORD pdwAttributes 
)
override

Definition at line 497 of file CDesktopFolder.cpp.

504{
505 TRACE ("(%p)->(HWND=%p,%p,%p=%s,%p,pidl=%p,%p)\n",
506 this, hwndOwner, pbc, lpszDisplayName, debugstr_w(lpszDisplayName),
507 pchEaten, ppidl, pdwAttributes);
508
509 if (!ppidl)
510 return E_INVALIDARG;
511
512 *ppidl = NULL;
513
514 if (!lpszDisplayName)
515 return E_INVALIDARG;
516
517 if (!*lpszDisplayName)
518 {
519 *ppidl = _ILCreateMyComputer();
520 return (*ppidl ? S_OK : E_OUTOFMEMORY);
521 }
522
523 if (lpszDisplayName[0] == ':' && lpszDisplayName[1] == ':')
524 {
525 return m_regFolder->ParseDisplayName(hwndOwner, pbc, lpszDisplayName, pchEaten, ppidl,
526 pdwAttributes);
527 }
528
529 HRESULT hr = _ParseDisplayNameByParent(hwndOwner, pbc, lpszDisplayName, pchEaten, ppidl,
530 pdwAttributes);
531 if (SUCCEEDED(hr))
532 {
533 if (BindCtx_ContainsObject(pbc, STR_PARSE_TRANSLATE_ALIASES))
534 {
535 CComHeapPtr<ITEMIDLIST> pidlAlias;
536 if (SUCCEEDED(Shell_TranslateIDListAlias(*ppidl, NULL, &pidlAlias, 0xFFFF)))
537 {
538 ILFree(*ppidl);
539 *ppidl = pidlAlias.Detach();
540 }
541 }
542
543 TRACE ("(%p)->(-- ret=0x%08x)\n", this, hr);
544 return hr;
545 }
546
548 return hr;
549
550 if (BindCtx_ContainsObject(pbc, STR_DONT_PARSE_RELATIVE))
551 return E_INVALIDARG;
552
553 if (SHIsFileSysBindCtx(pbc, NULL) == S_OK)
554 return hr;
555
556 BIND_OPTS BindOps = { sizeof(BindOps) };
558 if (pbc && SUCCEEDED(pbc->GetBindOptions(&BindOps)) && (BindOps.grfMode & STGM_CREATE))
559 {
560 BindOps.grfMode &= ~STGM_CREATE;
561 bCreate = TRUE;
562 pbc->SetBindOptions(&BindOps);
563 }
564
566 {
567 hr = m_DesktopFSFolder->ParseDisplayName(hwndOwner,
568 pbc,
569 lpszDisplayName,
570 pchEaten,
571 ppidl,
572 pdwAttributes);
573 }
574
576 {
577 hr = m_SharedDesktopFSFolder->ParseDisplayName(hwndOwner,
578 pbc,
579 lpszDisplayName,
580 pchEaten,
581 ppidl,
582 pdwAttributes);
583 }
584
586 {
587 BindOps.grfMode |= STGM_CREATE;
588 pbc->SetBindOptions(&BindOps);
589 hr = m_DesktopFSFolder->ParseDisplayName(hwndOwner,
590 pbc,
591 lpszDisplayName,
592 pchEaten,
593 ppidl,
594 pdwAttributes);
595 }
596
597 TRACE ("(%p)->(-- ret=0x%08x)\n", this, hr);
598
599 return hr;
600}
HRESULT _ParseDisplayNameByParent(HWND hwndOwner, LPBC pbc, LPOLESTR pszPath, DWORD *pchEaten, PIDLIST_RELATIVE *ppidl, DWORD *pdwAttributes)
HRESULT SHIsFileSysBindCtx(_In_ IBindCtx *pBindCtx, _Out_opt_ WIN32_FIND_DATAW *pFindData)
Definition: utils.cpp:153
BOOL Shell_FailForceReturn(_In_ HRESULT hr)
Definition: utils.cpp:170
HRESULT Shell_TranslateIDListAlias(_In_ LPCITEMIDLIST pidl, _In_ HANDLE hToken, _Out_ LPITEMIDLIST *ppidlAlias, _In_ DWORD dwFlags)
Definition: utils.cpp:111
#define debugstr_w
Definition: kernel32.h:32
#define STGM_CREATE
Definition: objbase.h:926
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:940
_In_ int _In_ BOOL bCreate
Definition: shlobj.h:1519

◆ SetNameOf()

HRESULT WINAPI CDesktopFolder::SetNameOf ( HWND  hwndOwner,
PCUITEMID_CHILD  pidl,
LPCOLESTR  lpName,
DWORD  dwFlags,
PITEMID_CHILD pPidlOut 
)
override

Implements IShellFolder.

Definition at line 943 of file CDesktopFolder.cpp.

949{
950 CComPtr<IShellFolder2> psf;
951 HRESULT hr = _GetSFFromPidl(pidl, &psf);
953 return hr;
954
955 return psf->SetNameOf(hwndOwner, pidl, lpName, dwFlags, pPidlOut);
956}
_In_ LPCSTR lpName
Definition: winbase.h:2789

◆ ShellUrlParseDisplayName()

STDMETHODIMP CDesktopFolder::ShellUrlParseDisplayName ( HWND  hwndOwner,
LPBC  pbc,
LPOLESTR  lpszDisplayName,
DWORD pchEaten,
PIDLIST_RELATIVE ppidl,
DWORD pdwAttributes 
)
private

Definition at line 34 of file CDesktopFolder.cpp.

41{
42 LPWSTR pch;
43 INT cch, csidl;
45 PARSEDURLW ParsedURL = { sizeof(ParsedURL) };
46
47 ::ParseURLW(lpszDisplayName, &ParsedURL);
48
49 DWORD attrs = (pdwAttributes ? *pdwAttributes : 0) | SFGAO_STREAM;
50 if (ParsedURL.pszSuffix[0] == L':' && ParsedURL.pszSuffix[1] == L':') // It begins from "::"
51 {
52 CComPtr<IShellFolder> psfDesktop;
53 hr = SHGetDesktopFolder(&psfDesktop);
54 if (SUCCEEDED(hr))
55 {
56 CComPtr<IBindCtx> pBindCtx;
57 hr = ::CreateBindCtx(0, &pBindCtx);
58 if (SUCCEEDED(hr))
59 {
60 BIND_OPTS BindOps = { sizeof(BindOps) };
61 BindOps.grfMode = STGM_CREATE;
62 pBindCtx->SetBindOptions(&BindOps);
63 hr = psfDesktop->ParseDisplayName(hwndOwner, pBindCtx,
64 (LPWSTR)ParsedURL.pszSuffix,
65 pchEaten, ppidl, &attrs);
66 }
67 }
68 }
69 else
70 {
71 csidl = Shell_ParseSpecialFolder(ParsedURL.pszSuffix, &pch, &cch);
72 if (csidl == -1)
73 {
74 ERR("\n");
75 return hr;
76 }
77
78 CComHeapPtr<ITEMIDLIST> pidlLocation;
79 hr = SHGetFolderLocation(hwndOwner, (csidl | CSIDL_FLAG_CREATE), NULL, 0, &pidlLocation);
81 return hr;
82
83 if (pch && *pch)
84 {
85 CComPtr<IShellFolder> psfFolder;
86 hr = SHBindToObject(NULL, pidlLocation, IID_PPV_ARG(IShellFolder, &psfFolder));
87 if (SUCCEEDED(hr))
88 {
89 CComHeapPtr<ITEMIDLIST> pidlNew;
90 hr = psfFolder->ParseDisplayName(hwndOwner, pbc, pch, pchEaten, &pidlNew, &attrs);
91 if (SUCCEEDED(hr))
92 {
93 hr = SHILCombine(pidlLocation, pidlNew, ppidl);
94 if (pchEaten)
95 *pchEaten += cch;
96 }
97 }
98 }
99 else
100 {
101 if (attrs)
102 hr = SHGetNameAndFlagsW(pidlLocation, 0, NULL, 0, &attrs);
103
104 if (SUCCEEDED(hr))
105 {
106 if (pchEaten)
107 *pchEaten = cch;
108 *ppidl = pidlLocation.Detach();
109 }
110 }
111 }
112
113 // FIXME: SHWindowsPolicy
114 if (SUCCEEDED(hr) && (attrs & SFGAO_STREAM) &&
115 !BindCtx_ContainsObject(pbc, STR_PARSE_SHELL_PROTOCOL_TO_FILE_OBJECTS))
116 {
117 ILFree(*ppidl);
118 *ppidl = NULL;
120 }
121
122 if (pdwAttributes)
123 *pdwAttributes = attrs;
124
125 // FIXME: SHWindowsPolicy
128
129 return hr;
130}
EXTERN_C INT Shell_ParseSpecialFolder(_In_ LPCWSTR pszStart, _Out_ LPWSTR *ppch, _Out_ INT *pcch)
Definition: shellpath.c:1859
HRESULT SHGetNameAndFlagsW(_In_ LPCITEMIDLIST pidl, _In_ DWORD dwFlags, _Out_opt_ LPWSTR pszText, _In_ UINT cchBuf, _Inout_opt_ DWORD *pdwAttributes)
Definition: utils.cpp:289
HRESULT WINAPI SHGetFolderLocation(HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwReserved, LPITEMIDLIST *ppidl)
Definition: shellpath.c:3150
#define pch(ap)
Definition: match.c:418
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
static DWORD DWORD void LPSTR DWORD cch
Definition: str.c:202
HRESULT WINAPI CreateBindCtx(DWORD reserved, LPBC *ppbc)
Definition: bindctx.c:556
#define CSIDL_FLAG_CREATE
LPCWSTR pszSuffix
Definition: shlwapi.h:1435
int32_t INT
Definition: typedefs.h:58
#define ERROR_PATH_NOT_FOUND
Definition: winerror.h:106
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92

Referenced by _ParseDisplayNameByParent().

Member Data Documentation

◆ m_DesktopFSFolder

CComPtr<IShellFolder2> CDesktopFolder::m_DesktopFSFolder
private

◆ m_regFolder

CComPtr<IShellFolder2> CDesktopFolder::m_regFolder
private

◆ m_SharedDesktopFSFolder

CComPtr<IShellFolder2> CDesktopFolder::m_SharedDesktopFSFolder
private

Definition at line 37 of file CDesktopFolder.h.

Referenced by _GetSFFromPidl(), EnumObjects(), FinalConstruct(), and ParseDisplayName().

◆ pidlRoot

LPITEMIDLIST CDesktopFolder::pidlRoot
private

Definition at line 41 of file CDesktopFolder.h.

Referenced by CreateViewObject(), FinalConstruct(), GetCurFolder(), and GetUIObjectOf().

◆ sPathTarget

LPWSTR CDesktopFolder::sPathTarget
private

Definition at line 40 of file CDesktopFolder.h.

Referenced by _GetSFFromPidl(), FinalConstruct(), and GetDisplayNameOf().


The documentation for this class was generated from the following files: