ReactOS  0.4.15-dev-3287-gfec35dc
CDesktopFolder Class Reference

#include <CDesktopFolder.h>

Inheritance diagram for CDesktopFolder:
Collaboration diagram for CDesktopFolder:

Public Member Functions

 CDesktopFolder ()
 
 ~CDesktopFolder ()
 
HRESULT WINAPI FinalConstruct ()
 
virtual HRESULT WINAPI ParseDisplayName (HWND hwndOwner, LPBC pbc, LPOLESTR lpszDisplayName, DWORD *pchEaten, PIDLIST_RELATIVE *ppidl, DWORD *pdwAttributes)
 
virtual HRESULT WINAPI EnumObjects (HWND hwndOwner, DWORD dwFlags, LPENUMIDLIST *ppEnumIDList)
 
virtual HRESULT WINAPI BindToObject (PCUIDLIST_RELATIVE pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut)
 
virtual HRESULT WINAPI BindToStorage (PCUIDLIST_RELATIVE pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut)
 
virtual HRESULT WINAPI CompareIDs (LPARAM lParam, PCUIDLIST_RELATIVE pidl1, PCUIDLIST_RELATIVE pidl2)
 
virtual HRESULT WINAPI CreateViewObject (HWND hwndOwner, REFIID riid, LPVOID *ppvOut)
 
virtual HRESULT WINAPI GetAttributesOf (UINT cidl, PCUITEMID_CHILD_ARRAY apidl, DWORD *rgfInOut)
 
virtual HRESULT WINAPI GetUIObjectOf (HWND hwndOwner, UINT cidl, PCUITEMID_CHILD_ARRAY apidl, REFIID riid, UINT *prgfInOut, LPVOID *ppvOut)
 
virtual HRESULT WINAPI GetDisplayNameOf (PCUITEMID_CHILD pidl, DWORD dwFlags, LPSTRRET strRet)
 
virtual HRESULT WINAPI SetNameOf (HWND hwndOwner, PCUITEMID_CHILD pidl, LPCOLESTR lpName, DWORD dwFlags, PITEMID_CHILD *pPidlOut)
 
virtual HRESULT WINAPI GetDefaultSearchGUID (GUID *pguid)
 
virtual HRESULT WINAPI EnumSearches (IEnumExtraSearch **ppenum)
 
virtual HRESULT WINAPI GetDefaultColumn (DWORD dwRes, ULONG *pSort, ULONG *pDisplay)
 
virtual HRESULT WINAPI GetDefaultColumnState (UINT iColumn, DWORD *pcsFlags)
 
virtual HRESULT WINAPI GetDetailsEx (PCUITEMID_CHILD pidl, const SHCOLUMNID *pscid, VARIANT *pv)
 
virtual HRESULT WINAPI GetDetailsOf (PCUITEMID_CHILD pidl, UINT iColumn, SHELLDETAILS *psd)
 
virtual HRESULT WINAPI MapColumnToSCID (UINT column, SHCOLUMNID *pscid)
 
virtual HRESULT WINAPI GetClassID (CLSID *lpClassId)
 
virtual HRESULT WINAPI Initialize (PCIDLIST_ABSOLUTE pidl)
 
virtual HRESULT WINAPI GetCurFolder (PIDLIST_ABSOLUTE *pidl)
 
virtual HRESULT WINAPI CallBack (IShellFolder *psf, HWND hwndOwner, IDataObject *pdtobj, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
STDMETHODIMP GetMaxLength (LPCWSTR pszName, int *piMaxNameLen)
 
STDMETHODIMP GetValidCharacters (LPWSTR *ppwszValidChars, LPWSTR *ppwszInvalidChars)
 
- 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 ()
 
- 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 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)
 
