mirror of
https://github.com/reactos/reactos.git
synced 2025-04-29 18:48:53 +00:00
[SHELL32] Create link must ask for a parsing name for file targets (#7267)
This commit is contained in:
parent
5506a8e170
commit
cca9acfa1d
1 changed files with 8 additions and 2 deletions
|
@ -588,12 +588,19 @@ HRESULT CFSDropTarget::_DoDrop(IDataObject *pDataObject,
|
||||||
/* We need to create a link for each pidl in the copied items, so step through the pidls from the clipboard */
|
/* We need to create a link for each pidl in the copied items, so step through the pidls from the clipboard */
|
||||||
for (UINT i = 0; i < lpcida->cidl; i++)
|
for (UINT i = 0; i < lpcida->cidl; i++)
|
||||||
{
|
{
|
||||||
|
SFGAOF att = SHGetAttributes(psfFrom, apidl[i], SFGAO_FOLDER | SFGAO_STREAM | SFGAO_FILESYSTEM);
|
||||||
CComHeapPtr<ITEMIDLIST_ABSOLUTE> pidlFull;
|
CComHeapPtr<ITEMIDLIST_ABSOLUTE> pidlFull;
|
||||||
hr = SHILCombine(pidl, apidl[i], &pidlFull);
|
hr = SHILCombine(pidl, apidl[i], &pidlFull);
|
||||||
|
|
||||||
WCHAR targetName[MAX_PATH];
|
WCHAR targetName[MAX_PATH];
|
||||||
if (SUCCEEDED(hr))
|
if (SUCCEEDED(hr))
|
||||||
hr = Shell_DisplayNameOf(psfFrom, apidl[i], SHGDN_FOREDITING | SHGDN_INFOLDER, targetName, _countof(targetName));
|
{
|
||||||
|
// If the target is a file, we use SHGDN_FORPARSING because "NeverShowExt" will hide the ".lnk" extension.
|
||||||
|
// If the target is a virtual item, we ask for the friendly name because SHGDN_FORPARSING will return a GUID.
|
||||||
|
BOOL UseParsing = (att & (SFGAO_FILESYSTEM | SFGAO_FOLDER)) == SFGAO_FILESYSTEM;
|
||||||
|
DWORD ShgdnFor = UseParsing ? SHGDN_FORPARSING : SHGDN_FOREDITING;
|
||||||
|
hr = Shell_DisplayNameOf(psfFrom, apidl[i], ShgdnFor | SHGDN_INFOLDER, targetName, _countof(targetName));
|
||||||
|
}
|
||||||
if (FAILED_UNEXPECTEDLY(hr))
|
if (FAILED_UNEXPECTEDLY(hr))
|
||||||
{
|
{
|
||||||
SHELL_ErrorBox(m_hwndSite, hr);
|
SHELL_ErrorBox(m_hwndSite, hr);
|
||||||
|
@ -605,7 +612,6 @@ HRESULT CFSDropTarget::_DoDrop(IDataObject *pDataObject,
|
||||||
PathCombineW(wszCombined, m_sPathTarget, targetName);
|
PathCombineW(wszCombined, m_sPathTarget, targetName);
|
||||||
|
|
||||||
// Check to see if the source is a link
|
// Check to see if the source is a link
|
||||||
SFGAOF att = SHGetAttributes(psfFrom, apidl[i], SFGAO_FOLDER | SFGAO_STREAM | SFGAO_FILESYSTEM);
|
|
||||||
BOOL fSourceIsLink = FALSE;
|
BOOL fSourceIsLink = FALSE;
|
||||||
if (!wcsicmp(PathFindExtensionW(targetName), L".lnk") && (att & (SFGAO_FOLDER | SFGAO_STREAM)) != SFGAO_FOLDER)
|
if (!wcsicmp(PathFindExtensionW(targetName), L".lnk") && (att & (SFGAO_FOLDER | SFGAO_STREAM)) != SFGAO_FOLDER)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue