Commit efb92561 authored by Misha Koshelev's avatar Misha Koshelev Committed by Alexandre Julliard

shell32: Handle default DDE application names.

parent c8829f56
......@@ -780,8 +780,51 @@ static unsigned dde_connect(WCHAR* key, const WCHAR* start, WCHAR* ddeexec,
applen = sizeof(app);
if (RegQueryValueW(HKEY_CLASSES_ROOT, key, app, &applen) != ERROR_SUCCESS)
{
FIXME("default app name NIY %s\n", debugstr_w(key));
return 2;
WCHAR command[1024], fullpath[MAX_PATH];
static const WCHAR wSo[] = { '.','s','o',0 };
int sizeSo = sizeof(wSo)/sizeof(WCHAR);
LPWSTR ptr = NULL;
DWORD ret = 0;
/* Get application command from start string and find filename of application */
if (*start == '"')
{
strcpyW(command, start+1);
if ((ptr = strchrW(command, '"')))
*ptr = 0;
ret = SearchPathW(NULL, command, wszExe, sizeof(fullpath)/sizeof(WCHAR), fullpath, &ptr);
}
else
{
LPWSTR p,space;
for (p=(LPWSTR)start; (space=strchrW(p, ' ')); p=space+1)
{
int idx = space-start;
memcpy(command, start, idx*sizeof(WCHAR));
command[idx] = '\0';
if ((ret = SearchPathW(NULL, command, wszExe, sizeof(fullpath)/sizeof(WCHAR), fullpath, &ptr)))
break;
}
if (!ret)
ret = SearchPathW(NULL, start, wszExe, sizeof(fullpath)/sizeof(WCHAR), fullpath, &ptr);
}
if (!ret)
{
ERR("Unable to find application path for command %s\n", debugstr_w(start));
return ERROR_ACCESS_DENIED;
}
strcpyW(app, ptr);
/* Remove extensions (including .so) */
ptr = app + strlenW(app) - (sizeSo-1);
if (strlenW(app) >= sizeSo &&
!strcmpW(ptr, wSo))
*ptr = 0;
ptr = strrchrW(app, '.');
assert(ptr);
*ptr = 0;
}
strcpyW(endkey, wTopic);
......
......@@ -1099,7 +1099,7 @@ static dde_tests_t dde_tests[] =
{"", "[open(\"%1\")]", "shlexec", NULL, NULL, FALSE, "[open(\"%s\")]", 0x0, 33},
/* Test default DDE application */
{"", "[open(\"%1\")]", NULL, "dde", NULL, FALSE, "[open(\"%s\")]", 0x1, 33},
{"", "[open(\"%1\")]", NULL, "dde", NULL, FALSE, "[open(\"%s\")]", 0x0, 33},
{NULL, NULL, NULL, NULL, 0x0, 0}
};
......@@ -1284,37 +1284,37 @@ typedef struct
static dde_default_app_tests_t dde_default_app_tests[] =
{
/* Test unquoted existing filename with a space */
{"%s\\test file.exe", "test file", 0x1, 33},
{"%s\\test file.exe param", "test file", 0x1, 33},
{"%s\\test file.exe", "test file", 0x0, 33},
{"%s\\test file.exe param", "test file", 0x0, 33},
/* Test quoted existing filename with a space */
{"\"%s\\test file.exe\"", "test file", 0x1, 33},
{"\"%s\\test file.exe\" param", "test file", 0x1, 33},
{"\"%s\\test file.exe\"", "test file", 0x0, 33},
{"\"%s\\test file.exe\" param", "test file", 0x0, 33},
/* Test unquoted filename with a space that doesn't exist, but
* test2.exe does */
{"%s\\test2 file.exe", "test2", 0x1, 33},
{"%s\\test2 file.exe param", "test2", 0x1, 33},
{"%s\\test2 file.exe", "test2", 0x0, 33},
{"%s\\test2 file.exe param", "test2", 0x0, 33},
/* Test quoted filename with a space that does not exist */
{"\"%s\\test2 file.exe\"", "", 0x1, 5},
{"\"%s\\test2 file.exe\" param", "", 0x1, 5},
{"\"%s\\test2 file.exe\"", "", 0x0, 5},
{"\"%s\\test2 file.exe\" param", "", 0x0, 5},
/* Test filename supplied without the extension */
{"%s\\test2", "test2", 0x1, 33},
{"%s\\test2 param", "test2", 0x1, 33},
{"%s\\test2", "test2", 0x0, 33},
{"%s\\test2 param", "test2", 0x0, 33},
/* Test an unquoted non-existent filename */
{"%s\\notexist.exe", "", 0x1, 5},
{"%s\\notexist.exe param", "", 0x1, 5},
{"%s\\notexist.exe", "", 0x0, 5},
{"%s\\notexist.exe param", "", 0x0, 5},
/* Test an application that will be found on the path */
{"cmd", "cmd", 0x1, 33},
{"cmd param", "cmd", 0x1, 33},
{"cmd", "cmd", 0x0, 33},
{"cmd param", "cmd", 0x0, 33},
/* Test an application that will not be found on the path */
{"xyzwxyzwxyz", "", 0x1, 5},
{"xyzwxyzwxyz param", "", 0x1, 5},
{"xyzwxyzwxyz", "", 0x0, 5},
{"xyzwxyzwxyz param", "", 0x0, 5},
{NULL, NULL, 0, 0}
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment