Author: gadamopoulos
Date: Sat Nov 5 00:09:51 2016
New Revision: 73130
URL:
http://svn.reactos.org/svn/reactos?rev=73130&view=rev
Log:
[BROWSEUI]
- CAddressEditBox: Implement handling relative paths in the addressbar of explore in
addition to absolute paths.
Modified:
trunk/reactos/dll/win32/browseui/addresseditbox.cpp
Modified: trunk/reactos/dll/win32/browseui/addresseditbox.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/browseui/address…
==============================================================================
--- trunk/reactos/dll/win32/browseui/addresseditbox.cpp [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/browseui/addresseditbox.cpp [iso-8859-1] Sat Nov 5 00:09:51
2016
@@ -90,16 +90,20 @@
ULONG attributes;
HRESULT hr;
HWND topLevelWindow;
-
- CComPtr<IShellBrowser> pisb;
- hr = IUnknown_QueryService(fSite, SID_SShellBrowser, IID_PPV_ARG(IShellBrowser,
&pisb));
+ PIDLIST_ABSOLUTE pidlCurrent= NULL;
+ PIDLIST_RELATIVE pidlRelative = NULL;
+ CComPtr<IShellFolder> psfCurrent;
+
+ CComPtr<IBrowserService> pbs;
+ hr = IUnknown_QueryService(fSite, SID_SShellBrowser, IID_PPV_ARG(IBrowserService,
&pbs));
if (FAILED_UNEXPECTEDLY(hr))
return hr;
- hr = IUnknown_GetWindow(pisb, &topLevelWindow);
+ hr = IUnknown_GetWindow(pbs, &topLevelWindow);
if (FAILED_UNEXPECTEDLY(hr))
return hr;
+ /* Get the path to browse and expand it if needed */
LPWSTR input;
int inputLength = fCombobox.GetWindowTextLength() + 2;
@@ -124,13 +128,34 @@
}
}
+ /* Try to parse a relative path and if it fails, try to browse an absolute path */
CComPtr<IShellFolder> psfDesktop;
hr = SHGetDesktopFolder(&psfDesktop);
+ if (FAILED_UNEXPECTEDLY(hr))
+ goto cleanup;
+
+ hr = pbs->GetPidl(&pidlCurrent);
+ if (FAILED_UNEXPECTEDLY(hr))
+ goto cleanup;
+
+ hr = psfDesktop->BindToObject(pidlCurrent, NULL, IID_PPV_ARG(IShellFolder,
&psfCurrent));
+ if (FAILED_UNEXPECTEDLY(hr))
+ goto cleanup;
+
+ hr = psfCurrent->ParseDisplayName(topLevelWindow, NULL, address, &eaten,
&pidlRelative, &attributes);
if (SUCCEEDED(hr))
{
- hr = psfDesktop->ParseDisplayName(topLevelWindow, NULL, address, &eaten,
&pidlLastParsed, &attributes);
- }
-
+ pidlLastParsed = ILCombine(pidlCurrent, pidlRelative);
+ ILFree(pidlRelative);
+ goto cleanup;
+ }
+
+ /* We couldn't parse a relative path, attempt to parse an absolute path */
+ hr = psfDesktop->ParseDisplayName(topLevelWindow, NULL, address, &eaten,
&pidlLastParsed, &attributes);
+
+cleanup:
+ if (pidlCurrent)
+ ILFree(pidlCurrent);
if (address != input)
delete [] address;
delete [] input;