Author: dquintana
Date: Tue May 27 17:55:41 2014
New Revision: 63479
URL:
http://svn.reactos.org/svn/reactos?rev=63479&view=rev
Log:
[BROWSEUI]
* Remove a call that shouldn't even be working in Windows, and was completely
unnecessary. Fixes explorer-new navigation history in ReactOS.
* Added some debug traces.
CORE-8173
Modified:
branches/shell-experiments/dll/win32/browseui/travellog.cpp
Modified: branches/shell-experiments/dll/win32/browseui/travellog.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/bro…
==============================================================================
--- branches/shell-experiments/dll/win32/browseui/travellog.cpp [iso-8859-1] (original)
+++ branches/shell-experiments/dll/win32/browseui/travellog.cpp [iso-8859-1] Tue May 27
17:55:41 2014
@@ -126,8 +126,9 @@
HRESULT hResult;
hResult = ILGetDisplayNameEx(NULL, fPIDL, pwzText, ILGDN_NORMAL) ? S_OK : S_FALSE;
- if (FAILED(hResult))
- return hResult;
+ if (FAILED_UNEXPECTEDLY(hResult))
+ return hResult;
+
return S_OK;
}
@@ -142,14 +143,16 @@
CComPtr<IStream> globalStream;
HRESULT hResult;
+ TRACE("CTravelEntry::Invoke for IUnknown punk=%p\n", punk);
+
hResult = punk->QueryInterface(IID_PPV_ARG(IPersistHistory,
&persistHistory));
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
hResult = CreateStreamOnHGlobal(fPersistState, FALSE, &globalStream);
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
hResult = persistHistory->LoadHistory(globalStream, NULL);
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
return S_OK;
}
@@ -160,34 +163,43 @@
CComPtr<IPersistHistory> persistHistory;
CComPtr<IStream> globalStream;
WINDOWDATA windowData;
- HGLOBAL globalStorage;
- HRESULT hResult;
+ HRESULT hResult;
+
+ TRACE("CTravelEntry::Update for IUnknown punk=%p, fIsLocalAnchor=%s\n",
punk, fIsLocalAnchor ? "TRUE" : "FALSE");
+
+
+ WCHAR wch[MAX_PATH * 2];
+ GetToolTipText(punk, wch);
+ TRACE("Updating entry with display name: %S\n", wch);
ILFree(fPIDL);
fPIDL = NULL;
GlobalFree(fPersistState);
fPersistState = NULL;
hResult = punk->QueryInterface(IID_PPV_ARG(ITravelLogClient,
&travelLogClient));
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
hResult = punk->QueryInterface(IID_PPV_ARG(IPersistHistory,
&persistHistory));
- if (FAILED(hResult))
- return hResult;
- globalStorage = GlobalAlloc(GMEM_FIXED, 0);
- hResult = CreateStreamOnHGlobal(globalStorage, FALSE, &globalStream);
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
+ return hResult;
+ hResult = CreateStreamOnHGlobal(NULL, FALSE, &globalStream);
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
hResult = persistHistory->SaveHistory(globalStream);
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
hResult = travelLogClient->GetWindowData(globalStream, &windowData);
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
fPIDL = windowData.pidl;
// TODO: Properly free the windowData
hResult = GetHGlobalFromStream(globalStream, &fPersistState);
- if (FAILED(hResult))
- return hResult;
+ if (FAILED_UNEXPECTEDLY(hResult))
+ return hResult;
+
+ GetToolTipText(punk, wch);
+ TRACE("Updated entry display name is now: %S\n", wch);
+
return S_OK;
}
@@ -198,6 +210,9 @@
*ppidl = ILClone(fPIDL);
if (*ppidl == NULL)
return E_OUTOFMEMORY;
+
+ TRACE("CTravelEntry::GetPidl returning ppidl=%p\n", *ppidl);
+
return S_OK;
}
@@ -209,6 +224,7 @@
fMaximumSize = 0;
fCurrentSize = 0;
fEntryCount = 0;
+ TRACE("CTravelLog created\n");
}
CTravelLog::~CTravelLog()
@@ -223,19 +239,25 @@
anEntry->Release();
anEntry = next;
}
+ TRACE("CTravelLog destroyed\n");
}
HRESULT CTravelLog::Initialize()
{
+ FIXME("CTravelLog::Initialize using hardcoded fMaximumSize.\n");
fMaximumSize = 1024 * 1024; // TODO: change to read this from registry
// Software\Microsoft\Windows\CurrentVersion\Explorer\TravelLog
// MaxSize
return S_OK;
}
-HRESULT CTravelLog::FindRelativeEntry(int offset, CTravelEntry **foundEntry)
+HRESULT CTravelLog::FindRelativeEntry(int _offset, CTravelEntry **foundEntry)
{
CTravelEntry *curEntry;
+ int offset = _offset;
+
+ if (foundEntry == NULL)
+ return E_INVALIDARG;
*foundEntry = NULL;
curEntry = fCurrentEntry;
@@ -257,7 +279,11 @@
}
if (curEntry == NULL)
return E_INVALIDARG;
+
*foundEntry = curEntry;
+
+ TRACE("CTravelLog::FindRelativeEntry for offset %d, returning %p\n",
offset, *foundEntry);
+
return S_OK;
}
@@ -265,6 +291,10 @@
{
CTravelEntry *saveNext;
long itemSize;
+
+ TRACE("CTravelLog::DeleteChain deleting chain starting at %p\n",
startHere);
+
+ long startEntryCount = fEntryCount;
if (startHere->fPreviousEntry != NULL)
{
@@ -285,17 +315,21 @@
startHere = saveNext;
fEntryCount--;
}
+
+ TRACE("CTravelLog::DeleteChain chain of %d items deleted\n",
startEntryCount - fEntryCount);
}
void CTravelLog::AppendEntry(CTravelEntry *afterEntry, CTravelEntry *newEntry)
{
if (afterEntry == NULL)
{
+ TRACE("CTravelLog::AppendEntry appending %p after NULL. Resetting head and
tail\n", newEntry);
fListHead = newEntry;
fListTail = newEntry;
}
else
{
+ TRACE("CTravelLog::AppendEntry appending %p after %p\n", newEntry,
afterEntry);
newEntry->fNextEntry = afterEntry->fNextEntry;
afterEntry->fNextEntry = newEntry;
newEntry->fPreviousEntry = afterEntry;
@@ -311,6 +345,8 @@
{
CComObject<CTravelEntry> *newEntry;
long itemSize;
+
+ TRACE("CTravelLog::AddEntry for IUnknown punk=%p, fIsLocalAnchor=%s\n",
punk, fIsLocalAnchor ? "TRUE" : "FALSE");
if (punk == NULL)
return E_INVALIDARG;
@@ -346,12 +382,14 @@
CTravelEntry *destinationEntry;
HRESULT hResult;
+ TRACE("CTravelLog::Travel for IUnknown punk=%p at offset=%d\n", punk,
iOffset);
+
hResult = FindRelativeEntry(iOffset, &destinationEntry);
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
fCurrentEntry = destinationEntry;
hResult = destinationEntry->Invoke(punk);
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
return S_OK;
}
@@ -360,11 +398,17 @@
{
CTravelEntry *destinationEntry;
HRESULT hResult;
-
+
hResult = FindRelativeEntry(iOffset, &destinationEntry);
- if (FAILED(hResult))
- return hResult;
- return destinationEntry->QueryInterface(IID_PPV_ARG(ITravelEntry, ppte));
+ if (FAILED_UNEXPECTEDLY(hResult))
+ return hResult;
+ hResult = destinationEntry->QueryInterface(IID_PPV_ARG(ITravelEntry, ppte));
+ if (FAILED_UNEXPECTEDLY(hResult))
+ return hResult;
+
+ TRACE("CTravelLog::GetTravelEntry for IUnknown punk=%p at offset=%d returning
%p\n", punk, iOffset, *ppte);
+
+ return hResult;
}
HRESULT STDMETHODCALLTYPE CTravelLog::FindTravelEntry(IUnknown *punk, LPCITEMIDLIST pidl,
ITravelEntry **ppte)
@@ -373,6 +417,9 @@
return E_POINTER;
if (punk == NULL || pidl == NULL)
return E_INVALIDARG;
+
+ UNIMPLEMENTED;
+
return E_NOTIMPL;
}
@@ -388,10 +435,10 @@
if (punk == NULL || cchText == 0)
return E_INVALIDARG;
hResult = FindRelativeEntry(iOffset, &destinationEntry);
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
hResult = destinationEntry->GetToolTipText(punk, tempString);
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
if (iOffset < 0)
{
@@ -402,6 +449,9 @@
wcscpy(templateString, L"Forward to %s");
}
_snwprintf(pwzText, cchText, templateString, tempString);
+
+ TRACE("CTravelLog::GetToolTipText for IUnknown punk=%p at offset=%d returning
L\"%S\"\n", punk, iOffset, pwzText);
+
return S_OK;
}
@@ -432,6 +482,8 @@
MENUITEMINFO menuItemInfo;
wchar_t itemTextBuffer[MAX_PATH * 2];
HRESULT hResult;
+
+ TRACE("CTravelLog::InsertMenuEntries for IUnknown punk=%p, nPos=%d, idFirst=%d,
idLast=%d\n", punk);
// TLMENUF_BACK - include back entries
// TLMENUF_INCLUDECURRENT - include current entry, if TLMENUF_CHECKCURRENT then check
the entry
@@ -467,6 +519,7 @@
if (SUCCEEDED(hResult))
{
FixAmpersands(itemTextBuffer);
+ TRACE("CTravelLog::InsertMenuEntries adding entry
L\"%S\"/L\"%S\" with id %d\n", itemTextBuffer,
menuItemInfo.dwTypeData, menuItemInfo.wID);
if (InsertMenuItem(hmenu, nPos, TRUE, &menuItemInfo))
{
nPos++;
@@ -487,6 +540,7 @@
if (SUCCEEDED(hResult))
{
FixAmpersands(itemTextBuffer);
+ TRACE("CTravelLog::InsertMenuEntries adding entry
L\"%S\"/L\"%S\" with id %d\n", itemTextBuffer,
menuItemInfo.dwTypeData, menuItemInfo.wID);
if (InsertMenuItem(hmenu, nPos, TRUE, &menuItemInfo))
{
nPos++;
@@ -507,6 +561,7 @@
FixAmpersands(itemTextBuffer);
if ((dwFlags & TLMENUF_CHECKCURRENT) != 0)
menuItemInfo.fState |= MFS_CHECKED;
+ TRACE("CTravelLog::InsertMenuEntries adding entry
L\"%S\"/L\"%S\" with id %d\n", itemTextBuffer,
menuItemInfo.dwTypeData, menuItemInfo.wID);
if (InsertMenuItem(hmenu, nPos, TRUE, &menuItemInfo))
{
nPos++;
@@ -527,6 +582,7 @@
if (SUCCEEDED(hResult))
{
FixAmpersands(itemTextBuffer);
+ TRACE("CTravelLog::InsertMenuEntries adding entry
L\"%S\"/L\"%S\" with id %d\n", itemTextBuffer,
menuItemInfo.dwTypeData, menuItemInfo.wID);
if (InsertMenuItem(hmenu, nPos, TRUE, &menuItemInfo))
{
nPos++;
@@ -545,6 +601,7 @@
return E_POINTER;
*pptl = NULL;
// duplicate the log
+ UNIMPLEMENTED;
return E_NOTIMPL;
}
@@ -558,6 +615,7 @@
HRESULT STDMETHODCALLTYPE CTravelLog::Revert()
{
// remove the current entry?
+ UNIMPLEMENTED;
return E_NOTIMPL;
}
@@ -573,13 +631,13 @@
if (theTravelLog == NULL)
return E_OUTOFMEMORY;
hResult = theTravelLog->QueryInterface(riid, reinterpret_cast<void
**>(ppv));
- if (FAILED(hResult))
+ if (FAILED_UNEXPECTEDLY(hResult))
{
delete theTravelLog;
return hResult;
}
hResult = theTravelLog->Initialize();
- if (FAILED(hResult))
- return hResult;
- return S_OK;
-}
+ if (FAILED_UNEXPECTEDLY(hResult))
+ return hResult;
+ return S_OK;
+}