mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 18:33:10 +00:00
- implement "create link" verb for control panel items
svn path=/trunk/; revision=35115
This commit is contained in:
parent
7da2062490
commit
0fd48bec89
1 changed files with 66 additions and 10 deletions
|
@ -1260,8 +1260,18 @@ static HRESULT WINAPI ICPanel_IContextMenu2_InvokeCommand(
|
||||||
LPCMINVOKECOMMANDINFO lpcmi)
|
LPCMINVOKECOMMANDINFO lpcmi)
|
||||||
{
|
{
|
||||||
SHELLEXECUTEINFOW sei;
|
SHELLEXECUTEINFOW sei;
|
||||||
|
WCHAR szPath[MAX_PATH];
|
||||||
|
char szTarget[MAX_PATH];
|
||||||
|
STRRET strret;
|
||||||
|
WCHAR* pszPath;
|
||||||
|
INT Length, cLength;
|
||||||
|
PIDLCPanelStruct *pcpanel;
|
||||||
|
IPersistFile * ppf;
|
||||||
|
IShellLinkA * isl;
|
||||||
ICPanelImpl *This = impl_from_IContextMenu(iface);
|
ICPanelImpl *This = impl_from_IContextMenu(iface);
|
||||||
|
|
||||||
|
TRACE("(%p)->(invcom=%p verb=%p wnd=%p)\n",This,lpcmi,lpcmi->lpVerb, lpcmi->hwnd);
|
||||||
|
|
||||||
if (lpcmi->lpVerb == MAKEINTRESOURCE(1))
|
if (lpcmi->lpVerb == MAKEINTRESOURCE(1))
|
||||||
{
|
{
|
||||||
ZeroMemory(&sei, sizeof(sei));
|
ZeroMemory(&sei, sizeof(sei));
|
||||||
|
@ -1277,17 +1287,63 @@ static HRESULT WINAPI ICPanel_IContextMenu2_InvokeCommand(
|
||||||
}
|
}
|
||||||
else if (lpcmi->lpVerb == MAKEINTRESOURCE(2))
|
else if (lpcmi->lpVerb == MAKEINTRESOURCE(2))
|
||||||
{
|
{
|
||||||
/* FIXME
|
if (!SHGetSpecialFolderPathW(NULL, szPath, CSIDL_DESKTOPDIRECTORY, FALSE))
|
||||||
* retrieve CSIDL_DESKTOPDIRECTORY path,
|
return E_FAIL;
|
||||||
* retrieve name from pidl and create a link there
|
|
||||||
*/
|
pszPath = PathAddBackslashW(szPath);
|
||||||
FIXME("implement shortcuthandling\n");
|
if (!pszPath)
|
||||||
return NOERROR;
|
return E_FAIL;
|
||||||
|
|
||||||
|
if (IShellFolder_GetDisplayNameOf((IShellFolder*)This, This->apidl[0], SHGDN_FORPARSING, &strret) != S_OK)
|
||||||
|
return E_FAIL;
|
||||||
|
|
||||||
|
Length = MAX_PATH - (pszPath - szPath);
|
||||||
|
cLength = strlen(strret.u.cStr);
|
||||||
|
if (Length < cLength + 5)
|
||||||
|
{
|
||||||
|
FIXME("\n");
|
||||||
|
return E_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (MultiByteToWideChar(CP_ACP, 0, strret.u.cStr, cLength +1, pszPath, Length))
|
||||||
|
{
|
||||||
|
pszPath += cLength;
|
||||||
|
Length -= cLength;
|
||||||
|
}
|
||||||
|
|
||||||
TRACE("(%p)->(invcom=%p verb=%p wnd=%p)\n",This,lpcmi,lpcmi->lpVerb, lpcmi->hwnd);
|
if (Length > 10)
|
||||||
|
{
|
||||||
|
wcscpy(pszPath, L" - ");
|
||||||
|
cLength = LoadStringW(shell32_hInstance, IDS_LNK_FILE, &pszPath[3], Length -4) + 3;
|
||||||
|
if (cLength + 5 > Length)
|
||||||
|
cLength = Length - 5;
|
||||||
|
Length -= cLength;
|
||||||
|
pszPath += cLength;
|
||||||
|
}
|
||||||
|
wcscpy(pszPath, L".lnk");
|
||||||
|
|
||||||
|
pcpanel = _ILGetCPanelPointer(ILFindLastID(This->apidl[0]));
|
||||||
|
if (pcpanel)
|
||||||
|
{
|
||||||
|
strncpy(szTarget, pcpanel->szName, MAX_PATH);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FIXME("\n");
|
||||||
|
return E_FAIL;
|
||||||
|
}
|
||||||
|
if (SUCCEEDED(IShellLink_Constructor(NULL, &IID_IShellLinkA, (LPVOID*)&isl)))
|
||||||
|
{
|
||||||
|
IShellLinkA_SetPath(isl, szTarget);
|
||||||
|
if (SUCCEEDED(IShellLinkA_QueryInterface(isl, &IID_IPersistFile, (LPVOID*)&ppf)))
|
||||||
|
{
|
||||||
|
IPersistFile_Save(ppf, szPath, TRUE);
|
||||||
|
IPersistFile_Release(ppf);
|
||||||
|
}
|
||||||
|
IShellLinkA_Release(isl);
|
||||||
|
}
|
||||||
|
return NOERROR;
|
||||||
|
}
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue