ReactOS 0.4.16-dev-336-gb667d82
CTravelEntry Class Reference
Inheritance diagram for CTravelEntry:
Collaboration diagram for CTravelEntry:

Public Member Functions

 CTravelEntry ()
 
 ~CTravelEntry ()
 
HRESULT GetToolTipText (IUnknown *punk, LPWSTR pwzText) const
 
long GetSize () const
 
STDMETHOD() Invoke (IUnknown *punk) override
 
STDMETHOD() Update (IUnknown *punk, BOOL fIsLocalAnchor) override
 
STDMETHOD() GetPidl (LPITEMIDLIST *ppidl) 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 ()
 
- Public Member Functions inherited from ITravelEntry
HRESULT Invoke ([in] IUnknown *punk)
 
HRESULT Update ([in] IUnknown *punk, [in] BOOL fIsLocalAnchor)
 
HRESULT GetPidl ([out] PIDLIST_ABSOLUTE *ppidl)
 
- Public Member Functions inherited from IUnknown
HRESULT QueryInterface ([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
 
ULONG AddRef ()
 
ULONG Release ()
 

Public Attributes

CTravelEntryfNextEntry
 
CTravelEntryfPreviousEntry
 
- Public Attributes inherited from ATL::CComObjectRootBase
LONG m_dwRef
 

Private Attributes

LPITEMIDLIST fPIDL
 
HGLOBAL fPersistState
 

Additional Inherited Members

- Public Types inherited from IUnknown
typedef IUnknownLPUNKNOWN
 
- 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)
 

Detailed Description

Definition at line 46 of file travellog.cpp.

Constructor & Destructor Documentation

◆ CTravelEntry()

CTravelEntry::CTravelEntry ( )

Definition at line 110 of file travellog.cpp.

111{
114 fPIDL = NULL;
116}
LPITEMIDLIST fPIDL
Definition: travellog.cpp:54
CTravelEntry * fNextEntry
Definition: travellog.cpp:51
CTravelEntry * fPreviousEntry
Definition: travellog.cpp:52
HGLOBAL fPersistState
Definition: travellog.cpp:55
#define NULL
Definition: types.h:112

◆ ~CTravelEntry()

CTravelEntry::~CTravelEntry ( )

Definition at line 118 of file travellog.cpp.

119{
120 ILFree(fPIDL);
122}
HGLOBAL NTAPI GlobalFree(HGLOBAL hMem)
Definition: heapmem.c:611
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:1042

Member Function Documentation

◆ GetPidl()

HRESULT STDMETHODCALLTYPE CTravelEntry::GetPidl ( LPITEMIDLIST ppidl)
override

Definition at line 213 of file travellog.cpp.

214{
215 if (ppidl == NULL)
216 return E_POINTER;
217 *ppidl = ILClone(fPIDL);
218 if (*ppidl == NULL)
219 return E_OUTOFMEMORY;
220
221 TRACE("CTravelEntry::GetPidl returning ppidl=%p\n", *ppidl);
222
223 return S_OK;
224}
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define S_OK
Definition: intsafe.h:52
LPITEMIDLIST WINAPI ILClone(LPCITEMIDLIST pidl)
Definition: pidl.c:237
#define TRACE(s)
Definition: solgame.cpp:4
#define E_POINTER
Definition: winerror.h:2365

◆ GetSize()

long CTravelEntry::GetSize ( ) const

Definition at line 135 of file travellog.cpp.

136{
137 return 0;
138}

Referenced by CTravelLog::DeleteChain().

◆ GetToolTipText()

HRESULT CTravelEntry::GetToolTipText ( IUnknown punk,
LPWSTR  pwzText 
) const

Definition at line 124 of file travellog.cpp.

125{
126 HRESULT hResult;
127
128 hResult = ILGetDisplayNameEx(NULL, fPIDL, pwzText, ILGDN_NORMAL) ? S_OK : E_FAIL;
129 if (FAILED_UNEXPECTEDLY(hResult))
130 return hResult;
131
132 return S_OK;
133}
#define E_FAIL
Definition: ddrawi.h:102
#define FAILED_UNEXPECTEDLY(hr)
Definition: precomp.h:121
BOOL WINAPI ILGetDisplayNameEx(LPSHELLFOLDER psf, LPCITEMIDLIST pidl, LPVOID path, DWORD type)
Definition: pidl.c:171
#define ILGDN_NORMAL
Definition: undocshell.h:72

Referenced by CTravelLog::GetToolTipText(), CTravelLog::InsertMenuEntries(), and Update().

◆ Invoke()

HRESULT STDMETHODCALLTYPE CTravelEntry::Invoke ( IUnknown punk)
override

Implements ITravelEntry.

Definition at line 140 of file travellog.cpp.

141{
142 CComPtr<IPersistHistory> persistHistory;
143 CComPtr<IStream> globalStream;
144 HRESULT hResult;
145
146 TRACE("CTravelEntry::Invoke for IUnknown punk=%p\n", punk);
147
148 hResult = punk->QueryInterface(IID_PPV_ARG(IPersistHistory, &persistHistory));
149 if (FAILED_UNEXPECTEDLY(hResult))
150 return hResult;
151 hResult = CreateStreamOnHGlobal(fPersistState, FALSE, &globalStream);
152 if (FAILED_UNEXPECTEDLY(hResult))
153 return hResult;
154 hResult = persistHistory->LoadHistory(globalStream, NULL);
155 if (FAILED_UNEXPECTEDLY(hResult))
156 return hResult;
157 return S_OK;
158}
#define FALSE
Definition: types.h:117
HRESULT WINAPI CreateStreamOnHGlobal(HGLOBAL hGlobal, BOOL fDeleteOnRelease, LPSTREAM *ppstm)
HRESULT QueryInterface([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
#define IID_PPV_ARG(Itype, ppType)

Referenced by CTravelLog::Travel().

◆ Update()

HRESULT STDMETHODCALLTYPE CTravelEntry::Update ( IUnknown punk,
BOOL  fIsLocalAnchor 
)
override

Implements ITravelEntry.

Definition at line 160 of file travellog.cpp.

161{
162 CComPtr<ITravelLogClient> travelLogClient;
163 CComPtr<IPersistHistory> persistHistory;
164 CComPtr<IStream> globalStream;
165 WINDOWDATA windowData;
166 HRESULT hResult;
167
168 TRACE("CTravelEntry::Update for IUnknown punk=%p, fIsLocalAnchor=%s\n", punk, fIsLocalAnchor ? "TRUE" : "FALSE");
169
170 if (TRACE_ON(browseui))
171 {
172 WCHAR wch[MAX_PATH * 2];
173 GetToolTipText(punk, wch);
174 TRACE("Updating entry with display name: %S\n", wch);
175 }
176
177 ZeroMemory(&windowData, sizeof(WINDOWDATA));
178 ILFree(fPIDL);
179 fPIDL = NULL;
182 hResult = punk->QueryInterface(IID_PPV_ARG(ITravelLogClient, &travelLogClient));
183 if (FAILED_UNEXPECTEDLY(hResult))
184 return hResult;
185 hResult = punk->QueryInterface(IID_PPV_ARG(IPersistHistory, &persistHistory));
186 if (FAILED_UNEXPECTEDLY(hResult))
187 return hResult;
188 hResult = CreateStreamOnHGlobal(NULL, FALSE, &globalStream);
189 if (FAILED_UNEXPECTEDLY(hResult))
190 return hResult;
191 hResult = persistHistory->SaveHistory(globalStream);
192 if (FAILED_UNEXPECTEDLY(hResult))
193 return hResult;
194 hResult = travelLogClient->GetWindowData(globalStream, &windowData);
195 if (FAILED_UNEXPECTEDLY(hResult))
196 return hResult;
197 fPIDL = windowData.pidl;
198 // TODO: Properly free the windowData
199 hResult = GetHGlobalFromStream(globalStream, &fPersistState);
200 if (FAILED_UNEXPECTEDLY(hResult))
201 return hResult;
202
203 if (TRACE_ON(browseui))
204 {
205 WCHAR wch[MAX_PATH * 2];
206 GetToolTipText(punk, wch);
207 TRACE("Updated entry display name is now: %S\n", wch);
208 }
209
210 return S_OK;
211}
HRESULT GetToolTipText(IUnknown *punk, LPWSTR pwzText) const
Definition: travellog.cpp:124
#define TRACE_ON(x)
Definition: compat.h:75
#define MAX_PATH
Definition: compat.h:34
HRESULT WINAPI GetHGlobalFromStream(IStream *pstm, HGLOBAL *phglobal)
PIDLIST_ABSOLUTE pidl
Definition: tlogstg.idl:26
#define ZeroMemory
Definition: winbase.h:1737
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by CTravelLog::UpdateEntry().

Member Data Documentation

◆ fNextEntry

◆ fPersistState

HGLOBAL CTravelEntry::fPersistState
private

Definition at line 55 of file travellog.cpp.

Referenced by CTravelEntry(), Invoke(), Update(), and ~CTravelEntry().

◆ fPIDL

LPITEMIDLIST CTravelEntry::fPIDL
private

Definition at line 54 of file travellog.cpp.

Referenced by CTravelEntry(), GetPidl(), GetToolTipText(), Update(), and ~CTravelEntry().

◆ fPreviousEntry


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