mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 07:46:29 +00:00
[SHELL32]
- Now that we correctly handle the shell link data block list with APIs, no need to hack an extra zeroed DWORD at the end of shortcut files! - Fix the display of the shortcut target location: this typically displays the (last) directory where the target resides. Addendum for r53624, r54957 and CORE-5730 CORE-6104 svn path=/trunk/; revision=73578
This commit is contained in:
parent
ef268d1301
commit
a3aa3fb107
1 changed files with 24 additions and 19 deletions
|
@ -751,11 +751,6 @@ HRESULT STDMETHODCALLTYPE CShellLink::Load(IStream *stm)
|
||||||
else
|
else
|
||||||
m_bRunAs = FALSE;
|
m_bRunAs = FALSE;
|
||||||
|
|
||||||
DWORD dwZero;
|
|
||||||
hr = stm->Read(&dwZero, sizeof(dwZero), &dwBytesRead);
|
|
||||||
if (FAILED(hr) || dwZero || dwBytesRead != sizeof(dwZero))
|
|
||||||
ERR("Last word was not zero\n");
|
|
||||||
|
|
||||||
TRACE("OK\n");
|
TRACE("OK\n");
|
||||||
|
|
||||||
pdump(m_pPidl);
|
pdump(m_pPidl);
|
||||||
|
@ -972,10 +967,6 @@ HRESULT STDMETHODCALLTYPE CShellLink::Save(IStream *stm, BOOL fClearDirty)
|
||||||
if (fClearDirty)
|
if (fClearDirty)
|
||||||
m_bDirty = FALSE;
|
m_bDirty = FALSE;
|
||||||
|
|
||||||
/* The last field is a single zero dword */
|
|
||||||
DWORD dwZero = 0;
|
|
||||||
hr = stm->Write(&dwZero, sizeof(dwZero), &count);
|
|
||||||
|
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2733,7 +2724,10 @@ LPWSTR SH_GetTargetTypeByPath(LPCWSTR lpcwFullPath)
|
||||||
StringCchPrintfExW(wszBuf, _countof(wszBuf), &pwszEnd, &cchRemaining, 0, L"%s ", pwszExt + 1);
|
StringCchPrintfExW(wszBuf, _countof(wszBuf), &pwszEnd, &cchRemaining, 0, L"%s ", pwszExt + 1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
StringCbPrintfW(wszBuf, sizeof(wszBuf), L"%s (%s)", fi.szTypeName, pwszExt); /* Update file type */
|
{
|
||||||
|
/* Update file type */
|
||||||
|
StringCbPrintfW(wszBuf, sizeof(wszBuf), L"%s (%s)", fi.szTypeName, pwszExt);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return wszBuf;
|
return wszBuf;
|
||||||
|
@ -2768,7 +2762,7 @@ INT_PTR CALLBACK CShellLink::SH_ShellLinkDlgProc(HWND hwndDlg, UINT uMsg, WPARAM
|
||||||
/* Get file information */
|
/* Get file information */
|
||||||
// FIXME! FIXME! Shouldn't we use pThis->m_sIcoPath, pThis->m_Header.nIconIndex instead???
|
// FIXME! FIXME! Shouldn't we use pThis->m_sIcoPath, pThis->m_Header.nIconIndex instead???
|
||||||
SHFILEINFOW fi;
|
SHFILEINFOW fi;
|
||||||
if (!SHGetFileInfoW(pThis->m_sLinkPath, 0, &fi, sizeof(fi), SHGFI_TYPENAME|SHGFI_ICON))
|
if (!SHGetFileInfoW(pThis->m_sLinkPath, 0, &fi, sizeof(fi), SHGFI_TYPENAME | SHGFI_ICON))
|
||||||
{
|
{
|
||||||
ERR("SHGetFileInfoW failed for %ls (%lu)\n", pThis->m_sLinkPath, GetLastError());
|
ERR("SHGetFileInfoW failed for %ls (%lu)\n", pThis->m_sLinkPath, GetLastError());
|
||||||
fi.szTypeName[0] = L'\0';
|
fi.szTypeName[0] = L'\0';
|
||||||
|
@ -2780,15 +2774,20 @@ INT_PTR CALLBACK CShellLink::SH_ShellLinkDlgProc(HWND hwndDlg, UINT uMsg, WPARAM
|
||||||
else
|
else
|
||||||
ERR("ExtractIconW failed %ls %u\n", pThis->m_sIcoPath, pThis->m_Header.nIconIndex);
|
ERR("ExtractIconW failed %ls %u\n", pThis->m_sIcoPath, pThis->m_Header.nIconIndex);
|
||||||
|
|
||||||
/* target type */
|
/* Target type */
|
||||||
if (pThis->m_sPath)
|
if (pThis->m_sPath)
|
||||||
SetDlgItemTextW(hwndDlg, 14005, SH_GetTargetTypeByPath(pThis->m_sPath));
|
SetDlgItemTextW(hwndDlg, 14005, SH_GetTargetTypeByPath(pThis->m_sPath));
|
||||||
|
|
||||||
/* target location */
|
/* Target location */
|
||||||
if (pThis->m_sWorkDir)
|
if (pThis->m_sPath)
|
||||||
SetDlgItemTextW(hwndDlg, 14007, PathFindFileName(pThis->m_sWorkDir));
|
{
|
||||||
|
WCHAR target[MAX_PATH];
|
||||||
|
StringCchCopyW(target, _countof(target), pThis->m_sPath);
|
||||||
|
PathRemoveFileSpecW(target);
|
||||||
|
SetDlgItemTextW(hwndDlg, 14007, PathFindFileNameW(target));
|
||||||
|
}
|
||||||
|
|
||||||
/* target path */
|
/* Target path */
|
||||||
if (pThis->m_sPath)
|
if (pThis->m_sPath)
|
||||||
{
|
{
|
||||||
WCHAR newpath[2*MAX_PATH] = L"\0";
|
WCHAR newpath[2*MAX_PATH] = L"\0";
|
||||||
|
@ -2804,16 +2803,18 @@ INT_PTR CALLBACK CShellLink::SH_ShellLinkDlgProc(HWND hwndDlg, UINT uMsg, WPARAM
|
||||||
}
|
}
|
||||||
SetDlgItemTextW(hwndDlg, 14009, newpath);
|
SetDlgItemTextW(hwndDlg, 14009, newpath);
|
||||||
}
|
}
|
||||||
/* working dir */
|
|
||||||
|
/* Working dir */
|
||||||
if (pThis->m_sWorkDir)
|
if (pThis->m_sWorkDir)
|
||||||
SetDlgItemTextW(hwndDlg, 14011, pThis->m_sWorkDir);
|
SetDlgItemTextW(hwndDlg, 14011, pThis->m_sWorkDir);
|
||||||
|
|
||||||
/* description */
|
/* Description */
|
||||||
if (pThis->m_sDescription)
|
if (pThis->m_sDescription)
|
||||||
SetDlgItemTextW(hwndDlg, 14019, pThis->m_sDescription);
|
SetDlgItemTextW(hwndDlg, 14019, pThis->m_sDescription);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
case WM_NOTIFY:
|
case WM_NOTIFY:
|
||||||
{
|
{
|
||||||
LPPSHNOTIFY lppsn = (LPPSHNOTIFY)lParam;
|
LPPSHNOTIFY lppsn = (LPPSHNOTIFY)lParam;
|
||||||
|
@ -2849,7 +2850,7 @@ INT_PTR CALLBACK CShellLink::SH_ShellLinkDlgProc(HWND hwndDlg, UINT uMsg, WPARAM
|
||||||
|
|
||||||
if (!PathFileExistsW(unquoted))
|
if (!PathFileExistsW(unquoted))
|
||||||
{
|
{
|
||||||
//FIXME load localized error msg
|
// FIXME load localized error msg
|
||||||
MessageBoxW(hwndDlg, L"The specified file name in the target box is invalid", L"Error", MB_ICONERROR);
|
MessageBoxW(hwndDlg, L"The specified file name in the target box is invalid", L"Error", MB_ICONERROR);
|
||||||
SetWindowLongPtr(hwndDlg, DWL_MSGRESULT, PSNRET_INVALID_NOCHANGEPAGE);
|
SetWindowLongPtr(hwndDlg, DWL_MSGRESULT, PSNRET_INVALID_NOCHANGEPAGE);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -2870,6 +2871,7 @@ INT_PTR CALLBACK CShellLink::SH_ShellLinkDlgProc(HWND hwndDlg, UINT uMsg, WPARAM
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case WM_COMMAND:
|
case WM_COMMAND:
|
||||||
switch(LOWORD(wParam))
|
switch(LOWORD(wParam))
|
||||||
{
|
{
|
||||||
|
@ -2880,6 +2882,7 @@ INT_PTR CALLBACK CShellLink::SH_ShellLinkDlgProc(HWND hwndDlg, UINT uMsg, WPARAM
|
||||||
/// open target directory
|
/// open target directory
|
||||||
///
|
///
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
case 14021:
|
case 14021:
|
||||||
{
|
{
|
||||||
WCHAR wszPath[MAX_PATH] = L"";
|
WCHAR wszPath[MAX_PATH] = L"";
|
||||||
|
@ -2892,6 +2895,7 @@ INT_PTR CALLBACK CShellLink::SH_ShellLinkDlgProc(HWND hwndDlg, UINT uMsg, WPARAM
|
||||||
pThis->SetIconLocation(wszPath, IconIndex);
|
pThis->SetIconLocation(wszPath, IconIndex);
|
||||||
///
|
///
|
||||||
/// FIXME redraw icon
|
/// FIXME redraw icon
|
||||||
|
///
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -2914,6 +2918,7 @@ INT_PTR CALLBACK CShellLink::SH_ShellLinkDlgProc(HWND hwndDlg, UINT uMsg, WPARAM
|
||||||
if (HIWORD(wParam) == EN_CHANGE)
|
if (HIWORD(wParam) == EN_CHANGE)
|
||||||
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue