mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-06 12:27:09 +00:00
shell32: Add support for Program Manager icons with arguments.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52506
This commit is contained in:
parent
e8bba58431
commit
aa21d1acb2
|
@ -261,7 +261,7 @@ static DWORD PROGMAN_OnExecute(WCHAR *command, int argc, WCHAR **argv)
|
||||||
}
|
}
|
||||||
else if (!wcsicmp(command, L"AddItem"))
|
else if (!wcsicmp(command, L"AddItem"))
|
||||||
{
|
{
|
||||||
WCHAR *path, *name;
|
WCHAR *target, *space = NULL, *path, *name;
|
||||||
IShellLinkW *link;
|
IShellLinkW *link;
|
||||||
IPersistFile *file;
|
IPersistFile *file;
|
||||||
HRESULT hres;
|
HRESULT hres;
|
||||||
|
@ -272,15 +272,24 @@ static DWORD PROGMAN_OnExecute(WCHAR *command, int argc, WCHAR **argv)
|
||||||
&IID_IShellLinkW, (void **)&link);
|
&IID_IShellLinkW, (void **)&link);
|
||||||
if (FAILED(hres)) return DDE_FNOTPROCESSED;
|
if (FAILED(hres)) return DDE_FNOTPROCESSED;
|
||||||
|
|
||||||
len = SearchPathW(NULL, argv[0], L".exe", 0, NULL, NULL);
|
target = wcsdup(argv[0]);
|
||||||
if (len == 0)
|
while (!(len = SearchPathW(NULL, target, L".exe", 0, NULL, NULL)))
|
||||||
{
|
{
|
||||||
IShellLinkW_Release(link);
|
/* progressively remove words from the end of the command line until we get a valid file name */
|
||||||
return DDE_FNOTPROCESSED;
|
space = wcsrchr(target, ' ');
|
||||||
|
if (!space)
|
||||||
|
{
|
||||||
|
IShellLinkW_Release(link);
|
||||||
|
free(target);
|
||||||
|
return DDE_FNOTPROCESSED;
|
||||||
|
}
|
||||||
|
*space = 0;
|
||||||
}
|
}
|
||||||
path = malloc(len * sizeof(WCHAR));
|
path = malloc(len * sizeof(WCHAR));
|
||||||
SearchPathW(NULL, argv[0], L".exe", len, path, NULL);
|
SearchPathW(NULL, target, L".exe", len, path, NULL);
|
||||||
IShellLinkW_SetPath(link, path);
|
IShellLinkW_SetPath(link, path);
|
||||||
|
if (space) IShellLinkW_SetArguments(link, argv[0] + (space - target) + 1);
|
||||||
|
free(target);
|
||||||
free(path);
|
free(path);
|
||||||
|
|
||||||
if (argc >= 2) IShellLinkW_SetDescription(link, argv[1]);
|
if (argc >= 2) IShellLinkW_SetDescription(link, argv[1]);
|
||||||
|
|
|
@ -231,10 +231,25 @@ static void test_parser(DWORD instance, HCONV hConv)
|
||||||
ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
|
ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
|
||||||
ok(check_exists("test/foobar.lnk"), "link not created\n");
|
ok(check_exists("test/foobar.lnk"), "link not created\n");
|
||||||
|
|
||||||
error = dde_execute(instance, hConv, "[AddItem(notepad,foo bar)]");
|
error = dde_execute(instance, hConv, "[AddItem(notepad\tfoo.txt,foo)]");
|
||||||
|
ok(error == DMLERR_NOTPROCESSED, "expected DMLERR_NOTPROCESSED, got %u\n", error);
|
||||||
|
|
||||||
|
error = dde_execute(instance, hConv, "[AddItem(notepad foo.txt,foo)]");
|
||||||
|
ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
|
||||||
|
ok(check_exists("test/foo.lnk"), "link not created\n");
|
||||||
|
|
||||||
|
error = dde_execute(instance, hConv, "[AddItem(notepad foo.txt bar.txt,foo bar)]");
|
||||||
ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
|
ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
|
||||||
ok(check_exists("test/foo bar.lnk"), "link not created\n");
|
ok(check_exists("test/foo bar.lnk"), "link not created\n");
|
||||||
|
|
||||||
|
error = dde_execute(instance, hConv, "[AddItem(C:\\Program Files\\Internet Explorer\\iexplore.exe,IE)]");
|
||||||
|
ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
|
||||||
|
ok(check_exists("test/IE.lnk"), "link not created\n");
|
||||||
|
|
||||||
|
error = dde_execute(instance, hConv, "[AddItem(C:\\Program Files\\Internet Explorer\\iexplore.exe https://www.winehq.org/,WineHQ)]");
|
||||||
|
ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %u\n", error);
|
||||||
|
ok(check_exists("test/WineHQ.lnk"), "link not created\n");
|
||||||
|
|
||||||
error = dde_execute(instance, hConv, "[AddItem(notepad,a[b,c]d)]");
|
error = dde_execute(instance, hConv, "[AddItem(notepad,a[b,c]d)]");
|
||||||
ok(error == DMLERR_NOTPROCESSED, "expected DMLERR_NOTPROCESSED, got %u\n", error);
|
ok(error == DMLERR_NOTPROCESSED, "expected DMLERR_NOTPROCESSED, got %u\n", error);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue