ReactOS 0.4.16-dev-2175-g9420ab7
CRecycleBinFolderViewCB Class Reference

#include <CRecycleBinFolderViewCB.h>

Inheritance diagram for CRecycleBinFolderViewCB:
Collaboration diagram for CRecycleBinFolderViewCB:

Public Member Functions

 CRecycleBinFolderViewCB ()
 
virtual ~CRecycleBinFolderViewCB ()
 
void Initialize (CRecycleBin *pRecycleBin, IShellView *psv, LPCITEMIDLIST pidlParent)
 
STDMETHODIMP MessageSFVCB (UINT uMsg, WPARAM wParam, LPARAM lParam) 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 ()
 

Private Member Functions

HRESULT RegisterChangeNotify (HWND hwndView)
 
HRESULT TranslatePidl (LPITEMIDLIST *ppidlNew, LPCITEMIDLIST pidl)
 
void TranslateTwoPIDLs (PIDLIST_ABSOLUTE *pidls)
 

Private Attributes

IShellViewm_pShellView
 
CRecycleBinm_pRecycleBin
 
ULONG m_nChangeNotif
 
CComHeapPtr< ITEMIDLISTm_pidlParent
 
CComHeapPtr< ITEMIDLISTm_pidls [2]
 

Additional Inherited Members

- 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 10 of file CRecycleBinFolderViewCB.h.

Constructor & Destructor Documentation

◆ CRecycleBinFolderViewCB()

CRecycleBinFolderViewCB::CRecycleBinFolderViewCB ( )

Definition at line 12 of file CRecycleBinFolderViewCB.cpp.

◆ ~CRecycleBinFolderViewCB()

CRecycleBinFolderViewCB::~CRecycleBinFolderViewCB ( )
virtual

Definition at line 19 of file CRecycleBinFolderViewCB.cpp.

20{
23}
EXTERN_C BOOL WINAPI SHChangeNotifyDeregister(ULONG hNotify)

Member Function Documentation

◆ Initialize()

void CRecycleBinFolderViewCB::Initialize ( CRecycleBin pRecycleBin,
IShellView psv,
LPCITEMIDLIST  pidlParent 
)

Definition at line 25 of file CRecycleBinFolderViewCB.cpp.

26{
27 m_pRecycleBin = pRecycleBin;
28 m_pShellView = psv;
29 m_pidlParent.Attach(ILClone(pidlParent));
30}
CComHeapPtr< ITEMIDLIST > m_pidlParent
LPITEMIDLIST WINAPI ILClone(LPCITEMIDLIST pidl)
Definition: pidl.c:238

◆ MessageSFVCB()

STDMETHODIMP CRecycleBinFolderViewCB::MessageSFVCB ( UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
override

Definition at line 132 of file CRecycleBinFolderViewCB.cpp.

133{
134 switch (uMsg)
135 {
136 case SFVM_QUERYFSNOTIFY: // Register change notification
137 {
138 // Now, we can get the view window
140 HWND hwndView;
141 HRESULT hr = m_pShellView->GetWindow(&hwndView);
143 return hr;
144 RegisterChangeNotify(hwndView);
145 return S_OK;
146 }
147 case SFVM_FSNOTIFY: // Change notification
148 {
150 return S_OK;
151 }
152 }
153 return E_NOTIMPL;
154}
#define ATLASSERT(x)
Definition: CComVariant.cpp:10
HRESULT RegisterChangeNotify(HWND hwndView)
void TranslateTwoPIDLs(PIDLIST_ABSOLUTE *pidls)
WPARAM wParam
Definition: combotst.c:138
#define E_NOTIMPL
Definition: ddrawi.h:99
#define FAILED_UNEXPECTEDLY
Definition: utils.cpp:30
HRESULT GetWindow([out] HWND *phwnd)
#define S_OK
Definition: intsafe.h:52
HRESULT hr
Definition: shlfolder.c:183
#define SFVM_FSNOTIFY
Definition: shlobj.h:1312
#define SFVM_QUERYFSNOTIFY
Definition: shlobj.h:1321

◆ RegisterChangeNotify()

HRESULT CRecycleBinFolderViewCB::RegisterChangeNotify ( HWND  hwndView)
private

Definition at line 32 of file CRecycleBinFolderViewCB.cpp.

33{
34 if (!hwndView)
35 {
36 WARN("!hwndView\n");
37 return E_FAIL;
38 }
39
42
43 // Populate entries
44 INT iEntry = 0;
45 for (INT iDrive = 0; iDrive < RECYCLEBINMAXDRIVECOUNT; ++iDrive)
46 {
47 WCHAR szBinPath[MAX_PATH];
48 HRESULT hr = GetRecycleBinPathFromDriveNumber(iDrive, szBinPath);
49 if (FAILED(hr))
50 continue;
51 LPITEMIDLIST pidl = ILCreateFromPathW(szBinPath);
52 if (!pidl)
53 continue;
54 entries[iEntry].pidl = pidls[iEntry] = pidl;
55 entries[iEntry].fRecursive = FALSE;
56 ++iEntry;
57 }
58
59 // Register
61 const DWORD dwEvents =
73 iEntry, entries);
74 if (!m_nChangeNotif)
75 WARN("SHChangeNotifyRegister failed\n");
76
77 // Clean up
78 while (iEntry > 0)
79 ILFree(pidls[--iEntry]);
80
81 return m_nChangeNotif ? S_OK : E_FAIL;
82}
#define WARN(fmt,...)
Definition: precomp.h:61
#define SHV_CHANGE_NOTIFY
Definition: brfolder.cpp:20
EXTERN_C ULONG WINAPI SHChangeNotifyRegister(HWND hwnd, INT fSources, LONG wEventMask, UINT uMsg, INT cItems, SHChangeNotifyEntry *lpItems)
#define E_FAIL
Definition: ddrawi.h:102
#define FALSE
Definition: types.h:117
#define MAX_PATH
Definition: compat.h:34
EXTERN_C HRESULT GetRecycleBinPathFromDriveNumber(UINT Drive, LPWSTR Path)
Definition: recyclebin.c:352
unsigned long DWORD
Definition: ntddk_ex.h:95
#define FAILED(hr)
Definition: intsafe.h:51
_In_ LPWSTR _In_ DWORD _In_ DWORD _In_ DWORD dwFlags
Definition: netsh.h:141
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:1051
LPITEMIDLIST WINAPI ILCreateFromPathW(LPCWSTR path)
Definition: pidl.c:1108
#define RECYCLEBINMAXDRIVECOUNT
Definition: recyclebin.h:20
#define SHCNE_RMDIR
Definition: shlobj.h:1899
#define SHCNE_DELETE
Definition: shlobj.h:1897
#define SHCNE_MKDIR
Definition: shlobj.h:1898
#define SHCNE_UPDATEITEM
Definition: shlobj.h:1908
#define SHCNE_RENAMEITEM
Definition: shlobj.h:1895
#define SHCNE_UPDATEDIR
Definition: shlobj.h:1907
#define SHCNE_UPDATEIMAGE
Definition: shlobj.h:1910
#define SHCNE_CREATE
Definition: shlobj.h:1896
#define SHCNE_RENAMEFOLDER
Definition: shlobj.h:1912
#define SHCNRF_NewDelivery
Definition: shlobj.h:1944
#define SHCNRF_ShellLevel
Definition: shlobj.h:1942
#define SHCNE_ASSOCCHANGED
Definition: shlobj.h:1916
#define SHCNRF_InterruptLevel
Definition: shlobj.h:1941
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
PCIDLIST_ABSOLUTE pidl
Definition: shlobj.h:1891
int32_t INT
Definition: typedefs.h:58
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by MessageSFVCB().

◆ TranslatePidl()

HRESULT CRecycleBinFolderViewCB::TranslatePidl ( LPITEMIDLIST ppidlNew,
LPCITEMIDLIST  pidl 
)
private

Definition at line 84 of file CRecycleBinFolderViewCB.cpp.

85{
86 ATLASSERT(ppidlNew);
87 *ppidlNew = NULL;
88
90 if (!SHGetPathFromIDListW(pidl, szPath))
91 {
92 ERR("!SHGetPathFromIDListW\n");
93 return E_FAIL;
94 }
95
96 CComHeapPtr<ITEMIDLIST> pidlChild;
99 if (!pidlChild)
100 {
101 ERR("!pidlChild\n");
102 return E_FAIL;
103 }
104
105 *ppidlNew = ILCombine(m_pidlParent, pidlChild);
106
107 return *ppidlNew ? S_OK : E_OUTOFMEMORY;
108}
#define ERR(fmt,...)
Definition: precomp.h:57
HRESULT ParseRecycleBinPath(LPCWSTR lpszPath, LPBC pbc, PIDLIST_RELATIVE *ppidl, DWORD *pdwAttributes)
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
LPCWSTR szPath
Definition: env.c:37
LPITEMIDLIST WINAPI ILCombine(LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
Definition: pidl.c:817
BOOL WINAPI SHGetPathFromIDListW(LPCITEMIDLIST pidl, LPWSTR pszPath)
Definition: pidl.c:1496

Referenced by TranslateTwoPIDLs().

◆ TranslateTwoPIDLs()

void CRecycleBinFolderViewCB::TranslateTwoPIDLs ( PIDLIST_ABSOLUTE pidls)
private

Definition at line 110 of file CRecycleBinFolderViewCB.cpp.

111{
112 ATLASSERT(pidls);
113
114 HRESULT hr;
115 if (pidls[0])
116 {
117 m_pidls[0].Free();
118 hr = TranslatePidl(&m_pidls[0], pidls[0]);
120 pidls[0] = m_pidls[0];
121 }
122 if (pidls[1])
123 {
124 m_pidls[1].Free();
125 hr = TranslatePidl(&m_pidls[1], pidls[1]);
127 pidls[1] = m_pidls[1];
128 }
129}
CComHeapPtr< ITEMIDLIST > m_pidls[2]
HRESULT TranslatePidl(LPITEMIDLIST *ppidlNew, LPCITEMIDLIST pidl)

Referenced by MessageSFVCB().

Member Data Documentation

◆ m_nChangeNotif

ULONG CRecycleBinFolderViewCB::m_nChangeNotif
private

Definition at line 16 of file CRecycleBinFolderViewCB.h.

Referenced by RegisterChangeNotify(), and ~CRecycleBinFolderViewCB().

◆ m_pidlParent

CComHeapPtr<ITEMIDLIST> CRecycleBinFolderViewCB::m_pidlParent
private

Definition at line 17 of file CRecycleBinFolderViewCB.h.

Referenced by Initialize(), and TranslatePidl().

◆ m_pidls

CComHeapPtr<ITEMIDLIST> CRecycleBinFolderViewCB::m_pidls[2]
private

Definition at line 18 of file CRecycleBinFolderViewCB.h.

Referenced by TranslateTwoPIDLs().

◆ m_pRecycleBin

CRecycleBin* CRecycleBinFolderViewCB::m_pRecycleBin
private

Definition at line 15 of file CRecycleBinFolderViewCB.h.

Referenced by Initialize(), and TranslatePidl().

◆ m_pShellView

IShellView* CRecycleBinFolderViewCB::m_pShellView
private

Definition at line 14 of file CRecycleBinFolderViewCB.h.

Referenced by Initialize(), and MessageSFVCB().


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