- Public Member Functions inherited from IUnknown
HRESULT QueryInterface ([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
 
ULONG AddRef ()
 
ULONG Release ()
 

Private Member Functions

HRESULT _GetSFFromPidl (LPCITEMIDLIST pidl, IShellFolder2 **psf)
 

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
 
- 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
 
- Public Attributes inherited from IShellFolder
SFGAO_STORAGEANCESTOR typedef ULONG SFGAOF
 

Detailed Description

Definition at line 26 of file CDesktopFolder.h.

Constructor & Destructor Documentation

◆ CDesktopFolder()

CDesktopFolder::CDesktopFolder ( )

Definition at line 193 of file CDesktopFolder.cpp.

193  :
194  sPathTarget(NULL),
195  pidlRoot(NULL)
196 {
197 }
LPITEMIDLIST pidlRoot
#define NULL
Definition: types.h:112

◆ ~CDesktopFolder()

CDesktopFolder::~CDesktopFolder ( )

Definition at line 199 of file CDesktopFolder.cpp.

200 {
201 }

Member Function Documentation

◆ _GetSFFromPidl()

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

Definition at line 250 of file CDesktopFolder.cpp.

251 {
252  WCHAR szFileName[MAX_PATH];
253 
254  if (_ILIsSpecialFolder(pidl))
255  return m_regFolder->QueryInterface(IID_PPV_ARG(IShellFolder2, psf));
256 
257  lstrcpynW(szFileName, sPathTarget, MAX_PATH - 1);
258  PathAddBackslashW(szFileName);
259  int cLen = wcslen(szFileName);
260 
261  if (!_ILSimpleGetTextW(pidl, szFileName + cLen, MAX_PATH - cLen))
262  return E_FAIL;
263 
264  if (GetFileAttributes(szFileName) == INVALID_FILE_ATTRIBUTES)
265  return m_SharedDesktopFSFolder->QueryInterface(IID_PPV_ARG(IShellFolder2, psf));
266  else
267  return m_DesktopFSFolder->QueryInterface(IID_PPV_ARG(IShellFolder2, psf));
268 }
CComPtr< IShellFolder2 > m_DesktopFSFolder
#define IID_PPV_ARG(Itype, ppType)
#define E_FAIL
Definition: ddrawi.h:102
#define lstrcpynW
Definition: compat.h:597
static BOOL _ILIsSpecialFolder(LPCITEMIDLIST pidl)
LPWSTR WINAPI PathAddBackslashW(LPWSTR lpszPath)
Definition: path.c:294
CComPtr< IShellFolder2 > m_SharedDesktopFSFolder
DWORD _ILSimpleGetTextW(LPCITEMIDLIST pidl, LPWSTR szOut, UINT uOutSize)
Definition: pidl.c:2096
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:34
#define INVALID_FILE_ATTRIBUTES
Definition: vfdcmd.c:23
#define GetFileAttributes
Definition: winbase.h:3671
CComPtr< IShellFolder2 > m_regFolder
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)

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

◆ BindToObject()

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

Definition at line 408 of file CDesktopFolder.cpp.

413 {
414  if (!pidl)
415  return E_INVALIDARG;
416 
417  CComPtr<IShellFolder2> psf;
418  HRESULT hr = _GetSFFromPidl(pidl, &psf);
419  if (FAILED_UNEXPECTEDLY(hr))
420  return hr;
421 
422  return psf->BindToObject(pidl, pbcReserved, riid, ppvOut);
423 }
HRESULT hr
Definition: shlfolder.c:183
REFIID riid
Definition: precomp.h:44
#define E_INVALIDARG
Definition: ddrawi.h:101
LONG HRESULT
Definition: typedefs.h:79
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:82
HRESULT _GetSFFromPidl(LPCITEMIDLIST pidl, IShellFolder2 **psf)

Referenced by GetUIObjectOf().

◆ BindToStorage()

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

Definition at line 428 of file CDesktopFolder.cpp.

433 {
434  FIXME ("(%p)->(pidl=%p,%p,%s,%p) stub\n",
435  this, pidl, pbcReserved, shdebugstr_guid (&riid), ppvOut);
436 
437  *ppvOut = NULL;
438  return E_NOTIMPL;
439 }
REFIID riid
Definition: precomp.h:44
const char * shdebugstr_guid(const struct _GUID *id)
Definition: debughlp.cpp:414
#define FIXME(fmt,...)
Definition: debug.h:111
#define E_NOTIMPL
Definition: ddrawi.h:99
#define NULL
Definition: types.h:112

◆ CallBack()

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

Implements IContextMenuCB.

Definition at line 841 of file CDesktopFolder.cpp.

842 {
843  if (uMsg != DFM_MERGECONTEXTMENU && uMsg != DFM_INVOKECOMMAND)
844  return S_OK;
845 
846  /* no data object means no selection */
847  if (!pdtobj)
848  {
849  if (uMsg == DFM_INVOKECOMMAND && wParam == 0)
850  {
851  if (32 >= (UINT_PTR)ShellExecuteW(hwndOwner, L"open", L"rundll32.exe",
852  L"shell32.dll,Control_RunDLL desk.cpl", NULL, SW_SHOWNORMAL))
853  {
854  return E_FAIL;
855  }
856  return S_OK;
857  }
858  else if (uMsg == DFM_MERGECONTEXTMENU)
859  {
860  QCMINFO *pqcminfo = (QCMINFO *)lParam;
861  HMENU hpopup = CreatePopupMenu();
863  Shell_MergeMenus(pqcminfo->hmenu, hpopup, pqcminfo->indexMenu++, pqcminfo->idCmdFirst, pqcminfo->idCmdLast, MM_ADDSEPARATOR);
864  DestroyMenu(hpopup);
865  }
866 
867  return S_OK;
868  }
869 
870  if (uMsg != DFM_INVOKECOMMAND || wParam != DFM_CMD_PROPERTIES)
871  return S_OK;
872 
873  return Shell_DefaultContextMenuCallBack(this, pdtobj);
874 }
void WINAPI _InsertMenuItemW(HMENU hmenu, UINT indexMenu, BOOL fByPosition, UINT wID, UINT fType, LPCWSTR dwTypeData, UINT fState)
UINT idCmdLast
Definition: shlobj.h:1318
#define MFT_STRING
Definition: winuser.h:741
UINT WINAPI Shell_MergeMenus(HMENU hmDst, HMENU hmSrc, UINT uInsert, UINT uIDAdjust, UINT uIDAdjustMax, ULONG uFlags)
Definition: shlmenu.c:857
#define TRUE
Definition: types.h:120
HRESULT WINAPI Shell_DefaultContextMenuCallBack(IShellFolder *psf, IDataObject *pdtobj)
Definition: shlfolder.cpp:450
HMENU hmenu
Definition: shlobj.h:1315
#define IDS_PROPERTIES
Definition: resource.h:101
#define E_FAIL
Definition: ddrawi.h:102
WPARAM wParam
Definition: combotst.c:138
#define MFS_ENABLED
Definition: winuser.h:745
#define DFM_INVOKECOMMAND
Definition: precomp.h:45
UINT indexMenu
Definition: shlobj.h:1316
#define MM_ADDSEPARATOR
Definition: shlobj.h:2345
UINT idCmdFirst
Definition: shlobj.h:1317
#define DFM_MERGECONTEXTMENU
Definition: precomp.h:44
#define DFM_CMD_PROPERTIES
Definition: shlobj.h:2429
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
static const WCHAR L[]
Definition: oid.c:1250
BOOL WINAPI DestroyMenu(_In_ HMENU)
#define S_OK
Definition: intsafe.h:52
#define SW_SHOWNORMAL
Definition: winuser.h:764
#define NULL
Definition: types.h:112
HMENU WINAPI CreatePopupMenu(void)
Definition: menu.c:846
HINSTANCE WINAPI ShellExecuteW(HWND hwnd, LPCWSTR lpVerb, LPCWSTR lpFile, LPCWSTR lpParameters, LPCWSTR lpDirectory, INT nShowCmd)
Definition: shlexec.cpp:2274
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
LPARAM lParam
Definition: combotst.c:139

◆ CompareIDs()

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

Implements IShellFolder.

Definition at line 444 of file CDesktopFolder.cpp.

445 {
446  bool bIsDesktopFolder1, bIsDesktopFolder2;
447 
448  if (!pidl1 || !pidl2)
449  {
450  ERR("Got null pidl pointer (%Ix %p %p)!\n", lParam, pidl1, pidl2);
451  return E_INVALIDARG;
452  }
453 
454  bIsDesktopFolder1 = _ILIsDesktop(pidl1);
455  bIsDesktopFolder2 = _ILIsDesktop(pidl2);
456  if (bIsDesktopFolder1 || bIsDesktopFolder2)
457  return MAKE_COMPARE_HRESULT(bIsDesktopFolder1 - bIsDesktopFolder2);
458 
459  if (_ILIsSpecialFolder(pidl1) || _ILIsSpecialFolder(pidl2))
460  return m_regFolder->CompareIDs(lParam, pidl1, pidl2);
461 
462  return m_DesktopFSFolder->CompareIDs(lParam, pidl1, pidl2);
463 }
#define MAKE_COMPARE_HRESULT(x)
Definition: shellutils.h:546
CComPtr< IShellFolder2 > m_DesktopFSFolder
static BOOL _ILIsSpecialFolder(LPCITEMIDLIST pidl)
#define E_INVALIDARG
Definition: ddrawi.h:101
BOOL _ILIsDesktop(LPCITEMIDLIST pidl)
Definition: CBandSite.h:24
#define ERR(fmt,...)
Definition: debug.h:110
CComPtr< IShellFolder2 > m_regFolder
LPARAM lParam
Definition: combotst.c:139

◆ CreateViewObject()

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

Definition at line 468 of file CDesktopFolder.cpp.

472 {
474 
475  TRACE ("(%p)->(hwnd=%p,%s,%p)\n",
476  this, hwndOwner, shdebugstr_guid (&riid), ppvOut);
477 
478  if (!ppvOut)
479  return hr;
480 
481  *ppvOut = NULL;
482 
483  if (IsEqualIID (riid, IID_IDropTarget))
484  {
485  hr = m_DesktopFSFolder->CreateViewObject(hwndOwner, riid, ppvOut);
486  }
487  else if (IsEqualIID (riid, IID_IContextMenu))
488  {
489  HKEY hKeys[16];
490  UINT cKeys = 0;
491  AddClassKeyToArray(L"Directory\\Background", hKeys, &cKeys);
492 
493  DEFCONTEXTMENU dcm;
494  dcm.hwnd = hwndOwner;
495  dcm.pcmcb = this;
496  dcm.pidlFolder = pidlRoot;
497  dcm.psf = this;
498  dcm.cidl = 0;
499  dcm.apidl = NULL;
500  dcm.cKeys = cKeys;
501  dcm.aKeys = hKeys;
503  hr = SHCreateDefaultContextMenu (&dcm, riid, ppvOut);
504  }
505  else if (IsEqualIID (riid, IID_IShellView))
506  {
507  SFV_CREATE sfvparams = {sizeof(SFV_CREATE), this};
508  hr = SHCreateShellFolderView(&sfvparams, (IShellView**)ppvOut);
509  }
510  TRACE ("-- (%p)->(interface=%p)\n", this, ppvOut);
511  return hr;
512 }
HRESULT hr
Definition: shlfolder.c:183
const HKEY * aKeys
Definition: shlobj.h:2374
REFIID riid
Definition: precomp.h:44
HRESULT WINAPI SHCreateDefaultContextMenu(const DEFCONTEXTMENU *pdcm, REFIID riid, void **ppv)
void AddClassKeyToArray(const WCHAR *szClass, HKEY *array, UINT *cKeys)
Definition: shlfolder.cpp:267
IContextMenuCB * pcmcb
Definition: shlobj.h:2367
const char * shdebugstr_guid(const struct _GUID *id)
Definition: debughlp.cpp:414
CComPtr< IShellFolder2 > m_DesktopFSFolder
HRESULT WINAPI SHCreateShellFolderView(const SFV_CREATE *pcsfv, IShellView **ppsv)
Definition: CDefView.cpp:3795
IShellFolder * psf
Definition: shlobj.h:2369
#define E_INVALIDARG
Definition: ddrawi.h:101
struct _SFV_CREATE SFV_CREATE
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:79
static const WCHAR L[]
Definition: oid.c:1250
LPITEMIDLIST pidlRoot
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
IUnknown * punkAssociationInfo
Definition: shlobj.h:2372
PCUITEMID_CHILD_ARRAY apidl
Definition: shlobj.h:2371
PCIDLIST_ABSOLUTE pidlFolder
Definition: shlobj.h:2368
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95

◆ EnumObjects()

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

Definition at line 383 of file CDesktopFolder.cpp.

384 {
385  CComPtr<IEnumIDList> pRegEnumerator;
386  CComPtr<IEnumIDList> pDesktopEnumerator;
387  CComPtr<IEnumIDList> pCommonDesktopEnumerator;
388  HRESULT hr;
389 
390  hr = m_regFolder->EnumObjects(hwndOwner, dwFlags, &pRegEnumerator);
391  if (FAILED(hr))
392  ERR("EnumObjects for reg folder failed\n");
393 
394  hr = m_DesktopFSFolder->EnumObjects(hwndOwner, dwFlags, &pDesktopEnumerator);
395  if (FAILED(hr))
396  ERR("EnumObjects for desktop fs folder failed\n");
397 
398  hr = m_SharedDesktopFSFolder->EnumObjects(hwndOwner, dwFlags, &pCommonDesktopEnumerator);
399  if (FAILED(hr))
400  ERR("EnumObjects for shared desktop fs folder failed\n");
401 
402  return ShellObjectCreatorInit<CDesktopFolderEnum>(dwFlags,pRegEnumerator, pDesktopEnumerator, pCommonDesktopEnumerator, IID_PPV_ARG(IEnumIDList, ppEnumIDList));
403 }
HRESULT hr
Definition: shlfolder.c:183
CComPtr< IShellFolder2 > m_DesktopFSFolder
#define IID_PPV_ARG(Itype, ppType)
CComPtr< IShellFolder2 > m_SharedDesktopFSFolder
LONG HRESULT
Definition: typedefs.h:79
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define ERR(fmt,...)
Definition: debug.h:110
CComPtr< IShellFolder2 > m_regFolder

◆ EnumSearches()

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

Implements IShellFolder2.

Definition at line 736 of file CDesktopFolder.cpp.

737 {
738  FIXME ("(%p)\n", this);
739  return E_NOTIMPL;
740 }
#define FIXME(fmt,...)
Definition: debug.h:111
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ FinalConstruct()

HRESULT WINAPI CDesktopFolder::FinalConstruct ( )

Definition at line 203 of file CDesktopFolder.cpp.

204 {
205  WCHAR szMyPath[MAX_PATH];
206  HRESULT hr;
207 
208  /* Create the root pidl */
210  if (!pidlRoot)
211  return E_OUTOFMEMORY;
212 
213  /* Create the inner fs folder */
215  &CLSID_ShellFSFolder,
218  if (FAILED_UNEXPECTEDLY(hr))
219  return hr;
220 
221  /* Create the inner shared fs folder. Dont fail on failure. */
223  &CLSID_ShellFSFolder,
226  if (FAILED_UNEXPECTEDLY(hr))
227  return hr;
228 
229  /* Create the inner reg folder */
230  hr = CRegFolder_CreateInstance(&CLSID_ShellDesktop,
231  pidlRoot,
232  L"",
233  L"Desktop",
235  if (FAILED_UNEXPECTEDLY(hr))
236  return hr;
237 
238  /* Cache the path to the user desktop directory */
240  return E_UNEXPECTED;
241 
242  sPathTarget = (LPWSTR)SHAlloc((wcslen(szMyPath) + 1) * sizeof(WCHAR));
243  if (!sPathTarget)
244  return E_OUTOFMEMORY;
245 
246  wcscpy(sPathTarget, szMyPath);
247  return S_OK;
248 }
LPITEMIDLIST _ILCreateDesktop(void)
Definition: pidl.c:1602
HRESULT hr
Definition: shlfolder.c:183
#define CSIDL_COMMON_DESKTOPDIRECTORY
Definition: shlobj.h:2036
#define TRUE
Definition: types.h:120
CComPtr< IShellFolder2 > m_DesktopFSFolder
#define IID_PPV_ARG(Itype, ppType)
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
CComPtr< IShellFolder2 > m_SharedDesktopFSFolder
HRESULT CRegFolder_CreateInstance(const GUID *pGuid, LPCITEMIDLIST pidlRoot, LPCWSTR lpszPath, LPCWSTR lpszEnumKeyName, REFIID riid, void **ppv)
Definition: CRegFolder.cpp:785
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:79
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:82
#define MAX_PATH
Definition: compat.h:34
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
static const WCHAR L[]
Definition: oid.c:1250
#define S_OK
Definition: intsafe.h:52
BOOL WINAPI SHGetSpecialFolderPathW(HWND hwndOwner, LPWSTR szPath, int nFolder, BOOL bCreate)
Definition: shellpath.c:2948
LPITEMIDLIST pidlRoot
CComPtr< IShellFolder2 > m_regFolder
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define E_UNEXPECTED
Definition: winerror.h:2456
static HRESULT SHELL32_CoCreateInitSF(LPCITEMIDLIST pidlRoot, PERSIST_FOLDER_TARGET_INFO *ppfti, LPCITEMIDLIST pidlChild, const GUID *clsid, REFIID riid, LPVOID *ppvOut)
Definition: CFindFolder.cpp:13
#define CSIDL_DESKTOPDIRECTORY
Definition: shlobj.h:2027
WCHAR * LPWSTR
Definition: xmlstorage.h:184
LPVOID WINAPI SHAlloc(SIZE_T len)
Definition: shellole.c:309

◆ GetAttributesOf()

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

Definition at line 517 of file CDesktopFolder.cpp.

521 {
522  HRESULT hr = S_OK;
523 
524  TRACE("(%p)->(cidl=%d apidl=%p mask=%p (0x%08x))\n",
525  this, cidl, apidl, rgfInOut, rgfInOut ? *rgfInOut : 0);
526 
527  if (cidl && !apidl)
528  return E_INVALIDARG;
529 
530  if (*rgfInOut == 0)
531  *rgfInOut = ~0;
532 
533  if(cidl == 0)
534  *rgfInOut &= dwDesktopAttributes;
535  else
536  {
537  /* TODO: always add SFGAO_CANLINK */
538  for (UINT i = 0; i < cidl; ++i)
539  {
540  pdump(*apidl);
541  if (_ILIsDesktop(*apidl))
542  *rgfInOut &= dwDesktopAttributes;
543  else if (_ILIsMyComputer(apidl[i]))
544  *rgfInOut &= dwMyComputerAttributes;
545  else if (_ILIsNetHood(apidl[i]))
546  *rgfInOut &= dwMyNetPlacesAttributes;
547  else if (_ILIsFolder(apidl[i]) || _ILIsValue(apidl[i]) || _ILIsSpecialFolder(apidl[i]))
548  {
549  CComPtr<IShellFolder2> psf;
550  HRESULT hr = _GetSFFromPidl(apidl[i], &psf);
551  if (FAILED_UNEXPECTEDLY(hr))
552  continue;
553 
554  psf->GetAttributesOf(1, &apidl[i], rgfInOut);
555  }
556  else
557  ERR("Got an unknown pidl type!!!\n");
558  }
559  }
560  /* make sure SFGAO_VALIDATE is cleared, some apps depend on that */
561  *rgfInOut &= ~SFGAO_VALIDATE;
562 
563  TRACE("-- result=0x%08x\n", *rgfInOut);
564 
565  return hr;
566 }
static const DWORD dwDesktopAttributes
HRESULT hr
Definition: shlfolder.c:183
BOOL _ILIsMyComputer(LPCITEMIDLIST pidl)
Definition: pidl.c:1920
BOOL _ILIsNetHood(LPCITEMIDLIST pidl)
Definition: pidl.c:1909
static BOOL _ILIsSpecialFolder(LPCITEMIDLIST pidl)
#define E_INVALIDARG
Definition: ddrawi.h:101
BOOL _ILIsFolder(LPCITEMIDLIST pidl)
Definition: pidl.c:1965
BOOL _ILIsDesktop(LPCITEMIDLIST pidl)
Definition: CBandSite.h:24
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:79
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:82
BOOL _ILIsValue(LPCITEMIDLIST pidl)
Definition: pidl.c:1974
#define ERR(fmt,...)
Definition: debug.h:110
#define S_OK
Definition: intsafe.h:52
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
static const DWORD dwMyComputerAttributes
void pdump(LPCITEMIDLIST pidl)
Definition: debughlp.cpp:248
static DWORD dwMyNetPlacesAttributes
unsigned int UINT
Definition: ndis.h:50
HRESULT _GetSFFromPidl(LPCITEMIDLIST pidl, IShellFolder2 **psf)

Referenced by ParseDisplayName().

◆ GetClassID()

HRESULT WINAPI CDesktopFolder::GetClassID ( CLSID lpClassId)
virtual

Implements IPersist.

Definition at line 809 of file CDesktopFolder.cpp.

810 {
811  TRACE ("(%p)\n", this);
812 
813  if (!lpClassId)
814  return E_POINTER;
815 
816  *lpClassId = CLSID_ShellDesktop;
817 
818  return S_OK;
819 }
#define TRACE(s)
Definition: solgame.cpp:4
#define S_OK
Definition: intsafe.h:52
#define E_POINTER
Definition: winerror.h:2365

◆ GetCurFolder()

HRESULT WINAPI CDesktopFolder::GetCurFolder ( PIDLIST_ABSOLUTE pidl)
virtual

Implements IPersistFolder2.

Definition at line 831 of file CDesktopFolder.cpp.

832 {
833  TRACE ("(%p)->(%p)\n", this, pidl);
834 
835  if (!pidl)
836  return E_INVALIDARG; /* xp doesn't have this check and crashes on NULL */
837  *pidl = ILClone (pidlRoot);
838  return S_OK;
839 }
#define E_INVALIDARG
Definition: ddrawi.h:101
#define TRACE(s)
Definition: solgame.cpp:4
#define S_OK
Definition: intsafe.h:52
LPITEMIDLIST WINAPI ILClone(LPCITEMIDLIST pidl)
Definition: pidl.c:228
LPITEMIDLIST pidlRoot

◆ GetDefaultColumn()

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

Implements IShellFolder2.

Definition at line 742 of file CDesktopFolder.cpp.

743 {
744  TRACE ("(%p)\n", this);
745 
746  if (pSort)
747  *pSort = 0;
748  if (pDisplay)
749  *pDisplay = 0;
750 
751  return S_OK;
752 }
#define TRACE(s)
Definition: solgame.cpp:4
#define S_OK
Definition: intsafe.h:52

◆ GetDefaultColumnState()

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

Implements IShellFolder2.

Definition at line 754 of file CDesktopFolder.cpp.

755 {
756  TRACE ("(%p)\n", this);
757 
758  if (!pcsFlags || iColumn >= DESKTOPSHELLVIEWCOLUMNS)
759  return E_INVALIDARG;
760 
761  *pcsFlags = DesktopSFHeader[iColumn].pcsFlags;
762 
763  return S_OK;
764 }
#define E_INVALIDARG
Definition: ddrawi.h:101
#define DESKTOPSHELLVIEWCOLUMNS
#define TRACE(s)
Definition: solgame.cpp:4
#define S_OK
Definition: intsafe.h:52
static const shvheader DesktopSFHeader[]

◆ GetDefaultSearchGUID()

HRESULT WINAPI CDesktopFolder::GetDefaultSearchGUID ( GUID pguid)
virtual

Implements IShellFolder2.

Definition at line 730 of file CDesktopFolder.cpp.

731 {
732  FIXME ("(%p)\n", this);
733  return E_NOTIMPL;
734 }
#define FIXME(fmt,...)
Definition: debug.h:111
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ GetDetailsEx()

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

Implements IShellFolder2.

Definition at line 766 of file CDesktopFolder.cpp.

770 {
771  FIXME ("(%p)\n", this);
772 
773  return E_NOTIMPL;
774 }
#define FIXME(fmt,...)
Definition: debug.h:111
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ GetDetailsOf()

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

Implements IShellFolder2.

Definition at line 776 of file CDesktopFolder.cpp.

780 {
781  if (!psd || iColumn >= DESKTOPSHELLVIEWCOLUMNS)
782  return E_INVALIDARG;
783 
784  if (!pidl)
785  {
786  psd->fmt = DesktopSFHeader[iColumn].fmt;
787  psd->cxChar = DesktopSFHeader[iColumn].cxChar;
788  return SHSetStrRet(&psd->str, DesktopSFHeader[iColumn].colnameid);
789  }
790 
791  CComPtr<IShellFolder2> psf;
792  HRESULT hr = _GetSFFromPidl(pidl, &psf);
793  if (FAILED_UNEXPECTEDLY(hr))
794  return hr;
795 
796  hr = psf->GetDetailsOf(pidl, iColumn, psd);
797  if (FAILED_UNEXPECTEDLY(hr))
798  return hr;
799 
800  return hr;
801 }
HRESULT hr
Definition: shlfolder.c:183
STRRET str
Definition: shtypes.idl:108
#define E_INVALIDARG
Definition: ddrawi.h:101
#define DESKTOPSHELLVIEWCOLUMNS
LONG HRESULT
Definition: typedefs.h:79
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:82
static const shvheader DesktopSFHeader[]
HRESULT _GetSFFromPidl(LPCITEMIDLIST pidl, IShellFolder2 **psf)

◆ GetDisplayNameOf()

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

Definition at line 674 of file CDesktopFolder.cpp.

675 {
676  TRACE ("(%p)->(pidl=%p,0x%08x,%p)\n", this, pidl, dwFlags, strRet);
677  pdump (pidl);
678 
679  if (!strRet)
680  return E_INVALIDARG;
681 
682  if (!_ILIsPidlSimple (pidl))
683  {
684  return SHELL32_GetDisplayNameOfChild(this, pidl, dwFlags, strRet);
685  }
686  else if (_ILIsDesktop(pidl))
687  {
689  return SHSetStrRet(strRet, sPathTarget);
690  else
691  return m_regFolder->GetDisplayNameOf(pidl, dwFlags, strRet);
692  }
693 
694  /* file system folder or file rooted at the desktop */
695  CComPtr<IShellFolder2> psf;
696  HRESULT hr = _GetSFFromPidl(pidl, &psf);
697  if (FAILED_UNEXPECTEDLY(hr))
698  return hr;
699 
700  return psf->GetDisplayNameOf(pidl, dwFlags, strRet);
701 }
HRESULT hr
Definition: shlfolder.c:183
#define GET_SHGDN_RELATION(dwFlags)
Definition: precomp.h:53
#define GET_SHGDN_FOR(dwFlags)
Definition: precomp.h:52
#define E_INVALIDARG
Definition: ddrawi.h:101
HRESULT SHELL32_GetDisplayNameOfChild(IShellFolder2 *psf, LPCITEMIDLIST pidl, DWORD dwFlags, LPSTRRET strRet)
Definition: shlfolder.cpp:197
BOOL _ILIsDesktop(LPCITEMIDLIST pidl)
Definition: CBandSite.h:24
BOOL WINAPI _ILIsPidlSimple(LPCITEMIDLIST pidl)
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:79
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:82
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
void pdump(LPCITEMIDLIST pidl)
Definition: debughlp.cpp:248
CComPtr< IShellFolder2 > m_regFolder
HRESULT _GetSFFromPidl(LPCITEMIDLIST pidl, IShellFolder2 **psf)

◆ GetMaxLength()

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

Definition at line 86 of file CDesktopFolder.h.

87  {
88  return E_NOTIMPL;
89  }
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ GetUIObjectOf()

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

Definition at line 580 of file CDesktopFolder.cpp.

587 {
588  LPVOID pObj = NULL;
590 
591  TRACE ("(%p)->(%p,%u,apidl=%p,%s,%p,%p)\n",
592  this, hwndOwner, cidl, apidl, shdebugstr_guid (&riid), prgfInOut, ppvOut);
593 
594  if (!ppvOut)
595  return hr;
596 
597  *ppvOut = NULL;
598 
599  if (cidl == 1 && !_ILIsSpecialFolder(apidl[0]))
600  {
601  CComPtr<IShellFolder2> psf;
602  HRESULT hr = _GetSFFromPidl(apidl[0], &psf);
603  if (FAILED_UNEXPECTEDLY(hr))
604  return hr;
605 
606  return psf->GetUIObjectOf(hwndOwner, cidl, apidl, riid, prgfInOut, ppvOut);
607  }
608 
609  if (IsEqualIID (riid, IID_IContextMenu))
610  {
611  if (cidl > 0 && _ILIsSpecialFolder(apidl[0]))
612  {
613  hr = m_regFolder->GetUIObjectOf(hwndOwner, cidl, apidl, riid, prgfInOut, &pObj);
614  }
615  else
616  {
617  /* Do not use the context menu of the CFSFolder here. */
618  /* We need to pass a pointer of the CDesktopFolder so as the data object that the context menu gets is rooted to the desktop */
619  /* Otherwise operations like that involve items from both user and shared desktop will not work */
620  HKEY hKeys[16];
621  UINT cKeys = 0;
622  if (cidl > 0)
623  {
624  AddFSClassKeysToArray(apidl[0], hKeys, &cKeys);
625  }
626 
627  DEFCONTEXTMENU dcm;
628  dcm.hwnd = hwndOwner;
629  dcm.pcmcb = this;
630  dcm.pidlFolder = pidlRoot;
631  dcm.psf = this;
632  dcm.cidl = cidl;
633  dcm.apidl = apidl;
634  dcm.cKeys = cKeys;
635  dcm.aKeys = hKeys;
637  hr = SHCreateDefaultContextMenu (&dcm, riid, &pObj);
638  }
639  }
640  else if (IsEqualIID (riid, IID_IDataObject) && (cidl >= 1))
641  {
642  hr = IDataObject_Constructor( hwndOwner, pidlRoot, apidl, cidl, TRUE, (IDataObject **)&pObj);
643  }
644  else if ((IsEqualIID (riid, IID_IExtractIconA) || IsEqualIID (riid, IID_IExtractIconW)) && (cidl == 1))
645  {
646  hr = m_regFolder->GetUIObjectOf(hwndOwner, cidl, apidl, riid, prgfInOut, &pObj);
647  }
648  else if (IsEqualIID (riid, IID_IDropTarget) && (cidl == 1))
649  {
650  CComPtr<IShellFolder> psfChild;
651  hr = this->BindToObject(apidl[0], NULL, IID_PPV_ARG(IShellFolder, &psfChild));
652  if (FAILED_UNEXPECTEDLY(hr))
653  return hr;
654 
655  return psfChild->CreateViewObject(NULL, riid, ppvOut);
656  }
657  else
658  hr = E_NOINTERFACE;
659 
660  if (SUCCEEDED(hr) && !pObj)
661  hr = E_OUTOFMEMORY;
662 
663  *ppvOut = pObj;
664  TRACE ("(%p)->hr=0x%08x\n", this, hr);
665  return hr;
666 }
virtual HRESULT WINAPI BindToObject(PCUIDLIST_RELATIVE pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut)
#define E_NOINTERFACE
Definition: winerror.h:2364
HRESULT hr
Definition: shlfolder.c:183
const HKEY * aKeys
Definition: shlobj.h:2374
#define TRUE
Definition: types.h:120
REFIID riid
Definition: precomp.h:44
HRESULT WINAPI SHCreateDefaultContextMenu(const DEFCONTEXTMENU *pdcm, REFIID riid, void **ppv)
IContextMenuCB * pcmcb
Definition: shlobj.h:2367
const char * shdebugstr_guid(const struct _GUID *id)
Definition: debughlp.cpp:414
const GUID IID_IDataObject
#define IID_PPV_ARG(Itype, ppType)
IShellFolder * psf
Definition: shlobj.h:2369
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
static BOOL _ILIsSpecialFolder(LPCITEMIDLIST pidl)
if SUCCEEDED(hr)
#define E_INVALIDARG
Definition: ddrawi.h:101
HRESULT IDataObject_Constructor(HWND hwndOwner, PCIDLIST_ABSOLUTE pMyPidl, PCUIDLIST_RELATIVE_ARRAY apidl, UINT cidl, BOOL bExtendedObject, IDataObject **dataObject)
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:79
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:82
void AddFSClassKeysToArray(PCUITEMID_CHILD pidl, HKEY *array, UINT *cKeys)
Definition: shlfolder.cpp:281
LPITEMIDLIST pidlRoot
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
CComPtr< IShellFolder2 > m_regFolder
IUnknown * punkAssociationInfo
Definition: shlobj.h:2372
HRESULT _GetSFFromPidl(LPCITEMIDLIST pidl, IShellFolder2 **psf)
PCUITEMID_CHILD_ARRAY apidl
Definition: shlobj.h:2371
PCIDLIST_ABSOLUTE pidlFolder
Definition: shlobj.h:2368
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95

◆ GetValidCharacters()

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

Definition at line 92 of file CDesktopFolder.h.

93  {
94  if (ppwszValidChars)
95  {
96  *ppwszValidChars = NULL;
97  }
98  if (ppwszInvalidChars)
99  {
100  SHStrDupW(INVALID_FILETITLE_CHARACTERSW, ppwszInvalidChars);
101  }
102  return S_OK;
103  }
HRESULT WINAPI SHStrDupW(LPCWSTR src, LPWSTR *dest)
Definition: string.c:2004
#define INVALID_FILETITLE_CHARACTERSW
Definition: undocshell.h:729
#define S_OK
Definition: intsafe.h:52
#define NULL
Definition: types.h:112

◆ Initialize()

HRESULT WINAPI CDesktopFolder::Initialize ( PCIDLIST_ABSOLUTE  pidl)
virtual

Implements IPersistFolder.

Definition at line 821 of file CDesktopFolder.cpp.

822 {
823  TRACE ("(%p)->(%p)\n", this, pidl);
824 
825  if (!pidl)
826  return S_OK;
827 
828  return E_INVALIDARG;
829 }
#define E_INVALIDARG
Definition: ddrawi.h:101
#define TRACE(s)
Definition: solgame.cpp:4
#define S_OK
Definition: intsafe.h:52

◆ MapColumnToSCID()

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

Implements IShellFolder2.

Definition at line 803 of file CDesktopFolder.cpp.

804 {
805  FIXME ("(%p)\n", this);
806  return E_NOTIMPL;
807 }
#define FIXME(fmt,...)
Definition: debug.h:111
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ ParseDisplayName()

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

Definition at line 277 of file CDesktopFolder.cpp.

284 {
285  LPCWSTR szNext = NULL;
286  LPITEMIDLIST pidlTemp = NULL;
287  PARSEDURLW urldata;
288  HRESULT hr = S_OK;
289 
290  TRACE ("(%p)->(HWND=%p,%p,%p=%s,%p,pidl=%p,%p)\n",
291  this, hwndOwner, pbc, lpszDisplayName, debugstr_w(lpszDisplayName),
292  pchEaten, ppidl, pdwAttributes);
293 
294  if (!ppidl)
295  return E_INVALIDARG;
296 
297  *ppidl = NULL;
298 
299  if (!lpszDisplayName)
300  return E_INVALIDARG;
301 
302  if (pchEaten)
303  *pchEaten = 0; /* strange but like the original */
304 
305  urldata.cbSize = sizeof(urldata);
306 
307  if (lpszDisplayName[0] == ':' && lpszDisplayName[1] == ':')
308  {
309  return m_regFolder->ParseDisplayName(hwndOwner, pbc, lpszDisplayName, pchEaten, ppidl, pdwAttributes);
310  }
311  else if (PathGetDriveNumberW (lpszDisplayName) >= 0)
312  {
313  /* it's a filesystem path with a drive. Let MyComputer/UnixDosFolder parse it */
314  pidlTemp = _ILCreateMyComputer ();
315  szNext = lpszDisplayName;
316  }
317  else if (PathIsUNCW(lpszDisplayName))
318  {
319  pidlTemp = _ILCreateNetwork();
320  szNext = lpszDisplayName;
321  }
322  else if( (pidlTemp = SHELL32_CreatePidlFromBindCtx(pbc, lpszDisplayName)) )
323  {
324  *ppidl = pidlTemp;
325  return S_OK;
326  }
327  else if (SUCCEEDED(ParseURLW(lpszDisplayName, &urldata)))
328  {
329  if (urldata.nScheme == URL_SCHEME_SHELL) /* handle shell: urls */
330  {
331  TRACE ("-- shell url: %s\n", debugstr_w(urldata.pszSuffix));
332  pidlTemp = _ILCreateGuidFromStrW(urldata.pszSuffix + 2);
333  }
334  else
335  return IEParseDisplayNameWithBCW(CP_ACP, lpszDisplayName, pbc, ppidl);
336  }
337  else
338  {
339  if (*lpszDisplayName)
340  {
341  /* it's a filesystem path on the desktop. Let a FSFolder parse it */
342  hr = m_DesktopFSFolder->ParseDisplayName(hwndOwner, pbc, lpszDisplayName, pchEaten, ppidl, pdwAttributes);
343  if (SUCCEEDED(hr))
344  return hr;
345 
346  return m_SharedDesktopFSFolder->ParseDisplayName(hwndOwner, pbc, lpszDisplayName, pchEaten, ppidl, pdwAttributes);
347  }
348  else
349  pidlTemp = _ILCreateMyComputer();
350 
351  szNext = NULL;
352  }
353 
354  if (SUCCEEDED(hr) && pidlTemp)
355  {
356  if (szNext && *szNext)
357  {
358  hr = SHELL32_ParseNextElement(this, hwndOwner, pbc,
359  &pidlTemp, (LPOLESTR) szNext, pchEaten, pdwAttributes);
360  }
361  else
362  {
363  if (pdwAttributes && *pdwAttributes)
364  {
365  GetAttributesOf(1, &pidlTemp, pdwAttributes);
366  }
367  }
368  }
369 
370  if (SUCCEEDED(hr))
371  *ppidl = pidlTemp;
372  else
373  *ppidl = NULL;
374 
375  TRACE ("(%p)->(-- ret=0x%08x)\n", this, hr);
376 
377  return hr;
378 }
virtual HRESULT WINAPI GetAttributesOf(UINT cidl, PCUITEMID_CHILD_ARRAY apidl, DWORD *rgfInOut)
HRESULT hr
Definition: shlfolder.c:183
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define CP_ACP
Definition: compat.h:109
DWORD cbSize
Definition: shlwapi.h:1432
HRESULT WINAPI IEParseDisplayNameWithBCW(DWORD codepage, LPCWSTR lpszDisplayName, LPBC pbc, LPITEMIDLIST *ppidl)
Definition: shdocvw_main.c:471
LPCWSTR pszSuffix
Definition: shlwapi.h:1435
CComPtr< IShellFolder2 > m_DesktopFSFolder
static LPOLESTR
Definition: stg_prop.c:27
if SUCCEEDED(hr)
#define debugstr_w
Definition: kernel32.h:32
#define E_INVALIDARG
Definition: ddrawi.h:101
CComPtr< IShellFolder2 > m_SharedDesktopFSFolder
LPITEMIDLIST _ILCreateMyComputer(void)
Definition: pidl.c:1613
HRESULT SHELL32_ParseNextElement(IShellFolder2 *psf, HWND hwndOwner, LPBC pbc, LPITEMIDLIST *pidlInOut, LPOLESTR szNext, DWORD *pEaten, DWORD *pdwAttributes)
Definition: shlfolder.cpp:70
LPITEMIDLIST _ILCreateGuidFromStrW(LPCWSTR szGUID)
Definition: pidl.c:1725
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:79
LPITEMIDLIST SHELL32_CreatePidlFromBindCtx(IBindCtx *pbc, LPCWSTR path)
Definition: CFSFolder.cpp:553
UINT nScheme
Definition: shlwapi.h:1437
HRESULT WINAPI ParseURLW(LPCWSTR x, PARSEDURLW *y)
Definition: url.c:197
LPITEMIDLIST _ILCreateNetwork(void)
Definition: pidl.c:1669
#define S_OK
Definition: intsafe.h:52
#define NULL
Definition: types.h:112
CComPtr< IShellFolder2 > m_regFolder
int WINAPI PathGetDriveNumberW(const WCHAR *path)
Definition: path.c:553
BOOL WINAPI PathIsUNCW(LPCWSTR lpszPath)
Definition: path.c:2265
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41

◆ SetNameOf()

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

Implements IShellFolder.

Definition at line 715 of file CDesktopFolder.cpp.

721 {
722  CComPtr<IShellFolder2> psf;
723  HRESULT hr = _GetSFFromPidl(pidl, &psf);
724  if (FAILED_UNEXPECTEDLY(hr))
725  return hr;
726 
727  return psf->SetNameOf(hwndOwner, pidl, lpName, dwFlags, pPidlOut);
728 }
HRESULT hr
Definition: shlfolder.c:183
_In_ LPCSTR lpName
Definition: winbase.h:2768
LONG HRESULT
Definition: typedefs.h:79
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:82
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
HRESULT _GetSFFromPidl(LPCITEMIDLIST pidl, IShellFolder2 **psf)

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: