Author: dquintana
Date: Tue Jun 20 23:03:24 2017
New Revision: 75157
URL:
http://svn.reactos.org/svn/reactos?rev=75157&view=rev
Log:
[NTOBJSHEX]
Improve the GetDisplayNameOf logic from "badly broken" to "seems to
work". I'm not convinced it's perfect, but it's better than before.
Modified:
trunk/reactos/dll/shellext/ntobjshex/ntobjfolder.cpp
trunk/reactos/dll/shellext/ntobjshex/regfolder.cpp
Modified: trunk/reactos/dll/shellext/ntobjshex/ntobjfolder.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/shellext/ntobjshex/nto…
==============================================================================
--- trunk/reactos/dll/shellext/ntobjshex/ntobjfolder.cpp [iso-8859-1] (original)
+++ trunk/reactos/dll/shellext/ntobjshex/ntobjfolder.cpp [iso-8859-1] Tue Jun 20 23:03:24
2017
@@ -651,51 +651,56 @@
if (FAILED_UNEXPECTEDLY(hr))
return hr;
- if ((GET_SHGDN_RELATION(uFlags) == SHGDN_NORMAL) &&
- (GET_SHGDN_FOR(uFlags) & SHGDN_FORPARSING))
- {
- WCHAR path[MAX_PATH] = { 0 };
-
- hr = GetFullName(m_shellPidl, uFlags, path, _countof(path));
+ if (GET_SHGDN_FOR(uFlags) & SHGDN_FOREDITING)
+ {
+ hr = MakeStrRetFromString(info->entryName, info->entryNameLength, lpName);
if (FAILED_UNEXPECTEDLY(hr))
return hr;
-
- PathAppendW(path, info->entryName);
-
- hr = MakeStrRetFromString(path, lpName);
- if (FAILED_UNEXPECTEDLY(hr))
- return hr;
-
- LPCITEMIDLIST pidlFirst = ILCloneFirst(pidl);
- LPCITEMIDLIST pidlNext = ILGetNext(pidl);
-
- if (pidlNext && pidlNext->mkid.cb > 0)
- {
- CComPtr<IShellFolder> psfChild;
- hr = BindToObject(pidlFirst, NULL, IID_PPV_ARG(IShellFolder,
&psfChild));
+ }
+
+ WCHAR path[MAX_PATH] = { 0 };
+
+ if (GET_SHGDN_FOR(uFlags) & SHGDN_FORPARSING)
+ {
+ if (GET_SHGDN_RELATION(uFlags) != SHGDN_INFOLDER)
+ {
+ hr = GetFullName(m_shellPidl, uFlags, path, _countof(path));
if (FAILED_UNEXPECTEDLY(hr))
return hr;
-
- WCHAR temp[MAX_PATH];
- STRRET childName;
-
- hr = psfChild->GetDisplayNameOf(pidlNext, uFlags | SHGDN_INFOLDER,
&childName);
- if (FAILED_UNEXPECTEDLY(hr))
- return hr;
-
- hr = StrRetToBufW(&childName, pidlNext, temp, _countof(temp));
- if (FAILED_UNEXPECTEDLY(hr))
- return hr;
-
- PathAppendW(path, temp);
- }
-
- ILFree((LPITEMIDLIST) pidlFirst);
- }
- else
- {
- MakeStrRetFromString(info->entryName, info->entryNameLength, lpName);
- }
+ }
+ }
+
+ PathAppendW(path, info->entryName);
+
+ LPCITEMIDLIST pidlNext = ILGetNext(pidl);
+ if (pidlNext && pidlNext->mkid.cb > 0)
+ {
+ LPITEMIDLIST pidlFirst = ILCloneFirst(pidl);
+
+ CComPtr<IShellFolder> psfChild;
+ hr = BindToObject(pidlFirst, NULL, IID_PPV_ARG(IShellFolder, &psfChild));
+ if (FAILED_UNEXPECTEDLY(hr))
+ return hr;
+
+ WCHAR temp[MAX_PATH];
+ STRRET childName;
+
+ hr = psfChild->GetDisplayNameOf(pidlNext, uFlags | SHGDN_INFOLDER,
&childName);
+ if (FAILED_UNEXPECTEDLY(hr))
+ return hr;
+
+ hr = StrRetToBufW(&childName, pidlNext, temp, _countof(temp));
+ if (FAILED_UNEXPECTEDLY(hr))
+ return hr;
+
+ PathAppendW(path, temp);
+
+ ILFree(pidlFirst);
+ }
+
+ hr = MakeStrRetFromString(path, lpName);
+ if (FAILED_UNEXPECTEDLY(hr))
+ return hr;
return S_OK;
}
Modified: trunk/reactos/dll/shellext/ntobjshex/regfolder.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/shellext/ntobjshex/reg…
==============================================================================
--- trunk/reactos/dll/shellext/ntobjshex/regfolder.cpp [iso-8859-1] (original)
+++ trunk/reactos/dll/shellext/ntobjshex/regfolder.cpp [iso-8859-1] Tue Jun 20 23:03:24
2017
@@ -706,51 +706,56 @@
if (FAILED_UNEXPECTEDLY(hr))
return hr;
- if ((GET_SHGDN_RELATION(uFlags) == SHGDN_NORMAL) &&
- (GET_SHGDN_FOR(uFlags) & SHGDN_FORPARSING))
- {
- WCHAR path[MAX_PATH] = { 0 };
-
- hr = GetFullName(m_shellPidl, uFlags, path, _countof(path));
+ if (GET_SHGDN_FOR(uFlags) & SHGDN_FOREDITING)
+ {
+ hr = MakeStrRetFromString(info->entryName, info->entryNameLength, lpName);
if (FAILED_UNEXPECTEDLY(hr))
return hr;
-
- PathAppendW(path, info->entryName);
-
- hr = MakeStrRetFromString(path, lpName);
- if (FAILED_UNEXPECTEDLY(hr))
- return hr;
-
- LPCITEMIDLIST pidlFirst = ILCloneFirst(pidl);
- LPCITEMIDLIST pidlNext = ILGetNext(pidl);
-
- if (pidlNext && pidlNext->mkid.cb > 0)
- {
- CComPtr<IShellFolder> psfChild;
- hr = BindToObject(pidlFirst, NULL, IID_PPV_ARG(IShellFolder,
&psfChild));
+ }
+
+ WCHAR path[MAX_PATH] = { 0 };
+
+ if (GET_SHGDN_FOR(uFlags) & SHGDN_FORPARSING)
+ {
+ if (GET_SHGDN_RELATION(uFlags) != SHGDN_INFOLDER)
+ {
+ hr = GetFullName(m_shellPidl, uFlags, path, _countof(path));
if (FAILED_UNEXPECTEDLY(hr))
return hr;
-
- WCHAR temp[MAX_PATH];
- STRRET childName;
-
- hr = psfChild->GetDisplayNameOf(pidlNext, uFlags | SHGDN_INFOLDER,
&childName);
- if (FAILED_UNEXPECTEDLY(hr))
- return hr;
-
- hr = StrRetToBufW(&childName, pidlNext, temp, _countof(temp));
- if (FAILED_UNEXPECTEDLY(hr))
- return hr;
-
- PathAppendW(path, temp);
- }
-
- ILFree((LPITEMIDLIST) pidlFirst);
- }
- else
- {
- MakeStrRetFromString(info->entryName, info->entryNameLength, lpName);
- }
+ }
+ }
+
+ PathAppendW(path, info->entryName);
+
+ LPCITEMIDLIST pidlNext = ILGetNext(pidl);
+ if (pidlNext && pidlNext->mkid.cb > 0)
+ {
+ LPITEMIDLIST pidlFirst = ILCloneFirst(pidl);
+
+ CComPtr<IShellFolder> psfChild;
+ hr = BindToObject(pidlFirst, NULL, IID_PPV_ARG(IShellFolder, &psfChild));
+ if (FAILED_UNEXPECTEDLY(hr))
+ return hr;
+
+ WCHAR temp[MAX_PATH];
+ STRRET childName;
+
+ hr = psfChild->GetDisplayNameOf(pidlNext, uFlags | SHGDN_INFOLDER,
&childName);
+ if (FAILED_UNEXPECTEDLY(hr))
+ return hr;
+
+ hr = StrRetToBufW(&childName, pidlNext, temp, _countof(temp));
+ if (FAILED_UNEXPECTEDLY(hr))
+ return hr;
+
+ PathAppendW(path, temp);
+
+ ILFree(pidlFirst);
+ }
+
+ hr = MakeStrRetFromString(path, lpName);
+ if (FAILED_UNEXPECTEDLY(hr))
+ return hr;
return S_OK;
}