[PATCH] shell32: Implement FCIDM_SHVIEW_CREATELINK

Nikolay Sivov bunglehead at gmail.com
Fri Jun 2 10:49:13 CDT 2017


On 02.06.2017 17:24, Aric Stewart wrote:
> 
> Presently the wine file explorer has a create shortcut entry that
> does nothing. This implements the FCIDM_SHVIEW_CREATELINK command.
> 
> Signed-off-by: Aric Stewart <aric at codeweavers.com>
> ---
>  dlls/shell32/shlview_cmenu.c | 50 ++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 50 insertions(+)
> 


> +    if (!SUCCEEDED(CoCreateInstance( &CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER,
> +                                     &IID_IShellLinkW, (LPVOID*)&shelllink)))
> +    {
> +        ERR("couldn't create ShellLink object\n");
> +        return;
> +    }

This should be FAILED(). You can use IShellLink_Constructor() instead of
going through generic object creation.

 > +    SHGetSpecialFolderPathW(NULL, root, CSIDL_STARTMENU, TRUE);
> +    lnkfile=HeapAlloc(GetProcessHeap(), 0, (lstrlenW(root)+1+lstrlenW(wszFilename)+5) * sizeof(*lnkfile));
> +    lstrcpyW(lnkfile, root);
> +    lstrcatW(lnkfile, backslashW);
> +    lstrcatW(lnkfile, wszFilename);
> +    lstrcatW(lnkfile, lnkW);

Why is it created in Start Menu dir? I think usual behavior is to create
it in target directory.

> +    if (!SUCCEEDED(IShellLinkW_QueryInterface(shelllink, &IID_IPersistFile, (LPVOID*)&persistfile)))
> +    {
> +        ERR("couldn't get IPersistFile interface\n");
> +        IShellLinkW_Release(shelllink);
> +        HeapFree(GetProcessHeap(), 0, lnkfile);
> +        return;
> +    }

FAILED() again, but really it can't fail. Also please LPVOID -> void*.



More information about the wine-devel mailing list